a.
Bi~u
dien
kien
true
thco
h~lfih
vi
Bie'u
dien
kicn truc ella thl!e
tlH!f
thea
himh
vi
Iii
ma
IiI
chue
n£ing
elw
h¢
thong
wong
tlJ'
nhu
d.e
chuang
tdnh
phan
mem
btng
cae
qua
tfrnh tinh
to{lIl.
Trong
bieu dien nay la khong
cung
ctip chi tict
\'i~c
thl!e
hi~n
,hiel ke. Trong
ngon ngli V
HDL,
de bicu
dicn
kicn true theo hanh vi,
diu
true ehfnh
eua
htlI1h
vi
sc
Iii
qmi lrinh. M9t
qUii
tdnh
c6
the eoi
nhu
Iii
rnQl
chuang
11'll1h
va
dW1e
xiy
dl!ng
lu
nhU'ng
cau true thu
IJ,lC
va
co
Ihe:
eho
phep
gC)i
cae
chuang
tftnh
can
gi6ng
nhu
lrong
cae
ngon
ngO'
qp
trlnh
truy~n
Ihong.
Ta
hay
xet
vi
d~l
rno
ta
kien true
cua
m
~eh
ct)ng
mOt
bit bang hanh vi.
Trang
m6 lit
chua
m¢l
qua
lrrnh voi ba tham
s6
iu
cae tfn hicu A. 8, Cin.
etc
tin hi¢u
mi.y
ctuQ'e
chua
trong
danh
saeh
cae
tin hi¢u
t<k
d9ng
'laO
qua
trlnh.
Vi~c
thl!c hi¢n qua
tdnh
sc
dung
l~i
neu
khong
eo
de
Sl.t ki¢n
x<iy
tra Iren
de
tfuong tin
hi~u
xuiit hi¢n
tmng
danh
siich hay noi
mQt
each
kh{IC
1;1
cac
tin
hi¢u lrong
danh
siich di.e tin
hi~u
tae dQng
khong
thay
doi
gia
Ir!_
Moi
khi
c6
mQI
slJ'
ki¢n x:'y fa
lfen
cac
duong
tin hi¢u, qua trlnh
siS
dU'<)'e
kieh
ho~1t
va
d.c
cau I¢nh ben
trang
cau
trlie
se
duqe
thl!c
hi~n
tuan II!.
142
architecture
BEHAVIOR
of
FULL_ADDER is
begin
process
( A,
13,
Cin )
begin
if
( A = '0'
and
B = '0'
and
C = '0' ) then
Sum
<::::
'0' :
Caul
<::::
'0' ;
elsif (A:::: '0'
and
il
::::
'0'
and
Cin
::::
'1' )
or
(A::::
'0'
and
il::::
'I'
and
Cin:::::
'0' )
or
( A
::::
'I'
and
B::::
'0'
and
Cin
::::
'0' )
then
Sum <::::'J' ;
Cout
<::::
'0' ;
clsif
( A
::::
'1'
and
13
::::
'I'
and
Cin =
'I'
)
then
Sum
<::::
'J' :
end
if
end
process;
end
BEHA VIOR;
Cout
<::::
'1';
A
B
J
C,n
•
F.A
-·c
'"'
• S
S=A8JB8JC
m
C,,",
= (A
8J
Fl)C
m
+
AFl
A __
t
\0~~!
B
___
I -:L./
II
~r,.i
\:;:-~
::
'
}"/'j
S:::
A(fJB
ex:
mnh
6.5
('[ill
(rllc
viI
hilllh
VI
b6
con)?:
lll('lt bit.
.,'
I
,
',j
II
C
,n
I
_____
J
c\~
C
:::
""
out·
J
)
~_/
M¢I
qu<i
trlnh m6
d.
h;mh
vi
ella
mQt
phau
ho~c
tOlln
b(l
thiet
ke.
Qua
trlnh xuc uinh
d.c
khoi
rna
l~nh
luan
tv
uQc
l~p.
Cae
khoi
nay co
the
duq'C
klch
hOi.~t
ling voi
cae
bien
u6i
tr~ng
thai
eua
lin
hi~u.
Khi
co
nhicu
han
1l1l)t
qua
trinh trang kien true thl nhung qua trlnh do
tIm;)'c
tlwc
hi911
u6ng thai.
i.
Mu
hinh
hanh
vi
Thie'! ke'
so
dU<;1c
md
hinh
hoa
nhu
mQt
nhum
cae
phep
lOan
lac
d¢ng
len
cae gia
Ir!
du
li~u
truy~n
qua
h¢
thong. Trang ma hlnh
htll1h
vi
ella VHDL
Qua trinh i Qua trinh k
._-
~
I tin hleu
-L
/'
~~
'Tc \
)-
I
'-
II
i
tic h;"
I·
._
I
~~ ~
tic
h;',
r ""
~
rL
~ ~
I tin hi$u
L-
_
Qua trinh j
I
M6
hinh cua qua trinh
II'inh
6.6
}'fo hlllh hoa!
d(ll1g
cua
mot qua Irlllh
process.
143
mOL
phcp
loAn
dugc
gOi
I~l
mOl
qua
trlnh va cac gia
tr~
du
li~u
di
qua
h¢
Ihting
duO·c
gOi
Iii.
tin
hi~u.
Mot M
thong
c6
the
coi
ia trip
hqp
cac qua
tdnh
\'~l
cac
qu<.l
trinh tucmg tac voi nhau thong
qua
cae
tin
hi~u.
Tilt
d.
cae
qu,i
trinh
trong
mo
hinh
tlwc
hi~n
dong
thai
va cac tin
hi~u
Olf(jC
oung
ot
dlnh
vi
cae
qua
trinh
song
song.
Chung
ta
co
the
coi
vi¢c thlie
hi¢n
mt?t
qwi
trinh
nhl1
I119t
vi:mg
i~p
vo
iwn.
Y
DOg
\~p
nay
bAt
driu tli vi¢c tlwc hi¢n
oong
l¢nh
dilU
tien.
Lil)
lugt
den
dong
l¢nh
thu
hai,
tht'r
ba,
eho
den
oong
\¢nh cuoi
ClHlg
va
li.li
quay
trt)·
Ii ti
d{)ng \¢nh driu tien.
Yi~c
tlwc
hi~n
cae
diu
I¢nh
tmng
qua
tdnh
duqc
th!!c
hi¢n
cho
dc'n khi
g0P
dIU
l~nh
wait. Khi
bj
dling
10-1.
qua
trlnh
e6
th~
duqc
tkp
tl]c tlwc hi¢n
tra
Jai.
Di~u
kl~n
de
qua
trlnh
thl.!C
hicn
Ira
L
ti
phl] thuQc
vao
tho·i
gian
thai
gian ngung
cl.!c
di.~i
tmng
ctlU
l¢nh
wait
tn)i qua.
Trang
ohicu
tnIang
hgp
qu;.l
trlnh
c6
the
dU(jC
kich
hOQ.l
tr6
1;.\1
ILl)'
thu~)C
\'~I.U
sl.!
thay
dbi
tqmg
thai clla
d.c
tin
hi~u
tac
d9ng
ho~c
khi cac
dieu
ki9n
d~t
Ia
dugc
thoa
man.
Ngoo
ngu-
YHDL
cung
dip
kha
nang
ml'i
t~i.
nhung tin hi¢u
tac
d¢ng
vao
GtC
qua
tdnh
bang
oanh
sach
cUc
tin
hi~u
tac dtjng. Khi
gl<.1
tri
Clia
dc
tin hi¢u trong
danh
sach
tac di;mg
hi
thay d6i.
qua
trinh
dlf()"C
kich
hm'lt
va
biit
ddu tlll!c
hi~n.
1'r011
hinh
6.6 ta C(S
1116
hinh
kien true clla h¢ thong gom ba
qua
trinh i,.I,
k.
Moi
qua
trlnh i
va.i
e6
hai tin
hi~u
tic
d()ng
con
qua trlnh k
ch"!
c6
m(l\.
tXiu
fa
cua
qua
trillh i
n6i
voi duu van
eua
qua
trinh k va
dau
ra
n\a
quci.lr1nh
.i
noi
Vl1·i
dAu
\,~lO
clla
qua
trinh i.
Ca
ba
qua
trlnh clmg
tlll.fc
hi~n
dong
tlll1"i
\'it
de
tin
hi¢u tac dl)ng
dung
de
kiem
soat tien trinh t1wc hi(:n cae qua trinh.
51.!
thay
doi gia tr! tin
hi~u
t,~i
llhung thai dic·m
tho-i
gian
X<l.C
d~nh
duqc
the bi9n qua
"thai
diem
mo
ph(·mg"
eoa
h~
th6ng.
Thoi
di6m ml'i
phong
trong
ngon
ngu
YHDL
la
thoi
(hem
tQ i
do
C()
cae
sl.!
ki~n
xuat
hiQn
tfen
duang
tin
hi¢u.
Khii
ni¢m th0i
diem
m6
phong
tren thue
te
la khac voi
kh<ii
ni¢m
Iho·i
gian dflng
ho
I1Qi
ti li.
CJc
qua
t1"il1h
lrong
YHDL
dW1c
kich
ho~.lt
l<'.li
moi
hhi
e6
slJ
thay
doi gia lr\
cua
tin hi¢u trong
danh
sil.eh
tin
hl~u
tac d(mg. Khi qua
tr"hlh
t,~o
nen
gla
Iri
eho
tin hi¢u
(Uu
fa, hl' thong m()
phong
se
chi
oinh
luqng
ttl
th(11
gi<l11
trU"tl'c
khi gia
p.'
dU(K
gih ra dau ra.
LLie
do ta
noi
rhng
h~
mo
phong
th~rc
hi¢n vi¢e
d~nh
c
IUC1l1g
trillh ch,) glao tac sau
thai
diem
ma
phong
xac
dinh. H¢
thong
ma
pho,tg clla
YHDL
cling
cho
phep
dinh
chuang
tdnh
144
cilo tn()l
s{i
btll
k5'
de
glao lac d6i
\,()'i
duO'ng
tin
ilJ(~u
ra.
T(lp
hqp
t[11
d
dc
giao tac d6i v6i tin hi¢u
Irollg
llH)1
qUi'
Irll1h
gql
hi
VI-IDL
eung
cf\p m6 illnh hal giai
do"m: elm Irinh
tnt)
phong.
Trang
giai doan
1:
gia
Ir~
Cllil
c,ic
1111
111~u
"t:;
lIme
1112n
giao dich lrong
thi)'i
gl<ln
hi¢n
t',li
dune
Illln
1116i
Trong
gi<li
do'.HI
2: nhilng
process
nh(ll1
I'h(mg
lin tai
Ilhung till hicu laC d()ng sc
tIme hi¢n Ilnll tn,in ello
leii
khi
bi
Lreo.
Kel thue gJai
aat
crall
rna
phung
Chu trinll
rna
phong
GI8i doan mot
crlp
nh~t
tin 'hieu
Giai
do~n
tlai
Thlle !lIen Ifnh toan
Di~u
khie';n
tieh
trinh
cae qiao dich
Ket thue
rna
phong C
lIinh
6.7
ChUll'inh
m()
r1l(ing
ell;!
qu~i
lrlilh.
dO<,lII
2.
Iht)'i
diem
me)
phl'Hlg
se nh:ln
gJ<.l
tq
m(ti va eilu
tdnh
tll\rc
IH¢n
h.li.
Nh:1
thie't
kl:'
co Ihe chi dinh tho'j gian tinh
ILr
thlJi
di~m
hi~n
tho"j
1l1~\
gi<i
Ir!
SC
du\l'C
glri
It'li
tin hi¢u ra trong
dc
du
I~nh
g(m
lin
hi¢u.
l\eu
lrong
du
12nl1
giin lin hicu kh{)ng chi r6
gl(1
Iri
IhO'i
gJan tn: hofle
gi:.i
Iri
ni:IY
b{lng
'()'
thi
Ihi.'!'i
giaD
Ire
lll~\c
dPlh
delta
eua
bO
nH)
ph('lI1g
,,~
duqc sir
ciL,mg
d~
dillh
J.ich
Irinh cho Ihao
1<IC.
Thb'i gian
Ir~
nay
khong thay
doi
thai
di~m
:,\u(t't
hl¢n
tin
11l¢u
d(ing
11<.)
1110
ph(lllg nhulIg
dUo'e
~Lr
dung
d~
kel Ihlic
m()t
rilu
Ir'1I1h
mll phong
\':1
btll (till m(ll elm trillh
1116i.
:.Jc'u
gia Irj
mai
duqc
g<ln
cho
1111
hi¢u kll,ic \'6i gi;t
If!
cu. Ircn
dU'CI1l2
lin hi¢u
XU~ll
hi¢n
s~r
! icn.
Phong
deh
me)
1<\
kic'n true
th("o
dim!;
liCf
lil:u
dfIC
III
11¢
th6ng nluf Gil'
hi~u
di~l1
song
~ong
Clla
Ci\c
dim!;!
du h¢u
Vi:I
dilllg
dc
tin hi¢u dicu
khi~l1.
Then
plllMng ph,ip
ni:l)'
cbllng ta
1116
1:'1
dc
cii:Jng
th6ng
lin.
h.lnl1
vi
lUiln
ehuy0n
e:.ie
dong
dCr
licu 1hen
Ihtl'i
gian
eua
dc
hi:lln
16gic
10
hlJP
nlw
1\1i.lCh
e(lllg. mi,leh so
~iinh.
m'.lch
gi,'li
ma
V~I
de
pld.n
ILr
IC)gic
eo
S()'.
Vi du,
la
et'l
th0
hi~u
lilcn kic'n Irue cua
n1<.lch
C(Hlg
FULL_ADDER
then phong
dell
dClllg
dO-
li¢u
nhu
"'-Ill.
145
architecture
DATAFLOW
of
FUll_ADDER
is
signal
S :
BIT
;
begin
S
<::::
A
xo
I3:
Sum
<::::
S
xur
Cil1
alTer
IOns:
COlli
<= ( A
and
I3
)
or
(S
and
Gn
)
affer.5
I1S
:
end
DATAFLOW:
Trong
yf
dl,!
nay la
co
ba bicu
illl.Ic
gall lIn hi¢u song song. Moi hicu
IhLIe
g,;in
nay
c6
Ihe:
hieu nhllll1QI
qua
Irlnh ,,6i lIn hi¢u
"c'
ben
ph,ii ella phcp g,ill
!~l
cae lin hi¢u ntnll Irong
danh
sach
dc
lin
hi~u
Ik
d¢ng
eua
qu,i Irlnh. Vi
cll,l,
Imng phcp gan
IhLI
ni1{l\'
duang lin hieu S
se
nh(lIl
giJ
If!
A
xur
B
sau
khl
c6
Slf
h211
XU.r1
hi¢n tfell
c1u())1g
A,
ho~e
Iren du(mg B
hO~le
IreB
cil
hai dUi\ng
A
\",1
B.
6 dily
chung
la
kh6ng
d~t
gi<.i.
Ir~
tLrO'ng
minh
ella
IhO'i
glan
Ire.
Do
do
de
111l)
phong
tic'n
lrlnh thVe hi¢n
qua
Irinh theo thai giall, he thong
Sll
(h.ll1g
Ih(:1i
glan tre
m(lC
dinh
delta.
Trong
phep
g{1l1
thu' haL duung tIn
hi¢u
Sum
nh;)n
gi<.1
tri
hic'u
thu'C
S
xur
Cin
sau IOn" so
v{ii
Ihi:J'i
dIem
c{l
cae
Sl!
ki¢n Ircn
uic
d£ill
"ao
S
V~\
On
cu,\ phfill tll XnL Cling
tU'C5ng
tu
nhu v(ly. dueing lin
hi¢Ll
COlli
,,is
nh.)n
gi:1
Irj
« A
and
B)
or
(S
and
Cil1)
sau
:'i
noS
",0
y6i Ihbi
diem
co
sl.r ki¢n
treB
cae
throng lill hi¢u A,
11.
S ho,)c
Cill.
Cic
htlllg
sC:i
co
sa
eo
the dvqc dung
nhu
cae
Iham
so Ire. Trong
vi
d~l
Illty,
ehting
ta
Ih[iy
cae khai bao
ella
tham
so tre
cua
ph:in khai bao
tlwc
tile
\'ll
vi¢e
slr
dl,!ng chung
lrong
kicn Irllc.
14G
VI
dl.l.
entity
FULL_ADDER is
generic
( K TIME
:=
5
n.'i
)~
port
(A.
11.
Cin
;
in
I3IT;
Sum,
COlli:
uut
BlT)~
end
r-ULLADDER;
architecture
DATAf-lOW
or
FeLL_ADDER
is
signal
S:
BIT:
heg,in
S <=A
xUI'll
:
SUI11
<= S
xor
Cill Hiler
2*N
:
Cout <= (A
Hnd
il) or ( S
Hnd
Cm ) affer N ;
end
DATAFLOW,
e.
meu dien
ki,Yn
truc hang
cau
true
Phong
e:."teh
1116
t:.t
kie'll truc th6ng
lJua
c:lu tr(ie x,ie
d.illh
call
true eua
thue
th~
~U'
d~l11g
e:le khai
0,10
ella
c:."te
pldn
tt!
thlll1h
ph[ill \'il cae phicn
b,111
eua cae phiin
tu
thill1h
phan. Cue
mel
hi
cau true
eh{ra
danh
",:.\.ch
eae philll
tu
hO<)t
d<)ng
c[{)ng
thoi
Vi:l
licll ket
giil"a
ule
ph:ln
tu
do, Vi
Ul,J,
khi ta m6
1<"1
C:'\U
truc cua
m<wh
c<)ng
m(ll bit FULL_ADDER.
M:'.lch
feLL_ADDER
dti'(/e
Ihi6"1
ke
tren
co'
s('j
c:te
thLll1h
pllan
Ii:I
HALf<
_ADDER
viI
OR_GATE. Clu
true dlfl/e thie't he' ella
m:.lch
e~)ng
I1H)t
oit chua hai
m:.lch
nt'ra
tong \'il
llH)t
phiin tU'logie
eo
ball
l~l
OICGalc,
C.i.c
phiin tu nily licn
kc"t
voi nhau btmg
e.:ie
tin hicu.
I
~
'0
~N3
HA2
Sum
~
>
- i c
'"
Il"Ilih
6.N
CIU In.k
(',
lillIe
kitn
(nk
ell~l
m;.lch
C011i!
1l1(1(
bit
ell<!
h,1I
till
hitu.
architecture STRUCTURE
of
f<ULL
ADDER
is
component IIALF _ADDER
}lort ( L
ILl:
in
BIT;
Carry,Sum : out BIT
);
end compunent:
compunent OR_GATE
147
hegin
port
( LJ.
L2:
in
nIT;
0:
uut
IllT
):
end
component
signal N l,N2.N3 :
BIT;
HA
I : HALF_ADDER
port
map
(
A,
13,
N L
1\2
);
HA2:
HALP _ADDER port map (
N2.
Cin. N3. Sum
):
ORI
: OICC;ATE port map
(NL
N3.
Cout):
end
STRUCfURE;
Khi
d(l
phlie
li.\P
ella
thie"1
ke'
lang
iC:n.
ni1a
thiet
ke
tlllIong ph[m
Uieh
h¢
th6ng
th~l!lh
nhung h¢ thong con.
eie
h¢
Ih6ng
con
Ilay
li~n
kc"t
ch(lt ehe
theo
ehCre
n[lllg lrong thanh phiin eua
h¢
thong t6ng the. Moi h¢ thong
con
le.ti
Cl)
th(~
dtfqe pilan tach thimh nhu'ng phan
h¢
6
111ue
th,rp
h<Jn
niJa. Trong
ngoll ngu'
VHDL
o'
mCfe
eao nh:;t eua
Ihie"t
ke
nguai la slf
dl;lIlg
m6
hinh
kicn
tnk
theo ['hong
deh
du
true
eua
tlWe
Ih~.
Ciu
true nay se
g01l1
t;)p
hqp
phi":n lxin
eua
de
['him
h~
ke"!
noi v0i nhau bang
de
dU'ung
Illl hi¢u.
Moi
phien
bi111
ella Ih;'lllh phiin
mi.lCh
du\l"C
m6 t.i b,\ng
de
h(lp den trong
hicu
lhell
e[iu true
\"(5i
e<.te
licil
klYt
cUu
v;:\O
V~I
lien
kc"!
(bu
ra
du"U"c
1116
Iii
ro
rimt-!.
eic
phien IX"1ll thilnil ph:in
ph li
lUang thfch \'6i e.te
t1We
th':.
Cic
time
the ni\y
;0
mi.)
lei
de
chu'e nimg
eua
Ih~lJ1h
plliln
mach
btmg cae
mil
hlllh ki61
Iruc theo bi':u
dl~n
e{lu
Irue
hO(1(
h~lllh
vi. Vi du,
d6i
\"()'i
m< \Ch
u)ng
m(ll
bit
ella
hili
tin iliell. ta co
m'.leh
eQng
"i,:
dU"eJe
X[IY
dvng tu
Iwi
1n'.lCh
!lila
tClng
"il
In(lt phrin
tu
OR. Khi
d6
theo
de
m()
1,\
kicn true ella cae Ihve the bang e.ie
m(l
t,i
cAu
true. thve the H;LL_ADDER
c1uqe
t,.\O
b()'i
hili
lime the
HALf_ADDER
V~I
lll(lt
tlH.re
the Ol-COATE. Trong
d{l
tlwc til':
HALF_ADDER co the
c1w;/C
xtty
dL.rng
til cae philn tu XOR
V~l
AND.
\IJ{) t.l
th~re
th~
HALf_ADDER theo
cflu
Irue tu
de
rlltin
Ill"
AND "i\
XDR,
148
entity
HALf_ADDER
is
purt
(
10,
I I : in
BIT:
S,
CO
:
out
IllT
);
end
HALf-_ ADDER;
an:hitecturc STRUCTURE
of
HALf_ADDER
is
component XOR_GATE
port
(
III.
I
I:
in IlIT;
0:
uut
IllT
);