当前位置:网站首页>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 暴搜专题
- This article takes you to learn in detail what is fiber to home FTTH
- Pywin32 opens the specified window
- 13. Semaphore critical zone protection
- 网络通信学习
- SUS系统可用性量表
- [pit avoidance guide] pit encountered by unity3d project when accessing Tencent bugly tool
- 【虚幻4】从U3D到UE4的转型之路
- 2021-09-12
- Stm32 et développement de moteurs (système supérieur)
猜你喜欢
随机推荐
js promise. all
The nanny level tutorial of flutter environment configuration makes the doctor green to the end
网络通信学习
Allure -- common configuration items
stm32和电机开发(上位系统)
618再次霸榜的秘密何在?耐克最新财报给出答案
Redis set password
SQOOP 1.4.6 INSTALL
Pytest learning --base
【避坑指南】Unity3D项目接入腾讯Bugly工具时遇到的坑
简洁、快速、节约内存的Excel处理工具EasyExcel
Understand the composition of building energy-saving system
【Lua】常见知识点汇总(包含常见面试考点)
[IDL] Research
Operator-1初识Operator
[Fantasy 4] introduction and use of UMG components (under update...)
Pytest-- test report allure configuration
【Unity3D】制作进度条——让Image同时具有Filled和Sliced的功能
STM32 and motor development (upper system)
Database dictionary Navicat automatic generation version


![[Fantasy 4] the transformation from U3D to UE4](/img/bb/665eba3c8cd774c94fe14f169121da.png)






