Reputation: 92
I am using a .do file which is used by GUI and by .tcl in command line (vsim -c) for simulating in Modelsim 10.3c
exec vsim -c -do DoFile.do
What I need is:
If an error happens, modelsim should be quit and return to the .tcl
. Otherwise it should simulate the project.
If I put the line onerror { quit -f }
in my .do
file the GUI is quit at the first error. So, this is not comfortable.
I didn't manage to use onerror
(warning: onerror command for use within macro
) or $error
(unknown variable) inside tcl
Upvotes: 2
Views: 5958
Reputation: 92
I have found a work around. I create a file in the .tcl and put the following lines into the .do scripts:
if [file exists ../Command_Line_Enable.txt] {
onerror { quit -f }
}
So, if that file is not generated the GUI will not exit.
Upvotes: 1
Reputation: 274
I would need further information about your DO and Tcl script but you can use try-catch on vcom (for compiling VHDL) or vlog (for compiling Verilog/SystemVerilog). Here a short a example how to use it:
# set variable for compile error
set comperror ""
# compile files
catch "vcom -quiet -93 -work work name.vhd" comperror
catch "vcom -quiet -93 -work work name2.vhd" comperror
# ... and futher files..
if [expr {${comperror}!=""}] then {
# quit modelsim or do anything else
} else {
# do simulation or execute further commands
}
You can compile ALL files and if a error occurs you can quit it. If it's successful you can run your simulation.
Upvotes: 3