当前位置:网站首页>UVM - configuration mechanism
UVM - configuration mechanism
2022-07-02 10:41:00 【weixin_ forty-five million seven hundred and four thousand five】
Here we use three examples to introduce uvm_config_db Usage of
To configure sequence produce transaction The number of
1、 Add control variables item_num
2、 Use get() Get control variables item_num Configuration of
obtain :
class my_sequence extends uvm_sequence #(my_transaction_da3);
`uvm_object_utils(my_sequence)
int item_num = 10;
function new(string name = "my_sequence");
super.new(name);
endfunction
function void pre_randomize();
uvm_config_db#(int)::get(m_sequencer, "", "item_num", item_num);
endfunction
virtual task body();
if(starting_phase != null)
starting_phase.raise_objection(this);
repeat(item_num) begin
`uvm_do(req);
end
#100;
if(starting_phase != null)
starting_phase.drop_objection(this);
endtask
endclass
Set up :
class my_test extends uvm_test;
`uvm_component_utils(my_test)
my_env m_env;
function new(string name = "", uvm_component parent);
super.new(name, parent);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
m_env = my_env::type_id::create("m_env", this);
uvm_config_db#(uvm_object_wrapper)::set(
this, "*.m_seqr.run_phase",
"default_sequence", my_sequence::get_type());
uvm_config_db#(int)::set(this, "*.m_seqr", "item_num", 20);
endfunction
virtual function void start_of_simulation_phase(uvm_phase phase);
super.start_of_simulation_phase(phase);
uvm_top.print_topology(uvm_default_tree_printer);
endfunction
endclass
To configure interface
Join in DUT, stay driver Create a virtual interface in .
class my_driver extends uvm_driver #(my_transaction);
`uvm_component_utils(my_driver)
virtual dut_interface m_vif;
function new(string name = "my_driver", uvm_component parent);
super.new(name, parent);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
uvm_config_db#(virtual dut_interface)::get(this, "", "vif", m_vif);
endfunction
virtual task pre_reset_phase(uvm_phase phase);
super.pre_reset_phase(phase);
`uvm_info("TRACE", $sformatf("%m"), UVM_HIGH)
phase.raise_objection(this);
m_vif.driver_cb.frame_n <= 'x;
m_vif.driver_cb.valid_n <= 'x;
m_vif.driver_cb.din <= 'x;
m_vif.driver_cb.reset_n <= 'x;
phase.drop_objection(this);
endtask
...
endclass
stay top Configure the interface in
uvm_config_db#(virtual dut_interface)::set(null, "*.m_agent.*", "vif", inf);
The above two can be seen in the code lab04.
Configure user-defined config class
Define two configuration classes
1、agent_config
class agent_config extends uvm_object;
uvm_active_passive_enum is_active = UVM_ACTIVE;
int unsigned pad_cycles = 5;
virtual dut_interface m_vif;
`uvm_object_utils_begin(agent_config)
`uvm_field_enum(uvm_active_passive_enum, is_active, UVM_ALL_ON)
`uvm_field_int(pad_cycles, UVM_ALL_ON)
`uvm_object_utils_end
function new(string name = "agent_config");
super.new(name);
endfunction
endclass
2、env_config
class env_config extends uvm_object;
int is_coverage = 0;
int is_check = 0;
agent_config m_agent_cfg;
`uvm_object_utils_begin(env_config)
`uvm_field_int(is_coverage, UVM_ALL_ON)
`uvm_field_int(is_check, UVM_ALL_ON)
`uvm_field_object(m_agent_cfg, UVM_ALL_ON)
`uvm_object_utils_end
function new(string name = "env_config");
super.new(name);
m_agent_cfg = new("m_agent_cfg");
endfunction
endclass
stay top、my_test、my_env、master_agent、my_driver Configuration in sequence . See the code for details lab05.
Use steps
1、 Define control variables or control objects .
2、 Before using these control variables or objects , Use uvm_config_db#(type)::get To get the configuration from a high level .
3、 Use these control variables or objects to configure the platform or behavior .
4、 Use... At high levels uvm_config_db#(type)::set To configure these control variables or objects .
边栏推荐
- 数据库字典Navicat自动生成版本
- 【虚幻4】UMG组件的简介与使用(更新中...)
- pytest框架实现前后置
- AttributeError: type object ‘Image‘ has no attribute ‘fromarray‘
- Test -- Summary of interview questions
- Windows环境MySQL8忘记密码文件解决方案
- SQOOP 1.4.6 INSTALL
- LeetCode+ 76 - 80 暴搜专题
- [Fantasy 4] introduction and use of UMG components (under update...)
- Mock Server基本使用方法
猜你喜欢
互联网快讯:腾讯会议应用市场正式上线;Soul赴港递交上市申请书
Operator-1初识Operator
Allure -- common configuration items
This article takes you to learn in detail what is fiber to home FTTH
4. Random variables
axis设备的rtsp setup头中的url不能带参
07 data import sqoop
Considerations for Apache deploying static web page projects
【避坑指南】使用UGUI遇到的坑:Text组件无法首行缩进两格
AI技术产业热点分析
随机推荐
12. Process synchronization and semaphore
[jetbrain rider] an exception occurred in the construction project: the imported project "d:\visualstudio2017\ide\msbuild\15.0\bin\roslyn\microsoft.csh" was not found
AttributeError: type object ‘Image‘ has no attribute ‘fromarray‘
拆解美图SaaS:开着飞机换引擎
js promise.all
Flutter——Canvas自定义曲线图
Sum the two numbers to find the target value
01安装虚拟机
[IDL] Research
2021-10-04
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
Redis set password
Zlib download and use
Windows环境MySQL8忘记密码文件解决方案
合并有序数列
Edge computing accelerates live video scenes: clearer, smoother, and more real-time
Deep understanding of redis cache avalanche / cache breakdown / cache penetration
Postman--使用
What are the popular frameworks for swoole in 2022?
Session cookies and tokens