uvm_reg_fifo

This special register models a DUT FIFO accessed via write/read, where writes push to the FIFO and reads pop from it.

Backdoor access is not enabled, as it is not yet possible to force complete FIFO state, i.e. the write and read indexes used to access the FIFO data.

Summary
uvm_reg_fifo
This special register models a DUT FIFO accessed via write/read, where writes push to the FIFO and reads pop from it.
Class Hierarchy
uvm_reg_fifo
Class Declaration
class uvm_reg_fifo extends uvm_reg
fifoThe abstract representation of the FIFO.
Initialization
newCreates an instance of a FIFO register having size elements of n_bits each.
set_compareSets the compare policy during a mirror (read) of the DUT FIFO.
Introspection
sizeThe number of entries currently in the FIFO.
capacityThe maximum number of entries, or depth, of the FIFO.
Access
writePushes the given value to the DUT FIFO.
readReads the next value out of the DUT FIFO.
setPushes the given value to the abstract FIFO.
updatePushes (writes) all values preloaded using set() to the DUT.
mirrorReads the next value out of the DUT FIFO.
getReturns the next value from the abstract FIFO, but does not pop it.
do_predictUpdates the abstract (mirror) FIFO based on write() and read() operations.
Special Overrides
pre_writeSpecial pre-processing for a write() or update().
pre_readSpecial post-processing for a write() or update().

fifo

rand uvm_reg_data_t fifo[$]

The abstract representation of the FIFO.  Constrained to be no larger than the size parameter.  It is public to enable subtypes to add constraints on it and randomize.

new

function new(
    string  name  =  "reg_fifo",
    int  unsigned  size,   
    int  unsigned  n_bits,   
    int  has_cover   
)

Creates an instance of a FIFO register having size elements of n_bits each.

set_compare

function void set_compare(
    uvm_check_e  check  =  UVM_CHECK
)

Sets the compare policy during a mirror (read) of the DUT FIFO.  The DUT read value is checked against its mirror only when both the check argument in the mirror() call and the compare policy for the field is UVM_CHECK.

size

function int unsigned size()

The number of entries currently in the FIFO.

capacity

function int unsigned capacity()

The maximum number of entries, or depth, of the FIFO.

write

Pushes the given value to the DUT FIFO.  If auto-prediction is enabled, the written value is also pushed to the abstract FIFO before the call returns.  If auto-prediction is not enabled (via uvm_reg_map::set_auto_predict), the value is pushed to abstract FIFO only when the write operation is observed on the target bus.  This mode requires using the uvm_reg_predictor class.  If the write is via an update() operation, the abstract FIFO already contains the written value and is thus not affected by either prediction mode.

read

Reads the next value out of the DUT FIFO.  If auto-prediction is enabled, the frontmost value in abstract FIFO is popped.

set

virtual function void set(
    uvm_reg_data_t  value,   
    string  fname  =  "",
    int  lineno  =  0
)

Pushes the given value to the abstract FIFO.  You may call this method several times before an update() as a means of preloading the DUT FIFO.  Calls to set() to a full FIFO are ignored.  You must call update() to update the DUT FIFO with your set values.

update

virtual task update(
    output  uvm_status_e  status,   
    input  uvm_path_e  path  =  UVM_DEFAULT_PATH,
    input  uvm_reg_map  map  =  null,
    input  uvm_sequence_base  parent  =  null,
    input  int  prior  =  -1,
    input  uvm_object  extension  =  null,
    input  string  fname  =  "",
    input  int  lineno  =  0
)

Pushes (writes) all values preloaded using set() to the DUT.  You must update after set before any blocking statements, else other reads/writes to the DUT FIFO may cause the mirror to become out of sync with the DUT.

mirror

Reads the next value out of the DUT FIFO.  If auto-prediction is enabled, the frontmost value in abstract FIFO is popped.  If the check argument is set and comparison is enabled with set_compare().

get

virtual function uvm_reg_data_t get(
    string  fname  =  "",
    int  lineno  =  0
)

Returns the next value from the abstract FIFO, but does not pop it.  Used to get the expected value in a mirror() operation.

do_predict

virtual function void do_predict(
    uvm_reg_item  rw,   
    uvm_predict_e  kind  =  UVM_PREDICT_DIRECT,
    uvm_reg_byte_en_t  be  =  -1
)

Updates the abstract (mirror) FIFO based on write() and read() operations.  When auto-prediction is on, this method is called before each read, write, peek, or poke operation returns.  When auto-prediction is off, this method is called by a uvm_reg_predictor upon receipt and conversion of an observed bus operation to this register.

If a write prediction, the observed write value is pushed to the abstract FIFO as long as it is not full and the operation did not originate from an update().  If a read prediction, the observed read value is compared with the frontmost value in the abstract FIFO if set_compare() enabled comparison and the FIFO is not empty.

pre_write

virtual task pre_write(
    uvm_reg_item  rw
)

Special pre-processing for a write() or update().  Called as a result of a write() or update().  It is an error to attempt a write to a full FIFO or a write while an update is still pending.  An update is pending after one or more calls to set().  If in your application the DUT allows writes to a full FIFO, you must override pre_write as appropriate.

pre_read

virtual task pre_read(
    uvm_reg_item  rw
)

Special post-processing for a write() or update().  Aborts the operation if the internal FIFO is empty.  If in your application the DUT does not behave this way, you must override pre_write as appropriate.

virtual class uvm_void
The uvm_void class is the base class for all UVM classes.
virtual class uvm_object extends uvm_void
The uvm_object class is the base class for all UVM data and hierarchical classes.
virtual class uvm_reg extends uvm_object
Register abstraction base class
class uvm_reg_fifo extends uvm_reg
This special register models a DUT FIFO accessed via write/read, where writes push to the FIFO and reads pop from it.
rand uvm_reg_data_t fifo[$]
The abstract representation of the FIFO.
function new(
    string  name  =  "reg_fifo",
    int  unsigned  size,   
    int  unsigned  n_bits,   
    int  has_cover   
)
Creates an instance of a FIFO register having size elements of n_bits each.
function void set_compare(
    uvm_check_e  check  =  UVM_CHECK
)
Sets the compare policy during a mirror (read) of the DUT FIFO.
function int unsigned size()
The number of entries currently in the FIFO.
function int unsigned capacity()
The maximum number of entries, or depth, of the FIFO.
virtual function void set(
    uvm_reg_data_t  value,   
    string  fname  =  "",
    int  lineno  =  0
)
Pushes the given value to the abstract FIFO.
virtual task update(
    output  uvm_status_e  status,   
    input  uvm_path_e  path  =  UVM_DEFAULT_PATH,
    input  uvm_reg_map  map  =  null,
    input  uvm_sequence_base  parent  =  null,
    input  int  prior  =  -1,
    input  uvm_object  extension  =  null,
    input  string  fname  =  "",
    input  int  lineno  =  0
)
Pushes (writes) all values preloaded using set() to the DUT.
virtual function uvm_reg_data_t get(
    string  fname  =  "",
    int  lineno  =  0
)
Returns the next value from the abstract FIFO, but does not pop it.
virtual function void do_predict(
    uvm_reg_item  rw,   
    uvm_predict_e  kind  =  UVM_PREDICT_DIRECT,
    uvm_reg_byte_en_t  be  =  -1
)
Updates the abstract (mirror) FIFO based on write() and read() operations.
Pushes the given value to the DUT FIFO.
Reads the next value out of the DUT FIFO.
virtual task pre_write(
    uvm_reg_item  rw
)
Special pre-processing for a write() or update().
virtual task pre_read(
    uvm_reg_item  rw
)
Special post-processing for a write() or update().
Reads the next value out of the DUT FIFO.
Read and check
function void set_auto_predict(
    bit  on  =  1
)
Sets the auto-predict mode for his map.
class uvm_reg_predictor #(
    type  BUSTYPE  =  int
) extends uvm_component
Updates the register model mirror based on observed bus transactions