數(shù)字設(shè)計(jì)課件第二章_第1頁
數(shù)字設(shè)計(jì)課件第二章_第2頁
數(shù)字設(shè)計(jì)課件第二章_第3頁
數(shù)字設(shè)計(jì)課件第二章_第4頁
數(shù)字設(shè)計(jì)課件第二章_第5頁
已閱讀5頁,還剩42頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、09.10.2020,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,1,Chapter2 Number Systems and Code,重點(diǎn): 1)二進(jìn)制、八進(jìn)制和十六進(jìn)制數(shù)的表達(dá)及各種數(shù)制之間的相互轉(zhuǎn)換; 2)符號(hào)數(shù)的表達(dá)及其加、減運(yùn)算; 3)BCD編碼和GRAY碼。,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,2,2.1 Positional Number Systems,1.Decimal number A decimal number 1536.79d digits:0、1、2、3、4、5、6、7、8、9 weight:10i radix:10 power:i,start from the left of the decimal p

2、oint, increase by one for each successive position from 0 ; from the right of the decimal point, decrease by one from (-1).,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,3,An arbitrary decimal number D with p digits in integer and n digits in fraction dp-1dp-2d1d0.d-1d-2d-n General expression:,2. Binary numbers radix:2 digits:0、1,also

3、 be called bit, weight:2i,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,4,A binary number 1011010.1012,:,an arbitrary binary number B bp-1bp-2b1b0 .b-1b-n ,the general expressions: The sum of each digit multiplied by the corresponding power of the radix is the binary numbers decimal value.,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,5,3. Others LSB: Least Significant

4、Bit MSB: Most Significant Bit bp-1bp-2b1b0 .b-1b-n,MSB,LSB,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,6,2.2 Octal and Hexadecimal Numbers,1.concept,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,7,Exp3:give the decimal value of the following numbers. 215.78= 3AD.8h= 2. 2-8 and 2-16 numbers Convensions,Table 1 relation between binary and octal,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,8,Table 2 binar

5、y-hexadecimal relations,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,9,(a)binaryoctal、hexadecimal conversions,Starting at the binary point,separate the bits into groups of 3 or 4,and replace each group with the corresponding octal or hexadecimal digit. If the leftmost group fall short of 3 or 4 bits, then 0 should be added to the lef

6、t of the MSB; so do the right。 Exp:do the following positional-number-system conversion 。 1111011010.00112=( ? )8=( ? )h Solution: =1732.148 =3DA.3h,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,10,(b) octal, hexadecimal-binary number conversion,Replace each octal or hexadecimal with the corresponding group of 3 or 4bits. Exp:267.248=

7、( ?)2 96CA.28h=( ?)2,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,11,2.3 general positional-number-system conversions,Radix-r-to-decimal conversion: Each radix-r numbers digit multiply by its own weight, and add them . Exp:512.46=( ?)d 1、decimal-to-radix-r conversioninteger part methods:除基取余 The integer of a p digits number in radix

8、r is: Divide the formula by r successively, yield the successive digits of the integer of D (radix r) from the right to left till the quotient is 0.,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,12,Exp: 371d =(?)2=(?)8=(?)h 2、 decimal-to-radix-r conversionfraction part methods:乘基取整 The fraction of a p digits number in radix r is : Mul

9、tiply the formula by r successively, yield the successive digits of the fraction of D (radix r) from the left to right till the required digits d-1 ,d-2,d-n are acquired.,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,13,Exp8: 0.71875d=( ? )2=( ? )8=( ? )h 3、summary of the positional-number-system conversions (1) conversion between dec

10、imal and radix r (2)radix-r-to-radix-j conversion (non-decimal) binary-to-octal, binary-to-hexadecimal or reverse, be converted directly conforming to the section-replace rules. others, radix-r numberdecimal radix-j number,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,14,2.4 addition and subtraction of nondecimal number,1、Rules of bin

11、ary addition and subtraction (1)rules of addition S=x+y+Cin Exp:01001011+10001111=?,initial carry,carry,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,15,(2)Rules of Binary Subtraction,d=x-y-bin Exp: 11000=?,initial borrow,borrow,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,16,2. addition and subtraction of octal and hexadecimal,addition: If two digits sum is greater th

12、an the radix on each column ,then carry 1 to the next more significant bit. subtraction: If the minuend is less than subtrahend ,then borrow 1 from the next more significant bit.,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,17,2.5 Representation of Negative Numbers,1、signed-magnitude representation unsigned numbers:just the magnitude

13、 of a number is represented, no + or - sign symbol before the number。 signed numbers:+ or - is added to the left of the number。 representation of signed number: sign symbol+number magnitude,like +34d、-1102、+1Dh、,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,18,in binary number, sign bit+magnitude The MSB of a bit string is used as the

14、 sign bit:0“+”,1“-” this type of signed binary number is called Signed Magnitude (S-M碼,或原碼)。 比如,+11101=011101 -1011=11011,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,19, The range of S-Ms representable numbers. an n-bit S-M number B: bn-1bn-2b1b0 Its range is: -(2n-1-1) +(2n-1-1) Include two zero: -0 and +0 Exp:find the S-M of the f

15、ollowing signed numbers。How to represent by using 8-bit S-M. +11101, -1011,+18,-18 the fault of S-M which is used in arithmetical operation:it cant be calculated directly.,符號(hào)位,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,20,2、Complement Number System,radix complement (基數(shù)補(bǔ)碼數(shù)制) diminished radix-complement (基數(shù)減1補(bǔ)碼數(shù)制) An n-digit number D

16、 in radix r: D =dn-1d1d0, radix-complement diminished radix-complement (也稱基數(shù)反碼) Relation between these two : Table 2-4, 2-5(P.36) shows some rs and (r-1)s complement.,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,21,3. Twos-complement Representation,Twos complement is a method for representing signed integers as binary numbers. n-bit

17、binary number B=bn-1b1b0,the twos complement is: B 2s =2n-B for Exp., 8-bit binary number twos complement 0000000028-0=00000000 0000000128-1=11111111 0000001028-10=11111110 1111111100000001,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,22,Define these twos complement as signed number, the MSB is served as sign bit。 MSB=0,positive numb

18、er MSB=1,negative number weight of the sign bit: MSB=0,weight +2n-1 MSB=1,weignt - 2n-1 Range of the value:positive 0+(2n-1-1); negative (-2n-1)-1。 Only one zero in twos complement.,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,23,twos complement number and their decimal equivalent,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,24,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,25,property,sign bit =0, S-M a

19、nd twos-complement have the same decimal value; sign bit =1, S-M and twos-complement have different decimal value 。 How to find the twos-complement representation of a negative decimal number?,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,26,Same value, but has opposite sign symbol,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,27,So, to calculate the 2s complement of an

20、 negative integer, invert the n-bit binary equivalent of the given number magnitude bit by bit, and then add 1 to the LSB. Exp: calculate the 2s complement of (+65) and(-65d) in 8-bit form. Solution: +65 01000001 -65 binary equivalent of 65 is 01000001, invert bit by bit 10111110 add 1 10111111,數(shù)字邏輯

21、設(shè)計(jì)及應(yīng)用,28,An n-bit binary number B=bn-1b1b0,the ones-complement is : B 1s =2n-1-B It is also the method of representing signed binary numbers. MSB=0,positive, weight +(2n-1-1) MSB=1,negative,weight -(2n-1-1)。 Range of representable numbers: negative -(2n-1-1)-0 positive +0(2n-1-1),4. Ones-complement

22、Representation,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,29,1s-complements property,N-bit positive integers are represented in the same way as n-bit sign-magnitude notation. The ones-complement of an n-bit negative integer number is obtained by complementing each one of the bits (the n-bit binary number), i.e., a 1 is replaced by

23、a 0, and a 0 is replaced by a 1. Exp.8-bit 1s-complement of the number. +18d = 00010010 -18d = 1s complement of 18 = 11101101,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,30,返回,From the least number to biggest number, 2s comp. and 1s comp. are successive increased by 1.,Summary of S-M, 2s comp. , 1s comp.,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,31,All of these th

24、ree are used to represent signed integer number in binary system. Comparing of the representing range of the value Representations of positive integer are same; but the representations of negative integer are different at all.,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,32,Calculate signed integers S-M, 2s-comp. , 1s-comp.,positive

25、signed number: convert the given number into the wanted n-bit binary equivalent. negative signed number: first convert the number into n-bit binary equivalent, S-M let MSB=1; 1s-complement invert the n-bit binary equivalent bit by bit,get the n-bit 1s-comp.; 2s-complement add 1 to the LSB of the n-b

26、it 1s-complement of the given number Exp13:Finding the S-M, 2s-comp, 1s-comp of the following signed number in 8-bit 。 +60,-60,+10010,-1101,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,33,5. Sign extension,When we convert an n-bit 2s complement number X into an m-bit one: (a)if m n,append (m-n) copies of Xs sign bit to the left of X;

27、 (b)if m n,discard Xs( n-m )leftmost bit。 So do to 1s-complement.,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,34,2.6 Twos-complement Addition and Subtraction,1、Rules Two operands add or subtract directly 。 Exp: 3+3,4+(-5),7-3,1-6,,符號(hào)數(shù)表格,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,35,2. A graphical view,Modular: the biggest number of quantities that a n-bit system ca

28、n represent is 2n. Modular operation: m MOD 2n =m-i2n (i=int( ) Exp:18 MOD 16=2,+2,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,36,3. overflow,If an addition operation produces a result that exceeds the range of the number system, overflow is said to occur. that is, if result +(2n-1-1),or -(2n-1),overflow is occurred. Detecting of ov

29、erflow: An addition overflows if the addends signs are the same but the sums sign is different from the addends. Exp: judge whether the result of the addition overflow or not 。 11111101+10000001,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,37,4. Subtraction rules,m-n=m+(2n-n) Negate the subtrahend by taking its 2s complement, and the

30、n add it to the minuend using the normal rules for addition.,-2,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,38,Exp:,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,39,5. Twos-complement and Unsigned Binary Numbers,When n-bit binary numbers are taken for unsigned number,the rules of addition and subtraction are as same as the 2s-complement. If the result of addition oper

31、ation exceed the range of n-bit system, a carry is produced to the left more significant bit.,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,40,2.10 Binary Codes for Decimal Numbers,Emphasis: BCD, excess-3 code: a set of n-bit in which different bit strings represent different numbers of other things is called a code. code word: a part

32、icular combination of n bit-values. 1、BCD code the digits 09 are encoded by 4-bit unsigned binary representations, 0000 through 1001. and the words 1010 1111 are not used. (invalid code word),數(shù)字邏輯設(shè)計(jì)及應(yīng)用,41,BCDs property,BCD is weighted code,the weights for the bits from left to right is:23、22、21、20。a

33、lso called 8421BCD。 (1)representing numbers by BCD like,11d, BCD00010001 256d, BCD 0010 0101 0110 (2) Packed BCD two-digits-per-byte,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,42,(3) Addition with BCD be similar to 4-bit unsigned binary number addition. But a correction must be made if the sum exceeds 1001 if,sum1001,then add 0110 to the result。 Exp.:,數(shù)字邏輯設(shè)計(jì)及應(yīng)用,43,2. Other decimal codes,P.49 table2-9, Excess-3 code:the code wor

溫馨提示

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

最新文檔

評(píng)論

0/150

提交評(píng)論