uvm源码阅读(1)——uvm_misc/uvm_void

前置了解
1. typedef
1)常用自定义类型

提供一个类型名,可以简单地理解为文本替换,提高代码的可读性

typedef int WIDTH_TYPE
2)前置定义

常用在要用的class还没有定义时,提前typedef一下

typedef class B;/
class A;
    B b;
    int xx;
endclass

class B;
    A a;
    logic tmp;
endclass
2. virtual class

    虚类一般用来定义类的格式,、类的成员、类的参数等,虚类不能被实例化,只能被扩展(重载)后实例化,用于在项目中定义一些标准的类。

    虚类中的方法通常使用关键字 " pure virtual " 纯虚方法。同时OOP规定,只要class中存在一个没有被实现的pure function,就不允许例化这个class。

    virtual class (抽象类):可以被扩展但是不能被直接例化,由抽象类扩展而来的类,只有在所以的虚拟方法都有实体的时候才能被例化。
    pure virtual function(纯虚方法):没有实体的方法原型,相当于一个声明,只能在抽象类中定义。

uvm_misc.svh

misc其实是英文miscellaneous的前四个字母,杂项、混合体、大杂烩的意思。

uvm_void

是所有uvm class的基础。没有data member 或者functions。

uvm_scope_stack

m_stack:局部字符串类型队列

the scope stack is used for messages that are emited by policy classes

 存放uvm路径(scope

该类中主要实现了以下内容:

function内容

depth

return 局部字符串类型队列深度
get获取字符串队列m_stack内所有字符串并用点号“.”对各字符串进行拼接。若某字符串以“[”“(”“{”其开头,追加到前一字符串尾部且不以点号分隔。
get_arg返回字符串m_arg

set

清空队列m_stack及m_arg,然后把指定字符串给到m_stack
down指定string给到m_stack,并且清空m_arg
down_element指定int给到m_stack,并且清空m_arg
up_element从m_stack.pop_back一个元素,如果非空or"[" push会m_stack; (清除队列中“”,“[”)
up

从m_stack队尾取scope并清空m_arg,s=“” 或 输入“." 跳出while

set_arg设置m_arg,且不能为“”
set_arg_elementset_arg_element增加了一个int类型的输入参数ele,ele转为字符串后,m_arg = arg[ele]
unset_arg当unset_arg的输入参数arg与m_arg相同时清空m_arg

uvm_status_containter

用来包含automation methods 状态信息的内置的class(internal class to contain status information for automation methods)

function内容

do_field_check 

define UVM_ENABLE_FIELD_CHECKS

检测field数组中是否存在指定的field,不存在则报error

get_function_type返回指定int类型对应的string
get_ful_scope_arg调用uvm_scope_stack的get函数返回m_stack内所有字符串
m_do_cycle_check

utility function used to perform a cycle check when config setting are pushed to uvm_objects.  the function has to look at the current object stack representing the call stack of all __m_uvm_field_automation() invocations. it is a only a cycle if the previous __m_uvm_field_automation call scope is not identical with the current scope AND the scope is already present in the object stack

将配置设置push到uvm_objects时执行cycle check的

实用程序函数。该函数必须查看当前对象堆栈,该堆栈表示所有__m_uvm_field_automation()调用的调用堆栈。如果前一个__m_uvm_field_automation调用作用域与当前作用域不相同,并且该作用域已存在于对象堆栈中,则这只是一个循环 ?

uvm_copy_map

local uvm_object m_map[uvm_object]

function内容
setm_map[key]= obj,将obj放入m_map
get如果存在key,return m_map[key]
clear清空m_map
delete

删除m_map中的某个

uvm_seed_cell

uvm_seed_map

内置function

function uvm_instance_scope:返回uvm lib所在的层级(import uvm_pkg::*的地方)或者module 或者package

function uvm_oneway_hash:单向哈希算法,多用于用以生成随机seed

function uvm_create_random_seed:生成随机seed,此处就用了oneway hash,生成的seed会加入seed_table中

function uvm_object_value_str:把指定uvm_object类型的object转换为字符串str,返回字符串@str

function uvm_leaf_scope:拆分full_name。

function uvm_vector_to_string:向量参数转字符串

function uvm_get_array_index_int:检测指定字符串是否为整型数组的index,如果是,index是什么

function uvm_get_array_index_string:检测指定字符串是否为字符串数组的索引

function uvm_is_array:判断是否为数组(检测最后一位字符是否为“]”)

function uvm_has_wildcard:判断是否有通配符

uvm_utils

包含有用的临时function

function内容
find_all调用uvm_root::find_all,在uvm_component队列中查找所有start(用户指定的component)之后的已经例化的component
find调用了find_all,但只返回第一个查找到的component
create_type_by_name调用uvm_factory的create_object_by_name,根据name创建object
get_config获取指定uvm_component的所有config

process_container_c 

进程容器

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值