Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

passing command line argument on Modelsim

1,661 views
Skip to first unread message

paci...@gmail.com

unread,
Sep 18, 2007, 7:55:30 AM9/18/07
to
Hi,

I am a begginer in TCL.
I want to write a script in TCL to be sourced on Modelsim by saying

> do run.tcl

I want to pass some arguments to run.tcl on the above command line
i.e.

> do run.tcl test1 test2

I tried using argv but argv list does not contain the argument test1
whereas argc correctly shows number of arguments as 2.

Please help.

Alan Anderson

unread,
Sep 18, 2007, 7:58:31 AM9/18/07
to
paci...@gmail.com wrote:

> I want to pass some arguments to run.tcl on the above command line
> i.e.
>
> > do run.tcl test1 test2
>
> I tried using argv but argv list does not contain the argument test1
> whereas argc correctly shows number of arguments as 2.

What *does* argv contain?

pacific29

unread,
Sep 18, 2007, 8:00:18 AM9/18/07
to
On Sep 18, 4:58 pm, Alan Anderson <arand...@insightbb.com> wrote:

lindex argv 0 ==> -gui
lindex argv 1 ==> .....nothing
lindex argv 2 ==> .....nothing

suchenwi

unread,
Sep 18, 2007, 9:02:11 AM9/18/07
to

So the [do] command (which is not standard Tcl, but probably provided
by Modelsim) does not put its arguments into argv. Have you checked
the modelsim documentation?


Bryan Oakley

unread,
Sep 18, 2007, 9:46:09 AM9/18/07
to

It took me less than a minute to find the modelsim user guide on the net
(how did we ever live without google?), and it is written:

-begin quote-
You can increase the flexibility of DO files by using parameters.
parameters specify values that are passed to the corresponding
parameters $1 through $9 in the macro file. For example say the
macro "testfile" contains the line bp $1 $2. The command below would
place a breakpoint in the source file named design.vhd at line 127:

do testfile design.vhd 127

There is no limit on the number of parameters that can be passed to
macros, but only nine values are visible at one time. You can use the
shift command to see the other parameters.
-end quote-

--
Bryan Oakley
http://www.tclscripting.com

0 new messages