數(shù)字設(shè)計 第二章學(xué)習(xí)課件_第1頁
數(shù)字設(shè)計 第二章學(xué)習(xí)課件_第2頁
數(shù)字設(shè)計 第二章學(xué)習(xí)課件_第3頁
數(shù)字設(shè)計 第二章學(xué)習(xí)課件_第4頁
數(shù)字設(shè)計 第二章學(xué)習(xí)課件_第5頁
已閱讀5頁,還剩42頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

Chapter2NumberSystemsandCode重點:1)二進制、八進制和十六進制數(shù)的表達及各種數(shù)制之間的相互轉(zhuǎn)換;2)符號數(shù)的表達及其加、減運算;3)BCD編碼和GRAY碼。2/28/20251數(shù)字邏輯設(shè)計及應(yīng)用2.1PositionalNumberSystems1.Decimalnumber

Adecimalnumber1536.79d

digits:0、1、2、3、4、5、6、7、8、9weight:10iradix:10power:i,startfromtheleftofthedecimalpoint,increasebyoneforeachsuccessivepositionfrom0;fromtherightofthedecimalpoint,decreasebyonefrom(-1).powerweightdigitradix2數(shù)字邏輯設(shè)計及應(yīng)用

AnarbitrarydecimalnumberDwithpdigitsinintegerandndigitsinfractiondp-1dp-2……d1d0.d-1d-2……d-nGeneralexpression:2.Binarynumbersradix:2digits:0、1,alsobecalledbit,weight:2i3數(shù)字邏輯設(shè)計及應(yīng)用Abinarynumber1011010.1012,:※anarbitrarybinarynumberBbp-1bp-2…b1b0

.b-1…b-n

,thegeneralexpressions:Thesumofeachdigitmultipliedbythecorrespondingpoweroftheradixisthebinarynumber’sdecimalvalue.4數(shù)字邏輯設(shè)計及應(yīng)用3.OthersLSB:LeastSignificantBitMSB:MostSignificantBit

bp-1bp-2…b1b0.b-1…b-nMSBLSB5數(shù)字邏輯設(shè)計及應(yīng)用2.2OctalandHexadecimalNumbers1.conceptOctalHexadecimalradix816weight8i16idigits0、1、2、3、4、5、6、70、1、2、3、4、5、6、7、8、9、A、B、C、D、E、FGeneralexpression6數(shù)字邏輯設(shè)計及應(yīng)用Exp3:givethedecimalvalueofthefollowingnumbers.215.78=3AD.8h=2.2-8and2-16number’sConvensions

octal01234567binarysection000001010011100101110111Table1relationbetweenbinaryandoctal7數(shù)字邏輯設(shè)計及應(yīng)用hexadecimalbinarysection0000010001200103001140100501016011070111hexadecimalbinarysection8100091001A1010B1011C1100D1101E1110F1111Table2binary-hexadecimalrelations8數(shù)字邏輯設(shè)計及應(yīng)用(a)binary——octal、hexadecimalconversionsStartingatthebinarypoint,separatethebitsintogroupsof3or4,andreplaceeachgroupwiththecorrespondingoctalorhexadecimaldigit.Iftheleftmostgroupfallshortof3or4bits,then0shouldbeaddedtotheleftoftheMSB;sodotheright。Exp:dothefollowingpositional-number-systemconversion。

1111011010.00112=(?)8=(?)hSolution:=1732.148=3DA.3h9數(shù)字邏輯設(shè)計及應(yīng)用(b)octal,hexadecimal-binarynumberconversionReplaceeachoctalorhexadecimalwiththecorrespondinggroupof3or4bits.Exp:267.248=(?)296CA.28h=(?)210數(shù)字邏輯設(shè)計及應(yīng)用2.3generalpositional-number-systemconversionsRadix-r-to-decimalconversion:Eachradix-rnumber’sdigitmultiplybyitsownweight,andaddthem.Exp:512.46=(?)d1、decimal-to-radix-rconversion—integerpartmethods:除基取余Theintegerofapdigitsnumberinradixris:Dividetheformulabyrsuccessively,yieldthesuccessivedigitsoftheintegerofD(radixr)fromtherighttolefttillthequotientis0.11數(shù)字邏輯設(shè)計及應(yīng)用Exp:

371d=(?)2=(?)8=(?)h2、decimal-to-radix-rconversion—fractionpartmethods:乘基取整Thefractionofapdigitsnumberinradixris

:Multiplytheformulabyrsuccessively,yieldthesuccessivedigitsofthefractionofD(radixr)fromthelefttorighttilltherequireddigitsd-1

,d-2,……,d-n

areacquired.12數(shù)字邏輯設(shè)計及應(yīng)用Exp8:

0.71875d=(?)2=(?)8=(?)h3、summaryofthepositional-number-systemconversions(1)conversionbetweendecimalandradixr(2)radix-r-to-radix-jconversion(non-decimal)binary-to-octal,binary-to-hexadecimalorreverse,beconverteddirectlyconformingtothesection-replacerules.others,radix-rnumber——decimal——radix-jnumber13數(shù)字邏輯設(shè)計及應(yīng)用2.4additionandsubtractionofnondecimalnumber1、Rulesofbinaryadditionandsubtraction(1)rulesofadditionS=x+y+CinExp:01001011+10001111=?CinxyCoutS0000000101010010111010001101101101011111initialcarrycarry000011110c14數(shù)字邏輯設(shè)計及應(yīng)用(2)RulesofBinarySubtractiond=x-y-binExp:11001100-01011100=?binxyboutd0000000111010010110010011101101100011111initialborrowborrow011100000b15數(shù)字邏輯設(shè)計及應(yīng)用2.additionandsubtractionofoctalandhexadecimaladdition:Iftwodigit’ssumisgreaterthantheradixoneachcolumn,thencarry1tothenextmoresignificantbit.subtraction:Iftheminuendislessthansubtrahend,thenborrow1fromthenextmoresignificantbit.16數(shù)字邏輯設(shè)計及應(yīng)用2.5RepresentationofNegativeNumbers1、signed-magnituderepresentation

unsignednumbers:justthemagnitudeofanumberisrepresented,no‘+’or‘-’signsymbolbeforethenumber。

signednumbers:’+’or‘-’isaddedtotheleftofthenumber。representationofsignednumber:

①signsymbol+numbermagnitude,like+34d、-1102、+1Dh、…

17數(shù)字邏輯設(shè)計及應(yīng)用②inbinarynumber,signbit+magnitudeTheMSBofabitstringisusedasthesignbit:0—“+”,1—“-”thistypeofsignedbinarynumberiscalledSignedMagnitude(S-M碼,或原碼)。比如,+11101=011101-1011=1101118數(shù)字邏輯設(shè)計及應(yīng)用③TherangeofS-M’srepresentablenumbers.ann-bitS-MnumberB:

bn-1bn-2…b1b0Itsrangeis:-(2n-1-1)~+(2n-1-1)

Includetwozero:-0and+0Exp:findtheS-Mofthefollowingsignednumbers。Howtorepresentbyusing8-bitS-M.+11101,-1011,+18,-18④thefaultofS-Mwhichisusedinarithmeticaloperation:itcan’tbecalculateddirectly.符號位數(shù)值19數(shù)字邏輯設(shè)計及應(yīng)用2、ComplementNumberSystemradixcomplement

(基數(shù)補碼數(shù)制)diminishedradix-complement(基數(shù)減1補碼數(shù)制)Ann-digitnumberDinradixr:D=dn-1……d1d0,①radix-complement②diminishedradix-complement(也稱基數(shù)反碼)Relationbetweenthesetwo:Table2-4,2-5(P.36)showssomer’sand(r-1)s’complement.20數(shù)字邏輯設(shè)計及應(yīng)用3.Two’s-complementRepresentation

Two'scomplementisamethodforrepresentingsignedintegersasbinarynumbers.n-bitbinarynumberB=bn-1……b1b0,thetwo’scomplementis:B

2’s=2n-B

forExp.,8-bitbinarynumber two’scomplement 00000000 28-0=00000000 00000001 28-1=11111111 00000010 28-10=11111110 …… …… 11111111 0000000121數(shù)字邏輯設(shè)計及應(yīng)用Definethesetwo’scomplementassignednumber,theMSBisservedassignbit。

MSB=0,positivenumberMSB=1,negativenumberweightofthesignbit:MSB=0,weight+2n-1

MSB=1,weignt-2n-1Rangeofthevalue:positive—0~+(2n-1-1);

negative—(-2n-1)~-1。Onlyonezerointwo’scomplement.22數(shù)字邏輯設(shè)計及應(yīng)用two’scomplementnumberandtheirdecimalequivalent2’scomplementdecimal00000000000000001+1…………01111111+12710000000-12810000001-127…………11111110-211111111-123數(shù)字邏輯設(shè)計及應(yīng)用2’s-complementdecimalequivalentS-M000000000000000001000000000000001+100000001……………..01111111+1270111111110000000-128-10000001-12711111111………………11111110-21000001011111111-11000000124數(shù)字邏輯設(shè)計及應(yīng)用propertysignbit=0,S-Mandtwo’s-complementhavethesamedecimalvalue;

signbit=1,S-Mandtwo’s-complementhavedifferentdecimalvalue。Howtofindthetwo’s-complementrepresentationofanegativedecimalnumber?25數(shù)字邏輯設(shè)計及應(yīng)用Decimalequivalent4-bits2’scomplement-81000-71001-61010-51011-41100-31101-21110-11111ItsoriginalbinarynumberDecimalequivalent1000801117011060101501004001130010200011互為補數(shù)Samevalue,buthasoppositesignsymbol26數(shù)字邏輯設(shè)計及應(yīng)用So,tocalculatethe2'scomplementofannegativeinteger,invertthen-bitbinaryequivalentofthegivennumbermagnitudebitbybit,andthenadd1totheLSB.Exp:calculatethe2’scomplementof(+65)and(-65d)in8-bitform.Solution:+6501000001-65binaryequivalentof65is01000001,invertbitbybit10111110add11011111127數(shù)字邏輯設(shè)計及應(yīng)用Ann-bitbinarynumberB=bn-1……b1b0,theones’-complementis:B

1s’=2n-1-BItisalsothemethodofrepresentingsignedbinarynumbers.MSB=0,positive,weight+(2n-1-1)MSB=1,negative,weight-(2n-1-1)。Rangeofrepresentablenumbers:negative—-(2n-1-1)~-0positive—+0~(2n-1-1)4.Ones’-complementRepresentation28數(shù)字邏輯設(shè)計及應(yīng)用1s’-complement’spropertyN-bitpositiveintegersarerepresentedinthesamewayasn-bitsign-magnitudenotation.Theones’-complementofann-bitnegativeintegernumberisobtainedbycomplementingeachoneofthebits(then-bitbinarynumber),i.e.,a1isreplacedbya0,anda0isreplacedbya1.Exp.8-bit1s’-complementofthenumber.+18d=00010010-18d=1'scomplementof18=1110110129數(shù)字邏輯設(shè)計及應(yīng)用decimalS-M2’scomp.1s’comp.-1100111111110-2101011101101-3101111011100-4110011001011-5110110111010-6111010101001-7111110011000-8-1000-decimalS-M2’scomp.1s’comp.7011101110111601100110011050101010101014010001000100300110011001120010001000101000100010001000001000000011110000返回Fromtheleastnumbertobiggestnumber,2’scomp.and1s’comp.aresuccessiveincreasedby1.SummaryofS-M,2’scomp.,1s’comp.30數(shù)字邏輯設(shè)計及應(yīng)用Allofthesethreeareusedtorepresentsignedintegernumberinbinarysystem.Comparingoftherepresentingrangeofthevalue

Representationsofpositiveintegeraresame;buttherepresentationsofnegativeintegeraredifferentatall.S-M2’scomp.1s’comp.positive+0~(2n-1-1)+0~(2n-1-1)+0~(2n-1-1)negative-(2n-1-1)~-0(-2n-1)~-1-(2n-1-1)~-031數(shù)字邏輯設(shè)計及應(yīng)用Calculatesignedinteger’sS-M,2’s-comp.,1s’-comp.①positivesignednumber:

convertthegivennumberintothewantedn-bitbinaryequivalent.②negativesignednumber:firstconvertthenumberinton-bitbinaryequivalent,

S-M—letMSB=1;

1s’-complement—invertthen-bitbinaryequivalentbitbybit,getthen-bit1s’-comp.;

2’s-complement—add1totheLSBofthen-bit1s’-complementofthegivennumberExp13:FindingtheS-M,2’s-comp,1s’-compofthefollowingsignednumberin8-bit。

+60,-60,+10010,-110132數(shù)字邏輯設(shè)計及應(yīng)用5.SignextensionWhenweconvertann-bit2’scomplementnumberXintoanm-bitone:(a)ifm>n,append(m-n)copiesofX’ssignbittotheleftofX;(b)ifm<n,discardX’s(n-m

)leftmostbit。Sodoto1s’-complement.33數(shù)字邏輯設(shè)計及應(yīng)用2.6Two’s-complementAdditionandSubtraction1、RulesTwooperandsaddorsubtractdirectly

。

Exp:

3+3,4+(-5),7-3,1-6,符號數(shù)表格34數(shù)字邏輯設(shè)計及應(yīng)用2.AgraphicalviewModular:thebiggestnumberofquantitiesthatan-bitsystemcanrepresentis2n.Modularoperation:mMOD2n=m-i·2n(i=int())

Exp:18MOD16=276543210-1-2-3-4-5-6-7-80111011001010100001100100001000011111110110111001011101010011000+235數(shù)字邏輯設(shè)計及應(yīng)用3.overflowIfanadditionoperationproducesaresultthatexceedstherangeofthenumbersystem,overflowissaidtooccur.thatis,ifresult>+(2n-1-1),or<-(2n-1),overflowisoccurred.Detectingofoverflow:

Anadditionoverflowsiftheaddends’signsarethesamebutthesum’ssignisdifferentfromtheaddends’.Exp:judgewhethertheresultoftheadditionoverflowornot。

11111101+1000000136數(shù)字邏輯設(shè)計及應(yīng)用4.Subtractionrulesm-n=m+(2n-n)Negatethesubtrahendbytakingits2’scomplement,andthenaddittotheminuendusingthenormalrulesforaddition.

2’s-comp.ofn76543210-1-2-3-4-5-6-7-80111011001010100001100100001000011111110110111001011101010011000-2+1437數(shù)字邏輯設(shè)計及應(yīng)用Exp:8-bit2’s-comp.38數(shù)字邏輯設(shè)計及應(yīng)用5.Two’s-complementandUnsignedBinaryNumbersWhenn-bitbinarynumbersaretakenforunsignednumber,therulesofadditionandsubtractionareassameasthe2’s-complement.Iftheresultofadditionoperationexceedtherangeofn-bitsystem,acarryisproducedtotheleftmoresignificantbit.39數(shù)字邏輯設(shè)計及應(yīng)用2.10BinaryCodesforDecimalNumbersEmphasis:BCD,excess-3code:asetofn-bitinwhichdifferentbitstringsrepresentdifferentnumbersofotherthingsiscalledacode.codeword:aparticularcombinationofnbit-values.1、BCDcodethedigits0~9areencodedby4-bitunsignedbinaryrepresentations,0000through1001.andthewords1010~1111arenotused.(invalidcodeword)40數(shù)字邏輯設(shè)計及應(yīng)用BCD’spropertyBCDisweightedcode,theweightsforthebitsfromlefttorightis:23、22、21、20。alsocalled8421BCD。(1)representingnumbersbyBCDlike,11d,

BCD—00010001 256d, BCD–001001010110(2)PackedBCDtwo-digits-per-bytedecimaldigits8421BCD00000100012001030011401005010160110701118100091001Donotdiscardthese041數(shù)字邏輯設(shè)計及應(yīng)用(3)AdditionwithBCDbesimilarto4-bitunsignedbinarynumberaddition.Butacorrectionmustbemadeifthesumexceeds1001if,sum>1001,thenadd0110totheresult。

Exp.:>1001makeacorrection42數(shù)字邏輯設(shè)計及應(yīng)用2.OtherdecimalcodesP.49t

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論