Pass cfg from cmd to test

Pass cfg from cmd to test

  • [1 Pass cfg from sh to case](#1 Pass cfg from sh to case)
  • [1.1 v a l u e value valueplusargs()`](#1.1 v a l u e value valueplusargs()`)
  • [1.2 uvm_config_int::get()<--->uvm_set_config_int/string/](#1.2 uvm_config_int::get()<--->uvm_set_config_int/string/)

The article's purpose is to solve the flexity; you can pass cfg to test by cmd directly; this is convinent for you to control or constraint the case;
Now,there are two common ways to do it;

1 Pass cfg from sh to case

1.1 v a l u e value valueplusargs()`

In any compenent,you use the usage;

sv 复制代码
        function void base_test:build_phase();
                super.build_phase(phase);
                if(!$value$plusargs("mask_mode=%0d",mask_mode)) begin
                        `uvm_error("base_test","mask_mode is set to default");
                end
        endfunction:build_phase
sh 复制代码
        #在末尾添加参数run_opt;
        -run_opt  +mask_mode=9

1.2 uvm_config_int::get()<--->uvm_set_config_int/string/

In any component,you should code in it; Principle: It will creats a diction,then put it in pool; you will use get it at any time;

you can put the code anywhere;

sv 复制代码
        function void base_test:build_phase();
                super.build_phase(phase);
                if(!uvm_config_int::get(this,"","mask_mode",mask_mode)) begin
                        `uvm_error("base_test","mask_mode is set to default");
                end
        endfunction:build_phase 
sh 复制代码
#末尾添加参数
-run_opt  +uvm_set_config_int="uvm_test_top,mask_mode,12" &

Note the difference between the two ways;

Advantage: you can use it even under regression;

regression 复制代码
# Add in the regression.txt
TESTS += xx_test;+uvm_set_config_int="uvm_test_top,mask_mode,12"
相关推荐
啄缘之间2 天前
17. 示例:用assert property检查FIFO空满标志冲突
学习·fpga开发·verilog·uvm·sv
啄缘之间10 天前
7. 覆盖率:covergroup/coverpoint/cross
学习·测试用例·verilog·uvm·sv
啄缘之间13 天前
4. 示例:创建带约束的随机地址生成器(范围0x1000-0xFFFF)
学习·测试用例·verilog·uvm·sv
啄缘之间16 天前
4.6 学习UVM中的“report_phase“,将其应用到具体案例分为几步?
学习·verilog·uvm·sv
啄缘之间21 天前
3.9 学习UVM中的uvm_env类分为几步?
学习·verilog·uvm·sv
啄缘之间22 天前
3.3 学习UVM中的uvm_driver 类分为几步?
学习·测试用例·verilog·uvm
啄缘之间1 个月前
verilog练习:i2c slave 模块设计
学习·fpga开发·verilog·uvm
啄缘之间1 个月前
1.4 学习序列(Sequence)分为几步?
学习·uvm·sv
啄缘之间1 个月前
verilog练习:8bit移位寄存器
开发语言·学习·fpga开发·verilog·uvm
啄缘之间1 个月前
3. 学习UVM的核心组件
学习·verilog·uvm·sv