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

  • 相关阅读:
    对模拟器虚假设备识别能力提升15%!每日清理大师App集成系统完整性检测
    教你实现华为快应用深色主题适配
    如何实现一个malloc
    如何提高团队管理能力?
    大型网站架构演变和知识体系
    call_user_func 和 call_user_func_array用法
    源码研究:php变量
    http协议简介
    用c语言实现http请求
    用socket写一个简单的客户端和服务端程序
  • 原文地址:https://www.cnblogs.com/jiang-ic/p/10579416.html
Copyright © 2011-2022 走看看