当前位置:网站首页>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 .
边栏推荐
猜你喜欢

Mongodb quickly get started with some simple operations of mongodb command line

Network real-time video streaming based on OpenCV

Stm32 et développement de moteurs (système supérieur)

Rapid prototyping

2021-10-02

Introduction and Principle notes of UE4 material

2021-10-04

axis设备的rtsp setup头中的url不能带参
![[SUCTF2018]followme](/img/63/9104f9c8bd24937b0fc65053efec96.png)
[SUCTF2018]followme

Shapiro Wilk normal analysis by SPSS
随机推荐
判断数组中是否存在重复元素
使用sqlcipher打开加密的sqlite方法
Mock Server基本使用方法
lunix重新分配root 和 home 空间内存
使用Windbg静态分析dump文件(实战经验总结)
Sum the two numbers to find the target value
Vscode auto format
13. Semaphore critical zone protection
《MySQL 8 DBA基础教程》简介
07数据导入Sqoop
[pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces
Windows环境MySQL8忘记密码文件解决方案
This article takes you to learn in detail what is fiber to home FTTH
STM32 and motor development (upper system)
js setTimeout()与面试题
Understand the composition of building energy-saving system
sqoop的表的导入
Use WinDbg to statically analyze dump files (summary of practical experience)
What are the popular frameworks for swoole in 2022?
allure--常用配置项