Binary Systems1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN
Binary Systems2 Digital Systems They manipulate discrete information (A finite number of elements) Example discrete sets 10 decimal digits, the 26 letters of alphabet 10 decimal digits, the 26 letters of alphabet Information is represented in binary form Examples Digital telephones, digital television, and digital cameras The most commonly used one is DIGITAL COMPUTERS
Binary Systems3 CENTRAL PROCESSING UNIT Digital Computers Control Unit Arithmetic Logic Unit (ALU) Registers R1 R2 Rn Main Memory DiskKeyboardPrinter I/O Devices Bus
Binary Systems4 Binary Signals It means two-states 1 and 0 true and false on and off A single “on/off”, “true/false”, “1/0” is called a bit Example: Toggle switch
Binary Systems5 Byte Computer memory is organized into groups of eight bits Each eight bit group is called a byte
Binary Systems6 Why Computers Use Binary They can be represented with a transistor that is relatively easy to fabricate (in silicon) Millions of them can be put in a tiny chip Unambiguous signal (Either 1 or 0) This provides noise immunity
Binary Systems7 Analog Signal
Binary Systems8 Binary Signal A voltage below the threshold off A voltage above the threshold on
Binary Systems9 Binary Signal
Binary Systems10 Noise on Transmission When the signal is transferred it will pick up noise from the environment
Binary Systems11 Recovery Even when the noise is present the binary values are transmitted without error
Binary Systems12 Binary Numbers A number in a base-r system x = x n-1 x n-2... x 1 x 0. x -1 x X -(m-1) x -m
Binary Systems13 Radix Number System Base – 2 (binary numbers) 0 1 Base – 8 (octal numbers) Base – 16 (hexadecimal numbers) A B C D E F
Binary Systems14 Radix Operations The same as for decimal numbers *
Binary Systems15 Conversion From one radix to another From decimal to binary
Binary Systems16 Conversion From one radix to another From decimal to base-r Separate the number into an integer part and a fraction part For the integer part Divide the number and all successive quotients by r Divide the number and all successive quotients by r Accumulate the remainders Accumulate the remainders x 2 = x 2 = x 2 = x 2 =
Binary Systems17 Different Bases
Binary Systems18 Conversion From one radix to another From binary to octal Divide into groups of 3 bits Example = = From octal to binary Replace each octal digit with three bits Example = =
Binary Systems19 Conversion From one radix to another From binary to hexadecimal Divide into groups of 4 bits Example = 3348.B = 3348.B6 From hexadecimal to binary Replace each digit with four bits bits Example 7BA3.BC4 = BA3.BC4 =
Binary Systems20 Complements They are used to simplify the subtraction operation Two types (for each base-r system) Diminishing radix complement (r-1 complement) Radix complement (r complement) For n-digit number N r-1 complement r complement
Binary Systems21 9’s and 10’s Complements 9’s complement of = 9’s complement of = 10’s complement of = 10’s complement of =976579
Binary Systems22 1’s and 2’s Complements 1’s complement of – = Simply replace 1’s and 0’s 1’s complement of 2’s complement of = Add 1 to 1’s complement 2’s complement of =
Binary Systems23 Subtraction with Complements of Unsigned M – N Add M to r’s complement of N Sum = M+(r n – N) = M – N+ r n Sum = M+(r n – N) = M – N+ r n If M > N, Sum will have an end carry r n, discard it If M<N, Sum will not have an end carry and Sum = r n – (N – M) (r’s complement of N – M) Sum = r n – (N – M) (r’s complement of N – M) So M – N = – (r’s complement of Sum) So M – N = – (r’s complement of Sum)
Binary Systems24 Subtraction with Complements of Unsigned ’s complement of Discard end carry Answer 59815
Binary Systems25 Subtraction with Complements of Unsigned ’s complement of There is no end carry => -(10’s complement of 40185)
Binary Systems26 Subtraction with Complements of Unsigned ’s complement of Discard end carry 2^ Answer
Binary Systems27 Subtraction with Complements of Unsigned ’s complement of There is no end carry => -(2’s complement of ) Answer =
Binary Systems28 Signed Binary Numbers Unsigned representation can be used for positive integers How about negative integers? Everything must be represented in binary numbers Computers cannot use – or + signs
Binary Systems29 Negative Binary Numbers Three different systems have been used Signed magnitude One’s complement Two’s complement NOTE: For negative numbers the sign bit is always 1, and for positive numbers it is 0 in these three systems
Binary Systems30 Signed Magnitude The leftmost bit is the sign bit (0 is + and 1 is - ) and the remaining bits hold the absolute magnitude of the number Examples -47 = = = = For 8 bits, we can represent the signed integers –128 to +127 How about for N bits?
Binary Systems31 One’s complement Replace each 1 by 0 and each 0 by 1 Example (-6) First represent 6 in binary format ( ) Then replace ( )
Binary Systems32 Two’s complement Find one’s complement Add 1 Example (-6) First represent 6 in binary format ( ) One’s complement ( ) Two’s complement ( )
Binary Systems33 Arithmetic Addition Usually represented by 2’s complement Discard Discard
Binary Systems34 Registers They can hold a groups of binary data Data can be transferred from one register to another
Binary Systems35 Processor-Memory Registers
Binary Systems36 Operations
Binary Systems37 Logic Gates - 1
Binary Systems38 Logic Gates - 2
Binary Systems39 Ranges The gate inputThe gate output
Binary Systems40 Study Problems Course Book Chapter – 1 Problems 1 – 2 1 – 7 1 – 8 1 – 20 1 – 34 1 – 35 1 – 36
Binary Systems41 Sneak Preview Next time ASSIGNMENT Will be given Will be given QUIZ……. Expect a question from each one of the following Expect a question from each one of the following Convert decimal to any base Convert between binary, octal, and hexadecimal Binary add, subtract, and multiply Negative numbers
Binary Systems42 Questions