万分着急,,高人可以帮我写个拨码开关输入 ,,然后脉冲分频的程序不?
从0000 0000
到1111 1111
00000000不分频,,,00000001 就是2分频,,然后依次类推一直到11111111..哪个帮我写下,,,十万着急,,非常
刚才有个朋友有用VERLOG语言写了,,可以领导要我用VHDL,,,哪个朋友帮忙用VHDL转写下,,,,下个星期要出东西
占空比1:1,输入8'b00000000,输出持续低电平,输入8 'b00000001为1分频,依次8'b00000010为2分频,依次。
module clk_fenp(
clk_in,
clk_out,
switch_8bit_in
//test
//,clk_q1,clk_q2,count,count_clk
);
input clk_in;
input[7:0] switch_8bit_in;
output clk_out;
//,clk_q1,clk_q2;
reg[7:0] count_clk;
reg clk_q1,clk_q2;
//output[7:0] count,count_clk;
wire[7:0] count;
wire estop,switch_0,switch_1;
assign switch_0=switch_8bit_in==8'b00000000 ? 1'b1 : 1'b0;
assign switch_1=switch_8bit_in==8'b00000001 ? 1'b1 : 1'b0;
assign estop=switch_0 || switch_1;
assign count=switch_8bit_in[0] ? (switch_8bit_in-1)/2+1 : switch_8bit_in/2+1;
assign clk_out=switch_1 ? clk_in :
switch_8bit_in[0] ? (clk_q1 || clk_q2) : clk_q1;
always @(posedge estop or posedge clk_in)
if(estop)
begin
count_clk<=0;
clk_q1<=0;
end
else
if(count_clk<count-1)
begin
count_clk<=count_clk+1;
clk_q1<=1;
end
else
if(count_clk<switch_8bit_in-1)
begin
count_clk<=count_clk+1;
clk_q1<=0;
end
else
begin
count_clk<=0;
clk_q1<=0;
end
always @(posedge estop or negedge clk_in)
if(estop)
clk_q2<=0;
else
clk_q2<=clk_q1;
endmodule
VETLOG程序如上,,哪个朋友用VHDL改下下,,我才入门,,下星期就必须交差
DDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDD
要是有PLL或者DCM,可以把输入频率*2作为计数的时钟频率,然后进行偶数分频就可以了
哪个朋友可以用VHDL语言写下,,我十分着急
DDDDDDDDDD下个星期东西不出来十分麻烦
dddddddddddddddddddd
你出多少钱?
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
