




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
Chapter2NumberSystemsandCode重點:1)二進制、八進制和十六進制數的表達及各種數制之間的相互轉換;2)符號數的表達及其加、減運算;3)BCD編碼和GRAY碼。2/28/20251數字邏輯設計及應用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數字邏輯設計及應用
AnarbitrarydecimalnumberDwithpdigitsinintegerandndigitsinfractiondp-1dp-2……d1d0.d-1d-2……d-nGeneralexpression:2.Binarynumbersradix:2digits:0、1,alsobecalledbit,weight:2i3數字邏輯設計及應用Abinarynumber1011010.1012,:※anarbitrarybinarynumberBbp-1bp-2…b1b0
.b-1…b-n
,thegeneralexpressions:Thesumofeachdigitmultipliedbythecorrespondingpoweroftheradixisthebinarynumber’sdecimalvalue.4數字邏輯設計及應用3.OthersLSB:LeastSignificantBitMSB:MostSignificantBit
bp-1bp-2…b1b0.b-1…b-nMSBLSB5數字邏輯設計及應用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數字邏輯設計及應用Exp3:givethedecimalvalueofthefollowingnumbers.215.78=3AD.8h=2.2-8and2-16number’sConvensions
octal01234567binarysection000001010011100101110111Table1relationbetweenbinaryandoctal7數字邏輯設計及應用hexadecimalbinarysection0000010001200103001140100501016011070111hexadecimalbinarysection8100091001A1010B1011C1100D1101E1110F1111Table2binary-hexadecimalrelations8數字邏輯設計及應用(a)binary——octal、hexadecimalconversionsStartingatthebinarypoint,separatethebitsintogroupsof3or4,andreplaceeachgroupwiththecorrespondingoctalorhexadecimaldigit.Iftheleftmostgroupfallshortof3or4bits,then0shouldbeaddedtotheleftoftheMSB;sodotheright。Exp:dothefollowingpositional-number-systemconversion。
1111011010.00112=(?)8=(?)hSolution:=1732.148=3DA.3h9數字邏輯設計及應用(b)octal,hexadecimal-binarynumberconversionReplaceeachoctalorhexadecimalwiththecorrespondinggroupof3or4bits.Exp:267.248=(?)296CA.28h=(?)210數字邏輯設計及應用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數字邏輯設計及應用Exp:
371d=(?)2=(?)8=(?)h2、decimal-to-radix-rconversion—fractionpartmethods:乘基取整Thefractionofapdigitsnumberinradixris
:Multiplytheformulabyrsuccessively,yieldthesuccessivedigitsofthefractionofD(radixr)fromthelefttorighttilltherequireddigitsd-1
,d-2,……,d-n
areacquired.12數字邏輯設計及應用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數字邏輯設計及應用2.4additionandsubtractionofnondecimalnumber1、Rulesofbinaryadditionandsubtraction(1)rulesofadditionS=x+y+CinExp:01001011+10001111=?CinxyCoutS0000000101010010111010001101101101011111initialcarrycarry000011110c14數字邏輯設計及應用(2)RulesofBinarySubtractiond=x-y-binExp:11001100-01011100=?binxyboutd0000000111010010110010011101101100011111initialborrowborrow011100000b15數字邏輯設計及應用2.additionandsubtractionofoctalandhexadecimaladdition:Iftwodigit’ssumisgreaterthantheradixoneachcolumn,thencarry1tothenextmoresignificantbit.subtraction:Iftheminuendislessthansubtrahend,thenborrow1fromthenextmoresignificantbit.16數字邏輯設計及應用2.5RepresentationofNegativeNumbers1、signed-magnituderepresentation
unsignednumbers:justthemagnitudeofanumberisrepresented,no‘+’or‘-’signsymbolbeforethenumber。
signednumbers:’+’or‘-’isaddedtotheleftofthenumber。representationofsignednumber:
①signsymbol+numbermagnitude,like+34d、-1102、+1Dh、…
17數字邏輯設計及應用②inbinarynumber,signbit+magnitudeTheMSBofabitstringisusedasthesignbit:0—“+”,1—“-”thistypeofsignedbinarynumberiscalledSignedMagnitude(S-M碼,或原碼)。比如,+11101=011101-1011=1101118數字邏輯設計及應用③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.符號位數值19數字邏輯設計及應用2、ComplementNumberSystemradixcomplement
(基數補碼數制)diminishedradix-complement(基數減1補碼數制)Ann-digitnumberDinradixr:D=dn-1……d1d0,①radix-complement②diminishedradix-complement(也稱基數反碼)Relationbetweenthesetwo:Table2-4,2-5(P.36)showssomer’sand(r-1)s’complement.20數字邏輯設計及應用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數字邏輯設計及應用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數字邏輯設計及應用two’scomplementnumberandtheirdecimalequivalent2’scomplementdecimal00000000000000001+1…………01111111+12710000000-12810000001-127…………11111110-211111111-123數字邏輯設計及應用2’s-complementdecimalequivalentS-M000000000000000001000000000000001+100000001……………..01111111+1270111111110000000-128-10000001-12711111111………………11111110-21000001011111111-11000000124數字邏輯設計及應用propertysignbit=0,S-Mandtwo’s-complementhavethesamedecimalvalue;
signbit=1,S-Mandtwo’s-complementhavedifferentdecimalvalue。Howtofindthetwo’s-complementrepresentationofanegativedecimalnumber?25數字邏輯設計及應用Decimalequivalent4-bits2’scomplement-81000-71001-61010-51011-41100-31101-21110-11111ItsoriginalbinarynumberDecimalequivalent1000801117011060101501004001130010200011互為補數Samevalue,buthasoppositesignsymbol26數字邏輯設計及應用So,tocalculatethe2'scomplementofannegativeinteger,invertthen-bitbinaryequivalentofthegivennumbermagnitudebitbybit,andthenadd1totheLSB.Exp:calculatethe2’scomplementof(+65)and(-65d)in8-bitform.Solution:+6501000001-65binaryequivalentof65is01000001,invertbitbybit10111110add11011111127數字邏輯設計及應用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數字邏輯設計及應用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數字邏輯設計及應用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數字邏輯設計及應用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數字邏輯設計及應用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數字邏輯設計及應用5.SignextensionWhenweconvertann-bit2’scomplementnumberXintoanm-bitone:(a)ifm>n,append(m-n)copiesofX’ssignbittotheleftofX;(b)ifm<n,discardX’s(n-m
)leftmostbit。Sodoto1s’-complement.33數字邏輯設計及應用2.6Two’s-complementAdditionandSubtraction1、RulesTwooperandsaddorsubtractdirectly
。
Exp:
3+3,4+(-5),7-3,1-6,符號數表格34數字邏輯設計及應用2.AgraphicalviewModular:thebiggestnumberofquantitiesthatan-bitsystemcanrepresentis2n.Modularoperation:mMOD2n=m-i·2n(i=int())
Exp:18MOD16=276543210-1-2-3-4-5-6-7-80111011001010100001100100001000011111110110111001011101010011000+235數字邏輯設計及應用3.overflowIfanadditionoperationproducesaresultthatexceedstherangeofthenumbersystem,overflowissaidtooccur.thatis,ifresult>+(2n-1-1),or<-(2n-1),overflowisoccurred.Detectingofoverflow:
Anadditionoverflowsiftheaddends’signsarethesamebutthesum’ssignisdifferentfromtheaddends’.Exp:judgewhethertheresultoftheadditionoverflowornot。
11111101+1000000136數字邏輯設計及應用4.Subtractionrulesm-n=m+(2n-n)Negatethesubtrahendbytakingits2’scomplement,andthenaddittotheminuendusingthenormalrulesforaddition.
2’s-comp.ofn76543210-1-2-3-4-5-6-7-80111011001010100001100100001000011111110110111001011101010011000-2+1437數字邏輯設計及應用Exp:8-bit2’s-comp.38數字邏輯設計及應用5.Two’s-complementandUnsignedBinaryNumbersWhenn-bitbinarynumbersaretakenforunsignednumber,therulesofadditionandsubtractionareassameasthe2’s-complement.Iftheresultofadditionoperationexceedtherangeofn-bitsystem,acarryisproducedtotheleftmoresignificantbit.39數字邏輯設計及應用2.10BinaryCodesforDecimalNumbersEmphasis:BCD,excess-3code:asetofn-bitinwhichdifferentbitstringsrepresentdifferentnumbersofotherthingsiscalledacode.codeword:aparticularcombinationofnbit-values.1、BCDcodethedigits0~9areencodedby4-bitunsignedbinaryrepresentations,0000through1001.andthewords1010~1111arenotused.(invalidcodeword)40數字邏輯設計及應用BCD’spropertyBCDisweightedcode,theweightsforthebitsfromlefttorightis:23、22、21、20。alsocalled8421BCD。(1)representingnumbersbyBCDlike,11d,
BCD—00010001 256d, BCD–001001010110(2)PackedBCDtwo-digits-per-bytedecimaldigits8421BCD00000100012001030011401005010160110701118100091001Donotdiscardthese041數字邏輯設計及應用(3)AdditionwithBCDbesimilarto4-bitunsignedbinarynumberaddition.Butacorrectionmustbemadeifthesumexceeds1001if,sum>1001,thenadd0110totheresult。
Exp.:>1001makeacorrection42數字邏輯設計及應用2.OtherdecimalcodesP.49t
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030年美體內衣行業市場發展分析及發展趨勢前景預測報告
- 2025-2030年皮革制品行業市場現狀供需分析及投資評估規劃分析研究報告
- 2025-2030年豬油行業市場深度分析及前景趨勢與投資研究報告
- 精準把握的2025市政工程試題及答案
- 2025-2030年新能源金融產業市場深度調研及發展趨勢與投資戰略研究報告
- 2025-2030年新傳媒技術產業市場發展分析及發展趨勢與投資研究報告
- 2025-2030年按摩器械行業市場發展分析及投融資與風險研究報告
- 2025-2030年家政行業發展分析及投資戰略研究報告
- 2025-2030年實木地板行業市場發展分析及投資前景研究報告
- 2025-2030年復印機行業投資機會及風險投資運作模式研究報告
- 訴訟文書送達地址確認書
- 一級病原微生物實驗室危害評估報告
- 茶葉加工機械與設備(全套524張課件)
- 五年級下冊數學課件-4.分數連加、連減和加減混合運算及應用練習 蘇教版 (共11張PPT)
- 設備機房出入登記表
- 電腦節能環保證書
- 工程質保金付款申請表格
- 建房界址四鄰無爭議確認表
- 肝膽外科住院醫師規范化培訓理論考試(題庫)
- 機械設備安裝與維修理論教案
- 房屋外立面改造施工組織設計
評論
0/150
提交評論