一种测试平台搭建方法

一、config文件夹

config文件:

  1. 对不同组件的变量进行声明,任何你想要全局共享的变量都可以放进来

  2. 声明virtual_if、reg_model_block和vip_config

  3. 工厂注册和域的自动化(方便后期通过log查看)

  4. 如果有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文件

  1. 定义module

  2. 包含uvm包和头文件

     import uvm_pkg::*;
      `include "uvm_macros.svh"
    
  3. 包含你自己的包

     import your_pkg::*;
    
  4. 定义所需的bit clk,rstn,使用initial语句块和非阻塞赋值语句

  5. 例化interface,也许有多个,全都需要例化

    • 将module中定义的clk,rstn赋值给if_inst的clk,rstn
    • 如果有需要的话,也可以在此处将一些dut信号抓取给interface,但是尽量避免这种行为
  6. 例化DUT,并进行连接

    • 连接dut全部通过interface进行,所以除了module中定义的clk,rstn外其他信号都在if文件中定义
  7. 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中的信号是连接软件和硬件的

  1. 声明所有dut所需的接口信号以及你在验证中可能需要的一些变量信号,大多数都是logic类型

  2. 为信号做连接,多使用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文件

  1. pkg也要包含UVM包和头文件,还需要你所引用的vip的包等。
  2. pkg要包含所有的文件,建议编辑一个添加一个

2、env文件

  1. <
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值