User guide

24-138
SystemVerilog Testbench Constructs
The following table shows the rest of the steps involved in weaving
of the advice for each type of placement element (before, after, and
around).
Within an extends directive, you can specify only one advice can be
specified for a given placement element and a given method. For
example, an extends directive may contain a maximum of one
before, one after, and one around advice each for a class method
Packet::foo of a class Packet, but it may not contain two before
advices for the Packet::foo.
Target method:
task myTask();
$display("Executing original code\n");
endtask
Table 24-4 Placement Elements
Element Description
before Inserts a new method-call statement
that calls an advice method. The
statement is inserted as the first
statement to be executed before any
other statements.
after Creates a new method A with the target
method prototype, with its first
statement being a call to the target
method. Second statement with A is a
new method call statement that calls
the advice method. All the instances
in the input program where the target
method is called are replaced by newly
created method calls to A. A is
replaced as the new target method.
around All the instances in the input program
where the target method is called are
replaced by newly created method calls
to the advice method.