SYNOPSYS VCS Makefile文件編寫與研究


SYNOPSYS VCS Makefile文件編寫與研究

這個Makefilesynopsys提供的模板,看上去非常好用,你只要按部就班提供實際項目的參數就可以了。我們來看這個文件的頭部說明:
makefile
其實完全可以用csh或其他腳本來編寫,只是VCS使用的linux內置的make命令定義了一個標准的仿真腳本,make命令是專門用來
做項目的源文件管理和編譯控制的命令。這篇文章重點看synpsys的標准仿真腳本都做了哪些操作,然后使用其他腳本來實現。這里主要是自己
寫的一點東西,有些地方是猜測的或者不准確。

#---------------------------------------------------------------------------------------------------------------------------
# SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of
# Synopsys, Inc., and is fully protected under copyright and trade secret
# laws. You may not view, use, disclose, copy, or distribute this file or
# any information contained herein except pursuant to a valid written
# license from Synopsys.
# SYNOPSYS
公司的版權聲明,沒有權限不可使用
#-----------------------------------------------------------------------------------------------------------------------------
#  Filename : $Id: Makefile,v 1.0 2006/07/18 23:59:59 vangundy Exp $
#  Created by   : Synopsys Inc. 07/17/2006
#  $Author     : vangundy $
#  Description : Demonstrates Verilog DUT and SVTB using VCS

 

#  makefile文件頭

#---------------------------------------------------------------------------------------------------------------------------
#   The Makefile works on two seperate flows.  The DEBUG flow is intended to be used
#   During debugging of a testcase and/or the DUT.   The REGRESSION flow is used
#   During regression runs and collects coverage data.
# 
makefile模版包括兩部分流程,debug(查錯)流程和regress(回歸測試)流程,兩個流程大致步驟都相同都是:CompileSIMurg,覆蓋
#  率的分析和采集),debug時主要是跑一個pattern,並dump VPD文件,SIM的同時可以打開DVE視圖界面,結束后觀察波形,regress主要用
#  於采集覆蓋率,一般要跑多個pattern,這時就無需dump VPD文件(節約時間),由於是debug后有進行的重復運行,所以叫regress(回歸)。
#  在我們的驗證平台中,若不做代碼覆蓋率的功能,可以不寫regress,只要寫debug的流程和跑多個pattern的腳本就好了。
#---------------------------------------------------------------------------------------------------------------------
#   The DEBUG flow turns on VPD dumping and turns off coverage collection.   After
#   building a testcase using the debug targets, you can debug the TB and the DUT  
#   source code using the testbench debugger and DVE.   Of course, you can turn on
#   coverage metrics and run in debug mode by changing compile and runtime options
#   in the makefile.  These changes are independent of the regression flow so that     
#   the regressions will still run optimally without the interference of VPD dumping. 

#   debug流程打開VPD文件的dump並關閉覆蓋率在build了一個包含DUTtestcase后,可以使用VCSdebuggerDVE進行debug。當
#   然,你也以通過改變makefile文件中的compileruntime選項參數來開啟覆蓋率功能。Debug流程和regress流程是各自獨立的,regression
#   流程一般不生成VPD
# --------------------------------------------------------------------------------------------------------------------------------
#   The REGRESSION flow turns off VPD dumping and turns on Coverage Metrics and TB
#   coverage collection.   This flow is intended to support verification engineers who
#   are working through the regression process and are interested in coverage
#   collection and urg.
#   REGRESSION
流程關閉VPD dump並打開Coverage collection功能,該流程是為了支持驗證引擎進行“流水線驗證“(跑多個testcase)和
#   代碼覆蓋率功能。??在驗證平台中可以將運行多個testcase的腳本命名為regress,運行單個testcase的腳本命名為regone??,這只是

#  synopsys的模版,我們不必完全遵守,可以不區分debugregress,然后將是否打開波形和coverage設置成參數。

# -------------------------------------------------------------------------------------------------------------------------------
#   Command Line   make
命令行
#   -----------------
#   The Makefile supports the following command line
#   makefile
支持下列命令行
% make target_name_* <SEED=xxx> <DEFINES=xxxx>
#   makefile
文件放在哪?放在仿真路徑。make [-f makefile文件名][選項][宏定義][目標]  
#   -f 指定makefile  若沒有則make程序首先在當前目錄查找名為makefile的文件,如果沒有找到,它就會轉而查找名為Makefile的文件。
#   Where target_name is the name of a testcase located in the test directory.   Every
#   test in the test directory is named using test_{test_name}.   All of the test targets
#   are listed in the TEST TARGETS section of the makefile.

 

#  target_nametest路徑下的一個testcase的名字,test路徑下的testcase的名字使用test_{test_name}來命名,例如test_1

 

#  所有的test target 都在makefile文件中的TEST TARGETS部分列出
# ---------------------------------------------------------------------------------------------------------------------------
#   Compile and Run Testcases    
編譯與運行testcase
#   -------------------------------
#   To compile and run a tescase use the test_* and regress_test_* targets.
#  
編譯與運行testcase,(test_1 就是執行了下面的兩個命令先編譯在運行) test_1 ==> compile_1  run_1   詳見下面命令定義
#   % make test_1           // Builds and runs test 1 with VPD dumping        其實就是debug的前邊的流程
#   % make regress_test_1 // Builds and runs test 1 with coverage turned on 
#  -------------------------------------------------------------------------------------------------------------------------
#   Debugging Testcases     Debug
實在上面命令之后在進行的
#   ------------------------
#   You can use DVE and the testbench debugger to visualize waveforms and testbench
#   execution.   You must first build the testbench using the make compile_* command.
#   dubug
必須是在DVEVCSdebug工具,與debussy一樣的功能)下進行,因為要看波形嘛,但是debug之前必須先compile
% make compile_1        // Builds test 1 for debugging    //
需要重新編譯一次嗎?
#   Once you have built the environment with the proper debug switches, you can use DVE and the testbench debugger.
#  #   testbench debugger
是否是指編譯后的那個simv可執行文件呢?  其實gui_1 和上面test_1中的run_1是一樣的只是增加了-gui
#   即增加了打開gui界面的參數,其他雷同

% make gui_1           // Debug test 1 with DVE
#   % make tb_gui_1       // Debug test 1 with the testbench debugger
% make both_guis_1  // Debug using both guis
#   % make pp_1           // Debug using the VPD file   VPD
文件要在執行simv之后才有吧?
#   If you want, you can turn on coverage for the DEBUG flow by uncommenting the
#   coverage flag in the makefile.   If you do this, you can still look at coverage.
#   This may be useful in helping those who are debugging coverage related issues.
#  
如果在makefile中的debug流程中使用了coverage功能,那么可以使用下面命令觀察覆蓋率
#   % make urg              // Visualize coverage data from debug runs
#  -----------------------------------------------------------------------------------------------------------------------------
#   Regression Testcases
#   --------------------
#   Regression tests are used to collect coverage information.   To build a testcase
#   for coverage collection use a command similar to the following.
#   regress
流程主要是為了收集代碼覆蓋率信息,在執行regress之前需要重新build testcase  類似debug時的compile
#   % make regress_build_1   // Build and run a regression test with a default seed
#   Once the test has been built, you can run it again with a new seed.
#  
debug不同的是regress需要重新run(使用新的SEED)一下,【還是debug的時候也要run一下?】
% make regress_run_1 SEED=1234
#   After running one or more regression runs, you can visualize the coverage data
#   using urg and the following command
run
完之后可以用下面命令看代碼覆蓋率
#   % make regress_urg
#----------------------------------------------------------------------------------------------------------------------------
# HOW TO REUSE THIS FILE ON ANOTHER DUT    //
如何重用該模版
# STEP 1:   Update the file locations as required   //設置file所屬的路徑
# STEP 2:   Update the DUT section with directory and source location info//
更新模版中DUT部分,指定DUT的路徑和include的路徑
# STEP 3:   Update the TB section with directory and source location info//
更新模版中TB部分,指定TB的路徑和include的路徑
# STEP 4:   Update the Coverage section with name of dut top (eg top.dut) //
跟新模版中Coverage部分,指定要測試代碼覆蓋率的duttop
# STEP 5:   Add test targets to the debug and regression targets section//
debugregresstarget加入模版中對應的部分
# STEP 5:   Adjust the debug and regression compile and run time arguments//
調整debugregresscompileruntime的命令參數
# STEP 7:   Adjust command line options as required//
調整命令行命令(后邊帶百分號和冒號的就表示可以在make命令行中使用的命令)
# STEP 8:   Update the env class so that it extends dkm_env//
更新env class(環境類)使得它可以提供dkm_env
#    You will need to have a copy of the dkm directory and it should  //dkm
是什么?
#       be located at $(TB_SRC_DIR)/dkm
#       a) Add [`include "dkm_env.sv"]
#       b) Add [extends dkm_env] to the environment class definition
#       c) Call the super.new("name") from the constructor
# STEP 9:   Run the debug and regression targets
    % make testbench_target_*   // testbench_target_*    
是指test_1之類的testcase
#-----------------------------------------------------------------------------

 

看了上文,大家應該可以簡單了解這個Makefile的功能了。接下來就按照step1~9來填空即可:

.PHONY : default help clean regress_clean
default: help
#-----------------------------------------------------------------------------
# DIRECTORIES    
總路徑
#-----------------------------------------------------------------------------
OUTPUT_DIR    = ./output      //
為什么debugregress沒有分開?   debugregressCoverageCOV_DIR下是有區分的
COV_DIR        = ./coverage    //
為什么沒有VPD的路徑?  
LOG_DIR        = ./logs         //output是做什么的?   VPD文件  simv文件 還有一寫其他文件在這里


# Set this to the location where you installed the designware models.   This
# depends on whether you ran the setup_vip_dw_home to install the models or
# the setup_vip_here script.
#DW_MODELS_DIR = $(DESIGNWARE_HOME)
DW_MODELS_DIR = /user/synopsys/designware      //
軟件路徑  VCS的路徑?
#DESIGNWARE_HOME = ~synopsys/bk/designware   
#DW_MODELS_DIR = ./designware
#----------------------------------------------------------------------------
# DEVICE UNDER TEST     DUT
路徑
#-----------------------------------------------------------------------------
DUT_SRC_DIR   =  ./source/Verilog                //SRC  source

DUT_SRC         = -f $(DUT_SRC_DIR)/rtl_list.f      //
待編譯的rtl文件列表文件  SRC是什么意思?
DUT_INC        += +incdir+/user/myproj/PROJECT/RTL/SRC/mymodule/
DUT_INC        += +incdir+/user/myproj/PROJECT/RTL/SRC/mymodule/mymodule_inc.v

DUT_CMP_OPTIONS   += +libext+.v+.V            //
這個參數是干什么的?指定VCS搜索文件時的文件后綴.v
#DUT_CMP_OPTIONS   += -timescale=1ps/1ps     //CMP
compile的意思  不是compare
#DUT_CMP_OPTIONS   += -override_timescale=1ps/1ps
#-----------------------------------------------------------------------------
# TESTBENCH      TB
路徑設置
#-----------------------------------------------------------------------------
TB_SRC_DIR    = ./source/svtb

# AXI TESTBENCH, VIP Sources first
#TB_SRC      += -f $(TB_SRC_DIR)/mac_if_tb/vip/gslv_model_package.f
TB_SRC       += $(TB_SRC_DIR)/mpdu_trx_tb/tests/mpdu_tb_top.sv
TB_SRC       += $(TB_SRC_DIR)/mpdu_trx_tb/tests/$(TB_TEST).sv   //
為什么有兩個SV

TB_INC       += +incdir+$(TB_SRC_DIR)/mpdu_trx_tb/vip
TB_INC       += +incdir+$(TB_SRC_DIR)/mpdu_trx_tb/env
TB_INC       += +incdir+$(TB_SRC_DIR)/mpdu_trx_tb/tests
TB_INC        += +incdir+$(DW_MODELS_DIR)/include/svtb      //
這部分為了支持sv嗎?
TB_INC        += +incdir+$(DW_MODELS_DIR)/include/verilog
TB_INC        += +incdir+$(DW_MODELS_DIR)/svtb

#TB_CMP_OPTIONS += -tb_timescale=1ns/1ps
#TB_CMP_OPTIONS += -lca Y-2006.06-SP2
TB_CMP_OPTIONS += +pkgdir+$(DW_MODELS_DIR)/include/svtb   //TB
的編譯選項和DUT不同?sv verilog的區別嗎?
TB_CMP_OPTIONS += -ntb_incdir $(DW_MODELS_DIR)/include/vera
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/vmt/latest/vera/src
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/vera/src
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/axi_master_vmt/vera/src  //TB
中使用的一些模型
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/axi_master_rvm_vera_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/axi_slave_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/axi_slave_rvm_vera_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/axi_monitor_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/axi_monitor_rvm_vera_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/axi_port_monitor_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/axi_port_monitor_rvm_vera_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/axi_interconnect_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir $(DESIGNWARE_HOME)/vip/amba/latest/axi_interconnect_rvm_vera_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir ${DESIGNWARE_HOME}/vip/amba/latest/ahb_master_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir ${DESIGNWARE_HOME}/vip/amba/latest/ahb_slave_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir ${DESIGNWARE_HOME}/vip/amba/latest/ahb_monitor_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir ${DESIGNWARE_HOME}/vip/amba/latest/ahb_bus_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir ${DESIGNWARE_HOME}/vip/amba/latest/ahb_master_rvm_vera_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir ${DESIGNWARE_HOME}/vip/amba/latest/ahb_slave_rvm_vera_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir ${DESIGNWARE_HOME}/vip/amba/latest/ahb_monitor_rvm_vera_vmt/vera/src
TB_CMP_OPTIONS += -ntb_incdir ${DESIGNWARE_HOME}/vip/amba/latest/ahb_bus_rvm_vera_vmt/vera/src

TB_CMP_OPTIONS += -ntb_define NTB
TB_CMP_OPTIONS += -ntb_define DW_VIP_AXI_MAX_NO_MSTRS=6
TB_CMP_OPTIONS += -ntb_define DW_VIP_AXI_MAX_NO_SLVS=2
TB_CMP_OPTIONS += +define+DW_VIP_AXI_MAX_NO_MSTRS_6
TB_CMP_OPTIONS += +define+DW_VIP_AXI_MAX_NO_SLVS_2
TB_CMP_OPTIONS += -ntb_opts rvm
TB_CMP_OPTIONS += -ntb_opts dtm
TB_CMP_OPTIONS += -ntb_opts use_sigprop
TB_CMP_OPTIONS += -ntb_opts interop
TB_CMP_OPTIONS += -ntb_opts dw_vip
TB_CMP_OPTIONS += +define+NT

# AIP Related files and compilation options
#TB_CMP_OPTIONS += +incdir+../BP062-BU-01000-r0p0-00rel0/sva \
               +incdir+../BP062-BU-01000-r0p0-00rel0/verilog \
               ../BP062-BU-01000-r0p0-00rel0/sva/AxiPC.sv \
               ../BP062-BU-01000-r0p0-00rel0/verilog/Axi.v \
               ./source/svtb/platform_tb/env/Snps_ARMAXI_CheckerBind.sv

#${VCS_HOME}/packages/aip/DDR2_AIP/src/Snps_DDR2_Checker.sv \
               -assert enable_diag \
               +incdir+.+${VCS_HOME}/packages/aip/DDR2_AIP/src/ \
               ./source/svtb/platform_tb/env/Snps_DDR2_Bind.sv \
   +incdir+../BP062-BU-01000-r0p0-00rel0/sva \
               +incdir+../BP062-BU-01000-r0p0-00rel0/verilog \
               ../BP062-BU-01000-r0p0-00rel0/sva/AxiPC.sv \
               ../BP062-BU-01000-r0p0-00rel0/verilog/Axi.v \
               ./source/svtb/platform_tb/env/Snps_ARMAXI_CheckerBind.sv
#-----------------------------------------------------------------------------
# COVERAGE
覆蓋率的設置
#-----------------------------------------------------------------------------
COV_TREE        += '+tree mpdu_tb_top'
COV_CM_OPTIONS   += -cm line+cond+fsm+assert    
注意CMCMP不一樣
#-----------------------------------------------------------------------------
# TEST TARGETS  
總命令
#-----------------------------------------------------------------------------
# debug targets
test_1: compile_1 run_1
   
與前邊對應test_1 就是debug流程(debug還可以將run_1 換成 gui_1);regress_test_1就是regress流程
test_11: compile_11 run_11
test_12: compile_12 run_12
test_13: compile_13 run_13
test_14: compile_14 run_14
test_2: compile_2 run_2
test_perf: compile_perf run_perf

# regression targets
regress_test_1: regress_build_1 regress_run_1
regress_test_11: regress_build_11 regress_run_11
regress_test_12: regress_build_12 regress_run_12
regress_test_13: regress_build_13 regress_run_13
regress_test_14: regress_build_14 regress_run_14
regress_test_2: regress_build_2 regress_run_2
regress_test_perf: regress_build_perf regress_run_perf
#-----------------------------------------------------------------------------
# COMPILE AND RUN TIME ARGUMENTS  
編譯與運行時的參數設置(runsim可以看成一個意思,run就是run simv
#-----------------------------------------------------------------------------
# Debug compile time arguments
DBG_CMP           += $(COV_CMP_OPTIONS)
//debug 編譯的參數
DBG_CMP           += -debug_all                    //使能DVE debugging (包括 line stepping
//DBG_CMP           += -debug_pp                             //
使能VPD dump assertion debug
DBG_CMP           += +define+VPD_ON           //debug compile
的時候定義一個VPD_ON的宏,注意VPDSIM時生成的
#DBG_CMP           += +define+VPD_OFF          //CMP時參數把VPD關了,但是在SIM時輸出一個VPD會怎么樣?
#DBG_CMP           += +define+LOG_FMT_OFF     //
應該是這樣,在verilog代碼中將VPD dump的代碼寫在 ifdefine VPD_ON 后面
# Debug run time arguments
DBG_RUN           += $(COV_SIM_OPTIONS)      //COV_SIM_OPTION
COV_CMP_OPTION的區別

# Regression compile time arguments
REG_CMP           += $(COV_CMP_OPTIONS)
REG_CMP           += +define+VPD_OFF         //regress compile
的時候定義了VPD_OFF debugregress的區別其實主要就是這,
                                                //
因為debug時也可以做urg,所以在CMPSIM參數中關於覆蓋率實際上是一致的
# Regression run time arguments                //
注意在debugregress各自的流程中urg命令(make 命令行命令)是不同的
REG_RUN           += $(COV_SIM_OPTIONS)        

# Define where the coverage data is for URG        //
覆蓋率數據,這個是給后邊urg命令用的,產生覆蓋率實在CMPSIM之后進行的
COV_DBG_DATA     += -dir $(COV_DIR)/debug/simv.vdb -dir   $(COV_DIR)/debug/simv.cm
COV_REG_DATA     += -dir $(COV_DIR)/regress/simv.vdb -dir   $(COV_DIR)/debug/simv.cm
#-----------------------------------------------------------------------------
# COMMAND LINE ARGUMENTS  make
命令行參數
#-----------------------------------------------------------------------------
SEED       = 766
#234567
#DEFINES    = "+rvm_log_default=DEBUG"
DEFINES    = "+vmm_log_default=DEBUG"
#DEFINES    = "+vmm_log_default=NOTE"
#DEFINES    = "+rvm_log_default=WARNING"
#DEFINES    = "+vmm_log_default=ERROR"

 


##############################################################################

 

##############################################################################
# PRIVATE    //
私有部分,用戶可以不改
# You should not need to modify anything below this point
# The following code supports a SV DUT and SVTB.  

 

##############################################################################
##############################################################################
DIR          = $(/user/synopsys/Gaon/Platform)
##########################################################################
# DEVICE UNDER TEST  DUT CMP
SIM參數設置,之前已經設置過debugregressCompile時的參數
##########################################################################
DUT_CMP_OPTIONS   += -sverilog +v2k
DUT_CMP_OPTIONS   += -o $(DUT_SIM_EXEC)
DUT_CMP_OPTIONS   += -Mdir=$(OUTPUT_DIR)/$(TB_TEST_ID)_csrc
DUT_CMP_OPTIONS   += -l $(LOG_DIR)/$(TB_TEST).cmp_log
DUT_CMP_OPTIONS   += +vcs+lic+wait +plusarg_save
DUT_CMP_OPTIONS   += $(DUT_INC)

DUT_SIM_OPTIONS   += -l $(LOG_DIR)/$(TB_TEST_ID).run_log
DUT_SIM_OPTIONS   += +vcs+lic+wait
DUT_SIM_OPTIONS   += +vpdfile+$(OUTPUT_DIR)/$(TB_TEST_ID).vpd   

 

//vpd實在執行sim后生成的,但是在debugcompile的時候為什么有個vdp_on的參數呢?
#DUT_SIM_OPTIONS   += +ntb_random_seed=$(SEED)
DUT_SIM_OPTIONS   += +ntb_random_seed_automatic
DUT_SIM_OPTIONS   += -assert nopostproc+report=$(LOG_DIR)/$(TB_TEST_ID).sva_log
DUT_SIM_OPTIONS   += -cm_assert_name $(TB_TEST_ID)
DUT_SIM_OPTIONS   += $(DEFINES)
DUT_SIM_EXEC     += $(OUTPUT_DIR)/$(TB_TEST)_simv

##########################################################################
# TESTBENCH   TB CMP
SIM參數設置,之前已經設置過debugregressCompile時的參數
##########################################################################
TB_TEST        += test_$*               //$*
是什么意思,$* :去掉后綴的當前目標名(?)。例如,若當前目標是pro.o,則$*表示pro
TB_TEST_ID    += $(TB_TEST)_$(SEED)
# VK ENVIRONMENT
TB_INC           += +incdir+$(TB_SRC_DIR)/vk
TB_CMP_OPTIONS +=   $(TB_INC)
##########################################################################
# COVERAGE 
覆蓋率設置
##########################################################################
#COV_CM_OPTIONS += +tb_cov_db_name=$(TB_TEST_ID)
COV_CM_OPTIONS  += -cm_name $(TB_TEST_ID)

COV_CMP_OPTIONS   += $(COV_CM_OPTIONS) -cm_hier $(COV_HIER)

COV_SIM_OPTIONS   += $(COV_CM_OPTIONS)
COV_SIM_OPTIONS   += -cm_log $(LOG_DIR)/$(TB_TEST_ID).cm_log

COV_HIER       += $(OUTPUT_DIR)/vcm.cfg

# Coverage options for build and run with debug   
COV_CM_DBG     += -cm_dir $(COV_DIR)/debug/simv.cm
#COV_CM_DBG     += -ova_dir $(COV_DIR)/debug/simv.vdb
#COV_CM_DBG     += +tb_cov_db_dir=$(COV_DIR)/debug/simv.vdb

# Coverage options for build and run with regressions
COV_CM_REG     += -cm_dir $(COV_DIR)/regress/simv.cm
COV_CM_REG     += -ova_dir $(COV_DIR)/regress/simv.vdb
COV_CM_REG     += +tb_cov_db_dir=$(COV_DIR)/regress/simv.vdb
##########################################################################
# DEBUG TARGETS
##########################################################################
compile_%:
echo $(COV_TREE) > $(COV_HIER);   //debug
編譯時主要有下面幾個參數  TB_CMP  DUT_CMP  DBG_CMP COV_CM_DBG
vcs $(TB_CMP_OPTIONS) \                   //
請詳細查看上面幾個變量的設置
         $(DUT_CMP_OPTIONS) \
      $(DUT_SRC) \
      $(TB_SRC) \
      $(SVA_SRC) \
      $(SVA_OPTIONS) \
      $(COV_CM_DBG) \
      $(DBG_CMP)                  
run_%:   

 

$(DUT_SIM_EXEC) $(DUT_SIM_OPTIONS) $(DBG_RUN) $(COV_CM_DBG)

 

//run 是上面說的test_1中的第二步,屬於debug流程,其實就是執行simv,參數有DUT_SIMDBG_RUN

 

//注意TBrunsim)時沒有相關參數

gui_%:      //gui_1
run_1的區別就是打開了視圖界面,他們都是執行sim
$(DUT_SIM_EXEC) $(DUT_SIM_OPTIONS) $(DBG_RUN) $(COV_CM_DBG) \
-gui

tb_gui_%:  //-tb_gui
-gui的區別是什么(上文提到DVEtestbenchdebugeer的含義),猜測-gui是打開DVE軟件,-tb_gui就不知道是神馬
$(DUT_SIM_EXEC) $(DUT_SIM_OPTIONS) $(DBG_RUN) $(COV_CM_DBG) \
-tb_gui +ntb_debug_on_start

both_guis_%:
$(DUT_SIM_EXEC) $(DUT_SIM_OPTIONS) $(DBG_RUN) $(COV_CM_DBG) \
-gui \
-tb_gui +ntb_debug_on_start

new_gui_%:   //
打開一個新的 DVE軟件窗口?
$(DUT_SIM_EXEC) $(DUT_SIM_OPTIONS) $(DBG_RUN) $(COV_CM_DBG) \
-gui \
-tbug

pp_%:   //
這個命令應該就是打開VPD波形
dve -vpd $(OUTPUT_DIR)/$(TB_TEST_ID).vpd

urg:    //
執行代碼覆蓋率操作?  代碼覆蓋律不是在sim的時候產生的嗎(在CMPSIM的時候都有COV的參數啊)?  這個要具體查一下
urg $(COV_DBG_DATA)   -report $(COV_DIR)/debug/urgReport -lca
mozilla $(DIR)/$(COV_DIR)/debug/urgReport/dashboard.html &

dve_cov:                 //
該命令應該是使用DVE軟件查看coverage結果
@echo ""
@echo "WARNING: Did you run this command?"
@echo ""
@echo " % source ./utils/setup_dve_cov"
@echo ""
dve -cov &      

##########################################################################
# REGRESSION TARGETS
##########################################################################
regress_clean: clean
@rm -rf $(COV_DIR)/*
@mkdir -p $(COV_DIR)/debug   //
怎么把debug的路徑也給刪除了?
@mkdir -p $(COV_DIR)/regress
@mkdir -p $(LOG_DIR)
@mkdir -p $(OUTPUT_DIR)

regress_build_%:    //regress compile
的時候就$(REG_CMP)debug不同仔細檢查兩者的差異
echo $(COV_TREE) > $(COV_HIER);
vcs $(TB_CMP_OPTIONS) $(DUT_CMP_OPTIONS) \
      $(DUT_SRC) \
      $(TB_SRC) \
      $(SVA_SRC) \
      $(SVA_OPTIONS) \
      $(COV_CM_REG) \
      $(REG_CMP)

regress_run_%:   //
觀察各參數和debug流程的有什么差異
$(DUT_SIM_EXEC) $(DUT_SIM_OPTIONS) $(REG_RUN) $(COV_CM_REG)

 


regress_urg:    //
看來VPDSIM時產生的,但是覆蓋率不是SIM時產生的,可能因為覆蓋律要跑多個case才有意義
urg $(COV_REG_DATA) -grade -report $(COV_DIR)/regress/urgReport
mozilla $(DIR)/$(COV_DIR)/regress/urgReport/dashboard.html &

regress_dve_cov:
@echo ""
@echo "WARNING: Did you run this command?"
@echo ""
@echo " % source ./utils/setup_dve_cov"
@echo ""
dve -cov &
#
綜上,debugregress流程類似,都是四步,compilesimurgdve_cov
##########################################################################
# ADMINISTRATIVE   
管理命令
##########################################################################
help:
@echo =======================================================================
@echo   "        "
@echo   " USAGE: %make target_name_* <SEED=xxx> <DEFINES=xxxx>             "
@echo   "        "
@echo   " ------------------------ DEBUG TARGETS ----------------------------"
@echo   " test_*       => Compile TB and DUT files, runs the simulation.   "
@echo   " clean           => Clean the intermediate files.                "
@echo   " compile_*    => Compile the TB and DUT.                      "
@echo   " run_*           => Run the simulation.                             "
@echo   " gui_*           => Run simulation interactively with DVE.       "
@echo   " tb_gui_*        => Runs simulation interactively with TB Debugger. "
@echo   " both_guis_*     => Run both debuggers.                             "
@echo   " new_gui_*    => Run new integrated debuggers.                "
@echo   " pp_*          => Post process VPD with DVE.                   "
@echo   " urg          => Make a coverage report for debug runs.       "
@echo   " dve_cov       => Brings up DVE for coverage reporting.           "
@echo   "                                                                    "
@echo   " ----------------------- REGRESSION TARGETS ------------------------"
@echo   " regress_test_*   => Compile and run with coverage.                "
@echo   " regress_clean => Remove all coverage files.                   "
@echo   " regress_build_* => Build test_*.                                   "
@echo   " regress_run_* => Run test * collecting coverage information.     "
@echo   " regress_urg     => Make a coverage report for regression runs.     "
@echo   " regress_dve_cov => Brings up DVE for coverage reporting.           "
@echo   "                                                                    "
@echo   " -------------------- ADMINISTRATIVE TARGETS -----------------------"
@echo   " help           => Displays this message.                         "
@echo   " init           => Clean all files, including coverage files.    "
@echo   " tar          => Tar and zip kit and place at ../                 "
@echo   "        "
@echo   " e.g.   gmake test_1                                              "
@echo =======================================================================

tar: clean
cd ..; \
tar cvf ${DIR}.tar ${DIR}; \
rm -f ${DIR}.tgz; \
gzip ${DIR}.tar; \
mv ${DIR}.tar.gz ${DIR}.tgz

clean:
@rm -rf $(OUTPUT_DIR)/*   $(COV_DIR)/debug/* $(LOG_DIR)/* ./DVEfiles
@rm -rf urgReport *.tcl *.tcl.old vc_hdrs.h   testbench_debugger_rc
@rm -rf ucli.key vcs.key vera_debugger_rc .vera_debugger_rc.lock
@rm -rf .test* .vlog* .dummyDir *.db *.vdb verilog.dump
@rm -rf ._* .dw* *.log

init: regress_clean
@rm -rf include
@rm -rf examples

 

 

總結:

經過研究,首先使用VCS驗證的流程是:

1.       對各個源文件(包括DUTTB)進行編譯,生成可執行文件(默認名字為simv

2.       執行simv文件進行仿真,這時會將testcase的仿真結果輸出,包括VPD(若開啟了VPD dumpping)文件等輸出文件

3.       若進行代碼覆蓋率檢查,在simv后可以使用urg命令收集覆蓋率信息(須跑多個case

Makefile 完成的功能是:

1.       對源文件的管理:主要是將DUT文件和TB文件以及一些必要的文件的路徑寫入變量($DUT_SRC_DIR $TB_SRC_DIR等),還有include的路徑(供VCS搜索)。在使用VCS命令進行編譯時,可以將該路徑加入命令中。我們可以使用腳本將需要編譯的文件輸出為一個file_list.f文件,然后用vcs –f file_list.f 進行編譯。

2.       對路徑的管理:將源文件路徑和輸出文件路徑寫入各自的變量,一遍在后邊使用vcs命令時調用。

3.       VCS命令參數的調整:這部分是重要的步驟,根據需要的不同(debugregress的需要就不相同),參數設置也有不同,但有一些參數是不管怎樣的流程都需要的,在我們的驗證平台中,我們可以將參數分為兩部分,一部分是都需要的可以公用的,一部分是可以靈活使用的,可以更改的。

4.       VCS命令的調整:這部分就是將VCS的幾個主要命令(其實就是VCS  SIMV)加上對應的參數設置。我們的驗證平台可以將不同的命令寫成不同的腳本,然后寫一個總的腳本進行調用。

5.       其實需要靈活配置的主要就是VPD文件和覆蓋率的設置(VPD rtl級實際上應該每次都生成)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM