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.
> 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?
lindex argv 0 ==> -gui
lindex argv 1 ==> .....nothing
lindex argv 2 ==> .....nothing
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?
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