Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top