Hi all,
I am trying to get the clock frequency of 2.4875Ghz
Eg:-
`timescale 1ns/1fs
realtime dly_time;
initial begin
dly_time=0.2010050;
forever begin #dly_time clk=~clk;
end
end
I am able to get 2.488Ghz clk frequency as the precision is rounding off the value 2.4875Gz to 2.488Ghz.
Could someone pls explain how I need to vary the `timescale in order to achieve 2.4875Ghz exactly?
Also would like to add:- I have tried changing the timescale with `timescale 1ns/10fs and 1ns/100fs - I wasn’t able to get clk frequency right as mentioned above.
In discrete event simulation, time gets represented by an integer, 64-bits in SystemVerilog. Converting decimal numbers to binary fractions does not always wind up with a number that fits into 64 bits, or even a rational number. You would need at least
But there is no need to get this level of accuracy in a digital logic simulation as long you as know what the simulated clock frequencies come out. The only thing that really matters is the relative ratios between what you are calling the 2.4875Ghz clock, and any other clocks that are some multiple/fraction of it.