Arithmetic Logic Unit
Arithmetic Logic Unit
Computer Organization
Arithmetic & Logic Unit
• No period
• Sign-Magnitude
• Two’s complement
Sign-Magnitude
• Left most bit is sign bit
• 0 means positive
• 1 means negative
• +18 = 00010010
• -18 = 10010010
• Problems
—Need to consider both sign and magnitude in
arithmetic
—Two representations of zero (+0 and -0)
Two’s Compliment
• +3 = 00000011
• +2 = 00000010
• +1 = 00000001
• +0 = 00000000
• -1 = 11111111
• -2 = 11111110
• -3 = 11111101
Benefits
OVERFLOW RULE: If two numbers are added, and they are both
positive or both negative, then overflow occurs if and only if the
result has the opposite sign.
Addition and Subtraction
Addition and Subtraction
Subtraction is easily handled
with the following rule:
SUBTRACTION RULE: To
subtract one number
(subtrahend) from another
(minuend), take the twos
complement (negation) of the
subtrahend and add it to the
minuend.
Geometric Depiction of Two's Complement Integers
Multiplication
• Complex
• Work out partial product
for each digit
• Take care with place value
(column)
• Add partial products
Unsigned Binary Multiplication
Execution of Example
Flowchart for Unsigned Binary Multiplication
Multiplying Negative Numbers