Docsity

Computer Organisation - Computer Arithmetic, Study notes of Computer Architecture and Organization

Partial preview of the text

Download Computer Organisation - Computer Arithmetic and more Study notes Computer Architecture and Organization in PDF only on Docsity!

Computer Arithmetic

Addition and subtraction in S+M

Operation Add

Magnitud

e

Subtract Magnitude

When A>B When A<B When A=B

(+A)+(+B) +(A+B)

(+A)+(-B) +(A-B) -(B-A) +(A-B)

(-A)+(+B) -(A-B) +(B-A) +(A-B)

(-A)+(-B) -(A+B)

(+A)-(+B) +(A-B) -(B-A) +(A-B)

(+A)-(-B) +(A+B)

(-A)-(+B) -(A+B)

(-A)-(-B) -(A-B) +(B-A) +(A-B)

Hardware Requirement

Parallel Adder for the Microoperation

A+B

Comparator to establish A>B,A<B or A=B

Two parallel Subtractor to perform the

Microoperation A-B and B-A

A XOR gate to determine sign of the

result

Hardware for signed Rep. Add and Sub

A register

AVF

E

B

s

A

s

B register

Complementer

Parallel Adder

S

Load

Sum

M

Mode

Control

Input

Carry

Output

Carry

Addition and subtraction in

S+M

Addition & Subtraction-Fixed Point

No.’s

2’s Complement Representation

AC-BR

AC<-AC+BR+

V<-Overflow

End

AC+BR

AC<-AC+BR

V<-Overflow

End

Basic adders

Circuits to add two n bit unsigned binary

numbers

▫

Serial adder

▫ Parallel adders

Ripple carry Adder

Carry lookahead adder

Serial adder

Least expensive in

terms of hardware

N clock cycle to

compute sum of n

bit no.’s

1 bit

adder

Carry

in C i-

Carry

out Ci

Q D

Yi

Xi

Zi

Ripple carry adder - limitation

Large signal propagation delay

Gate Delay

▫

Time taken by the signal to propagate

through the logic gate

x

x’

1

0

gate delays

Delay’s in ripple carry adder

1

2

3

4

5

6

7

8

9

For an n-bit ripple carry adder, the

longest path has 2n+1 gates

4x2+1=

64 bit->2x64+1 =129 gates

Carry look ahead adder

Compute the input carry needed by stage i

directly from carry like signals from preceding

stages rather than wait for carry to ripple

▫ The “generate” function g

i

produces 1 when there

must be a carry out from position i (i.e., when A

i

and B

i

are both 1). g

i

= A

i

B

i

▫ The “propagate” function p

i

is true when, if there is

an incoming carry, it is propagated (i.e, when A

i

=

or B

i

=1, but not both). p

i

= A

i

 B

i

▫Then we can write Carry out as C

i

= g

i

  • p

i

C

i-

1

▫ Sum equation for stage I Z

i

= p

i

 g

i

C

i-

Carry look ahead adder

A

i

B

i

C

i

C

i+ 1

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 1

1 1 1 1

Generate

Propagate

4 stage Carry Look Ahead

Adder

  • c

1

= g

0

  • p

0

c

0

  • c

2

= g

1

  • p

1

c

1

= g

1

  • p

1

(g

0

  • p

0

c

0

)

= g

1

  • p

1

g

0

  • p

1

p

0

c

0

  • c

3

= g

2

  • p

2

c

2

= g

2

  • p

2

(g

1

  • p

1

g

0

  • p

1

p

0

c

0

)

= g

2

  • p

2

g

1

  • p

2

p

1

g

0

  • p

2

p

1

p

0

c

0

  • c

4

= g

3

  • p

3

c

3

= g

3

  • p

3

(g

2

  • p

2

g

1

  • p

2

p

1

g

0

  • p

2

p

1

p

0

c

0

)

= g

3

  • p

3

g

2

  • p

3

p

2

g

1

  • p

3

p

2

p

1

g

0

  • p

3

p

2

p

1

p

0

c

0

4 bit carry look ahead adder