CH 8 Stallings
CH 8 Stallings
CH 8 Stallings
Chapter 8
Computer Arithmetic
Arithmetic & Logic Unit
0 means positive
1 means negative
+18 = 00010010
-18 = 10010010
Problems 1. Need to consider both sign and
magnitude in arithmetic
Problem of Sign-Magnitude 2. Also two representation of
representation: zero (+0 and -0)
+0 = 00000000
-0= 10000000
Two’s Compliment Example
Two’s Compliment
+3 = 00000011
+2 = 00000010
+1 = 00000001
+0 = 00000000
-1 = 11111111
-2 = 11111110
-3 = 11111101
Benefits of 2’s Complement
8 bit 2s compliment
+127 = 01111111 = 27 -1
-128 = 10000000 = -27
16 bit 2s compliment
+32767 = 011111111 11111111 = 215 - 1
-32768 = 100000000 00000000 = -215
Conversion Between Lengths
Complex
Work out partial product for each digit
Take care with place value (column)
Add partial products
Multiplication Example (unsigned)
1-bit reg
(Product in A, Q)
Flowchart for Unsigned Binary
Multiplication
Multiplying Negative Numbers
Home Task
Booth’s Algorithm
Example of Booth’s Algorithm
Division
00001101 Quotient
Divisor 1011 10010011 Dividend
1011
Partial 001110
1011
Remainders
001111
1011
Remainder
100
Division of Unsigned Binary
Integers
Division of Unsigned Binary
Integers
Real Numbers
Stallings Chapter 8
IEEE 754 on IEEE Web site