Differences and usage scenarios of $monitor, $strobe, $write and $display

$display and $strobe

Consider the following example:

The result is as follows:

Here, the $display statement is executed in the active area, while the assignment statement on line 44 is executed in the NBA area, so the value of a printed by $display is the previous value;

As for $strobe, it starts to print after all the operations are executed every time #5, so the value printed by $strobe is the value after each update of a;

To sum up: when $strobe is called, all statements are executed, and $strobe prints the text, which includes blocking and non-blocking operations; while $display prints the parameters filled in when the function is executed;

If the above non-blocking assignment is changed to blocking assignment, the result is as follows:

 Both blocking assignment and $display are executed in the active area, but the assignment comes first and the print comes later, so $display and $strobe print the updated value;

$display 与 $write

The difference between the two is that the former will wrap automatically, but the latter will not, as in the following example:

The result is as follows:

 $display and $monitor

$monitor is used to monitor the changes of parameters, and will print if the parameters change; see the following example:

 The result is as follows:

If the above $monitor is called twice, as follows:

The result is as follows:

It can be seen that only the second $monitor is printed here, because $monitor has a single process , that is, each timing slot will only be executed once, and one of the two $monitors will be automatically closed at the same time. If you want to monitor at the same time For multiple signals, multiple signals need to be written to the parameter list of the same $monitor, as follows:

 The result is as follows:

 

 

 

 

Guess you like

Origin blog.csdn.net/bleauchat/article/details/121717656