Home > Community > Forums > Functional Verification > Pass string to $system in SystemVerilog?

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Pass string to $system in SystemVerilog?  

Last post Thu, Jan 11 2007 6:05 PM by archive. 3 replies.
Started by archive 11 Jan 2007 06:05 PM. Topic has 3 replies and 2361 views
Page 1 of 1 (4 items)
Sort Posts:
  • Thu, Jan 11 2007 6:05 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    Pass string to $system in SystemVerilog? Reply

    Hi, I want to run perl command with dynamic argument in SystemVerilog. And I use Cadence IUS583. When I try to pass a string to $system(), the ncvlog said "Using String without index is not supported in the given context." The code I write like below, //--------------------- string perl_cmd_str = ""; $sformat(perl_cmd_str,"perl ./perl/test_opt_file.pl -a %0d -b 4", data_a); $display("string is %s\n", perl_cmd_str); $system (perl_cmd_str); //--------------------- Any suggestion on how to input string to $system()? Thanks! Davy


    Originally posted in cdnusers.org by davyzhu
    • Post Points: 0
  • Tue, Jan 16 2007 12:32 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Pass string to $system in SystemVerilog? Reply

    It doesn't address the question of passing a string to $system, but it does solve your problem:

    module test;

    int f;
    int data_a;
    string perl_cmd_str = "echo ";

    initial begin
      f=$fopen("run_sys.pl", "w");
      assert(randomize(data_a) with {data_a >= 0;});
      $sformat(perl_cmd_str,"perl ./perl/test_opt_file.pl -a %0d -b 4", data_a);
      $display("string is %s\n", perl_cmd_str);
      $fdisplay (f, "%s", perl_cmd_str);
      $system ("run_sys.pl");
    end

    endmodule


    Originally posted in cdnusers.org by tpylant
    • Post Points: 0
  • Tue, Jan 16 2007 9:36 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Pass string to $system in SystemVerilog? Reply

    Hi tpylant,

    I tried to change
    string perl_cmd_str = " ";
    to
    reg [100*8:1] perl_cmd_str = " ";
    And it turned out to be OK!

    I found Cadence SV implementation is ambigous on String and one-dimentional reg array.

    Best regards,
    Davy


    Originally posted in cdnusers.org by davyzhu
    • Post Points: 0
  • Tue, Jan 16 2007 9:38 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Pass string to $system in SystemVerilog? Reply

    The above reg ??*8:1]
    is
    reg [ 100*8 : 1 ]

    Best regards,
    Davy


    Originally posted in cdnusers.org by davyzhu
    • Post Points: 0
Page 1 of 1 (4 items)
Sort Posts:
Started by archive at 11 Jan 2007 06:05 PM. Topic has 3 replies.