#----------------------------------------------------------------------------- # # 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. # #----------------------------------------------------------------------------- # # 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 # # 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. # # 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. # # 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. # # Command Line # ------------ # The Makefile supports the following command line # # % make target_name_* <SEED=xxx> <DEFINES=xxxx> # # 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. # # Compile and Run Testcases # ------------------------- # To compile and run a tescase use the test_* and regress_test_* targets. # # % make test_1 // Builds and runs test 1 with VPD dumping and debug on # % make regress_test_1 // Builds and runs test 1 with coverage turned on # # Debugging Testcases # ------------------- # 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. # # % 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. # # % 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 # # 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. # # % 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. # # % 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. # # % 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 # # % make regress_urg #-----------------------------------------------------------------------------
#----------------------------------------------------------------------------- # # HOW TO REUSE THIS FILE ON ANOTHER DUT # # STEP 1: Update the file locations as required # STEP 2: Update the DUT section with directory and source location info # STEP 3: Update the TB section with directory and source location info # STEP 4: Update the Coverage section with name of dut top (eg top.dut) # STEP 5: Add test targets to the debug and regression targets section # STEP 5: Adjust the debug and regression compile and run time arguments # STEP 7: Adjust command line options as required # STEP 8: Update the env class so that it extends dkm_env # You will need to have a copy of the dkm directory and it should # 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_* # #-----------------------------------------------------------------------------
Step by Step 来创建自己的Makefile
看了上文,大家应该可以简单了解这个Makefile的功能了。接下来就按照step1~9来填空即可。
.PHONY : default help clean regress_clean default: help
# 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 #DESIGNWARE_HOME = ~synopsys/bk/designware #DW_MODELS_DIR = ./designware
#---------------------------------------------------------------------------- # DEVICE UNDER TEST #----------------------------------------------------------------------------- DUT_SRC_DIR = ./source/verilog
# Regression run time arguments REG_RUN += $(COV_SIM_OPTIONS)
# Define where the coverage data is for URG 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
############################################################################## ############################################################################## ############################################################################## ############################################################################## # # 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 # ##########################################################################
# 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