🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.verilog
Article #108

Re: Accessing command line arguments

#108
From: W. Scott Cranston
Date: Wed, 30 Sep 1992 02:34
47 lines
1898 bytes
In article <90432@netnews.upenn.edu> ekenberg@down.hep.upenn.edu 
(Tor L. Ekenberg) writes:
 
> Sorry if this a FAQ, but how can I access the command line arguments I started
> verilog with?
> 
> Thanks in advance,
> 
> 				- tor
> 

My answer is in two parts:

1) From the HDL, you can only get the plusargs, using the predefined
system task $scan$plusargs.  This returns true or false depending on
whether the specifed plusarg is on the command line.  For example:


yourhost> verilog -axs +plusarg1value +plusarg2ref file.v

And in your description you put

reg r;
r = $scan$plusargs("plusarg1"); //r will be 1
r = $scan$plusargs("plusarg3"); //r will be 0

2) Using the PLI, you can also access the plusargs using the function
mc_scan_plusargs().  This will give the remainder of the argument.
Using the same command line as above:

char *arg = mc_scan_plusargs("plusarg1"); 

will set arg to "value."

There is currently no way to get all the arguments.  In the future
there may be hooks in the PLI to get argc and argv, but not currently.


Enjoy,
 WSC


--
+---------^>        "The Spirit of Massachusetts is the Spirit of America"
|        <                    -Massachusetts Division of Tourism
+-------. \   7     "Right..."
         \_\_/                -cranston@cadence.com
Technical Details
Message-ID: <CRANSTON.92Oct12101806@ayn.cadence.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!Cadence.COM!cadence.com!cranston
References: <90432@netnews.upenn.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.verilog
Path: arc1-ca.pugleaf.net!sparky!uunet!Cadence.COM!cadence.com!cranston
From: cranston@ayn.cadence.com (W. Scott Cranston)
Subject: Re: Accessing command line arguments
In-Reply-To: ekenberg@down.hep.upenn.edu's message of 25 Sep 92 19:43:13 GMT
Message-ID: <CRANSTON.92Oct12101806@ayn.cadence.com>
Sender: usenet@Cadence.COM (Usenet News)
Nntp-Posting-Host: ayn
Organization: Cadence Design Systems, Lowell MA, United States of America
References: <90432@netnews.upenn.edu>
Distribution: usa
Date: Wed, 30 Sep 1992 02:34:06 GMT
Lines: 47