User guide
2-31
Modeling Your Design
$display("%i");
if ($activescope("top.d0.block","top.d1.named"))
$display("%-i");
end
endmodule
The following is an example of a DirectC application that uses the
$activeinst system function:
module child;
initial discriminator.t;
endmodule
module top;
child c1();
child c2();
child c3();
child c4();
endmodule
In task t the following occurs:
1. The $activeinst system function returns a pointer to the
current scope, which is passed to the C function showInst. It is a
pointer to a volatile or temporary char buffer containing the name
of the instance.
extern void showInst(input bit[31:0]);
module discriminator;
task t;
reg[31:0] r;
begin
showInst($activeinst);
if($activeinst("top.c1", "top.c3"))
begin
r = $activeinst;
$display("for instance %i the pointer is %s", r ? "non-zero" : "zero");
end
end
endtask
declaration of C function named showInst
$activeinst system function without arguments
passed to the C function