School of Computer and Communication Engineering, UniMAP Mohd ridzuan mohd nor DKT 122/3 - DIGITAL SYSTEM I Chapter 2a: Number Systems Operation and Codeds
School of Computer and Communication Engineering, UniMAP 2 1.0Number & Codes Digital and analog quantities Decimal numbering system (Base 10) Binary numbering system (Base 2) Hexadecimal numbering system (Base 16) Octal numbering system (Base 8) Number conversion Binary arithmetic 1’s and 2’s complements of binary numbers Signed numbers Arithmetic operations with signed numbers Binary-Coded-Decimal (BCD) Digital codes
School of Computer and Communication Engineering, UniMAP Introduction to Numbering Systems 3 We are all familiar with the decimal number system (Base 10). Some other number systems that we will work with are: Binary Base 2 Octal Base 8 Hexadecimal Base 16
School of Computer and Communication Engineering, UniMAP Number Systems 4 Decimal Binary Octal Hexadecimal 0 ~ 9 0 ~ 1 0 ~ 7 0 ~ F
School of Computer and Communication Engineering, UniMAP 5 DECIMAL NUMBERS
School of Computer and Communication Engineering, UniMAP Binary Number System 6 Also called the “Base 2 system” The binary number system is used to model the series of electrical signals computers use to represent information 0 represents the no voltage or an off state 1 represents the presence of voltage or an on state
School of Computer and Communication Engineering, UniMAP 7 Binary Numbering Scale Base 2 NumberBase 10 EquivalentPowerPositional Value
School of Computer and Communication Engineering, UniMAP 8 Figure 2–1 Illustration of a simple binary counting application. Copyright ©2006 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. COUNTING IN BINARY
School of Computer and Communication Engineering, UniMAP 9 EXAMPLE 2-1 Convert the binary whole number (base 2) to decimal (base 10)
School of Computer and Communication Engineering, UniMAP Binary to Decimal Conversion Convert ( ) 2 to its decimal equivalent: Binary Positional Values x x x xx x x x Products
School of Computer and Communication Engineering, UniMAP 11 Exercise 2-1 Convert the fractional binary number to decimal
School of Computer and Communication Engineering, UniMAP 12 Number Conversion Any Radix (base) to Decimal Conversion
School of Computer and Communication Engineering, UniMAP 13 Number Conversion Binary to Decimal Conversion
School of Computer and Communication Engineering, UniMAP 14 Number Conversion Sum of weights method Decimal to Any Radix (Base) Conversion 1. INTEGER DIGIT: Repeated division by the radix & record the remainder 2. FRACTIONAL DECIMAL: Multiply the number by the radix until the answer is in integer
School of Computer and Communication Engineering, UniMAP 15 Example 2-2 Convert the to Binary
School of Computer and Communication Engineering, UniMAP Answer example2.2: - Repeated Division by 2 method 2 5 = = = = = MSBLSB = Remainder
School of Computer and Communication Engineering, UniMAP Answer example2.2: - Fractional Numbers Carry x 2 = x 2 = x 2 = x 2 = The Answer: MSBLSB
School of Computer and Communication Engineering, UniMAP 18 Exercise 2-2 Convert the following decimal numbers (base 10) to Binary (base 2) (a) 19 (b) 45
School of Computer and Communication Engineering, UniMAP 19 BINARY ARITHMETIC Binary Addition Binary Substraction Binary Multiplication Binary Division
School of Computer and Communication Engineering, UniMAP 20 Binary Addition = 0Sum of 0 with a carry of = 1Sum of 1 with a carry of = 1 Sum of 1 with a carry of = 10Sum of 0 with a carry of 1 Example: ???
School of Computer and Communication Engineering, UniMAP 21 Example 2.3 :- (a) (b) (c) (d)
School of Computer and Communication Engineering, UniMAP Binary Subtraction = = = = with a borrow of 1 Example: ???
School of Computer and Communication Engineering, UniMAP 23 Binary Subtraction = = = = with a borrow of 1 Example 2.4: ???
School of Computer and Communication Engineering, UniMAP 24 Simple Arithmetic Addition Example 2.5: Substraction Example 2.6:
School of Computer and Communication Engineering, UniMAP 25 Binary Multiplication 0 X 0 = 0 0 X 1 = 0Example 2.7: 1 X 0 = X 1 = 1 X
School of Computer and Communication Engineering, UniMAP 26 Binary Division Use the same procedure as decimal division
School of Computer and Communication Engineering, UniMAP 1’s complements of binary numbers 27 Changing all the 1s to 0s and all the 0s to 1s Example 2.8: Binary number ’s complement
School of Computer and Communication Engineering, UniMAP 1’s complements of binary numbers 28 Figure 2–2 Example of inverters used to obtain the 1’s complement of a binary number. Copyright ©2006 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved.
School of Computer and Communication Engineering, UniMAP 2’s complements of binary numbers 29 2’s complement Example 2.9: Step 1: Find 1’s complement of the number Binary # ’s complement Step 2: Add 1 to the 1’s complement
School of Computer and Communication Engineering, UniMAP 2’s complements of binary numbers 30 Figure 2–3 Example of obtaining the 2’s complement of a negative binary number. Copyright ©2006 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved.
School of Computer and Communication Engineering, UniMAP 31 Signed Magnitude Numbers Sign bit 0 = positive 1 = negative 31 bits for magnitude This is your basic Integer format …
School of Computer and Communication Engineering, UniMAP Sign numbers 32 Left most is the sign bit 0 is for positive, and 1 is for negative Sign-magnitude form = +25 sign bit magnitude bits 1’s complement form The negative number is the 1’s complement of the corresponding positive number Example: +25 is is
School of Computer and Communication Engineering, UniMAP Sign numbers 2’s complement form The positive number – same as sign magnitude and 1’s complement The negative number is the 2’s complement of the corresponding positive number. Example 2.10:- Express +19 and -19 in i) sign magnitude ii) 1’s complement iii) 2’s complement
School of Computer and Communication Engineering, UniMAP DECIMAL VALUE OF SIGNED NUMBERS Sign Magnitude Example 2.10:- - Determine the decimal value of this signed binary number expressed in sign-magnitude summing the weight where there is 1s = 21 The sign bit is 1; dec no is -21
School of Computer and Communication Engineering, UniMAP DECIMAL VALUE OF SIGNED NUMBERS 1’s Complement form (example: +ve value) Example Determine the decimal value of this signed binary number expressed in 1’s compliment summing the weight where there is 1s = +23
School of Computer and Communication Engineering, UniMAP DECIMAL VALUE OF SIGNED NUMBERS 1’s Complement form (example: -ve value) - Determine the decimal value of this signed binary number expressed in 1’s compliment summing the weight where there is 1s = -24 Adding 1 to the result, the final decimal no is = -23
School of Computer and Communication Engineering, UniMAP DECIMAL VALUE OF SIGNED NUMBERS 2’s Complement form (example: +ve value) - Determine the decimal value of this signed binary number expressed in 1’s compliment summing the weight where there is 1s = +86
School of Computer and Communication Engineering, UniMAP DECIMAL VALUE OF SIGNED NUMBERS 2’s Complement form (example: -ve value) Example Determine the decimal value of this signed binary number expressed in 1’s compliment summing the weight where there is 1s = -86
School of Computer and Communication Engineering, UniMAP 39 Q & A