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

Chapter Thi

330
process rca,Droc is triggered when a rising edge occurs on input ctk.
a is copiedto output q'
When thb procese is triggered, input

Regarray
bheset of regislers wilhin the cPU
The roslrray entity is used to model
valucs during instruction processing.
that are used to slore intermediale
lo during the execuLionof in'
nt;t; .Lgi"t rc are read from and rvritten
a RAM of eight 16-bit rvords.
Ttle sef of registers is,modeled_as
f.
"*liorr"r.
The svmbol for the r.sarrav entitylFshor@
+i"fi;Gfu;settrrpurEcrffihe locationbobe
rlt:
and put a rising edge on
written, input data with the data to be written'
s€t input aet to the location
i.rp,rt .it. io re"d a rocationfrom resarrav,
data is output on port q'
to be read and set input on to a'l'; the
The registe, is modeledas two separateprocessesas shown in
"*"y
the following:

I, llbrar:'fEEEl
l.
uac IEEC.r!d-1oglc-116{'4111
t. all I
{I utc IEE!. rt4::.ogtc-urllgroad'
l) urc rork.cpu-llb'allI
ll
r,
rt'
tl cnultY rogarr:ry ls
Porc( d'atr r ln blt'161
ll
|
*{ gol r Ln t-rcgl
6a r ln atsd-loglct
4l
c1k r ln ctdl-loglcl
' qtoubblbl6)'
crld r.gltaty,

qE !E!T
Flgure l3-8
EET IEEI
I ."*
RegArraySymbol.

1..
"
DescriPtion
CPU: SYnthesis
of regarrdit
ar c hlc e' c t u r o rcl v!
o f b"^-
ltr6;
"'".;:";_;;:i"::,:""1:,;:,,
\
'\. I
\:
lq. ;
' "oot r l. """( c l k , g s l - ) . -
t^It"tf"lr" . F 'r n :
\, ramdaEa ! E-rar';
i
ot 1?c 1k , e v 6 n u 't ' . t n u t
and clk '
(ae1) ) : = daua;
uo.^,
ra:odatsat"o"l-lnttger
) a f t '6 r I ns'
r: : l* g : : l i " <o r a : n d a t a ( c o n v - l n L e s o r ( s e l )

6. 6nd P r o c e s s i
a. -
(ori' esmp-data )
,S
Procoee
begln e n
r r1t then
cerg-data afE€r I DBi
q <=
be
1 n6!
0n "t T . - *z '7 'Z z ? 'z 'z z z z z z \ 'Z z z i sl 'f E o r
0n end l fl
end' I) r oc e66'

in
ttre.garr H ::x';*;1"J
moders
il ;;; r'oess .:*:i ii:' :'1,:
"-'1"-
sff ::;:ffi*::i."ffi:h'"fi:;;'J,1ff
uv
1'Iffi'l*:t*:1i
aeti' 'ld11:i,*1.,*-;;
input t. pa$the:*: ?
;fi;;:v*rti,llil\Tf
i#;;;"i."t"a
the secondp:""11^r"ri"ut..
-8?'and :T:[,#:*.#:*:::T,S]H ''' cannotbe
i"* vrror' . "?1111':":H:'"iJ;".*i teeal-- uuthssothera1m':"'' : :
'
ttH;'btsharingvariablesbetweenprocL----- --
;*:::;:r$::ssis-useali:::i,:::;Iil.'ffi ;:l*S;:"#..
j,i-"
i,, "' :n""?:.; j:;l* ;" o *" l?lory data' -''
nal ccqr-datsa rs pasc€u ru::::i!lT;;;
: ;": :,"i,," t"ro_dara
*if
:.
the oa srg i8 'lii
thevalue'i:;;";i
^f 1i'Y:: "lt" .''o
n"o."r,'*inufs
Thesecond ":-'.
orherwise,it putsil";"';; r.er:,'ar +" *t5;n'3 *::::ffi:
i,ir t."";a;::1[.Ji,$il:]ilH*
tYoFe
il ;,rt"q*technologv
t" and
A smart a#tt * tit target
entitv canbettni*:''liiJl;RAM
provide thepropermapping lo'l,TffiT; *:*;t*rT,'::q:tJ$ ue'
thatincruoei-il;:
i;;;;pCd technolocv ,"0'"'a RAlvtdevice'
map
;l;'i' toolcould. se\ -r
u.r'Y'.
the'rcc'ar:'1":::'.;;
i nlo'n"n'andgates
"" creates
;i;
ffi ""tTn"I;:ifii:iltrffiil:'
taswr rr'Prv'^'-'---'
a smaller and

.f
3 32

shifr

f*jl:ili'*';"^,$i:lll,iiiiiil*,ffr"1'f"
ahifr enrirynasa 16-bir ,:,il,r:ffi
fr
inpurbus, ro:tlr.;;;;ff:::J;:::r"ill:
"
npo,.nti*^i1""''
:)::r:i::i';riln';,;l;t''r'iii rrris;' .i.;';; b1.'re
'I'he typesof shift operations
that ian bc pcrformedby the ghlfr
bibyare shorvn,inFigures1J-10 en-
and 13-11,
As can be seenby the figures,tt"ro
rr,ii. unritycan perform a
sliifr rig't, rotate reft,and rotate shift left,
right op*ution. on" op".utti.,
trol sirorvnbv the figuresis a pass that is
tfi.ougi op.."ti* in ;;;;il',
inpurs
""'n" un1.t'
H1il: ffi::i JiJ:::.1',,'.11 "nguanouo
*'i"gi"i n tirv
".,
lib r ary IE E E ,
u 6 e IE E E . etd_1ogl c_116{.a1l 1
u g a w ork.cpu_l l b.aLl l

6ne 1 t f , . g h l f C 1 g
port(a:Inblt16l
. ee.I r ln t_ablftr
y r out, blr,16),
end s h i f t l

' ar oh L t e c t , u r e rbl of ohl.ft la


begln
ah f t p r o c : proc6r!B (a, es1)
. bcgla
caga gel le
when ghf,tpaae r>
y <r a a f ! . r 1 Ds,

when ahl
. y <F a ( 1->{ d , o v a t o 0 ) & . : {, . attcr 1 nal
w hE n B hr g>

M ENT &E FiqI


Flgure t 3-9
ShiftSymbol.

".i6da{l$ffi1
s;'. 1i

-.'...'.
! t.,, :.f r t : . ii, . r , : \ . t ! . . ...
CPU: SynthesisDescri$tion 333
l&l E tilRt utel
Flgur e l3- t O
5hift Operations.
e

is Shift Left
^A LS
Lis vJ

uts
itv

tz-i ..)
1\:-i , 1), t1l l t l D ' 7 6 cc r
o lo lo lo lo 0 0 0 0 o lo lr oll 0 t

:N
|
\\\

\\\
0l 0l 0l 0l 0 0 U 0 0 01010 1t0 I 0

Shift Rigbt

<o '0' & a ( 15 do'rrD to l ) attcr 1 al ,

vrbon rotl c>


<o a ( l { dosnto o) & a(15) a!!.r 1 D .,

vrhea l Otr s>


t <e a(0) & a(15 do',mto 1) after 1 "n|,

cad cagg,
snd D rocesg,
cnd rtl r

The etrftpaga mode allorvsthe shifter to pass the input data to lhe o
put without an)' shift operations.This mode is quite common because
very fe\v
of ttr" ALQ operabions florv through.the atrllc entity, and
strrictions are actually performing a shift operation' ;.
-.,,..;*.,.,.-.".,- ,qr d::;&"SMl&*6!-

Chapter
396
E@l Btrr @ trEEl
Flgur e l7' t
High Dens ir yDes i9n

ri
;l
,{
rl
t.

;l

'i

Post LaYoutTiming
Simulation

TheVITAL process in Figure1?'2'


1' shc'''{n
generate.two VlTALcomplisnt simulatr
The placeand route tools
that contsinsthe interconnectlor
input files.The first i;; C;;;ttlist e
the design'The secondis a timing
of all of the entities*ta it "ttal into tl
to input post'route'tlming
curate SDF back'a""ti"'it" nfeused do the gimulati
vlrAl, eimulation.;;;;; i; ; try9- iL?"t needed
proceso. The third ;il;i';h; vriel tt3.t"rythat deecribegall of t
thedesign'In the nextfew s
behavlorof theentitiJ. t"ta to implement
detail'
tione, we examine each of thesein more

': ::-'i

eruffi*;
:{''' ' '
:Vital Simulabion 397
xtLiit tfjls: lil4'tdl !i'ii!?
Flgure 17'2
WIAL DAIAFIOW,

VF IDL
Nctli.r t

VITAL LibrarY
deve usethere were no gta,n'
One of the reasons VITAL rvas
dard me method of'
%ndard
timing,therewas als
tffi i "iu'"'"
ff.'.Ht.,"J *i" tion'wIDL.was"1'" tl"^1:'
:::,i, :iuil;
optimized for
ffi;:"r}ffiH: ffi,.,lo*p"'.d rogarelevelsimulators
ulatr t"F"[ii,i'J*Hr::';
vrrAl v,.as neargarelevelsim'
roauorv
creared
rctiot features
accuralemodeis'Someof the
hge ulation performancev;ith riming
s:
lto tl availabll with \TITAL are as f6llsr'
ulati
oft i ffiJ'"'
;J'H:';T'iil'"T'i"
bwe
occurrence of a condition'

l
. -' ***
-,----, -*

fu.'t"
3 98
a t oorr- Checksincl,de setupc'ecke,
PHg Z.l:Fr4+,!rerls,+o hold
checks,
periodchecks,andaccurare
liijlrl;ll,rewidrh slitclr
N wy t" tp"tifuf""
'ygyt -Functionaritycanbespecifred
with truth tables,statetabies,
boolean
pnml'lves,
d e s c ri pti on.
or a behavioral
i
Al l o f these featul es gi ve the desi gner
the abi ri ty co create ti ming
a c c u ra te IIP GA or A S IC l i brari e
s,

ffiffi eaffi vrrAr, sirnulation pnocess


Overview
**Fi+*qg#s.
:n:.
tu:|:lrptur. T$,J/iT4!_cutglur,onupurrrug rt
of uru nt"r. fne
is the \IFIDL nafliqf- fhio io . r,
first
9-le
nals,,and component-instanGti;rsrh;dnnect
alr of the comDonsr I
wr ro.formrhe,functionality
of the deeign.
i. '"rauvtl.ir,"*jiT",:
titt'_nt" yTe:t, -' d;fiil:
]
l
nent connectivifJ,'in the dptpho*
file is sn SDF (StandsrdDelayFormat)file that
Ih_e_eecond
tinfinaTortfdaa E
containe SDF
statements that describethedelaysand tiriring I
checksfor the inetance.This
irr-forrnationis used during simurationto model r{
the timing uerrauii".
To build the vITAr, sinulation database,the
eimulatorneed,gto have
vITAr library that-containscomponents for the target technorogyand r?
i I
the vrrDl netlist and sDF timing firufror the place L:
and route toole.The u*
eimulator uses the netliet to inslantiate the proper
instancesfrom the
virAl library in the internar darabase ilf"p
;iJrg to the
instances rvith the sDF file. Each of the instances
"na'tt.T "pply fl:e
containsa number of
generics that receivethe timing information, t-
The timing data is used 1: :

within the modelto providethe correctbehavior igc.


of the underlyingdevice.

W ffitr'ffi V{TAL Implementation


y-rTAr descriptionsfoiiow a standardsryreand make use of
/'unc'ronsand proceduresfrom trvo standard
wrAL packages,The VITAL Timing
@,-

*l
399
CPU:Vital Simulation
ures
geconrainsproced
packa ""uj:1:: :TJ:lril'ilT: :'"tt
lJ"$i:Xff;
errorreportlng'
andtiming
i*irr""n;.ks, i* simulatorperformance.
",
"""1'.t*ogtt-t"l^T,1:':;:\]|o[.6"Jrl'J11r.,.iJ*iri'n""packageintothc
Most \4TAL-comPIrr
:i*rf :#:'lH';il"'T:;i:::r:l*ff
T,:""?::tt"J':',t;tl,
i rortiminsi*:1'::
onlY,Hht[H:i"T*xp:dT,]EtL::,t:
to";i;;;;;t'
i*",,,,,ses "7
i,";',ro;]l;J."."$*'#;"""#1:Ti"J"".:,:::t".'iltl
i:lnli*'gg":in'""'::ip:i'i*i::il1'"tL'";x
;i;^"'l;;"t o a""'lrtio-ns Y mavnotbebuill in'
^ljl',n,.n
constructs w
;";;";s use ueitavloral

VITAL Model
effiSffiFsffifi SimPle
howthewtALT''-'-lff
rounderstand t:'1i"o;ilil""ffiil:T';i""ili"T"Tffii
model examined''Ihe nigu'"rz-s'
il;i; gate
i-
rortbeAND " 'il#,;, * "lt-T":li"*if
-"*ri"-rr*or this devicenas
p ' m;;i"J;dwrAl,'
F
i-
D inl lnPutDelaY
Er'4{
e# E#t, r'rrig
' F igu re l 7 -3

--t
MTALAND Gate'
[.o

Io

of
ed
.o

OutPut DelaY
int2 -> Y
.a.t, 1s

rn0

F.
' p+, ll,,,:,,
Chapter Ssvefiteen.

from input loe


lrlt to output v and
pin-to-pin delays from input
!n2, &rd
to output v' the funcLionality of the
is the --irAl
V model that implements
Following
erroz device:
CEIJIJ A!T D 2 -----
----- : ;
1i6s6.ry IEEEI
:
uae IEEE'STD-LoGIC-116{'h1l;
all ;
i"". it"i' *r-nr'-rtrnlsg'
iii'"* :
uge
^1Y{!.}lo*.r."rr,'
al€- v t l' 9U '

declaratlon --
- - ont s lc y
AND2 16
entsltsY
generic ( B ool ean :r tfuel
: - Falae'
't-'19?::*1'
1*:::::::*i'
-a-arrElonqai
Dee
"lI.; r' '*"r-- t
stnrHo
ro:s*:al'qii' D€fProf)D€layo1'
ire"ro"laytYec9l i Dc!Pro!,Dcla1|'o1t
:*ffi-; i vriarocr'v*rP'01 1il' DolPronDclelolf
:T- *; r vlcal.D!1a141?c0t t
elPoJ:: r' DatProttDclrlol)
I vltaroela!'ttrirc0l

porc (
T t otlg
t t! s'rD-rpclc'
eatitvk Tasrt
iti
.,:i.

':jil ; . ,
l''""iH,i' #.*-'HtflTt^L"''
:
l ... : -.---.
'i::
) Ys ' ' " o 4 ' n fO2
!B:
{rl

.iir
ii,
;"*llki*1ffi*'Y^"1u'n* r arcb'ltcogrrrc
lr

ii TRI'E'
1 r r u 'l
Eroltlr'
::::1*
lN2-lp.o : 313:ffi1! tE \u"
SIONAL

bcgln

-"'--:-
wl"raDo).aY : blocx
b cg i n , { n6 . g!r€'-INl) I
l rcD or"V trl-.,r
'l -i '-I' ctgd-rN 2) I
vical fi
t l nz-'v-'
vlEa]-Wl reoal aY
a n d bl ockl
i\
t
li
-. BEIIAVIOR

vIT ALBotr aw l or
SECTION

: gtoc €as
(rNl-tpd, r'ne-IPd)

ii
ii
tt4.
,Ft ii"
,:Ij

I
I
-<
.-t

@',\-
a- ''----
')/l
-t
|t\
Eft ----/
' 1" ctt
la, 10
{ I n it , a r . s ' i/ . 1( )' . / l) t ' t t li \ I . 't ' t tt t it t
l) t ' l l r r t l l r ( llI o{ l.lccir lt:. ] * r. -
'\

AI] Ii L-l-l D I- I) t'itttt t'

Alllil, I)t'intct' Ctxtlcnls

. L lt t t t odt t c lt ot t
. 2. Bas ic s lluc t ur c o{ ' ; t t l r \ ll1: . 1.s o t r r c e l l l e
. i. p- - e- q. lat i{ ig16 ( nr odulc , pin, r t od c , c o r l s t i t l l l s )
. 4. ),lrrr_nbcrs
. -5 .Dir c c liv c s
. (r , Set s
o a. ltldgl-lltg o!-i!!c!5!!rrg it L('!
o b. Sqlpltq_rlttqrtr
6.Qpstalqr.r
o a. l, ogic al O pc r alor s
o b. A-n!hl_c_tis_.stt_c1_tl(_e!
r
o c. Retatiqnal_sp!-iajq[s
o d. A.rs:grute!1-spej4lslE
.o e. Qperatgr-prio-riV
8.LBeie-dssiBtier
o a.Eqg4rllllt
. Whea:Ib9n-Etr9-st4!e'nen!
o b.Ir:utlilabl_e
o c. S-B!,e-_Dq5_cI]p_!9x
I State-diagram
r lf-Then-Elsestatemertt
r 'With statement
r Case statenrent
o d.D_S!-Qxlenslelg
a 9. TeS! vectors
a 10. Device Specific (Propery
a I l. f,4r'sce[[aneore
o a. A-alr_yq: Lqrv_-d.ec larallqlS
a 1 2 . Ex a m p l e s
o MoO_r_e_ ttrt ite ,StllteI''lachirte
o Mgq.ly_Finjte Statef,tachjne
o Syttc-luOttB tc.St atc lrlirclt tttc
tLsM-c;tl)' [: i Lr,i
C.oqm-on!!_tslakss.
Refercnces
Acknorvledgernent

I Introduction
Ag-&galgl.gg.&g!-c-ggpqua.tion La4guagc)allowsyouto enterbghavior-likc of a lggiccircuit.AIJEL is
descriptions
an industry-standard hardwaredescription (HDL) thatwasdeveloped
languag_e by DataIiO Corporatlon for
' pgggltlmplJ.elogic{eyices(FLD).Thereareotherhardware description
languagessuchasVHDL andVerilog.A.QEL-
thanVHDI. whichis capable
is a simplerlan'!-triige systems
of-d.esE-ribing of largercomplexiry.
#r!Fi
4Epl"can-lerscdJodescribe.thebehaviorof a systemin a varietyof forms.includinglogic equations,
truth tg"bl.er-ed
The ABEL compilerallorvsdesigns
statediagramsusingC-like satements. to be simulatedandimplemented intoPLDs
subhTFPHf,i;CFtb;
anonPcns.

andsyntaxof ABEL.lt is notintended


Followingis a briefoverviewof someof thefeatures to bea completediscussion
primerwill getyousta(edwithwritingABELcode.In caseyouarefamiliarwithABEL,
of all its.fpatutes..ItUgApEL
thiswrite.up-qnserva'A;.a quickreferenceof thefQs! oft9ousedcommands.
Formoreadvanged please
features,
consu[t ariAf gUinaniiilnilbelitinx-on:lng documentati

h$,
*c*$:i*li
t.

t.

N
.. A ,rl. l. { { } ln ' (' t ^ f ilt '
ttl :lll /t ti
2. lllr sic st t'rtr {itt't'
c l c r r ': r t : r
i' ; t ' ' l{ lt c ll! lt l) ' : ] lt 't
r',rr AllL,l. s(r ur . c (ltl il"- r t t t

tc.d i tr c tl ( ) t c i l :'( : 5( :l l r ' ri '


( ll r i ,c r t. tl ttttl tti '- c tc ')
,1.\(rilllll;lllrl'i
f i'1rl0 ( l l r l 't l l I
,l i c el l l ;t:- s C tt:;i l i r l t
' ' r" t,\' 1 ' , ()l i l l , j .l ( - ;l \( ', l r r ti
lr t ' t r r ' " , , 1" { 1 \\\1 1l ' 1 :i l l t,1 ,1,. , tt"'t.
r lill( :r ) Lilll t} t :
l \)\\'( l l.il:'f

,,,t,,' . I r r r tt ' { r ii
,,.'l i ;'i ',,,1 'i
"
L , i r 'L
1, i1( . . , 1i ; lL, ' r

qgPro'l;te,rn'$o*c" \ lrbel'e"^r
r d'i!'e'y.at"'*
.r'l'eAuJ,e

frrble MN
f,i,:.'rccil-' ' i '':;r rlcviceType;i
:.1':"

a:t
sindrchrqfinnt
: I
$ ,''
ii1 atl*xdeclvdidttg
!.

{ l { tli- t;u n $

( . . - 1 7 ;;ir ":' ;

t[€sle Vad@^*T
. ,., /r )/ r
i. . il

l r \:itl t::tt
c . i' t t i "

E' \' a r n p le of a l ral l 'addcr:


' r ' 1 , , , , , . . r 1;1 1 r ,iL 'I, ) r .!iL .:c;:;' : i! a n

, '.1-

*r-J'*t*u'Y,'
madu.l,q, ,, , .,,t'., I
't it j' e' ' - ' iif r en c '''
' i' : ( ; : "' ir r ' : ,,
i
;;lotxY 'lt{4so3g' ;
d'cM{'G','lr
:;:. I
i l i rrl l { .i i :;
, ii : '
' rl $i l i r. '
t?i, ..
t:a1i.:
.yr1,,i i,
':l;., 'j.. i ::r ;:) ::
. ,1. 1 ' ';'

i,,, '
" tnPut PlYl*
At B',air'l'S' 5;

. '' o ' - ' t::' ir i:' J ' :l t' 5 ;


1t) q
t 1
rL'R i stype ' comt
$ Ul' :, Cit:- r :r r c' u i: P: ll

' e(lr:e''r''irJn6 l' ,

:&, i
r ,,"s U r{= (A r !B ) $ (fe a B ) '
"s ''- & Bi
&;
i4<.
"'l''
I
t';i,

. .:.
ir t, ) ,) ,

r lr clli r i( i r l l r 'r ( nl

\vlliclr is c - lr i\ , r l- r i t r

Hor i' e v e r,tl rerc l a ti o n aol p e ra to(==)


r gives Qdy_prrg_b1_!,so tirat the restof theequati on
eval uates
al sot o one bit , and r lt e
" 3" is tru n c a re dto ' 1" .. l ' h u s th e a b o vcequati oni s cqualto:

-afrpe'ators
'l'lrcrc or c ( bur bas ic t y pc s
of ol) c r at or s Iogi cal ,ari tl rrrrct
i c, rcl ati orraI
andassi gnrncnt..

a. Logical Opcrators

Thetablebelorvgivesthe loSicalopcrators.
Theyareperformcdbit by bit-wi'rlrthe@ALTERNATIVEdirective.one
canusethealtematiVesetof ooeratorsasindicated
in thctable.

O pera to r (d e fa u l t) D e s c ri n ti on Alternate operator


N O T (o n escompl enrent)
& AND
+

exclusive
lXn*OR: nor I

b. Ar ithnr clic,op erators

T he. t a b l eb e l o rvg i v e sti rea ri th n re tioc p erators.


N ote tharthe lastfour operators arenot allorvedwith sets.The minussisn
Canhaved i ffe rc n tn rc a n i n g su:s c db e tw eentrvo operands i t i ndi cates
subrracti on
(or addi ngthetw oscom plem ent ;*. hiie
us edwi th o n e o l )e ra toirt i n d i c a teth s e r w oscomptcnrcnr.

D cscri oti on
s compl enrent
(
ubtracti on

Thafollowing operalors are not used with sets:

r
;t
+ ulus:remainder
of A/3
*'> ShiftA left by B bits
a ShiftB rightby B bits

;.:siiri&biisdsdi+ l- -ra.rcr:t.i-1:t t:-'.il".'


"",1 \
,.,"4' \-" '/ \
,f. \
//Ilcl cxplir r lr t t t or tol' t lt e s t at c lllc llt s { ir llo r v . l : o r a r r r o r c<i c r ; r i l c d
r l i s c : r r s s i osrrr}ct l ) c f o l k l r v i u i s c c t i o n so r c c n si .l l t
..",,.){tL-tll)l- rrr.rtt'rl'wlrcrru.si.gArr;i. rvitrr,i,. i;l;;;;i'n;;;,,",;;;,;,,,;;,,1;;li* niii,,.wiz,ercr
:i fi
"'f tclllpla tc o l' t lr c bas ic s lf uc t ur e and ir t s c r tso r r r c rvrrich rvirrrii',c;
o f t h e k c y r v o r r i s .A l s o t l r e L a n g u a g eA s s i s t a n ri n t h c
provides on-lincirelp' Go to theTool-s A B E L c d i to r
-tr-nNcu,qcb nsstsrnNTnrenu.l'he Languagcrcrnprarcs
of tttostABELconrrrrand-s' givca
.:;:::I""" s'rrtax,
hicrarchl,,
crc,rvhilcrhcSl,nthc.sis
rcrnplarc
r:ivcs
cxanrptcs
of tvpical

3 . D ccl :rt-:lti ons

ttlicr ttrr:;ir ; r . l r r r r r lr r I it , r r r r t ir r r . :r,' r { ir


r r r , .r r, , , , ; , i ; , , : . , . , ; ; ; , ; , ', , ', ; , . . " : . ; ; , ; . , , r r ( . r r((,:r.(r:.

tr:rr()rr'(l l l -\ tlr , r r \ t'r r \Y( t.r r 'r r r :'l


, r r 11 1r 11,.1lr ,r l r r ir .r r r ,J,, r ,,J ( 1,) ,
'r r ( .r r ,r l r r r ,

,\'trittg: rs it s c r r L
crrclo'sct1.bv-.s.qg]9,911t19:;
Srrirrlis
arcusccrlirr'r'l'il.t.,
ot'l'toNSsrfrc,ucirs,
trr p tt't,rrrt<lcalr < i;,r;liffii.:j,.i:;x;i:l;i; i,,r(r

device; this declaration.is qnclassociates


Qntional :jgvtqqidg(rrr9r{r{4r;4g,rlie-pl9gglllBu-e-Lo8ggylglThc
3.u.trupnt-rnu*."'n.{ty^itrjlinxCADsystcmtocornpitethedesign,itis
Defternot to put the devicestatement
in thesourcefi'leto keett;u;'J"rig,, ;r,,i.!"ni*ilrii.
r," -
a""i*. whenyou crearea
C",-r!"'i. i"
ffiJJ,TffJ*J,i'J[,ld'+#tr9"?,",i:"#jg;"i**"4 p,o;"a
o'. M;;", window,i,i"e
dev ice _ i dd e v i c e ' re a l d e v i c e ,:

E x am p l e :MY _ D E C OD ER d e v i c e ,XC 4003E ,;


L

;'-''[lffi" a"1a.sqir;gsd"gurc
---'--:-:,i----:.--
((
pin: pjgjgg!3glislsjell&e'cpmPikt$d{'h.sv.rnbqlig-Eaqer-a&-associarcdyjth
piqs..Format:
thqcetigs-!,slr'at
l! J pin id pin tp i n * j Ii s ty p e ,attri butes,j
;
One can ipecifo more than one pin per
line:

[!]pin_id, pin_id,pin_idpin Ipin#,[pin#,[pin#]ll[istype'anributes,];

Example:

-IN1. IN2, .A1 pin 2. 3, 4;

O UT 1 pi n 9 i s ty p e . ' re g ,

E NA B LE p i n ;

! Chip_s e l e c t pin 1 2 i s ty p e ' com' ;

! S 0. . ! S 6 p i n i s ty p e tco m t;

effi:ct
rift rigltt

ll :i division
G':signea
-' N
rF

lll ( l

:i l 1(l

thenor equal

le

[ea
i

gic descriPtion
way'
describedin the followillg
A logic dcsign can be

r Equations
. Truth Table
r Statc DcscriPtion

.a. Eqnations onsusingrhespjeigl:


r ^^^'i ^ti nnc F hU Atl O ns Sp€ul r J r v 6''v - " r -
'
"
'Usethekqlrwordequati'onstobegintrrlleicdescriptions.Equationsspecifylogicexpresst,
,.. statement'
w.i describedabove,"' "*t:"-Gg;t: is usedIn Ine
ia, to a rogicfunction'(Note:"lf -Then-Else"
describe
starement is usedin_equations
The"when-Then_Erse, bt progression)'
iagrat' i
n"to"d-t'-t'
State-d ""t'o ""tt
siaiement is asfollotvs:
The formatof the"When-Then-Else"
r c : ';
f i- lt ii ele r n e l : =e v 'p r e s s
WHEN c ondit ior r

. - equat ion;
ELSE

THEN e q u a t l o '';
WH EN c o n d i ti ' o n

ExamPlesof equations:

SUM=(Ae lB) { (!A & B) ;


.A0 := EN & l D l & D 3 & \D'l;

= A 1i
Dl -out
IIHEN (A == B) THEN
= A 0;
= = C ) TH E N D l -out
EtSE HHSN (A XZ I
gHEN (A>B) ( X 1 ,= P 1; " = D 2;
THEN

i!',4' *Yh&61*iit ; *b*,t t:.;J!t1i,iils^^ r*+i


/"

E'tr-t."t-l-.
e-'-'F ry'4
Kr u LL \e-
ff.."*^
e)
c,.1^'k-.14 ,t-"k 1
Lt,rg-t-k =tA-}z\ *
-*tx"fltlh
4W ,\.A lf^--t4,.-,^J Ga d'\ *t1'-e"^"'e- ofi
t crF- L"- \ A,r ^ ;' ]t

Lo ctvv'.-s-t'\'^-€

LE
s R-Et'F-ESe N T'\K
S g \v exr ce oF (e-,ecnTsT<'\gogn:s r-R
BY AN En.-."",b.; q"t'+,L.' '
'l
TtroN q (AiPH '
liq e*.r1A,tJ€r'." ?r S)
.L
b,' )L Dr".^^, DX ELU
& l..-o
--
I

Irr;t
\r/
V = Vx n+br-
y* hr *^tlre
V'Vrert-thr tr /> V4 x- *['i

V " VDt"o+P"

V 'V* r e t P j

tw^htl"J) s1*^^,r.'tjTifl q"""tA


q*"+r^
sr/\,u-^*,-t*.,
o*"
*Y s-v\€-"ns&
h-{-
---qli..r.e
.pt- a. -\*Ln,..q .

g- {- 1n5Jtu <A,^.\ t4- ouct{^/-{- a.-k a..- \Lr^e- -

.,9'ry*r.- €-"^&c".Aa'-l \.s o'LI^,\.'.J \-h *.s-J,tn.$ve- top*t."-r.


ff*fl ^ |-b
qJ)
T-""1 5
T$J.16-^,s-\ T*, F-e-e.Jx^^g. o>.€- te-Lre-e-/h f-f.
t^.. L^"1, k-Q.^--o
K-*f,
rc Fi es-.q .i-..
, 12J )

A-<i4,.t..,-\J ,
L'

13= hx +hi t= pgltt D.f.*+l'

q * tsNAt_! H =- Dr1-++ E

,^"-.r...€-.f,)---5 Fr[x)= 6*F+H


[C"-
\dilrr

A = X trt ts " ? r ' ttF s -


b.7tt

G=b*A+C !-i'DfA+e

h l ( a = 6+et rl
" .z
[Q*t *"J".*l-)
-g1 )
*"^JJ J trv<if C.cu''"

"j AA*-\e
c)
-tt*',<'7-+"*
!*-u^-^^^<-
[3) *
r G
6*\-yrrrx-rtr,Orf-O
t'..o:^""- ** l"Ds
W*'t (6<j{ A,^t/*C-,!"^?
y

3€^,-<^4L
q L.
o>.rr '
g) *^*./- o.\,(- tt)
"I{'^^,b
[
^ ^^
t',"n'S-b{.).Al( iA 't-'oJtu.'e-
6) E Lo.^r \-"-

0 rG,
,a.^,1 e'r<:-*.'.f^Nt y'-|L
II 'il"V

4 F{ N c\}o N-ftL u d"lrrs


qrq6tlRn L u NITg"

p^^J.f*-*!- ^"^'J"q ) hry_v.^*


\L iJ"--tifo u-
M e*.r- $./.4-\- f
, tM t1'u n^^J,*ka
t"1_ t r- q"--r'.pb",r
I

r l-,
Fe],^1 8 ..
M\" EJ:-L/eA
-"
A-.^.*/-.J ^"J"o
Y ?'t
._ E € _ _ _
F::G_
--:-E

*. **-it!*^''A *"!Ptt
^r*rr-A-t*;b,

t-".JCr".\ -'>
Lr)
e gi,-?Ae- v,,ri,b o^-^ft*t W',e-_.,^,h".e-
^^f*",.'-^
" Co.l.,[o{ *'*it" L,*^\d A^0-. ["
tle^,t..leX'Ie,t
b.,{itisa^/) -

yYoot-L^-j
r ^ t[\tt \s .-"^At"l tE \--i-r
.}tt+viwt yn<x,t-a,'""uat'"t
c, E^.f
-'^^A^'{F-g F

; iG
ib fi
""11v(-/\^' \" .-*t&t"'"*-L

( .l+ t".rt-<i^t
\ e-r^h^sld
*N'
Mqd*",LL

Lir'i) ge-^i
w

& A^{ v'**uJ


b^,-.-&o tU*V -1. -'04{^,.x-,--so}- l^--"*
)'t^4atb {o
"t'
e,:,t-e*-.r.i'tx,l-n 5* },-J*-Ly-t. ;J"J-,
i\'^<A Ea
re .\-e-lF .e,^,.cezs a"^.d
\r"'re-\^ cx- -fe4-{'L1*
A*7,rl"l b*:l*,"^ Y
1i;

t-,*^.^,1"'.
^"r!^
=fvve--.R-TL
\f**l
A*-t"o AJre8.#
*- af'

^Uen1, - ,r,+{-rt tr
W{z\xAa-aD ,
:l

A"I*
o.r-.x- r\^red t".t (€-'.{-c=IL ftt^^t4^Jele'n^ b 14^"""Ie-
( '
n
:-v" dt-n ^J ,l t*-"-hd
Aqp€,"J.r^,^lc A*fA""^^ -t AA?^J-)
0
\ ^--[- -- -_
I

*t"" ---+
'S*"

G'"N
*l"^^,6

STRu e-:tu K-E- s f RT L


MrcK-o PKsG RF+4ME-D c^ N TF^ LL€R-

do >
3,r,,-,<.-.rUe".aL t /. rr^v\e-l\r\,'\*t- | \^}t^ivt1 ehe'zr

.r--h"S"

g{&u c.-\{ e*.E. "Ia"+^J


(;tJ-s.,*/'^

e"^J;l*;

&b-v*J

ot s-$^,o^ NroAe-
v\-

-----
J_

--) G-. *-=A gA"V (CS) e TR W


'
rrrnvr'r're\"1
/l

-'

uo t"D"J
*? O-^*vl,.rct 9\"*"e- A.AJAPI4 @e*9
=-
fI \A

\1","e-
""Jt>.+r.1lt"--
-t a.$'xx*,g U,'q '.n e-^,-ref''fr €=^st'J*'i"^,*?
(LgArCiElJ) --)ao Ie t---+""h" t-\^e-
-- LS t-tJ".^^s
-:-
\s t - [-].J'-"L-"J

::
-*>
,-=..^*ttd a-tsr'.e- -
d" .y.,"ici€rYtat\-t^-'t*; I^-.-.^^\'
I

nvi@3
#
-
Un^hJl€^
AJ- et- rv"t

€\*^V-"-."^^f"f,.^-
^* :*f^^ F
' Tqf* W
.^-^e,."J"-4.. {,"
\ \=,,.k- *{*;u-
q'-;}",,= ^J
*
"-{"'
v+ili*of,i*^
I
ru.tffi \A ti".J*J t-^j. Ji*[Jr'\\,-<l**-V
._
W"I&S a.)r.<- 2r-<4p.,i-J 4-l rtr''h^-iln-"'r^' ^ ""
dr
' 4 U u t 't- J-
_
t+<rep"*b.l- t^/1atw!ef,; ''Tt's'o lcveac f"-"'*
4
--'-.^

w"^S-[ gff"I"
t,eJ t.,
2 A A-"vt.-u i5
Llt;
q- 6^^t!4t .r^h'=t d#-o *r RL*"-*
* U
"t",^ht t\ I \ l-
t'q-r.Jcrt-o\- IA.l/V..1a'\-
u

b{-e,*J€n,
t"J-{i"*J)
.,g.r-l-rt a^JL ""^t S ti''^
\p.,t- '5-o-""'e
^14
i"'
"tJ"e- 4f@
tt-€-
L!2.€--

M \r-Fslt{ e TR,Vc T Ec o$ UBN r-DtvI ,

't ! fie:,.e sJ.$.er^ r\€.Lt


7 "^ic-\F.i,"\At*e;
"fU,,..,t--.-U"""*,"n*-
t"^ ". FtA {.^ t4^e-
\s "a,-,p,ke-
:{

-t"*ll.J
t*t.;"^kJ'
" fvrLr o-"t*-,-<4g ir t.*JJ {-J,o es ft-R
oJ-vQ-- tY*"'/
c Fer. ..*Y\Aiuk%J
Wn )
*"P
\.,.>o ae0-A6d,.t-be4

LLt ;n AR-?^iittt'a

*--t *:,'**:-. -"'^


\^Y\^^"4 i.r-.*i^,..rr+"-..1"*-.
t^x^ru*-t*., J-' *'w\r
\A 4**,,I J''.
\-\^- *",*..*"il
*"cr's't^'"alrn^<*'
*:
6^-,-^^,J-,ea ^, &1"t"rJ Y4"+- t
1
','n1A tr*:,
t-o ofo^ih t!'e- l,'-^'*Jr

>€ t"'"-ft.^tL*?**-? ,l-e1ru*'*^


"-?
ko
S'r-*- ko o-p^-^kT uev'ho.\ni?-"l" s------"-=:
\a) ^*
CIkL.c,..-ta q1x^;I't b''A"^ot"' '
k)

SH-:/.t
v$*
l**J:*f eJ't,-\s^
q
M5cx-o LNJ tr--',1c-Tro N) \ Ih^ trNJ

F€-tEt^ (

\
\
>e-,u=&-
\

E"te4r".&- \

bk^-lar'l-<- \
a--t&^-..e^l
I
d*<k
b Rln s U B S Y S T EM

Se-T;tL.\4A Lq^,t t<- *?*J^P q,o L -

In^.[i*,-^"{.^*l-, A-e-yi/'Ae9t-+
t+^lf.'-'
d
o. filiw{ . Lr ;*-- ^.
k1,^.,'". os--l*'1,4 t*W ' t&-4,\ - EaJ.
- +
**h"f'.-. Y " "
6- o {
o
n : il- 0 n
U^al"-^J".1- hglA't.a_
q,-Jr c*..'I-{ Of-S L kn^'cA-:'ry*- "^*?
!. \^^^\-,sd, ^

1v,"
$--g''t wuZ'Vf

Ct-h-e € *

.|-r^ \""#; *7vt*" q}u- )-rl't"a*-\''i\t'


a^l"^"t\
3
o \o f-r
1*^3rc h"J o^.^'{

\-us.€.Ju^ A*F^
L.o,,^.,*<-4.,\.\ A-t-U W*J- /..R-rl1-i t-J" t'-^)-..i
u

V" o. n-e1)a&*l *.s-o? \- ^^5^'J"" *b B1a-e--


. E*$t =
" t-*^^ Lo
'
fi -'
g1/, O^'z\€* ,=?A^e\ !'--P^
%.*94-;.^F,1
\ , . .l l - a'l-f'"rx>+' l"*}t
.r--!.-i l s--
*o -^[..F tx '&t'*at{A
tro i l -' .^* o,l .a^/ \ ^?( v<r ,
*."-1'-.^S, * ."idt ^^-n
'd.rnr.d {&"-t \a"'e- o"c'<x*8
n*J *s\,L{€- , bt
{#.",t"",-
j+-"-
(^-.-*"ret lg 't-t + *?^l"^P""
L4^w*- <-r\^--e--

fulo1 {&-^,\
{iRe.",
""1t*^ A-'-'-l-..
IL\o n aA,,rnn-r\ !va-*J I^l* '!"'ta 2
)^^ "S*T ""?:
0O \^n rrwninn \i1^ e/v\e\t *P
Y

vrnoA*Le) .-? P"-1tr'"'\ *"t Ltt--t'ttkt


\D Sv*^'tC'^.J t"r.i,"-{-4"^^"*h.:^

CAs€ 4-^"4 f 3
I
4.> 7-tl^c1", y - rl"
"trL'*... Ft -) Z -e,.,*
o - 6*J- W1^*,v".FL, 2 --e-,.bZ.z r(-tr',
lD ?t Y -t-

En r DCAr e j
Z --e^^-E

<s-.^.le-.i,,-'s-'a t/'"1 -A"^t"^=^S


\3) P .^s Pall'.,s -+ n^Arr*-
[e.w*,^iJ-
.^"^*f+.,t Vt e -
pi-.c-e[5 Ltvvr.zr,r q,]r* q*Lq*-( *si"ee t
l-t-J<"n q &.el
\1) "dL.*. ,

[t) q.^^r\l-i!d \. e"^^,t^p- ers-u]^"t{-{H*z*


o.).€(;!..a-rilrt'J u "t\'p',-"^^ltF"^"*"q
q,cJ&Q'P-dr?
b.}pLfr".H"^
|\ | .tl g,1^o ,q-s-u5x-€- A"J
"[-^&-]^"ilt-^

\o eN 4- lt*"'e-)
cl-)u< Adbel ^J"s'-

e un.Lr.r*

D,,'{'ir*t'l.^''"

Lt\r.iJidil'*l) tliJ.l-"^f"-J)

G--I.'*\
g^^,\t*,,"--
Crcfuf e-OU g UGSYSTA ^4
'-.=,: -
\. e-
Yg lD q- .+.i71n" A*,|t- v^*-e-l-^^^e ' S'b€-",tvi.-Jflry
l 0a
o \..,n- t^\,,.."b d\.t- qI* ua1^16"\ t ^^lp^"b, \io

ue.'Jttn^4 In,t^ o,J"^I/


)^*"
E \.e---^,1r^^,b dl-hA t-,-htJ-- -'*.tr^,,"*Lr)
o :tt srL €A sM€- ,L^*k- l;.{ A^---t '.^. }.e_i-1"4- Grc'-v-JF{
\ , t +- ' 0 , f* .r
-.

%o€W
\lte^^'<zo r
1o\ bib-v<^As\ '
Ek--}"e- c, * kr ^o -l.l r ll^Ja>_e

*t""-^t
\\,r,*.rye- A"kJ ^t".n >-\--&-,kc€'Jl'tG-*-J
u \t"n- *T
e,"4l-*-^r"-*}- c*1^Ja' \t

e \hi
\
b
Q\)
SJ*.f*"-t^^r{;

p@J.a^-l;Z1r&, Ury,

Id"a. el€J@Fllllrr.ln^

It.t-r.4- e.l-.r-

rno. g& U".r,€z> .


l"s
"-tt^ I
UM l-1
,5Jo"Jcu"" t^"8
(t, W\W. gf""sr--I"^",t Aclnr,,'n^.t- , e,er^rrAtv€^^g
U-
,r,t'
c,. !.f#^IIi
0 .^ U
Js]"".\^tad
| - l ---l --l
'
0
i,^JfqJ\:lqJ[ t[*h^*? c^$Il^ot"t
>$qlt^^^l^^t \'\ 'A
T\^s
^ Q * ^ ^ ^ lt c -t . '
0. , .0-t--^
^ .t,L^""!4G. al-p'Jic't
V-*jF^^ t^'^i o'\a ^ I-

gYNTAX FoR- q eN eR*'tFN .

fF- Q es eB*tPN .
,f t-f^^^
l€r".'."ls - J'*.L"f ' -" f*
' L t{."k- 'qe"'g*.>t"s';
!rql/'l
T,
Cr6-Ya4.l,)^'>tezr E - )6k'"v&t'fr1

e^^J.
N Lf*-)"J*LJi
g^t'lt-ts"l6
Q * o'l"t
Et<,wSe
E^^I.V t ,f - e"^L.{6le
qa"^ee.i.-(*l fl.l TEgen:= 8)r
fy*-(.^.);
A^"A*t- e" l.i\ i
4.d-4^ik4j.\^)"4. *i - 4^./,*\a.cA"\^- .l ^a -.-tlJ\*d \k

a4 - "'ut^lt .l.^*c-;
^t

; t71.c, .fx"^^/.o ta
t*6^J 1 tb ,&*.r\,.tts-
a tp t-e- o\''eA-lt J"J
^r,J*

T^€- 4$,D -f,1 ^l^"- L 'td"r^4 ro^r:a k *_ .^r.r.l.^"J*J , k


h"
o|<>.qle.rtn^ o,
'
P
Sl Ad{D sL .

Ude"-MvL ,t t'U',t o' , '1','Z')',


u.J "
( LrR , rsvu) 'teJoP,+ MVL;
ttoa- t')VL'2
l^^"^* ( U, R , MV L)
* -,"t^ ^rl\rr\zr
t R : m v u ) r - u A^\rn rqVL,

df

'l$
Atnig-',-.1€^^t Olax,a.sloa-' + T1^aJ4- a.x-e- t,rD<t
t,,l.D<l {.s
(3 o'/1"LX"^
^^t|1^4,
'o't ' Tts+ a\A 2
er" AI9^^"I , v, raxla.Ll,ezs
.' u.cJ\rll\.(/r\
, 'L '{s",lAt^'$t 0
o-

* (= ';l \A/l-€J \s Vo'l^lt'A to SS.CrN*L .


".",8fA.
4 i= t,lA-eJ \o Wtr {s VM.[.A B LeS bN gfAN?g_
- "o[^"",, ,
af, =7 dZ- v al,..r"-a \p kAil"L^.J
ua€d t{
ve4,f,s1-
s4- *nU^ OTHenS.
o LeencJ sLgr,glpxg -+,
:
o.^^d nn.r^A otr s'l- h gl- ru^^eA- n4vb
l+ ""rvt orrevtl-Jdrre

b K{t^t^;( o}^.r't=ta,5 --t


:
(.^ >=
i' g{,iJlc SLr rl-[ea-b t
-.-
,t)& A^f ,A* .SA-e\. i,"L nr't-

loo I o lo lA{ L b o\ olo oo


1 o ol o lo 6r:)-3 ia o o o lo o 1
t
loololo tJ'.L LA o lo lo o o
( ..^',{.\4^>.il",tne"lc l-^t- .^,{^i"h ia to ' )
Fltxrt
Ioololo ,8 ,A- o .3 \A ttll o() |
L *'i{|. lt4rk*wrk b^V *tich k ' r' j
F$*4

t<t {f / +* MoD f-E'H ABs

e*
4
t
o' ><
tl ' >) o )
tc' tA ' A
& k 'T/ a C- AT ,
Eq vf P"la' Ptg?r1""^lR'D \
a) ',
D oW r-t?o
: sTD- L O q E C -r EctoR t']
S[ 'qF \ A - L d
RtCr H'( 2-t ,
>-o Jt >{f-G H ' ,,r ) ' ueFT -7 , )'l
dt riw , -

{t uer.sqTH= B
E" u+ S^f .I A4*qt" k' -

cQ<t €v EI$T A"^'al' ='l') ') I


ct Jq * *l
$
I
t ", '
) staTA-BLE
\ s' +<ssvE
)^^^.rt A''u;t^,,]RD
:-:--_-r-
'"o HEQH' 8'aruqe''
orrr--^i'^tt-r-|it '5auA
Sen^^e-
"t ^l*r'^U^^p^ r'rr:t-
{C'^'€=ca--'^\'^"f,f,tr" +
gVex,\ cl-<-. VHDL --d-. ^qi-^
*r t^^J"\D
12/svJ
"tr-{al^.-o-A^A*i \ tb'r..."nn*- a*."ht*J B d
A-l^" .A "'J*'"nt""k'a2
o '
To -ai""t i T
'
'4Y T Arx o
Iu
^1'4-'it{"t
oF .*{* -ry14"rc " ff
o-krdt^^k--q^d,.ne-
- ATTFgB rtT€dffA IL^^Is --! ' l. r a lz . r r , < ' o A ; L ^ ^ l( . - * l' t ' ,
ATT&T.gute
Domains and Levels of Modeling
Structural Functional

high level of
abstraction

- Iow level of
sbstraction

Geometric "Y-charl" due to


Gajski
u5!"

DomainsandLevelsof Modeling
Strrctural Functional

Geometric "Y-chart" dueto


Gajski& Kahn
22
Domainsand Levelsof Modeling
Structural Functional

Geometric "Y-chart"dueto
Gajski & Kahn

DomainsandLevelsof Modeling
Structural Functional

Geometric "Y-chart" dueto


G{ski & Kahn
aA
libr
US€
eril

a- \^*rn en
arc
col

en
stg
be
ha
ha

lit
LT
el
tr

g
Full addercircuit usinga macroof Half adder.

libraryieee;
useieee.std_logic_1 164.all;
entityfa is
port( xin,yin,zin : in std_logic;
cout,sum : out std_logic
);
endfa;
architecture fa_structof fa is
component ha is
port ( X, y 1in std_logic;
s ,c :outs td_l o g ic ) ;
endcomponent ha;
signaltempO,templ,temp2 : std_logic;
begin
ha1: ha portmap(x=>xin,y=)yin,s=>temp0,c=>templ);
ha2: ha portmap(x=>temp},y=>zin,s=)sUtTtrc=>temp2)i
cout<= templ or temp2;
end fa_struct;

4-bit adderusinga macroof Fulladder

libraryieee;
useieee.std_logic_1 164.all;
entityfa_4bitis
port( a,b : in std_logic_vector
(3 downto0);
sum : out std_logic_vector(3 downto0);
carry: out std_logic);
endfa_4biU

architecture
fa_4bit_behave
of fa_4bitis

component
fa is
port( xin,yin,zin : in std_logic;
cout,sum : out std_logic);
endcomponent fa;
sign
beg

c(0

ul- :
u2:
u3:
u4 I

lv A ^"_ 0,"1 Ar end


1\
\I
I
libr
W6 * us

en

9,/'"*L

en

ar

st
D(

e
(3 downto0);
signalc : std_logic_vector
begin

c( 0 )<- '1';

u1 fa portmap(xin=>a(0),yin= >b(0),zin= >c(0),sum= >sum(0),cout=>c(1));


u2 fa portmap(xin= >a(1),yin= > b(1),zin= >c(l),sum= >sum(1),cout=>c(2));
u3 fa portmap(xin=>a(2),yin= >b(2),zin->c(2),sum= >sum(2)rcout=>c(3));
u4 fa portmap(xin= >a(3),yin= >b(3),zin= >c(3),sum= >sum(3)rcout=>carry);

fa_4bit_behave;

{/-a
4 bit adder using GENERATE
STATEMENT

libraryieee;
useieee.std_logic_1
t64.all;

entityfa_generate is
port ( a,b : in std_logic_vector
(3 downto0);
cin : in std_logic;
': (3 downto0);
sum out std_logic_vector
carry: out std_logic);
endfa_generate;

architecture
for_generate of fa_generate is
componentfa is
port( xin,yin,zin : in std_logic;
cout,sum : out std_logic);
endcomponent fa;

(4 downto0);
signalc : std_logic_vector
begin

c(0)<= 61n,

gk : for k in 3 downto0 generate


u1 : fa portmap(a(k),b(k),c(k),sum(k),c(k+1));
endgenerategk;

carry<= c(4),
endfor_generate;
Singlebit comparator
libraryieee;
L64.all;
useieee.std_logic_1

entitycompis
port (a,b in std_logic;
X out std_logic;-- a > b
Y out std_logic;-- a < b
z out std-logic;-- d = b
en in std_logic);
endcomp;

comp_behave
architecture of compis
begin
process(en)
begin
if (en = '1')then
if (a>b)then
t1t;
x <=
y (=' 0 ' ;
z <= ' 0 ' ;
elsif(a<b)then
x <= ' 0 ' ;
y (= ' 1 ' ;
z <= ' 0 ' ;
else
x <= ' 0 ' ;
y (= ' 0 ' ;
z <= ' I ' ;
end if;
end if;
end process;
endcomp_behave;

Comparatorwith EnableBit
entityComparatorEnableis
Port( a in std_logic_vector(1
downto0);
en in std_logic;
Gr out std_logic;
Le out std_logic;
en

an

be

qr g

As
h'L
&l
$6 L<-
e

v9
g"-
BI
9,t

M tc tr'^/h4"l"r4J^k- ( ) ) x\\) , a(o)=) BV),


F**--+ ^tt
e,rn72y
t W7 k^."t"I
k2 fl)pa 4W9
w) 2 4-r,* o
I
u1-{^,-+ ry-{e- &
)r
E-\,@^fi__1
' 2\,
Eq : out std_logic);
endComparatorEnable;

architecture
Behavioral
of ComparatorEnable
is

begin
process(en,A)
begin
if (en = '0')then
Gr <= '0';
Le <= '0';
E q< = ' o ' ;
else
if (A(1)> A(0))then
Gr<= '1';
Le <= '0';
E q< - ' o ' ;
elsif(A(1) < A(0))then
Gr <= '0';
L e< = ' 1 ' ;
E q< = ' o ' ;
else
Gr <= '0';
Le <= '0';
E q< = ' 1 ' ;
end if;
end if;
end process;
endBehavioral;

4 Bit Comparator
entityComparator4bit
is
Port( A in std_logic_vector(3
downto0);
B : in std_logic_vector(3
downto0);
en in std_logic;
GT out std_logic;
LE out std_logic;
EQ out std_logic);
endCompa
rato14bit;

architecture
Behavioral
of Comparator4bit
is

>)

7
1- r .
r component ComparatorEnableis
(
Port a : in std_logic_vector(1
downto0);
en : in std_logic;
Gr : out std_logic;
Le : out std_logic;
Eq : out std_logic);
endcomponent ComparatorEnable;
signaltemp:std_logic_vector(10 downto0);
begin
U1:ComparatorEnable portmap(a(1)=> A(3),a(0)=> B(3),€fl =) en, Gr =>
temp(O),Le= >temP(1),Eq= >temp(2));

portmap(a(1)=> A(2),a(0)=> B(2),€n =) temp(2),Gr


U2:ComparatorEnable
\ => temp(3),Le
=>temp(4),Eq=>temp(S));

U3:ComparatorEnable portmap(a(1)=> A(1),a(0)=> B(1),efl =) temp(S),Gr


= > temp(6),Le= >temp(7),Eq=
>temp(B));

U4:ComparatorEnableportmap(a(1)=> A(0),a(0)=> B(0),en => temp(B),Gr


= > temp(9),Le
= >temp(10),Eq=
>EQ);

GT <= temp(O)or temp(3)or temp(6)or temp(9);


-,t Lf 4= temp(l)or temp(4)or temp(7)or temp(10);
\
\_-.,
<{ \ end Behavioral;
'-t/'

4xL Multiplexer
libraryieee;
useieee. std_log
ic_1t64.all;

entitymux4_l_ifis
port(a: in std_logic_vector(3
downto0);
s: in std_logic_vector(1
downto0);
y: outstd_logic);
endmux4_l_if;

architecture
mux_behave
of mux4_1_if
is
begin
process(s)
begin

t
t
ifs=" 0 0"then
y <= a ( 0);
e lsifs="01"then
Y <= a (1);
e lsifs="10"then
Y <= a (2);
else
Y <= a ( 3);
end if;
end process;
end mux_behave;

4:1 Mux usingCasestatement


libraryieee;
useieee.std_logic_1
164.all;

entitymux4_1_case is
poft (a: in std_logic_vector(3
downto0);
s: in std_logic_vecto(1
downto0);
y: out std_logic);
end mux4_l_case;

architecture mux_behave of mux4_l_case


is
begin
process (s)
begin
cases is
when"00"=> y<=a(0);
w h e n" 0 1"=> y <= a(1)i
w h e n " 10"=>y <_a(2),
whenothers-> y <= a(3)i
endcase;
end process;
end mux_behave;

4=L Mux usingwhen statement


libraryieee;
useieee.std_logic_1
t64.all;
entitymux4_l_whenis
port(a: in std_logic_vector(3
downto0);
s: in std_logic_vector(1
downto0);
y: out std_logic);
end mux4_1_when;

architecture
mux_behave of mux4_l_whenis
begin
y (= a(0)whens = "00"else
a(1)whens = "01"else
a(2)whens = "10"else
a(3);
end mux_behave;

4:1 mux usingwith-select


libraryieee;
useieee.std_logic_1
t64.all;

entitymux4_l_withis
port(a: in std_logic_vector(3
downto0);
s: in std_logic_vector(1
downto0);
y: out std_logic);
end mux4_1_with;

architecturemux_behave
of mux4_l_withis
begin
with s select
y (= a(0)when"00",
a(1)when"01",
a(2)when"10",
a(3)whenothers;
end mux_behave;

2=4DecoderusingWhen-else statement
libraryieee;
useieee. std_logic_l
t64.all;

entitydecoder2_4
is
I

port ( a : in std_logic_vector(1
downto0);
y : out std_logic_vector(3
downto0));
enddecoder2_4;

architecture
decoderbehaveof decoder24 is
begin

y (= "1110"whena = "00"else
"1101"w hena = " 0 1 "e ls e
"1011"w hena = " 1 0 "e ls e
"0111"w hena= " 1 1 " ;
enddecoder_behave;

3:8 DecoderusingWhen-else statement


libraryieee;
useieee.std_logic_1
164.all;

entitydecoder3_B is
port ( a : in std_logic_vector(2
downto0);
y : out std_logic_vector(7
downto0);
en : in std_logic);
enddecoder3_B;

architecture
decoder_behave of decoder3_B is
signaltemp : std_logic_vector(7
downto0);
begin
temp<= "11111110" w h e na = " 0 0 0 "e ls e
"11111101"w h e na = " 0 0 1 "e ls e
"11111011"w h e na = " 0 1 0 "e ls e
"11110111"w h e na = " 0 1 1 "e ls e
"11101111"w h e na = " 1 0 0 "e ls e
"11011111"w h e na = " 1 0 1 "e ls e
"10111111"w h e na = " 1 1 0 "e ls e
"01111111"w h e na = " 1 1 1 " ;
y (= =
tempwhenen '0' else
(others-> '1');
enddecoder_behave;
Parity Bit

entityparitybitis
Port( x : in std_logic_vector(4
downto0);
y : out std_logic);
end paritybit;

architectureBehavioral of paritybitis
component xorl is
Po rt(a:i ns td_l ogi c ;
b : in std_logic;
z : out std_logic);
endcomponent xorl;
signaltemp:std_logic_vector(3 downto0);
begin
uk: for i in 4 downto0 generate
ukO:if i=4 generate
a:xorl portmap(x(i), x(i-1),temp(i-l));
endgenerateuk0;

uk1:if i<3 generate


b: xorl portmap(x(i),
temp(i+1),temp(i));
, endgenerate uk1;
endgenerateuk;
y<=temp(o);
endBehavioral;

BCDdecoder

entityBCDdecoder is
Port( x : in std_logic_vector(3
downto0);
y : out std_logic_vector(6
downto0));
end BCDdecoder;

Behavioral
architecture of BCDdecoder
is

begin
y <= "0111111"
w h e nx = " 0 0 0 0 e" ls e
"0000110"
whenx= "0001"else
whenx= "0010"else
"1011011"
"1001111w"h e nx = " 0 0 1 1 e" ls e
whenx= "0100"else
"1100110"
whenx= "0101"else
"1101101"
"1111101w"h e nx = " 0 1 1 0 e
" ls e
"0000111"
whenx= "0111"else
"1111111wh
" e nx = " 1 0 0 0 e" ls e
" e nx = " 1 0 0 1 e" ls e
"1101111wh
"0000000";
endBehavioral;

Adder usinggeneratestatement

entityadder4_generate is
Port( a : in std_logic_vector(3
downto0);
b : in std_logic_vector(3
downto0);
cin : in std_logic;
sum : out std_logic_vector(3
downto0);
cout : out std_logic);
endadder4_generate;

architecture Behavioral is
of adder4_generate
component Adderis
Po r t( x: i ns td_l ogi c ;
y : in std_logic;
ci : in std_logic;
s : out std_logic;
co : out std_logic);
endcomponent Adder;
signaltemp : std_logic_vector(3 downto0);
begin
ad: for i in 3 downto0 generate
ad0:if i=0 generate
addl: adderpoft map(a(i),b(i),cin,sum(i),temp(i));
endgenerate ad0;

ad1:if i>0 generate


add2:adderportmap(a(i),b(i),temp(i-
1),sum(i),temp(i));
endgenerate ad1;
endgenerate ad;
cout<=temp(3);
endBehavioral;
BCDAdder

entityBCDadder is
( downto0);
Port bcdl : in std_logic_vector(3
downto0);
bcd2: in std_logic_vector(3
carryin: in std_logic;
bcd_sum: out std_logic_vector(3
downto0);
carryout: out std_logic);
endBCDadder;

architecture Behavioralof BCDadderis


component adder4_generate is
Port( a : in std_logic_vector(3
downto0);
b : in std_logic_vector(3
downto0);
cin : in std_logic;
sum : out std_logic_vector(3
downto0);
cout : out std_logic);
endcomponent adder4_generate;
signalB,x:std_logic_vector(3
downto0);
signalc,k:std_logic;
begin
bcdaddl:adder4_generate portmap(a(3downto0)=>bcd1(3downto0),b(3
downto0)=> bcd2(3downto0),cin=>carryin,cout= downto0)=>313
> k,Sum(3
downto0));

c (= k or (B(1)andB(2))or (B(2)andB(3));
x(= "0110"whenc='1'else"0000";

bcdadd2: portmap(a(3downto0)=>B(3downto0),b(3
adder4_generate
>carryout,sum(3
downto0)=>x(3downto0),cin=)'O',cout= downto
0)=>bcd_sum(3downto0));

endBehavioral;

LookaheadCarry4-bit Adder

entitylookaheadcarryis
(
Port A : in std_logic_vector(3
downto0);
B : in std_logic_vector(3
downto0);
Cin: in std_logic;
lq b o^,
i I r'l-
end
i o-'r^)J
arc
s) 9v
-'
f,h l \ 4 Lr ! cr-
t ,lr-r Jl - ) Yv 0-
<-l -l'
v 9:,

IJU rI t '

Lo L--

en
r(i

at)

r^(2
('t L

3l'li

cl

C1

eI
('<t Sum: out std_logic_vector(3
downto0);
- Cout: out std_logic);
=T end lookaheadcarry;

I architecture
Behavioralof lookaheadcarry is

r begin
signalc: std_logic_vector(4

91: for i in 3 downto0 generate


downto0);
signalp,g: std_logic_vector(3

P(i)<= A(i)xor B(i); 'z


g(i) <= A(i)andB(i); "/
downto0);

Sum(i)<= p(i)xor c(i); .--


endgenerate;
c(0)<= ern;
c(1)<= (Cinandp(0))or g(0);
c(2)<= ((Cinandp(0)andp(1))or(p(t) andg(0)))or g(1);
c(3)<= 1(Cinandp(0)andp(1)andp(2))or (p(2)and p(1)andg(0)))or g(2);
c(4)<= ((Cinandp(0)andp(1)andp(2)andp(3))or (p(3)andp(2)andp(1)
andg(0)))or g(3);

Cout<= c(4)i
endBehavioral;

+ve edge triggeredAsynchronousD flip Flop


entityDFFis
Port( reset,D: in std_logic;
clk : in std_logic;
Q : out std_logic);
end DFF;

architecture
Behavioral
of DFFis

begin
process(clk,reset) V
begin
if(reset='0') then \/
Q <='0'; v /
elsif(clk'eventandclk ='1')then.
Q <=D ; \/
end if;
end process;
endBehavioral;
enti
r
i .,^ .M - . r, -\ i-))
end
e^..,Ah^*l
; ard

q-\e,L*+o-.-L=J-*--\*'t- t---l ' 4 beg


Y o)
: kV\- fud .- -*'"*-(-u^-fr -a+'"r'^'(o
.l.,'^^,..-f
3f*
b^"".
cJk,*y)
F-""uu* t
L"4,"""1
'-'\ (
rl \' hst-^k en
u
(=tb.oo7;
T \-1'<'\
[ *J' cJk
"!-afl '[]+-L'^""^t- -'u')
= ) - t"^1( >- - +*"""ft1;
*1,, et

e"^"'LF-."
"f_,
1, <>"*, e
""A t J"^; a

b
-ve edgetriggeredFlip FloP

entityDFFis
Poft( reset,D: in std_logic;
clk : in std_logic;
Q : out std_logic);
endDFF;

of DFFis
Behavioral
architecture

begin
process(clk,reset)
begin
if(reset='0') then
Q <='0';
elsif(clk'eventandclk ='0')then
Q <= D ;
end if;
end process;
endBehavioral;

4 bit Shift Right

entityShiftRight4bitis
( downto0);
Port datain: in std_logic_vector(3
downto0);
dataout: out std-logic-vector(3
clk : in std_logic;
newdata: in std_logic;
reset: in std_logic);
endShiftRight4bit;

Behavioral
architecture is
of ShiftRight4bit

begin
process(cl
k,reset,newdata)
begin
then
if(reset='1')
dataout<= "0000"i
andclk='0')then
elsif(clk'event
dataout<= newdata& datain(3downto1);
3-
I
I

D*-c*J*= Cs<""^.(s.
I
l.r. r
A/,."/fld*4 d<r1_
rI
\A
v

lirr-.-k- [ r{.\z\
MJ-k7u (= *"^'-#" 9,
*vR-{,,!-,sr
1
"[ : end
(!.k ,.
\r/* Arcd^ {*?.j
qr
w e""rt A-1-.\- [B?'. - v€e4€{ C3 a^n ru$.'e " ) t
,)

Ix^^,t : '6^ ,b.U*\*?-c );


Itr
ent
5v-o\ d^-<- .) I
/

*rr.€il+e-<Jk^r-\€- Ltt ='1 &o ta


tt r> o- l- \ "
A.rfJ 4 r o"d-h1,.-- \A-?-,(v\ t SoL$ur''X-o " )/
erx
L--r;^ arc
ue,.!s( "lk 1A""^t )
f* bet
L^T'^"
\l
\1, \ a.--*
\)
o' ) +'.'v
I

I""^"{" <= +*-'.4.1 l en

v* <
\4 \

h
s t a
\t &r
\

W {==- &

4"i&
{*^^\

q4" ' , el

*)
al

€^^^
**[\"

tr
] h

@'7/

e"^A f."rl^;
endprocess;
endBehavioral;

4 bit Shift Left


entityShiftLeft4bitis
Port( datain: in std-logic-vector(3
downto0);
clk : in std_logic;
reset: in std_logic;
newdata: in std_logic;
dataout: out std_logic_vector(3downto0));
endShiftLeft4bit;

architecture
Behavioral is
of ShiftLeft4bit

begin
process(cl
k,reset,newdata )
begin
if(reset='1')then
dataout<= "0000"i
elsif(clk'event andclk='0')then
dataout<= datain(2downto0) & newdata;
end if;
end process;
endBehavioral;

SynchronousD flip flop


entitySync_DFF is
Port( reset: in std_logic;
D : in std_logic;
clk : in std_logic;
Q : out std_logic);
endSync_DFF;

Behavioral
architecture is
of Sync_DFF
begin
process(clk,reset)
g"4;*\ )^^ \ P o."*-tl.p-La \"+-

a/-a- [*-6,i. -v"*-xoz-t= *,

["qa.
ol
ti-t( ,Wq
flracP'-5 \
h9)tA
"7"t! |
(h^""t- =' | ) JLa"4
t 0\ . 1
d^,t-- "-\ts '-
\ tl.kt<^^^-a^tsL-
c'tf< '-\' ) +t*-
\
;^b t
#1.,
b"" LP^AL(9
t c-(k *to' ) +ut
v L e-0-Jrf
e^,-a/*-q'.

fr,r
'.}.tf,- *bo\t'
^1" t ' \ \ ^ ' e ' ")
" c-2 -t1,- '
J4""^ hL )
1 < i %t . o'
*"*d;
'^ - - t
.^Jil- )
uJf*e-u\^ )
e€l,'
( +*19
W
*ffi
h^ar
) +^"-
b"4pL
+"^,-{fl}-\.^--u^0=*-
"o' ,i l

L)
begin
if (clk'event and clk = '0') then
if (reset= '0') then
Q <='0';

end if;
endif;
end process;
endBehavioral;
EDATools
1, DesignEntry
.ViewLogic
.MentorGraphics
(Renoir)
.CadenceDesignSystem
.OTCAD
.ALDEC(ActiveHDL)
.SimuCAD(Silos-3)

EDAToo|s
2.DesignSimulation
.ModelTechnology (Modelsim)
.Synopsy
.Cadence
.SimulCAD (Silos-3)
.Quickturn DesignSystems(PowerSuite)
.ViewLogic(VHDSimulator)

EDATools
3. LogicSynthesis
l.Synopsis
.FPGAExpressway
.FPGA Compiler
(Synplicity)
2. Synplify
3. Exempler Logic(Leonardo Spectrum)
4, ViewLogic (Intelliflow)
5. Cadence DesignSystem
6. Aldec(ActiveSynthesis)

EDAToo|s
4. ProgrammableLogic(Vendors)
.Xilinx- XilinxFoundation
Series
.Altera- MaxPlus II
.Altera- QuartusII Ver.4.0
.Lattice- isp ExpertCompiler
.Lucent- ORCAFoundary Development

il
.Actel- FPGAOeeopmern gen
'Cypress-Warp2
.Atmel- FPGAOeeoprnent Sl/*nt
.QuickLogic- Qr[* works
.GateField- ASICMaster

OtherHDLs

1) ISPS(InstructionSet Processor
Specification)
-Behavioral
Language
-Usedto designsoftwarebasedon speciflchardware
-Statementleveltimingcontrol,but no gatelevelcontrol

2. TI-HDL
.TI-HDL(TexasInstructionHardware
DescriptionLanguage)
{reated a TexasInstruments
-Hierarchical
-ModelsSynchronous andasynchronous
circuits
-Non-extendable
fixeddataWpes

3. ZEUS
- Createdat GeneralElectric
- Hierarchical
- FunctionalDescriptions
- StructuralDescriptions
- ClockTiming,but no gatedelays
- No asynchronous circuits

4. TEGAS
.TEGAS (TestGeneration AndSimulation)
-Structuralwith behavioral
extension
-Hierarchical
-Allowsdetailedtimingspecification

5. Verilog
.Verilog
-Essentially
identicalin functionin VHDL
-Simplerand syntactical ly different
-GatewayDesignAutomation Co. 1983
-Earlyde factostandardfor ASICprogramming
-OpenVerilogInternational Standard
-Programming Language Intefaceto allowconnection
to non-Verilog
code
6. ABEL
.ABEL
-SimplifiedHDL
-+LD Language
-Dataflowprimitives
e.g. registers
{an useto ProgramXilinxFPGA

7. AHPL
.AHPL(A HardwareProgrammingLanguage)
-Dataflowlanguage
-ImplicitClock
-Doesnot supportasynchronous
circuits
-Fixeddatatypes
-Non-hierarchical

B. CONLAN
.CONLAN (CONsensusl-ANguage)
-Familyof Language
for describing
variouslevelsof abstraction
{oncurrent
-Hierarchical

9. ALTERA
.ALTERA
{reated by AlteraCorporation
-Simplifieddialectof HDL
.(AHDL:AlteraHDL)

10.CDL
.CDL(Computer DesignLanguage)
-AcademicLanguagefor teachingdigitalsystems
-DataflowLanguage
-Non-hierarchical
{ontai ns conditiona
I statements

1 1 .ID L
.IDL (InteractiveDesignLanguage)
-InternalIBMLanguage
-Originallyfor automaticgenerationof PLAStructures
-Generalized to coverothercircuits
{oncurrent
-Hierarchical

l:
Se-y1,te^c* D€,t€"-lot o lo

"-er<k
:>i = C
sr : C1

e*"hq *1*
"( E? uJ< ; dr &\d- Z: e*t a\4 -/*7');
F*{t 4-,U
eu-A ;
-{R1\,^,e/v,cJr-

c,\rLitqlur,r- VQIL,Y L"1we/v\c-e- L{


M - 1 t* -W d^ (So,5,,9,),
W
AV" - I F - &b ?
lD24/r.)
-*&t
@(k)
bu ' f*c'-s4
:t>P4A'.
.0 ^. \ / -WU r"
'[ el*'
p-U-<='n'-#)
onJ- ,l ,
e,'L YM;
(- P - - \ L ' ( F- e' E)
f*cx' A
vr *a^c..r..- 3, =7
t-\
Ctt* ti U^€^.
b-&'t f .'o'
,r74r.rprr., So :) I

t*s-t: Sl i
E='o' t+ 'e" ' Z<r'l ;
V 'o'i qn-& 't - < = S r
/1 > '' eL>P-
; q*91 = So i
'. 1

&P- z< > o


' z < =-'o ' ez^"LiL
; 0
e",""ttl g1,\r2L
t
CrJ4e
i

e-^J Vhnc*jA c -Jr-j ;


I
t I E-='l' tt€^ ^ €^,-=L Urrt-.;
32)
Z < o'o' ; L\ -A t < =

"/.ttr-_ t
z *' o ,
<_r,aLil
I
J K -trF

e,v\
I
er*i$ Jn U l>E/
I

P.t.b"( J, K/ c.Q.k>
oLL r 1,^61J- 4-; 9z9B I D{.^,L
l/.a--i'7t); e-{.

u,J-1 K i ,3-

L
o.ct."ted*^xq- U"l I f- ta
1
bz^ !
P
cx* Cf , K 7 C.tA, ,h)
/-,n
vo-,i*/'te E--t*.F tW .8A{-btrtl b

6"a^- L

" t Q.-t 0'


I ; 14.€,r.-)
{ -t
q = { = ."4+ =tO', .t

€!at, ( d.k'e-v*, t ' t{^€^r


^,.J- dA "t )
.l- E'r o^l' t4^r,n ]K -9G+ tl_
=to/ *'"-A Kotoo tt'€/11 o13 gtt)
+ I o
ol
q- W,.f, i :- 9- k4,-f ) lo I
1r gtr u ,
,ry J"-tu' wu4- K -tl' -(4.e'"1
$-te,-Jr:: '0' ;
J"t1' a'\'^@(K oto'-l+{^'
-UrUl
$- ten".,[-: -: ' l' ;
.t'iJ I = tt'
4
a"J K "'l' u^e,- L\

9 - \€r*--1":: "rruetq- +""-F ;


."_dl;
$< : 9 - € " ^ - .P ;
98< = r.et g- {**^P; Ar
+ ,
e"J ct-'l ,
f,ruc
a^J t^ef^ ;
'\ *{. n
lll

:-

e/"kq T () oilF
l"*-t' Ca, c.0J<,
&, 9, 1,iixa- l'"7'1 ;
8.," : i.', .s-14- -qD7,tL'2
e4r-A T i

ducf^;*e"q^).r- bQL L8
%T

w L T, M, c{,"r E.' )
We*
v a>.i^Lte q - +e*'"p : a'l't{ - Wt ;

(/tr\
b,€*i^''
"t-(r- o t o' tl''.e-r (d
+
I - {s/v"'.F
=- to ' t
\--/
)
.Ia_LI ( c/-t ' . ^^*'t a'J dA = 't ') t{*'"
\l' Jd^€-
'r UJ _____*:_:_
i.L En -
"
I
D O (\
tl T ='f ' tt^€-1
0
q-tP^"^b'rmek E-
I e &j
\. i
e-\^4-

.*+i o
Ur^O., ;
€4r."L"/ i
q<- 9-t*'^t';
€4,."tP- *;
ts {l

e"^ot W', AL
\
O

O
lF\
1 ) .- t- F ^ r
vrr
:::

€;,r:

b€l
I
Q)v-1

or)r
a,..[1v D is b"r

F.x* [
O, &, c.[rv: i-4.1.{ -Lr-f.; 9,913 I e<-&xtd -W'); l'^
er-4 D ; \Jo.
o,rd^i{p"}.^x<, L"l.Y D L}
oorcAtwcA^:-.r- L"J^ y g i; b..
l-r;'-
4^ ,r-"r"u ( Dr@, cb') il
t
yL*;, ( D,&, @)
Eff- e
va>*
"U'e 9- {.-^F I : 'a-QJ- X>7t.; i|
"Lth.
o' +L'r-l
e)
'\
67^ 9( = o , il
.1 e.(r. = tO' ++rE *fti ( cU<e^'"^^A
'-J
C'AA, a
|J

tu '
^ d - t(
Q - *e , ' ' ^ { o = ; \\l
q <- D; .J
rl

rA-,r-p t dk' e-ve-nL a,J c-t/< ,,'( ' ) +1^e*, ,-/ ;


".-"L
a) E- l* t f 'u^ e * , e^J f."* ; el
g-r* {:: }; e.,r.'{ U*-l^ i

")'r>--

:' $*P*V ;
$ -{sz'.*.p
e,JtI
q < > g-M F.i
qB ( r 'rre& 9-t€4''^P)
en-d
F"*;
e-{ b"t^;
ss-lf
s K ."^
e^dik'd
?L,
98"' e'"ts4rJ-I'"y._);
P"* i ,'LJx. i.,"arJ-/*'tri-; 9,
3r K, cQ-k
el,-A gg-i

oD.efii{:ecAr-r€- b*Y SR t-3

b,.s&
,ptJ ,-r^ ( 9, R, cLt, Lq-"Ij")
vo:ul*-L,Qc E - \€r.'\P : : 81d - {e7i<- ;
) i^
4- o
?s" =' o {f'€^"
il c,b- ='o ' @" .^^J
I
9 - r.i=t^p
e-L4it ( c-Q.-j"t'a.,^c-.! arJ e!-k =' l ' kl"c' )
U
tJ E"n"t'{0.rrn
C{,hJ
t4 t-br
-'['
a,-'-\ ?]v ='| ' Q{"'e'"" 9 (tJ2
v
iL S:
to' a,-={- fl= 'o' Ll,'...o'-
oo 9 \+r
0 ol o
q- te,r-..|::: q- {*4""Fi \c 1
e,t,,i; s >tct R"1' tL-'t','. \l
^*A
:: 'oi
9* \sr\^\P
tl' o'."J R='o' kf*- ,.
S'
W
? 'l '
Q*+a ,n ^npl ,
e L ^ L -g .='1' c t^-J K ='1' k L " e ' n "
0
tt 'l '
$ -te ^ -.-1 ":= O oooO O )

erJ+,
j
9 4= 9-te/Y""'P
t q'ret E-\€/"^P'
96 l.
e-.A urlS )
V\n
,zr..td Wv, i
nA
l{a"V ^
ftsd.d.,€ ,

Sr,u,''n
F
elr.k
\,
F=\
@/'..4
er^l+$ FtA - AoEryR b
(A, t3, r.nx,kr{- S-ur''',,*^Y : s"'E aU -3t7'O; dt}.rj
F ^-b 4.)
€-J. HA =AOD€R-; l*x
ar,ej^ite^A^:l<- \^e*, H A -40D,E-Ri:
P'*
Y t"?
lro4i-
( A, a) z
VLr"^
ba^, er.d

/\'t^^,n (: A xlt B; 4 ert--A

4""-t g'2 B
Col).^X < >- A
u-
VeL't
-rJ
R J L U- AODER. e-+
ehJat^l m ,)9 t*l
tT ul * : t. -
'€u' bT' ' v'),2\ e{A.arJ* h?'-) ; SAcJ
Fu.rJ
erJ F+ ; ol{

*fr/,.*1*^f*Xe- beJ. F* i^ I
% EFe-
I

b-e4i"1 blLo
t
y-l.or" t A,B, Ct') n b.q
V.+.r'*U{<€ X, X, L : .e-.ld- JtF?'c-; (]
A
*T" z
gw
?(i: 4 ?A€\ B;
e;l^
U^-r(. : d€R Cr" ;
"(
A a" ^J.B ;
?,=
>< or^J c,G" ;
d- \
z<> o{ } ;
3
er-ol- €r,>A ) Q*i
t/r^
er-.{- l6d"\ i
4hb.b Xo< q-jz
"

b - __/
:f> - ? '
2 //
e^^A\X q XoK
':L
F4e"\t( q, L, c, 4 I L,n Ald - ,|s7,r..) Tl
e.,$ .9,\d - bf");
a/^4 4 Xo R ,
c$,/^i+e^+u.n€ Euh 4XoR rE
{
l>-q,r.-'t
A
p > . . i-"*{ (^ ,L,L ,A)
t^
*Tn
z
er--t l/--n cX-,rS'
g )
<rv-"f Leh ,)

t,
3 }tb,.,t P'.\,45tP
#

T
2_
F-

e...JJt7 3 N,410 U
p*-t ( A, B, C r 1",..s-tJ^ b?^. , tr-, e'tt Xt {- t?'.);
e-u-.-t3 xr eND i

o.&lte.Ao.e- t€-r^ Y 3NftND LJ


b"?-
y ? - A a R - e / tC A,B , C)

b?b
Z ( n meL tA a.-^.1E o'"=t- ,_) )

e".'AY*;
e^^d te-tr;
x(ct
0 Rr vej I^ti\
)€\t (.n
x(5)
Pa:ts,l
2.'A I
x6)
uu.Li{

4^
x l3) lfincn
\/ o->11

q(tej
\*"a
Ctu>4

* (l)

e,l,\f,tb..l
"a.P R U-:
f",o'Lt ( ?Lr i. n .s}{- AF?ic--vez.Astu( 1 to q) i FRT : e.^t sAd-V"-ve,.tet(l I
erJ PR;
*uc/"it+**"r.r. t-e"i4 el PK LA
t6Aa^- t

,.p ' ( t', o(2, d3, i l 4, {S , * c )


W
4-
t2- La.r\ i > cnef ;
= ^2-
e( ? b€!^, : xet {j j
14 tar- s c|lst- *1 )
"
X -f 3aa l: vrst *S.;
f.6 La.r t s "neA o(6 t

P Rr l( = )(-l;
P Rrz (: 9g1 Xz a,,^"{-o,\^-e t.}t t) ;
PRTJ ( : x 3 .nJ '.,.\,e"t(Iol o^,A ^^'s.b td A) i
.n€tLd,-q-) o,-J- n^Eb\dL) *-d er.J
PRI 4 4 *-J '.,e't tx D ;
"t td' a\^^'t*t'eh U
P R rS{r X S qrJ t"(4/ ^'-'J ft"R
t"tg) *J -""* z
-',re\
sr.6 .,J rct ttT) *^'J * 't 8t{) '^^'t Qtr-)anJ {'va^t\dzJ
P R T6 ( : "^'-t e-J
q^,"^d t* f'}t D \

er.J P-.^*; e*J


P/^A te-,t^;
l6x t l ' (u x 4
B
,,.k{"3Mux t/
)€ \r tA f B / (, D,E , # , 4 , H , I r ! r K , L , M,N,0 , P : t.6 H - !" /"' ,
v
( : et"t ,r'+A - W. ^ve't/.'4- rc Le 3));
u^d , M t / X ; P

SoSl 52 s3
urr-c,0rileclwr-Le- bd1 eJ MU X A II
U

4-
p\

q . H , r.' 1 .K. L ,M ,N, o ,P, "s)


l>*,ocn* [Ar ts, c . D . F , € ,
- l' /f
L/' f - lt l- l- l ) | | I '
i

v a>utrr,Lts : A.\rd - ,G:."u i 7l-


0 . i\-,

b€?t.... /,!
!' t'
Stb
i p { ^ u e r r -, 'o o " o " =) A ;
teT- npl:
u t *4 ^ x z v ^' b o o i ' Lel^^fo: = 13 i
*Q -r)
o to ' =) tr ,4,\^hI : c ;
utyt^rqn^ "no o \ 1 " :) ttv-lr' = D ;
D\ (r r \A tn
rn/L^,c/vr O 116O , k^,".^p'. r e;
tuy4..sr",r v o \ 0 \ t =) te,,w.p : : F )
* o \ \ o' :) Ifr-.i l : q ;
",s4,.t^
"o " :) \-a'v'^\a r : H ;
hn/u/v^. \ \ 1
t\
w4. rr , - ooo"=) t- € ,v- + : - T t
*\Co'l f j
ui41€l\^. '=-) \+:-u-^-lt::
* tc \o"' >) te-{:' K;
L \y'L \f/.\ '(o 11" =) \et""'fr:: L;
{-o-^\-'= ru;
"t1c c '=)
u,5r l..t!1 "\(ol' -) t c , l" ^ \ . : : Ni
t t'
t \ \ o >) \e-+^,rp'-: o i

t ^ . 9 y 'n € zr^ ..'\I\l " a) { e,m ,r i' I: ?;

\t..!'t ar\4 e{,\P:v.l :) Le-wy t > X ;

e'J qee{
i
Att z 2 k-r. F ^P to v',1, ',
="J |*^"*;
--.,J k/";
2-'. 4 De-cnAB-t ,

A%dL
b€

Dl

g"
p"

e,,r&$ D€& r^
J-?c- D: s{^FAJki ^lFA/^c I o to:)
-.-F"'te^'
pnF I A, e, eanJ'{,e : i,r^ AAA- ;
e-J b-ee ;

s:rqLlLe^Jq.D.R- t"el^ Dx{- L8


"1
t e+in
p-,f*-* ( A,B, e.,",^}"(e)
[;"H* *t-", b I'&'H- i"?,t'-i
I"*f-
dJ^L ) elt*a.
'* i
tU*r. I : orekt;
il t\l' tt'P'-
U """^1"1"
ULa'i)
) o ( -: "r...ltit t otb*a av-*t ;
D t 4. " vrvt ( qL€' o'^J U);

D z a: qne'k- ( o. ot-.t'{ U}t"'a-) ;

Dz<>" n e & - (o. Q "-.db);

.L<
\t tl

D(= lltl ;
ily;
e-J P*^unatI
e-J teA;
I i + DrzrnvY.

bo
D'
DZ
D3

e**;9 fu'vntu><
Pt ( zF ' '^.Y:3:), ( r) ;
S : t"ar 4+J - u*.," -vez-(ei-o rc
fT" ( o e" :)
D : $-t-F.t*J - k{;.-vt'-(ea ),
eal D*"r"1\^/r(-;

a:ra-{"rte-"-ko.r- \.,ela q Wv^'wt i>


to3 )
t-7-- Y_
/ 4B^t
n

, '5 rtl ,Br---, h

F+ F4 HA
trz FI r1c
t . }t s

f+

t" 3) ;
S I ot-th A&1 - {.7,te - rie'c-b' ( o to3);

G{r-t- : e-ujt 1l-LJ * XF?IL ) ;


<^^dd^+ t ;
przl.^.ite*}.o..< aA.""^* iA
% F4L
te-v.^b.e" HA
-*I
b*'f t x, Y : Lr, .AIA-XF?^c ; \^D,k \ bdtr 'LrJ-\,.c);
eil c.^"1tg.r".-* e/^J
;
*W trA t"s
( M R, L: e'-^h*JJ-z(nilt);
F".b L, , Q- I i'"''.51d-\^: t
Q)v\1
e-J ryf"^ e-$ i
8-U *h?" -vePS' t o t-o z); d)ur
*?"^^l L
" (-9z'
bfi/^"
8. , s o, u) ;
f*-b ,r^"t fo,
Ho I H 4
( P*r
e4a\r
Pl ... m pth s-^"-f ( Ar ,Br ? Co ,S,r L ,\)
trz' m p,ea} w-na.P( A ,- ,g t, c,, 3r ,e .) ; c-e1
Br ,,L r r s\,C^ ,r J\;
F3 FA F^$ "-not't A r , t"
e*J +trut^t ; QJV

,t
I

b,
D
D
D
D
D
e,
d-
J]L
<lr
-l

C.,C)

r.
-) <t
r)^
t4 <a
).\
t

fz
rn
4
t"

T"

T,
+l

t_
V
-L f 3l

*"..*.{y 'De-t is
'o
' ot 6
u'Y1
: v-, qH [='4 L t€+) ;
I 8-U -kLL -!3-te-\
t*h-k"(
Y, eL* - fo,1._-f"f! 3 r ) ) ;
^rl
€rJ D-"- ;
dJr-cj^i{€:zAr\s Atr'.-,.kj: et bpt- la
24 'D4^e.
( X : \r.'a.H - i€,?ic ; A, B, C, , D : o, "t |s J ' { - b?^' ) ;
Fen-b r Y
er.delr-ugcc*,r.-n"[-wre^^* )

3t D'<-
: sn ^ jrsr d- h"t);
t *,b- ( E,F,G lr t - ' . : . t . A - l e 7 ,..' - ; tl,I,T ,K,L ,H,N,o
.lr"i- c"-t+" i-.{ ;
.n^n*"r- E-n : E-k{^ .,(*i. - vee/e{- ( o to s ) t
tr"cqa.r^r
0 1' e-2' €D3)i
D I : L4 D-€-r-[=,.-b ** ( 13, f4 E*o E.'4
' '
D z: 38 p -,e--p * aA."r.o- t
(Lu, f or r l, s z , Yo , Vl, Yt , \ / s , Yf ,v s , Y t , v r ) ;
D3. : 33pxx_F.^ \.'-+ ( €. r t r t . , Fl , I r - , Yg, Yr, Ytt u, Y, r ,Y r r J , r , 'l \ - , Y r
Dt,. qr Erc<-h".* "'"^ P
(et Lr $, I ' , . I z , Y1 u , Yt l, Yr t , 1t 1, \ ' , Y z t , Y 2 y , '/ r r
De : 3t p 44 lae rA'z'r'.r(t.-f] f . Dis ls . , Y"+ , Yz s , \ , r , bt Yr r , r r r , y , r r l z " l r , ) )
e"^d An'r1r.,cts
;
7 t 6: r M ul(

ell

f"
o
a

b
F
v
t
A
A
I

Q)

I Bit c"'*l>

4p .nsb td- e'Le4-' b);


"1,
/,o
utf <, o \ a ,-A 6" t - - b) ;
I
;

I ('
R II
L
^
bl
AA

4 \L ,{E*.:

a
Br
r-:
"o-
AIJ- 2 ilL)

A-& +
A#- t
S
^c+ a Vtg
W Vts)
Y\ll
!\r.1
tJ.n-o yro;

e^^*ibl 4Vnc Lg
f"*r. t ^,n ,i+!t'/kut
l d y*&?'-
,t1 r,, 4,^,*,4)u: e'4 s^A*W);
e*,tl- 4 A-n <-1

a:ret .\s.l.rru- b{r^ % t Urnc fj


b'^Jd*'
( A, R)
h"J.",*
vc.r..nA.k-V-4, MJ. -e4^h ,&Je-t'+ : .LW*,1a"'");
bs+C,r.,,
='o '; *Th <, W -#4'\^P;
^ - t ^ 4 '-
h el - t c / ' ^ f I = \ o ' ; N r" < r A l L -* P ;
A.IL * b'n'tf : : 'o' .; \e-,b < > A<L-Mh ;
+ ^B i filr- < : AIJ.-e*"+ €{.A€"t- 1r/^+',
s'L kA- ts*'^l';
W-W ::' t' ; *T- < > V -L"r;|,
A"n < = (4-€-'-e"^f);
rf,-S s\3.)2 4L3Jr.Lerl
-eL
q. t A -t=r-F: :'l'I "-J F* *o ;
eU./ +r>)P Bt, s^€- a*J Leh ;

1 o--l' 2
Y
J-'xi-l gel > Su +t!c^^
AJJ"- & "^{'t = t 1' j
d"rrLAU) ? ts(]-) +-tva^,
W -ie , h ^ F : 1 'l) 'z
.lorl B\) > AtU tt*,,
t,'
-t.^+ I =
AXJ" -
.LiJ A\'o) > BaJ +l^f/n
*AL- t"^-1,
: :'l',;
B(o) 2 Ato) -$R'1-)
p,l"<U,A&h
_{?,^P:=.r, j

-1"" A<J"- iev,.^f'. =' lt )


Ml ;
b" DlD2- D! X Y7
ooo el X XO X - D rts ! * D :
too o 0 ol
Y : D, D-JDg * D3
xlo CI o dl
xxr o Z, D' DJ ur D g + D , D
t
\ ot
XX X I I 1l + D ' d+ D :
e"Jdt-d Pe t:
Fa^,b ( |r

er.€l. Pg ;
,*r-.^t F

alcli{s-t-ke.x- @\ PE t}
1(
Cn1-jaer.'^er^b f
BC > to Ex-oe-a -3

r
F, -*program for 8x3 encoder
l i b r a r y i ee e ;
D,r u s e i e e e . std -1 o g i c-1 1 6 4 . a l l ;
D3 entitv e n c8 x3 i s
port(i : i n b i t-ve cto r(O to 7 ) ;d :out bit*vectCIr ( O ts 2) ) ;
end enc8x3;
architecture beh of enc8x3 i s
begi n
p r o ce ss( i )
vari able a0temp, altenp, aZtenp : bi t :
beqi n
i f( i ( o) ='1 ') then
aO te m p ;= '0';
a ltem p := 'O';
aZtem p := 'O';
el si f( i ( 1 )=' 1') then
a 0 tem p := '1' ;
a lter n p : =' 0' ;
a2 tem p := '0';
e lsif( i ( 2 )='1') then
a 0 tem p := '0';
altem p := 'i ';
a Ztem p ;= 'O' ;
el si f( i ( 3)=' 1') then
a0 tem p := '1' ;
al"tenp : =' 1' ;
a2 ter n p :='0' ;
el si f (i (4)=' L' ) tlren
a0 ten p := '0' ;
al"tem p ;= '0' ;
a 2 tem p := '1' ;
e lsif( i ( 5 )='1') then
a 0 tem p := '1' ;
a l"tem p := '0' ;
a 2 tem p := '1';
e lsi f( i ( 6)=' 1') then
a0 ten p := '0'i
al"ten p := '1' ;
a2 ter n p :=' 1' ;
el si f( i ( 7)=' 1') then
a 0 ten p := '1' ;
a 1 - tem p := '1' ;
a 2 tem p := '1' ;
el se
a 0 tem p := 'On;
a ltem p := 'O'i
a Ztem p := 'O';
e n d if;
d(O)a:agteilp;
d(L)<=altecp;
d(2)<=a2tery;
en d pr o ce ss;
en d be h ;

Page 1
B C U to Ex-c.'e-a-3

Bo Bl 82 [53 gb €, E2_ E3 Di Dz Dl
Do
oooo ootl oo rl
,oool ot oo o) oo
0o(o of ol I ol
I
oo {1 o t\o O lo
0t rco c t\ 1 o I l/
t ol lcc)o I o0
O (
\o ( oo I o or
o \ \l t olo o lo
\ O Oo to tl o ll
t 0 ol \IO( .) I oo

w=
q4B
Fa
BrYs
oo
U
ot
'U O
/t lo
O
*x5
F-n
o It l\ t)
%-x3 OoO /( /o

fo I
rc I /o
o1 o lfl ffr o1
a-a
ir) o o ol O tlo
,X
ll X /r Y xi tr F] (1
#
rlll
A X h
td
' .1/l X ){- ,.- o h TU
I o
^l
x
^
D+ = 3o * Ez&tt8,8.. DB
Dc= Eri. o ure..
e'*ttV iA
"1 E2 clA t [,^ .5U .fin'c-; 'Z : eut .t-U-
p-A* - -L7rr'c);
? rv.d q ;
o,xrLik-'U"az. LRA / "^R"li h
(+iB,(,0);
W 4- W ' ts
.btV"r-t P--e; nt-.z't ' "'4R"1/-
VF'
b*if-
S-p^*t ; ( c'(R)
/,noe*s
4^
L]-U*- = 'o' u,'e""
a
= n-&;
/ -r\ t
Mr/ ;
e^r{t'%ex*si
(P-*, E)
c--f+^f : fw@-,,s
Lrb
La+e- lf -.?+ (b
U,>Lq-, A z 7
.E z'l ' u " */1
V
Z 1"o' ; N- Pt 1= B;
e ,U. eil E = ' o' ur a* 1
z<r'l' ; N-A t <> c'
u.\o{il ;
uol"t^ E = 7
LI E
I
2 <>'o'; N-.vt< = D;
oLr* y E *'o' a,,R*,
a
z<r'l'; N-rrt<>(;
err.rrLi] :
(J'
vYt.'naa L t 7
fl Ez'ot +l^te/v,
0
Z < ; N- a. t < > L; (
^ 'l'
r-l t
,J,r*i,l
a
E
* o ,;
'u^4/"1
I
z<z N _* t < > B; e

dl; a
.relrw^" D = )
t
l
u E r^o' u-r2"1
{
z< >'o' ; N-'5't<=b)
I
e,l* ,tt E l' U^err,
( -' 1

z< N-& <> L; rl


;
-'l'
e-rA,)/ : t
er^),
('
@,/>z )
,FI
e
e/vst c- ;
f+noe.u fa* e
e^^/ L<A'
t
'l
a
I S q L.rer.lee. D+j<,c/e<- | o/
tf

I' n-e>e-t
g.-&.
3l rteqp'e.n z b)ryahafu ueLth / .
U
EL 2 ,re-7..e,4/x, 'Ar@& @.d.h^r/r.Lx'6 ,,ri% 1o .

),/n
J t"t

'l ,
{ u

{{-
.a{ I -;' '|J
t-
t l^
I IU
clu
,t'r'U4/ e*Iry A
N L E, (lk : tt/, 04- Z : e4/t .s.U- -r{n^'.);
?.;
e+^ee1ffF;
a;.atik-c-b'-xx-B*h / ry*tt
Vh* q t r - y t q-A u (su ,s,,sz)i
uN t'-,'^t :flry*-yy;
ry
6- , cx,s ( r-Lk)
f^Af f,
\bt1i4

v LtAu' o' U^xrr^

p-* q-e ; 7
e"r*t
-:/ ;
,t^A [-+a c:.x;
I
L - W ; f t ' nec'Yt (t'-*reS
tl
'l I

ry
U.rl-e- b- r*+ A
,
I
Wyl.\t ., S, = 2
t-J 17 t 'o' A'\82,
a
2 { z 'o' N-r>t 1z 9')
;
J4 4V E te " R/ ' n
-'l '
N''9't (= st)
Z<:_'a' )
?"'d A '
u)
tlvlrrp^ S t =)

€ . 'o' tt,a,vl
V
z < = 'o' ; ' ?-8t <> S2 ;
el'rc t/ E n'/' U'a*,
z< >'o' ; m-9t1= st)
dl;
,t*'{rar" I =)
Z
?-W
VE
Z <-z'o' ; n- r r t 1= S"t tr
Q*\/
ob. it c: u' l' U"4/")
(
Oat
21zt,';'n-vt<'3r)
C>vt
* ar /;
F*
err-( @s er\.
a^d
tre P/rs
.-f*; eLI
eurJ- fuA ;
fil
ry
t-
f":
9tt
UA
I:
4t
UA
Tzt
4e
L!
Tzt
Crr-l

l-L
I + - BLt Lwn*erv
ft

f ^ lq
r---- i, | , i --j ---
-lr e.
, L- - ; $, r-L l t q
| f Jt
---D [ "- *l -I L-
. i
f
'f)
r
i +' Ta
if
!1

il
--q_ --."-*--""-s" I
t
. ..!
t\

Fo 0r
1

e4rrl-"Ifl cl b tA

ry'( qb; uxrb, Em, Ln A.u.-fi;.; 0i (ous))


err\-l

axoJ^i&^..A*tz /*Ua/t V d C+b t6


u
0r',".he"ttre TPF
' g ; e,lL */-J-A^')'
(7, *, ct)-t Ea' t^ ,s'&1-/s7)c-
w
er^Ar*-ryr'r,r'^L ;
et( t-bn+.' &u-,vL;
el^4 q--+-".'*'lc,
elk-r*f : n'b(-z{1n'c- tu'64" (oW>);

t-k-np<" '/' .;
f": TpF *ra.f Lt
P# -k, p, Uk, cln, E rq -fu/ Lol);
9 ( r l < 2 c 1-U,n pLa;
UA^ qf ro) I z 9- {t'wtf Lo)i

I , : TF+ (t-+r,ql, & - * fl d a - ,E n ,q - M p ( u ) ;


- ;./.-o l
qV) ( r g- aaf ut ;
UA- Lcnt'ttS ( = I - ++-'ut'
trt;
Trt TtrF lr*-+ ('(.-tu1",c/*-A-/(Dt &, fat q^M,l,tz));
gV)<" q - ' h, wt hDj
g
t' lU < ; -@ t' cu;
cLl<-b',,4
TZtTFf ,n"/ C t-fut', UA-t"*4le),1(..l-/&r9-*,"',VtD);
N
er A *ttl'*ut ;
1 -EJ( f"r& - MAcv

F F F
A fL A
A fr

!t

Ca&*
u*.
a^huy }a{u,v
of'A,8,
,* n
n*J-Jbf; e^J-{&+-.!*fruy;.-
l'*.{ ,'S',',:,:1)air;'l- ry)i
b,
"-J l^^ tt
sxcj.*-$q;h.','e*s**l *{ fu 4 bv\ tT-
*q
.**$*'r-'f Hory- ^JS;
;-*r',
;;nfi^,y);"1 *H - Y')'
d$ I e'rt'
e--J.*^^pr..*t ,
^'
"
r,v {r"t"t""^i k& "J..'"f
f'l-e'*p-,a*'; t) c: *'/d' ;a.+J-lY"*)''
&;;
f^r^t tL,A'l f ''-
wd s"\l"*'*"t ;
c , e M- I^yit- ue**e'lto+'2-);
^w_ey\i}
f .t
*"",+ ( '+o ' s", * o ),
;ri A,l'l- A,l'/stI":* ''3o
,J"^ oJ
Jr- ' | ^" *? ( A ,,b ,rc u r ( 1 /
c") ' '2
F,
rr# l" & k
a' I At,S> ,9t,t r)
{ :, , 11 , C,
>t
..-
\ [ h : ' S g ' C' , S.i , C6*I )t
Pb I

s"J 4fu^l13^tit
T-
+7 -I*'-
I a v
'r
*ql*--+

(l'f, r-- ri*-


rh
'l
4 T* \lI
Fj
*- ' !.
*t Tl
i
rt, l
oD

= f-o;l "l -
=\
\ - .- * J
't
fi"-

-*"^^r*1
| 4
4 5*,
F-'

\.r
\

t->
f e1r':
PfL
xu
={t
.cl (\l
K$)

qI
"bt
5l- (*.-+*
\l{ /,

+I,
et
J
,t

{ f

ry ,
?

Xrdt

93- qe
&?/
9r
\1
w1
4o
q*-
r7A
t<d{tr" .\ i--n G.t j
":u I'
*
:t
**@a
t!
aq
,
B:-
Xg

6!
a
&fo

#"t
*r &*r$o \f ,$,

l-x'&
4 Bn+ e*.'t e\

;c l
o
Lor

*rrrQJ>
1eM

t!
I xt- izzv\if
\Pl

\"'L*

v 7f 2- l,4t o;', ' \

Bl
Ar
+1, fl5 ( 44Ao
h rb t /t-r tj-o t) L-
LL al 1
b&^J<_- C€.^"^-[e4

(l<- D fs--B C- D D4 4 D. DD
4
ce-'-e---e-'e e>-e-=-< I ootoI
&o c , - 1 t O@tt:
oo( 9
I
00t i
,o o t o , @ c9t
ol0o
Oce t1 o{oo
o lo o o1()( o, l I
al
o 1o t o 1t o o |
I
o
1 |
O t(o o tl a tl n
t t o oo
o t"L r: 0
'l"oi 0
o o 10 c1 1
to tonl
c> O oo
La o I Dva

L- 4.\
.---l
R{ X g -X-\
vl /n""'1
z
V-l
n x
\Jrr:

(y \l
-l b4?
[ ', ,

'*_ h
I ")WU
\\
y-\
co*d,- d/
a*
Ut^

Ct^1

lS /a'* e
3 A'e.-to o
4t (!_N-
\ 4Ljxs b <<

2( ..1
>

v f-A-L
7
s ea
&h I I\\/\/A
sa-
Jo 3 r
g--e
,--@
|

5-
5,
5v
_t
:_.-.--(jr,l tTrtn \\r)
D c ,){ - !.

- i i-llJL:!lt*:s
I QL"llll l!,_.\rillgg Ks
.,,nj , , ' rn ; r pa,n < J %
313
I U nct:)n s rC adf r O f n
ryfL 4 t^b rr
rod b_.si a rr;ng wit h ilfl
rFfl
EA.*j
counr,errtG;@"p*
(t2_1) A' = D, so.theD
inputmapis idenricat
I::"-,:]":fj:fl
map.Thercforc. rhc,.:r1r.*irn w,itht h e : x t - s t a t e
[or /.)cirnlr. ooli';rfi;H:l;l: -
lhc c.untcror i.rg.ll..'l..rirc 0 : a p .F o r
cs, lhel foltr*,,rg.qultion, can be
mlrpsshownrn i.'rg.il 4{il)j readf.romthe . xt - st at e
(t2-2)
l ),, l ,= lJ Ii ,, ll'
-,,1 + I1("
ti , ('' l (" , lit (' ,1/ i lt\
' fh is
(t2*3) lca d r to l l rc nr:{r,,1).h \i j ()w t.l
rrr l .' i rt l J i i ri si ngclockcd
l) ilip-f),

{12 4) ,', I
!,'
i
.L
-""---'
ll f""a."
(l 2-5) I II;FI
t)
,,1
I
| ii
l iiri h I
yF.*_-J ',
I
Yj
(t2-d1 L/--\
tt\
tt!
i t!
I ttl

ttl
-*l),fetrint0=0 ; 'r--;
rinaring Q Equa_ i (
,,^\
rP for Simitarly, j
-r.
lll of the (, * rnap rl i
i\
I F_ - .=\

:drcared bi (t2_5).
- - +- - - _
F r g r r i.: l2 ,li
forflip-flcpQby co u r tr r o l F r g l,t r ' 1itlq a) |l{ i ;i ( l l j J

:
I
r: :e. / an d K a r e
#|
ittl
l2.z
Design ot it C*rtlc COnvel't.,er
i o op i h c l l r o n
j,ll:,;::;'i.:i::jjr ltri'ri'.'iif'r c.rr'rt:,'t:,ini,r:arrpri
llf t \ ' / of k J..l:'','1
whic it h ;rs ir ,,rlr.ijij irt lse
tcrJto
unl scr.ll , t i; t
i n F r t r l f 1 3l i r i l
t, : op irc i /l r on cxterriat
inpirs.i.,,,..,,,,ir.i,,',.,,^r,.i,ll',i,i:,,.,i,;ili:r]::': her
i,il('c.nir:rrcr rrr:i,ri
:njit:: ::l "" ..,;- .l
t,,,,, '' tir,j,'
i i l ' :r,,f.'l:,
r ( ) L ) sl i l l l ,."tr'l:',;;tl,;tj;]"tt,l.i;;;j_l:,llJ:
l l l l l - i '. r t t l r f : h c ] - t t " 'l f -., 9 r s
s t r - lr c d, ,. r, tr1,
, , !. ,/itiri,lr' , ,r r" 1
, ',i 3, ,,', , \ j 'r i 1 digits t) ihrou

;:[:; ;*: ll'+j:i:;i,:,,ii*i,'.


i r i r r i l c t i . r ; l i . " f l t l l j llr:
:i ( rler Ii tC sl ,an_
.i:ilsary.{?) The
i;I;;;[;;l:fi:";:l;,ffi:[:'i;:
yertcris giv.e'briTairjc-t.t
i";:;,,;; l'r'il,t
:if'::,,
t : thc
t l t c ne*r,ork,
n e l r , , , ^ r l . the
r h o ,correspc
. : : : ^ *. jr ng
rl Il -
rtr e Jq a n d Ko inpr:r
eoriarions, and
ir.,...,,,,i,,'i;;,r;;i' i- K
the l-li r(l r;!lrr,r, 'i irc ,:ircui,,t'
ir:.:;l;:;l';1.1i."fXli;
1,1f o
lerile i,; irrrri;rltr,
i,r.,.i,^^,r.^ rr..n
llL)

iEsr-E-

ary
t

I
I l
,}
ri
:J
iI
.g
,f
I

-;::.. fOr :be

coUn'ELs--
3 r{ trIT 12 --

- a a e '2 -8
5b:e -id€ for Cod€ Converter
trz_
shift l
0000 0 A sh lt reg
0001 U
TlrisnumLr-
0010 0 t tl u l -
.h :i '
0 t) I I 0
0 l tl 0 U type, orts
0l0l i lllust r at esi
0 rr0 I init ii I cont
() i I I I il sc(on(l p
lOuu I ,'cgisrr t()
r i.:rrint
l0ul I
, hc r 'r put t
lr y t l c shr f t .
'lt Jl- 1i. . r 1, , ; r r i: nPu:
,l cloclcd I i. . e st t le
,ftd.
'l'o
lr ssu-
i.

AB JA ,. X't gl ()l ll l0
g) 0'ill l0 ,r f st at c of t
Jt, I I x I
t-{) 0 0 x I * 'j'_ V l S C . 5!v C l r
Ui 0 u I 0 nt o t nc illP: : :
{rl 0 I x I K 'D r he
0 x , lclr ', . . , \ ilcr
!'_ 0
71 I
tl
: tL x x
JD IU x x
I
I
li-- I

r0 0 1l x
DN
A rril

Jo = t.l)
J6 = I)
Alr :' (

A, ' i) '
, I)
r D*
K ,r= o

'
A i ," I
m
tl
ii_ S' di'115.
: : - oblem

_l _
l]_ ou t put
h r r hich
.\l rrl t r ns r rr t d
,. I K t ltttlri. : ) c st . it c
A. J\

1ucr r l; ai

I
L__,

I -
***1
S hrl .
Convcrt p ul rc r
pulsc tpure 12-l3
trgure12-'l2 CFIKRight.!lrtt Ilcr.;i:tcrr
g:D to €xces'3 CodeConvertet
n/__J 0t' sTA'rll(;lt\PIls,,\ND
DBRIVAT|0ll T\nl,lls 359. I
I

'ms for the

ffif l1.l
d f, Design of a SequtnccDet,ect,or
T ' o i l l u s tra tc th c dcl grt of .i .l ' .rc!.cdi rl trrl y scqtreti ti l rlnetrvork,w e \\i l l dcstgna
'lhe
dctecior. nr'lwtirl'hrs-1iTffiil-iil;;rn f,S'la-f .
scquencc
Ilu $Tt:lrs--
'---.--

r-__l
12,
r-l f- - ,'
L__.. I

ihifr 1 ( i ,rl

F(lure14-1
sh ft reg
Detcrtorto b" Dt-,'grcd
Sequerrce
Lis numLr.-
, t(' | ,r,,r-

pe, oits
The networkwill examinea stringof 0'sand I's appliedto thc X input ind gen-
u s t i"at e si
eratean output Z:1 only v,,lten a prescribed input seo.uenceoccurs.It will bc
it i ; I c onl pulses. we
assumed that the input X can only change betrvcenclock Specifically,
sc(dnd p produce
in-!-0!will an
willdcsignthe netrvorkso th{rtirn)'inPtrtscqucnccending
b'.' ! ' t \'
t rirr.r tzr
I lcmn g output Z = I coincidcnt*'ith the last l. The nctworkdocsnot re-sct when a I
E i . t p ut 5
outputoccurs.A typicalinput scquencc 3nd thc corrcspondingOutputscquencc
' ti c shifr
. th. .^^!,r flrc
P ' li( )l )\;l t " "Yul
tl tr c I L',1I'
tt c s t at e X: 0 0 I I 0 lr0 0 i0 l0 l0 0
a'
| () ils \ l l
' n ^?
Z.= 0 0 0 0 o ro 0 0 o 0 l0 l0 0 (1 4 -l)
rta t c of t (rime: 0123 4 5 6 7 8 9 l0 n t 2 t 3 1415)
i'C. 5!. \'Ct-il
Iniiially',*'e do not know horvmany flip-ffopsrvill be rcquilcd'so wc will dcs-
ii thc t lip ,,
<e t he ignaterhenetworkstatcsas .tn,S,, etc.,and latcrassignflipflop stalesto corre-
a ; . . , \ ll cr
spondto thcnctworkstatcs. Wc,villconsiructI statcgraphto shOwthesequence
oI statesar:J c:utfuts\\!ric]roccrrrin responsc to diflerentinputs.Initially,we
will sfarf ihc net\\'L)rk in :t rcsctstatcdcsignlrtcd S6..ll a 0 input is rcceived,
q we arc lookingfor docsnot
thc nctworkcanstat'in.\..stnccthe input scqtrcnce
start \\'ith 0 Hou,evcr. if r I is rrceived wc must go to a ncw state(Sr).to
"remember"that l.:e irrsi input in the desiredsequence has been received
Fig. la-21.The labelson i:.cgrapharcof thefc,rmX lZ, wherethesi mbolbcforc
6 1 . 1 1 ) f tl t,
,rhc.,lash is thc input ,rnCll'.: s',r::rolaitcrthc sllsh is thecorresponding output.
:robiem
ourput
h rvhich
rl ts rrr. t d
l c sl i tt e
;u crrt i al
Figur e14- 2
i ---
l"_

(rJ r9t (]f!


300 Il N fl t4
um-
W h c n i n s l l tc .!,, lork
i f i l c rcccrvc nol
(.1 ' r)to rc l rrr:rn l -* r
tl rl rt nrusl changc to a rtw new $rare
rcicived.
tl re f i
';:::,;::,'::''.i:::: ll,,l,,ll.Iliork
l l Jrl t(r 0[ l l rc w ;rtdtt
Jver,
rr ; ; i; n statc S\_-
tl csi rr:d scquencc
. - r - - " ! e (l
1 rt))
'r 7 have
t t a v E been
', tttl
h cad
Ae^-:,,
s i r e d,
o cen c:ln
rheourpurshollJ d
bc -
seguence (l0l) is com- input
slJ:",:rg
nould
\tl .tc (,r I'J.,.:,T',,nu
th c n g < >l o ;1 y 1 ,;11. iir.,
1 Trre ^.,^^.:
Jr,l,il
., .si,rcc :;"Jfi ;:l
s u p p o s e dIo rc .i (.t jl;::1.:" ,,r.!,
i r h c n :rr r r]sl i \rrl ;;;';;.,;:,1,",,,";:l
l:,
stttcc lltc l;r :,i
i r lr .r \r ,lr t( .r i . '':.,;u:- go hack,,,.s,,r.i,*"r.,.
\. (.u! ;].,:,
r1.,,, ,.,,1,,1,,,
1.,.lJrr.lrrrl I ,,,',,
r e ttl1 1 ) { ( ) ,\, ;t.r
r tr ,lr e ;ti,r l r ;r i tr. ,,.* r;:;,;jr,:.t;.J,|l
ij

''z^.
. / - 'r
'., / ..r/-\,

-{ '' ')
z--t
i 1 'r/,, 5r.
\--l' I'
tigure l4-3 r .il

3t e
her
Thegraph t'*
is:rit incomprere.rf a r inputoccurs
fablFrg.
we canstayin"'s' since
,lr ,', whenin states1,
rhe'sequenc. ir-ri.nply. nes
state.9,we havereceivccJ *r,"r,"a. i" 0""0",
,*,, 6,rin o',n* occunin :n
mustresctrhcnetworkto
i:llT#_i',Hi 1:,::t,r.," .r",i.i'iniul'Iou.nce,.and
"nO rtate
going
tooneorrhe
c,rher
iffi
li.l"i*Tirilfl*{f;ix
,f.J,J"*l,ily,{.!ili:i;:ff
j;;;
rin.,,r.p,n i,;;;*i"Ji,n
;;',;',j;i:#li:Jil:?;1,;j,,, r,*,ofcnrry

Figurel4-4 rl
Mealy State Graph.for EN
SequenceDetedor
tcs
ph
StateSu is thc sti ls
tras
oeeri thata scquence
;;il'illiffj';,,]j;ili,;l',j'1''o''r enciinginr r ll
'e"..i'.,,,
rcccrvcd.
An arrornariu. ,t sc(tucncc
cntting
in r0 rras"ucci .re
,u,,u',j:;;::';;::::;ll

*L+",+
labeiedl/1. Thismeunli
tru;::fr
l*t#:T,i[i:ii*p{'3i'"'T"fi:
o'i;;.,; ,;;:,:.^::'n't'
thc arc berween
sr .na-i,'i, vo
outputis l. This , ot*'no'whenthe prcsent srateis s. andxl r
thepresent,
.r,,,,o,."i,';;;;;:1:;.::'::::il:i',.,:]:"asxu"com.,.I,,hu.,isbe[orc
Att th
A this
is p
p.rint,
()i 1 1 t,w in tl
j -t: Iri rcco tn tlrc.9.,
tc.9.,row
row of thc
thc'table. :
wc c .rc
irrc rc,rrv tabl i .
aes
.
c,inea rt:;rrtv;:'
t r',il.',*,,.T; ;.,"rtir..'.",,r,::,rn.;_.
,{a..r....
lltrtced
fi;.i#,;;,ili'i:, l ".*, r*,t: I
I

________

ri.
:, ;$
\ \
\
t DBHMTION 0F STATIiCR{I'I|S Arr*l)TAltl,tlS 361 ' . 1

Tabre14- I
f-;tate
' )een
orn- il
N,:ttSt.tc
It rcrcn I
()urput
l,rcsjnt fi
lork Sr ar c l l . \ *0
- ----*-*it- --
. Y =l X-0 X *l
not so so sl 00
Ii
s, ll s, s,
lverr
can .s:
'
So .sr I 00
0l

llip'l)opr,rrt ;r,r',lt',1
l() rcl)l()scnltlretlrrccstrrlcs.
I)csip,natc
thc lwo flip.flopstrs
,'1rrndlJ. Lcr lirp-l)rr1rstatsszl .- ()./J 0 corrcsglld to nctwork$ntc Ss;,{ : 0,
*
B = I correspontl to,S,.;rndA = l,/l = 0corrtspondtonelworkstatcSr.Each
network state rs th!rr reprcsented by a uniquecombinationof flip0op statcs.
Substituting the llri'.flopstatesfor.l,,, S, and S, in thc statetrblc yieldsthe

T able14 -2
C
"l)
sin |-, ! r- \ : J
late :t) trl 00
tl l 00
Iabl€ig. ,: 0l
ncs
.rt
Frcr:r
for t hc

\X (l
A8\

{t } 0 0

0l 0 0

X il x
n
rl
cn
U ll) 0
U
/1 ' - ,\"Ji 7.= X A
:es
ph 'l
l tt' l l rp -l l o 1 ri ttl l rti si u ('l l tr' r) rl eri reri l rtr111 111..'ncxl \tl l tc l nl rpstrsi ngl hc sl rnrt:
ls tn c l l i o tl l l l l rl rr' ,rr l ,,rl l ,l (,)r,rl l (' r., i l i ur,' l r,,ril )t)J l l l ) l l i gl -l l ol l sl trc usc(1,
nt D ^ : A ' : .t* l J a rrtl 1 ),, l l ' . .r. + hi ch l c;rtl s[o t]rc netw ork show n i n Fi g.
re l 4 5 . l n rtta l l ), \!c \\i i l re - rt l rotl i l l rt-r-l l trJrs 1u l l tc /cro sl at0 B y traci ng si gnal s
th rtrtrg hth c t' tc t' ,v o rl )' . ()i r, i n) r' r' l i i t' l i trrl l ur ()tl l pul /. = | w i l l occur w hcl t l rn
or i n l l trl s c tl ttt' rttt' r' tt,l ttt,, ttt l 1 )l occttts. Io l tvrti tl rel rrl trrlfii rl sc6utputs,i tl w aysl el rtl
ro Ih c v :tl ttco f' Z ;r{ ' tc itl rr: i n I ut l rl rs' -' l l rrrft:dl rrri j bcft' rrcthe cl ci ck pul se.
362 urm t4

('lg L

Frgurel4-
Moore Sta
Fg ure l4-5

ls similart0
The proccdurcfor finJingttlc slrle grirphfof a Moore nl:rchtne
that usei for a.Mealy machincexceptthal the ou put ls writtenwrth the state
slatcs Wc will reworkthe irrcviouser'
insteadof with thc tritnsitit)nl)elweerr
ample as a fv{oorcm;tcIinc to ilittstrittclhe nroecdure.'Ihenetworkshouid
tt:curred
p ro d u c e a n o u l p t)t r.rl i 1 } nl f i l l rn i rtpr:t 5i :(l Ll cncfcndi ng i n l { \l hi rs
cri l l rnl tchi rreup thrt;ugi i l he poi nt w hcre
T h e d c s i g r:i s s i n trl a r' l c rth a l i or ti rc l r' 1
w i tl i
th e i n p u t s e q u e n c (1l 0 h ;rs gccurreri c\ccpt that 0 output i s associ atcd
s ta te sSo , S , a n d 5 ' r:

,,eG)--q
l"
O
musl
N o w , w h c n u t i n p trt ()c crl rsto c:ottti rl cl cthc l 0l scqucl l cc,the output
a new S l ate
b e c o me l ; th e re fo rc ,w e c a n not go back l i ; state S , and must crcate
5 3 w i th a l o u tp u t: Tablel4*z

We now completethegiaphas shownIn I;';9.l4-6. Note t:tesequence 100rescts


the networkto So A sequence l0l0 takesthe network back to S, sinceanother
I input shouldcattscZ t o b c c o n t c I l t i ', ; t t r t
___5
pgR|l'ATtON
0]'ilul_q&lr,ils ,,r\t)| \ril,rjs 363

figure1a-6
lfoo.eStateG.apt,:._

Thu .:., r)('t\,()rlis givcnby Tablc l4-3. Notc


tha I li. . - - I .c r;,. .)tliprrits detcrntiitcd
by tir:
n_,..
. ., - ' '.
..
l . c [ ] i . r . r n t i r r r c x a , n p l e t h e ] {O O r c
.ri;.riI ntachrne which detects the same
I .-....:
rr')put
gure l4-
bore Sta'
Tablet4-3

l :rnt

ar
rJ

_t
;
bie 1 4 -

Si n c c ti ,i rc .-: :--.,:r re\j * :i ed to real i zethe netw ork.


Us i n g th e Sti l l e ;S .' i 3:01 forS ,, ,B : i l forS r,and
A B : l } i e rS.' - ..r: ' r rhe r)rp-fl opsresul ts(Tabl e 1.1_4):

Table14-4

*e 14-t

The outpurfunc(i.. $ z :,rlJ'. Nt-rrerh,rt/. riepends


only on theflip-flopsrates
and is independenr of .x, whirefor rherc.rrespondingMialy machine, z wasa
functionof x Deriv.ticnoi rhe flip-flopinpurcquarions
is irraightforwardand
will not bc givenhcrc.

d
II

364 tjNil' t.t

tr4.',e
More (lornplex Ilesign Problenrs
r . \ f sor nce
i. -: \ ign! 'd a!
lrr tlrissccli.,tttvcrVill,lt:tive;r sl:rlt'plr:rplt : : : ; , lt seque
firr:t sct;ttcttti;tl
nctwrtrktrf s.mcwhirl
conrIlt.rrivllt;rrr1.lre : r l em pt ing
Srcrttcr r)l!.\.1(,usc.tlrruplrs..l.lrc
trclrlorl to b*dcslgncd
hasthc fornr aguirr r l \ cquencc
'h,rw'riirr [iig. r-r r.-fl,erutput Z shourdbc l if theinput scquence : r t cnt . We r
cndsin cithcrillil ,r r(x)r,;tnd /. sh,rrrrrt bc 0 orhe^vire.Bcforcartemptingr. t rD' i^4.
r lr r r ir t lr r ' r r ' r ' r . lit lr ' , " * i i l , , , . r i . i , r r i . , {}r n L r, v p t c ; t r I'' ree'

urptrr-r)urr)u[ \dqucncc\ l(;


t t t ii\ i. lt r t ir , . , . i ir : t , , ! . : i Ll i . . . t i r : r , l i . t . i . 1 r r r l r i l l lo l
t l t e J l r , , b l c t t r . , i i t t e l u u t i t . Wc , , r i l
t ic t c ilr r r r r c I lr r
' lr ". r r , . ' , !r ir ir pi i l . ( . ( i r i ( . n (r . l i r r t l l c l i r l t o w i t t l l i n p t t t s r , q r r c r t c c : i , J u rr' I,

\-ortI{ij(rrr I 0 0 t CI 0 t |, 0I
.1 I
I
+ +
I I
uh ( _.:r,.elooki
e f
/.,00 0I 0 |0 I |0 0 0II o I 0 0 I .,1JsoZ=
At point n, lhf irrlltltsc(lucttcc a :rnentdo
crrtJ::
irr t)10,onc <lfthc scc;uencr::i
we are looLrrrg ..'. At poi
for, scrthe .ufJruris 1, l. At pr.ri'rrr, thc input
-. agai'cnds in 010 so 2,, L .: ._rI outp
Note thilt ()\'sri'rppnE scqucnccs urc rilowcd rina t-h,,problcmsraremcntdo*
not say anythingabout resertrrrg the networkwhen a t output occurs.At poinr r scquenc
c, the input scqucnce endsin r00r, so Z is againt. why ao we havea r ourpur -: and Stat
at pointsd, a, andf? ', 'r start o
we will srarrconsrrucrion of rhcsraregraphby workingwith therwosequenecs s \\'hgn.tt
which lead to a I outpur.'fhcrr we will lutcr add addirional : ar Weaf t
arrowsand starcs
as rcquircdto nrakesure that the output is correctfor othcr
cases.Wc start off i: r r-eceive
with a rescrstateso which corrcspondsto havingreceivedno , : rlput
inpurs.whenevcr f or
an input is rcccivcdwhich corrcspon<Js to part of onc of the s€quences we arc . , : cQ U€t lC
looking[or, the networkshouldgo to a new statelo ..rcmembcr-
havingreceivcd l: , g in 010.
this input. Figure l4-7 showsa partial stategraph which gives,a , : . r r r ling
r ourput lor in
the sequcncc010. In rhis graph s, corrcspondsto havingieceivedu ,.q,,,,n,.. \ \ c CAngO
cndirrgirr 0,.t,, ro il sequcnccc,ding in 0r, an<Js, to a rqu"nr. cndingin Ortr | \ e{luence
Now, if a I input is receivedin statesr, we again have a scqu€oce
endingin i /o11{ p111.
01, which is parr of the inpur sequencewe are looking for. Tbcicfor. ,".
."igo
backto starcs, (arrowc) sinces, corrcsponds ro hivingrceived *qu.oi,
ending in 01,'l'lrcnif wegctanother
0 in statcs1,w0go io s3 wirha" I outpur.
Thisis correcr sincethesequenceagainendsin OtO.
ll3j: scquence
roccvcd
So rcrct
5r0
sr 0t
sr 010

|-_-o--,-'
(/;*-
Figure14-7 Ll Fgun l4-9
r

tllltrllirl strU | (;i l \t,l ts-l \tr


'oi _!lt
r\1i l ,t.:s 3{; il

I xqlgrlrr i|ll5ln
sa rc$at
-tr 0
.s. 0l
r.l I somcwhar tll0 or I()
.:,..igncd I
again t. 100
:'::,,t sequence
'i
: :r:tcmptjng tr. --
tO l \ '': , '\
ll rt ' Q U C D C C S rrdl 1'
'/Y
l0
c: lrnt. We will l --'

l, ?' ice: Fiqure

Ncxt r'c uill c.rrsrructthc pirrt o[ trrcgraprrcorrcsponding


to thc sequence
lfi)1. Ag'in w'c.strrrtin rlc rcsctstatcs,,,and whcnwc rcceive a I input,we go
t. so (Fig. l4 8,,rrow b) t'rcmcmbcr thrt wc havereccivcd
the first I in thc
scqucnce 100l. Thc nextinnut in the scqrrcncc is 0, and shcn thi-s0 is rcceil,cd
,_..r,-elookjng
shouldask thc questior:Should\\,ccreareil ne\\.staie
)ilso Z*1. .we to coir.cspond to l
sequence cndingir; 10,ur ciiil \r'cgo to one o[ thc previousstates
a :rnent does on the state
graph?sincc.5,corresponds to a sequence endrngin 10,ne can go io s, (arrorv
:'-'. At point
c).The lact that rvc dirin'rhavean initial0 rhis time doe.s
,: e I output not rnarrersincel0
startsoff the sequence wc are rookingfor. If we get a 0 input when in sr,
the
input sequcnce received wiil cnd in r00 regardlcss
r ,scquences of ttrepaitrwe took to get to
s.' Sincethercis no srateso far corresponoing ro the sequence
rs and states 100.\\,ecreatea
nervs,.iteS, to in<Jiclrtc huvinqreceivetl a sequence endingili 100
Uc start off
If rvcgcta I inpur*'henin sr;r{cs,, th;scompretcs thesequence
5 \\:hgngyst r("ilrandgives
a I otrtputas irrdicutccl by urrorvc. Ag:rinwi: trskthc qucslion,can \\,cgo
ir ra5we are back
lo onc of the prcviousstt\t(.\. or tlo wc iraYcto createa newstate.Sinccthe end
Ir c rcceived
of thc sequcncc r&)1 is 0t, and s, corresponds to a sequence
.)ulputfor endingin 01, we
cirngo back r. st (Fig. l4 g). rt wc gcr'nothcr
ir s uQ L l € f l C € 00r, wc haveagaincompretecr
tlrcsuqrrcncc l00l lrndgcI irrtrlthcrloutout
l; ,g in 010.
Wc havcnow t;rkcncarcr,f pu(tingorrt:r I rvheneither
: .:rrrling
in tic sequcnce 010or
liX)l is eomplctccl. Ncrt. rvt,rrillgo blck ;rnrlc()mDlerc
\{c can gc) the stategr.rphto take
' r s c if UC l l C C
t / orr1 p 1 1 1 . \rlt-c sgyfTg:4rl
So rcsct
S r0
sl 0l
.f, 010or l 0
tl
.,a I

J. I (i .)

F r q r r r f 1 ,1 .- lr

l 4- 9

-
306 |r\-l't'I I
Jlf',"'"tod lro
r.c:tre in .t
ca r c of t lic ot hc r S- ' t iile t e i : r r ', l l t i i r . r c i t a v e n 't a l r c a d y
o S,, we ha
accountcd fof. In r( sequenc
Sl at e. \ r , , \ c haiu rcrl foi .r I rrrl;1.,bLrt not a 0 rnput. lf
wc are irr S, and
ge t ll l) lnpui, t ( ) : :;h.rl ri ,j!\U !.rr: l l ' I 0 i nput occursi n S (arrow
, nc have a ft
se LUUnCCCt ) dlr l. : .: (- X r.'
-i n,' l g irr t),and
i ).i i t tr! ci ther of the i nput s,:qucn(csfor
wht eir ilc t r c 1, , , , , Il ;i l |i ,r. l l ,.,.ri r;i () i tn(l sti t.). i n .S , c () i,1prl1 ca
{l rrror, / ) N ,,
Il l l lll( ' t li,r r r lil;|, ) ( ,( i ,' 1,, tr |\ !' i .t :,crj U en!.c e trtl i ttg tn (). Js rrr I l. Sir
g.
Sta) ' t n. l , r lr r t r l "1;i i l il statewhi
I .' !rir\r t:rkcnclrreof thc 0 inJ,p1 gx.ra,
btr t nc ' l t lt r : I r r r ; : , r Lil\ r , ll . t I r : r , a , . a i , , . , i
. ilic lnput sequcncc . J()rresllon
cnd.srn I l. Since
I I is r r , ll l- r ir r (, ; i i. r r lr , . : r ir . , i. ( ltt r . j . . , , r r . , :
'r l r X ) 1 . \ r , , . r l l r ) ( ) l l t e c ( l : l s t a t a , . v h i c h
nds to havi
C () ll,.t5l) \r n.j. i,, , ,ltl,' l 'l s . . r ', r r r 5 , r i r t c c . \ .
f :9lr r, ' orrcspond
r r r iltt, . : i l r r . _ 's i r , r n d ,
t() ,J \( :illlcn!c r .j, :,r [1 lti i] I lfCl . t,,r',
. ,, :'i, ,, .\u.r:t,,-i,
.,,rr..-llr,,;,,ir',,,'
ii ,r,'.j ., -\. lhe inp
Itc c t ir ' t i il \ ( ' ( lu( il\ r . t . t t r llir i, r , t I t , r l ( r \ r , .,rr..)\yA) s:;r
t l i . \ , r l t r . . r t l i l r ; t s ; t r r r r w , sa , , r r a r 1 r , r , , a l , r , !
(O 0; r r r t i I \ { } \ ! e J \ i' . t i r r . \ " t *. t 8el I (
tic.t. ll lr I rs reeurvCdin 54, th. Input l', u, "
' t Pr r i\ ,
sequencc crd:; tr: ii. Wc rJri st,ryrrr.!o ;rnd lgnorethc cxtra I (arrow,Jr) ''t t lr J00
sincc ,,) '
I I is rrlt part ()' cirhcrscquc'ccror whrih we arc looking.In ,''. , , , lt ot cendin
sr, if we gst s 0 "' lr ; r saf f ows
input,thc scqur.n(:.: ettds.tt(itX).Srrrrr:
LX,xl
is rrr:tcontainccj
in eithcr0t0,rr 1001,
we c :l n g o l r;re kl i r ' \, r1 1 1 ' '.' ,r,r, r:' .,1r,r11.r. tri i r.rvi rrgreccj vcrJi i scqri cl cccrl {rng fc lrasftXn4
ir '' sur c
in rl l i e (o l trt,rrel t,: I' i l ri rr()n i l )l cl r'ti\ rc , l :ri r:grapl r si rrccrvury t hat a
sLi ttehas :rrrow r
lc a Yi rrgi l x ' l ri c i rrro i l u \[)(]n (ll 0 l ri l ti r () rrrrrji l l )puts.W c sl roul tl '"' ir j : hal a I
now g,0b.rcl und !i" :l,

c hc c k th c s ti l i c !,ri tl )h i l u rl r):;ttlrc,rr' i gi l l ri !n[]ut se{ i uenccsl o make surr i hat


a . rl l (l
r ',.ril1One
I o u tp u t i s a i w a y s o b ta i n c d rb r a scquerrecendi ng i n 010 br l 00l and rhat a I t r s r r xr
out p u t d o c s n o t o c .r' u rfo r a rl y ol l ;er suct of lt
i r:l l cc.
N c x t w c w i l l d eri v c th c s tl te graph for a r\' l oorcscqucnti alnetw (l rk ri i th
4 rypica
onc U5,
inp u t x a n ti o n e u u tp u r 7 -.' l ' h e outpur / i s r.r bc I i f the toral numbcr of
I' s
r ec e l l ' c di s o d d i rrr(ii ,I l c rts {tw t..r,r()nsuci rl i t]' ves havc becn rcC C i V ed. A tV pi C al ^ r i r.
inp u t.U td rru tp rrtrt.tl ttc n rci : :,1f l

.\., i0ll00tt \ { il I

i 1 lll (i)[]:

u b cde ir \lgesg
z:t}) 0 0 0 0 0 I 0 | I t r cr nl s 6r y,
, 'eecr t t dwit h
we huvc shifted rhc Z scqu*ncero the right to cmphasizcthat for a Moorc
*c r cr , lf l'. s
r,etworkan input changedoesnot affec't z immediatety,bulz can chsngeonl, . . _ c r , Ulpul
afterthe next clockpulse.'fhc initiul 0 in p.rrenllreses
is lhe outputassociated wirb rcCs. . hiye
the resetslatc.At points d ald b in thc aboveseguenft,an odd numbcrof l!
has bsenreceived, Lrut[wo consecutive 0's havenot beenrcccived,so the output
r3set
rcmuins0. At poinrr,c and r, ln odtl nulribcrof I's and two consecutive 0'shavc ' '.'ler
'
beenrer:eivccl,so 7.= L At pi,rintI, z '. ii becaus,g th* numberof I's is rvel.
\vt st;rrt':onsirucliorrr,.frhc r1,.rorIsi..r.,)
graphiFig. la-10) with th,: reset
s t atr.:5 ,,, l i ti ti rv ,.:l :,s r.,C i ;rli cr 0 (-),.tti -i 1l i ,,' i ; i i rj " r S !;ttr. Fi rS t. W e V ttl l C OnS i dgf
k ecp ri i gtrl tc l i o l ' x ' i rr;tl .tcir.
i rc i l L ri l i i rt:ir! i " . ;r i .vri rto!' $rJrj ,l l R ' cgct u I i npuf i n
56, w r: w tl l g o i o rl ;ttr.:.' i , l t, ti i tl i crtl i :urr ri l i rl ;nrl rrbsruf I' s rccui vcrj .' l ' hcoul put

Ii,cscl
'' -1 l l l Ooui s
E.vrir i
Fig ure14 -10 Fk3ure14- 12
_f
t
_---.--- I

)
r_-..------ DfiRryATloN ,I
' oF sTArlLcR^rtr.s ,rABr,ES I

aNp
ll f* 'rr,1 1 . 6 f or . f n 3 67
)c lre in J,
and
n ,tr, we have :!19 rgrrrs rqived
a
t( sequences So rcsctor ecn I,r
for
(rtrrow,f). Jr odd I's
..lo Sr cvcrr l.c rnd 0
rg rrrt), and
we Sl cvcn l,s and 00
c () r,rpulcasc, S{ 00 and odd I's
ctsirr ll. Sine
statewhich
,,1 fQure
I -orfCstr,Onds
ncl.sto having
for S, is 0 sinccI
'lrr.rpondjng filo conscculilc0's

";iilT
reccrved, ha' no{ b€cnrcceived'
sh.u*J
, J., the inpur unnccc.s.sary,o,,,ll-u,t
lcr.t rr.r ,,,,;.','tt *l:n,,second I is
, .. rr()\yA) s:acc
u,.r,'t
, r, ,
t*t gct a o
t"(' tl r lool' il,:; t+it$:jtil:,j,iil;:r
rfl{i:k*:i1#iii,
e n ding
! , , ,,Jc'tl ce
'"'i gotos,"10'offj;1,' i,.]:,,,1,1,,,.
h ;rsa f r ows
go b6sft and c On s e c u ti v e
0 ,Sre c The
i:il;.l,'H,:l::;,.;:;.,.,,:,;;.,y;l;,:",;;
ccive<J;";;,*.,:rved o . rp rr is s rrlt . ,i; r
, , ' . , ; ; ; . ; " , ; : l, u ru . , . , f
. su rc that a lJ lvc8ct;r I input, .s
I h at go we ft,11,g rer"iuJ un'",, nurnl.,cr re -
:,,,1"u a I lld
osan',r.;;j
'ts..'r*i.l
;,:li,;.:J,,:,1:,*1,,,;l,j,Jl,';,,i;,1; ;;;;;';;.:l; of l,s
,-lur.receii.c
,woco;rsecurjve
:l:"ti one ;i I in .5o, ,,,,r;,:,;
t r \ h t t t',,irh
r
t. A typiul
of I's
rn. ,.s , s o \ t e c an

;;;,i* :il:ll
iI :
1;. r,:,
ri j
r c { Ua

i:: ;:
,,
:,ri:Ifil,.";::,
,l;""
iir
il:
"rl
t) s.
c^
nnoeo
tos,,,,
;;i::,':
il::lll *."J: i
itn()
cttrrcsPrrr)tls
t, rrr,,,ltl ,r,rrrl,ci,,,",
,,,,r1 lt':':.t.
# :i,"fi::.ff J.ru;',n'
(Fig. l4 12,
arro*,/,,, hich
i '(i rrsccti l r\c 0 'sa rd ru ..,,,, ;y0. ' ,,;;;
, lliilt' t"tl11Ar r .{ hcr
0 r csu1s,,,

tlr \loorc
)::::ii;ti:lri"txtrilli:#,i
,,,,
tti " i v t' ti ;rrr
;iqru;';jT f,,"' ,,,,ri,,ir
:;;r1,,..,,,,,,,
rrrrr,l ,t.r ,i i r" ;;;;,:' ' i ;: Jr, a I i npur
means rhal * e
l lrerl n l s 6 n1, r+ ' cmu s I re ttrrn ' rtrl ,j ,"t' ' ' l l .l r(' (ri v(' (l have
l o .\.. t" i l w { } col l ' \ccl l l i i c
ierri tl j q ri 1f i r+ e re c c i re a ,.,,,r," ,' 1' r;.
*c f tcr ,rf l i recc
rc,,, " s,:, I i n ,!.. .f:l "t' ' u
o;n,Ii,,i.Ii,.n.l);,*i;i
)jjl,ljHJfTj1yri,i,i
" ' ,.i

_ , .ts,,Utp U l
r cC uti 0 'i h tt'e
:
j
! I^r.att_ r::': -lls!s$nr*
l.1r rCSCI re\c( of cvCn I'S
:,
c,rrsider .) , o<IdI's
r;trut in cveoI's rud 0
:,
Jr pvcnl,c rud 00
: c:t(pul
odd r! and00
:1.
ir o<JdI'c and0

tigure14-12
Ev en l' s

i
L
r
T
L
814 A P P ENDIX A VHDL Rnrnnsxcr

LIBRARY ieee ;
USE ieee.stdlogic-l I 64.all ;
USE ieee.std-logic-unsigned.all;

ENTITY count4IS
PORT(Resetn : IN STD_LOGIC;
E, Clock : IN S TD _LOGIC ;
a :OU TSTD_LOGTC_YECTOR(3 DOWNTO 0) ) ;
END count4;

ARCHITECTURE Behavior OF count4IS


SIGNAL Count: STD-LOGIC-VECTOR (3 DOWNTO 0) ;
BEGIN
PROCESS( Clock, Resetn)
BEGIN
iF'Resetn: '0' THEbi
Count <: "0000- i
ELSIF (Clock'EVENT AND Clock: '1') TTIEN
IF E :' l ' T I{ E N
Count <: Count* I ;
E N D IF ;
E N D IF ;
ENDPROCESS;
Q <: Count;
END Behavior ;
FigureA.

FigureA.40 An exompleof o counfer.

register. The register has an asynchronousreset input" Resetn. It also has an enable input, representsthe ,
E, which is controlled by a four-bit counter. The counter has an asynchronousclear input on the register
and a count enable input. The circuit operatesby first clearing all bits in the register and The staten
counter to 0. Then in each clock cycle, the counter is incremented, and the sum ouq)uts keywords are r
from the addenare stored in the register. When the counter reaches the value 1111, the (n :> k) sets
enable inputs on both the register and counter are set to 0 by the NAND gate. Hence the the adder,but i
circuit remainsin this stateuntil it is reset again. The final vziluestored in the registeris the code,is use
equalto l5X. a constantvalu
We can represent the accumulator circuit using several subcircuits described in this defined for thi_.
appendix: addern (Figure A.15), NANDz (Figure A.28\, regne, and count4. We piaced register, which
the component declaration statementsfor all of these subcircuits in one package, named carry-out, whic
components,which is shown in Figure A.42. The regne
Completecodefor tlte accumulatoris givenin FigureA.43. It usesthegenericparameter usedto setthe r
.i
t to representthe number of bits in the input X. Using this parameterin the code makes it Sarnoutput fror
i
easyto changethe bit-width at a later time if desired. The architecturedefinesthe signal Surz output of the ac
to representthe outputsof the adder;for simplicity, we ignore the possibility of arithmetic is required in tt
overflow and assumethat the sum can be representedusing /c bits. The four-bit signal C component.
?:'l
F.,
sii.

l .'0 S S et
":rrtrc.,,,r,..
f:,
"
t l.lBRAIt-r-iree ;
.,
USE ieee.std_logic_l
l64.all ; $.'.
F:
3 ENTITY shifi4IS
4 PORT( w. Clock : iN ST}-I.OG]C:
Cr : 0i; i' sl;)_' i-ilic-vE{,t'ii.lj.ii 1 -i{} _l)
; E),il] shill ! :

{t
7 ARCHITECTURE Behavior oF Shjft4iS F"
g
a B EGIN F
o
PROCESS( Clock )
t0 VARIABLE Sreg : STD_LOGIC_VTCTOR(
v
I

1 TO4); t:
lt BECIN F
a?
1: iF Clocli'EVE\*TAliD Clock: ,1, THEN !_

I3 Sre_s(-l) :: rv ;
Sreg13):: Sre-e(4) ;
15 S re g (2 ):: Sreg,3);
to S re g (l ):: Sreg(2);
tl END IF:
t8 Q <: Sre-q;
i9 END PROCESS;
20 END Behavior;

FigureA.39 Jhecodefrom FigureA.3g, usingo vorioble.

ent
ip- A.10.8 CounsrnRs
ite
FigureA.40 showsihe codefor a four-bit counter
with an asynchronous resetinput. The
.As counteralso has an enabreinput. on the positive
crock edge,ir rhe e'aL,r*d is r. rhe
tm count is incrernented.If g : 0, the counteih.ids its cuffentvalue.
coirlmoniyneededin logic circuits"mostcAD B..uur. countersare
in systemsprr:videa selectionof counters
can be instantiated
in a desien. that
:es
)9,
t6
ifr A'10.9 usrxc suncrncurrswrrrr GENER{CpaReurreRs
\1'ehaveshownseveralexamplesof VHDL
)\ entitiesthat include
thesesubcircuitsare usedas componentsi'other ltr:lmeters. When
-gei-rei:,:
code, the genericparameterscan bc
nt set to whateverva-ruesare needed.To give an exampreof corJponent
ot generics,considerthe circuit shownin instantiationusing
Rgure A.41. The circuit ,oo" J"-uinury
td representedby thefr-bitinputx to itselfa numberoftiines. number
Sucha circuit is often called
an accuntulator'To storethe resultof each
additionoperation.thecir-cuirinefr1fls5
a ft-si1
A P PENDIX A VHDL Rrrnnexcr

I LIBRARY ieee ; I
Z USE ieee.stdlogic-l164.all; 2

J ENTITY Shift4IS 3
4 PORT ( w, Clock : IN STD_LOGIC; 4
5 a : OUT STD_LOGIC_VECTOR(1TO 4) ) ; 5
6 END shift4; 6

l ARCHffECTURE Behavior OF shift4IS 1


8 SIGNAL Sreg : STD_LOGIC_VECTOR(ITO 4) ; 8
9 BEGTN 9
10 PROCESS( Clock ) 10
ll BEGIN 11
t2 IF Clock'EVENT AND Clock: '1, TIIEN
. { .t ?
i1.-:! rc
Sreg(4)<: w; i;
Sreg(3) <: Sreg(4); , t4
15 Sreg(2)<: Sreg(3); 15
t6 Sreg(l) <: Sreg(2); l6
t7 EN D IF ; l7
18 END PROCESS; l8
l9 Q < : S re g ; 19
20 END Behavior; 20 1

A.SA Codefor o bur-bil shifrregisrer. Figure


;l{*

statementsin fines 13 to Henceall flip- 4.10.8 Cr


flops changetheir at the same time, as required in the shift register. We could write
the statementsin lines 13 to 16 in any order without changingthe meaningof the code. FigureA.40 st
In sectionA.9.7 we introducedvariablesand showedhow they differ from signals.As counteralso h
anotherexampleof the semanticsinvolved usingvariables,FigureA.3g gives the codefrom count is incren
Figure A;38 but with Sreg declaredas a variable,insteadof is a signal. The statementin commonly nee
line 13 assignsthe value of rryto Sreg(!). Since Sreg-j can be instantir
gffectrrrursuidltrry.
_L'Lrr immediately.In rine r+
ril true 14the
tne value
value or sr"g (ZfrffihGffidy
of Jreg (4), wrucn nas aready be--
been changed to lf.
is assignEdTo'TrQ(3).Henceline 14 resultsin Sreg(3): w. Simiiarly,lines 15 and 16
set ^Sreg(2) and Sreg(l) to the value of ry. The code doesnot describethe desiredshifi A.10.9 U s
regis.lgr,but ratherloads all fli with the val
Fo1the codein Figure$Jp_1o_.-c..g the ordering of lines We have showl
l3 to 16hasto bereversed.ThenthenritiiiignmenGersffit6 to thevalueof sreg(z), thesesubcircui
the secondsetssreg (2) to the value of sreg (3), and so on, Each successiveassignment set to whatevel
is not affectedbv the one that precedesit; hencethe semanticsofusing variablesdoesnot generics,consi
causea problem. As we said in sectionA.9.7, it can be confusingto use bottr signalsand representedby
variablesat the sametime becausethey imply different semantics. an accumulcitot
A. !+ !gr_ri'g1'pl.r,1_lli*rc:-'t rs il'! 'r

LlilRAR'i ie*e :
USE ieee.stdiogic-116-1.aII
:

ENTITY regneiS
GENEIiIC { n : I\TT:CER :: -i ) :
f'r.li{T i D : 1-\ :''i}-}.tltliC,\r--:.-i-tl,ii:i- i i .r n )' ail il ,
li':.etii : lN STii-L.OGii ; r: :'

ff
E. Clock : i]{ STD,LOGIC ;
a : OUT STD LOGIC-VECI'OR(n-1 DO\\iNTO 0) ):
END regne:
l:r.
ARCI{ITECTUREBehaviorOF regneIS E.:'i
ffi*
BEGIN
PF.OCESS ( Resetn.Clock ) ffi
BECI}J
IF R.esetn: '0' THEN
Q < : (O T H ER S:> ' 0' );
#
: sri

ELSIF Clc,ck'EVENTAND Clock : '1' THEN


IF E: ' 1 ' T H E N *t
Q < :D ;
END IF;
ffi
END IF;
END FROCESS;
END Behavior;

FigureA.37 with cJnenobleinput.


VHDLcodefor on u-bitregister

change their stored values if the enableE is 0. If f :


clock edge in the normal wa_v.
I. the register responds to the active

ff
ff
A.10.7 SnrrrRncrs"rBRs
An exampleof crxlethatdefinesa tbur-bitshift registeris .shownin FigureA.-18.The lines
of code are numbrredtor easeof reference.The shift registerhasii seririiinput, u,. and
paralleloutputs,Q. The right-mostbit in the registeris Q(4). andthe left-mostbit is Qi I jr' iffi
shiftingis perfornred in theright-to-leftdirection.The architecture declaresthesignalSreg, ,ffi
which is usedto describethe shift operation.All assignnrents
the clock edgeby the IF condition;henceSregrepresents
to,tres are svnchronizedto
the outputsof flip-flops. The
iffi
statementin line 13 specifiestrratSreg(4)is assignedthe valueof rt. -As weg1plailgd.
preliog{y*{is as;+ign_ment doesnot take effect immedia'relvbut is scheduledto occur at
the end of theprocess.In.lin614tn" luo.nt u"i,r. nisr"jt+i. riefoieif is ihiiietl asa result
6f li"i, i:, liiriiSti"it to Srng{3).Lines l5 and 16completetheshiftoperation.They assign
the currentvaluesof sreg(3)lncl Sru,,{(2). hetbrctheyurechangeti as a rcslrltof lines l4
and f -i. to Sre.q(l)andSn,,*{ FInall'v.
ii. resgrci:tivcl-v.,. S,z,gis li:;sigrl*d
to thr'f] o'.rtputs.
-----:-*r_

810 A P P ENDIX A VHDL R.nrsnpxcn

LIBRARY ieee; LIBRARY I


USE ieee.std-logic-1
164.ail; USE ieee.st,

ENTITY reg4 IS ENTITY rer


POR T ( D : IN STD_LOGIC_VECTOR(3DOWNTO O): GENE:
Resetn,Clock : IN STD_LOGIC: PCRT
o ouT STD_LOGTC_VECTCR(3DO$/NTO 0) ) ;
END reg4 ;

ARCHITECTURE Behavior OF reg4IS END regne


BEGIN
PROCESS( Resetn,Clock ) ARCHITE{
BEGIN BEGIN
IF Resetn: '0' THEN PROCI
Q <: "0000"; BEGIi.
ELSIF Clock'EVENT AND Clock : '1' TIIEN li

Q< :D ;
END IF;
END PROCESS;
END Behavior;

E
FigureA.35 Codefor o four-bil registerwith osynchronous
cleor.
END F
END Behar
LIBRARY ieee ;
USE ieee.stdlogic-l164.all;
FigureA.37
ENTITY regnIS
GENERIC( n: INTEGER:: 4 ) :
PORT ( D :IN STD-LOGIC-VECTOR(n-1 DOWNTOO);
chan,eetheir store
Resetn,Clock : IN STD_LOGIC;
clock ed_ee
in the
a : OUT STD-LOGIC-VECTOR(n-l DOWNTOO));
END regn ;

ARCHITECTURE Behavior OF resn IS A.10.7 Ssrr


BEGIN
An exampleof co
PROCESS( Resetn,Clock )
of code are numt
BEGNi
paralleloutputs,(
IF Resetn: 'O' THEN
shifting is perforr
Q < : (O T I{ E R S :> ' 0' ); which is usedto r
ELSIF Clock'EVENT AND Clock : 'l' THEN
the clock edge b.
Q.:D : statementin line
E N D IF ;
previously,this a
END PROCESS;
the end of the pro
END Behavior;
6frii"*iriioi'is
the currentvalue,
FigureA.36 Codefor on ,r-bitregisierwilh osynchronous
cleor. and l -5,to Srr,g(2
w

A.tO 5r1r-rxrr,rr-Clnr:llr!

LIBRARY ieee;
USE ieee.stdlogic-i164.a11
;
D
ENTITY flipflopIS
ne PORI(D, Resetn,Clc'ck : Il{ STD [-OG]C :
a : OU f ST-i-\L{; .:' -" :
l:iriD Itipflcp;

ARCHITECTURE Behavior OF flipfloplS


BEGIN
nc PROCESS( Resetn,Clock )
NL BEGIN
iF Clock'EVENT AND Clock : '1' THEN
t,
iF Resern: 'q' THEN
I

t" Q < :' 0' ;


li. ELSE
es. Q < :D ;
i;
he END IF .
D Ei.{DIF;
END PROCESS;
TE END Behavior;
le

FigureA.33 D flip-flopwith synchronor.rs


reset,usingon |F stotement.
bf-'t';l:t"
of
LIBRARY ieee;
USE ieee.stdlogic-ll64.all ;

ENTITY fliptlopIS
PORT( D, Resetn,Clock : IN STD-I-OGIC;
a : OUT STD-LOGTC );
END flipflop;

ARCHITECTURE BehaviorOF fl iptlop IS


BEGIN
PROCESS
BEGIN
WAIT UNTIL CIock'EVENT AND Ciock : '1' :
.O'
IF Resetn: THEN
j Q< :' 0 ' :
ELSE
( Q< :D r
'I END IF ;
END PROCESS:
END Behaviar:

FigureA.34 O flip-flopwith synchronous


resei,usingo WAITUNTILstoiement.
\

808 A P P E NDIX A o VHDL RersneNcr

4.10.4 A Fr-rp-Fr-opwrrHAsvNcnnoNous Rnsnr


Figure A.32 gives a processthat is similar to the one in Figure A.30. It describesa D
flip-flop with an asynchronousreset,or clear, input. The resetsignal has the nameResern.
When Resef,a: 0, the flip-flop output Q is setto 0. Appendingthe letter n to a signalname
is a widely usedconr.entionto denotean active-lowsignal.

A.lO.5 SvlrcunoxousRESET
FigureA.33 showshow a flip-flop with a synchronousresetinput can be describedby using
the IF statement.FigureA.34 presentsa specificationbasedon theWAIT IJNTIL statement.

A.10.6 Recrsrens
One possibleapproachfor describinga multibit registeris to createan entity that instantiates
multiple flip-flops. A more convenientmethod is illustrated in Figure A.35. It gives the
same code shown in Figure A.32 but using the four-bit STD-LOGIC-VECTOR input D
and the four-bit output Q. The codedescribesa four-bit registerwith asynchronousclear.
Figure l{..36 gives the code for an entity namedregn. It shows how the code in Figure
A.35 can be extendedto representan n-bit register. The numberof ffip-flops is setby the
genericparameterr?.
The code in Figure A.37 showshow an enableinput can be addedto the n-birregister
from Figure 4.36. When the active clock edge occurs,the flip-flops in the registercannot
Li
LII
LIBRARY ieee ;
USE ieee.stdlogic-ll64.all ; E}

ENTITY flipfloplS
PORT ( D, Resetn,Clock : IN STD-LOGIC; EI.
a : OUT STD-LOGIC );
END flipflop; AT
BI
ARCHITECTURE Behavior OF flipflopls
BEGIN
PROCESS( Resetn,Clock )
BEGIN
IF Resetn: 'O' THEN
Q < :' ,O' ;
ELSIF Clock'EVENT AND Clock: '1' TlmN
Q < :D :
END IF;
END PROCESS;
END Behavior;

FiEureA"32 reset
D flip-flopwith osynchronous
\Y'
tzi2L <7*7 W ug'|*'J l*AA
'|-4Ez iz,<-.t,v,<bu..(. t*J- h-
b" -".
z?
zt.t- #, Alo' UAZ c-o'r*' +tak'-ne^b

(,_- t - )'- aE&- le*


Z: t
:( - L c- ," &) trutl AJ-I"A- / Ui 4 t^F".^b I on 6r^le --'
P4 vz Lg 3 t^/"^^A tr/c^r} Z?k-,\-'/
tc)
\:/ T-
P ;- P=..l-r--- J t6-) SR _ tr ^--'/
i '-?.;L-..-:-i.-.ol ,@- wtc-eJtx "n"-Lrce\k- l^ooa. do*1 6 i; 3d-t€o
V P**iV
;4 Y 'i 6' o/r J"* cR.T(cJ, 4,.,"*/r PRf[i, ri {e t<-1 .; "^ -(
-.,.r: r,-tgr-+
e,'-,t-, ',' |
. 2- w;tJ vHDr . "*- p q^/o
-i
KV
* /^l. "i{ t-. j
gr^-.el-4 neJc,rlexr,f l\'/
o 2.-.-'

A-* - .'-,-,,,,1- va vHDl- &r#0{Fc,}< ( H H : vtrt: Ss)


-nnT* ,*
r -\ '; ) ),_ ,,*Je
Y l^,L
l _l
' ix i 1 . 4 UX
-r' @ t -gtu N,J"^- ,-/
D4 ^ ,*&^ - ^ " V 2 X+ b ' g x? D< r *J+av
::, 8 W^^J*t/ ( 5 ) S x3 2
' X 16 2t {e P}tlt\J'J"d E-rc-eJer'
D<-r^J'r'-/- t6,) '
-t

-) --s- ',V-ruk-VHDL usJ€, J*- tl.^nirne-r,:a'q- R:1j44cn


Tx/

?'
ry-
8 - 6"t ^^"i
\

g1 Dtt>L7"^ a- EC> g- Ez<cx,4-3 c-& c.-,\^/e{1.-e-L-\^r*&{-{s-


v a^k-j."^./J"-*;W
{"9""#- {e}b L"-4 k4f B e D te-€xceao - 3 ).^*J.i G v<>-;h {d-
+€4* tn/^#" {s/l. -^ -L \/
VHot- ."^,J"f P 4 -b^k 4 *t{^ o.-b-r"*L r+^^i
9
' / [ s , o J , B *+ t q y @ te -\,"7^"f,biI /^"r7^JrhL3/o,'
bL.-^- , 'ur , )^ lrrs .a.,.^,,
, Ae I )v\
v,@ :
eJr^aj-
6 'LrL+.
Ob W U,--, $, ,1e{o
^-a
D<i{^ a* B e-o */-t"^, c-{o<^^r-b
*f \l'H{?
W
=W*
W)'rte-VHDL&^ x + R'+f'4 , 1^a,tlli J^,f A^'!e't aA
d* ,Lb
;V ,"r{,:k- ,r^-AL ar) ;-^AAr"t uf
V^T 6' 1 6 :1 M ,u x *T 1'1 MUx* vH D L
* \ A9
L'4Dt- d- <'+t-''7iz+'-/'e'- v/""'-)''
$:-
2: -*'.\<.b- bu/^i",<bul f '!'-L.'-Q
*z z-<4t^f',4<- o I o . Uaz cs^t* +t-nk--z^t
t
e-- t'l ),- Le-Js-
P*
' I K - F+ \," \---'
G) R^L[ AJLJy^-/ U) 4 t^F..^b XoK f
:' D -F+ "-/' q) T - F+ t--' 6) 3 t^i",^A v+-.1"a7^/e-,\-..'
' u
? H**JJ'>-J L6) sR-rc^/

4 cc.^"4^-*1;;*-J Qncgl*-.n"-Lrrol.t<- l^aan. do-1 i' ''c,..rnzeo


V 4- WV
K 6) 4-J rr<.tpr 6. o/f ,.#'* CF.T((,) , n^ */p PRr1j, {. {e t< I
+ 'j '^ "t
u
*1 XU |
^^,{ "/ '-o thn ",[{. l.j " wrribevHDu ce.k- p tt",,l
K(i)
6# W'*^^eh^^'{
Wr.iJ<- p,rn
VHDI- (pf H: Mr.l: ss).
* ^-Y*f* J-, $trSd,'</<
g> VHDL ,*JE-
V I*,L
a rn ..
t, t6 x t 14vX ./ \1) t -e)"u)JJ"^- ,'1
**V 2x+ & sxr De,,-Jzrv
12) 31 8 v;M b sx 32 o<^ &'
1x ta Dx.-'/\N'-L t6) 2' 'te ' P"'b"^r? L-r"'J'r'
f3;

v W).ik- v HDf- , /e p'" tla^tw,r*-[


ry"

v D;.4iX^ a- BC> 16- Ea4ae,a*-3 r*-,J<c-s.,^^re-d^!"uc"..** 2^J*-i^^""/Jt-^tW


uo*r#- &4-b"A"
+ea* ta^^#" t4ll. -,.
.,L {-a4f B e D *-'6.1cea,o- 3/b^ *J*
\/
J@-\/<>;h 4<-

VHtu ,^tuJ.J' l,*- 4 -b^k o- 6-l>*L *^9;


9 -k+.pr-€^
Y ls,of ,B*+t q Y b ht 3 /o''
t*.w"T--l, L''*1 /^ T-V^J, */'aoul.,e-t
I
,'^r, l^ -a"s 4"4^4, AE /'\'64T^
-ry 7, ^-l- b ^.vd bLL O 7a W A.-, eA "# '
D<-^1.^ q* B ca ^)J*^, ,)rr"it *i M'e{?
W
=*-V
Wr.rte-VHDL&^.r.lh,G.J*LbX+ Rll-M, k"-.-? r)^,f,s'ic-t^*J
V ,^."1J*- eo t*^",}[ uf
.^rr^*e-
a- 16:1M,ux *T 1.1Mux* A*w'HDL.
* ry \
b+ LEr?f Bc> @q *-i vFtD.',ffi-tr {,."&*f
?j ^
c -'t '.r,','r,r{g U^e VH D U
V ckL Jr*1
I
D o -) r D, f\
5
I,n-t^"Ja o \^tp^^fo
oo o o X x o
IO o o o o I
h1 o o o I 1
XX I
I o 1 o' l
XX 4 I ,l
l)

U)^i- rA^'L MT I I I t'4uX Vr1bL'


->'+n*uvl 4
V ^a
v

ffi
w
-N
g -t$.1 3.*-e-o Z--Jo.+*'* aq E-.-(*ro-f,.o-'
tt I
v.
?;t*g- I n,"+ fo l trortv:,
\'*\*liff f k""-Yf
9^;)'r+<- ,I"^f - t.^,
we\d -0J-9. i* g*te7r- ^*"f j1 {"-o-^i-oo;

M o!'-eo
?"1_
-el *ttt ),.t** U,{^ t
v-'t.+t *t r-\d-
^-.!* ,.r
f:{".^"-
l<--,ee-*?*-{;b*GDu ,tr '^ g?
r' a 't r't- d
,t
"--1,-, "^"!;\-ft"D
Lt, f-"r .e..h T ,"Ils.l , wJi"ol-u- \ t4^'t^te^ {Le"r a)ue-
Z+-bd.*.!i-yc€rD,€^F L i/tyer ,, Ju'fe-t'-i-e J-*-tg
fn\/(lU'
VI -L \-'E q
^-
i; z*, *4 rii lt - t tiif2 b"
^ff
lo I I I ol zJl
@
\v, .,,t o"'J q t^\ 4e\ Z- '
C^,.c ^^J
V u.r-{,-.-Ha
"\tilf 4* $Ua^I {( #+z3DP# '-".J
K ' z\ VFu7 u
d, ,4t w,str-^t -
""*'^/^ €
:: F&"Y
Le) r,.6-.,-....r,f'*-.-k{ t^J'e\ti-'t
U ?^" <x)'"*ct v''
Itl 6--^.d*'.
U, ilh Ll^ u^t v *+r-b7.- +* +tF"
'-"t--k1^-; '''vtg'd('{ \/
vrl,' t'^o'^-t- 9'
r-"'g"l"-l'ttelv**-.-'3 v
Lh) A;W 'u '
711-r4'" +")o,lr^
L+J
ttiJ/i g4,**- t^-#n*f*
rl
t d |L
t--b.{-.'
- /'
^r_,1.)
o^L - b,
bL= ^ ' s
t\"-(-
q' L>- L)

.4^[-'[
\/
NglT L, DIT:[ r'Vet
tF-) G"?fu-*-^
tJ-^^.^,*,^u,:-'\x,t^.f+
I Zt* "*ZliJ.e^
'G a
.*{ts*^e-r^^'-fe-
f^:* ^-t-'-$.
Li,l..ts C--he{t-e\
F-T u J*" .|..uof,[tL
9.3t t De.,a^.'7^. oe *
Vl €'i&-t^ *'Ff.*io'- ft?i4;+'t'
,
4-+g,,
.
q+?- 4-*; #*
o\4€'\e/\
"^1'"1'^",'-crt'
f"4
l sl <.-6't--t*
\"tk tq"''\ao--x^'vr
t*t*.'
q{td E tt}u(-\- v o'*-.tr-v: c^^'-tfzt---'--b 1
4^AJx^f&-"^- "/ _) ..^,+"o[tn-l
tb/ U*#t^a;Y^'..^cr'p '-e/
U^]rs-Wt- -- \
*-'t*Lo'cr^,**^--r-[a]v\
,''c^-+^JJ""\
$x Lll tr'^t4,"*..^&w'* g fu^*J€f""l*-
#o '|L
.*^si&t.^ 4 *4 ,ltai*)
;t.-0J' F
Qt I t*J-^.,'n's--rA
r",,.'.-"^lA
f%

^..^-u-|{fi"--*
./.\
2
. .1 t
d g<v.lRt ,l
s Y' cL..art
,)
c **^-l "^rq--c-\c \lA D*r-e-*L.tcr'J
FttU a+.\e-"-
Y Y
O( qc-t€-
u'ot-*'. -.0r- -
+'. I vuX **,-i noiV- - s^fE€t dh'{ ,
c Dtr4*\e"Jqdte bf"* aeJ - !'?-
ut -$*-\*V*
0u
^-^'J
g
,/
P-cCe,'.,3
ffi
VHDu J
c D A-F <\P
. . rs f
0,
o t)x*,i*1 ' * ..^J - \e ua^-'*'\-kg}t "
U 6' e xlT A'l--d '
1'{'.c r{ exT
f
s)
hfii-t""\io'-k- F,o r-r4 ( Ct4,n,
c

na9
€ Art {q-!i--}.^
U
a-f ire -f \ 6 T r-s , {
Zt t-zt'-.]b.erf i1
^ .nA :
\c
z > < = d. 4e. (a 'Y*s :
\

\er'J-t 4*y5 ^1A<-\


i t'
Z7 ( '= I "( U
J
p'n ft{vrj
aND T€Rr\^
..vroxe[i.t
e w-,.'.{"-
Fo\ ^A&^-
n
\ t!
e
s ui,-n\g
LsleL'<


C.LoeA.

K
I
!t-rDL l,€'\ + H.t
e ,- y"-'-- - tl n ' {
!.r1uvr,.tee->-e-t-- y b_+-L-t-cxt_+1't\-!
{s 6g.'Lv/eA'
ct.-' i.-'R-l'h" e[-'['-re-
ia, t" ,,e-.,..'-,-rLV
A'*-k?^*
,-e-* -"LAt" 7-"r1"^[9Nl:
aL-4.^,b*da
;:* ff;,
{ i-U v"v<Jet)

kg *!h:nw*
fr#",J:;
T#rr,-',
c V H D L c*& h h*j u\€^-'\cQ-J-"J*^-bl "
u-i'{'r^H^ cl"
G AAv, *f +op- ,t**l A*;f "t"*'k-t JJ'Wttu '
.F."=^.-J
e
-,,\ UtL*+"^-t- lup
vU
-"!--'*-^ l'1*-" -
{
0 . \' f + f
t_
tJ
p' i4n- ""* ,rVHDL\
rrrrrrN,
\l L ."\ r"\r *_
wQ .G"| + D 4 _
t r ad
\ ^ : t** ia L^ '><-Y t-{DL ?

oC _
rr.J*lf* V HD U2^+<- '^!tQ^rve-'fLd1Q-
D J'e'.-t,6; '* e+'k '
t\
A
ts
C
lc
1."-,e-Aa\bA? -
.A-r\tD "LA-"/
t..' 'D -\FB - , o
oF
t-
.*J*:
x@yA ^-
e^,,?tOO
.4Yrr"-7 I
-c

'L*-oF"
'l ""-'< A^f":I- t1 P V *---'<ln* h-*-
\a I ^*
$ '= SL? n'r-r '
*l eKt t-*-..Jl^*ti A"-t''-*fl
p&.'',
&e.o.-^r
It) t^*n{* t/nuL

N*J er-te&A t^^


n^trn"*s-"- hLb::l
(
L*,*fo
w1=&,-.,Q-q '- r ( 4-lf\, , D (tr )
W.|".^--*t Rrfl? C j
S '- . Y^ 'C . D tF ;
y l ( A ,8 , D ) ,
^.. J
'',=f l D, B , h) ' t
ref--[ F, ts, () ;
t
{'*l *""=Plt"'t*-;
7 b.t'J*u-e'Y'I
;-,f ,l=d
- 'vr4L-i()
6 frr-r + 11D"L "l'""'d W;
-^-{
\
\5

V
t' DlF) i
xnJ--k ci--f t +-rL,
* t" * A ,B,c,D,
e-.tY,.-.t-+ F 2
,,--i",rt- t*0,Y . q rJ ;
J, ?,
a,J (rr,br.,A),
a- - ^ "'(LJ,^ ,c ) ,
d , - - J ( o 3 t k,O.)_,
" J \ l Z t V t\) I
{- L I C , a r^' )i
*^r t- ( ql A ),
.r-.ot- (d,E)',
e,r,..,,l*r-o2'Jt
1 *c' t
( h.J'L *- L's-Q'^--' Y-^*(
ft '."r.',a1'r-'i\
/ rl
lflr,
o ',
f''
'^l}'-' .0-'t-'{
ia o "d-{"d-'-r-1-Q
rr
ii, K.n *. ,l , u-r'd}"n
"J'r^.{ -'. :,
o"
u.r-,r.lt \, d n L /*.l. .3- t"'-+ '- nj /
fT-*u"'7--Ak- *;:l
er-fr(^r'.,*r{r'o,"t''-'-.u
,4 ff)*,^ .
L3'L"-t.;' 8' *"'.(*""': - a
>.k l'4," er-*.t2 '-

:,t;:; -'r'^e-{.'-t'-r'
6'---""/'e-1
o ,,.ffi*,u^. ,,;: ""0A ktL*"'*l ^7*\
t*, l1(,*k L-
K r u-Rr't
e
o

@ A - '\-\ E
B
(;
----
J-t I tL-
.D ---J llt*J"
A W."4 16'-'-c;--O(c-d i
tt J"ffi^\-t ul-{>4"*Ae-^
C-

e.v-t ,r,-(*^:'-YG -J
+t'a'"1
- iJu l'az-b)
t3,
cyz =L.,
to 1 > a ..'?

J"4
a. L _ <_)
o*^J'
I
^tr nI
W *t r ^ ^ > F@ ^IJ lt- ^ " .{ g
n

We B-d+
*-4;9, "-'*l"t'
N frfu D v*Q"
0
Vy#^-in
5l Ld-a+ k.--H* . I n
sl Di*-f
- jl U^,^.-nure-.r,''-t-- .,-*1-\-ta g4-zL/'t\. ,/-^
.-^'t'e-{--"4't
/ti'*t+

N s-t^q, 'o-
*?fq A *g LD

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