What does #`DEL mean in verilog?

2019-01-26 20:15发布

问题:

I saw some statements in the form of below. What does #`DEL mean here? I just have basic understanding on verilog, and cannot find its meaning easily because it contains special character.

cmd <= #`DEL 32`b0

回答1:

It is a delay statement.

Delaying the assign of value on the Righthand side to the lefthand side by the defined amount, in this case delaying cmd becoming zero.

The delay can be specified in any time or realtime format, #1 would be 1 timestep as defined by the ...

#1ns, #1us, #1ms and more are available in SystemVerilog.

A more typical case would be with a non-constant right hand side.

assign a = #1ns b;

Here a will lag b by 1 ns.

Reference to this can be found in Language Reference Manual LRM by searching for 'delay_value'.



回答2:

The code in question delays the assignment by some amount. The #`DEL (can't use inline coding because of the backtick) has 3 parts. First, the # indicates that this is a delay statement. Next, the backtick (the character underneath the ~) indicates a preprocessor definition in Verilog; somewhere in the code you're compiling you will have something along the following lines:

`define DEL 1ns

Where 1ns might be any time value, which will be the delay. We should be clear here that there should be a backtick (under the ~) before DEL, whereas 32'b0 uses a single quote.



标签: verilog