Modelsim仿真tcl脚本与wave.do文件

时间:2022-09-19 08:32:15
Modelsim仿真tcl脚本与wave.do文件

Modelsim的仿真,如果一直使用图形界面建工程,编译,仿真,一个个加入观察波形的话,未免复杂了一些,尤其是当工程较大,需要观察的信号较多时,下面贴出一些常用的tcl脚本命令和wave.do常用语法:

vsim.tcl仿真脚本:
vlib compress_lib
vmap compress_lib compress_lib
set verilog_file_list [ glob verilog/compress/*.v ]
foreach i $verilog_file_list {
vlog -work compress_lib $i
}
vlib uncompress_lib
vmap uncompress_lib uncompress_lib
set verilog_file_list [ glob verilog/uncompress/*.v ]
foreach i $verilog_file_list {
vlog -work uncompress_lib $i
}
vlib common_lib
vmap common_lib common_lib
set verilog_file_list [ glob verilog/common/*.v ]
foreach i $verilog_file_list {
vlog -work common_lib $i
}
vlib work_lib
vmap work work_lib
set verilog_file_list [ glob verilog/*.v ]
foreach i $verilog_file_list {
vlog -L compress_lib -L uncompress_lib -L common_lib -work work_lib $i
}
vsim -t ps -voptargs=\"+acc\" -L secureip -L xilinxcorelib -L unisims_ver  -L compress_lib -L uncompress_lib -L common_lib common_lib.glbl  work_lib.testbench
# Turn off IEEE library warnings
set NumericStdNoWarnings 1
set StdArithNoWarnings 1
do wave_me.do
run -all
wave.do波形观察文件内容示例:
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -format Logic -radix binary /testbench/clk_200
add wave -noupdate -format Logic -radix binary /testbench/rstn
add wave -noupdate -divider {incross fifo in  signals}
add wave -noupdate -format Logic -radix binary /testbench/stest_wvalid
add wave -noupdate -format Logic -radix binary /testbench/stest_wready
add wave -noupdate -format Logic -radix hex /testbench/matlab_in
add wave -noupdate -format Logic -radix decimal /testbench/stest_wdata_re
add wave -noupdate -format Logic -radix hex /testbench/stest_wdata
add wave -noupdate -divider {signals}
add wave -noupdate -format Logic -radix binary /testbench/clk_200
add wave -noupdate -format Logic -radix binary /testbench/incross_m_valid
add wave -noupdate -format Logic -radix binary /testbench/incross_m_ready
add wave -noupdate -format Logic -radix decimal /testbench/incross_m_data_re
add wave -noupdate -format Logic -radix decimal /testbench/s_axi_tdata
add wave -noupdate -format Logic -radix decimal /testbench/incross_wr_data_count
add wave -noupdate -format Logic -radix decimal /testbench/incross_rd_data_count
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {200 ns} 0}
WaveRestoreZoom {0 ps} {200 ns}
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 1
configure wave -griddelta 40
configure wave -timeline 0