引言
本文在上一講逐漸熟悉了VCS的開關選項後,下面繼續介紹VCS的使用,我始終關注於熟悉工具的使用,在本系列中,對Verilog的語法不作深入研究,這樣可以加快前進的步伐。也爲了加快從FPGA中轉變到IC領域來。在本文中將介紹VCS 調試基礎。
1、基礎理論講義
—Afer completing this unit ,you should be able to:
- Describe three methods of debugging Verilog code using VCS
- Invoke UCLI debugger
- Debug Verilog designs using UCLI
–VCS Debugging Suport
4. Trance and locate causes of errors
5. Three general debugging methods:
-
Verilog SystemVerilog System Task calls
VCS UCLI
VCS DVE(GUI) -
Four factors to consider:
simulation speed
signal visibility
sgnal tractability
usability
Verilog System Task For Debugging 利用verilog的系統函數
- Debug visibility:
- $ display prints formatted message to console
- $ strobe Like$dispaly except printing is delayed until all events in the current time step have executed
- $ monitor Monitor signals listed and prints formatted message whenever one of the listed signals changes
- $ time returns current simulation time as a 64bits integer
-
Stopping simulations:
$stop halts simulation lie a breakpoint
$finish halts simulation and terminated the simulation session -
Simulation stimulus and reference:
- readmemb
Reads ASCII dataform a disk file ,Each digit is binary
Debugging via UCLI(no-recom)不推薦使用UCLI方式來查看波形
- Simulation speed
Speed depends on the scale of visibility you specify - Signal Vsisibiility
- Signal Traceability
-Usability
Compile and Invoke UCLI Debugger
-Compile and invoke UCLI in one step(一步走,編譯並且調用UCLI)
$ vcs source.v -debug|debug_all -R -ucli
-ucli invokes UCLI and stop simulation time at time 0
-Compile and invoke UCLI in two step(分兩步走,先編譯,後執行可執行文件)
vcs source.v -debug|debug_all|debug_pp(debug_pp只打開部分調試開關,加快編譯速度)
invoke UCLI and stop simulation time at time 0
$simv -ucli
UCLI Debugger Command Line Option
-debug
enables command line debugging option. This flag does not enable line stepping.
-debug_all
enables command line debugging option including line stepping
-ucli
forces runtime to go into UCI mode by default
-gui
compile time option invokes the DVE gui when issured at run time
-l log_filename
captures simulation output ,such as user input UCLI commands and responses to UCLI commands.
-i input_filename
reads interactive UCLI commands from a file the switches readding from standard command line input
-k key_filename
writes interactive commands entered to input_filename,which can be used by a latter simv as -i input_filename
由於UCLI的陳舊,這裏不再強調。
退出UCLI
quit 即可
Problems in simulation?
if you suspect simlation is having problems
Determine whether or not time is advancing:
halt simulation by hiting ctrl+c 通過ctrl+c來退出仿真
check simulation time
continue simulation by typing in run at UCLI prompt
halt simulation again after a shor period of time
if simulation time has not changed,simulation may be caught in infinite loop or waiting for a phantom triger
-Determine potential location of problem:
Re-compile with -debug_all compile-time option
halt simulation
use UCLI command show to dispaly variables
trace code execution with UCLI command next
官方的文檔位置:
DVE(Discovery Visual Environment)
An intuitive and easy to use GUI
Quiickly fine bugs
RTL or Gates
Assertions
Testbench
Supports
Interactive
Post-simulaton analisis
Multiple languages
verilog
VHDL
SV
C++、C
NTB
波性文件vpd
verdi裏面的波性文件爲fsdb
比較兩個信號
2、實際基本操作dve的技巧-圖形界面參考資料
2.1 查看波形與調試波形
參考資料 DVE使用手冊
以後在實驗中逐步訓練加強。
程序,我們仍然使用在卷一中講解的程序。並且用DVE打開。界面如下:
主要分爲:菜單、左邊的模塊、coding、下面的腳本、以及終端輸出反饋。
DVE界面也有很多操作,涉及到了很多原理,我們不用一一來學,先上手搞懂基本操作再說,基本操作就是會看波形,把仿真跑起來。
首先是添加波形,我這裏不好截圖,選中波形後,右鍵即可,
add to waves->new wave
如圖已經打開了波形,現在先運行起來再說。
有個向下箭頭,這個就是運行。或者點擊快捷鍵F5,然後波形就出來了,此時肯定不太好看,希望看到一個full。使用按下F即可,或界面按鈕。
旁邊是放大縮小。
此時我明白你肯定希望像在modelsim中一樣,按住ctrl鍵滾動齒輪,對局部進行拉大。
在DVE中,使用鼠標左鍵不放拖動,就可以在指定的區域進行放大了。而且非常有趣的是,分爲橫向拖動和縱向拖動,縱向拖動是看full,還有斜着拖動,斜着拖動是看縮小,橫向拖動是放大。
另外,在DVE中按住ctrl鍵,滾動齒輪,是波形向前向後。
然後可以右鍵可以add marker
2.2 基本入門
使用dve -v
或者在DVE的命令行輸入gui_get_version
或者在help->about幫助菜單選項
可以查看到DVE的版本,DVE和VCS的版本要一致纔行
在simulator中的選擇setup,然後執行文件選擇simv文件即可
該按鈕可以用來重啓波形