大家帮我分析下这个程序能实现占空比为50%的num分频吗?谢谢
大家帮我分析下这个程序能实现占空比为50%的num分频吗?谢谢always @(posedge clk_50M)
begin
if(flag1==1)
begin
if(cnt == (num-2)/2)//pc communication set 13
begin
outp_1<= 1'b1;
cnt <= cnt + 16'd1;
end
else if(cnt == (num-1))//pc communication set 26
begin
outp_1<= 1'b0;
cnt <= 16'd0;
end
else
begin
cnt <= cnt + 16'd1;
end
end
end 这个对于num是偶数的倒是可以的,如果为奇数的话就不能了,需要另寻它法了。 并且前提条件是flag1==1的前提条件下才可以分频的,你的代码风格需要改进,存在隐含的锁存器
页:
[1]