CPEN 4 - Digital Logic Design Binary Systems C. Gerousis Digital Design 3 rd Ed., Mano Prentice Hall Digital vs. Analog An analog system has continuous range of values A mercury thermometer Vinyl records Human eye A digital system has a set of discrete values Digital Thermometer Compact Disc (CD) Digital camera
Benefits of using digital Analog signal Digital signal Advantages of using Digital: Cheap electronic circuits Easier to calibrate and adjust Resistance to noise: Clearer picture and sound Binary System Discrete elements of information are represented with bits called binary codes. Example: (9) = () (5) = () Question: Why are commercial products made with digital circuits as opposed to analog? Most digital devices are programmable: By changing the program in the device, the same underlying hardware can be used for many different applications.
Decimal Code Review the decimal number system. MSD Base (Radix) is - symbols (,,.. 9) Digits For Numbers > 9, add more significant digits in position to the left, e.g. 9>9. Each position carries a weight. Weights: 3 3 LSD If we were to write 936.5 using a power series expansion and base arithmetic: 3 + 9 + 3 + 6 + + 5 Binary number system The binary number system. Base is - symbols (,) - Binary Digits (Bits) For Numbers >, add more significant digits in position to the left, e.g. >. Each position carries a weight (using decimal). MSD Weights: 3 3 If we write. using a decimal power series we convert from binary to decimal: 4 3 + + + + + + = = 6 + 8+ 4+ + +.5+.5 = 3.5 LSD
Binary number system (.) = (? ) ANS: 48.4375 In computer work: =4 is referred as K = kilo =48576 is referred as M = mega 3 =? 4 =? What is the exact number of bytes in a 6 Gbyte memory module? Octal/Hex number systems The octal number system [from Greek: ΟΚΤΩ]. Its base is 8 eight digits,,, 3, 4, 5, 6, 7 (36.4) 8 = (? ) 8 + 3 8 + 6 8 + 4 8 = 58. 5 The hexadecimal number system [from Greek: ΕΚΑΕΞΙ]. Its base is 6 first digits are borrowed from the decimal system and the letters A, B, C, D, E, F are used for the digits,,, 3, 4, 5 (D63FA) 6 = (? ) 4 3 3 6 + 6 6 + 3 6 + 5 6 + 6 = 87756
Conversion from Decimal to Binary Conversion from decimal to binary: Let each bit of a binary number be represented by a variable whose subscript = bit positions, i.e., ( ) a Its decimal equivalent is: = ( aa ) ( + + ) = ( a + a + a ) It is necessary to separate the number into an integer part and a fraction: Repeatedly divide the decimalnumber by. Conversion from Decimal to Binary Find the binary equivalent of 37. 37 8 9 4 = 8 +.5 = 9 + = 4 +.5 = + = + = +.5 LSB 37 = MSB 53 =? ANS: 53 =
Conversion from Decimal to Binary Conversion from decimal fraction to binary: same method used for integers except multiplication is used instead of division. Convert (.854) to binary (give answer to 6 digits)..854 x = +.784 a - = MSB.784 x = +.468 a - =.468 x = +.8336 a -3 =.8336 x = +.667 a -4 =.6675 x = +.3344 a -5 =.3344 x = +.6688 a -6 = LSB (.854) = = (. a a a 3a 4a 5a 6) (.) (53.854) = (? ) Conversion from Decimal to Octal Conversion from decimal to octal: The decimal number is first divided by 8. The remainder is the LSB. The quotient is then divide by 8 and the remainder is the next significant bit and so on. Convert to octal. 8 8 4 8 7 8 = 4 +.5 = 7 +.5 = +.5 = +.5 R R4 R R = 4 8 LSB MSB
Table - page: 8 Decimal Hex Binary 3 3 4 4 5 5 6 6 7 7 8 8 9 9 A B C 3 D 4 E 5 F Octal 3 4 5 6 7 3 4 5 6 7 Conversion using Table Conversion from and to binary, octal, and hexadecimal plays and important part in digital computers. since 3 = 8 and 4 = 6 each octal digit corresponds to 3 binary digits and each hexa digit corresponds to 4 binary digits. (. ) = (74.3) 8 (. ) = (6FD.34) 6 from table
s and s Complements s complement of N = ( n -) N (N is a binary #) s complement can be formed by changing s to s and s to s s complement of a number is obtained by leaving all least significant s and the first unchanged, and replacing s with s and s with in all higher significant digits. The s complement of = The s complement of = Find the s and s-complement of Answer: and Subtraction Using Complements Subtraction with digital hardware using complements: Subtraction of two n-digit unsigned numbers M N base r:. Add M to the r s complement of N: M + (r n N). If M N, the sum will produce an end carry and is equal to r n that can be discarded. The result is then M N. 3. If M N, the sum will not produce an end carry and is equal to r n (N M)
Binary Subtraction using complements Binary subtraction is done using the same procedure. Subtract using s complement: A = s complement of B = + Sum = Discard end carry = Answer = end carry Subtract using s complement: Answer = Binary Subtraction using complements Subtract using s complement: A = s complement of B = + Sum = End-around carry = + Answer = Subtract using s complement: Answer =
Arithmetic addition Negative numbers must be initially in s complement form and if the obtained sum is negative, it is in s complement form. + 6 +3 +9 6 +3 +7 Add 6 and 3 Answer = Transfer of Information with Registers J
Binary Information Processing