User guide

24-163
SystemVerilog Testbench Constructs
In Example 24-24, extends directive myaspect adds advice to turn
off constraint c1 before each call to the foo::pre_randomize method.
Example 24-24 :
class foo;
rand integer myfield;
constraint c1 {
myfield == 4;
}
endclass
extends myaspect(foo);
before task pre_randomize();
constraint_mode(OFF, "c1")
endtask
endextends
In Example 24-23, extends directive myaspect adds advice to set a
property named valid to 0 after each call to the foo::post_randomize
method.
Example 24-25 :
class foo;
integer valid;
rand integer myfield;
constraint c1 {
myfield == 4;
}
endclass
extends myaspect(foo);
after task post_randomize();
valid = 0;
endtask
endextends
Example 24-25 shows an aspect extension that defines an around
advice for the class method packet::send. When the code in example
is compiled and run, the around advice code is executed instead of
original packet::send code.