my clock period is 1.28ns.
frequency is 781Mhz.
The above code is for clock generator. but in my case there is already one clock and I want to delay/shift it by random delay. My random delay should be 0 to 1.28ns. It should be added at the beginning of the clock. (In other words I just want to shift phase).
for example:
lets say first positive edge comes at 1ns without adding any delay.
Now, my random delay is 1ns which is from [0, 1.28]ns.
Now, 1st positive edge should come on at 2ns, so we are shifting entire clock by 1ns delay.
so can we do like this? or you can suggest better way.
real rand_val;
initial begin
rand_val = $urandom_range(0,128)/100.0;
`uvm_info(“DELTA”, $sformatf(“Randomized delta: %f”, rand_val), UVM_NONE);
end
always @(posedge clk) begin
//here we can add delay
end