uvm_reg_fifo——寄存器模型(十五)

当我们对寄存器register, 存储器memory, 都进行了建模,是时候对FIFO进行建模了

uvm_reg_fifo毫无旁贷底承担起了这个责任,包括:set, get, update, read, write, 等等函数。

 

//------------------------------------------------------------------------------
// Class: 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.
//
//------------------------------------------------------------------------------

class uvm_reg_fifo extends uvm_reg;

    local uvm_reg_field value;
    local int m_set_cnt;
    local int unsigned m_size;

    // Variable: 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.
    //
    rand uvm_reg_data_t fifo[$];

    constraint valid_fifo_size {
      fifo.size() <= m_size;
    }

 

posted on 2017-12-12 14:12  dpc525  阅读(861)  评论(0编辑  收藏  举报

导航