对于一个复杂设计,寄存器模型要能够模拟任意数量的寄存器域操作。UVM提供标准的基类库,UVM的寄存器模型来自于继承自VMM的RAL(Register Abstract Layer),现在可以先将寄存器模型进行XML建模,再通过脚本工具直接生产寄存器模型。首先来看看uvm_reg_model的代码,该文件用来保存Register Layer的全局变量和文件include。

  1. //------------------------------------------------------------------------------
  2. // TITLE: Global Declarations for the Register Layer
  3. //------------------------------------------------------------------------------
  4. //
  5. // This section defines globally available types, enums, and utility classes.
  6. //
  7. //------------------------------------------------------------------------------
  8.  
  9. `ifndef UVM_REG_MODEL__SV
  10. `define UVM_REG_MODEL__SV
  11.  
  12. typedef class uvm_reg_field;
  13. typedef class uvm_vreg_field;
  14. typedef class uvm_reg;
  15. typedef class uvm_reg_file;
  16. typedef class uvm_vreg;
  17. typedef class uvm_reg_block;
  18. typedef class uvm_mem;
  19. typedef class uvm_reg_item;
  20. typedef class uvm_reg_map;
  21. typedef class uvm_reg_map_info;
  22. typedef class uvm_reg_sequence;
  23. typedef class uvm_reg_adapter;
  24. typedef class uvm_reg_indirect_data;

除了声明了基本的寄存器模型外,还定义了一些全局变量和枚举的定义:

  1. // Type: uvm_hdl_path_slice
  2. //
  3. // Slice of an HDL path
  4. //
  5. // Struct that specifies the HDL variable that corresponds to all
  6. // or a portion of a register.
  7. //
  8. // path - Path to the HDL variable.
  9. // offset - Offset of the LSB in the register that this variable implements
  10. // size - Number of bits (toward the MSB) that this variable implements
  11. //
  12. // If the HDL variable implements all of the register, ~offset~ and ~size~
  13. // are specified as -1. For example:
  14. //|
  15. //| r1.add_hdl_path('{ '{"r1", -1, -1} });
  16. //|
  17. //
  18. typedef struct {
  19. string path;
  20. int offset;
  21. int size;
  22. } uvm_hdl_path_slice;
  23.  
  24. typedef uvm_resource_db#(uvm_reg_cvr_t) uvm_reg_cvr_rsrc_db;
  25.  
  26. //--------------------
  27. // Group: Enumerations
  28. //--------------------
  29.  
  30. // Enum: uvm_status_e
  31. //
  32. // Return status for register operations
  33. //
  34. // UVM_IS_OK - Operation completed successfully
  35. // UVM_NOT_OK - Operation completed with error
  36. // UVM_HAS_X - Operation completed successfully bit had unknown bits.
  37. //
  38.  
  39. typedef enum {
  40. UVM_IS_OK,
  41. UVM_NOT_OK,
  42. UVM_HAS_X
  43. } uvm_status_e;
  44.  
  45. // Enum: uvm_path_e
  46. //
  47. // Path used for register operation
  48. //
  49. // UVM_FRONTDOOR - Use the front door
  50. // UVM_BACKDOOR - Use the back door
  51. // UVM_PREDICT - Operation derived from observations by a bus monitor via
  52. // the <uvm_reg_predictor> class.
  53. // UVM_DEFAULT_PATH - Operation specified by the context
  54. //
  55. typedef enum {
  56. UVM_FRONTDOOR,
  57. UVM_BACKDOOR,
  58. UVM_PREDICT,
  59. UVM_DEFAULT_PATH
  60. } uvm_path_e;
  61.  
  62. // Enum: uvm_check_e
  63. //
  64. // Read-only or read-and-check
  65. //
  66. // UVM_NO_CHECK - Read only
  67. // UVM_CHECK - Read and check
  68. //
  69. typedef enum {
  70. UVM_NO_CHECK,
  71. UVM_CHECK
  72. } uvm_check_e;
  73.  
  74. // Enum: uvm_endianness_e
  75. //
  76. // Specifies byte ordering
  77. //
  78. // UVM_NO_ENDIAN - Byte ordering not applicable
  79. // UVM_LITTLE_ENDIAN - Least-significant bytes first in consecutive addresses
  80. // UVM_BIG_ENDIAN - Most-significant bytes first in consecutive addresses
  81. // UVM_LITTLE_FIFO - Least-significant bytes first at the same address
  82. // UVM_BIG_FIFO - Most-significant bytes first at the same address
  83. //
  84. typedef enum {
  85. UVM_NO_ENDIAN,
  86. UVM_LITTLE_ENDIAN,
  87. UVM_BIG_ENDIAN,
  88. UVM_LITTLE_FIFO,
  89. UVM_BIG_FIFO
  90. } uvm_endianness_e;
  91.  
  92. // Enum: uvm_elem_kind_e
  93. //
  94. // Type of element being read or written
  95. //
  96. // UVM_REG - Register
  97. // UVM_FIELD - Field
  98. // UVM_MEM - Memory location
  99. //
  100. typedef enum {
  101. UVM_REG,
  102. UVM_FIELD,
  103. UVM_MEM
  104. } uvm_elem_kind_e;
  105.  
  106. // Enum: uvm_access_e
  107. //
  108. // Type of operation begin performed
  109. //
  110. // UVM_READ - Read operation
  111. // UVM_WRITE - Write operation
  112. //
  113. typedef enum {
  114. UVM_READ,
  115. UVM_WRITE,
  116. UVM_BURST_READ,
  117. UVM_BURST_WRITE
  118. } uvm_access_e;
  119.  
  120. // Enum: uvm_hier_e
  121. //
  122. // Whether to provide the requested information from a hierarchical context.
  123. //
  124. // UVM_NO_HIER - Provide info from the local context
  125. // UVM_HIER - Provide info based on the hierarchical context
  126.  
  127. typedef enum {
  128. UVM_NO_HIER,
  129. UVM_HIER
  130. } uvm_hier_e;
  131.  
  132. // Enum: uvm_predict_e
  133. //
  134. // How the mirror is to be updated
  135. //
  136. // UVM_PREDICT_DIRECT - Predicted value is as-is
  137. // UVM_PREDICT_READ - Predict based on the specified value having been read
  138. // UVM_PREDICT_WRITE - Predict based on the specified value having been written
  139. //
  140. typedef enum {
  141. UVM_PREDICT_DIRECT,
  142. UVM_PREDICT_READ,
  143. UVM_PREDICT_WRITE
  144. } uvm_predict_e;
  145.  
  146. // Enum: uvm_coverage_model_e
  147. //
  148. // Coverage models available or desired.
  149. // Multiple models may be specified by bitwise OR'ing individual model identifiers.
  150. //
  151. // UVM_NO_COVERAGE - None
  152. // UVM_CVR_REG_BITS - Individual register bits
  153. // UVM_CVR_ADDR_MAP - Individual register and memory addresses
  154. // UVM_CVR_FIELD_VALS - Field values
  155. // UVM_CVR_ALL - All coverage models
  156. //
  157. typedef enum uvm_reg_cvr_t {
  158. UVM_NO_COVERAGE = 'h0000,
  159. UVM_CVR_REG_BITS = 'h0001,
  160. UVM_CVR_ADDR_MAP = 'h0002,
  161. UVM_CVR_FIELD_VALS = 'h0004,
  162. UVM_CVR_ALL = -
  163. } uvm_coverage_model_e;
  164.  
  165. // Enum: uvm_reg_mem_tests_e
  166. //
  167. // Select which pre-defined test sequence to execute.
  168. //
  169. // Multiple test sequences may be selected by bitwise OR'ing their
  170. // respective symbolic values.
  171. //
  172. // UVM_DO_REG_HW_RESET - Run <uvm_reg_hw_reset_seq>
  173. // UVM_DO_REG_BIT_BASH - Run <uvm_reg_bit_bash_seq>
  174. // UVM_DO_REG_ACCESS - Run <uvm_reg_access_seq>
  175. // UVM_DO_MEM_ACCESS - Run <uvm_mem_access_seq>
  176. // UVM_DO_SHARED_ACCESS - Run <uvm_reg_mem_shared_access_seq>
  177. // UVM_DO_MEM_WALK - Run <uvm_mem_walk_seq>
  178. // UVM_DO_ALL_REG_MEM_TESTS - Run all of the above
  179. //
  180. // Test sequences, when selected, are executed in the
  181. // order in which they are specified above.
  182. //
  183. typedef enum bit [:] {
  184. UVM_DO_REG_HW_RESET = 'h0000_0000_0000_0001,
  185. UVM_DO_REG_BIT_BASH = 'h0000_0000_0000_0002,
  186. UVM_DO_REG_ACCESS = 'h0000_0000_0000_0004,
  187. UVM_DO_MEM_ACCESS = 'h0000_0000_0000_0008,
  188. UVM_DO_SHARED_ACCESS = 'h0000_0000_0000_0010,
  189. UVM_DO_MEM_WALK = 'h0000_0000_0000_0020,
  190. UVM_DO_ALL_REG_MEM_TESTS = 'hffff_ffff_ffff_ffff
  191. } uvm_reg_mem_tests_e;

包含其他文件的include:

  1. `include "reg/uvm_reg_item.svh"
  2. `include "reg/uvm_reg_adapter.svh"
  3. `include "reg/uvm_reg_predictor.svh"
  4. `include "reg/uvm_reg_sequence.svh"
  5. `include "reg/uvm_reg_cbs.svh"
  6. `include "reg/uvm_reg_backdoor.svh"
  7. `include "reg/uvm_reg_field.svh"
  8. `include "reg/uvm_vreg_field.svh"
  9. `include "reg/uvm_reg.svh"
  10. `include "reg/uvm_reg_indirect.svh"
  11. `include "reg/uvm_reg_fifo.svh"
  12. `include "reg/uvm_reg_file.svh"
  13. `include "reg/uvm_mem_mam.svh"
  14. `include "reg/uvm_vreg.svh"
  15. `include "reg/uvm_mem.svh"
  16. `include "reg/uvm_reg_map.svh"
  17. `include "reg/uvm_reg_block.svh"
  18.  
  19. `include "reg/sequences/uvm_reg_hw_reset_seq.svh"
  20. `include "reg/sequences/uvm_reg_bit_bash_seq.svh"
  21. `include "reg/sequences/uvm_mem_walk_seq.svh"
  22. `include "reg/sequences/uvm_mem_access_seq.svh"
  23. `include "reg/sequences/uvm_reg_access_seq.svh"
  24. `include "reg/sequences/uvm_reg_mem_shared_access_seq.svh"
  25. `include "reg/sequences/uvm_reg_mem_built_in_seq.svh"
  26. `include "reg/sequences/uvm_reg_mem_hdl_paths_seq.svh"

uvm_reg_model——寄存器模型(一)的更多相关文章

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

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

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

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

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

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

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

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

  5. uvm_reg_item——寄存器模型(五)

    uvm_reg_item 扩展自uvm_sequence_item,也就说寄存器模型定义了transaction item. adapter 的作用是把这uvm_reg_item转换成uvm_sequ ...

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

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

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

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

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

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

  9. uvm_reg_file——寄存器模型(十四)

    有了uvm_reg_field, uvm_reg, uvm_block, 也许我们需要跟大的uvm_file,这就是传说中的寄存器堆. // // CLASS: uvm_reg_file // Reg ...

随机推荐

  1. MTK UART串口调试

    一.UART初始化 1. kernel-3.18/drivers/misc/mediatek/uart/uart.c static int __init mtk_uart_init(void) { ; ...

  2. Azure Key Vault (1) 入门

    <Windows Azure Platform 系列文章目录> 为什么要使用Azure Key Vault? 我们假设在微软云Azure上有1个场景,在Windows VM里面有1个.NE ...

  3. Jquery获取web窗体关闭事件,排除刷新页面

    在js脚本里全局定义一个 var r=true;若是刷新的话则把r=false; $(window).unload(function () { if (r) { //这里面证明用户不是点的F5刷新 执 ...

  4. UltraISO中文版+注册码

    UltraISO v9.5.3.2901 百度网盘下载地址: http://pan.baidu.com/s/1l9t2U 新浪微盘下载地址: http://vdisk.weibo.com/s/rcvB ...

  5. Linux : linux命令之 svn

    感谢前辈的整理,让我直接站在巨人的肩膀上.来自:http://www.jb51.net/os/RedHat/2461.html 1.将文件checkout到本地目录 svn checkout path ...

  6. VS2008给对话框添加背景颜色

    第一种方法如下: 在对话框OnPaint()函数中添加代码 //改变对话框背景颜色 CRect rect; CPaintDC dc(this); GetClientRect(rect); dc.Fil ...

  7. fetch + async await 使用原生JS发送网络请求

    由于现在主流浏览器支持Fetch API,无需引用其他库就能实现AJAX,一行代码就搞定,可以说是非常方便了. export default { name: 'HelloWorld', data() ...

  8. TP5实现签到功能

    基于tp5 模型的一个签到功能: 由于存储所有的签到日期数据库会非常庞大,所以签到日期只存储近三个月的. 具体功能: 1.记录最近一次的签到时间 2.每次签到都会添加15积分 3.有连续签到的记录 C ...

  9. hdoj2577【多种状态】(简单DP)

    #include <stdio.h> #include <iostream> #include <sstream> #include <string.h> ...

  10. PHP 数组序列化,转为字符串

    serialize() <?php $a = array('a' => 'as' ,'b' => 'bs' , 'c' => 'cs'); //序列化数组 $s = seria ...