今天偶然在群里看到有人分享了Mentor Graphics
提供的一個UART的UVM驗證環境代碼,包含了UVM的基本使用以及進階的UVM寄存器模型。這里也分享給大家。
文件說明
agents/apb_agent - APB agent used in the UVM testbench
agents/uart_agent - UART agent user in the UVM testbench
agents/modem_agent - UART Modem interface agent, used in the UVM testbench
docs
protocol_monitor - contains an example APB protocol monitor
rtl - Contains the UART RTL source code***
sim - Simulation directory for the example, contains the Makefile
uvm_tb/tb - Top level testbench
uvm_tb/tests
uvm_tb/virtual_sequences
uvm_tb/sequences
uvm_tb/register_model
uvm_tb/env - contains the functional coverage monitors described in the cookbook
DUT是16550A UART模塊,接口主要包含apb、uart以及一些狀態信號,agents下是不同接口的agent。16550A UART推薦大家自己搜索下載詳細的spec。
docs是uart模塊的簡單說明,包含了一些寄存器的說明
protocol_monitor是一個協議檢查模塊,通過斷言對apb協議進行檢查
環境集成以及sequence等編寫在uvm_tb下。
運行仿真
想要運行可以通過sim目錄下的makefile進行,makefile調用的是quesatsim進行仿真,如果沒有的話,需要自己編寫vcs的makefile進行仿真。
如果想要在window下通過makefile運行仿真,需要以下幾個步驟
- 安裝git_bash,git的bash實際上也就是一個mingw,是可以支持部分linux指令的,但是只有少部分,可以讓我們的的終端更加像linux下的操作。
- 這個時候還是不支持makefile,需要我們自行安裝,教程可以參考下面的鏈接
- 安裝questasim
完成以后就能直接通過make all運行啦。
默認的makefile只進行到仿真這一步,沒有生成覆蓋率報告,我在makefile中加了入了覆蓋率相關的命令
先合並覆蓋率數據庫,然后生成覆蓋率報告的html文件
rpt_cg:
vcover merge -out merge_coverage.ucdb *.ucdb
vcover report -details -html merge_coverage.ucdb
@echo "html has been created in ./sim/covhtmlreport"
詳細的內容請查看README
微信公眾號
摸魚范式
,后台回復uart
獲得驗證環境