340 likes | 584 Views
This chapter in the book includes: Objectives Study Guide 1.1 Digital Systems and Switching Circuits 1.2 Number Systems and Conversion 1.3 Binary Arithmetic 1.4 Representation of Negative Numbers 1.5 Binary Codes Problems. SLIDES FOR CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
E N D
This chapter in the book includes: Objectives Study Guide 1.1 Digital Systems and Switching Circuits 1.2 Number Systems and Conversion 1.3 Binary Arithmetic 1.4 Representation of Negative Numbers 1.5 Binary Codes Problems SLIDES FORCHAPTER 1INTRODUCTIONNUMBER SYSTEMS AND CONVERSION Click the mouse to move to the next page. Use the ESC key to exit this chapter.
Number system and Conversion Decimal Notation 953.7810 = 9x102 + 5x101 + 3x100 + 7x10-1 + 8x10-2 Binary 1011.112 = 1x23 + 0x22 + 1x21 + 1x20 + 1x2-1 + 1x2-2 = 8 + 0 + 2 + 1 + 1/2 + 1/4 = 11.7510 二進制、八進制、十進制、十六進制 (下標:Base 10) (Base 2)
Octal 147.38 = 1x82 + 4x81 + 7x80 + 3x8-1 = 64 + 32 + 7 + 3 x 1/8 = 103.37510 Hexadecimal Composed from 0、1、2、3、4、5、6、7、8、9、A、B、C、D A2F16 = 10x162 + 2x161 + 15x160 = 2560+32+15 = 260710 建立一數字系統: 以R為基數,用一幕級數(power series) 來展開 來獲知 我們所習用的十進制 (詳課本pp.9)
Conversion (a) 十進制轉二進制: 整數值用連除法( 詳課本p.10) EXAMPLE: Convert 5310 to binary.
Conversion (b) 十進制轉二進制: 小數值用連乘法( 詳課本p.10) EXAMPLE: Convert .62510 to binary. 乘小數 乘盡
Conversion (c) EXAMPLE: Convert 0.710 to binary. 乘不盡
Conversion (d) EXAMPLE: Convert 231.34 to base 7.
Equation (1-1) Binary Hexadecimal Conversion 每一個16進位數可以轉換成等值4-位元二進位數 每一個8進位數可以轉換成等值3-位元二進位數 • 4-digits 為一單位 • 不足位元以0補上 Conversion from binary to hexadecimal (and conversely) can be done by inspection because each hexadecimal digit corresponds to exactly four binary digits (bits).
Addition 二進位之運算法(Binary Arithmetic) 加法 Add 1310 and 1110 in binary.
Subtraction (a) 二進位之運算法(Binary Arithmetic) 減法 The subtraction table for binary numbers is 0 – 0 = 0 0 – 1 = 1 and borrow 1 from the next column 1 – 0 = 1 1 – 1 = 0 Borrowing 1 from a column is equivalent to subtracting 1 from that column.
Subtraction (b) EXAMPLES OF BINARY SUBTRACTION: 另一種二進位減法可以用2’補數(complement arithmetic)來計算
Subtraction (c) A detailed analysis of the borrowing process for this example, indicating first a borrow of 1 from column 1 and then a borrow of 1 from column 2, is as follows:
Multiplication (a) 二進位之運算法(Binary Arithmetic) 乘法 The multiplication table for binary numbers is 0 x 0 = 0 0 x 1 = 0 1 x 0 = 0 1 x 1 = 1
Multiplication (b) The following example illustrates multiplication of 1310 by 1110 in binary:
Multiplication (c) 二進位之運算法:避免大於1之數值 When doing binary multiplication, a common way to avoid carries greater than 1 is to add in the partial products one at a time as illustrated by the following example: 1111 multiplicand 1101 multiplier 1111 1st partial product 0000 2nd partial product (01111) sum of first two partial products 1111 3rd partial product (1001011) sum after adding 3rd partial product 1111 4th partial product 11000011 final product (sum after adding 4th partial product)
二進位之運算法:除法 Binary Division Binary division is similar to decimal division, except it is much easier because the only two possible quotient digits are 0 and 1. We start division by comparing the divisor with the upper bits of the dividend. If we cannot subtract without getting a negative result, we move one place to the right and try again. If we can subtract, we place a 1 for the quotient above the number we subtracted from and append the next dividend bit to the end of the difference and repeat this process with this modified difference until we run out of bits in the dividend.
Binary Division 二進位之運算法: 不足以扣除,則往後退一位 The following example illustrates division of 14510 by 1110 in binary:
3 Systems for representing negative numbers in binary Sign & Magnitude: Most significant bit is the sign Ex: – 510 = 11012 1’s Complement: = (2n – 1) - N Ex: – 510 = (24 – 1) – 5 = 16 – 1 – 5 = 1010 = 10102 2’s Complement: N* = 2n - N Ex: – 510 = 24 – 5 = 16 – 5 = 1110 = 10112 For n-bit word, the first sign is sign, remaining n-1bits represent the magnitude So we have 2n-1 for positive and 2n-1 for negative integers Section 1.4 (p. 16)
1’s Complement: • For n= 4: • -0 =(24-1)-0=15 =(1111) • -8=(24-1)-8= 7=(0111) • (b) 正數(N)與負數: 由1變0 • 0變1 • (c)1’scomplement+1=2’scomplement 與+7混淆 • 2’s Complement: • 正數不變(N) • 負數以 2n去扣正數:2n-N (其中n為數字系統之位元數(bit)) • 所有2’s complement 之負數,其最左邊數值為1。(與前述之 • Sign & Magnitudesystem同樣具備易於辨識之優點)
Table 1-1:Signed Binary Integers (word length n = 4) 1’ and 2’ complement are commonly used: adv. : arithmetic unit are easy to design 1’s+1 由1變0 0變1
2’s Complement Addition (d) Note:For1’sand2’scomplementtogetann-bitsumis: Anoverflowoccursifaddingtwopositivenumbersgivesanegative answerorifaddingtwonegativenumbersgivesapositiveanswer: Thanoverflowoccurs!
Binary Codes Although most large computers work internally with binary numbers, the input-output equipment generally uses decimal numbers. Because most logic circuits only accept two-valued signals, the decimal numbers must be coded in terms of binary signals. In the simplest form of binary code, each decimal digit is replaced by its binary equivalent. For example, 937.25 is represented by: Section 1.5 (p. 21)
Table 1–2. Binary Codes for Decimal Digits Error-checking