User guide
24-164
SystemVerilog Testbench Constructs
Example 24-26
// Begin file example.sv
program test;
packet p;
p = new();
p.setLen(5000);
p.send();
p.setLen(10000);
p.send();
endprogram
class packet;
integer len;
task setLen( integer i);
len = i;
}
task send();
$display("Sending data\n”);
endtask
endclass
extends myaspect(packet);
around task send();
if (len < 8000){
proceed;
}
else{
$display("Dropping packet\n");
}
endtask
endextends
// End file example.sv
This Example 24-26 also demonstrates how the around advice code
can reference properties such as len in the packet object p. When
executed the output of the above example is,
Sending data
Dropping packet