uvm_reg_item——寄存器模型(五)

news/2024/7/7 1:43:10

  uvm_reg_item 扩展自uvm_sequence_item,也就说寄存器模型定义了transaction item. adapter 的作用是把这uvm_reg_item转换成uvm_sequence_item,再经由uvm_sequencer发送个uvm_driver,最终在总线上传输。

 

//------------------------------------------------------------------------------
// Title: Generic Register Operation Descriptors
//
// This section defines the abstract register transaction item. It also defines
// a descriptor for a physical bus operation that is used by <uvm_reg_adapter>
// subtypes to convert from a protocol-specific address/data/rw operation to
// a bus-independent, canonical r/w operation.
//------------------------------------------------------------------------------


//------------------------------------------------------------------------------
// CLASS: uvm_reg_item
//
// Defines an abstract register transaction item. No bus-specific information
// is present, although a handle to a <uvm_reg_map> is provided in case a user
// wishes to implement a custom address translation algorithm.
//------------------------------------------------------------------------------

class uvm_reg_item extends uvm_sequence_item;

  `uvm_object_utils(uvm_reg_item)

  // Variable: element_kind
  //
  // Kind of element being accessed: REG, MEM, or FIELD. See <uvm_elem_kind_e>.
  //
  uvm_elem_kind_e element_kind;


  uvm_object element;
  rand uvm_access_e kind;

  // Variable: value
  //
  // The value to write to, or after completion, the value read from the DUT.
  // Burst operations use the <values> property.
  //
  rand uvm_reg_data_t value[];


  // TODO: parameterize
  constraint max_values { value.size() > 0 && value.size() < 1000; }

  rand uvm_reg_addr_t offset;
  uvm_status_e status;
  uvm_reg_map local_map;
  uvm_reg_map map;
  uvm_path_e path;
  rand uvm_sequence_base parent;
  int prior = -1;
  rand uvm_object extension;
  string bd_kind;
  string fname;
  int lineno;

  function new(string name="");
    super.new(name);
    value = new[1];
  endfunction


  // Function: convert2string
  //
  // Returns a string showing the contents of this transaction.
  //
  virtual function string convert2string();
    string s,value_s;
    s = {"kind=",kind.name(),
         " ele_kind=",element_kind.name(),
         " ele_name=",element==null?"null":element.get_full_name() };

    if (value.size() > 1 && uvm_report_enabled(UVM_HIGH, UVM_INFO, "RegModel")) begin
      value_s = "'{";
      foreach (value[i])
         value_s = {value_s,$sformatf("%0h,",value[i])};
      value_s[value_s.len()-1]="}";
    end
    else
      value_s = $sformatf("%0h",value[0]);
    s = {s, " value=",value_s};

    if (element_kind == UVM_MEM)
      s = {s, $sformatf(" offset=%0h",offset)};
    s = {s," map=",(map==null?"null":map.get_full_name())," path=",path.name()};
    s = {s," status=",status.name()};
    return s;
  endfunction


  virtual function void do_copy(uvm_object rhs);
  endfunction

endclass



//------------------------------------------------------------------------------
//
// CLASS: uvm_reg_bus_op
//
// Struct that defines a generic bus transaction for register and memory accesses, having
// ~kind~ (read or write), ~address~, ~data~, and ~byte enable~ information.
// If the bus is narrower than the register or memory location being accessed,
// there will be multiple of these bus operations for every abstract
// <uvm_reg_item> transaction. In this case, ~data~ represents the portion 
// of <uvm_reg_item::value> being transferred during this bus cycle. 
// If the bus is wide enough to perform the register or memory operation in
// a single cycle, ~data~ will be the same as <uvm_reg_item::value>.
//------------------------------------------------------------------------------

typedef struct {

  // Variable: kind
  //
  // Kind of access: READ or WRITE.
  //
  uvm_access_e kind;


  // Variable: addr
  //
  // The bus address.
  //
  uvm_reg_addr_t addr;


  // Variable: data
  //
  // The data to write. If the bus width is smaller than the register or
  // memory width, ~data~ represents only the portion of ~value~ that is
  // being transferred this bus cycle.
  //
  uvm_reg_data_t data;

   
  // Variable: n_bits
  //
  // The number of bits of <uvm_reg_item::value> being transferred by
  // this transaction.

  int n_bits;

  /*
  constraint valid_n_bits {
     n_bits > 0;
     n_bits <= `UVM_REG_DATA_WIDTH;
  }
  */


  // Variable: byte_en
  //
  // Enables for the byte lanes on the bus. Meaningful only when the
  // bus supports byte enables and the operation originates from a field
  // write/read.
  //
  uvm_reg_byte_en_t byte_en;


  // Variable: status
  //
  // The result of the transaction: UVM_IS_OK, UVM_HAS_X, UVM_NOT_OK.
  // See <uvm_status_e>.
  //
  uvm_status_e status;

} uvm_reg_bus_op;

 

转载于:https://www.cnblogs.com/dpc525/p/8025133.html


http://www.niftyadmin.cn/n/1496367.html

相关文章

JS编程建议——18:比较function语句和function表达式

建议18&#xff1a;比较function语句和function表达式在JavaScript语言中&#xff0c;既有function语句&#xff0c;也有函数表达式&#xff0c;这是令人困惑的&#xff0c;因为它们看起来是相同的。一个function语句就是值为一个函数的var语句的简写形式。下面的语句&#xff…

计算机考试前会让上机吗,计算机等级考试上机六大注意事项

究竟是什么原因呢?不就是那100道题目吗?翻来覆去的看也没有发现自己的程序有什么错误啊&#xff0c;看资料&#xff0c;用模拟盘模拟也是满分啊&#xff0c;可为什么正式考试就是0分呢?CNrencai网小编发现了一些问题&#xff0c;现在分享给大家。于是很多人甚至把通过上机考…

爱创课堂每日一题七十二天-如何删除一个cookie?

1.将时间设为当前时间往前一点。var date new Date();date.setDate(date.getDate() - 1);//真正的删除setDate()方法用于设置一个月的某一天。2.expires的设置document.cookie user encodeURIComponent(name) ;expires new Date(0)<strong>&#xff0c;<em>和…

建筑安全检查标准怎么计算机,建筑施工安全检查标准评分 怎么算

市政工程施工安全检查评定应符合本标准第3章~第8章中各检查评定项目的有关规定&#xff0c;并应按本标准附录A、附录B的评分表进行评分。分项检查评分表和检查评分汇总表的满分分值均应为100分&#xff0c;评分表的实得分值应为各检查项目所得分值之和&#xff0c;分项检查评分…

shell中awk命令常用用法总结

1、获取分隔的内容 以点为分隔符获取IP地址的最后一个字段 echo $ip | awk -F . {print $4}

开博之日,谨此铭记!

一心集染脂梨花 云遮住皎洁的月光 找不到你离开的方向 草丛间七八只蟋蟀 又奏起不知名的忧伤 桌上余温尚存的纸杯 却被胭脂掩盖了茶香 你无情的离去还叫我把你遗忘 可滴在我手心的泪又叫我如何遗忘 石子坠入我门前的池塘 你的笑还在脑海伴着涟漪回荡 池塘边为你种下的白杨 在晚…

计算机在机械制造领域中的应用论文,自动化技术在机械制造中的应用毕业论文...

自动化技术在机械制造中的应用毕业论文 (4页)本资源提供全文预览&#xff0c;点击全文预览即可全文预览,如果喜欢文档就下载吧&#xff0c;查找使用更方便哦&#xff01;4.9 积分自动化技术在机械制造中的应用毕业论文      1、机械自动化技术概念及组成分析      1.1机…

计算机命令符号,给几个电脑常用的命令提示符

首先我当然推荐方便的软件&#xff1a;http://sx.huajun.net/down/shutcool.zip定时关机技巧全集一、win9x关机关机是大家常做的一件事&#xff0c;不少人还传统地使用着点击开始&#xff0f;关闭系统&#xff0f;关闭计算机的方法。是不是太古老了&#xff1f;来吧朋友&#x…