diff --git a/tools/modelsim/commands.do b/tools/modelsim/commands.do index 475dc5b48fa2161bcc3a1c61c3f78c44d7add6b8..d9cae9cb1262a52f32e4706338812a3fb627a696 100644 --- a/tools/modelsim/commands.do +++ b/tools/modelsim/commands.do @@ -97,7 +97,7 @@ proc lp {{arg_lib ""}} { #------------------------------------------------------------------------------- proc project_mk_cmds {} { - return {clean compile files make test vmake} ;# mk with arg_cmd="" will default to "make" + return {clean execute compile files make test vmake} ;# mk with arg_cmd="" will default to "make" } # Get commands from the mk args @@ -108,6 +108,7 @@ proc parse_for_cmds arg_list { echo "mk \[commands\] \[projects\]" echo " possible commands are:" echo " clean: removes the library files" + echo " execute: runs compile IP scripts" echo " compile: runs project compileall" echo " files: list files in compile order" echo " help: displays this help" @@ -204,6 +205,25 @@ proc mk_clean {arg_lib} { } } +proc mk_execute {arg_lib} { + # if there are compile scripts for IP files then first use use mk_execute to compile those into this work + set compile_ip [read_lib_compile_ip_file $arg_lib] + if {[llength $compile_ip] > 0} { + echo "\[mk execute $arg_lib\]" + set sim [simdir $arg_lib] + lp $arg_lib + # create work library if it does not already exist + if {![file exists "$sim/work"]} then { + vlib work + } + global env ;# Make global env() variable known locally. This is necessary for $env(*) in compile IP tcl script, alternatively use $::env(*) in compile IP tcl scrip + foreach ip $compile_ip { + echo "do $ip" + do $ip + } + } +} + proc mk_compile {arg_lib} { set sim [simdir $arg_lib] if {[string compare [env] "<No Context>"] != 0} { @@ -212,17 +232,13 @@ proc mk_compile {arg_lib} { } echo "\[mk compile $arg_lib\]" lp $arg_lib + # recreate work library if {[file exists "$sim/work"]} then { vdel -lib $sim/work -all } vlib work - # if there are compile scripts for IP files then first compile those into this work - global env ;# Make global env() variable known locally. This is necessary for $env(*) in compile IP tcl script, alternatively use $::env(*) in compile IP tcl scrip - set compile_ip [read_lib_compile_ip_file $arg_lib] - foreach ip $compile_ip { - echo "do $ip" - do $ip - } + # and then first execute any IP compile scripts + mk_execute $arg_lib # and then compile the HDL project compileall } @@ -245,8 +261,11 @@ proc mk_vmake {arg_lib} { # so to be compatible for both names always use work to generate the makefile echo [exec vmake -fullsrcpath work > $sim/makefile] } + # recreate work library vdel -lib $sim/work -all vlib work + # and then first execute any IP compile scripts + mk_execute $arg_lib } proc mk_make {arg_lib} {