M
masoodtahir
Guest
I have a clock named "clk" with clock period of 200ps(50%duty cycle).
I want to introduce a drift of 1ps every clock cycle. Please look at
this short piece of verilog code which I thought would do this. In the
simulation, I see that for the first 100 cycles, the positive edges of
clk and delayed_clk keep moving apart from each other by 1ps, 2ps,
3ps....all the way to 100ps, which is what I intended the code to do.
Then at 101th clock, the delayed_clk remains asserted for the next 100
cycles. Then at cycle#200, the edges of clk and delayed_clk align
again, and the process is repeated.
Any idea what I am missing here? I expected that the rising edges of
clk and delayed_clk would be 101ps apart in cycle # 101, then 102ps
apart in cycle#102, all the way to 199ps apart in cycle#199 and then
align again in cycle#200. Any idea how to do this?
wire delayed_clk;
integer acc_driftdelay=0; // accumulate drift delay
always @(posedge clk)
begin
if (acc_driftdelay ==200)
acc_driftdelay = 0;
else
acc_driftdelay = acc_driftdelay + 1;
end
assign #acc_driftdelay delayed_clk = clk;
I want to introduce a drift of 1ps every clock cycle. Please look at
this short piece of verilog code which I thought would do this. In the
simulation, I see that for the first 100 cycles, the positive edges of
clk and delayed_clk keep moving apart from each other by 1ps, 2ps,
3ps....all the way to 100ps, which is what I intended the code to do.
Then at 101th clock, the delayed_clk remains asserted for the next 100
cycles. Then at cycle#200, the edges of clk and delayed_clk align
again, and the process is repeated.
Any idea what I am missing here? I expected that the rising edges of
clk and delayed_clk would be 101ps apart in cycle # 101, then 102ps
apart in cycle#102, all the way to 199ps apart in cycle#199 and then
align again in cycle#200. Any idea how to do this?
wire delayed_clk;
integer acc_driftdelay=0; // accumulate drift delay
always @(posedge clk)
begin
if (acc_driftdelay ==200)
acc_driftdelay = 0;
else
acc_driftdelay = acc_driftdelay + 1;
end
assign #acc_driftdelay delayed_clk = clk;