|HOME |ABOUT |ARTICLES |ACK |FEEDBACK |TOC |LINKS |BLOG |JOBS |


Tutorials



VMM XACTOR



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();

   forever begin
        #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();

   forever begin
        #100;
        $display(" Driver : %d",$time);
   end
endtask: main

endclass:Driver


program test();

  Driver drvr = new();
  
  initial
     fork
      #100 drvr.start_xactor();
      #1000 drvr.stop_xactor();
     join
endprogram

Download the files

vmm_xactor.tar
Browse the code in vmm_xactor.tar

Command to run the simulation
vcs -sverilog -f filelist -R -ntb_opts rvm -ntb_opts dtm

Log file report

 Driver :                  200
 Driver :                  300
 Driver :                  400
 Driver :                  500
 Driver :                  600
 Driver :                  700
 Driver :                  800
 Driver :                  900
 Driver :                 1000
$finish at simulation time                 1000


Vmm_xactor Members

function new ( string name, string instance, int stream_id = -1 );
virtual function string get_name ( );
virtual function string get_instance ( );
vmm_log log;
int stream_id;
virtual function void prepend_callback ( vmm_xactor_callbacks cb );
virtual function void append_callback ( vmm_xactor_callbacks cb );
virtual function void unregister_callback ( vmm_xactor_callbacks cb );
vmm_notify notify;
// Enumeration values for the state of the transactor:
enum { XACTOR_IDLE, XACTOR_BUSY,
XACTOR_STARTED, XACTOR_STOPPED, XACTOR_RESET };
virtual function void start_xactor ( );
virtual function void stop_xactor ( );
virtual function void reset_xactor ( reset_e rst_typ = SOFT_RST );
protected task wait_if_stopped ( );
protected task wait_if_stopped_or_empty ( vmm_channel chan );
protected virtual task main ( );
virtual function void save_rng_state ( );
virtual function void restore_rng_state ( );
virtual function void xactor_status ( string prefix = "" );
// Macro to simplify the calling of callback methods:
`vmm_callback ( callback_class_name, method ( args ) )

Index
Introduction
Vmm Log
Vmm Env
Vmm Data
Vmm Channel
Vmm Atomic Generator
Vmm Xactor
Vmm Callback
Vmm Test
Vmm Channel Record And Playback
Vmm Scenario Generator
Vmm Opts

Report a Bug or Comment on This section - Your input is what keeps Testbench.in improving with time!





<< PREVIOUS PAGE

TOP

NEXT PAGE >>

copyright © 2007-2017 :: all rights reserved www.testbench.in::Disclaimer