Creating Configurable Environments with Hierarchical and Global Options (vmm_opts) in VMM

Verification environments need to accommodate changing specifications and at 
the same time cater to the requirements of different clusters and subsystems.
vmm_opts provides the ability to provide a high level of configurability so 
that environments can work for different DUTs. This article shows how to use 
vmm_opts not just to set the switches globally and hierarchically, but also to 
specify the address ranges in scenarios from the test cases and the 
command-line.


First, you need to create a list of controls/switches that should be 
provided as global options (like simulation timeout, scoreboard/coverage enable,
etc.) and then another set of hierarchical options to control instance specific
behavior (like number of transactions to be generated, burst enables, 
transaction speed, address ranges to be generated by a specific instance, etc.)


Global options:
Step 1:
Declare an integer, say simulation_timeout in the environment class or wherever
it is required and use vmm_opts::get_int(..) method as shown below. Specify a 
default value as well just in case, if the variable is not set anywhere.


simulation_timeout = vmm_opts::get_int("TIMEOUT", 10000);


Step 2:
Then either at the test case or at the command-line, this can be overridden
using vmm_opts::set_int or +vmm_opts+ runtime option.


Overridding from the test case:


vmm_opts::set_int("%*:TIMEOUT", 50000); 


In the examples above, "%*" specified any hierarchy and hence this will apply
to all classes wherever there is a TIMEOUT variable.
Overridding from the command-line.


./simv +vmm_opts+TIMEOUT=80000


Options can also be overridden from a command file. Also, options can be a 
string or Boolean variable as well.


Hierarchical options:
In order to use hierarchical options, the parent child hierarchy should be 
established across components while creating the verification environment. This
is possible by passing the parent handle to any component during construction
or through the set_parent_object() method. Since all VMM base classes extend
from vmm_object, all derived classes can thus use this method. This is required
since the hierarchy specified externally (from test case/command line) will be
used to map the hierarchy in the environment. The following steps shows how 
hierarchical options are used.


Step 1:
Declare options, say burst_enable and num_of_trans in a subenv class and use 
vmm_opts::get_object_bit(..) and vmm_opts::get_object_int(..) to retrieve 
appropriate values. This is done by passing the current hierarchy and default 
values as arguments. Also, for setting ranges, declare min_addr and max_addr,
 and use get_object_range().


class master_subenv extends vmm_subenv;
    bit burst_enable;
    int num_of_trans;
    int min_addr;
    int max_addr;
    function void configure();
          bit is_set; //to determine if the default value is overridden
          burst_enable = vmm_opts::get_object_bit(is_set, this, "BURST_ENABLE");
          num_of_trans = vmm_opts::get_object_int(is_set, this, "NUM_TRANS", 100);
          vmm_opts::get_object_range(is_set, this, "ADDR_RANGE", 0, 32'hFFFF_FFFF);
          ....
    endfunction
 endclass


Step 2:
Build the environment with parent/child hierarchy either by passing the parent
handle through the constructor to every child, or using 
vmm_object::set_parent_object() method. This is easy as almost all base classes
 are extended from vmm_object by default.


class  dut_env extends vmm_env;
       virtual function build();
         .....
         mst0 = new("MST0", ....);
         mst0.set_parent_object(this);
         mst1 = new("MST1", ...);
         mst1.set_parent_object(this);
        ....
       endfunction
endclass


Step 3:
From the test case, you can override the default value using vmm_opts::set_bit 
or vmm_opts::set_int(..) specifying the hierarchy. You can also use pattern 
matching as well to avoid specifying the overrides only for specific instances
as in the patterns mentioned.  


vmm_opts::set_int("%*:MST0:NUM_TRANS", 50);
This will only override the NUM_TRANS value in MST0 instance to 50.


vmm_opts::set_int("%*:MST1:NUM_TRANS", 100); 
This will only override the NUM_TRANS value in MST1 instance.


vmm_opts::set_bit("%*:burst_enable);
This will override the burst_enable variable and set it to 1 in all instances.


vmm_opts::set_range("%*:MST1:ADDR_RANGE", 32'h1000_0000, 32'h1000_FFFF);
This will override the ADDR_RANGE in MST1 instance.


The default value can be overriden from the command-line as well.
./simv +vmm_opts+NUM_TRANS=50@%*:MST0+NUM_TRANS=100@%*:MST1+burst_enable@%*


In summary, vmm_opts provides a powerful and user friendly way of configuring 
the environment from the command-line or the test case. 
There is also a possibility to auto-document these options. You can provide the 
explanation of each of the options in the get_object_*() and get_*() methods 
and this will be displayed when vmm_opts::get_help() is called or 
+vmm+help is passed at runtime. The details of the override from different
hierarchies including the line numbers and the file numbers will also be 
displayed. For more details on these classes, please refer to the VMM User Guide.
## 软件功能详细介绍 1. **文本片段管理**:可以添加、编辑、删除常用文本片段,方便快速调用 2. **分组管理**:支持创建多个分组,不同类型的文本片段可以分类存储 3. **热键绑定**:为每个文本片段绑定自定义热键,实现一键粘贴 4. **窗口置顶**:支持窗口置顶功能,方便在其他应用程序上直接使用 5. **自动隐藏**:可以设置自动隐藏,减少桌面占用空间 6. **数据持久化**:所有配置和文本片段会自动保存,下次启动时自动加载 ## 软件使用技巧说明 1. **快速添加文本**:在文本输入框中输入内容后,点击"添加内容"按钮即可快速添加 2. **批量管理**:可以同时编辑多个文本片段,提高管理效率 3. **热键冲突处理**:如果设置的热键与系统或其他软件冲突,会自动提示 4. **分组切换**:使用分组按钮可以快速切换不同类别的文本片段 5. **文本格式化**:支持在文本片段中使用换行符和制表符等格式 ## 软件操作方法指南 1. **启动软件**:双击"大飞哥软件自习室——快捷粘贴工具.exe"文件即可启动 2. **添加文本片段**: - 在主界面的文本输入框中输入要保存的内容 - 点击"添加内容"按钮 - 在弹出的对话框中设置热键和分组 - 点击"确定"保存 3. **使用热键粘贴**: - 确保软件处于运行状态 - 在需要粘贴的位置按下设置的热键 - 文本片段会自动粘贴到当前位置 4. **编辑文本片段**: - 选中要编辑的文本片段 - 点击"编辑"按钮 - 修改内容或热键设置 - 点击"确定"保存修改 5. **删除文本片段**: - 选中要删除的文本片段 - 点击"删除"按钮 - 在确认对话框中点击"确定"即可删除
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值