monitor verilog
Hi ASIC_intl,
$monitor, once invoked, continuously monitors the values of the variables/signals specified in the parameter list and displays all the parameters in the list whenever the value of ANY one of the variables/signals changes.
Since this system task continuously monitors the values, it needs to be invoked only once and hence, it is typically invoked in the initial block since the initial block is also invoked only once during the length of the simulation.
However, it is not necessary that the $monitor statement HAS to be invoked through the initial block. You can invoke it in any procedural block (like always block). In fact, it may be invoked multiple times in conjunction with $monitoron and $monitoroff statements.
Hope this helps.
Regards,
Saurabh