Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 48

Computer Arithmetic

Number Representation
• Unsigned Integer Number:
– Range is 0 to (2n-1)
• Signed Integer Number:
– 1’s complement: Range is -(2n-1-1) to +(2n-1-1)
– 2’s complement: Range is -2n-1 to +(2n-1-1)
Sub using Add(1’s complement)

Perform: 3-5, there is no carry, result is negative.


Sub using Add(2’s complement)

Perform: 3-5, there is no carry, result is negative.


Two bit addition
Addition of multi-bit numbers
Full adder
Delay of Full adder
N bit ripple carry adder
Carry Look Ahead adder
(CLA)
Design of 4 bit Carry Look Ahead Adder
4 bit CLA circuit
Design of 4 bit Carry Look Ahead Adder
Design of 16 bit Carry Look Ahead Adder using 4 bit CLA
Unsigned number multiplication

Shift and Add


Generate n2 partial products
Require n2 AND gates
Design of combinational array multiplier
Extremely inefficient, large hardware
Unsigned sequential multiplication
Procedure for unsigned multiplication
Example of multiplication using shift and add
Data Path for shift and add multiplier
Signed number multiplication

Rule: Extend or replicate the sign bit any number of times


towards the MSB
Shift and add method for signed number

Multiplicati
on of 2 n
bit numbers
results in
max 2n bit
result

It requires
n additions
and n shift
operations
Booth’s algorithm for signed multiplication

• Basic Idea of Booth’s Algorithm


• If the bits are same (00 or 11), we only shift the partial
product
• If the bits are 01, we do an addition and then shift.
• If the bits are 10, we do a subtraction and then shift.
• Significantly reduces the number of additions/subtractions
• Bit pairs stated above can be expressed as Booth’s
encoding
• Use the symbols +1, -1 or 0 to indicate changes wrt Qi
and Qi-1
• 01 = +1 10= -1 00 or 11= 0
Booth’s Encoding Example
Procedure for Booth’s multiplication
Booth’s Multiplication Example
Booth’s Multiplication Example
Design of Fast multiplier

• This technique halves the number of summands


• It is derived from Booth’s algorithm
• Group the Booth-coded multiplier digits in pairs

• (+1,-1): (+1)(21)+(-1)(20) = +1 write as (0,+1)


• (0,+1): (0)(21)+(+1)(20) = +1 write as (0,+1)
• (-1,0): (-1)(21)+(0)(20) = -2 write as (0,-2)
Example

-1 * M= 2’s complement
-2 * M= left shift -1 * M
Integer Division
Procedure for integer division
Floating Point Numbers

A binary Number with fractional part is given by:

B= bn-1bn-2……b1b0.b-1b-2……b-m

These are called Fixed point numbers, as the radix point is fixed.
Limitations of this representation
Floating point number representation
IEEE 754
Normalized representation
Example
Another example
Floating Point Addition
Floating Point Subtraction

You might also like