diff options
Diffstat (limited to 'mig_test/simulation')
-rw-r--r-- | mig_test/simulation/Makefile | 67 | ||||
-rw-r--r-- | mig_test/simulation/run.do | 65 | ||||
-rw-r--r-- | mig_test/simulation/wave.do | 27 |
3 files changed, 159 insertions, 0 deletions
diff --git a/mig_test/simulation/Makefile b/mig_test/simulation/Makefile new file mode 100644 index 0000000..b1a0b89 --- /dev/null +++ b/mig_test/simulation/Makefile @@ -0,0 +1,67 @@ +# +# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/beam_position_monitor/trunk/hardware/board_prototyp1/simulation/Makefile $ +# $Date$ +# $Author$ +# $Revision$ +# + +library = work +top = top_tb + +software_dir = ../software + + +# http://sourceforge.net/projects/vmk/ +VMK = vmk + +# generate list of used libs +library_list = $(shell cut --field 1 --delimiter=" " --only-delimited ../vhdl_files.txt | grep --invert "\#" | sort --unique) +#library_list += $(shell cut --field 1 --delimiter=" " --only-delimited ../verilog_files.txt | grep --invert "\#" | sort --unique) + +# list of verilog files +#vlog_list = $(shell cut --field 3 --delimiter=" " --only-delimited ../verilog_files.txt | grep --invert "\#" | sort --unique) + + +all: compile + +software: + test ! -d $(software_dir) || make --directory $(software_dir) | ccze -A + +hw_timestamp: + test ! -f ../rtl/Makefile || make --directory ../rtl + +compile: hw_timestamp Makefile.msim + @# compile DDR3 memory model stuff + #vlog -work nanya +define+x16 +define+sg15f +incdir++../rtl_tb $(vlog_list) + @# normal vhdl compile + export ANAFLAGS="-quiet -2008"; \ + make -f Makefile.msim | ccze -A + @echo "Start the simulation with \"make simulate\" now." + + +simulate: + #mkdir -p data + export top=$(top); \ + vsim -quiet -novopt -gui $(library).$(top) -do run.do -l transcript.log + + +clean: + @# modelsim stuff + rm -f transcript.log + rm -f bus_trace.txt + rm -f *.wlf + rm -f wlf* + @# compile stuff + -make -f Makefile.msim clean + rm -rf $(library_list) + rm -f Makefile.msim + rm -f .stamp + + +# generate Makefile.msim with vmk +Makefile.msim: software ../vhdl_files.txt $(library_list) + $(VMK) -t modelsim -O -w $(library) -F ../vhdl_files.txt + +$(library_list): + vlib $@ + diff --git a/mig_test/simulation/run.do b/mig_test/simulation/run.do new file mode 100644 index 0000000..bba55ac --- /dev/null +++ b/mig_test/simulation/run.do @@ -0,0 +1,65 @@ + +# +# helper functions +# + +# restart + run +proc r {} { + restart -f + set sim_start [clock seconds] + + run -all + + puts "# simulation run time: [clock format [expr [clock seconds] - $sim_start] -gmt 1 -format %H:%M:%S] " +} + + +# restart with clear +proc rc {} { + .main clear + r +} + +# print varables +proc my_debug {} { + global env + foreach key [array names env] { + puts "$key=$env($key)" + } +} + + +# fast exit +proc e {} { + exit -force +} + +# fast exit +proc x {} { + exit -force +} + + +# get env variables +global env +quietly set top $env(top) + + +if {[file exists wave.do]} { + do wave.do +} else { + if {[file exists wave_$top.do]} { + do wave_$top.do + } else { + puts "INFO: wave file (wave_$top.do) not found" + } + puts "INFO: no wave file (wave.do) found" +} + + + +set sim_start [clock seconds] + +run -all + +puts "# simulation run time: [clock format [expr [clock seconds] - $sim_start] -gmt 1 -format %H:%M:%S] " diff --git a/mig_test/simulation/wave.do b/mig_test/simulation/wave.do new file mode 100644 index 0000000..607e5f3 --- /dev/null +++ b/mig_test/simulation/wave.do @@ -0,0 +1,27 @@ +onerror {resume}
+quietly WaveActivateNextPane {} 0
+add wave -noupdate /top_tb/simulation_run
+add wave -noupdate /top_tb/tb_clk
+add wave -noupdate /top_tb/tb_user_led_n
+add wave -noupdate -expand -group {carrier board LEDs} /top_tb/tb_b2b_b3_l59_n
+add wave -noupdate -expand -group {carrier board LEDs} /top_tb/tb_b2b_b3_l59_p
+add wave -noupdate -expand -group {carrier board LEDs} /top_tb/tb_b2b_b3_l9_p
+add wave -noupdate -expand -group {carrier board LEDs} /top_tb/tb_b2b_b3_l9_n
+TreeUpdate [SetDefaultTree]
+WaveRestoreCursors {{Cursor 1} {83164314 ps} 0}
+quietly wave cursor active 1
+configure wave -namecolwidth 150
+configure wave -valuecolwidth 100
+configure wave -justifyvalue left
+configure wave -signalnamewidth 1
+configure wave -snapdistance 10
+configure wave -datasetprefix 0
+configure wave -rowmargin 4
+configure wave -childrowmargin 2
+configure wave -gridoffset 0
+configure wave -gridperiod 1923
+configure wave -griddelta 32
+configure wave -timeline 1
+configure wave -timelineunits ns
+update
+WaveRestoreZoom {0 ps} {901530 ns}
|