VMM Consumers

This file defines the following VMM consumer components.

Summary
VMM Consumers
This file defines the following VMM consumer components.
vmm_consumerA simple VMM consumer xactor that gets transactions from a channel and “executes” them by printing them and delaying a bit.
in_chanThe vmm_channel from which new transasctions are obtained.
newThe standard constructor for a vmm_xactor: inst name, stream_id, and an optional input vmm_channel handle.
mainA process that continually peeks transactions from in_chan, prints it, waits a bit, then pops it off the channel to unblock the producer.
vmm_watcherReceives data via notification status
INCOMINGThe notification id upon which this component will wait for a transaction.
sbd_chanA channel into which the received data is sneaked and from which the main method gets the data, so that the tee() call in the scoreboard will also see it.
newCreates a new instance of this class with name specified in inst argument.
mainA process that continually gets transactions from sbd_chan, so that the scoreboard’s tee() method will see it.
indicatedWhen the INCOMING notification is indicated, the incoming transaction is passed to this function for processing.
vmm_notifier_consumer
in_chanThe vmm_channel from which new transasctions are obtained.
newThe standard constructor for a vmm_xactor: inst name, stream_id, and an optional input vmm_channel handle.
mainA process that continually peeks transactions from in_chan, prints it, waits a bit, then pops it off the channel to unblock the producer.
vmm_pipelined_consumer
req_chanThe vmm_channel from which new transasctions are obtained.
newThe standard constructor for a vmm_xactor: inst name, stream_id, and an optional input vmm_channel handle.
mainA process that continually peeks transactions from req_chan, prints it, waits a bit, then pops it off the channel to unblock the producer.

vmm_consumer

A simple VMM consumer xactor that gets transactions from a channel and “executes” them by printing them and delaying a bit.  A real consumer would naturally do something more substantive with each transaction.

class vmm_consumer #(type T=vmm_data) extends vmm_xactor;

   // Variable: in_chan
   //
   // The vmm_channel from which new transasctions are obtained.

   vmm_channel_typed #(T) in_chan;

   int stop_after_n_insts = -1;
   int num_insts = 0;
   int DONE;

   // Function: new
   //
   // The standard constructor for a vmm_xactor: inst name,
   // stream_id, and an optional input vmm_channel handle.
   // If the in_chan handle is not given, a new default channel
   // is created.

   function new(string inst,
                int unsigned stream_id=-1,
                vmm_channel_typed #(T) in_chan=null
                `VMM_XACTOR_NEW_ARGS);

     super.new("vmm_consumer #(T)", inst, stream_id `VMM_XACTOR_NEW_CALL);
     if (in_chan == null)
        in_chan = new("vmm_channel #(T)","in_chan");

     this.in_chan = in_chan;

     DONE = this.notify.configure(-1, vmm_notify::ON_OFF);

   endfunction: new


   // Task: main
   //
   // A process that continually peeks transactions from <in_chan>,
   // prints it, waits a bit, then pops it off the channel to unblock
   // the producer.

   virtual protected task main();

     fork
       super.main();
     join_none

      while (this.stop_after_n_insts <= 0 ||
             this.num_insts < this.stop_after_n_insts) begin

       T tr;

       this.wait_if_stopped_or_empty(this.in_chan);

       this.in_chan.peek(tr);

       `vmm_note(log, {"Received transaction ", tr.psdisplay()});
       #100;


       this.in_chan.get(tr); // pop

       num_insts++;

     end

     this.notify.indicate(DONE);
     this.notify.indicate(XACTOR_STOPPED);
     this.notify.indicate(XACTOR_IDLE);
     this.notify.reset(XACTOR_BUSY);

   endtask: main

endclass

in_chan

vmm_channel_typed #(T) in_chan

The vmm_channel from which new transasctions are obtained.

new

function new(string inst,  
int unsigned stream_id = -1,
vmm_channel_typed #(T) in_chan = null `VMM_XACTOR_NEW_ARGS)

The standard constructor for a vmm_xactor: inst name, stream_id, and an optional input vmm_channel handle.  If the in_chan handle is not given, a new default channel is created.

main

virtual protected task main()

A process that continually peeks transactions from in_chan, prints it, waits a bit, then pops it off the channel to unblock the producer.

vmm_watcher

Receives data via notification status

class vmm_watcher #(type T=int) extends vmm_xactor;

  // Variable: INCOMING
  //
  // The notification id upon which this component will wait for a transaction.
  // Components wanting to source transaction to this component must call
  // this.notify(INCOMING,<transaction>), where <transaction> is the handle
  // to any vmm_data-based transaction.

  int INCOMING;

  // Variable: sbd_chan
  //
  // A channel into which the received data is sneaked and from which the
  // main method gets the data, so that the tee() call in the
  // scoreboard will also see it.

  vmm_channel_typed #(T) sbd_chan;

  // Function: new
  //
  // Creates a new instance of this class with name specified in ~inst~
  // argument. The INCOMING notification is configured, and a callback is
  // registered to call this component's <indicated> method when the
  // INCOMING notification is indicated.

  function new(string inst);
    vmm_watcher_cb #(vmm_watcher #(T)) cb;
    super.new("vmm_watcher",inst);
    INCOMING = notify.configure(-1,vmm_notify::ONE_SHOT);
    cb = new(this);
    notify.append_callback(INCOMING,cb);
    sbd_chan = new("vmm_channel","Scoreboard channel");
  endfunction

   // Task: main
   //
   // A process that continually gets transactions from sbd_chan,
   // so that the scoreboard's tee() method will see it.

   virtual protected task main();
     T tmp;
     fork
       super.main();
     join_none

     while (1)
       sbd_chan.get(tmp);
   endtask // main


  // Function: indicated
  //
  // When the INCOMING notification is indicated, the incoming transaction
  // is passed to this function for processing.

  virtual function void indicated(vmm_data status);
    `vmm_note(log,{"Received transaction ",status.psdisplay()});
    sbd_chan.sneak(status);
  endfunction

endclass

INCOMING

int INCOMING

The notification id upon which this component will wait for a transaction.  Components wanting to source transaction to this component must call this.notify(INCOMING,<transaction>), where <transaction> is the handle to any vmm_data-based transaction.

sbd_chan

vmm_channel_typed #(T) sbd_chan

A channel into which the received data is sneaked and from which the main method gets the data, so that the tee() call in the scoreboard will also see it.

new

function new(string inst)

Creates a new instance of this class with name specified in inst argument.  The INCOMING notification is configured, and a callback is registered to call this component’s indicated method when the INCOMING notification is indicated.

main

virtual protected task main()

A process that continually gets transactions from sbd_chan, so that the scoreboard’s tee() method will see it.

indicated

virtual function void indicated(vmm_data status)

When the INCOMING notification is indicated, the incoming transaction is passed to this function for processing.

in_chan

vmm_channel_typed #(T) in_chan, out_chan

The vmm_channel from which new transasctions are obtained.

new

function new(string inst,  
int unsigned stream_id = -1,
vmm_channel_typed #(T) in_chan = null,
vmm_channel_typed #(T) out_chan = null `VMM_XACTOR_NEW_ARGS)

The standard constructor for a vmm_xactor: inst name, stream_id, and an optional input vmm_channel handle.  If the in_chan handle is not given, a new default channel is created.

main

virtual protected task main()

A process that continually peeks transactions from in_chan, prints it, waits a bit, then pops it off the channel to unblock the producer.

req_chan

vmm_channel_typed #(T) req_chan, rsp_chan

The vmm_channel from which new transasctions are obtained.

new

function new(string inst,  
int unsigned stream_id = -1,
vmm_channel_typed #(T) req_chan = null,
vmm_channel_typed #(T) rsp_chan = null `VMM_XACTOR_NEW_ARGS)

The standard constructor for a vmm_xactor: inst name, stream_id, and an optional input vmm_channel handle.  If the req_chan handle is not given, a new default channel is created.

main

virtual protected task main()

A process that continually peeks transactions from req_chan, prints it, waits a bit, then pops it off the channel to unblock the producer.

vmm_channel_typed #(T) in_chan
The vmm_channel from which new transasctions are obtained.
function new(string inst,  
int unsigned stream_id = -1,
vmm_channel_typed #(T) in_chan = null `VMM_XACTOR_NEW_ARGS)
The standard constructor for a vmm_xactor: inst name, stream_id, and an optional input vmm_channel handle.
virtual protected task main()
A process that continually peeks transactions from in_chan, prints it, waits a bit, then pops it off the channel to unblock the producer.
int INCOMING
The notification id upon which this component will wait for a transaction.
vmm_channel_typed #(T) sbd_chan
A channel into which the received data is sneaked and from which the main method gets the data, so that the tee() call in the scoreboard will also see it.
virtual function void indicated(vmm_data status)
When the INCOMING notification is indicated, the incoming transaction is passed to this function for processing.
vmm_channel_typed #(T) req_chan, rsp_chan
The vmm_channel from which new transasctions are obtained.