How to get a module to display it's own instance name?

M

Mike Sendrove

Guest
Hi:
Is it possible to get a testbench model (in this case, a RAM, but that's
irrelevant) to report its own instance name using a $display or similar
construct? I assume there's some sort of parameter built in to the language,
but I can;t for the life of me find it.
I am currently using VCS and nc/xl simulators.
Many thanks,
Mike
 
"Mike Sendrove" <michael.sendrovePANTS@ntlworld.PANTScom>
wrote in message news:nBo*X3u5p@news.cam.globespanvirata.com...

Is it possible to get a testbench model (in this case, a RAM, but that's
irrelevant) to report its own instance name using a $display or similar
construct?
$display("%m")


--

Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail: jonathan.bromley@doulos.com
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
"Mike Sendrove" <michael.sendrovePANTS@ntlworld.PANTScom> wrote in message news:<nBo*X3u5p@news.cam.globespanvirata.com>...
Is it possible to get a testbench model (in this case, a RAM, but that's
irrelevant) to report its own instance name using a $display or similar
construct? I assume there's some sort of parameter built in to the language,
but I can;t for the life of me find it.
A %m in a $display format will print the full hierarchical name of the
scope in which it appears (generally a module instance). The %m does
not use up one of the arguments to the $display, since it is not printing
one of them.
 
"Mike Sendrove" <michael.sendrovePANTS@ntlworld.PANTScom> wrote in message news:<nBo*X3u5p@news.cam.globespanvirata.com>...
Hi:
Is it possible to get a testbench model (in this case, a RAM, but that's
irrelevant) to report its own instance name using a $display or similar
construct? I assume there's some sort of parameter built in to the language,
but I can;t for the life of me find it.
I am currently using VCS and nc/xl simulators.
Many thanks,
Mike
%m will do it:

module a ();
b b ();
endmodule

module b ();
initial
$display("My instance name is %m"); // My instance name is a.b
endmodule


Regards,
Alexander
 

Welcome to EDABoard.com

Sponsor

Back
Top