VCS-S11-Unit-06

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

6-1SynopsysProfessionalServicesHTCWorkshop.Confidential©2002SynopsysProprietaryAgenda:Day2DAY2TopicLabUnitDebuggingSimulationMismatches5UsingPLIRoutineswithVCS6FastRTLLevelVerification7FastGateLevelVerification8Appendix:VCS/VCM96-2SynopsysProfessionalServicesHTCWorkshop.Confidential©2002SynopsysProprietaryUnitObjectivesAftercompletingthisunit,youshouldbeableto:„CompileanPLICprogram„CreateaPLI.tabfileforthePLICprogram„CallthePLICprograminVerilogcode„CompileVerilogcodeandlinkinPLICprogram„RunSimulationwiththePLICprogramenabledVerilogcode6-3SynopsysProfessionalServicesHTCWorkshop.Confidential©2002SynopsysProprietaryWhatisPLI?„ProgrammingLanguageInterface:zInterfacebetweenCprogramsandVerilogsimulatorszPartoftheVerilogstandardIEEE1364zEnablesdevelopmentofuserdefinedsystemtaskorfunction„ExamplesofPLIusage:zTestbench‹ApplystimulusandcaptureresultszCmodels‹EmulatefunctionalblockszExtendingtheVeriloglanguage‹Dynamicmemorymanagement,fileI/oroutines,etc.6-4SynopsysProfessionalServicesHTCWorkshop.Confidential©2002SynopsysProprietaryLinkingCProgramstoVerilogCode„ForthePLICprogram:zWritePLICprogramwithPLIlibraryroutines‹Include“vcsuser.h”and“acc_user.h”headerfileszCompileintoobjectcode„FortheVerilogcodezWriteVerilogwhichcallstheuserdefinedCPLIprogram„InVCS:zCreatePLItable(.tabfile)‹MapsCprogram“task”tomatching“$task”inVerilogcode‹Controls“$task”accessintoVCSdatastructurezCompileVerilogcodeandlinkinPLICobjectcodeandlinkinPLItablwith-Pswitch6-5SynopsysProfessionalServicesHTCWorkshop.Confidential©2002SynopsysProprietaryAVerySimplePLIExamplevcsmy_model.v-Phello.tabhello.oPLItable//hello.tab$hellocall=hello_callVCS//my_model.vmodulemy_model;initial$hello;endmoduleVerilogCodeuserdefinedPLICcall/*hello.c*/#include“vcsuser.h”hello_call{io_printf(“Hello!\n”);}CPLIProgramhello.omy_model.vgccPLItfroutinesimv6-6SynopsysProfessionalServicesHTCWorkshop.Confidential©2002SynopsysProprietaryAnotherExample:TheFileI/OPackage„VCSismostefficientreadingstimulusfromanexternalfile„ThecurrentVeriloglanguageislimitedinfileI/O:zOnly$readmemformatsupportedzOnly32filescanbeopenatonce„FutureIEEE-1364standardwillincludesystemfunctionstoreadandwritefiles„Fornow,usethefileI/OpackagefromChrisSpear:zAvailablefrom©2002SynopsysProprietaryTheFileI/OPackage„Filemanipulation:z$fopenr,$fcloser,$fopenw,$fclosew,$ferror„ReadingASCIIfiles:z$fgetc,$ungetc,$fgets,$fscanf,$ftell,$fseek„Readingbinaryfilesz$fread„WritingASCIIfilesz$fprintf„ReadingandwritingVerilogstrings:z$sscanf,$sprintf6-8SynopsysProfessionalServicesHTCWorkshop.Confidential©2002SynopsysProprietaryFileI/ORoutinesComparedtoCCodeVerilogCCode`timescale1ns/10psmodulestim;integerfile,r,bin,dec,hex;realrtime;initialbegin$display(timedecimalhex);file=$fopenr(stim.pat);while(!$feof(file))begin//Readthenexttimer=$fscanf(file,%f,rtime);//Waituntiltheabsolutetimeinthefile,readstimulus#(rtime-$realtime)r=$fscanf(file,%d%h\n,dec,hex);$display(“@%t%d%h\n”,rtime,dec,hex);end//whilenotEOFr=$fcloser(file);end//initialendmodule//stim#include“stdio.h”main(){FILE*file;intdec,hex;doublertime;charline[1000];/*Lineoftextreadfromfile*/printf(timebindecimalhex\n);file=fopen(”stim.pat”,“r”);while(!feof(file)){/*Readthenexttime*/fscanf(file,%f,&rtime);/*readstimulus*/fscanf(file,%d%x\n,&dec,&hex);printf(“@%f%d%x\n”,rtime,dec,hex);}/*whilenotEOF*/fclose(file);}6-9SynopsysProfessionalServicesHTCWorkshop.Confidential©2002SynopsysProprietaryCompileFileI/OPackage„CompilethefileI/Opackage„Makesureyouhavethefollowingfileio.tabfilegcc-cfileio.c-I$VCS_HOME/`vcs-platform`/lib//file.tabforFileIOapplicationwithVCS$fopenacheck=fopen_checkcall=fopen_callmisc=fopen_miscsize=32data=1acc=rw:%TASK$fopenrcheck=fopen_checkcall=fopen_callmisc=fopen_miscsize=32data=2acc=rw:%TASK$fopenwcheck=fopen_checkcall=fopen_callmisc=fopen_miscsize=32data=3acc=rw:%TASK$fcloseacheck=fclose_checkcall=fclose_callsize=32data=1$fclosercheck=fclose_checkcall=fclose_callsize=32data=2$fclosewcheck=fclose_checkcall=fclose_callsize=32data=3$fgetscheck=fgets_checkcall=fgets_callsize=1acc=rw:%TASK$getscheck=gets_checkcall=gets_callsize=1acc=rw:%TASK$fgetccheck=fgetc_checkcall=fgetc_callsize=32acc=rw:%TASK$getcharcheck=getchar_checkcall=getchar_callsize=32acc=rw:%TASK$ungetccheck=ungetc_checkcall=ungetc_callsize=32$feofcheck=feof_checkcall=feof_callsize=32$ferrorcheck=ferror_checkcall=ferror_callsize=32$fscanfcheck=fscanf_checkcall=fscanf_callmisc=fscanf_miscsize=32acc=rw:%TASK$sscanfcheck=sscanf_checkcall=sscanf_callmisc=sscanf_miscsize=32acc=rw:%TASK$scanfcheck=scanf_checkcall=scanf_callmisc=scanf_miscsize=32acc=rw:%TASK$ftellcheck=ftell_checkcall=ftell_callsize=32$fseekcheck=fseek_checkcall=fseek_callsize=32$freadcheck=fread_checkcall=fread_callsize=32acc=rw:%TASK$sprintfcheck=sprintf_checkcall=sprintf_callmisc=sprintf_miscsize=32acc=rw:%TASK$fprintfcheck=fprintf_checkcall=fprintf_callmisc=fprintf_miscsize=32acc=rw:%TASK6-10SynopsysProfessionalServicesHTCWorkshop.Confiden

1 / 23
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功