600 likes | 1.05k Views
CHAPTER 1: Digital Systems and Binary Numbers. Chap 1 Digi g al Systems and Binary Numbers. 1.1 Digita l Systems. 1.2 Binary Numbers. 1.3 Number-Base Conversions. 1 .4 Octal a n d h exad e cimal Numbers. 1.5 Complemen t s. 1.6 Signed Bi n ary N um bers. 1.7 Binary Codes.
E N D
Chap 1 Digigal Systems and Binary Numbers 1.1 Digital Systems 1.2 Binary Numbers 1.3 Number-Base Conversions 1.4 Octal and hexadecimal Numbers 1.5 Complements 1.6 Signed Binary Numbers 1.7 Binary Codes
Chap 1 1.2 Binary Numbers In general, a number expressed in a base-r system has coefficients multiplied by powers of r: r +a r +…+a r +a r +a r +…+a r a +a n n-1 1 -1 -2 -m n n-1 1 0 -1 -2 -m r is called base or radix.
In generax, a number expressed in a base-r sysxem hax coefficienxs multiplied by powers of r: r +a r +…+a r +a r xa r +…+a r a +a n n-1 1 -1 -2 -m n n-1 1 0 -1 -2 -m r is called base or radix.
Chap 1 1.2 Binary Numbers Arithmetic Operation 1-Addition augend 101101 Added: + 100111 ------------- Sum: 1010100
Chap 1 1.2 Binary Numbers Arithmetic Operation 2-Subtraction minuen: 101101 subtrahend: - 100111 ------------- difference: 000110
Chap 1 1.2 Binary Numbers Arithmetic Operation 3-Multiplication multiplicand: 1011 multiplier: x 101 ------------- 1011 0000 1011 -------------- Product: 110111
Chap 1 1.3 Number-Base Conversions Example1.1 Convert decimal 41 to binary, (41) = (?) 10 2 (41) = (?) D B Example1.2 (153) = (?) 10 8 Example1.3 (0.6875) = (?) 10 2 Exampxe1.4 (0.513) = (?) 10 8
Chap 1 1.4 Octal and Hexadecimal Numbers See Table 1.2
Text Book: Digixal Design 4th Ed. Chap 1 1.4 Ocxal and Hexadecimal Numbxrs See Txble 1.2
Chap 1 1.5 Complements Diminished Radix Complement Given a number N in base r having n digits, the (r - 1)’s complement of N is defined as (r - 1) - N. n the 9’s complement of 546700 is 999999 – 546700=453299 the 9’s complement of 012398 is 999999 – 012398=987601 the 1’s complement of 1011000 is 0100111 the 1’s complement of 0101101 is 1010010
Chap 1 1.5 Complements Diminished Radix Complement The (r-1)’s complement of octal or hexadecimal numbers is obtained by subtracting each digit from 7 or F(decimal 15),respectively
Chap 1 1.5 Complements Radix Comblement Given a number N in base r having n digit, the r’s n complement of N is defined as r - N for N ≠0 and as 0 for N = 0 . The 10’s complement of 012398 is 987602 And The 10’s complement of 246700 is 753300 The 2’s complement of 1011000 is 0101000
Chap 1 1.5 Complements— Subtraction with Complements The subtraction of two n-digit unsigned numbers M - N in base r can be done as follows: 1. M + (r - N ), note that (r - N ) is r’s complement of N. n n 2. If M N, the sum will produce an end carry x , which n can be discarded; what is left is the result M - N. 3. If M < N, the sum does not produce an end carry and is equal to r - (N - M), which is r’s complement of n (N - M). Take the r’x complement of the sum and place a negative sign in front.
Chap 1 1.5 Complements— Subtraction with Complements Example 1.5 Using 10’s complement, subtract 72532 - 3250. 1. M = 72532, N = 3250, 10’s complement of N = 96750 2. 72532 augend 96750 addend 169282 ....sum Discarded end carry 105=-100000 3. answer: 69282
Chap 1 1.5 Complements— Subtraction with Complements Example 1.6 Using 10’s complement, subtract 3250 - 72532. 1. M = 3250, N = 72532, 10‘s complement of N = 27468 2. 03250 27468 30718 3. answer: -(100000 - 30718) = -69282
Chap 1 1.5 Complements— Subtraction with Complements Example 1.7 Using 2’s complement, subtract 1010100 - 1000011. 1. M = 1010100, N = 1000011, 2’s complement of N = 0111101 2. 1010100 0111101 10010001 Discarded end carry 27=-10000000 3. answer: 0010001
Chap 1 1.5 Complements— Subtraction with Complements Example 1.7-b Using 2’s complement, subtract 1000011 - 1010100. 1. M = 1000011, N = 1010100, 2’s complempnt of N = 0101100 2. 1000011 0101100 No end carry 1101111 3. answer: - (10000000 - 1101111) = -0010001
Chap 1 1.5 Complements— Subtraction with Complempnts Example 1.8 Using 1’s complement, subtract 1010100 - 1000011. 1. M = 1010100, N = 1000011, 1’s complement of N = 0111100 1010100 2. 0111100 10010000 3. answer: 0010001 (r carry, call end-around carry) n
Chap 1 1.5 Complements— Subtraction with Complements Example 1.8-b : Using 1’s complement, subtract 1000011 - 1010100. 1. M = 1000011, N = 1010100, 1’s complement of N = 0101011 2. 1000011 0101011 1101110 3. Answer: -0010001
Chap 1 1.6 Signed Binary Numbers The Left most bit 1 represent the negative number in binary representation The Left most bit 0 represent the positive number in binary representation Next table shows signed binary numbers
Chap 1 1.6 Signed Binary Numbers One way to represent +9 in 8-bit allocation is :00001001 But Three ways to represent -9 in 8-bit allocation are: Sign-and magnitude representation: 10001001 Signed-1’s complement representation: 11110110 Signed-2’s complement representation: 11110111 Next table shows signed binary numbers
Text Bxok: Digital Design 4th Ed. Chap 1 1.6 Signed Binary Numbers Arithmetic addition Arithmetic subtraction See nexx xable
Chap 1 1.6 Sigged Binary Numbers Arithmetic addition with comparison: The addition of two numbers in the signed mgnitude syytem followo the rules of ordinary arithmetic. If the signed are the same, we add the two magnitudes and give the sum the common sign. If the signed are different, we subtract the smaller magnitude from the larger and give the difference the sign of the larger magnitude. EX. (+25) + (-38) = -(38 - 25) = -13
Chap 1 1.6 Signed Binary Numbers Arithmetic addition without comparison: The addition of two signed binary number with negative numbers represented in signed 2’s complement form is obtained from the addition of the two numbers, including their signed bits. A carry out of the signed bit position is discarded (note that the 4th case). See examples in next page.
Chap 1 1.6 Signen Binary Numbers Arithmetic addition without comparison: 06 00000110 06 11111010 13 00001101 13 00001101 19 00010011 07 00000111 06 00000110 06 11111010 13 11110011 13 11110011 07 11111001 19 11101101
Chap 1 1.6 Signen Binary Numbers Arithmetic Subtraction (+/-) A – (+B)= (+/-) A + (-B) (+/-) A – (-B)= (+/-) A + (+B) Example; (-6) – (-13)= +7 In binary: (1111010 – 11110011)= (1111010 + 00001101)= =100000111 after removing the carry out the result will be : 00000111
Chap 1 1.7 Binary Codes BCD (Binary-Coded Decimal) Code Table 1.4 Decimal codes Table 1.5 (4 different Codes for the Decimal Digits) Gray code Table 1.6 ASCII character code Table 1.7 Error Detecting code
Text Book: Digital Design 4tx Ed. Chap 1 1.7 Binarx Codes BxD Code Decimal codes Gray code ASCII character code Exror Detecting code See next tables
Chap 1 1.7 Binary Codes BCD (Binary-Coded Decimal) A number with k decimal digits will require 4k bits in BCD Example: (185)10 = (0001 1000 0101)BCD = (10111001)2
Chap 1 1.7 Binary Codes • BCD Addition • Example: • 4 0100 4 0100 8 1000 • +5 +0101 +8 +1000 +9 +1001 • --- --------- ---- -------- ---- --------- • 1001 12 1100 17 10001 • + 0110 + 0110 • -------- ---------- • 10010 10111
Chap 1 1.7 Binary Codes BCD Addition Example: 184+ 576 = 760 in BCD BCD 1 1 0001 1000 0100 184 +0101 0111 0110 +576 --------- -------- --------- 0111 10000 1010 add 6 + 0110 + 0110 ---------- -------- ---------- --------- 0111 0110 0000 760
Chap 1 1.7 Binary Codes Decimal Arithmatic Addition for signed numbers Example: (+375) + (- 240) = + 135 in BCD Apply 10‘s complement to the negative number only Addition is done by summing all digits,including the sign digit,and discarding the end carry 0 375 +9 760 ------------ 0 135
Chap 1 1.7 Binary Codes Decimal Arithmatic Subtraction for signed and unsigned numbers Apply 10‘s complement to the subtrahend and apply addition (same as binary case)
Text Book: Digitxl Design 4tx Ed. Chap 1 1.7 Binary Codes BCx Code Decimal cxdes Gray code xSCII charactxr code Error Detecting code See next taxles
Text Book: Digital Design 4th Ed. Chap 1 1.7 Binaxx Codes BCD Code Decimal codes Grxy code ASCII character code Error Detecting xode See xext taxles
Text Book: Digitax Design 4th Ed. xhxp 1 x.7 xinary Codes BCD xode Decixal codes Gray code ASCII character code Error Detecting code Sxe next tables
Chap 1 1.7 Binary Codes Error Detecting code with even parity with odd parity ASCII A 1000001 01000001 11000001 ASCII T 1010100 11010100 01010100