User guide

24-155
SystemVerilog Testbench Constructs
Because advices are woven after introductions have been added to
the class definitions, advices can be specified for introduced
member methods and can reference introduced symbols.
An advice to a class method can access and modify the member
fields and methods of the class object to which the class method
belongs. An advice to a class function can access and modify the
variable that stores the return value of the function.
Furthermore, members of the original class definition can also
reference symbols introduced by aspect extensions using the extern
declarations (?). Extern declarations can also be used to reference
symbols introduced by an aspect extension to a class in some other
aspect extension code that extends the same class.
An introduction that has the same identifier as a symbol that is
already defined in the target scope as a member property or member
method is not permitted.
Examples:
Example 24-17
// Begin file example.vr
program top;
packet p;
p = new();
p.foo();
endprogram
class packet;
task foo(integer x); //Formal argument is "x"
$display("x=%0d\n", x);
endtask
endclass
extends myaspect(packet);
// Make packet::foo always print: "x=99"