diff --git a/tools/modelsim/commands.do b/tools/modelsim/commands.do index 39c9da54afe13ffd703644b1f74c106acce8a431..f33854891923406e5d7a11de359a5a00f6d519ea 100644 --- a/tools/modelsim/commands.do +++ b/tools/modelsim/commands.do @@ -47,7 +47,7 @@ # HDL library settings #------------------------------------------------------------------------------- -puts "Loading general HDL library commands..." +echo "Loading general HDL library commands..." proc hdl_env {} { global env @@ -67,15 +67,27 @@ proc get_cur_lib {} { proc lp {{arg_lib ""}} { set cur_lib [get_cur_lib] - if {$arg_lib == "" || $arg_lib == $cur_lib} { + if {$arg_lib=="help"} { + echo "" + echo "lp \[project\]" + echo " possible projects are:" + echo " <lib_name> : load project <lib_name>.mpf" + echo " : report current project library" + echo " all : report all libraries that the current project library depends on" + echo " help : displays this help" + echo "" + } elseif {$arg_lib == "" || $arg_lib == $cur_lib} { return $cur_lib + } elseif {$arg_lib=="all"} { + read_lib_compile_order_file $cur_lib + return } else { set sim [simdir $arg_lib] if {[eval project env]!=""} { - project close + project close ;# close current project } - project open $sim/$arg_lib.mpf - return $arg_lib + project open $sim/$arg_lib.mpf ;# load project for the requested library + return $arg_lib } } @@ -92,21 +104,22 @@ proc project_mk_cmds {} { proc parse_for_cmds arg_list { set cmds {} if [ string equal $arg_list "help" ] then { - puts "mk \[commands\] \[projects\]" - puts " possible commands are:" - puts " clean: removes the library files" - puts " compile: runs project compileall" - puts " files: list files in compile order" - puts " help: displays this help" - puts " make: runs makefile" - puts " test: runs test cases" - puts " vmake: creates makefile" - puts "" - puts "commands are executed for the projects indicated" - puts "- when no command is specified, 'make' is used as default" - puts "- when no projects are specified, the current project is used" - puts "- when the keyword 'all' is specified, then the command is applied to all projects that the current project depends on" - puts "" + echo "" + echo "mk \[commands\] \[projects\]" + echo " possible commands are:" + echo " clean: removes the library files" + echo " compile: runs project compileall" + echo " files: list files in compile order" + echo " help: displays this help" + echo " make: runs makefile" + echo " test: runs test cases" + echo " vmake: creates makefile" + echo "" + echo " commands are executed for the projects indicated" + echo " - when no command is specified, 'make' is used as default" + echo " - when no projects are specified, the current project is used" + echo " - when the keyword 'all' is specified, then the command is applied to all projects that the current project depends on" + echo "" return } else { # search for commands in arg_list @@ -175,7 +188,7 @@ proc mk args { } proc mk_clean {arg_lib} { - puts "\[mk clean $arg_lib\]" + echo "\[mk clean $arg_lib\]" set sim [simdir $arg_lib] if {[file exists "$sim/work"]} then { vdel -lib $sim/work -all @@ -194,10 +207,10 @@ 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." + echo "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\]" + echo "\[mk compile $arg_lib\]" lp $arg_lib if {[file exists "$sim/work"]} then { vdel -lib $sim/work -all @@ -209,7 +222,7 @@ proc mk_compile {arg_lib} { proc mk_files {arg_lib} { lp $arg_lib foreach file [project compileorder] { - puts $file + echo $file } } @@ -218,11 +231,11 @@ proc mk_vmake {arg_lib} { if {![file exists "$sim/work/_info"]} then { mk_compile $arg_lib } - puts "\[mk vmake $arg_lib\]" + echo "\[mk vmake $arg_lib\]" 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] + echo [exec vmake -fullsrcpath work > $sim/makefile] } vdel -lib $sim/work -all vlib work @@ -233,22 +246,22 @@ proc mk_make {arg_lib} { if {! [file exists "$sim/makefile"] } then { mk_vmake $arg_lib } - puts "\[mk make $arg_lib\]" + echo "\[mk make $arg_lib\]" if {[this_os]=="Windows"} { - puts [exec [hdl_env]/tools/bin/make.exe -C $sim -s -k -f makefile] + echo [exec [hdl_env]/tools/bin/make.exe -C $sim -s -k -f makefile] } else { - puts [exec /usr/bin/make -C $sim -s -k -f makefile] + echo [exec /usr/bin/make -C $sim -s -k -f makefile] } } proc mk_test {arg_lib} { - puts "\[mk test $arg_lib\]" + echo "\[mk test $arg_lib\]" radix -decimal vsim -quiet tst_lib.tb_$arg_lib set tb [tbdir $arg_lib] foreach tc [glob -directory $tb/data -type d -nocomplain tc*] { - puts "testcase $tc" + echo "testcase $tc" foreach fileName [glob -directory $tc -type f -nocomplain *.in *.out *.ref] { file copy -force $fileName . } @@ -295,7 +308,7 @@ proc read_lib_compile_order_file {arg_lib} { set data [string trim $data] ;# trim any trailing white space close $fp set lib_names [split $data] - puts $lib_names + echo $lib_names return $lib_names }