Phltn ban OR I gtlt1 \'6'i tlu,l'c IhJ OICGATE lrong tilu Yi¢n WORK. Ph:lt1 Itch VIIDL Ii'! qu{t Irlllh kicll1 Ira Ihi':t kc' VHDL eho dllllg Cll ph<.ip <I nglf nghTa. Sau khi phtlt1 Itch VHDL, d.e don \'! thiet kC' sc dUQ'c luu giu' trotH! C{tC thu vitn de sU: dun" sau n~IY. Tim \'len thiet kc co the chefa nilu"llo ~ . ' c _, c phein tLr tilu \'i¢n sau: Goi : i:'lllhlrng m() ta, khai b,io clU'0e clung chung. Tiwe the: Iii nhling me) ta thic'l kc dU\K dung chung. Kic'n true: nhlrng thie1 k( chi tic't dlfqc dLlng chung. C\u hinh : [;1 nhu'ng phien b,in ella thlle thc du(}"c dllng chung. eic don vj tilu' \'ien Iii dIe e<.'iu true YHDL co the dUQ'e ph,ln tfeh rieng r0 thco trlnh 11,1' nh[11 d!nh. Vi dl.l, tlwc the ph,ii dUQ'e ph,ln tfeh truCic kil'"n true eua chung: dc gOI phai dU\1C ph:111 tich truCK khi UU\K dan v1 thiet kc su' clL,mg. Trong ngon ngiJ' VIIDL co 11m vi~n Ihie't kc' d,~c hi';l eo tcn IZI "WORK". Khi chung la hien d!ch m61 cillwng Ir'inh viel tren ngt'm ngli VHDL nhung khong chi r6 thlf vi~n dtch, chucmg trlnh nilY sc dU\K bien d!ch Vi:I eh(ra vilO 11m vi¢n "WORK". Vi d~l, knh \iC My-Design.vhd sc ki~lll tra eu phap cillrung trinh ntun trong t¢p "My-Dcsign.vhd", d1eh L _B~9~p~h~a_n~1 -+ tfch _ [ j library-1 [IEEE - [ STD - WORK Thllv,en [ - omop ong VHDL 9 tong ap VHDL lIinh 6.10 So lui hie'll rlicn qllli lrinh bi':n dich va m6 phon12 Ili' cillt(/l1g trinh lhimh e<ic lhlr \'i~1l ella ngon ngfr VHDL. sal! d{) nle t!m "icil ~L: dU'(ie dli'<t \'ilO!J': me) p!JClIlS_ cillf(mg trlnh clo r()i ehlb vilo thu vi¢n "WORK". Illnh 6.10 chi ra de phU'o)lg thue slr cll;lllg cae Ihu' \'i~n thiet k~ trong ngon ngiI VHDL. l\gon llgU VHDL c6 ba di,mg d6i 1Lf9'llg: bien, tfn h~¢u \'il hi\ng, Phfl!l khai lxio lrung C{lC du truc ng6n ngCi so: h~t ke cac deli tWl'ng s2 Sif (iL,mg. CiIC klCll ella dc d6i IU'0ng do \'J. giii tri ban d:iu mil Ch(lllg sC nh(lll lrong qua trlnh I1H1 phcmg. 1. Cae d6i tut,mg du li~u Trong ngon ngCf VHDL nglf0i 1<1 p\},ln hi¢1 ha loai d6i 1lH,:ing dCi li~u: htlllg. hi~n \'~I tin hi¢u. Cac d6i 1L1l)'ng du'C)'c c1[\C 1<.1 dl,ra V:IO C<IC tlf kllOa. NhCing ILl kho{1 n:l)' rh~li xufit hi¢n 0 rhfln (HIU eua rlhin khai bao cloi tL19'ng. a. Han~ Htlllg b el6i Ilf9'ng dl!9'c khc)'i tao btl11g nhCing gia tr! nhfit djnh khi dl!0'C 1' 10 ntn trong qu<i Irinh thve hi~ll va sau d6 gi,i lri clla h,\ng khong lhay (h~i. Htlllg co the dL10c khai b{1O trong cUc gai. timc Ihe, kie'n truc, cillf(mg lrinh con. khoi Va qu'.l trlnh. Cll ph<.ip kiwi bao hung: constant {ell hiing . fhl hlillg I: kic'll 1;-::: i ;/(i fr! J: Vf d~l, constant CIIAR7 : BIT _ VECfOR ( 4 downtu 0) :-::: "00 III "; constant MSB: I~TEGER;::= 5; b. Bien Bien HI d6i tU(Jng du' li¢u dung d~ clitIa nhCfng kc', qU~l trung gian. Bien chi c6 the dm!c kiwi o.io ben Irong cac qua Idnh hO~lc chuang trinh con. Bien \uon eli doi \'6i kiC:u. do d6 bien rh,'ti dlt'(K kiwi baa kiC:u. xac d!nh khOi.lng gi{)'i h~lI1 hO~lc gia Ir~ kh{)'i I~\{) ban dall. M0t d.ch m~le d!nh, gi,i Ir! kh(')'j 1:,10 eLla hic'n El gicl trj thiip nhiit trang cae gici. trj thu(lC mit:n x.;ie dPlh ella ki6u. BiC:'ll eo Cli pllclP khai belo nhu sau. Vi d~l, Co Tin hiell variable Temp: ilIT_ VECTOR ( g duwnto 0 ) variahle Delay: INTEGER ran~e 0 to 15 :=0: Tin hieu l~l dtii w0ng du li¢u dung de ke't n6i gii!":l cae qua trlnh ho<)C d6ng b<,') de qu,i trinh. Khai 1xio tin hi¢u :0.13 1<.10 tin hi¢u 1116i c{) GIC gi l tl"! ella ki6u x.ie djnh. Tin hi¢ll c6 thc duqc khai b.lo tfOng ph,\n khai b,IO g6i ( khl d6 tin hi¢ll sc Iii tin hi~u tO~IJl Cl.IC ). khai b,io tlll!e th6 ( khi do tin hi¢u b tin hi~Ll toan CL.lc eLla tht!c the l. khai hao kicn tnk ( tin hi¢u sc 1;1 tin hl¢U tO~1l1 clie ella ki6n true) V;:I trung khai. Cae tin hi¢u c6 thc dU\K SLf dung nlurng k.h6ng the (ILrqe khai bao trong c:ic qu.i Idnh \';1 dc chu()'ng trlnh con. Co the gi,:ll thieh dieu n;IY nhu sau. dc qua trlnh va chuaHg trlnh con 1:1 Gte thanh ph.i]) e0 sa eua m6 hinh \'il. dU0e coi 1<'1 e.:ie hl)p den. Cite tin hi¢u -;c \;ic ch)ng V;IO c.ie ht)p elen do tv ben ngoi:li. Cae d.ip ung Cll.1 hl)p den SC (ll1h hU'l'mg de'll dlrCil1g tin hieu fa. Cic tin hieu c{l Cll phci.p k.hai b.io nhu' sau. signal Ikcp: BIT:= '0'; signal Res: INTEGER range 0 to Ion: 2. elK kiClI dj1 Ii~u M9i dai tut:mg dfr li¢u trong ng6n ngfr VHDL deu ph 'll dm:c d!llh nghia boi c le kicu di}' Ii¢u. Ng6n ngiJ VHDL eho phcp sir dYllg CilC kicll co sO de t, l0 ncn de doi tLr0ng pi1(fe t' lp han. 154 KiC;u ph<.ll du\1C khai h,ia tmoe khi Slr dl.lOg. Khai h<to kie'u x<tc c1inh t(:11 kitu vi\ mi6n x,\c dinh eua kieu. Cae khai baa kicu e6 the n:111l troug plHin khai b{lo cLla g6i. khai b,\o Ilmc th( klUli hell) kicn true. khai h,IO ehuD'llg !rlnh con vii kiwi b,.lO dc qu<.i trinh. Cae kicu dCr iL~u ehinh trong ngon ngCi: VHDL: Kicu ki¢1 kt. Kieu so nguyen Kicu du'CJe djnh nghia tru6c eua VHDL Kicu lm'tng K ieu h,in ghi Ki~u STD_LOGIC. SIGNED va UNSIGNED. Ck h~u con. a. Kicu Ij~t kc Kieu li¢t ke dmJe dPlh nghia hilllg c{IC!1 li¢t ke t[{1 Cli cae gia !rj e{) the e6 clla kicu. CeK gi<.t !rj nilY do nguoi Slr dl,lng x.ic dmil \'a c6 tile la c;ic kn hO;lc nhung ky' q.J'. OJ ph<.ip clla klCU li¢1 ke Trong ngon ngCi: VHDL kit'll li¢1 kt co (h~le diem kh;ie \,{1i kieu li('\ k0 eLlil de ngon ngiJ 1(lp trlnh khae. M{)i gi,i tri trong thimh ph[in ella kicu e6 tile xuii! hi¢n trong hai ho~\C nhicu hon kicu li¢t kt. Vi d~l, type Color is (Red, Orange, Ydlmv. Green, niue, Purple): type Light is ( Red, Y cllow, Green ): t~pc STD_LOOIC is CU', 'X', '0', '1', 'z', 'W', 'L', 'If, '.'J: yariahle X: Color: si~nal Y: STD_LOGIC: Tron o cae n"(ll1 l1"illap trlnh !ruven thOll", cae liet kc khong dU(1C phcp eo e e .• e . ~. ch(Ta nhCfng phan \\i gi6ng nhall. Trong VI dl,l tren, tmng cac ng6n ngiJ I,)p 1:')5 Irlnh Iruycn Ih6ng de khai b,io hai kitu "Color'" viI "Lighl'" iiI sai \'~ m~tt ell ph,ip. Dicu do I~\ do n2~u m(lt hien X co kicu 12t "Colm". thl khl thl.fC hi~ll phcp g,in x ,= Red: ehuong trlnh dich se kh()ng xac dinh dLlqc gia Ifi 'Red' Ihuc)c mien x<.le dPlh cua kieu n~lo! Neu gia tr! 'R.:J' J6 thU(1C kicu "Color" Ihl pilcp gem lit dung. Tl'Ong trlfong hqr gia trj 'Red' thu(le ki~u "Light" thi phep gem do Ii:I sai. D~ gi,ii LJuye'( tinh tri lllg m(lp ma do. tl'Ong ngt'lll ngu YHDL ton 1'.11 co ehe dinh kieu. Co ehe nay cho phcp xae dinh mr)t each tU'ong 111mh giet tri dang xcI Ihu(le kleU n(lo. M6i d6i IU(,mg xuilt hi~n trong kicu co mc)t vi trf nhflt dll1h \'il duqc Xi.le dinh b6i trtll tLl xu:it hien. :\1(lt c<tch mac dinh, doi ILlqng dtiu lien c6 \"i trf O. deli tuqllg tiep theo c(l vi lrf I. v.\'. Trong qua trlnh tcing IWp phi."in clrng, kfch thude ella tin hicu ho,)c bi61 klCU li¢t kc dUQ'e x<\c dinii blri so Iwmg bit nh() nhSI de mJ h6a s6luqng de gia tr! li¢1 kc. h. Kicli s(i nguj"cn Kicu nguyen Ji:t llli~n xac dinh eua dte so nguyen. Ttlt Cit c.ie plIcp loan to il1 hqc th61lg thu(l'ng deu.up dl;lI1g dur/c eho so nguyen, Cal' phep to;in th~rc hi¢ll tren kic'u nguyen IiI: +. *, /. Quy ti.k Cll pilar kilai hi.lo kicu nguyen co dang nhu sau: type U;/1 ku;;{ is ran<>e mU;/1 \() Il(l{/\C/I . . ~ ~, mi/II \(j' IIglI\(,1I I~\ mien can eua t(lp hop s(j nguyen. Vi dy, t,ype lnteg~r is rangs -2 I 474R3047 to 2147403647:., t)'pe Twos_complement_Integer is range -3276R to 32707: c. Cae kieu duoe dinh nUh)a tru6c tron" VHDL . . ~ ~ Tileo tieu ehufin IEEE 1076 - 1987 ngu'()'i ta x<\c dinh hai gOI ehutin: g6i Standard \,~I goi Textio Irong tim \'i~n STD. Moi gOI chua t(lp hqp eic kicu V~I toan tLe. Trong gOI Standard chua tat d. cae t¢p nguon elm ng6n ngiJ' YIIDL l:So v(1i cae !l1~nh d~ [In. Sall d:IY \,\ m(lt s6 \";iC:u ehu,-In dlHl'e 1116 ta trong g/ll Standard. Bouh'<ln: kiC:ll lid kc c6 h,-11 giCI Ir~ faise vii true \/ii qLlan h~ fHI~e < trul'. Ck phcp t,:i.e dQng kn doi tlf()'ng \";i~u Uoolcan ;;\ rh0p lo,ln 16gie vtl quan he. Cae phep toan n~\y If,-I h.li gi.1 tri ki0u Boolean. Bit: ki0u liet ke \'(ii hai giCI Iri '0' vii 'J'. C:IC phcp 10:\11 16glC c6 Ihe Ilwe hl~n Iren de Mii tu'qng kieLJ Bit va Ir.l h.li gia In kiell Hit. Character: kicu iI~t \ ;C veii mien \.ac d!nh 1:1 t~IP hnp die k;' Ill' ASCII, eic k~' Ill' kh(mg hicll du(.'iC bi~u dien billlg 10;1 eht'l'a ha k)' ILL Cae k)' It.r hl~n hlnh dlf<,'IC bicu dicn giua hai da'u lm'lc do)). ]nte~cr: kieu so nguyen v6i nhullg giii trj dlfong ho(tc [l1n. Mien Xiie dPlh Cll,1 ki~u Intl'~cr lfOng g6i Standard la: ILl' -2. [47.41)1.647 d0'l1 2.147 A!n.G-l-7, Ck phcp to.ln tren C<IC dc'li IUcl'ng kicu I ntcgrr Iii UtC phcp tmin so h')c: +, ;" ,/ ' Natural: III m(lt kiC:u COil clla kieu ,,,6 nguycil \':1 dltng de: chi utC ,,(l ngu)'C'n kh('ng [lin - ,,,6 IV nilien. P()~itivc: Iii ki.::'u con clm ki~u so nguyen sir dung de hieu dicn c.\c s6 duong. Bit vector: Iil. kicu bicu dicn 111,'lIlg eae Bit. Strill;:!;: kieu ch-[' lt~u bao g6m ndng cac Charater. M()I glcl In KIC:U Strin~ dWl'C chl'l'a Hong m()t cap m6c kcp. Real: mt'l 1,'\ GtC s6 tlwc Irong gi6i h'.ln: tu -1.ClI : + 38 (kn I.OE + ::IS. Phy-,icaltypc Time: kieu Time dU9c Sll' dy.ng de' hie'u di~ll uie ~l,i If! thl~i gl<111 dLll1g Irong qua Irinh m(i pbong, d. KiC'u m.in~ Tlflmg 11.1' IIbll' trong etc ng(lI1 ngCf 1~lp trlnh truycn Ih6ng. lrong ng()Il ngCr VHDL. phiin Ill' kieu m:ing 121 nh6m cae phfin tLI' clll1g kicu vi:t duoe truy c:tp \l'ri nlHr m(ll d(ii tu<:m~. Ph:in ttr kieu mang trung ng6n ngi.1' Vl-IDL e6 nhCing dae dlcm nhu ~all. CCIC ph,-\II ILl' clla m:l1lg c{l Ihe lit l119i ki(:u lfOng ngt'lllllgt"i' VI-IDL, SCi ill'(!ng e.ie dl! s6 ella m.ing ( noi deh khat 1<'1 s6 ehicu cua 1l1,-'llIg e6 Ihe' nh:lIl 1l19i gi.l Ir\ dll'ong. Nting chi cl'i m()t va chi m(lt chi s6 dung de Iru)' nil~lr Ill'i ph~in ttl'. !'i7 Mien hie'n lhien elH' ehi s6 xilc dinh s(i phan tu cua llliing \,~I hu6ng ~,jp :\c'p chi ,,6 trong 1l1ilng: llr c,ie chi ,,6 eao xu6ng c,\c chi so lhftp ho\\C nguoe 1'.11. Kicll elm chi s6 co the' 1;'1 kitu nguyen ho~\C kicu li¢t kc. Khiie \'{j'i de ng6n ngu IZlp trlllh tru),cn thong, trong ng(lI1 IlgU" YHDL rn;ing dw)"C cilia Uun hai lo".li: m<.lng c6 r~lllg bU(K \';'1 m lng kh6ng rllng bw)c. M:.ing c6 r~ng hU(le III milng lrong d6 kie'u eLla chi s6 e6 mien xac dinll dUlye quy d!nh mQ\ d.ch lU"i".mg Inlllh. Dicu do co nghTiI Iii ,au klu dU<;Ic Khai ])(io, mang co Krcll thw'K c6 dinh. 'llnr y,Jy m:"lng c6 r:ltlg hU(K tHong II,!" "oi doi tllvng kltu lll<.ing Iiong ele ngllll ngCr li)p trlnh Iruycn til6ng. eli phiip eua 11l,ing co fling bUi)e: t)PC ICII_lIhllIg is array (Alw(f!l'.;_ (liil_( 11I·_.\() ) uf Alell (1l0 1!/itlll III Trong (h). / :/i()(iIlX_( ,i(/_cJlI_,wJ'];'llIlicn con clJ<1 kitu nguycn ho~\C kicll lil:! t l:. / :/(,'u_Cliu-,)Jh'il_,/i·la kicu ella phfill lU m;ing. vr dl.!, khai b<.io mlmg ella 64 rhfin lU- nguyen. type Arl-is array (0 to 63) oflntcgcr: Miin!.! khl')'l!! rllll!! bw.)e III ki0u milll!! Iron!! d6 mien ""ie dinh elta ' L. L klCII chi Stl \';1 lur6ng s{lr xc'p ella de chehi sli kh()lIg \"iie dinh illae ell! s6 IU\l'n,!! chil'u ella lll:ing (tWl"e chi roo \'!m \'ity (kii Ill"ting llliing kh()J1g r;lIlg bU(le eo the e6 s(i !UO'llg ph:11l Ill' kh()ll~' :>;;Il' dlllh. 1\6i c iell kllile mill'g kh(lng ri\ng hU(K' e6 "(1 kich IlJU\l'c bll,'n Ihicn 'lIm \'<.)y dung lu\mg btl nho slr dung Chll lllr)1 ll1,ing kh(')llg rilllg hill'll" e6 the thay doi tU)' theo nhu cliu slr ell.mg, Dlcu nlly khae \ 6"i de ng(l/l ngLr 1(lp tflllh lruyen th6ng nlnr C. Pa"eal. . ell phiip eua m<.lng kh()ng riltlg hur)c: f~Pt' /(;II_"hing is arra~' ( 1(;/1 / :/{'II ('hi ,I/! n.ll1gc < > ) of Ai ('II 1)1111'11_1/;'. Ihl /":/(;11 ('/11' sli'lll kicu eon xile dinh chi sCi. Vfdu. t.ype B1T_ VECfOR is array (i'atUl'HI ran~e < » of BIT: type String is array ( pustiy(' rHng~' < > ) of dwractc,,: ;-,uhtypc B4 is I31T _VECTOR ( 3 down to 0 ): \.'ariablc V5 : BIT_VECTOR (4 downtn () ): rv1ang IlllJ'tillg dl:ll1,!! tl2 bicu di~n call Ink luyc'n 1111h nhu tl1a1111 gill. RAM. ROM. eic phfin ILl' m;lng dune d;inh dja chi hang de elll :-;6. do del chi <;(i ella m;lng ph;l] co ki~u n\i 1"<.1t: nl11i kicu :-;0 nguy0n. kil:U li~·t kc. Vi (IL.I: m6 I;; Ix) Ilh6'c6 kich Ihu6c 16 x 10: suhtypt, int J. is Integer range 0 to 15: ;-,uht.\pc ImlO is lntcgt'r range 0 to 1023: f)'pc \1ClIIllfY is array ( Inl 1- ) of Illi [0: Ta e6 the truy c;)p t6"i de phfin Ilr cLla tn~ing thco chi :-;6. Vi d~l. LtC Iruy e(lp lai de ph;"in IU eLla tn,ing X thea ehl :-;6 l. variable X: Mcmory: variable 1: int 1-: variable Y: IntlO: Y:=XI ]+3 I: l\gClllllgO" VI-IDL elm phep kh;\i b;Io de 1l1;lng nhi(:u ehicu. Vi dl,l \'c truy c;)p mang nhi(:u ehicu duqe dua ra du6i day. Vi til.l. type T\\oarray is array ({) 10 7. 0 to 3) of BIT: constant 'l\nlROM : Twoanay:= 11'11', 'U', '()', 'I' I ( '(I', ' (' , '()' , '(' I ( '0', '0' ,']' ,'(' I ( '1', ' I' , '0' , '1 t ) X := TwoROM (2,3); ('0' ,'0' ,'(' ,'(' I, I '0' , ']' , '0' , '(' I, ( '(' , '0' , '0' , '(' ), ('(', '(', ']', ']')); C. Kicil ban nhi " Rill ghi 1;\ ullom eua m()t ho~\e nhieu ph£ill tu' thw.)e nhO'ng ki~ll kh.ie nluLI \'~\ dLil.K truy dp tdi nhu 1l1t)1 d6i tI1Q'ng. Rill ghi e6 nhung d,)e dicm saL!. NMi ph:in tLf eua \xill ghi duq'c truy nh(lp t6i then I~n trl1()'ng. eic phiin ttl ella Ixin ghi co the nh~1ll moi kicll ella ngbn ngiI VBDL kc C<.I 1l1<"lIlg yil \xln gill. VI d~l kiell h,ln ghi: type Datc_ Type is ( Sun, Mon. Tue, Wed. Till'. Fri. Sal ): typc Holyclay is rccord Y car : Intc!!;cr rangt' 1900 to 1l)99~ Month: Integ:cr ran!!;c I to 12: Day : Integer range I to 31 ~ Date : Date_Type: end record: eic phfln ILf eua h.ln ghi dU(Jc tru)' nhttp theo ten b<.'ltl giti \':1 ll'll 11 LflJng. Hai tklllh [1h,'ln n~ly ng[1ll deh nhau h()oi d:lu ',' . Vi d~l, signal S: Iioliday: variable T I: Inte~cr rangc ( 1900 to 2099 ): variable T2: Datc_ Type: Tl := S.Year: T2 : = S. Data; f. Cae kicli trung goi Standard Logie n.:" Il1d hinh hOii uic till 1H~'n C() tile: nh;:1ll nhicu hO'n 1w.i giii tr!, IlUn,g ngon ngO' VIIDL X{IC djnh gl)i Standard Logic ( tuong ling voi chu[ln IEEE ](iO Std 1164 - 19(3). Hai kicu dG' li¢u co ~& Irnng goi nay I:l STD_ULOGIC va STD_LOGIC. STD_CLOGIC xac djnh ki~u dlilL¢u grim chin giii II"!. etC gi<.1 tr~ tin hil:u klc'u STD_ULOGIC kh6ng th~ tham gia \'110 dlc pbcp lOitn logic Y~I so hQc co h,in. Trong tru'cmg hOp n~IY 1<1 ph,ii 1l1(:i rong C(IC phcp tU~ln so hQC va logic C0 b,ll1 bang each cung Ci;IP cac h,1111 quye"t dlllh. Trong nhling tru'ung IWp khi lin hi¢u tren Im''lt dUi'J"ng co the nh,)n duoc til" nhieu nguon lin hi0u kh(lc nhau, chung ta cOng ph,'li cung eilp dc kiln quycl d!nh. Vi dy., trong Iru'ong hqp tr0n hinh 5.11. dlf()"Il,g tin hi¢u s Iii kc"t n6i eLliI hi.!1 dLfCl"ng tinl1]l.::u d(lC 1~1l1 SI \"i\ s] , khl d6 t<.li diem kel noi cll<\ hai dU'o-ng tin hi~Ll ta ([in ph<li xac djnh giu tin hi¢u tren s DlI:ll1l1;ll 1Iilll1 quycI dll1h gl~i In lin hl~LI mnh 6.11 Trlrollg hOp ,Lf dung hiltll quyfl ,1mh. dlfCl"llg s sCi nh[ln throc tu gi<.i Irj lIn hi~u trcn duo-n,g "I \',\ S, nhu Ih6 n£\O. Thong thu'cmg giil trj Iren duong S du~1"C X(IC djnh b~ll1g de phcp loCm OR, AKD hO~lc XOR. Trong Irll'bng i10P gi,t Irj CUi.! tin hi¢u duqc 1110 1,1 b~l11g m(lt lrong chin gi;'t trj CLla kicu STD_lJLOOIC. ta din phai Im'1 rQng cac phcp tocin \('lgic cha dc giAlr! khong IhuQc I(lp hqp { '0', 't 'J hay I 'rills~', 'Irue' 1. NIlllng phcp to,in m6 r¢ng d6 duC)'c bieu dicn htlllg dlC hilln lJuy6t d.ll1h. Cae gia If! clla kicu STD_ULOGIC: type STD_ULOGIC is ('U', 'X', 'I)', ,\" 'Z', '\Y', 'L', 'H', '.' ), STD_LOGIC lil ki~u dU'\JC x,-ie d!nh. Cae hiun quye't dinh cua kiC"u l\~y du"Oc cung dip hlii g6i Stand and Logic. Tunng tll' nhu' nIT V;I nrr_ V ECrOR. n~6n ngu VHDL CUllg cap hai kl,-'u STD_L'LOGIC VECTOR V" STD_LOGIC VECTOR. Vi dL,l. cntity ADDER is port ( A. It in STU_LOGIC YLCfOR ( 3 do\~nto 0 ). Cin : in STU_LOGIC: S ,out STD_LOGIC_ VECTOR ( ,downto () . Coul, (lut STD_LOGIC: ), end ADDER; 161 [...]...g Kicli signed va unsigned Ki~u e6 d:ill signed va kh6ng dflu unsigned dLIqe sir dl,lOg doi v6i nbu'l1g d6i tuVng sc uuqe truy C(lp t6i nhLI cae bit va nhLI d.C s6 nguyen Hai h~u nilY' dLIQ'C djnh nghLa lrang hai g6i NUMERIC~BIT va NUMERIC_STD nhu' "au: t~[pe signed is array (natural range . s6 xilc dinh s(i phan tu cua llliing ,~I hu6ng ~,jp :c'p chi , ,6 trong 1l1ilng: llr c,ie chi , ,6 eao xu6ng c,c chi so lhftp ho\C nguoe 1'.11. Kicll elm chi s6. elll :- ;6. do del chi <;(i ella m;lng ph;l] co ki~u ni 1"<.1t: nl11i kicu :-;0 nguy0n. kil:U li~·t kc. Vi (IL.I: m6 I;; Ix) Ilh6'c6 kich Ihu6c 16 x 10:. end ADDER; 161 g. Kicli signed va unsigned Ki~u e6 d:ill signed va kh6ng dflu unsigned dLIqe sir dl,lOg doi v6i nbu'l1g d6i tuVng sc uuqe truy C(lp t6i nhLI cae