verilog2.5分频设计
时间:10-02
整理:3721RD
点击:
就两行代码,就不写附件了,不好意思要钱。
觉得有用的可以看看启发一下思路,n.5分频都可以用这种方法实现。n越大,duty cycle越接近50%。tb太简单,想试试的自己写了
但我觉得还是有不妥之处,比如无法做到50% duty cycle,而且jitter可能比较大之类的。
大家对分频器还有什么好的思路?
module div2p5(
iclk,
rst_n,
oclkby2p5
);
input iclk;
input rst_n;
output oclkby2p5;
reg [2:0] count;
reg pos2p5, neg_pre2p5;
always @ (posedge iclk or negedge rst_n)
if(!rst_n)
begin
count <= 'b0;
pos2p5 <= 1'b0;
neg_pre2p5 <= 1'b0;
end
else
begin
count <= (count==3'b000)? 3'b100 : (count-1'b1);
pos2p5 <= (count == 3'b100 || count==3'b001);
neg_pre2p5 <= (count ==3'b100 || count == 3'b010);
end
reg neg2p5;
always @ (negedge iclk or negedge rst_n)
if(!rst_n)
neg2p5 <= 1'b0;
else
neg2p5 <= neg_pre2p5;
assign oclkby2p5 = pos2p5 | neg2p5;
endmodule
觉得有用的可以看看启发一下思路,n.5分频都可以用这种方法实现。n越大,duty cycle越接近50%。tb太简单,想试试的自己写了
但我觉得还是有不妥之处,比如无法做到50% duty cycle,而且jitter可能比较大之类的。
大家对分频器还有什么好的思路?
module div2p5(
iclk,
rst_n,
oclkby2p5
);
input iclk;
input rst_n;
output oclkby2p5;
reg [2:0] count;
reg pos2p5, neg_pre2p5;
always @ (posedge iclk or negedge rst_n)
if(!rst_n)
begin
count <= 'b0;
pos2p5 <= 1'b0;
neg_pre2p5 <= 1'b0;
end
else
begin
count <= (count==3'b000)? 3'b100 : (count-1'b1);
pos2p5 <= (count == 3'b100 || count==3'b001);
neg_pre2p5 <= (count ==3'b100 || count == 3'b010);
end
reg neg2p5;
always @ (negedge iclk or negedge rst_n)
if(!rst_n)
neg2p5 <= 1'b0;
else
neg2p5 <= neg_pre2p5;
assign oclkby2p5 = pos2p5 | neg2p5;
endmodule
可以,这样做出的时钟,在原时钟占空50%,稳定下,也是稳定的.是个实用的描述,谢谢.
以前我也想过用门延时去做2倍频,不知有人试过吗?
我公司的人用过,在FPGA里,就是要保证综合的时候门delay不被优化掉就好了,实际IC中没见到过。
好东西!谢谢
写的不错,很好,学习了,谢谢小编!
写的很好,学习了
