Home > Community > Forums > Functional Verification > How to pass arguments to ncsc_run just like you would pass arguments from the command line to a C program.

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: *

 How to pass arguments to ncsc_run just like you would pass arguments from the command line to a C program. 

Last post Fri, Jun 10 2011 12:23 AM by Matthieu P. 2 replies.
Started by Matthieu P 09 Jun 2011 07:39 PM. Topic has 2 replies and 1671 views
Page 1 of 1 (3 items)
Sort Posts:
  • Thu, Jun 9 2011 7:39 PM

    • Matthieu P
    • Not Ranked
    • Joined on Thu, Jun 9 2011
    • Posts 2
    • Points 25
    How to pass arguments to ncsc_run just like you would pass arguments from the command line to a C program. Reply
    Hi dear community members,

    I'm trying to achieve the following:
    - Just like if I were passing arguments to a C program called "myprog" and running ./myprog arguments and then parse the arguments in the code using argc and argv. I'd like to do the same when I use ncsc_run to simulate my SystemC environment.
    - What I want to do is simple, I just want to give a value to one of my variables in one of my SystemC modules.

    I went through cdnshelp and ncsc_run -help but I couldn't spot the answer to my problem. Any help is appreciated, thanks in advance.
    • Post Points: 20
  • Thu, Jun 9 2011 10:21 PM

    • muffi
    • Top 500 Contributor
    • Joined on Tue, Aug 4 2009
    • Bangalore, Karnataka
    • Posts 22
    • Points 305
    Re: How to pass arguments to ncsc_run just like you would pass arguments from the command line to a C program. Reply
    You can use the +systemc_args option with the ncsc_run
    #include "systemc.h"
    
    int sc_main(int argc,char *argv[) {
    
    cout << "argc = " << argc << endl;
    cout << "argv[0] = " << argv[0] << endl;
    cout << "argv[1] = " << argv[1] << endl;
    cout << "argv[2] = " << argv[2] << endl;
    cout << "argv[3] = " << argv[3] << endl;
    
    return 0;
    }
    
    ncsc_run -sc_main +systemc_args+"x y z" test.cpp  
    • Post Points: 20
  • Fri, Jun 10 2011 12:23 AM

    • Matthieu P
    • Not Ranked
    • Joined on Thu, Jun 9 2011
    • Posts 2
    • Points 25
    Re: How to pass arguments to ncsc_run just like you would pass arguments from the command line to a C program. Reply
    Thank you very much!
    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by Matthieu P at 09 Jun 2011 07:39 PM. Topic has 2 replies.