User guide

2-30
Modeling Your Design
Returning Information About the Scope
The $activeinst system function returns information about the
module instance that contains this system function. The
$activescope system function returns information about the scope
that contains the system function. This scope can be a module
instance, or a named block, or a user-defined task, or a function in a
module instance.
When VCS executes these system functions it does the following:
1. Stores the current scope in a temporary location.
2. If there are no arguments it returns a pointer to the temporary
location. Pointers are not used in Verilog but they are in DirectC
applications.
The possible arguments are hierarchical names. If there are
arguments it compares them from left to right with the current
scope. If an argument matches, the system function returns a
32-bit non-zero value. If none of the arguments match the current
scope, the system function returns a 32-bit zero value.
The following example contains these system functions:
module top;
reg r1;
initial
r1=1;
dev1 d1(r1);
endmodule
module dev1(in);
input in;
always @ (posedge in)
begin:named
if ($activeinst("top.d0","top.d1"))