[UVM]UVM Sequence item

                               UVM Sequence item

 

       The sequence-item is written by extending the uvm_sequence_item, uvm_sequence_item inherits from the uvm_object via the uvm_transaction class. therefore uvm_sequence_item is of an object type.

       Before moving to uvm_sequence_item will look into uvm_object concepts required to write uvm_sequence_item, The uvm_object has a number of virtual methods that are used to implement common data object functions (copy, clone, compare, print, transaction, and recording) and these should be implemented to make the sequence_item more general purpose.also, uvm_object has macros defined in it, mainly Utility Macros and Field Macros.

一、UVM Utility Macros

       The utility macros provide implementations of the create method (needed for cloning) and the get_type_name method (needed for debugging), etc.

1、objects with no field macros,

`uvm_object_utils(TYPE)

2、objects with field macros,

`uvm_object_utils_begin(TYPE)
    `uvm_field_*(FIELD, FLAG)
`uvm_object_utils_end

二、UVM Field Macros

       The `uvm_field_* macros are invoked inside of the `uvm_*_utils_begin and `uvm_*_utils_end, for the implementations of the methods: copy, compare, pack, unpack, record, print, and etc.

       Each `uvm_field_* macro is named to correspond to a particular data type: integrals, strings, objects, queues, enum, etc., and each has at least two arguments: FIELD and FLAG.

`uvm_field_*(FIELD, FLAG);
                  FLAG                                                                      Description
UVM_ALL_ONSet all operations on (default)
UVM_DEFAULTUse the default flag settings
UVM_NOCOPYDo not copy this field
UVM_NOCOMPAREDo not compare this field
UVM_NOPRINTDo not print this field
UVM_NODEFPRINTDo not print the field if it is the same as its
UVM_NOPACKDo not pack or unpack this field
UVM_PHYSICALTreat as a physical field. Use physical setting in policy class for this field
UVM_ABSTRACTTreat as an abstract field. Use the abstract setting in the policy class for this field
UVM_READONLYDo not allow the setting of this field from the set_*_local methods

A radix for printing and recording can be specified by OR’ing one of the following constants in the FLAG argument

UVM_BINPrint/record the field in binary (base-2)
UVM_DECPrint/record the field in decimal (base-10)
UVM_UNSIGNEDPrint/record the field in unsigned decimal (base-10)
UVM_OCTPrint/record the field in octal (base-8).
UVM_HEXPrint/record the field in hexadecimal (base-16)
UVM_STRINGPrint/record the field in string format
UVM_TIMEPrint/record the field in time format

1、Sequence item:

       The sequence-item consist of data fields required for generating the stimulus.In order to generate the stimulus, the sequence items are randomized in sequences. Therefore data properties in sequence items should generally be declared as rand and can have constraints defined.Data fields represent the following types of information,

  • Control Information  – a type of transfer, transfer size, etc
  • Payload Information  –  data content of the transfer
  • Configuration Information – mode of operation, error behavior, etc
  • Analysis Information – fields used to capture information from DUT, ex: read data, response, etc

       As analysis information fields will be used for capturing response, except these fields the other fields can be declared as rand and can have constraints associated with it.

2、Sequence item example

class mem_seq_item extends uvm_sequence_item;
  //Control Information
  rand bit [3:0] addr;
  rand bit       wr_en;
  rand bit       rd_en;
   
  //Payload Information
  rand bit [7:0] wdata;
   
  //Analysis Information
       bit [7:0] rdata;
     
  //Utility and Field macros,
  `uvm_object_utils_begin(mem_seq_item)
    `uvm_field_int(addr,UVM_ALL_ON)
    `uvm_field_int(wr_en,UVM_ALL_ON)
    `uvm_field_int(rd_en,UVM_ALL_ON)
    `uvm_field_int(wdata,UVM_ALL_ON)
  `uvm_object_utils_end
   
  //Constructor
  function new(string name = "mem_seq_item");
    super.new(name);
  endfunction
   
  //constaint, to generate any one among write and read
  constraint wr_rd_c { 
    wr_en != rd_en; 
  };
   
endclass

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

元直数字电路验证

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值