Makefile文件编写.docx

上传人:b****5 文档编号:3325233 上传时间:2022-11-21 格式:DOCX 页数:14 大小:25.85KB
下载 相关 举报
Makefile文件编写.docx_第1页
第1页 / 共14页
Makefile文件编写.docx_第2页
第2页 / 共14页
Makefile文件编写.docx_第3页
第3页 / 共14页
Makefile文件编写.docx_第4页
第4页 / 共14页
Makefile文件编写.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

Makefile文件编写.docx

《Makefile文件编写.docx》由会员分享,可在线阅读,更多相关《Makefile文件编写.docx(14页珍藏版)》请在冰豆网上搜索。

Makefile文件编写.docx

Makefile文件编写

SYNOPSYSVCSMakefile文件编写与研究

这个Makefile是synopsys提供的模板,看上去非常好用,你只要按部就班提供实际项目的参数就可以了。

我们来看这个文件的头部说明:

 

makefile 其实完全可以用csh或其他脚本来编写,只是VCS使用的linux内置的make命令定义了一个标准的仿真脚本,make命令是专门用来 

做项目的源文件管理和编译控制的命令。

这篇文章重点看synpsys的标准仿真脚本都做了哪些操作,然后使用其他脚本来实现。

这里主要是自己 

写的一点东西,有些地方是猜测的或者不准确。

#---------------------------------------------------------------------------------------------------------------------------

#SYNOPSYSCONFIDENTIAL-Thisisanunpublished,proprietaryworkof 

#Synopsys,Inc.,andisfullyprotectedundercopyrightandtradesecret 

#laws.Youmaynotview,use,disclose,copy,ordistributethisfileor 

#anyinformationcontainedhereinexceptpursuanttoavalidwritten 

#licensefromSynopsys. 

# SYNOPSYS公司的版权声明,没有权限不可使用 

#-----------------------------------------------------------------------------------------------------------------------------

#  Filename:

$Id:

Makefile,v1.02006/07/1823:

59:

59vangundyExp$ 

#  Createdby  :

SynopsysInc.07/17/2006 

#  $Author     :

vangundy$ 

#  Description:

DemonstratesVerilogDUTandSVTBusingVCS

 

#  makefile文件头

#---------------------------------------------------------------------------------------------------------------------------

#  TheMakefileworksontwoseperateflows. TheDEBUGflowisintendedtobeused 

#  Duringdebuggingofatestcaseand/ortheDUT.  TheREGRESSIONflowisused 

#  Duringregressionrunsandcollectscoveragedata. 

#  该makefile模版包括两部分流程,debug(查错)流程和regress(回归测试)流程,两个流程大致步骤都相同都是:

Compile,SIM(urg,覆盖 

#  率的分析和采集),debug时主要是跑一个pattern,并dumpVPD文件,SIM的同时可以打开DVE视图界面,结束后观察波形,regress主要用

#  于采集覆盖率,一般要跑多个pattern,这时就无需dumpVPD文件(节约时间),由于是debug后有进行的重复运行,所以叫regress(回归)。

 

#  在我们的验证平台中,若不做代码覆盖率的功能,可以不写regress,只要写debug的流程和跑多个pattern的脚本就好了。

 

#---------------------------------------------------------------------------------------------------------------------

#  TheDEBUGflowturnsonVPDdumpingandturnsoffcoveragecollection.  After 

#  buildingatestcaseusingthedebugtargets,youcandebugtheTBandtheDUT   

#  sourcecodeusingthetestbenchdebuggerandDVE.  Ofcourse,youcanturnon 

#  coveragemetricsandrunindebugmodebychangingcompileandruntimeoptions 

#  inthemakefile. Thesechangesareindependentoftheregressionflowsothat      

#  theregressionswillstillrunoptimallywithouttheinterferenceofVPDdumping. 

#   debug流程打开VPD文件的dump并关闭覆盖率在build了一个包含DUT的testcase后,可以使用VCS的debugger和DVE进行debug。

当 

#   然,你也以通过改变makefile文件中的compile和runtime选项参数来开启覆盖率功能。

Debug流程和regress流程是各自独立的,regression 

#   流程一般不生成VPD。

 

#--------------------------------------------------------------------------------------------------------------------------------

#  TheREGRESSIONflowturnsoffVPDdumpingandturnsonCoverageMetricsandTB 

#  coveragecollection.  Thisflowisintendedtosupportverificationengineerswho 

#  areworkingthroughtheregressionprocessandareinterestedincoverage 

#  collectionandurg. 

#   REGRESSION流程关闭VPDdump并打开Coveragecollection功能,该流程是为了支持验证引擎进行“流水线验证“(跑多个testcase)和 

#   代码覆盖率功能。

在验证平台中可以将运行多个testcase的脚本命名为regress,运行单个testcase的脚本命名为regone?

,这只是

#  synopsys的模版,我们不必完全遵守,可以不区分debug和regress,然后将是否打开波形和coverage设置成参数。

#-------------------------------------------------------------------------------------------------------------------------------

#  CommandLine   make命令行 

#  ----------------- 

#  TheMakefilesupportsthefollowingcommandline 

#   makefile支持下列命令行 

#  %maketarget_name_*

#   makefile文件放在哪?

放在仿真路径。

make[-fmakefile文件名][选项][宏定义][目标]  

#   -f 指定makefile  若没有则make程序首先在当前目录查找名为makefile的文件,如果没有找到,它就会转而查找名为Makefile的文件。

 

#  Wheretarget_nameisthenameofatestcaselocatedinthetestdirectory.  Every 

#  testinthetestdirectoryisnamedusingtest_{test_name}.  Allofthetesttargets 

#  arelistedintheTESTTARGETSsectionofthemakefile.

 

#  target_name是test路径下的一个testcase的名字,test路径下的testcase的名字使用test_{test_name}来命名,例如test_1

 

#  所有的testtarget 都在makefile文件中的TESTTARGETS部分列出 

#---------------------------------------------------------------------------------------------------------------------------

#  CompileandRunTestcases     编译与运行testcase 

#  ------------------------------- 

#  Tocompileandrunatescaseusethetest_*andregress_test_*targets. 

#   编译与运行testcase,(test_1 就是执行了下面的两个命令先编译在运行) test_1==>compile_1  run_1   详见下面命令定义 

#   %maketest_1          //Buildsandrunstest1withVPDdumping        其实就是debug的前边的流程 

#   %makeregress_test_1 //Buildsandrunstest1withcoverageturnedon  

# -------------------------------------------------------------------------------------------------------------------------

#  DebuggingTestcases     Debug 实在上面命令之后在进行的 

#  ------------------------ 

#  YoucanuseDVEandthetestbenchdebuggertovisualizewaveformsandtestbench 

#  execution.  Youmust firstbuildthetestbench usingthemakecompile_*command. 

#   dubug必须是在DVE(VCS的debug工具,与debussy一样的功能)下进行,因为要看波形嘛,但是debug之前必须先compile 

#  %makecompile_1       //Buildstest1fordebugging    //需要重新编译一次吗?

 

#  Onceyouhavebuilttheenvironmentwiththeproperdebugswitches,youcanuseDVEandthetestbenchdebugger. 

# #   testbenchdebugger 是否是指编译后的那个simv可执行文件呢?

  其实gui_1 和上面test_1中的run_1是一样的只是增加了-gui项 

#   即增加了打开gui界面的参数,其他雷同

#  %makegui_1           //Debugtest1withDVE 

#   %maketb_gui_1      //Debugtest1withthetestbenchdebugger 

#  %makeboth_guis_1 //Debugusingbothguis 

#   %makepp_1           //DebugusingtheVPDfile   VPD文件要在执行simv之后才有吧?

 

#  Ifyouwant,youcanturnoncoveragefortheDEBUGflowbyuncommentingthe 

#  coverageflaginthemakefile.  Ifyoudothis,youcanstilllookatcoverage. 

#  Thismaybeusefulinhelpingthosewhoaredebuggingcoveragerelatedissues. 

#   如果在makefile中的debug流程中使用了coverage功能,那么可以使用下面命令观察覆盖率 

#   %makeurg             //Visualizecoveragedatafromdebugruns 

# -----------------------------------------------------------------------------------------------------------------------------

#  RegressionTestcases 

#  -------------------- 

#   Regressiontestsareusedtocollectcoverageinformation.  Tobuildatestcase 

#  forcoveragecollectionuseacommandsimilartothefollowing. 

#   regress流程主要是为了收集代码覆盖率信息,在执行regress之前需要重新buildtestcase  类似debug时的compile 

#   %makeregress_build_1  //Buildandrunaregressiontestwithadefaultseed 

#  Oncethetesthasbeenbuilt,youcanrunitagainwithanewseed. 

#   与debug不同的是regress需要重新run(使用新的SEED)一下,【还是debug的时候也要run一下?

】 

#  %makeregress_run_1SEED=1234 

#  Afterrunningoneormoreregressionruns,youcanvisualizethecoveragedata 

#  usingurgandthefollowingcommand 

#  run完之后可以用下面命令看代码覆盖率 

#   %makeregress_urg 

#----------------------------------------------------------------------------------------------------------------------------

#HOWTOREUSETHISFILEONANOTHERDUT    //如何重用该模版 

#STEP1:

  Updatethefilelocationsasrequired   //设置file所属的路径 

#STEP2:

  UpdatetheDUTsectionwithdirectoryandsourcelocationinfo//更新模版中DUT部分,指定DUT的路径和include的路径 

#STEP3:

  UpdatetheTBsectionwithdirectoryandsourcelocationinfo//更新模版中TB部分,指定TB的路径和include的路径 

#STEP4:

  UpdatetheCoveragesectionwithnameofduttop(egtop.dut) //跟新模版中Coverage部分,指定要测试代码覆盖率的dut的top 

#STEP5:

  Addtesttargetstothedebugandregressiontargetssection//将debug和regress的target加入模版中对应的部分 

#STEP5:

  Adjustthedebugandregressioncompileandruntimearguments//调整debug和regress的compile和runtime的命令参数 

#STEP7:

  Adjustcommandlineoptionsasrequired//调整命令行命令(后边带百分号和冒号的就表示可以在make命令行中使用的命令) 

#STEP8:

  Updatetheenvclasssothatitextendsdkm_env//更新envclass(环境类)使得它可以提供dkm_env 

#   Youwillneedtohaveacopyofthe dkm directoryanditshould  //dkm是什么?

 

#      belocatedat$(TB_SRC_DIR)/dkm 

#      a)Add[`include"dkm_env.sv"] 

#      b)Add[extendsdkm_env]totheenvironmentclassdefinition 

#      c)Callthesuper.new("name")fromtheconstructor 

#STEP9:

  Runthedebugandregressiontargets 

#      %maketestbench_target_*   //testbench_target_*    是指test_1之类的testcase 

#-----------------------------------------------------------------------------

 

看了上文,大家应该可以简单了解这个Makefile的功能了。

接下来就按照step1~9来填空即可:

 

.PHONY:

defaulthelpcleanregress_clean 

default:

help 

#----------------------------------------------------------------------------- 

#DIRECTORIES    总路径 

#----------------------------------------------------------------------------- 

OUTPUT_DIR   =./output      //为什么debug和regress没有分开?

   debug和regress的Coverage在COV_DIR下是有区分的 

COV_DIR        =./coverage    //为什么没有VPD的路径?

   

LOG_DIR        =./logs         //output是做什么的?

   VPD文件  simv文件还有一写其他文件在这里

#Setthistothelocationwhereyouinstalledthedesignwaremodels.  This 

#dependsonwhetheryouranthesetup_vip_dw_hometoinstallthemodelsor 

#thesetup_vip_herescript. 

#DW_MODELS_DIR=$(DESIGNWARE_HOME) 

DW_MODELS_DIR=/user/synopsys/designware      //软件路径  VCS的路径?

 

#DESIGNWARE_HOME=~synopsys/bk/designware    

#DW_MODELS_DIR=./designware 

#---------------------------------------------------------------------------- 

#DEVICEUNDERTEST     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  +=-overr

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 学科竞赛

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1