diff --git a/tools/modelsim/commands.do b/tools/modelsim/commands.do index 548f0a63d80dd760358b94435362b362bac64bbd..39c9da54afe13ffd703644b1f74c106acce8a431 100644 --- a/tools/modelsim/commands.do +++ b/tools/modelsim/commands.do @@ -192,15 +192,17 @@ proc mk_clean {arg_lib} { } proc mk_compile {arg_lib} { + set sim [simdir $arg_lib] if {[string compare [env] "<No Context>"] != 0} { puts "A project cannot be closed while a simulation is in progress.\nUse the \"quit -sim\" command to unload the simulation first." return } puts "\[mk compile $arg_lib\]" lp $arg_lib - if {![file exists work"]} then { - vlib work; + if {[file exists "$sim/work"]} then { + vdel -lib $sim/work -all } + vlib work project compileall } @@ -217,16 +219,13 @@ proc mk_vmake {arg_lib} { mk_compile $arg_lib } puts "\[mk vmake $arg_lib\]" - if {![file exists "$sim/makefile"] || - ([file mtime "$sim/makefile"] < [file mtime "$sim/work/_info"]) } then { + if {![file exists "$sim/makefile"] || ([file mtime "$sim/makefile"] < [file mtime "$sim/work/_info"]) } then { # Both the specific library name $(arg_lib)_lib and the work library map to the same local work library, # so to be compatible for both names always use work to generate the makefile puts [exec vmake -fullsrcpath work > $sim/makefile] } - if {[file exists "$sim/work"]} then { - vdel -lib $sim/work -all - vlib work - } + vdel -lib $sim/work -all + vlib work } proc mk_make {arg_lib} { @@ -293,6 +292,7 @@ proc read_lib_compile_order_file {arg_lib} { append file_name "_lib_order.txt" set fp [open $sim/$file_name] set data [read $fp] + set data [string trim $data] ;# trim any trailing white space close $fp set lib_names [split $data] puts $lib_names