当前位置:网站首页>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 .
边栏推荐
- LeetCode+ 76 - 80 暴搜专题
- 2.hacking-lab脚本关[详细writeup]
- [unity3d] cannot correctly obtain the attribute value of recttransform, resulting in calculation error
- Is this code PHP MySQL redundant?
- Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
- Introduction to MySQL 8 DBA foundation tutorial
- 2021-09-12
- axis设备的rtsp setup头中的url不能带参
- Determine whether there are duplicate elements in the array
- 4.随机变量
猜你喜欢

Rapid prototyping

01 install virtual machine

Pytest learning --base

Operator-1初识Operator

Feature (5): how to organize information

Internet News: Tencent conference application market was officially launched; Soul went to Hong Kong to submit the listing application

SUS系统可用性量表

《MySQL 8 DBA基础教程》简介

Delivery mode design of Spartacus UI of SAP e-commerce cloud

Flutter——Canvas自定义曲线图
随机推荐
ERROR 1118 (42000): Row size too large (&gt; 8126)
Database dictionary Navicat automatic generation version
Ctrip starts mixed office. How can small and medium-sized enterprises achieve mixed office?
Message mechanism -- getting to know messages and message queues for the first time
两数之和,求目标值
pytest学习--base
Session cookies and tokens
2.hacking-lab脚本关[详细writeup]
Deep understanding of redis cache avalanche / cache breakdown / cache penetration
测试--面试题总结
session-cookie与token
使用sqlcipher打开加密的sqlite方法
Pywin32打开指定窗口
pytest框架实现前后置
Nonlinear optimization: steepest descent method, Newton method, Gauss Newton method, Levenberg Marquardt method
[unity3d] nested use layout group to make scroll view with dynamic sub object height
Internet News: Tencent conference application market was officially launched; Soul went to Hong Kong to submit the listing application
SPSS做Shapiro-Wilk正态分析
【Visual Studio】每次打开一个Unity3D的脚本,都会自动重新打开一个新的VS2017
[IDL] Research