zoukankan      html  css  js  c++  java
  • uvm_cmdline_processor

    无意中看到uvm_cmdline_processor,之前使用+UVM_TESTNAME也没深究,现在记录一下

    内部调用脚本中的参数,通过使用uvm_cmdline_processor可以从脚本层级,从外部向仿真环境传递参数

    get_arg_value( string match, ref string value )
    Function:
            get_arg_value


    This function finds the first argument which matches the match arg and
    returns the suffix of the argument. This is similar to the $value$plusargs
    system task, but does not take a formating string. The return value is
    the number of command line arguments that match the match string, and
    value is the value of the first match.

    使用例子:

    uvm_cmdline_processor clp = uvm_cmdline_processor::get_inst();

    等价于:

    uvm_cmdline_processor clp;

    clp=new();

     1 program automatic test;
     2 import uvm_pkg::*;
     3 
     4 class hello_world extends uvm_test;
     5 
     6 uvm_cmdline_processor clp;
     7 int arg_value;
     8 string arg;
     9 
    10 `uvm_component_utils(hello_world);
    11 
    12   function new (string name, uvm_component parent);
    13    super.new(name, parent);
    14    clp=new();
    15    if(clp.get_arg_value("+arg_value=",this.arg)) begin 
    16      this.arg_value=this.arg.atoi();
    17      `uvm_info("test_arg", $sformatf("input value = %d", arg_value), UVM_DEBUG);
    18    end 
    19    else begin
    20   `uvm_info("test_arg", "no input arg_value", UVM_DEBUG);
    21    end
    22 
    23   endfunction
    24 
    25 endclass
    26 
    27 initial begin
    28   run_test();
    29 end
    30 
    31 endprogram

    运行:
    ./simv +UVM_TESTNAME=hello_world +UVM_VERBOSITY=UVM_DEBUG +arg_value=100

    结果:

    UVM_INFO hello.sv(19) @ 0: uvm_test_top [test_arg] input value =         100

  • 相关阅读:
    强烈推荐:240多个jQuery插件【转】
    逆变与协变详解
    Mac入门 (二) 使用VMware Fusion虚拟机
    JQUERY UI DOWNLOAD
    几个常用Json组件的性能测试
    jQuery.extend 函数详解
    获取Portal中POWL程序的APPLID
    设计师和开发人员更快完成工作需求的20个惊人的jqury插件教程(上)
    Linux kernel中网络设备的管理
    mongodb修改器
  • 原文地址:https://www.cnblogs.com/jiang-ic/p/10579416.html
Copyright © 2011-2022 走看看