1
\$\begingroup\$

enter image description here

What does #period indicate or mean in Verilog in general terms? I have posted the image just as an example.

toolic
10.8k11 gold badges31 silver badges35 bronze badges
asked Dec 2, 2022 at 6:13
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Timing control which is not synthesisable. \$\endgroup\$ Commented Dec 2, 2022 at 11:10

2 Answers 2

2
\$\begingroup\$

# is a timing control that can be used to add a delay in the simulator.

In your example, the duration of the delay is specified by timescale * period.

period has no special meaning. It's simply a localparam that holds the constant expression 20:

  • localparam period = 20;

According to the comment, the timescale has a unit of 1ns.

The timescale configuration should look something like this:

  • `timescale 1ns/1ps

Therefore the expression after #period; is delayed by 1ns * 20 = 20ns.

answered Dec 2, 2022 at 7:09
\$\endgroup\$
1
\$\begingroup\$

#period can have different meanings depending on the context where it is used.

In the example provided, it is a delay event control placed in front of an empty procedural statement. That means it suspends the currently executing process for 20 time units until proceeding to the statement that follows it.

#period can also be used

  • as a gate delay: not #period (out,int);
  • continuous assignment delay: assign #period A = B + C;
  • as a parameter value override in a module instance:
mymod #period mm(...);
...
module mymod #(P=0)(...);
endmodule
answered Dec 2, 2022 at 21:20
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.