TRUONG DAI HQC BAcH KHOA HA Nor 7 LlNH GIANG /' K • TRUONG D~I HQC BAcH KHOA HA N(n NGUYEN LINH GIANG A' -' THIET KE , H BANG MAy TiNH • Giao trluh cho sinh vien Cong ngh~ Thong tin, I)i~n tit Vien thong cae truOng d~i hQc, cao dfing ky thu~t thuQc cae h~ dolo t.w , NHA. XU'\T nAN KHOA HOC vA KY THUST HA N(JI 6-6C2-01-6T7.3 113-244-03 KHKT-03 Uri n6i dilu ClIng nii .\'1/ ,i('// h(1 ella khoa !rec k.v fhlll)t, l'i~;c 11/ d(Jtlg h()(l rhie'" k( ("{Ie m(lch di~1I fl'( drillg nI(Jr \'(/i lui qllall hellg '/"o/lg "/(;(" tlllle del)' Sf.'" pil(I' tri/n ".f rllll(l{ tilllt (mill. TII'I11117)lg IIdm 50 n;a lilt k)" 20, (III(/ 161111 pluff/ric'll k} rllll(tt di~;11 fir dd qlla Jlhi/u giai do(w: 1/( IIllling b/i/Ig dhl di~;11 /If'd6! nlurllg h/mg /)(111 deln, qua IIltirllg nlWh licli IWp IIlId r6i {(il llliii'lig mwh \'(1'/ nl/lt d() Ifcit IWp!/fIl I't/ sihr 1/111. NIIII)lg nlWh licit IWp loai 1/(1), CfY fli/ ell/'(O itdllg 1ri~;11 finl! kii;'11 h/m d/i/l (FCII nl(J{ II1Wh. \ 'f (il.l di(;'1 flil/II h, ("lIe h(! )'i XII' '-". Vi('(' lf1i(" k( /lll/l'lIg mach l'I)'/ d(i tidl it(IP hl/l \'(/ S/('II I!J"f/ k!/{)/lg 111/ ///1/(' hi~;11 nl()t ('(leI! tllli C/jng. /lid plu;i u; Sl/ Xilip (hY (,Iiu mciy lillh. SUII f1l()/ .1'/;' lIlinl guing d~IY nUJ/I hee 'Till'" I,j nrw-II 1/1/(')' nUlv Ifnll" t~li Klloa CrJng Ilg/i¢ TII/mg till, TI'II/)'n,!!, D(li h(lc H(icil kho(l Hti N()i, Il'hl ('(/ sri Tlwm khdo kilili nghi¢nr gidng d~ly Clio ('(Ie ci(ing IIglli{'p I'({ cdc tlli 1i~'11 !1r1l(!C flllh 1'1,11 lIay, ell/ilig IrJl hiL;1I S()(III gido trillil c/to /Jujll hpc II(IY, nh/im (,illig (,(I{) till li~;11 tllOm I-Iu/o clio sil/II I'h'lI ('1111.\'('/1 IIgilllh C/Jllg IIgh~' TJU)/lg lill, Di~'11 tlrVitll tll/lllg I'd 1I11I(I:g (Ii (II/Ifil (tim tim hilu limon Ii(H' Irc'lI, "j rollg CII(;'II s(leh I/(I.\' ellllJlg t(ii Iril/It hay nlc giw doqn qllWI !r(ln:.; lrung (/1/(/ Irin/r {hie" k(j'I'd .will XI/(I! cdc mw'lI tleh l/(ir tmllg ('(illg IIghi~;fJ, Qml trillil 1/(/-,,: hao g(JJ1l ('(Ie /JI(//{' IIlIi hill" IUla m(lch tn'/! CUI' nll(c d(j chi lu't kll(ic 111/((11, xciy dl.olg mwh 1'(/ ki/m IIglli~;1II IlI(ICII, Clllillg I{)i kluJ/lg tlwI!! I'ellg Irinlr hdy IJr 01 C(1e 1'(111 £1/ lie'll qllall I()'I lett oj cdc gilli d()~1/1 ('[ia qil(l Irinit .\'(III.rJ/(/{ IIId ellli Y(';' {(Ie trill/g 1'(/0 111 'I ,I()' CI)/lg d()~fiI: Tlli(it k/ Ill/I hilll! !UJ(I tlwch I'd ki/m !lghi~;m {filII (hing dt/II nia Ihic;, k/ Trhl gUli d()~111 1176 hi/lft !U)(/, lrollg 1111/(' t/ ('(J IIllItll /'<.;/ill IIgl7' OJ Iht'dll'(!C Sir dllllg 111111' SPICt:, VFRILOG, VIIDL , sOllg cluillg /1'1 r~ifJ !/'IIlIg I'c/O trill It bdy IIg/j/lllgll'\/HDL trong gi(io Irillli lillY, !Nfi nglJII ngtr VIIDL ld tIl(Jt IIg/J1I IIgii' OJ tillfl C{/II tl'lle ('(lO, M(JI d{ic dilm (/1/(/11 Ir(!I('<; Clia IIg01l IIgll' \ HDI. Id /I() clIO p!tL;fJ flU) lei' tfllL'! At" Tileo 11111/11 tlllit d(j ('iti !ie'; kh(IC 1111(111 - ll/' nl/rc ki(',1 tl'l/e d(',1 ('(IC cdll Inie I'd ti(ing cI/i' 1i~;II. Vri'i nhii)lg 11'11 di/m IIdy, Ilg/)II IIgii'FJlDL clIO phL'P xci)' dl/Ilg C(IC Ihidf k(mwh III' 1(/lIg qlUfT dJlI clll li(", clIO pl/('p IIhd Thief /':(UI Ih/ liMn fII(;T (,(lell /('{lIg the>" qwi trin/t thit'! k( I'd: gilip clto qWI Trinh ki/m Ira tfl/It tiling ddll uta titil'! Af dl!'(!c de ddllg. Cltfilit llit(1 \'~IY md IIg()n ngii'VHDL 3 dll(iC Sir dUllg r(!lIg n7i [rollg djl/g IIghir'p ehe'I(Jo mwh di~;1/ III' (,(J de) rich It~)j) C([O . . f\"IUfll ((If) ('11(/11 S(lefl dWfC .rudt hdll, dUIl/g I()i .rill clUJII IIie/1I1! ni//1 (m SI/ ,l!.()jJ .~' cllcllI tillli CI/O Ule "~III ddllg IIghi~;p (rollg B(j /}/(J/I Kv tllII~jf Mel.\" linlt, KI/Oo C611g IIgh~; Tht'illg rill Trtl/iIIg D{li Ii~)c D(Ic/t kho(l flil N()i. D()-n,~ [f/(Ji, ell/il/g I()i Cllllg c//(111 11/(11111 ('(im (ill SI/ kllll.W'/1 khicfl l'rlf{1O c/I/II ki~'1/ Clio Nlui XI/crt bdil Khoo flee I'd K)~ flllldt dl CWil1 Sikh /1(1)" .\,()'m dl({lc ra el()'i. CUr// Cling cluillg t(11 I/IOllg IIh~JI/ dWfC Sl/ cI(l/lg g()p ql(~' ball Cliu cdc b(1I1 d(}'lIg IIglii~'p 1'(1 h~1I1 d(){' Xli gd"1I d/lrill {(JI IUIII sail ('I[(}II S(lcit dl(/c hOc/II ehillll /l(iII. T,le gia TS. N~uycn Linh G-i:mg 4 MI,lC ll,lC Trang LO'j noi dati Chlwng I. Ma dati vao thiet kc In<:,ch vi di¢n tu * 1.1. Cae pl1[lll d(x~n trong thiet kc d.c mach lfeh lwp ~ 1.2. :\16 hlnh hoa nwch di¢n ~ 1.3. T6ng hQP va 'oi uu hoa 111' lCh dung Imi), tinh Chuang II. Co' sit toan h<;lc *2.1. f)~.li so Bool YU I}' thuyct chuyen mt.teh ~2.2. Cae h~un logic va d'.lIlg chufln uk *2.3. T6i thicu h6a de bieu Ihue logic 7 7 , III 12 IY 19 22 27 Clllwn~ III. Co so ella thiCt kc logic :t'i *3.1. D.)c diem cLIa qu!.! trlnh thic"t kc m~\ch miiy tinh 35 *3.2. Cae phan IU logic C0 ban 40 ~3.3. Thiel ke d.e nwch t6 hQ'p '-1-3 *3.4. Nh(l'ng \'un de khi thie'l ke mach to hqp 51 *3.5. Thiel ke cae mt.teh tuan tl! 54 *3.6. Nhung van de khi lhi~-t ke Ci.lc m<',lch tufin t~r 67 Chuong IV. NhO:ng khai ni~m chung ,"'c mb hloh hoa phan 77 drng *4.1. M6 hlnh hoa philn cung ~4.2. Otc ngon ngu m6 hinh hoa phun cu:ng ~4.3. Otc mo hiBh tnlu tuqng Chtwng V. eric phuong phap mt> hlnh hoa logic ~5 .1. Co sa ma hillh hoa logic ~5.2. Phuong phip ma hinh hoa hi en djch §5.3. Phuong phip mo hlnh hOil hu6ng sl! ki4n 77 78 87 95 97 106 I II 5 ~5.4. M(l hlnh hoa qua trlnh tre tin hi¢u trong cae philo tLr 1T1i.Kh 115 ~5.5. M6 hlnh hoa tren mtre cae phan tV logie 114 Chll"tJllg VI. I'oigon ngu ml> hinh hoa VHOL 131 96.1. ~vll~ <.UtU ng<.'m ngO VUOL 131 ~6.2. Cic c:{u truc co so trang VHOL 136 ~6.3. Cae kie'u dO ll('u 153 ~6.4. Toao tv \';1 bic'u thue 162 ~6.5. etc cAu true tuiin tv 171 ~6.6. Dic cilu true song . ,ong 1X7 ~6.7. Cic chu"Ong trlnh con Vil cae goi clnwng trlnh 196 Chmmg VIl. ~lo hlnh hoa m~.lch bill1g ng(ln ngu VHUL 207 ~7 .1. ~vl0 hlnh hoa Iren mile crlu true 207 ~7.2. \16 hlnh hoa trC:n ll1Lrc thanh ghi truycn dq.t 219 ~7 .3. ~16 hlnh hoa de 610111<11 hiJu Iwn 231 Chmmg VIll. C{IC phuong ph,ip kic'm tra loi ml,lch logic 243 §8.1. Cae 1116 hlnh lui logic 243 §8.2. Bai to;io phat hiGn 16i 250 §8.3. Cie phu<.1ng ph<.lp thu,~t toan tong h<,l"p uk gia tr! thiI nghi¢111 264 ~g.4. PlllfO'ng ph<ip!TI6 hinh h6a 101 277 §8.5. M(l1. so pilU'0ng phap lam d<.m gian hoa qua trlnh kiem tra phat hi911 16i 288 Tai li~u tham kluio 297 (, CHUONG I. MO DAU VAO THIET KE M,.,CH VI DI~N Til §1.1. Cae ph:!n do:;t" trung thiet ke cae mach tich hqp SV ra (\i:J'j ella de mach \'i di2n Ill' di'i l:un co' ~h phel! tri~ll phCill cll'll~ \,~I phi-til I1lCIll Cllil de h~ th6ng tillh t,xtn tl'Ong nhl1"ng th(tp k~- g;lll d,ly. Vll'l' \,\ng hen n,le meTe d6 Ifch hqp ella de lll<.lch c1i¢n til' IrcH tnt'll 1ll::11 don d~l dua t6i \'i~c che 1<,10 nhilng I-u; thong \'O'i d(l phdc 1' 1]1 ngay c~lllg t:Ing COll)! ngh!.,' che I~\O m,~ch Itch heyp tren eel sb' uie chflt han d,ln pluit trj~ll \'U hao. T(1i gifb.l nhfrng n[\[11 RO elta the k)' 20 nglf(1i la dil dl lh~ chc tao liU'(,il' llhung \11',lch 1ich h9P chu-a lui h(\I1g tri~u liuh kicn di¢n lU trcn mot lmh the ch~-ll b:ln d,ll1. I\'hU11g llwch dl) duq'C gqi El m'.Icil lich hQ'p cao(VLSl) ho~c \a mi tell vi cti¢n IU. Vi~c ra dui etla nhung 111' leh vi di~n Ill' (hi him nay sinh "~f can Ihid ph,!i co ITIQI phuong ph{ip luan va quy trinh thie't ke'. ehe 1<,tO thieh h9V. Trong eoog nghi~p. v,~c che' t, tO uie nweh lich IH)p dU'Q"c thL!e IlJ¢n qua hon giai dm~n: • Giai dmm thie't ke. • Giai c1o<',m che' h.W. • Giai do<.~n ki~m tra. • Giai c1m.1I1 dong go!. o giai do,.111 thiel kc. Itr de ehue nang ma me.teh sc tlll.re hi¢n. ('hClng ta x,ly dung mCl hinh ella me.leh tren nhi~u mue de) chi liet khac nhau. Cae muc de) chi tiet co the (hrqc ehia thanh muc kie'n true, mu:e logic, mCre V(lt 15;. Ket qua eLla giai dO<'111 thiet ke la cac rm'l hlnh ella m,wh (El duvc xac lIil(1ll kh6ng ehu:a loi tren phuong di~n thiel kc. Gi<.li <.10<.111 th(r hai iiI giai c1O<.I11 che' h.l0. 6 giai c10,.111 nay, m'.Ich tieh hqp se duqe che \'.10 th :o dc e(mg ngh¢ eflY ghcp d.e phfin tLf lllC.lCh iClI dIe tinh tht chat bi.in d<'ill btll1g phmmg phap m~11 na che phLI vi'I cong ngh¢ X{IY dung cae mach nhi~u la-po Ke't q\l(i ella giai c1m.l!1 llay lit nhung vi mach time hi~n nhfrng ehLfe n[mg nhu trong thie't kc. Giai doan ba la gi<'lI c1m,1I1 kiem Ira. 6 giai dO<'.111 nay, nhu'ng m',lch d5 che' t"to se dU\J'C kidm nghi¢m ngau nhicn c1d khiing dtnh dll1g l1l<:tch kh6ng ebu:a loi ve m,)! ehe !<;Io. Trang truung hqp co nhilng 10, g(lp nllleu litn c6 the rut ra 7 1<:6'1 lutlll loi do eo Ih~ la loi lrong qua Irlnh che l<;to. Dl!<I \'aO VI¢C kitm Ira quy Il'lnb eong ngh¢ la e6 Ihe rUI ra ke'l lU(1l1 \'e cae kh,lu c6 Ih~ >;mh ra luI. Cil;\[ doan euai clll1g I~I gml c10an dong g6i. Ll:ic lki de vi mach sc ducfe phfll1 laeh \'il du~jC I,.to Vl') hoe. Trong ehu'ong trlnh ta s2 nghi2n eCru ky giai dm~ll dill! ti2n iii giai duan thict kC. Qua trlnh thic't kc' nie mach vi lti¢n tti lrung cong nghicp c1uqc ehia Elln ba ph;ll1 dOi ll1: • Mo hlnh h6a. • T()ng hqp vii lai Ull ho'\. • Kl~m nghi¢m vii phi': eilu£ln. Trong do ehung la 1(lp trung vi:1O blli loan m() hlnh hoa maeh \,~I 1611g hl.lp. t6i ll'll ho;i mach. Pluin du~n dUll lien: 1\-11'. hlnh hO{1 6 giai dm.1i1 n~\y. nh~1 thie't ke X[IY (hyng de mo hinh dIll trllc l11<,lch \'il de ch(re n~lllg ma mi lell >;is tlll.re hi¢n. Cic mI.) hlnh m;.leh iii c{)1l1:! cu bi(o'u di~n d.e ;' tu'('mg thiel ke. Mo hinh ho,\ el6ng \'al tn) quail lrong Irong LI1II.':1 kc' m:.Ich \'i di¢n ILl' blii \'1 cac m6 hlnh Iii nhung phuong lien mang Ih6ng Lin \'(~ dc mach s0 duue xiI)' d~rng m6t deh Cl) dong VlI ehinh x,ic. Do d6 Ill() hinh e[m ph;ii ehinh x<.i.c. ch[lt ehl' eOng nlur c6 ml['e ell) 16ng quat. trong su6t \'(1 de hl~U c10i w':ii ngl['()"i thiC·'t kc "il may. V{)'i sl,l' phat L["J~n eUd cae k5' Ihu,:tl mo phong, me) hlnh 111<,1ch c6 the duqc xi.ly d~rng treil cO' so' Ciic ngon ngL'i" 1110 l;i ph[in eU:llg HDL (harclwar~ description language>;). Trollg nhicu tnIll'ng hnp, Ciic mo hlnh de) hqa nhu bieu do dong thong tin. so' de) m,.teh V(I 1lll) I;i hinh d'.lI1g hlnh hQc eLla cae d6i tU'(5!lg cung nhu deh sAp xcp cluing Lj'~n Ixin mach dell eo Ihe dUQ'e dllllg d~ hidu <lien m;.Ich. D6i vt'fi llhi}'ng llli,leh co dt) lich h0'P sieu lall do dl) phLi'c t:.lp ella mach n'ft eao nen \'l~e X[IY (h.rn,!! 111l') hinh mach Ihuang Iheo eae IllLrC d() chI li2'1 kh,ic nhau. Dieu d6 elm ph<'sp nglf(\i Ihiel ke' I:~p trung \'aO tung ph,'ln Cl'la mo hinh I;.li 1[l'llg giai dO:.lIl thiet kC:'. Ph;'l11 d()~n hai: Tong hqp va t6i I(lI hila Tl)llg lWp mach iii giai cto'.111 >;;ing I'.l() thCr hai ella qll,i trlllh ll1le-l ke'. ('lal dOi.lI1 dill! lu[m theo cae \' lUl'mg: cllil nh;1 Ihici kc hl1111 111>l1h (hin de kh;ii ni¢m Y~ 111<.lch Y~I xay dvng nhung mo hlnh sO' h9 dfiu lien ye m'.\'.:I1. Ml.lc dleh ehinh cLla giai dO<;ln t6ng h\Jp mach I~I xfly dVng 1116 hlnh chi liel ella 111<.1ch. v\ dl,l nhu cae chi liel \'C dang hlnh hqe phl,le vu cho cong dO'.I11 Illp nip viI tao vi) bge eho mach. Dicll n~IY d'.lt c1l(.iC thong qua yu.\. trinh xay dung: V~I chfnh xac hm\. thiet kc ti:rng: bu6e trong d6 m0 hlnh truu wq"ng ban diiu dW"iC ngui\i thiet ke chi tiel ho<1. tung bu6c I~p (11 I~p l<:li. Khi thVe hi¢1l qUi. Idnh t6ng Iwp 111'.lch theo dc blfac Gii tie'n m6 hinh, ngu(1i thi('1 kc" dn nillcu thC)ng tin lien quan 16'i cae e(lIlg ngh~ che tao YLI cac phong cach thi(,t kc 1l10ng l11u6n. Ta co Iht thtiy e.lc ehCre nang ella lll<.\eh e6 Iht dge !{Ip \'Cii cae chi tic"t thut hiC'n, trong khi do Cile d~lt1g hi6u dien hinh h~)C ella nwch hO~1ll toi\l1 pliu thU(lC \'LIO cac d;)c tinh ella cemg ngh¢ vi dl,l nhu kfch Ihu6c cLla de d[ry dim IroJlg miKh plll.l thuQe dto cbng nghc ehe' 1 •. 10. Bai Imin t6i It'U mach IUllll ke"t IWp cll(lt che \'6i bili Imin t(')ng IWp m'.lch. Qu;.i trlnh 16i lilt dOl h(')i phill Il,l''-l chQn nhung chi lict dc djnh eua 1l1i lell \'()"i ml.lC rlieh lam Hill'; kh,'1 Il~ing ella m'.leh "e phuong <.lJ¢n thie"t ke tuong Crng v6i nhiJng d(l do x,ie djnh. Vai Ir() ella tcii lru IiI n[mg cao chell IUq"ng ella mach dien Hlur tOL uu \'~ chue nan". \'C dj~n ttch, \'C tll1h d~ kiem n"hicm \'i'l . _ b . b , ph,it hi¢ll il')i. ehuc nimg lien quail t6i thl"ii gian rl6 Ilwe hi~n Ill(lt qu(\ trlnh :Xlr I)' th(lJIg tin cung nhlf ~ci IUQ"ng Ih6ng lin c() lh6 dU<;ic XLe Iy trong 111(11 d{1ll Y! Ih(l"i gian. Cilc tlnh n,-mg ella mach Iii anh lur6ng 16n t(1i kha nfulg eanh tranh ella m'.leh trC:n th; trui:5ng. V.tll dc ch{lt Iuong ella n1<,leh cOng !ten qllan t6i kkh Hllr6c cling nhlr di~n tfeh clla n1<,leh. Di¢n Ikh cung IiI d6i Wong cLla 16i uu mach. Kfeh Ihu6e nhl) ella me.lell eho phcp co Ih6 ph.ln b6 nhicu mach tren IIl9t lap. dicu d6 IZlln gli.im gl.l IhLtnh che' lao \'a d6ng g(ll. Trong dmg nghi~p ehe' 1,.\0 chung la Il10l1g muCln c<.'l nhung IhiL::t ke' eho phcp ph.it h:cn 10] \'a x.ie djnh \'i tI'l 16i ella nl<.\eh sau khi ehe' tao. Kh.'t nfmg !lilY. lrong nhicu truil'ng hup, :lJlil imtJ'ng 16n t6'i eh:it IIJ'~l'Ilg ella l11~leh. M(ll tht'H1g ~6 quan trqng lrong \'eln de plUl1 hi¢n loi ella Il1i.\eh li\ ph[ill Inllll loi e6 th6 duo'e ph(11 hien doi ,,6'i mot h() g]a trj thLe nghi¢lll. l\'oi chung, ngU'{Ji thic"t k.c mung mu()n c6 nhung m,.ICh de ki~m nghi¢\D, dieu d{) lam glillll gi(l thLlllil chung: ella qUil tl"lnh ~,\n xuelt. PhilO dOl,l1l 3: Kicm nghi~m "'a phe chmln Qui Iflnh phe chuan m'.lch ILl vi¢c (t,lt dw.IC <'1 m()1 mLre (t() eh(lc eh{lll hop 1)' rang 111<.1ch dicn sc lam \'i¢c dung v6j gi,\ Ihic"t khong c6 loi clie" t,.lo. TrC:n ') [...]... IlH )1 kh(ii [\VII kh;ic lll(yl kh(li cap III [ ;1 kh(ii con m chieu n;\]n lrang kh6i /I ChlCU \'~l liel! r 10 1 gi,-lll 1; 1 kh6i Ir'ill nhSI ll;illl Inmg I,-~p hop V 1( /) lr'm nkll Irollg Inr(l'Ilg [](/p l1~ly Vit) Kh . ( /1/ ( /11 Ir(!I('<; Clia IIg01l IIgll' HDI. Id /I() clIO p!tL;fJ flU) lei' tfllL'! At" Tileo 11 111 /11 tlllit d(j ('iti !ie'; kh(IC 11 11( 111 . k/ Trhl gUli d() ~11 1 11 76 hi/lft !U)(/, lrollg 11 11/ (' t/ ('(J IIllItll /'<.;/ill IIgl7' OJ Iht'dll'(!C Sir dllllg 11 111 1' SPICt:, VFRILOG,. TII'I 111 17)lg IIdm 50 n;a lilt k)" 20, (III(/ 16 111 1 pluff/ric'll k} rllll(tt di~ ;11 fir dd qlla Jlhi/u giai do(w: 1/ ( IIllling b/i/Ig dhl di~ ;11 /If'd6!