User guide

24-162
SystemVerilog Testbench Constructs
constraint con1 {
myfield == 4;
}
endextends
Examples of advice code
In Example 24-23, the extends directive adds advices to the
packet::send method.
Example 24-23 :
// Begin file example.sv
program test;
packet p;
p = new();
p.send();
endprogram
class packet;
task send();
$display("Sending data\n”);
endtask
endclass
extends myaspect(packet);
before task send();
$display("Before sending packet\n");
endtask
after task send();
$display("After sending packet\n");
endtask
endextends
// End file example.sv
When Example 24-23 is executed, the output is:
Before sending packet
Sending data
After sending packet