This base class is to be used as the basis for all transactors, including bus-functional models, monitors and generators. It provides a standard control mechanism expected to be found in all transactors.
virtual function void start_xactor();
Starts the execution threads in this transactor instance. This method is called by Environment class which is extended from vmm_env start() method.
virtual function void stop_xactor();
Stops the execution threads in this transactor instance. This method is called by Environment class which is extended from vmm_env stop() method.
protected task wait_if_stopped()
protected task wait_if_stopped_or_empty(vmm_channel chan)
Blocks the thread execution if the transactor has been stopped via the stop_xactor() method or if the specified input channel is currently empty.
protected virtual task main();
This task is forked off whenever the start_xactor() method is called. It is terminated whenever the reset_xactor() method is called. The functionality of a user-defined transactor must be implemented in this method.
Let us see an example of using vmm_xactor.
1) Extend vmm_xactor to create a custom_xtor.
class Driver extends vmm_xactor;
2) Define constructor. In this example, we don't have any interfaces of channels, we will not implement them.
Call the super.new() method.
function new();
super.new("Driver Transactor", "inst", 0);
endfunction: new
3) Define main() method.
First call the super.main() method.
Then define the activity which you want to do.
task main();
super.main();
foreverbegin #100;
$display(" Driver : %d",$time);
end endtask: main
Now we will see how to use the above defined Custom_xtor class.
1) Create a object of Custom_xtor.
Driver drvr = new();
2) Call the start_xactor() methods of Custom_xtor object.
Now the main() method which is defined starts gets executed.
#100 drvr.start_xactor();
3) Call the stop_xactor() methos.
This will stop the execution of main() method.
#1000 drvr.stop_xactor();
Complete Vmm_xactor Example
class Driver extends vmm_xactor;
function new();
super.new("Driver Transactor", "inst", 0);
endfunction: new
task main();
super.main();
foreverbegin #100;
$display(" Driver : %d",$time);
end endtask: main