Professional Documents
Culture Documents
AdvantageofUsingVHDL
y Industrialstandard(IEEE1076) y Portabilityofdesignsandknowledge y Hierarchyindesigndescription y Technology(implementation)independence y CodeReusability y ParameterizedDesign y (Thelistdoesnotendhere!)
BasicConcepts
y VHDLisstronglytyped y VHDLallowsuserdefinedtypes y VHDLiscaseinsensitiveandfreeformat y Commentsarespecifiedbytwoconsecutivedashes()
Example
entityMyAnd2is port(a,b:inbit; c:outbit ); endMyAnd2; specifyentitynamebyconvention specifyin/out/inout ports no;here endedby; endentityspecification behaviorspec starthere dataflow endhere
Entity
y BITisapredefinedtype;itisanenumerationtype
Architecture
Thearchitecturebodycanbeusedforthefollowing modelingstyles:
y Asasetofconcurrentassignments(torepresent
DataflowDesc inVHDL
y Inadigitalsystem,variousformsofhardware
SimpleSignalAssignment
y E.g.,c<=aandb; y c :targetsignal y a,b:sourcesignals y <=:signalassignmentoperator y Thesixlogicaloperatorsare: y ANDORNANDNORXORNOT
SelectedSignalAssignment
y Theselectedsignalassignmentstatementismuchlike
SelectedSignalAssignment(Syn)
Thesyntaxis: WITHexpressionSELECT target<=waveformWHENchoice, waveformWHENchoice, ... ...;
2to1Multiplexer
entityMux21is port(a,b,sel :inbit; y:outbit ); endMux21; architecturedataflowofMux21is begin withsel select ys outputisbasedonsel y<=awhen1, bwhen0; enddataflow;
BitVector
y Severalbitscanbeaggregatedtofromabitvector y E.g.,myBitVector:inbit_vector(7downto 0); y Eachofthebitscanbeaccessedbybit_vector[i]to
ConditionalSignalAssignment
y Conditionalsignalassignmentstatementslistaseries
41Multiplexer
entityMux41is port(data:inbit_vector(3down0); sel:inintegerrange0to3; f:outbit ); endMux41; architecturedataflowofMux41is begin f<= data(0)whensel =0else data(1)whensel =1else data(2)whensel =2else data(3); enddataflow;
Process
y AprocessinVHDLisusedtomodelbothsequentialand y y y y
IfThanElseinProcess
y Equivalenttoconditionalstatementbutitis
SequentialLogic
process(clk,clr) begin ifclr =1then reset q<=0; elsif clkevent andclk =1then q<=d; endif;makesureplaceendifhere endprocess;