您好,欢迎访问三七文档
当前位置:首页 > 金融/证券 > 综合/其它 > SystemVerilog语法
|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›Intro_to_SystemVerilogAmyWu12/2013|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›ContentIntroDataTypesProcessesSystemVerilogClassesSystemVerilogInterfacesSystemVerilogProgramBlockSystemVerilogClockingRandomConstraintsFunctionalcoverage|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›IntroSystemVerilogcombinestheVerificationcapabiltiesofHVL(HardwareVerificationLanguage)witheaseofVerilogtoprovideasingleplatformforbothdesignandverification.NewfeaturesCtypedatatypeslikeint,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-introHighlightsofSystemVerilogdatatypesarebelowoshortintandlongintdatatypes.oshortreal(realwasalreadydefinedinVerilog)datatype.ostring,chandleandclassdatatypes.ologic,bitandbytedatatype.oUserdefinedtypestypedef.ostruct,union,andclassdatatypes.ovoiddatatype.onulldatatype.oarrays,queue,associativearray,dynamicarray|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-Integerdatatypes2statevalueintegerdatatypesareoshortint: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-voidandnulldatavaluesvoidandnulltypesvaluearesameasinClanguageovoidisusedinfunctionstoreturnnovalue.onullisusedforcomparingavariabletoemptyvalue,saycomparingastringtoemptystring.|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-chandledatatypeschandledatatypeisusedforstoringthepointer,whileusingDirectprogramminginterface(DPI).|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-stringdatatypes-1stringdatatypeisusedforstoringstrings.thesizeofstringdataisdynamic.stringdatatypescomewithbuildinmethods|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-stringdatatypes-2StringOperators|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-stringdatatypes-3buildinmethods|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-eventdatatypesSyntax:eventvariable_name[=initial_value]Initialvaluecanbeanothereventvariable,Andcanbenullifyouwantvariable_nametobetriggeredalways.|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-UserdefinedtypesUserdefinedtypesaresameasfoundinClanguageorothers.Atypecanbeusedbeforeitisdefined,provideditisfirstidentifiedasatypebyanemptytypedef.Syntaxotypedefdata_typetype_identifiervariable_dimensionotypedefinterface_instance_identifiertype_identifierotypedef[enum|struct|union|class]type_identifier|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›DataTypes-StructuresandunionstypesStructureanduniondeclarationstypesaresameasthatfoundinClanguage.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-newdatatypesQueues,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-1staticprocesses,introducedbyalways,initialorforkdynamicprocesses,introducedbyfork...join_anyandfork...join_none.always_combooformodelingcombinationallogicbehavioralways_combbegin:ADDERsum=b+a;parity=^sum;end|PresentationTitle|October19,2019|AMDSRDCConfidential‹#›Process-2Forkjoin|Present
本文标题:SystemVerilog语法
链接地址:https://www.777doc.com/doc-1610052 .html