Docsity

Digital Logic: Half-Adders and Full-Adders, Study notes of Electrical and Electronics Engineering

Partial preview of the text

Download Digital Logic: Half-Adders and Full-Adders and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Basic Adders and Counters

Lecture 3

Half-adder

x y

c s

HA

x + y = ( c s ) 2

2 1

x y c (^) s 0 0 1 1

0 1 0 1

0 0 0 1

0 1 1 0

Half-adder

Alternative implementations (1)

s = xy + xy

b)

a)

s = x โŠ• y

c = xy

c = x + y

c) c = xy

s = xc + yc = xc โ‹… yc

Half-adder

Alternative implementations (2)

Full-adder

Alternative implementations (2)

s = x โŠ• y โŠ• cin = xycin + xycin + xycin + xycin

b) cout = xy + xcin + ycin

Full-adder

Alternative implementations (3)

c)

x y cout s 0 0 1 1

0 1 0 1

0

1

cin cin

cin

cin

cin cin

x y

A A1^ XOR^

D

0 1

Cin

Cout

S p

g

Full-adder

Alternative implementations (4)

Implementation used to generate fast carry logic in Xilinx FPGAs

x y cout 0 0 1 1

0 1 0 1

y

y

cin cin

p = x โŠ• y g = y s= p โŠ• cin = x โŠ• y โŠ• cin

Latency of a k -bit ripple-carry adder

Tripple-add = TFA(x,yโ†’cout) +
+ ( k -2) โ‹… TFA(cinโ†’cout) +
+ TFA(cin โ†’s)

Latency โ‰ˆ k โ‹… TFA

Latency โˆ k

Overflow for signed numbers (1)

Indication of overflow Positive

  • Positive = Negative

Negative

  • Negative = Positive

Formulas

Overflow2โ€™s complement = xk-1 yk-1 sk-1 + xk-1 yk-1 sk-1 =

= ck โŠ• ck-

Addition of a constant (1)

xk-1 xk-2... x 1 x 0 yk-1 yk-2... y 1 y 0

variable

  • constant

xk-1 xk-2... xh+1 xh xh-1... x 0 yk-1 yk-2... yh+1 1 0... 0

variable

  • constant

xh xh-1... x 0

sk-1 sk-2... s 1 s 0

sk-1 sk-2... sh+

Addition of a constant (2)

HA/^... MHA

HA/ MHA

HA/ MHA

HA/ MHA

xk-1 xk-2... xh+2 xh+1 xh xh-1... x 0

..

sk-1 sk-2... (^) sh+2 sh+1 xh xh-1... x 0

If yi = 0 Half-adder (HA) yi = 1 Modified half-adder (MHA)

ck

Modified half-adder

x y

c s

MHA

x + y + 1 = ( c s ) 2

2 1

x y c (^) s 0 0 1 1

0 1 0 1

0 1 1 1

1 0 0 1

HA HA HA HA

xk-1 xk-2... x 2 x 1

..

sk-1 sk-2... s 2 s 1

x 0

x 0

ck

Incrementer

MHA MHA MHA MHA

xk-1 xk-2... x 2 x 1

..

sk-1 sk-2... s 2 s 1

x 0

x 0

ck

Decrementer

Possible solutions to the

carry propagate problem

  1. Detect the end of propagation rather than wait for the worst-case time
  2. Speed-up propagation via
  • look-ahead
  • carry skip
  • carry select, etc
  1. Limit carry propagation to within a small number of bits
  2. Eliminate carry propagation through the redundant number representation

Analysis of carry propagation

Probability of carry generation = 41 (xiyi = 11)

Probability of carry propagation = 21 (xiyi = 01 or 10)

Probability of carry anihilation = 21 (xiyi = 00 or 11)

j j-1....... i+1 i 1 0 โ€ฆ 1 โ€ฆ0 โ€ฆ 1 1 1 1 โ€ฆ 0 โ€ฆ1 โ€ฆ 0 1

Probability of carry propagating from position i to position j

=

11 or 00 (^) 01 or 10 1 2

1 j โˆ’^ i โˆ’ โ‹… 2

1

probability of propagation

probability of anihilation

=

j โˆ’ i 2

1

Expected length of the carry chain
that starts at position i (1)

Expected length( i , k ) =

k i
k i
k j i
j i
j i
โˆ’^ โˆ’

Length of the carry chain

Probability of the given length

Probability of propagation till the end of adder

Distance till the end of adder

Manchester Carry Chains and Adders

Generate signal: gi = xiyi Propagate signal: pi = xi โŠ• yi Anihilate (absorb) signal: ai = xi yi = x + y

Transfer signal: ti = gi + pi = ai = xi + yi cout =1 given cin = 1

ci+1 = gi + cipi = = (gi + cigi) + cipi = = gi + ci (gi + pi) = = gi + ci ti

X + XY = X Absorption law