Download presentation
Presentation is loading. Please wait.
Published byMitchell Dawson Modified over 9 years ago
1
School of Computer and Communication Engineering, UniMAP Mohd ridzuan mohd nor mohdridzuan@unimap.edu.my 019-3806067 1 DKT 122/3 - DIGITAL SYSTEM I Chapter 2b: Number Systems Operation and Codeds
2
School of Computer and Communication Engineering, UniMAP 2 SIGN-MAGNITUDE: Decimal values of +ve & -ve no are determined summing the weights in all the mag. bit positions where there are 1’s and ignoring those positions where there are zeros. The sign is determined by examination Of the sign bit DECIMAL VALUE OF SIGNED NUMBERS
3
School of Computer and Communication Engineering, UniMAP 3 DECIMAL VALUE OF SIGNED NUMBERS Sign Magnitude - Determine the decimal value of this signed binary number expressed in sign-magnitude 10010101 2 6 2 5 2 4 2 3 2 2 2 1 2 0 summing the weight where there is 1s 0 0 1 0 1 0 1 16 + 4 + 1 = 21 The sign bit is 1; dec no is -21
4
School of Computer and Communication Engineering, UniMAP 4 DECIMAL VALUE OF SIGNED NUMBERS 1’s COMPLEMENT: Decimal values of +ve no are determined by summing the weights in all bit positions where there are 1s and ignoring those positions where there are zeros. Decimal number of –ve no are determined by assigning a –ve value to the weight of sign bit, summing all the weights where there are 1s and adding 1 to the results
5
School of Computer and Communication Engineering, UniMAP 5 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 00010111 -2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 summing the weight where there is 1s 0 0 0 1 0 1 1 1 16 + 4 + 2 + 1 = +23
6
School of Computer and Communication Engineering, UniMAP 6 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 11101000 -2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 summing the weight where there is 1s 1 1 1 0 1 0 0 0 -128 + 64 + 32 + 8 = -24 Adding 1 to the result, the final decimal no is -24 + 1 = -23
7
School of Computer and Communication Engineering, UniMAP 7 DECIMAL VALUE OF SIGNED NUMBERS 2’S COMPLEMENT: Decimal values of +ve and –ve no are determined by summing the weights in all by summing the weight in all positions where there are 1s and ignoring those positions where there are zeros The weight of the sign bit in a –ve no is given a –ve value
8
School of Computer and Communication Engineering, UniMAP 8 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 01010110 -2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 summing the weight where there is 1s 0 1 0 1 0 1 1 0 64 + 16 + 4 + 2 = +86
9
School of Computer and Communication Engineering, UniMAP 9 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 10101010 -2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 summing the weight where there is 1s 1 0 1 0 1 0 1 0 -128 + 32 + 8 + 2 = -86
10
School of Computer and Communication Engineering, UniMAP 10 ARITHMETIC OPERATION WITH SIGNED NOs Addition: Conditions: 1.Both number +ve 2. +ve number with magnitude larger than –ve no 3.-ve number with magnitude larger than +ve no 4.Both no –ve
11
School of Computer and Communication Engineering, UniMAP 11 ARITHMETIC OPERATION WITH SIGNED NOs Substraction: Remember: The sign of a +ve or –ve binary number is changed by taking its 2’s complement To substract two signed numbers, take the 2’s complement of the subtrahend and add. Discard any final carry bit
12
School of Computer and Communication Engineering, UniMAP 12 ARITHMETIC OPERATION WITH SIGNED NOs Multiplication: 2 methods: Direct addition – lengthy 2. Partial product – most common Partial Product: Step 1 – determine if the sign of the multiplicand are the same or different. That’s will determines the end result -If the sign are the same, the product = +ve -If the sign are different, the product = -ve
13
School of Computer and Communication Engineering, UniMAP 13 Step 2 – Change any number to uncomplemented form. Usually from 2’s complemented form to true number Step 3 – Do a partial product multiplication. Use only the mag. bits. Ignore sign bit Step 4 – Add each successive partial product to get the final product. Step 5 – If sign bit is –ve, take the 2’s complement of the product. Else just leave it as the final result. Don’t forget to add the sign bit
14
School of Computer and Communication Engineering, UniMAP 14 ARITHMETIC OPERATION WITH SIGNED NOs Division: Step 1 – determine if the sign of the divident and divisor are the same or different. That’s will determines the sign of the quotient -If the sign are the same, the quotient = +ve -If the sign are different, the quotient = -ve Step 2 – Substract the divisor from the dividend using 2’s compliment addition to get the 1’s partial remainder and add 1 to quotient -If the partial remainder is +ve, go to step 3. If –ve, division is completed.
15
School of Computer and Communication Engineering, UniMAP 15 Step 3 – Substract the divisor from the partial remainder and add 1 to quotient. If result = +ve, repeat for the next partial remainder. If result = 0 or –ve, division is complete. ARITHMETIC OPERATION WITH SIGNED NOs
16
School of Computer and Communication Engineering, UniMAP 16 00000000 00000001 00000010 00000011 00000100 00000101 00000110 00000111 00001000 00001001 00001010 00001011 00001100 00001101 00001110 00001111 000 001 002 003 004 005 006 007 010 011 012 013 014 015 016 017 0123456789ABCDEF0123456789ABCDEF 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 BinaryOctalHexDec
17
School of Computer and Communication Engineering, UniMAP 17 Significant Digits Binary: 11101101 Most significant digit Least significant digit Hexadecimal: 1D63A7A Most significant digit Least significant digit
18
School of Computer and Communication Engineering, UniMAP 18 Hexadecimal Number System Base 16 system Uses digits 0-9 & letters A,B,C,D,E,F Groups of four bits represent each base 16 digit
19
School of Computer and Communication Engineering, UniMAP 19 Hexadecimal to Decimal Conversion Convert 3B4F 16 to its decimal equivalent: Hex Digits 3 B 4 F xx x 16 3 16 2 16 1 16 0 12288 +2816 + 64 +15 15,183 10 Positional Values Products x
20
School of Computer and Communication Engineering, UniMAP 20 Decimal to Hexadecimal Conversion Convert 830 10 to its hexadecimal equivalent: 830 / 16 = 51 R14 51 / 16 = 3 R3 3 / 16 = 0 R3 33E 16 = E in Hex
21
School of Computer and Communication Engineering, UniMAP 21 Number Conversion Binary to Hexadecimal Conversion (vice versa) 1. Grouping the binary position in 4-bit groups, starting from the least significant position.
22
School of Computer and Communication Engineering, UniMAP 22 Binary to Hexadecimal Conversion The easiest method for converting binary to hexadecimal is to use a substitution code Each hex number converts to 4 binary digits
23
School of Computer and Communication Engineering, UniMAP 23 Number Conversion Example: Convert the following binary numbers to their hexadecimal equivalent (vice versa). a) 10000.1 2 b) 1F.C 16 Answer: a) 10.8 16 b) 00011111.1100 2 or 11111.1100 2
24
School of Computer and Communication Engineering, UniMAP 24 Convert 010101101010111001101010 2 to hex using the 4-bit substitution code : 0101 0110 1010 1110 0110 1010 Substitution Code 5 6 A E 6 A 56AE6A 16
25
School of Computer and Communication Engineering, UniMAP 25 00000000 00000001 00000010 00000011 00000100 00000101 00000110 00000111 00001000 00001001 00001010 00001011 00001100 00001101 00001110 00001111 000 001 002 003 004 005 006 007 010 011 012 013 014 015 016 017 0123456789ABCDEF0123456789ABCDEF 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 BinaryOctalHexDec NUMBER SYSTEMSNUMBER SYSTEMS
26
School of Computer and Communication Engineering, UniMAP 26 Octal Number System Also known as the Base 8 System Uses digits 0 - 7 Readily converts to binary Groups of three (binary) digits can be used to represent each octal digit Also uses multiplication and division algorithms for conversion to and from base 10
27
School of Computer and Communication Engineering, UniMAP 27 Octal to Decimal Conversion Convert 653 8 to its decimal equivalent: 6 5 3 xx x 8 2 8 1 8 0 384 + 40 + 3 427 10 Positional Values Products Octal Digits
28
School of Computer and Communication Engineering, UniMAP 28 Decimal to Octal Conversion Convert 427 10 to its octal equivalent: 427 / 8 = 53 R3Divide by 8; R is LSD 53 / 8 = 6 R5Divide Q by 8; R is next digit 6 / 8 = 0 R6Repeat until Q = 0 653 8
29
School of Computer and Communication Engineering, UniMAP 29 Number Conversion Binary to Octal Conversion (vice versa) 1. Grouping the binary position in groups of three starting at the least significant position.
30
School of Computer and Communication Engineering, UniMAP 30 Octal to Binary Conversion Each octal number converts to 3 binary digits To convert 653 8 to binary, just substitute code: 6 5 3 110 101 011
31
School of Computer and Communication Engineering, UniMAP 31 Number Conversion Example: Convert the following binary numbers to their octal equivalent (vice versa). a) 1001.1111 2 b) 47.3 8 c) 1010011.11011 2 Answer: a) 11.74 8 b) 100111.011 2 c) 123.66 8
32
School of Computer and Communication Engineering, UniMAP 32 Substitution code can also be used to convert binary to octal by using 3-bit groupings: 010 101 101 010 111 001 101 010 Substitution Code 2 5 5 2 7 1 5 2 25527152 8
33
School of Computer and Communication Engineering, UniMAP 33 Digital Codes BCD (Binary Coded Decimal) Code 1. Represent each of the 10 decimal digits (0~9) as a 4-bit binary code. Example: Convert 15 to BCD. 1 5 0001 0101 BCD Convert 10 to binary and BCD.
34
School of Computer and Communication Engineering, UniMAP 34 Digital Codes ASCII (American Standard Code for Information Interchange) Code 1. Used to translate from the keyboard characters to computer language
35
School of Computer and Communication Engineering, UniMAP 35 Digital Codes The Gray Code Only 1 bit changes Can’t be used in arithmetic circuits Binary to Gray Code and vice versa. DecimalBinaryGray Code 00000 10001 200100011 3 0010 401000110 501010111 601100101
36
School of Computer and Communication Engineering, UniMAP 36 Q & A
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.