






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!























Data Types
Complements
Fixed Point Representations
Floating Point Representations
Other Binary Codes
Error Detection Codes
Information that a Computer is dealing with
Data Types
Major Consideration is the COST and TIME
Arithmetic - Addition of Numbers - Table for Addition
0 1 0 0 1 1 1 10
0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 10 2 2 3 4 5 6 7 8 9 1011 3 3 4 5 6 7 8 9 101112 4 4 5 6 7 8 9 10111213 5 5 6 7 8 9 1011121314 6 6 7 8 9 101112131415 7 7 8 9 10111213141516 8 8 9 1011121314151617 9 9 101112131415161718
Binary Addition Table
Decimal Addition Table
Data Types
Decimal Binary Octal Hexadecimal 00 0000 00 0 01 0001 01 1 02 0010 02 2 03 0011 03 3 04 0100 04 4 05 0101 05 5 06 0110 06 6 07 0111 07 7 08 1000 10 8 09 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F
Binary, octal, and hexadecimal conversion
Octal Binary Hexa
Data Types
Convert 41.6875 10 to base 2.
Integer = 41 41 20 1 10 0 5 0 2 1 1 0 0 1
Fraction = 0.
x 2
x 2
x 2
x 2
(41) 10 = (101001) 2 (0.6875) 10 = (0.1011) 2
Convert (63) 10 to base 5: (223) (^5) Convert (1863) 10 to base 8: (3507) (^8) Convert (0.63671875) 10 to hexadecimal: (0.A3) (^16)
Exercise
Data Types
Two types of complements for base R number system:
The (R-1)'s Complement
Subtract each digit of a number from (R-1) Example
The R's Complement
Add 1 to the low-order digit of its (R-1)'s complement
Example
Complements
Signed magnitude representation Signed 1's complement representation Signed 2's complement representation
Example: Represent +9 and -9 in 7 bit-binary number
Only one way to represent +9 ==> 0 001001 Three different ways to represent -9: In signed-magnitude: 1 001001 In signed-1's complement: 1 110110 In signed-2's complement: 1 110111
In general, in computers, fixed point numbers are represented either integer part only or fractional part only.
Need to be able to represent both positive and negative numbers
CHARACTERISTICS OF 3 DIFFERENT REPRESENTATIONS
Complement Signed magnitude: Complement only the sign bit Signed 1's complement: Complement all the bits including sign bit Signed 2's complement: Take the 2's complement of the number, including its sign bit.
Maximum and Minimum Representable Numbers and Representation of Zero X = xn x (^) n-1 ... x 0. x (^) -1 ... x-m
Signed Magnitude Max: 2n^ - 2 -m^ 011 ... 11.11 ... 1 Min: -(2 n^ - 2 -m^ ) 111 ... 11.11 ... 1 Zero: +0 000 ... 00.00 ... 0 -0 100 ... 00.00 ... 0 Signed 1’s Complement Max: 2n^ - 2 -m^ 011 ... 11.11 ... 1 Min: -(2 n^ - 2 -m^ ) 100 ... 00.00 ... 0 Zero: +0 000 ... 00.00 ... 0 -0 111 ... 11.11 ... 1
Fixed Point Representations
Signed 2’s Complement Max: 2n^ - 2 -m^ 011 ... 11.11 ... 1 Min: -2 n^ 100 ... 00.00 ... 0 Zero: 0 000 ... 00.00 ... 0
[1] Compare their signs [2] If two signs are the same , ADD the two magnitudes - Look out for an overflow [3] If not the same , compare the relative magnitudes of the numbers and then SUBTRACT the smaller from the larger --> need a subtractor to add [4] Determine the sign of the result
Overflow (^) 9 + 9 or (-9) + (-9) 9 1001 +) 9 1001 overflow (1)
Fixed Point Representations
ARITHMETIC ADDITION: SIGNED 2’s COMPLEMENT
Example (^6 0 ) 9 0 1001 15 0 1111
Add the two numbers, including their sign bit, and discard any carry out of leftmost (sign) bit - Look out for an overflow
9 0 1001^ overflow +) 9 0 1001
2 operands have the same sign and the result sign changes x (^) n-1 yn-1 s’ (^) n-1 + x’ (^) n-1 y’ (^) n-1 s (^) n-1 = c (^) n-1⊕ c (^) n
x’ (^) n-1 y’ (^) n-1 s (^) n- (c (^) n-1 ⊕ c (^) n)
x (^) n-1 yn s’ (^) n- (c (^) n-1 ⊕ c (^) n)
Fixed Point Representations
S + M > 1’s Complement > 2’s Complement
2’s Complement > 1’s Complement(end-around C)
2’s Complement is fast
Fixed Point Representations
Take the complement of the subtrahend (including the sign bit) and add it to the minuend including the sign bits.
Fixed Point Representations
sign (^) sign
mantissa exponent ==> +.1234567 x 10+
Example A binary number +1001.11 in 16-bit floating point number representation (6-bit exponent and 10-bit fractional mantissa)
0 0 00100 100111000
Example
Note: In Floating Point Number representation, only Mantissa(M) and Exponent(E) are explicitly represented. The Radix(R) and the position of the Radix Point are implied.
Sign Exponent Mantissa or
Floating Point Representation
Normal Form
Representation of Zero
Floating Point Representation