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

  1. //------------------------------------------------------------------------------
  2. // Title: Generic Register Operation Descriptors
  3. //
  4. // This section defines the abstract register transaction item. It also defines
  5. // a descriptor for a physical bus operation that is used by <uvm_reg_adapter>
  6. // subtypes to convert from a protocol-specific address/data/rw operation to
  7. // a bus-independent, canonical r/w operation.
  8. //------------------------------------------------------------------------------
  9.  
  10. //------------------------------------------------------------------------------
  11. // CLASS: uvm_reg_item
  12. //
  13. // Defines an abstract register transaction item. No bus-specific information
  14. // is present, although a handle to a <uvm_reg_map> is provided in case a user
  15. // wishes to implement a custom address translation algorithm.
  16. //------------------------------------------------------------------------------
  17.  
  18. class uvm_reg_item extends uvm_sequence_item;
  19.  
  20. `uvm_object_utils(uvm_reg_item)
  21.  
  22. // Variable: element_kind
  23. //
  24. // Kind of element being accessed: REG, MEM, or FIELD. See <uvm_elem_kind_e>.
  25. //
  26. uvm_elem_kind_e element_kind;
  27.  
  28. uvm_object element;
  29. rand uvm_access_e kind;
  30.  
  31. // Variable: value
  32. //
  33. // The value to write to, or after completion, the value read from the DUT.
  34. // Burst operations use the <values> property.
  35. //
  36. rand uvm_reg_data_t value[];
  37.  
  38. // TODO: parameterize
  39. constraint max_values { value.size() > && value.size() < ; }
  40.  
  41. rand uvm_reg_addr_t offset;
  42. uvm_status_e status;
  43. uvm_reg_map local_map;
  44. uvm_reg_map map;
  45. uvm_path_e path;
  46. rand uvm_sequence_base parent;
  47. int prior = -;
  48. rand uvm_object extension;
  49. string bd_kind;
  50. string fname;
  51. int lineno;
  52.  
  53. function new(string name="");
  54. super.new(name);
  55. value = new[];
  56. endfunction
  57.  
  58. // Function: convert2string
  59. //
  60. // Returns a string showing the contents of this transaction.
  61. //
  62. virtual function string convert2string();
  63. string s,value_s;
  64. s = {"kind=",kind.name(),
  65. " ele_kind=",element_kind.name(),
  66. " ele_name=",element==null?"null":element.get_full_name() };
  67.  
  68. if (value.size() > && uvm_report_enabled(UVM_HIGH, UVM_INFO, "RegModel")) begin
  69. value_s = "'{";
  70. foreach (value[i])
  71. value_s = {value_s,$sformatf("%0h,",value[i])};
  72. value_s[value_s.len()-]="}";
  73. end
  74. else
  75. value_s = $sformatf("%0h",value[]);
  76. s = {s, " value=",value_s};
  77.  
  78. if (element_kind == UVM_MEM)
  79. s = {s, $sformatf(" offset=%0h",offset)};
  80. s = {s," map=",(map==null?"null":map.get_full_name())," path=",path.name()};
  81. s = {s," status=",status.name()};
  82. return s;
  83. endfunction
  84.  
  85. virtual function void do_copy(uvm_object rhs);
  86. endfunction
  87.  
  88. endclass
  89.  
  90. //------------------------------------------------------------------------------
  91. //
  92. // CLASS: uvm_reg_bus_op
  93. //
  94. // Struct that defines a generic bus transaction for register and memory accesses, having
  95. // ~kind~ (read or write), ~address~, ~data~, and ~byte enable~ information.
  96. // If the bus is narrower than the register or memory location being accessed,
  97. // there will be multiple of these bus operations for every abstract
  98. // <uvm_reg_item> transaction. In this case, ~data~ represents the portion
  99. // of <uvm_reg_item::value> being transferred during this bus cycle.
  100. // If the bus is wide enough to perform the register or memory operation in
  101. // a single cycle, ~data~ will be the same as <uvm_reg_item::value>.
  102. //------------------------------------------------------------------------------
  103.  
  104. typedef struct {
  105.  
  106. // Variable: kind
  107. //
  108. // Kind of access: READ or WRITE.
  109. //
  110. uvm_access_e kind;
  111.  
  112. // Variable: addr
  113. //
  114. // The bus address.
  115. //
  116. uvm_reg_addr_t addr;
  117.  
  118. // Variable: data
  119. //
  120. // The data to write. If the bus width is smaller than the register or
  121. // memory width, ~data~ represents only the portion of ~value~ that is
  122. // being transferred this bus cycle.
  123. //
  124. uvm_reg_data_t data;
  125.  
  126. // Variable: n_bits
  127. //
  128. // The number of bits of <uvm_reg_item::value> being transferred by
  129. // this transaction.
  130.  
  131. int n_bits;
  132.  
  133. /*
  134. constraint valid_n_bits {
  135. n_bits > 0;
  136. n_bits <= `UVM_REG_DATA_WIDTH;
  137. }
  138. */
  139.  
  140. // Variable: byte_en
  141. //
  142. // Enables for the byte lanes on the bus. Meaningful only when the
  143. // bus supports byte enables and the operation originates from a field
  144. // write/read.
  145. //
  146. uvm_reg_byte_en_t byte_en;
  147.  
  148. // Variable: status
  149. //
  150. // The result of the transaction: UVM_IS_OK, UVM_HAS_X, UVM_NOT_OK.
  151. // See <uvm_status_e>.
  152. //
  153. uvm_status_e status;
  154.  
  155. } uvm_reg_bus_op;

uvm_reg_item——寄存器模型(五)的更多相关文章

  1. uvm_reg_predictor——寄存器模型(十七)

    这是寄存器模型类中唯一派生自uvm_component的类,我们的寄存器模式需要实时,以最接近的方式知道DUT中寄存器的变化,uvm_reg_predictor就是为这个而生的. // TITLE: ...

  2. uvm_reg_sequence——寄存器模型(六)

    寄存器模型 uvm_reg_sequence是UVM自带所有register sequence 的基类. 该类包含model, adapter, reg_seqr(uvm_sequencer). 感觉 ...

  3. uvm_reg_model——寄存器模型(一)

    对于一个复杂设计,寄存器模型要能够模拟任意数量的寄存器域操作.UVM提供标准的基类库,UVM的寄存器模型来自于继承自VMM的RAL(Register Abstract Layer),现在可以先将寄存器 ...

  4. [Beego模型] 五、构造查询

    [Beego模型] 一.ORM 使用方法 [Beego模型] 二.CRUD 操作 [Beego模型] 三.高级查询 [Beego模型] 四.使用SQL语句进行查询 [Beego模型] 五.构造查询 [ ...

  5. uvm_reg_cbs——寄存器模型(十六)

    当你完成寄存器模型的时候,你就会想到给后来的人一个接口,给他更多的扩展,让他做更多的事,一般而言,只有做VIP时,会想到做callbacks. typedef class uvm_reg; typed ...

  6. uvm_reg_block——寄存器模型(七)

    这是寄存器模型的顶层 //------------------------------------------------------------------------ // Class: uvm_ ...

  7. uvm_reg_defines——寄存器模型(四)

    文件: src/marcos/uvm_reg_defines 类: 无 该文件是寄存器模型src/reg/* 文件对于的宏文件,主要定义了寄存器地址位宽,寄存器数据位宽,字节的大小.计算机从最初的8, ...

  8. UVM——寄存器模型相关的一些函数

    0. 引言 在UVM支持的寄存器操作中,有get.update.mirror.write等等一些方法,在这里整理一下他们的用法. 寄存器模型中的寄存器值应该与DUT保持同步,但是由于DUT的值是实时更 ...

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

    当我们对寄存器register, 存储器memory, 都进行了建模,是时候对FIFO进行建模了 uvm_reg_fifo毫无旁贷底承担起了这个责任,包括:set, get, update, read ...

随机推荐

  1. bzoj 3160 万径人踪灭 —— FFT

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3160 求出关于一个位置有多少对对称字母,如果 i 位置有 f[i] 对,对答案的贡献是 2^ ...

  2. PHPstorm相同变量标识

    setting-> plugins-> Browse Repositories 输入BrowseWordAtCaret 搜索,安装,然后重启

  3. UVaLive 3635 Pie (二分)

    题意:有f+1个人来分n个圆形派,每个人得到的必须是一个整块,并且是面积一样,问你面积是多少. 析:二分这个面积即可,小了就多余了,多了就不够分,很简单就能判断. 代码如下: #pragma comm ...

  4. CodeForces - 377A Maze BFS逆思维

    Maze Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, ...

  5. 【转】Win8 下 管理无线网络

    Ref:http://windows.microsoft.com/zh-CN/windows-8/manage-wireless-network-profiles 管理无线网络配置文件 适用于 Win ...

  6. art-template在项目中的应用

    art-template 是一个简约.超快的模板引擎.它采用作用域预声明的技术来优化模板渲染速度,从而获得接近 JavaScript 极限的运行性能,并且同时支持 NodeJS 和浏览器. 下面介绍在 ...

  7. 51nod1414【思维】

    思路: 直接可以枚举1-n,如果枚举到是n的约数i,那么暴力枚举起点,其余点用i累加就一定是正多边形.复杂度是(n*n的公约数个数(最多80)): const int N=2e4+10; int a[ ...

  8. 計蒜客/數正方形(dp)

    題目鏈接:https://nanti.jisuanke.com/t/44 題意:中文題誒~ 思路: 用dp[i][j]存儲以(i, j)爲左上定點的最大正方形變長,從右下角網左上角一次計算所有頂點: ...

  9. 51nod1639(组合数学)

    题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1639 题意:中文题诶- 思路:组合数学 n根鞋带要组成一个环, ...

  10. PJzhang:百度网盘是如何泄露公司机密的?

    猫宁!!! 参考链接:https://mp.weixin.qq.com/s/PLELMu8cVleOLlwRAAYPVg 百度网盘在中国一家独大,百度超级会员具有很多特权,尤其是在下载速度上,是普通会 ...