vhdl语言例程集锦

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

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

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

资源描述

ExamplesofVHDLDescriptionsAdvancedElectronicDesignAutomationExamplesofVHDLDescriptionsAuthor:IanElliottofNorthumbriaUniversityThisfilecontainsaselectionofVHDLsourcefileswhichservetoillustratethediversityandpowerofthelanguagewhenusedtodescribevarioustypesofhardware.Theexamplesrangefromsimplecombinationallogic,describedintermsofbasiclogicgates,tomorecomplexsystems,suchasabehaviouralmodelofamicroprocessorandassociatedmemory.AlloftheexamplescanbesimulatedusinganyIEEEcompliantVHDLsimulatorandmanycanbesynthesisedusingcurrentsynthesistools.Usethehierarchicallinksbelowtonavigateyourwaythroughtheexamples:●CombinationalLogic●Counters●ShiftRegisters●Memory●StateMachines●Registers●Systems●ADCandDAC●ArithmeticCombinationalLogic●Exclusive-ORGate(Dataflowstyle)●Exclusive-ORGate(Behaviouralstyle)●Exclusive-ORGate(Structuralstyle)●MiscellaneousLogicGates●Three-inputMajorityVoter●MagnitudeComparator●Quad2-inputNand(74x00)●BCDtoSevenSegmentDecoder●Dual2-to-4Decoder●OctalBusTransceiver●Quad2-inputOR●8-bitIdentityComparator●HammingEncoder●HammingDecoder●2-to-4DecoderwithTestbenchandConfiguration●Multiplexer16-to-4usingSelectedSignalAssignmentStatement●Multiplexer16-to-4usingConditionalSignalAssignmentStatement●Multiplexer16-to-4usingif-then-elsif-elseStatement●M68008AddressDecoder●HighestPriorityEncoder●N-inputANDGateCountershttp://www.ami.bolton.ac.uk/courseware/adveda/vhdl/vhdlexmp.html(1of67)[23/1/20024:15:01]●CounterusingaConversionFunction●GeneratedBinaryUpCounter●CounterusingMultipleWaitStatements●SynchronousDownCounterwithParallelLoad●Mod-16CounterusingJKFlip-flops●PseudoRandomBitSequenceGenerator●UniversalCounter/Register●n-BitSynchronousCounterShiftRegisters●UniversalShiftRegister/Counter●TTL164ShiftRegister●Behaviouraldescriptionofan8-bitShiftRegister●StructuralDescriptionofan8-bitShiftRegisterMemory●ROM-basedWaveformGenerator●AFirst-inFirst-outMemory●Behaviouralmodelofa16-word,8-bitRandomAccessMemory●Behaviouralmodelofa256-word,8-bitReadOnlyMemoryStateMachines●Classic2-ProcessStateMachineandTestBench●StateMachineusingVariable●StateMachinewithAsynchronousReset●PatternDetectorFSMwithTestBench●StateMachinewithMooreandMealyoutputs●MooreStateMachinewithExplicitStateencoding●MealyStateMachinewithRegisteredOutputs●MooreStateMachinewithConcurrentOutputLogicSystems●PelicanCrossingController●SimpleMicroprocessorSystem●BoothMultiplier●LotteryNumberGenerator●DigitalDelayUnit●ChessClockADCandDAC●PackagedefiningaBasicAnaloguetype●16-bitAnaloguetoDigitalConverter●16-bitDigitaltoAnalogueConverter●8-bitAnaloguetoDigitalConverter●8-bitUnipolarSuccessiveApproximationADChttp://www.ami.bolton.ac.uk/courseware/adveda/vhdl/vhdlexmp.html(2of67)[23/1/20024:15:07]●8-bitUnsignedMultiplier●n-bitAdderusingtheGenerateStatement●AVarietyofAdderStyles●BoothMultiplierRegisters●UniversalRegister●OctalD-TypeRegisterwith3-StateOutputs●QuadD-TypeFlip-flop●8-bitRegisterwithSynchronousLoadandClearUniversalRegisterDescription-Thisdesignisauniversalregisterwhichcanbeusedasastraightforwardstorageregister,abi-directionalshiftregister,anupcounterandadowncounter.Theregistercanbeloadedfromasetofparalleldatainputsandthemodeiscontrolledbya3-bitinput.The'termcnt'(terminalcount)outputgoeshighwhentheregistercontainszero.LIBRARYieee;USEieee.Std_logic_1164.ALL;USEieee.Std_logic_unsigned.ALL;ENTITYunicntrISGENERIC(n:Positive:=8);--sizeofcounter/shifterPORT(clock,serinl,serinr:INStd_logic;--serialinputsmode:INStd_logic_vector(2DOWNTO0);--modecontroldatain:INStd_logic_vector((n-1)DOWNTO0);--parallelinputsdataout:OUTStd_logic_vector((n-1)DOWNTO0);--paralleloutputstermcnt:OUTStd_logic);--terminalcountoutputENDunicntr;ARCHITECTUREv1OFunicntrISSIGNALint_reg:Std_logic_vector((n-1)DOWNTO0);BEGINmain_proc:PROCESSBEGINWAITUNTILrising_edge(clock);CASEmodeIS--resetWHEN000=int_reg=(OTHERS='0');--parallelloadWHEN001=int_reg=datain;--countupWHEN010=int_reg=int_reg+1;--countdownWHEN011=int_reg=int_reg-1;--shiftleftWHEN100=int_reg=int_reg((n-2)DOWNTO0)&serinl;--shiftrightWHEN101=int_reg=serinr&int_reg((n-1)DOWNTO1);--donothingWHENOTHERS=NULL;ENDCASE;ENDPROCESS;det_zero:PROCESS(int_reg)--detectswhencountis0BEGINtermcnt='1';FORiINint_reg'RangeLOOPhttp://www.ami.bolton.ac.uk/courseware/adveda/vhdl/vhdlexmp.html(3of67)[23/1/20024:15:08](i)='1'THENtermcnt='0';EXIT;ENDIF;ENDLOOP;ENDPROCESS;--connectinternalregistertodataoutportdataout=int_reg;ENDv1;OctalD-TypeRegisterwith3-StateOutputsSimplemodelofanOctalD-typeregisterwiththree-stateoutputsusingtwoconcurrentstatements.LIBRARYieee;USEieee.std_logic_1164.ALL;ENTITYttl374I

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

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

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

×
保存成功