Verilog: Timescales

As we are aware, compiler directive `timescale in Verilog is a tricky topic and have many discussion around it.

Timescale specifies the time unit and time precision of a module that follow it. The simulation time and delay values are measured using time unit. The precision factor is needed to measure the degree of accuracy of the time unit, in other words how delay values are rounded before being used in simulation.

Let’s have a look into it and see how time units and precision are taken to calculate simulation time.

In the examples, following time scale /time precision combinations are used.

The rval changes in different time-steps but due to the differences in timescale directives the simulation time varies.

In the below code, timescale is `timescale 1ps / 1ps.

To find out number of digits taken after decimal, first divide time scale with time precision. The exponent number will be your result.

Here, 1ps/1ps = 1 = 100, as the result is 100, NO digit will be taken after decimal. So 10.566601 will be 11 and next time step 21.546604 will be just 22.

Check below result to see all simulation time for rval. Also note that simulation ends at 100 PS.

Now, let us check one more example. In module timescale_check2, timescale is 1ns / 1ps.

Timescale/Time Precision = 1ns/1ps = 1000 = 103 So 3 digits after decimal will be used. In this case 10.566601 becomes 10567 and 21.546604 becomes 21547.

Below examples show simulation results for timescales 100ns/1ns, 1ms / 1us and 10 ms / 10 ns.

Sini Balakrishnan

Sini Balakrishnan

Staff Engineer at Intel
Sini has spent more than a dozen years in the semiconductor industry, focusing mostly on verification. She is an expert on Formal Verification and has written international papers and articles on related topics.
Sini Balakrishnan

Latest posts by Sini Balakrishnan (see all)


  1. muvva


    your explanation is very nice, but still i had a small difficulty.

    according you both 1ps/1ps and 1ns/1ns has to give same answer as both give 10^0 only, but i am getting different results.

    with no provision i failed attach the image, if you give your mail id i can post the simulation results.

    thanking you,

Leave a Reply

Your email address will not be published. Required fields are marked *