PDF download Download Article
Learn the dos and don'ts for using 1 picosecond (1ps) in Verilog
PDF download Download Article

1ps is a unit of measurement in the Verilog timescale compiler directive. It stands for 1 picosecond, or 1 trillionth of a second. The `timescale directive, which determines the unit of time for a simulation and rounds the outputs, can be tricky, so keep reading to see how to set up a module and record outputs in Verilog.

1ps in Verilog Timescale

1ps stands for 1 picosecond, which is equal to 1 trillionth of a second, and refers to one unit in Verilog timescale. The `timescale directive is written as `timescale [time unit]/[resolution]. The first unit sets the timescale of the module, and the resolution sets how far the outputs are rounded.

Section 2 of 3:

How to Use the Verilog Timescale Directive

PDF download Download Article
  1. In Verilog, the timescale directive is written as `timescale integer [time unit] / integer [resolution]. When choosing your units, always put the larger one first. The general time scale must be divisible by the resolution. [2]
    • The first unit is how time is measured, and the second is how precise your recordings are. [3]
    • The ` symbol, or backtick, lets the program know that you’re using a compiler directive. It introduces the `timescale directive, as well as `include, `resetall, `define, and others. [4]
  2. Finish setting the timescale by choosing one of three integers to put before your units: 1, 10, or 100. [5] By adding an integer you can control how much time makes up a single unit or how many units go into the resolution.
    • For example, if you write the directive `timescale 10ns / 1ns, then for every 10 nanoseconds the output value will be rounded to the nearest nanosecond. [6]
    • A common timescale is 1ns / 1ps, which means at each nanosecond there is an output rounded to the nearest picosecond.
  3. Test benches run a simulation of your design, and check the outputs. [7] Set up your module by writing:
    • `timescale [unit of time]/[unit of precision]
    • module tb;
    • reg val;
    • initial begin
    • val<=[where you want to start];
  4. To program when your data is recorded, write the operator #[real number] and then a function. The operator # (AKA the delay) is multiplied by the time unit, then rounded to the nearest time precision unit (resolution). [8] For example, you could write
    • #5 $display (“T=%0t At time #5”, $realtime);
    • val<=1;
    • If your `timescale is 1ns/1ns, then your output would be 1(ns) * 5 = 5 since it’s rounded to the nearest nanosecond.
    • If your `timescale was 10ns/1ns, then your output would be 10(ns) * 5 = 50.
    • If your `timescale was 1ns/1ps, then your output would be 1000ps (AKA 1ns) * 5 = 5000 to convert it to picoseconds.
  5. To end the simulation, write #[real number] before the function $display (“T=%0t End of simulation”, $realtime); then write the codes “end,” then “endmodule”. “End” closes the block “initial begin,” and “endmodule” closes the “module” block. [9]
    • Your entire simulation may look like this:
      • `timescale 1ns/1ps
      • module tb;
      • reg val;
      • initial begin
      • val<=0;
      • #1 $display (“T=%0 At time #1”, $realtime);
      • val<=1;
      • #5 $display (“T=%0t End of simulation”, $realtime);
      • end
      • endmodule
  6. Advertisement
Section 3 of 3:

Other Meaning of 1ps

PDF download Download Article
  1. Video games that are in first-person perspective are often called first-person shooters, more often abbreviated as FPS. Occasionally, they’re also abbreviated to “1ps.”
  2. Sometimes, IPS refers to a unit of measurement for acceleration, which is inches per second. [10] When it’s being used for a change in velocity (acceleration), it’s written as inches per second 2 .
  3. IPS (in-plane switching) monitors are a kind of LCD screen where liquid crystals are sandwiched between two planes of glass. [11]
  4. IPS can also mean “intrusion prevention systems,” which block attacks on networks and computers. [12]
  5. Advertisement

Expert Q&A

Ask a Question
      Advertisement

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!
      Advertisement

      About This Article

      Thanks to all authors for creating a page that has been read 1,024 times.

      Is this article up to date?

      Advertisement