Search code examples
system-verilogspecmansystem-verilog-dpi

Implementing System verilog’s $value$plusargs() system function in Specman E


What is the equivalent syntax or implementation for System verilog‘s $value$plusargs option in Specman E ?

I am working in converting a source code from System verilog to Specman E, I am stuck with implementing $value$plusargs() system function in Specman E. How do I pass the arguments from command line or Makefile to the source code in Specman E ?. Here is the System verilog sample code which I want to convert and implement in Specman E environment ,

    function load_testname();
        if($value$plusargs("test=%s",test_name_s)) begin 
          $display(“Running testcase is %s”,test_name_s); 
        end 
     endfunction

I may also need $test$plusargs() implementation in Specman E. Please help.


Solution

  • For $value$plusargs(...), there is the sn_plusarg_value(arg: string): string method. For $test$plusargs(...) there is sn_plusarg_exists(arg: string): bool.

    You pass plusargs to Specman with the +plusarg[=value] command line argument.

    Examples:

    var test_name := sn_plusarg_value("test");
    var number_i := sn_plusarg_value("number").as_a(int);