Вы находитесь на странице: 1из 42

ABEL-HDL Primer

ABEL Primer Contents


1. Introduction 2. Basic structure of an ABEL source file 3. Declarations (module, pin, node, constants) 4. Num ers !. Directi"es #. $ets o a. Inde%in& or accessin& a set o . $et operations #. 'perators o a. Lo&ical 'perators o . Arit(metic operators o c. )elational operators o d. Assi&nment operators o e. 'perator priorit* +. Lo&ic description o a. E,uations -(en./(en.Else statement

. /rut( /a le c. $tate Description $tate0dia&ram If./(en.Else statement -it( statement 1ase statement o d. Dot e%tensions 2. /est "ectors 13. De"ice $pecific (4ropert*) $tatements 11. 5iscellaneous o a. Acti"e.lo6 declarations 12. E%amples o 5oore 7inite $tate 5ac(ine o 5eal* 7inite $tate 5ac(ine o $*nc(ronous 5eal* 7inite $tate 5ac(ine 1ommon 5ista8es )eferences Ac8no6led&ement
o o

Introduction
ABEL (Ad"anced Boolean E,uation Lan&ua&e) allo6s *ou to enter e(a"ior.li8e descriptions of a lo&ic circuit. ABEL is an industr*.standard (ard6are description lan&ua&e (9DL) t(at 6as de"eloped * Data I:' 1orporation for pro&ramma le lo&ic de"ices (4LD). /(ere are ot(er (ard6are description lan&ua&es suc( as ;9DL and ;erilo&. ABEL is a simpler lan&ua&e t(an ;9DL 6(ic( is capa le of descri in& s*stems of lar&er comple%it*. ABEL can e used to descri e t(e e(a"ior of a s*stem in a "ariet* of forms, includin& lo&ic e,uations, trut( ta les, and state dia&rams usin& 1.li8e statements. /(e ABEL compiler allo6s desi&ns to e simulated and implemented into 4LDs suc( as 4ALs, 14LDs and 74<As. 7ollo6in& is a rief o"er"ie6 of some of t(e features and s*nta% of ABEL. It is not intended to e a complete discussion of all its features. /(is ABEL primer 6ill &et *ou started 6it( 6ritin& ABEL code. In case *ou are familiar 6it( ABEL, t(is 6rite.up can ser"e as a ,uic8 reference of t(e most often used commands. 7or more ad"anced features, please consult an ABEL manual or t(e =ilin% on.line documentation.

2. Basic structure of an ABEL source file


An ABEL source file consists of t(e follo6in& elements. 9eader> includin& 5odule, 'ptions and /itle Declarations> 4in, 1onstant, Node, $ets, $tates. Li rar*. Lo&ic Descriptions> E,uations, /rut(.ta le, $tate0dia&ram /est ;ectors> /est0"ectors End ?e*6ords (6ords reco&ni@ed * ABEL suc( as commands, e.&. &oto, if, t(en, module, etc.) are not case sensiti"e. Aser.supplied names and la els (identifier) can e uppercase, lo6ercase or mi%ed.case, ut are case.sensiti"e (input1 is different from Input1).

A t*pical template is &i"en elo6. module module name Btitle stringC Bde"iceID device de"ice/*peDC pin declarations ot(er declarations e,uations e,uations B/est0;ectorsC test "ectors end module name /(e follo6in& source file is an e%ample of a (alf adder>

module my_first_circuit; title 'ee200 assignment 1' EE200XY device 'XC4003E'; E input pins A, B pin 3, !D E output pins $A5, 1arr*0out pin 1!, 1+ ist*pe FcomFD e,uations $A5 G (A H IB) J (IA H B) D 1arr*0out G A H BD end m*0first0circuitD

3. Declarations
Module> eac( source files starts 6it( a module statement follo6ed * a module name (identifier). Lar&e source files often consist of multiple modules 6it( t(eir o6n title, e,uations, end statement, etc. Title> is optional and can e used to identif* t(e proKect. /(e title name must e et6een sin&le ,uotes. /(e title line is i&nored * t(e compiler ut is (and* for documentation. String> is a series of A$1II c(aracters enclosed * sin&le ,uotes. $trin&s are used for /I/LE, '4/I'N$ statements, and in pin, node and attri ute declarations. device> t(is declaration is optional and associates a de"ice identifier 6it( a specific pro&ramma le lo&ic de"ice. /(e de"ice statement must end 6it( a semicolon. -(en *ou are usin& t(e =ilin% 1AD s*stem to compile t(e desi&n, it is etter not to put t(e de"ice statement in t(e source file to 8eep *our desi&n independent of t(e de"ice. -(en *ou create a ne6 proKect in =ilin% *ou 6ill specif* t(e de"ice t*pe (can also e c(an&ed in t(e 4roKect 5ana&er 6indo6 usin& t(e 4roKect Information utton). /(e format is as follo6s> de"ice0id device Freal0de"iceFD E%ample> 5L0DE1'DE) device F=14333EFD comments> comments can e inserted an*6(ere in t(e file and e&in 6it( a dou le ,uote and end 6it( anot(er dou le ,uote or t(e end of t(e line, 6(ate"er comes first.

pin> pin declarations tell t(e compiler 6(ic( s*m olic names are associated 6it( t(e de"ices e%ternal pins. 7ormat> [!]pin_id pin [pin#] [istype 'attributes'] ; 'ne can specif* more t(an one pin per line> BICpin0id , pin0id, pin0id pin [pinJ, BpinJ, BpinJCCC Bistype Fattri utesFCD E%ample> IN1, IN2, A1 pin 2, 3, 4D 'A/1 pin 2 istype 're 'D ENABLE pinD I1(ip0select pin 12 istype 'com'D I$3..I$# pin istype 'com'D Lou do not need to specif* t(e pin. 4in num ers can e specified later * usin& a Euser constraint file E 6(en doin& t(e compilation usin& =ilin% 1AD. /(is (as t(e ad"anta&e t(at our desi&n is more &eneral and fle%i le. /(e I indicates an acti"e lo6 (t(e si&nal 6ill e in"erted). /(e istype is an optional attri ute assi&nment for a pin suc( as FcomF to indicate t(at t(e output is a com inational si&nal or Fre&F for a cloc8ed si&nal (re&istered 6it( a flip flop). /(is attri ute is onl* for output pins. node> node declarations (a"e t(e same format as t(e pin declaration. Nodes are internal si&nals 6(ic( are not connected to e%ternal pins. E%ample>

tmp1 node [istype FcomFCD

ot!er declarations allo6s one to define constants, sets, macros and e%pressions 6(ic( can simplif* t(e pro&ram. As an e%ample a constant declaration (as t(e follo6in& format> id B, idC,... G e%pr B, e%prC.. D E%amples> A G 21D 1G2MND ADD) G B1,3,11CD LA)<E G B H 1D D G BD3, D2, D1, D3CD D G BD3..D3CD /(e last t6o e,uations are e,ui"alent. /(e use of E..E is (and* to specif* a ran&e. /(e last e%ample ma8es use of "ector notations. An* time *ou use D in an e,uation, it 6ill refer to t(e "ector BD3, D2, D1. D3C.

". #um$ers
Num ers can e entered in four different ases> inar*, octal, decimal and (e%adecimal. /(e default ase is decimal. Ase one of t(e follo6in& s*m ols (upper or lo6er case allo6ed) to specif* t(e ase. -(en no s*m ol is specified it is assumed to e in t(e decimal ase. Lou can c(an&e t(e default ase 6it( t(e Directi"e E)adi%E as e%plained in t(e ne%t section. BA%E #A&E Binar* 'ctal Decimal 9e%adecimal BA%E 2 + 13 1# %ym$ol. O Oo Od (default) O(

E%amples> %pecified in Decimal 'alue ABEL 3! 3! O(3! !3 O 131 !

(. Directi)es
Directi"es allo6 ad"anced manipulation of t(e source file and processin&, and can e placed an*6(ere needed in a file. *AL+E,#A+E Syntax Palternate PAL/E)NA/E ena les an alternate set of operators. Asin& t(e alternate operator set precludes use of t(e ABEL.9DL addition (Q), multiplication (M) and di"ision (:) operators ecause t(e* represent t(e '), AND and N'/ lo&ical operators in t(e alternate set. /(e standard operator still 6or8 6(en PAL/E)NA/E is in effect. /(e alternate operators remain in effect until t(e P$/ANDA)D directi"e is used or t(e end of t(e module is reac(ed. *,ADISyntax Pradi% expr D Expr: A "alid e%pression t(at produces t(e num er 2, +, 13 or 1# to indicate a ne6 default ase num er. /(e P)adi% directi"e c(an&es t(e default ase. /(e default is ase 13 (decimal). /(e ne6l*.specified default ase sta*s in effect until anot(er Pradi% directi"e is issued or until t(e end of t(e module is reac(ed. Note t(at 6(en a ne6 Pradi% is issued, t(e specification of t(e ne6 ase must e in t(e current ase format

E%ample Pradi% 2D S Pradi% 1313D Rc(an&e default ase to inar* Rc(an&e ac8 from inar* to decimal

*%+A#DA,D Syntax Pstandard /(e Pstandard option resets t(e operators to t(e ABEL.9DL standard. /(e alternate set is c(osen 6it( t(e Palternati"e directi"e.

.. %ets
A set is a collection of si&nals or constants used to reference a &roup of si&nals * one name. A set is "er* (and* to simplif* lo&ic e%pressions. An* operation t(at is applied to a set is applied to eac( element. A set is a list of constants or si&nals separated * commas or t(e ran&e operator (..) put et6een s,uare rac8ets (re,uired). E%amples> [D0,D1,D2,D4,D5] [D0..D6] E incrementin& ran&e [b6..b0] E decrementin& ran&e [D7..D15] [b1,b2,a0..a3] E ran&e 6it(in a lar&er set Edecrementin& ran&e of acti"e .lo6 [!S7..!S0] si&nals 9o6e"er, t(e follo6in& is not allo6ed> [D0, X]; in 6(ic( = is also a set X = [X3..X0]D Instead one can 6rite> [D0, X3..X0]D

a. Inde/in or accessin a set


Inde%in& allo6s *ou to access elements 6it(in a set. Ase numerical "alues to indicate t(e set inde%. /(e num er refers to t(e it position in t(e set startin& 6it( 3 for t(e least si&nificant it of t(e set. 9ere are some e%amples. D1 = [D15..D0]; "set declaration =2 G B=3..=3CD Eset declaration =2 >G D1B3..3CD Ema8es =2 e,ual to BD3, D2, D1, D3C =2 >G D1BN..4CD Ema8es =2 e,ual to BDN, D#, D!, D4C /o access one element in t(e set, use t(e follo6in& s*nta%> OUT = (X[2] == 1); 9ere a comparator operator (GG) is used to con"ert t(e sin&le.element (=B2C) into a it "alue e,ui"alent to =2. /(e comparator (GG) &i"es aE1E or E3E dependin& if t(e comparison is /rue or 7alse. Notice t(e difference between the assignment operator (=) and the equal operator (==). /(e assi&nment operator is used in e,uations rat(er t(an in e%pressions. E,uations assi&n t(e "alue of an e%pression to t(e output si&nals.

$. %et operations
5ost of t(e operations can e applied to a set and are performed on eac( element of t(e set accordin& to t(e rules of Boolean al&e ra. 'perations are performed accordin& to t(e operatorFs priorit*D operators 6it( t(e same priorit* are performed from left to ri&(t (unless one uses parent(eses). 9ere are a couple of

e%amples.

E%ample 1> Signal = [D2,D1,D0]; "declaration of Signal set $i&nal G B1,3,1C H B3,1,1CDE results in $i&nal ein& Ee,ual to B3,3,1C E%ample 2> [A,B] = C & D; t(is is e,ui"alent to t6o statements> A = C & D; B G 1 H DD E%ample 3> [A1,B1] = [D1,D2] & [C3,C2]; is e,ui"alent to> BA1,B1C G BD1 H 13, D2 H 12CD t(us A1 G D1 H 13, and B1G D2 H 12. E%ample 4> X & [A,B,C]; 6(ic( is e,ui"alent to B=HA, =HB, =H1CD 9o6e"er consider t(e follo6in& e%pression 2 & [A,B,C]; no6 t(e num er E2E is first con"erted into a inar* representation and padded 6it( @eros (3313) if necessar*. /(us t(e a o"e e,uation is e,ui"alent to> [0 & A, 1 & B, 0 & C];

E%ample !> A=[A2,A1,A0]; "set declaration BGBB2,B1,B3CD Eset declaration A J BD is e,ui"alent to BA2 J B2, A1 J B1, A3 J B3CD !A; is e,ui"alent to [!A2,!A1,!A0]; E%ample #> [b3,b2,b1,b0] = 2;"is equivalent to b3=0,b2=0,b1=1,b0=0. /(e num er E2E is con"erted into inar* and padded 6it( @eros (3313). E%ample N> $ets are also (and* to specif* lo&ic e,uations. $uppose *ou need to specif* t(e e,uation> Chip_Sel = !A7 & A6 & A5; /(is can e done usin& sets. 7irst define a constant Addr set.> Addr = [A7,A6,A5];" declares a constant set Addr. 'ne can t(en use t(e follo6in& e,uation to specif* t(e address> Chip_Sel = Addr == [0,1,1]; 6(ic( is e,ui"alent to sa*in&> Chip_Sel = !A7 & A6 & A5; Indeed, if ANG3, A#G1 and A!G1, t(e e%pression Addr GGB3,1,1C is true (or 1) and t(us 1(ip0$el 6ill e true (or 1). Anot(er 6a* to 6rite t(e same e,uation is> Chip_Sel = Addr == 3; " decimal 3 is equal to 011. /(e a o"e e%pressions are "er* (elpful 6(en 6or8in& 6it( a lar&e num er of "aria les (e%. a 1# it address).

E%ample +> 7or t(e same constants as in t(e e%ample a o"e, t(e e%pression, 3 & Addr; 6(ic( is e,ui"alent to [0,1,1] & [A7,A6,A5] B3 H AN, 1 H A#, 1 H A!C B3,A#,A!C. 9o6e"er, t(e follo6in& statement is different> 3 & (Addr == 1); 6(ic( is e,ui"alent to> 3 & (!A7 & !A6 & A5). 9o6e"er, t(e relational operator (GG) &i"es onl* one it, so t(at t(e rest of t(e e,uation e"aluates also to one it, and t(e E3E is truncated to E1E>. /(us t(e a o"e e,uation is e,ual to> 1& !A7 & !A6 & A5.

0. 1perators
/(ere are four asic t*pes of operators> lo&ical, arit(metic, relational and assi&nment..

a. Lo ical 1perators
/(e ta le elo6 &i"es t(e lo&ical operators. /(e* are performed it * it. -it( t(e PAL/E)NA/I;E directi"e, one can use t(e alternati"e set of operators as indicated in t(e ta le. 1perator 2default3 Description N'/ (ones complement) AND ') =')> e%clusi"e or =N')> e%clusi"e nor Alternate operator

! & # $ !$

/ * + :+: :*:

$. Arit!metic operators
/(e ta le elo6 &i"es t(e arit(metic operators. Note t(at t(e last four operators are not allo6ed 6it( sets. /(e minus si&n can (a"e different meanin&s> used et6een t6o operands it indicates su traction (or addin& t(e t6os complement), 6(ile used 6it( one operator it indicates t(e t6os complement. 1perator . . Q M : T UU VV E/ample .D1 11.12 AQB AMB A:B ATB AUUB AVVB Description /6os complement (ne&ation) $u traction Addition 5ultiplication Ansi&ned inte&er di"ision 5odulus> remainder of A:B $(ift A left * B its $(ift B ri&(t * B its

The following operators are not used with sets:

c. ,elational operators
/(ese operators produce a Boolean "alue of /rue (.1) or 7alse (3). /(e lo&ical true "alue of .1 in t6os complement is represented * all ones (i.e.all bits will be ones> e%. for a 1# it 6ord all its are one> .1 is represented * 1111 1111 1111 1111). 1perator GG IG U UG V VG E/ample Description

AGGB or 3GG! (false) E,ual AIGB or 3 IG ! (true) Not e,ual AUB or 3 U ! (true) AVB or .1 V ! (true) AVGB or I3 VG ! (true) Less t(an <reater t(an <reater t(an or e,ual AUGB or 3 UG ! (true) Less t(an or e,ual

Relational operators are unsigned. Be careful> I3 is t(e one complement of 3 or 11111111 (+ its data) 6(ic( is 2!! in unsi&ned inar*. /(us I3 V 2 is true. /(e e%pression .1V! is true for t(e same reason. A relational e%pression can e used 6(ene"er a num er can e used. /(e .1 or 3 6ill e su stituted dependin& on t(e lo&ical result. As an e%ample >

A G B IW (1 GG D)D A 6ill e e,ual to B if 1 is e,ual to D (true or 11111...D B =N') 1 e,uals B), ot(er6ise, A 6ill e e,ual to t(e complement of B (if 1 is not e,ual to B (false or 3)).

d. Assi nment operators


/(ese operators are used in e,uations to assi&n t(e "alue of an e%pression to output si&nals. /(ere are t6o t*pes of assi&nment operators> com inational and re&istered. In a com inational operator t(e assi&nment occurs immediatel* 6it(out an* dela*. /(e re&istered assi&nment occurs at t(e ne%t cloc8 pulse associated 6it( t(e output. As an e%ample, one can define a flip.flop 6it( t(e follo6in& statements> Q1 pin istype 'reg'; X1 >G DD /(e first statement defines t(e X1 flip.flop * usin& t(e Fre&F as ist*pe (re&istered output). /(e second statement tells t(at t(e output of t(e flip.flop 6ill ta8e t(e "alue of t(e D input at t(e ne%t cloc8 transition. 1perator G >G Description 1om inational assi&nment )e&istered assi&nment

e. 1perator priority
/(e priorit* of eac( operator is &i"en in t(e follo6in& ta le, 6it( priorit* 1 t(e (i&(est and 4 t(e lo6est. 'perators 6it( t(e same priorit* are performed from left to ri&(t. Priority 1 1 2 2 2 2 2 2 3 3 3 1perator . I H UU VV M : T Q . J Description Ne&ation (t6os complement) N'/ AND s(ift left s(ift ri&(t multipl* unsi&ned di"ision modulus add su tract ')

3 3 4 4 4 4 4 4

W IW GG IG U UG V VG

=') =N') e,ual not e,ual less t(en less t(en or e,ual &reater t(an &reater t(an or e,ual

4. Lo ic description
A lo&ic desi&n can e descri ed in t(e follo6in& 6a*. E,uations /rut( /a le $tate Description

a. E5uations
Ase t(e 8e*6ord equations to e&in t(e lo&ic descriptions. E,uations specif* lo&ic e%pressions usin& t(e operators descri ed a o"e, or E-(en./(en.ElseE statement.

/(e E-(en./(en.ElseE statement is used in e,uations to descri e a lo&ic function. (Note> EIf ./(en.ElseE is used in t(e $tate.dia&ram section to descri e state pro&ression). /(e format of t(e E-(en./(en.ElseE statement is as follo6s> WHEN condition THEN element=expression; EL$E e,uationD or -9EN condition /9EN e,uationD E%amples of e,uations> SUM = (A & !B) # (!A & B) ; A0 := EN & !D1 & D3 & !D7; -9EN (A GG B) /9EN D10out G A1D ELSE WHEN (A == C) THEN D1_out = A0; WHEN (A>B) THEN { X1 :=D1; X2 :=D2; } 'ne can use t(e races Y Z to &roup sections to&et(er in loc8s. /(e te%t in a loc8 can e on one line or span man* lines. Bloc8s are used in e,uations, state dia&rams and directi"es.

$. +rut! +a$les
/(e 8e*6ord is truth-table and t(e s*nta% is TRUTH_TABLE ( in_ids -> out_ids )

inputs .V outputs D or TRUTH_TABLE ( in_ids :> reg_ids ) inputs >V re&0outs D or TRUTH_TABLE ( in0ids >V re&0ids .V out0ids ) inputs >V re&0outs .V outputs D in 6(ic( E.VE is for com inational output and E>VE for re&istered output. /(e first line of a trut( ta le ( et6een parent(eses) defines t(e inputs and t(e output si&nals. /(e follo6in& lines &i"es t(e "alues of t(e inputs and outputs. Eac( line must end 6it( a semicolon. /(e inputs and outputs can e sin&le si&nals or sets. -(en sets are used as inputs or outputs, use t(e normal set notation, i.e. si&nals surrounded * s,uare rac8ets and separated * commans. A donFt care is represented * a E.=.E. E%ample 1> (alf adder
TRUTH_TABLE ( [ [ [ [ [ A, 0, 0 0, 1 1, 0 1, 1 B] -> [Sum, Carry_out] ) ] -> [0, 0 ] ; ] -> [1, 0 ] ; ] -> [1, 0 ] ; ] -> [1, 1 ] ;

9o6e"er, if one defines a set IN G BA,BCD and 'A/ G B$um, 1arr*0outCD t(e trut( ta le ecomes simpler>
TRUTH_TABLE (IN -> OUT )

0 1 2 3

-> -> -> ->

0; 2; 2; 3;

E%ample 2> An e%cluse ') 6it( t6o intputs and one ena le (EN). /(is e%ample illustrates t(e use of donFt cares (.=.)
TRUTH_TABLE ([EN, A, B] -> OUT ) [ 0, .X.,.X.] -> .X. ; [ 1, 0 , 0 ] -> 0 ; [ 1, 0 , 1 ] -> 1 ; [ 1, 1 , 0 ] -> 1 ; [ 1, 1 , 1 ] -> 0 ;

E%ample 3> (see E%ample in ). ?at@, section N.2.1 and ta le N.14) /rut( ta les can also e used to define se,uential mac(ines. Lets implement a t(ree. it up counter 6(ic( counts from 333, 331, to 111 and ac8 to 333. Lets call XA, XB and X1 t(e outputs of t(e flip.flops. In addition, 6e 6ill &enerate an output 'A/ 6(ene"er t(e counter reac(es t(e state 111. -e 6ill also reset t(e counter to t(e state 333 6(en t(e reset si&nal is (i&(.
MODULE CNT3; CLOCK pin; " input signal RESET . pin; " input signal OUT pin istype 'com'; " output signal (combinational) QC,QB,QA pin istype 'reg'; " output signal (registered) [QC,QB,QA].CLK = CLOCK; "FF clocked on the CLOCK input [QC,QB,QA].AR = RESET; "asynchronous reset by RESET TRUTH_TABLE ) [QC, QB, QA] :> [QC,QB,QA] -> OUT)

[ [ [ [ [ [ [ [ END CNT3;

0 0 0 0 1 1 1 1

0 0 1 1 0 0 1 1

0 1 0 1 0 1 0 1

] ] ] ] ] ] ] ]

:> :> :> :> :> :> :> :>

[ [ [ [ [ [ [ [

0 0 0 1 1 1 1 0

0 1 1 0 0 1 1 0

1 0 1 0 1 0 1 0

] ] ] ] ] ] ] ]

-> -> -> -> -> -> -> ->

0; 0; 0; 0; 0; 0; 0; 1;

7or t(e use of .D'/ e%tensions (.1L? and .A)) see section Nd.

c. %tate Description
/(e $tate0dia&ram section contains t(e state description for t(e lo&ic desi&n. /(is section uses t(e $tate0dia&ram s*nta% and t(e EIf./(en.ElseE, E<otoE, E1aseE and E-it(E statements. Asuall* one declares s*m olic state names in t(e Declaration section, 6(ic( ma8es readin& t(e pro&ram often easier. State declaration (in t(e declaration section) s*nta%> state_id [, state_id ...] STATE ; As an e%ample> SREG = [Q1, Q2]; associates t(e state name $)E< 6it( t(e state defined * X1 and X2. /(e synta/ for State_diagram is as follo6s> State_diagram state_reg $/A/E state_ alue > Be,uationDC Be,uationDC

: : trans0stmt D ... /(e 8e*6ord state_diagram indicates t(e e&innin& of a state mac(ine description. /(e $/A/E 8e*6ord and follo6in& statements descri e one state of t(e state dia&ram and includes a state "alue or s*m olic state name, state transition statement and an optional output e,uation. In t(e a o"e s*nta%, state_reg> is an identifier t(at defines t(e si&nals t(at determine t(e state of t(e mac(ine. /(is can e a s*m olic state re&ister t(at (as een declared earlier in t(e declaration section. state_value> can e an e%pression, a "alue or a s*m olic state name of t(e current stateD equation > an e,uation t(at defines t(e state mac(ine outputs trans_stmt> t(e EIf./(en.ElseE, 1A$E or <'/' statements to defines t(e ne%t state, follo6ed 6it( optional -I/9 transition e,uations. If-Then-Else statement> /(is statement is used in t(e state0dia&ram section to descri e t(e ne%t state and to specif* mutuall* e%clusi"e transition conditions. $*nta%: IF expression THEN state_exp BEL$E state0e%pC D

In 6(ic( state.e%p can e a lo&ic e%pression or a s*m olic state name. Note t(at t(e EI7./(en.ElseE statement can onl* e used in t(e state0dia&ram section (use t(e E-(en.If./(enE to descri e lo&ic functionsE. /(e EL$E clause is optional. /(e I7./(en.Else statements can e ne%ted 6it( Goto, Case and With statements. E%ample (after ). ?at@)> in t(e declaration section 6e define first t(e state re&isters> SREG = [Q1, Q0]; Edefinition of state re&isters S0 = [0, 0]; S1 = [1, 1]; state0dia&ram $)E< state $3> 'A/1 G 1D if A then S1 else S0; state S1: OUT2 =1; if A then S0 else S1; EIf./(en.ElseE statements can e nested as in t(e follo6in& e%ample (after -a8erl*). -e assume t(at one (as defined t(e re&isters and states in t(e declaration section. state_diagram MAK state INI/> if )E$E/ t(en INI/ else L''?D

state L''?> if )E$/ t(an INI/ else if (X == LASTX) then OK else LOOK; state OK: if RESET than INIT else if Y then OK else if (X == LASTX) then OK else LOOK; state OK: goto INIT; EwithE statement> $*nta%> trans_stmt state_exp WITH equation [equation ] ... ; in 6(ic( trans0stmt can e EIf.t(en.elseE, F<otoE or a E1aseE statement. state_exp> is t(e ne%t state, and eq atio! is an e,uation for t(e mac(ine outputs. /(is statement can e used 6it( t(e EIf./(en.ElseE, E<otoE or E1aseE statements in place of a simple state e%pression. /(e E-it(E statement allo6s t(e output e,uations to e 6ritten in terms of transitions. E%ample 1> i" X#$==1 the! S1 %ith &=1 e'se S2; In t(e a o"e e%ample, t(e output [ 6ill e asserted as soon as t(e e%pression after t(e if statement e"aluates to a lo&ic 1 (or /)AE). /(e e%pression after t(e E-it(E 8e*6ord can e an e,uation t(at 6ill e e"aluated as soon as t(e if condition is true as in e%ample 2>

E%ample 2> i" X()$ the! S3 %ith &=X#$ e'se S2 %ith &=$; /(e E-it(E statement is also useful to descri e output e(a"ior of re&istered outputs, since re&istered outputs 6ould la& * one cloc8 c*cle. It allo6s one also for instance to specif* t(at a re&istered output s(ould (a"e a specific "alue after a particular transition. As an e%ample B1C, E%ample 3B1C> state $1> if RST then S2 with { OUT1 := 1; Error-Adrs := ADDRESS; } else if (ADDRESS <= ^hC101) then S4 else S1; Notice t(at one can use curl* races to control a &roup of outputs and e,uations after t(e -it( 8e*6ord as in t(e e%ample a o"e. E%ample 3> state S1: if (A & B) then S2 with TK = 1 else S0 with TK = 0 ; Lou (a"e to e a6are of t(e timin& 6(en usin& t(e E-it( E statement 6it( com inational or as*nc(ronous outputs (as in a 5eal* mac(ine). A 5eal* mac(ine c(an&es its outputs as soon as t(e input c(an&es. /(is ma* cause t(e output to c(an&e too ,uic8l* resultin& in &litc(es. /(e outputs of a 5eal* mac(ine 6ill e "alid at t(e end of a state time (i.e. Kust efore t(e cloc8 transition). In t(is respect a

5oore output (6it( s*n(ronous outputs) is less prone to timin& errors. An e%ample of a 5eal* mac(ine and a 5oore mac(ine is a"aila le. Case statement $*nta%> CASE expression : state_exp; B e%pression > state0e%pD C > END1A$E D e%pression is an* "alid ABEL e%pression and state0e%p is an e%pression t(at indicates t(e ne%t state (optionall* follo6ed * -I/9 statement). E%ample> State S0: case ( A == 0) : S1; ( A == 1) : S0; endcase; /(e case statement is used to list a se,uence of mutuall*.e%clusi"e transition conditions and correspondin& ne%t states. /(e 1A$E statement conditions must e mutuall* e%clusi"e (no t6o transition conditions can e true at t(e same time) or t(e resultin& ne%t state is unpredicta le.

d. Dot e/tensions

'ne can use dot e%tensions to more precisel* descri e t(e e(a"ior of t(e circuit. /(e si&nal e%tensions are "er* (and* and pro"ide a means to refer specificall* to internal si&nals and nodes associated 6it( a primar* si&nal. /(e s*nta% is signal_name.ext $ome of t(e dot e%tensions are &i"en in t(e follo6in& ta le. E%tensions are not case sensiti"e. $ome dot e%tensions are &eneral purpose (also called arc(itecture independent or pin.to.pin) and can used 6it( a "ariet* of de"ice arc(itectures. 't(er dot e%tensions are used for specific classes of de"ice arc(itectures and are called arc(itecture.dependent or detailed dot e%tensions. In &eneral, *ou can use eit(er dot e%tensions. Dot e/tension .A1L) .A$E/ .1L? .1L) .1'5 .7< Description As*nc(ronous re&ister reset As*nc(ronous re&ister preset 1loc8 input to an ed&e.tri&&ered flip.flop $*nc(ronous re&ister reset 1omin ational feed ac8 from flip.flop data input )e&ister feed ac8

Arc!itecture independent or pin-to-pin e/tensions

.'E .4IN .$E/ .D .\ .? .$ .) ./ .X .4) .)E .A4 .A) .$4 .$)

'utput ena le 4in feed ac8 $*nc(ronous re&ister preset Data input to a D 7lip flop \ input to a \? flip.flop ? input to a \? flip.flop $ input to a $) flip.flop ) input to a $) flip.flop / input to a / flip.flop )e&ister feed ac8 )e&ister preset )e&ister reset As*nc(ronous re&ister preset As*nc(ronous re&ister reset $*nc(ronous re&ister preset $*nc(ronous re&ister reset

De)ice %pecific e/tensions 2arc!itecture dependent3

/(e fi&ure elo6 illustrates some of t(e e%tensions.

7i&ure 1> Illustration of D'/ e%tensions for> (a) an arc(itecture independent (pin.to.pin) and ( ) ar(itecture dependent D.t*pe (or /.t*pe) 7lip 7lop Arc(itecture E%ample 1> [S6..S0].OE = ACTIVE; 6(ic( accesses t(e tri state control si&nal of t(e output uffers of t(e si&nals $#..$3. -(en A1/I;E is (i&(, t(e si&nals 6ill e ena led, ot(er6ise a (i&( [ output is &enerated. E%ample 2>

Q.AR = reset; B[.ar, X.arC G resetD 6(ic( resets to output of t(e re&isters (flip flops) to @ero 6(en reset is (i&(.

6. +est )ectors
/est "ectors are optional and pro"ide a means to "erif* t(e correct operation of a state mac(ine. /(e "ectors specif* t(e e%pected lo&ical operation of a lo&ic de"ice * e%plicitl* &i"in& t(e outputs as a function of t(e inputs. $*nta%> Test_vectors [note] (input B, input C.. .V output B, output C .. ) Bin"alues .V out"alues D C > > E%ample> Test_vectors ( BA, BC .V B$um, 1arr*C ) B 3, 3 C .V B3, 3CD B 3, 1 C .V B1, 3CD

B 1, 3 C .V B1, 3CD B 1, 1 C .V B1, 1CD 'ne can also specif* t(e "alues for t(e set 6it( numeric constants as s(o6n elo6. Test_vectors ( BA, BC .V B$um, 1arr*C ) 0 -> 0; 1 -> 2; 2 -> 2; 3 -> 3; DonFt cares (.=.), cloc8 inputs (.1.) as 6ell as s*m olic constants are allo6ed, as s(o6n in t(e follo6in& e%ample. test_vectors ( B1L?, )E$E/, A, B C .V B L3, L1, L3C ) [.X., 1, .X.,.X.]->[ S0, 0, 0]; [.C., 0, 0, 1 ] -> [ S0, 0, 0]; [.C., 1, 1, 0 ] -> [ S0, 0, 1];

78. Property %tatements

ABEL allo6s to &i"e de"ice specific statements usin& t(e propert* statement. /(is statement 6ill e passed to t(e E7itterE pro&ram durin& compilation. 7or t(e 14LD de"ices t(ese properties include $le6 rates Lo&ic optimi@ations Lo&ic placement 4o6er settin&s 4reload "alues

77. &iscellaneous
a. Acti)e-lo9 declarations
Acti"e lo6 si&nals are defined 6it( a EIE operator, as s(o6n elo6, !OUT pin istype 'com' ; -(en t(is si&nal is used in a su se,uent desi&n description, it 6ill e automaticall* complemented. As an e%ample consider t(e follo6in& description, module EXAMPLE A, B pin D I'A/ pin ist*pe FcomFD e,uations 'A/ G A H IB J IA H B D end

In t(is e%ample, t(e si&nal 'A/ is an =') of A and B, i.e. 'A/ 6ill e E1E (9i&(, or 'N) 6(en onl* one of t(e inputs is E1E, ot(er6ise 'A/ is E3E. 9o6e"er, t(e output pin is defined as I'A/ , i.e. as an acti"e.lo6 si&nal, 6(ic( means t(at t(e pin 6ill &o lo6 E3E (Acti"e.lo6 or 'N) 6(en onl* one of t(e t6o inputs are E1E. 'ne could (a"e o tained t(e same result * in"ertin& t(e si&nal in t(e e,uations and declarin& t(e pin to e 'A/, as is s(o6n in t(e follo6in& e%ample. /(is is called explicit pin!to!pin acti e!low ( ecause one uses acti"e.lo6 si&nals in t(e e,uations). module EXAMPLE A, B pin D 'A/ pin ist*pe FcomFD e,uations I'A/ G A H IB J IA H B D end Acti"e lo6 can e specified for a set as 6ell. As an e%ample lets define t(e sets A,B and 1. A = [A2,A1,A0]; "set declaration B = [B2,B1.B0]; "set declaration X = [X2,X1.X0]; "set declaration I= G A H IB J IA H BD /(e last e,uation is e,ui"alent to 6ritin& I=3 G A0 & !B0 # !A0 & B0; I=1 G A1 & !B1 # !A1 & B1; I=2 G A2 & !B2 # !A2 & B2;

,eferences

1. =ilin%.ABEL Desi&n $oft6are )eference 5anual, Data I:' 1orp., 1223. 2. /(e I$4 Application <uide and 14LD Data Boo8, Application Note =A443N!, 122N, =ilin%, $an \ose, 1A, 122N. 3. D. ;an den Bout, E=ilin% 74<A $tudent 5anualE, 4rentice 9all, En&le6oods 1liff, N\, 122N. 4. ). ?at@, E1ontemporar* Lo&ic Desi&n,E BenKamin:1ummin&s 4u l. 1omp., )ed6ood 1it*, 1A, 122!. !. \. -a8erl*, EDi&ital Desi&n,E 4rentice 9all, En&le6oods 1liff, N\, 1223. #. =ilin% 7oundation $eries, 'n.line documentation, =ilin%, $an \ose, 1A.

Ac:no9led ement
/(e support of 5r. \ason 7einsmit( and t(e Xilinx1orporation is ac8no6led&ed for pro"idin& t(e =ILIN= 7oundation 51(/5) $oft6are and 74<A Demo oards for educational purposes.

Bac8 to ABEL 4rimer 1ontents ] /o to 1ommon 5ista8es list ] <o to t(e EE Ander&raduate La 9omepa&e ] <o to =ilin% La /utorial 9omepa&e ] <o to t(e 7oundation /utorial pa&e ] <o to EE233 or EE233 La 9omepa&e ] .

1reated * \. ;an der $pie&el, UKanPee.upenn.eduV $ept. 2#, 122ND Apdated Au&ust 13, 1222

Вам также может понравиться