how to run a Tcl script with argument in windows Modelsim?

Status
Not open for further replies.

wwfhm2002

Member level 5
Joined
Dec 7, 2003
Messages
83
Helped
6
Reputation
12
Reaction score
5
Trophy points
1,288
Activity points
686
how to run tcl script modelsim

I have a Tcl script to run simulation on modelsim as below (test.tcl):

# Setting library directory, 1
vlib work

# Loading configuration
set vlogdumpon 0
foreach arg $argv {
switch -regexp -- $arg {
-TC {set vsimtc 1}
}
}

if {$vsimtc == 1} {
vsim work.mpx2_tb
} else {
vsim work.mpx2_tb +notimingchecks
}
# Run
run -all


Now in Win2000 modelsim command window, I run: source test.tcl -TC
The modelsim give me: # wrong # args: should be "source fileName"

How can I run test.tcl with argument, or other equivalent solution?
 

tcl script to run modelsim

wwfhm2002 said:
Now in Win2000 modelsim command window, I run: source test.tcl -TC
The modelsim give me: # wrong # args: should be "source fileName"

How can I run test.tcl with argument, or other equivalent solution?

That's a classical TCL problem, with some google you can find several solutions. One I like is here:

Code:
proc src {file args} {
   set argv $::argv
   set argc $::argc
   set ::argv $args
   set ::argc [llength $args]
   set error [catch {uplevel [list source $file]} return]
   if { $error } { set code error } { set code ok }
   set ::argv $argv
   set ::argc $argc
   return -code $code $return
 }

Say, put this in a file named "src_with_args.tcl". First source it inside TCL Shell first, then this new proc becomes visible. Now one can do:

src arg.tcl -TC

I tried it in tclsh under Cygwin, not sure how MTI handles it.

HTH
Ajeetha
www.noveldv.com
 

execute tcl script windows

Hi

Thanks for the tcl script src_with_args. I just tried this on ModelSim 6.1 using the test.tcl file posted earlier and it works a treat.

src test.tcl -TC
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…