一、config文件夹
config文件:
-
对不同组件的变量进行声明,任何你想要全局共享的变量都可以放进来
-
声明virtual_if、reg_model_block和vip_config
-
工厂注册和域的自动化(方便后期通过log查看)
-
如果有vip_config要在new函数里创建
function new(string name ="your_config"); super.new(name); vip_cfg = vip_config::type_id::create("vip_cfg"); endfunction
二、tb文件夹
1、tb文件
-
定义module
-
包含uvm包和头文件
import uvm_pkg::*; `include "uvm_macros.svh"
-
包含你自己的包
import your_pkg::*;
-
定义所需的bit clk,rstn,使用initial语句块和非阻塞赋值语句
-
例化interface,也许有多个,全都需要例化
- 将module中定义的clk,rstn赋值给if_inst的clk,rstn
- 如果有需要的话,也可以在此处将一些dut信号抓取给interface,但是尽量避免这种行为
-
例化DUT,并进行连接
- 连接dut全部通过interface进行,所以除了module中定义的clk,rstn外其他信号都在if文件中定义
-
initial块开始测试,并且将全部例化后的interface实例通过config传递给需要的组件
-
interface只能在module这儿例化,别的地方都是virtual,所以需要传递一下
initial begin uvm_config_db#(virtual apb_if)::set(uvm_root::get(), "uvm_test_top.env.vip_mst", "vif", apb_if_inst); uvm_config_db#(virtual rkv_timer_if)::set(uvm_root::get(), "uvm_test_top", "vif", timer_if_inst); run_test(""); end
-
tun_test函数的含义:Phases all components through all registered phases. If the optional test_name argument is provided, or if a command-line plusarg, +UVM_TESTNAME=TEST_NAME, is found, then the specified component is created just prior to phasing. The test may contain new verification components or the entire testbench, in which case the test and testbench can be chosen from the command line without forcing recompilation. If the global (package) variable, finish_on_completion, is set, then $finish is called after phasing completes.
-
2、if文件
interface中的信号是连接软件和硬件的
-
声明所有dut所需的接口信号以及你在验证中可能需要的一些变量信号,大多数都是logic类型
-
为信号做连接,多使用assign语句和always语句块
assign vip_clk_gated = vip_clk; always @(vip_rstn,clk) begin if(!vip_rstn) out <= 0; else if(a) out <= clk; end
三、env文件夹
1、pkg文件
- pkg也要包含UVM包和头文件,还需要你所引用的vip的包等。
- pkg要包含所有的文件,建议编辑一个添加一个
2、env文件
- <