How do I create a clock with random starting phase?

Jul 31, 2006 1 Replies

Here is my code. I need that every time inject_tv is called, it will restart clock clk3_84m_0 for a unknown number of cycles, but with a random delay. Clk3_84m_0 shall change only until next time the event is called upon.



How can I achieve that?



Thanks in advance.


module mytest;



event start_clk_0; always @ (start_clk_0) begin clk3_84m_0


Why not assign a random value to a variable and then use a for loop to insert that number of much smaller (picosecond) delays.

for example: `timescale 1 ns / 1 ps

. . .

integer i; reg [16:0] r_shift;

. . . r_shift Thanks in advance.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required