How do I print the name of the module


#1

In my Verilog test bench, I have $display statements in several modules. How do I print the name of the module from there the statement is being printed?


#2

%m displays the hierarchical name of the module where the print is executed from.

For example:

module utils();
    ...
    $display("%m, @%0t: In task module", $time);
    ...
endmodule

Output:

utils, @100: In task module