SystemVerilog语法

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

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

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

资源描述

|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›Intro_to_SystemVerilogAmyWu12/2013|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›ContentIntroDataTypesProcessesSystemVerilogClassesSystemVerilogInterfacesSystemVerilogProgramBlockSystemVerilogClockingRandomConstraintsFunctionalcoverage|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›IntroSystemVerilogcombinestheVerificationcapabiltiesofHVL(HardwareVerificationLanguage)witheaseofVerilogtoprovideasingleplatformforbothdesignandverification.NewfeaturesCtypedatatypeslikeint,typedef,struct,union,enum.Dynamicdatatypes:struct,classes,dynamicqueues,dynamicarrays.Newoperatorsandbuiltinmethods.Enhancedflowcontrollike,foreach,return,break,continue.Semaphores,mailboxes,eventextensions.classesforobjectorientedprogramming.Assertions.Coverage.|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-introHighlightsofSystemVerilogdatatypesarebelowoshortintandlongintdatatypes.oshortreal(realwasalreadydefinedinVerilog)datatype.ostring,chandleandclassdatatypes.ologic,bitandbytedatatype.oUserdefinedtypestypedef.ostruct,union,andclassdatatypes.ovoiddatatype.onulldatatype.oarrays,queue,associativearray,dynamicarray|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-Integerdatatypes2statevalueintegerdatatypesareoshortint:16-bitsignedinteger.oint:32-bitsignedinteger.olongint:64-bitsignedinteger.obyte:8-bitsignedinteger,canbeusedforstoringASCIIcharater.obit:Userdefinedvectortypes.4-statevalueintegersdatatypesareologic:Userdefinedvectortypes.oreg:Userdefinedvectortypes.owire:Userdefinedvectortypes.ointeger:32-bitsignedinteger.otime:64-bitunsignedinteger.|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-voidandnulldatavaluesvoidandnulltypesvaluearesameasinClanguageovoidisusedinfunctionstoreturnnovalue.onullisusedforcomparingavariabletoemptyvalue,saycomparingastringtoemptystring.|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-chandledatatypeschandledatatypeisusedforstoringthepointer,whileusingDirectprogramminginterface(DPI).|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-stringdatatypes-1stringdatatypeisusedforstoringstrings.thesizeofstringdataisdynamic.stringdatatypescomewithbuildinmethods|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-stringdatatypes-2StringOperators|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-stringdatatypes-3buildinmethods|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-eventdatatypesSyntax:eventvariable_name[=initial_value]Initialvaluecanbeanothereventvariable,Andcanbenullifyouwantvariable_nametobetriggeredalways.|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-UserdefinedtypesUserdefinedtypesaresameasfoundinClanguageorothers.Atypecanbeusedbeforeitisdefined,provideditisfirstidentifiedasatypebyanemptytypedef.Syntaxotypedefdata_typetype_identifiervariable_dimensionotypedefinterface_instance_identifiertype_identifierotypedef[enum|struct|union|class]type_identifier|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-StructuresandunionstypesStructureanduniondeclarationstypesaresameasthatfoundinClanguage.packed:Apackedstructureconsistsofbitfields,whicharepackedtogetherinmemorywithoutgaps.unpacked:Anunpackedstructurehasanimplementation-dependentpacking,normallymatchingtheCcompiler.tagged:AnTaggedunionisatype-checkedunion.|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-Structuresandunionstypes•equivalenttoapackedarraysubdividedintonamedfields:–example:48bitpackedarray–canbeaccessedaspack1[15:0]=‘b0;–canaccesspack1[9:4]=15;–canbeaccessedaspack1.d=‘b0;–thewholestructcanberesettedwithpack1=‘b0;•unpackedstruct(no“packed”keyword)allowonlyaccesthroughthenamedfields(pack1.d=‘b0);|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-newdatatypesQueues,byteq1[$];//Aqueueofbytesstringnames[$]={Bob};//AqueueofstringswithoneelementMethod:size(),delete(),pop_front(),pop_back()…..dynamicbit[3:0]nibble[];integermem[];Methodnew[],size(),delete()andassociativearraysbit[20:0]array_b[string];eventev_array[myClass];Method:num(),delete();exists()...reducedmemoryusage,built-insupportforsearchingandsorting|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-Classandstructuresclassrsp;intaddress;//Propertiesareaddress,data,andcrcbit[63:0]data;reqrqp;//HandletoanotherPacketfunctionnew();//Methodsaresendandnewfunctionbitcopy();endclass:rsptypedefstruct{bit[7:0]opcode;bit[23:0]addr;}instruction;//namedstructuretype|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-Enum|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›Process-1staticprocesses,introducedbyalways,initialorforkdynamicprocesses,introducedbyfork...join_anyandfork...join_none.always_combooformodelingcombinationallogicbehavioralways_combbegin:ADDERsum=b+a;parity=^sum;end|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›Process-2Forkjoin|Present

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

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

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

×
保存成功