Skip to content
Snippets Groups Projects
Commit e193a468 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

use echo to transcript instead of puts to shell. Added 'lp help' and 'lp all'.

parent 3545aed1
No related branches found
No related tags found
No related merge requests found
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
# HDL library settings # HDL library settings
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
puts "Loading general HDL library commands..." echo "Loading general HDL library commands..."
proc hdl_env {} { proc hdl_env {} {
global env global env
...@@ -67,14 +67,26 @@ proc get_cur_lib {} { ...@@ -67,14 +67,26 @@ proc get_cur_lib {} {
proc lp {{arg_lib ""}} { proc lp {{arg_lib ""}} {
set cur_lib [get_cur_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 return $cur_lib
} elseif {$arg_lib=="all"} {
read_lib_compile_order_file $cur_lib
return
} else { } else {
set sim [simdir $arg_lib] set sim [simdir $arg_lib]
if {[eval project env]!=""} { if {[eval project env]!=""} {
project close project close ;# close current project
} }
project open $sim/$arg_lib.mpf project open $sim/$arg_lib.mpf ;# load project for the requested library
return $arg_lib return $arg_lib
} }
} }
...@@ -92,21 +104,22 @@ proc project_mk_cmds {} { ...@@ -92,21 +104,22 @@ proc project_mk_cmds {} {
proc parse_for_cmds arg_list { proc parse_for_cmds arg_list {
set cmds {} set cmds {}
if [ string equal $arg_list "help" ] then { if [ string equal $arg_list "help" ] then {
puts "mk \[commands\] \[projects\]" echo ""
puts " possible commands are:" echo "mk \[commands\] \[projects\]"
puts " clean: removes the library files" echo " possible commands are:"
puts " compile: runs project compileall" echo " clean: removes the library files"
puts " files: list files in compile order" echo " compile: runs project compileall"
puts " help: displays this help" echo " files: list files in compile order"
puts " make: runs makefile" echo " help: displays this help"
puts " test: runs test cases" echo " make: runs makefile"
puts " vmake: creates makefile" echo " test: runs test cases"
puts "" echo " vmake: creates makefile"
puts "commands are executed for the projects indicated" echo ""
puts "- when no command is specified, 'make' is used as default" echo " commands are executed for the projects indicated"
puts "- when no projects are specified, the current project is used" echo " - when no command is specified, 'make' is used as default"
puts "- when the keyword 'all' is specified, then the command is applied to all projects that the current project depends on" echo " - when no projects are specified, the current project is used"
puts "" echo " - when the keyword 'all' is specified, then the command is applied to all projects that the current project depends on"
echo ""
return return
} else { } else {
# search for commands in arg_list # search for commands in arg_list
...@@ -175,7 +188,7 @@ proc mk args { ...@@ -175,7 +188,7 @@ proc mk args {
} }
proc mk_clean {arg_lib} { proc mk_clean {arg_lib} {
puts "\[mk clean $arg_lib\]" echo "\[mk clean $arg_lib\]"
set sim [simdir $arg_lib] set sim [simdir $arg_lib]
if {[file exists "$sim/work"]} then { if {[file exists "$sim/work"]} then {
vdel -lib $sim/work -all vdel -lib $sim/work -all
...@@ -194,10 +207,10 @@ proc mk_clean {arg_lib} { ...@@ -194,10 +207,10 @@ proc mk_clean {arg_lib} {
proc mk_compile {arg_lib} { proc mk_compile {arg_lib} {
set sim [simdir $arg_lib] set sim [simdir $arg_lib]
if {[string compare [env] "<No Context>"] != 0} { 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 return
} }
puts "\[mk compile $arg_lib\]" echo "\[mk compile $arg_lib\]"
lp $arg_lib lp $arg_lib
if {[file exists "$sim/work"]} then { if {[file exists "$sim/work"]} then {
vdel -lib $sim/work -all vdel -lib $sim/work -all
...@@ -209,7 +222,7 @@ proc mk_compile {arg_lib} { ...@@ -209,7 +222,7 @@ proc mk_compile {arg_lib} {
proc mk_files {arg_lib} { proc mk_files {arg_lib} {
lp $arg_lib lp $arg_lib
foreach file [project compileorder] { foreach file [project compileorder] {
puts $file echo $file
} }
} }
...@@ -218,11 +231,11 @@ proc mk_vmake {arg_lib} { ...@@ -218,11 +231,11 @@ proc mk_vmake {arg_lib} {
if {![file exists "$sim/work/_info"]} then { if {![file exists "$sim/work/_info"]} then {
mk_compile $arg_lib 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 { 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, # 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 # 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 vdel -lib $sim/work -all
vlib work vlib work
...@@ -233,22 +246,22 @@ proc mk_make {arg_lib} { ...@@ -233,22 +246,22 @@ proc mk_make {arg_lib} {
if {! [file exists "$sim/makefile"] } then { if {! [file exists "$sim/makefile"] } then {
mk_vmake $arg_lib mk_vmake $arg_lib
} }
puts "\[mk make $arg_lib\]" echo "\[mk make $arg_lib\]"
if {[this_os]=="Windows"} { 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 { } 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} { proc mk_test {arg_lib} {
puts "\[mk test $arg_lib\]" echo "\[mk test $arg_lib\]"
radix -decimal radix -decimal
vsim -quiet tst_lib.tb_$arg_lib vsim -quiet tst_lib.tb_$arg_lib
set tb [tbdir $arg_lib] set tb [tbdir $arg_lib]
foreach tc [glob -directory $tb/data -type d -nocomplain tc*] { 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] { foreach fileName [glob -directory $tc -type f -nocomplain *.in *.out *.ref] {
file copy -force $fileName . file copy -force $fileName .
} }
...@@ -295,7 +308,7 @@ proc read_lib_compile_order_file {arg_lib} { ...@@ -295,7 +308,7 @@ proc read_lib_compile_order_file {arg_lib} {
set data [string trim $data] ;# trim any trailing white space set data [string trim $data] ;# trim any trailing white space
close $fp close $fp
set lib_names [split $data] set lib_names [split $data]
puts $lib_names echo $lib_names
return $lib_names return $lib_names
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment