现在863的项目被老板拉去做H.264和AVS宏块预测的ASIC实现,SPEC基本上已经完成,代码已经写好一个小的模块。本来想在实验室服务器上写代码和调试的,因为VCS和Verdi用得都比较熟了,可是老师说要check我的代码,服务器上拷贝东西出来比较麻烦,因此让我在自己电脑上coding,没办法,阿哥只好用Modelsim做了。
老觉得modelsim鼠标点来点去十分不爽,自己脚本那一套auto-run的方法都施展不出来,于是花了一点时间学习modelsim里面的auto-run flow。利用modelsim对do文件或者tcl文件的支持,再加上windows下的debussy,阿哥花了一下午时间学习和整理,写了两个脚本,现在基本上也可以像在Linux那样auto-run simulation了。磨刀不误砍柴工,接下来的时间把所有精力放在coding上面,早日完成任务,早日出去实习,早日毕业...(貌似偏题了。。。)
首先总结一下modelsim和debussy的使用:
1. 安装Modelsim和Debussy并正确设置好license;
2. 将Debussy安装目录下share\PLI\modelsim_pli54\WINNT\novas.dll拷贝到
Modelsim安装目录下win32目录下(如果是VHDL,将share\PLI\modelsim_fli54\WINNT\novas_fli.dll拷贝至win32目录下);
3. 修改Modelsim安装目录下modelsim.ini文件,将Veriuser = veriuser.sl修改为Veriuser = novas.dll
(如果是VHDL,修改为Veriuser = novas_fli.dll).
4. 将Debussy安装目录下share\PLI\modelsim_pli54\WINNT\novas_vlog.v拷贝到
工程目录的源代码目录下(如果是VHDL,拷贝share\PLI\modelsim_fli54\WINNT\novas.vhd);
5. Testbench里面使用novas/debussy的PLI来dump波形
--------------------------------------------------------------
initial
begin
$fsdbDumpfile("info_fetch_tb.fsdb");
$fsdbDumpvars;
end
--------------------------------------------------------------
6. 使用modelsim编译时将novas_vlog.v一起编译进work库
vlog -incr -work work novas_vlog.v tb.v other_rtl.v
7. 使用debussy查看波形debug.
=======================================
### modelsim仿真请参考msim.tcl和run.bat脚本 ####
======================================= |
然后给出我写的msim.tcl和run.bat脚本,如果你需要使用的话,需要根据的工程目录修改脚本的相应地方,有任何问题可以联系我。还有一些关于modelsim仿真的有用的东东,如force等命令,我现在暂时用不到,所以这里也没有列出。msim.tcl# msim.tcl
# This TCL script is used to simulate verilog design with modelsim. # You should configure the modelsim and debussy properly before you # call this script with run.bat batch file. # # By TAO YULiang @ MicroE.SJTU # #
#--------- create library and mapping ------------# # usage: vlib # vmap vlib work #vmap work work
set path [pwd] set proj_dir [file dirname $path]
set sim [file mkdir [file join $proj_dir "sim"]] set debussy [file mkdir [file join $proj_dir "debussy"]]
# get vlog files set tbfiles [glob -nocomplain [file join [file join $proj_dir "tb"] "*.v"]] set rtlfiles [glob -nocomplain [file join [file join $proj_dir "rtl"] "*.v"]] set tbfile [glob -nocomplain [file join [file join $proj_dir "tb"] "*_tb.v"]]
# novas_vlog file regsub {(.*)/vlog/.*} $proj_dir {\1/lib/novas_vlog.v} novas_vlog
# verilog file list set vfile_list [concat $novas_vlog $tbfiles $rtlfiles]
# generate modules.f file set cache [open [file join $sim "modules.f"] w] puts $cache "//vlog source files" foreach vfile $vfile_list { puts $cache $vfile } close $cache
#-------------------- compile --------------------# # usage: vlog -work <-incr> .v .v vlog -f modules.f -incr
#-------------------- simulate -------------------# # usage: vsim -lib regsub {.*/(\w+)\.v} $tbfile {\1} tb_module vsim -novopt $tb_module
#------------------ add wave -------------------# # enable following two lines if you check wave file in modelsim #regsub {work\.((.*)_tb)$} $tb_module {sim:/\1/\2/*} top_signals #add wave -radix hexadecimal $top_signals
#-------------------- run ------------------# # usage: run run -all quit
|
run.bat
@echo off rem run.bat rem xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx echo x x echo x Run simulation with modelsim. x echo x Make sure your modelsim and debussy was configured properly. x echo x By TAO YULiang @ MicroE.SJTU {yuliang.sjtu@gmail.com} x echo x x echo x PRESS [ENTER] TO CONTINUE x echo x x echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx echo. pause >nul
set ROOT_DIR="D:\Study\863\asic_design\mbpred" set MODULE_DIR=%cd%
if not exist %MODULE_DIR%\sim md %MODULE_DIR%\sim
cd %MODULE_DIR%\sim if not exist msim.tcl copy %ROOT_DIR%\scripts\msim.tcl msim.tcl
echo. echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx echo x start simluation with modelsim... x echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx vsim -c -do msim.tcl
echo. echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx echo x simluation was completed sucessfully. x echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx set /p option=execute debussy to check your wave? (y/n) if "%option%"=="n" goto exit
:debussy echo. echo starting debussy... cd %MODULE_DIR%\debussy Debussy.exe -f ..\sim\modules.f -ssf ..\sim\x.fsdb
:exit exit
|
阅读(7304) | 评论(1) | 转发(0) |