浏览代码

Changed tb lauching method in makefile

Min 4 年之前
父节点
当前提交
f76b4b385c

+ 5 - 4
Makefile

@@ -36,6 +36,7 @@ tb_file ?=
 tb_dir = $(dirname "${testbench_file}")
 tb_mod ?=
 do_file ?=
+SIM_DIR ?= ./simulation/modelsim
 
 ### ================================================================
 ### Commands
@@ -50,11 +51,11 @@ modelsim: analysis
 modelsim_cli:
 	${MODELSIM_BIN} -c
 
-sim:
-	cd ./simulation/modelsim && ${MODELSIM_BIN} -c -do "${do_file}"
+%.cli: ${SIM_DIR}/%.do
+	${MODELSIM_BIN} -c -do "$<"
 
-sim_gui:
-	cd ./simulation/modelsim && ${MODELSIM_BIN} -gui -do "${do_file}"
+%.gui: ${SIM_DIR}/%.do
+	${MODELSIM_BIN} -gui -do "$<"
 
 testbench:
 	${MODELSIM_BIN} -c -do "vlog -sv +incdir+${tb_dir} {${tb_file}}; vsim -t 1ps ${VSIM_ARGS} ${tb_mod}; run -all"

+ 3 - 6
readme.md

@@ -23,11 +23,8 @@ make tb_file=./src/root.sv tb_mod=root_tb testbench
 Running testbench with defined simulation tcl script.
 Scripts has be located in **simulation/modelsim/sim_\*.do**
 ```bash
-# With GUI
-make do_file=${file} sim_gui
+# GUI example for simulation/modelsim/sim_root_tb.do
+make sim_root_tb.gui
 # Without GUI
-make do_file=${file} sim
-
-# Example
-make do_file=sim_root_tb.do sim_gui
+make sim_root_tb.cli
 ```

+ 1 - 1
simulation/modelsim/sim_fpa_mod.do

@@ -2,7 +2,7 @@
 if {[file exists rtl_work]} {
 	vdel -lib rtl_work -all
 }
-set rootdir [pwd]/../..
+set rootdir [pwd]
 puts "Root Directory $rootdir"
 vlib rtl_work
 vmap work rtl_work

+ 1 - 1
simulation/modelsim/sim_fpu32.do

@@ -2,7 +2,7 @@
 if {[file exists rtl_work]} {
 	vdel -lib rtl_work -all
 }
-set rootdir [pwd]/../..
+set rootdir [pwd]
 puts "Root Directory $rootdir"
 vlib rtl_work
 vmap work rtl_work

+ 1 - 1
simulation/modelsim/sim_neural.do

@@ -2,7 +2,7 @@
 if {[file exists rtl_work]} {
 	vdel -lib rtl_work -all
 }
-set rootdir [pwd]/../..
+set rootdir [pwd]
 puts "Root Directory $rootdir"
 vlib rtl_work
 vmap work rtl_work

+ 1 - 1
simulation/modelsim/sim_root_tb.do

@@ -2,7 +2,7 @@
 if {[file exists rtl_work]} {
 	vdel -lib rtl_work -all
 }
-set rootdir [pwd]/../..
+set rootdir [pwd]
 puts "Root Directory $rootdir"
 vlib rtl_work
 vmap work rtl_work