Search code examples
verilogsystem-verilogreal-time-clocksystem-clockquestasim

Realtime CPU clock vs High Frequency Software clock


I am curious to learn about the technology which is used in generating software clock in simulators. The frequency of my machine is only ~2.4GHz but I can generate up to 500THz clock using a simulator(Refer below system Verilog snippet ).

`timescale 1fs/1fs;//This is the minimum time-unit and precision that can be used to generate 500THz clock
module temp();
  bit clk_b;
  always #1 clk_b =~ clk_b ;
endmodule

Is this higher frequency just a software illusion or does it have any link with CPU crystal oscillator?


Solution

  • The simulation does not "run" in realtime. So it will compute the result for the steps and if it is done it is done. Which means that the ratio between number of required steps (as well as problem complexity) and your computer performance will define how much time the simulation will need to finish. The timescale setting of the simulation is just what it says: a way to relate the simulation steps into a time(scale).

    So it is really an "illusion" if you want to call it so.