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

//------------------------------------------------------------------------------
// TITLE: Global Declarations for the Register Layer
//------------------------------------------------------------------------------
//
// This section defines globally available types, enums, and utility classes.
//
//------------------------------------------------------------------------------ `ifndef UVM_REG_MODEL__SV
`define UVM_REG_MODEL__SV typedef class uvm_reg_field;
typedef class uvm_vreg_field;
typedef class uvm_reg;
typedef class uvm_reg_file;
typedef class uvm_vreg;
typedef class uvm_reg_block;
typedef class uvm_mem;
typedef class uvm_reg_item;
typedef class uvm_reg_map;
typedef class uvm_reg_map_info;
typedef class uvm_reg_sequence;
typedef class uvm_reg_adapter;
typedef class uvm_reg_indirect_data;

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

// Type: uvm_hdl_path_slice
//
// Slice of an HDL path
//
// Struct that specifies the HDL variable that corresponds to all
// or a portion of a register.
//
// path - Path to the HDL variable.
// offset - Offset of the LSB in the register that this variable implements
// size - Number of bits (toward the MSB) that this variable implements
//
// If the HDL variable implements all of the register, ~offset~ and ~size~
// are specified as -1. For example:
//|
//| r1.add_hdl_path('{ '{"r1", -1, -1} });
//|
//
typedef struct {
string path;
int offset;
int size;
} uvm_hdl_path_slice; typedef uvm_resource_db#(uvm_reg_cvr_t) uvm_reg_cvr_rsrc_db; //--------------------
// Group: Enumerations
//-------------------- // Enum: uvm_status_e
//
// Return status for register operations
//
// UVM_IS_OK - Operation completed successfully
// UVM_NOT_OK - Operation completed with error
// UVM_HAS_X - Operation completed successfully bit had unknown bits.
// typedef enum {
UVM_IS_OK,
UVM_NOT_OK,
UVM_HAS_X
} uvm_status_e; // Enum: uvm_path_e
//
// Path used for register operation
//
// UVM_FRONTDOOR - Use the front door
// UVM_BACKDOOR - Use the back door
// UVM_PREDICT - Operation derived from observations by a bus monitor via
// the <uvm_reg_predictor> class.
// UVM_DEFAULT_PATH - Operation specified by the context
//
typedef enum {
UVM_FRONTDOOR,
UVM_BACKDOOR,
UVM_PREDICT,
UVM_DEFAULT_PATH
} uvm_path_e; // Enum: uvm_check_e
//
// Read-only or read-and-check
//
// UVM_NO_CHECK - Read only
// UVM_CHECK - Read and check
//
typedef enum {
UVM_NO_CHECK,
UVM_CHECK
} uvm_check_e; // Enum: uvm_endianness_e
//
// Specifies byte ordering
//
// UVM_NO_ENDIAN - Byte ordering not applicable
// UVM_LITTLE_ENDIAN - Least-significant bytes first in consecutive addresses
// UVM_BIG_ENDIAN - Most-significant bytes first in consecutive addresses
// UVM_LITTLE_FIFO - Least-significant bytes first at the same address
// UVM_BIG_FIFO - Most-significant bytes first at the same address
//
typedef enum {
UVM_NO_ENDIAN,
UVM_LITTLE_ENDIAN,
UVM_BIG_ENDIAN,
UVM_LITTLE_FIFO,
UVM_BIG_FIFO
} uvm_endianness_e; // Enum: uvm_elem_kind_e
//
// Type of element being read or written
//
// UVM_REG - Register
// UVM_FIELD - Field
// UVM_MEM - Memory location
//
typedef enum {
UVM_REG,
UVM_FIELD,
UVM_MEM
} uvm_elem_kind_e; // Enum: uvm_access_e
//
// Type of operation begin performed
//
// UVM_READ - Read operation
// UVM_WRITE - Write operation
//
typedef enum {
UVM_READ,
UVM_WRITE,
UVM_BURST_READ,
UVM_BURST_WRITE
} uvm_access_e; // Enum: uvm_hier_e
//
// Whether to provide the requested information from a hierarchical context.
//
// UVM_NO_HIER - Provide info from the local context
// UVM_HIER - Provide info based on the hierarchical context typedef enum {
UVM_NO_HIER,
UVM_HIER
} uvm_hier_e; // Enum: uvm_predict_e
//
// How the mirror is to be updated
//
// UVM_PREDICT_DIRECT - Predicted value is as-is
// UVM_PREDICT_READ - Predict based on the specified value having been read
// UVM_PREDICT_WRITE - Predict based on the specified value having been written
//
typedef enum {
UVM_PREDICT_DIRECT,
UVM_PREDICT_READ,
UVM_PREDICT_WRITE
} uvm_predict_e; // Enum: uvm_coverage_model_e
//
// Coverage models available or desired.
// Multiple models may be specified by bitwise OR'ing individual model identifiers.
//
// UVM_NO_COVERAGE - None
// UVM_CVR_REG_BITS - Individual register bits
// UVM_CVR_ADDR_MAP - Individual register and memory addresses
// UVM_CVR_FIELD_VALS - Field values
// UVM_CVR_ALL - All coverage models
//
typedef enum uvm_reg_cvr_t {
UVM_NO_COVERAGE = 'h0000,
UVM_CVR_REG_BITS = 'h0001,
UVM_CVR_ADDR_MAP = 'h0002,
UVM_CVR_FIELD_VALS = 'h0004,
UVM_CVR_ALL = -
} uvm_coverage_model_e; // Enum: uvm_reg_mem_tests_e
//
// Select which pre-defined test sequence to execute.
//
// Multiple test sequences may be selected by bitwise OR'ing their
// respective symbolic values.
//
// UVM_DO_REG_HW_RESET - Run <uvm_reg_hw_reset_seq>
// UVM_DO_REG_BIT_BASH - Run <uvm_reg_bit_bash_seq>
// UVM_DO_REG_ACCESS - Run <uvm_reg_access_seq>
// UVM_DO_MEM_ACCESS - Run <uvm_mem_access_seq>
// UVM_DO_SHARED_ACCESS - Run <uvm_reg_mem_shared_access_seq>
// UVM_DO_MEM_WALK - Run <uvm_mem_walk_seq>
// UVM_DO_ALL_REG_MEM_TESTS - Run all of the above
//
// Test sequences, when selected, are executed in the
// order in which they are specified above.
//
typedef enum bit [:] {
UVM_DO_REG_HW_RESET = 'h0000_0000_0000_0001,
UVM_DO_REG_BIT_BASH = 'h0000_0000_0000_0002,
UVM_DO_REG_ACCESS = 'h0000_0000_0000_0004,
UVM_DO_MEM_ACCESS = 'h0000_0000_0000_0008,
UVM_DO_SHARED_ACCESS = 'h0000_0000_0000_0010,
UVM_DO_MEM_WALK = 'h0000_0000_0000_0020,
UVM_DO_ALL_REG_MEM_TESTS = 'hffff_ffff_ffff_ffff
} uvm_reg_mem_tests_e;

包含其他文件的include:

`include "reg/uvm_reg_item.svh"
`include "reg/uvm_reg_adapter.svh"
`include "reg/uvm_reg_predictor.svh"
`include "reg/uvm_reg_sequence.svh"
`include "reg/uvm_reg_cbs.svh"
`include "reg/uvm_reg_backdoor.svh"
`include "reg/uvm_reg_field.svh"
`include "reg/uvm_vreg_field.svh"
`include "reg/uvm_reg.svh"
`include "reg/uvm_reg_indirect.svh"
`include "reg/uvm_reg_fifo.svh"
`include "reg/uvm_reg_file.svh"
`include "reg/uvm_mem_mam.svh"
`include "reg/uvm_vreg.svh"
`include "reg/uvm_mem.svh"
`include "reg/uvm_reg_map.svh"
`include "reg/uvm_reg_block.svh" `include "reg/sequences/uvm_reg_hw_reset_seq.svh"
`include "reg/sequences/uvm_reg_bit_bash_seq.svh"
`include "reg/sequences/uvm_mem_walk_seq.svh"
`include "reg/sequences/uvm_mem_access_seq.svh"
`include "reg/sequences/uvm_reg_access_seq.svh"
`include "reg/sequences/uvm_reg_mem_shared_access_seq.svh"
`include "reg/sequences/uvm_reg_mem_built_in_seq.svh"
`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. nagios对windows流量的检测

    windows下用于和 nagios 整合监控的方式主要有三种:nsclient++ .nrpe_nt.SNMP.三者各自的特点主要如下: 1.nsclient++比较成熟稳定,文档也丰富,内置很多了 ...

  2. C/C++获取Windows系统CPU和内存及硬盘使用情况

    //1.获取Windows系统内存使用率 //windows 内存 使用率 DWORD getWin_MemUsage(){ MEMORYSTATUS ms; ::GlobalMemoryStatus ...

  3. 【网络爬虫】【python】网络爬虫(一):python爬虫概述

    python爬虫的实现方式: 1.简单点的urllib2 + regex,足够了,可以实现最基本的网页下载功能.实现思路就是前面java版爬虫差不多,把网页拉回来,再正则regex解析信息--总结起来 ...

  4. roguelike地图的随机生成算法

    如果要想自己设计一个roguelike游戏,那么需要你有一个随机地图生成,我在indienova上看到一篇文章,描述了一个roguelike算法,然后自己用unity实现了一个下. 原文地址:随机生成 ...

  5. 解决“System.Data.OracleClient需要Oracle客户端软件8.1.7或更高版本”

    问题描述:远程访问该数据库(客户端同样是Oracle11g)提示“System.Data.OracleClient需要Oracle客户端软件8.1.7或更高版本”. 解决的办法: 1.一定要关闭Win ...

  6. Apache CXF简介

    Apache CXF是一个开源的,全功能的,容易使用的Web服务框架.CXF是由Celtix和XFire合并,在Apache软件基金会共同完成的.CXF的名字来源于"Celtix" ...

  7. mysql使用小结

    一.修改 mysql 的 root 密码 mysql> use mysql;  mysql> update user set password=password('123456') whe ...

  8. now code——处女座的期末复习

    题目描述 快要期末考试了,处女座现在有n门课程需要考试,每一门课程需要花ai小时进行复习,考试的起始时间为bi,处女座为了考试可以不吃饭不睡觉,处女座想知道他能否复习完所有的科目(即在每一门考试之前复 ...

  9. HDU 3501【欧拉函数拓展】

    欧拉函数 欧拉函数是指:对于一个正整数n,小于n且和n互质的正整数(包括1)的个数,记作φ(n) . 通式:φ(x)=x*(1-1/p1)(1-1/p2)(1-1/p3)*(1-1/p4)-..(1- ...

  10. C++两个类相互引用错误留影

    java中类相互引用很方便,c++中有编译顺序的问题 c++声明作用,告诉编译器,我声明的东西你要是找不到,那就跳过去吧,等全编译完你就可以找到了. C1.h #pragma once #includ ...