Hardware Implementation of Algorithms Adders

Post on 12-Jan-2016

66 views 2 download

description

Hardware Implementation of Algorithms Adders. Ernest Jamro, Dep. Of Electronics, AGH, Poland. References. Omondi A.R Computer Arithmetic Systems. Algorithms Architecture and Implementations, Prentice Hall 1994. - PowerPoint PPT Presentation

Transcript of Hardware Implementation of Algorithms Adders

1

Hardware Implementation of Algorithms

Adders

Ernest Jamro, Dep. Of Electronics, AGH, Poland

2

References

• Omondi A.R Computer Arithmetic Systems. Algorithms Architecture and Implementations, Prentice Hall 1994.

• Pirsch P., Architectures for Digital Signal Processing, Chichester UK, Wiley 1998.

• U.Mayer-Baese Digital Signal Processing with Field Programmable Gate Arrays, Springer, Berlin 2001

• Keshab K. Parhi VLSI Digital Signal Processing Systems, J.Wiley & sons, 1999

• Kazimierz Wiatr Akceleracja Obliczeń w systemach wizyjnych, WNT, W-wa 2003

• E. Jamro, K. Wiatr, Układy mnożące przez stały współczynnik implementowane w układach programowalnych FPGA, http://home.agh.edu.pl/~jamro/2001KCM_pl.pdf

• www.xilinx.com

• www.altera.com

3

Układ dodający ze szeregową propagacją przeniesienia Ripple Carry Adder

HA Half Adder Pół Sumator

a0 b0

FA Full Adder Sumator

FA Full Adder Sumator

FA Full Adder Sumator

a1 b1 a2 b2 a3 b3

s0

c0

s1

c1

s2

c3

s3

ci-1\ai,bi 00 01 11 10

0 0 1 0 1

1 1 0 1 0

ci-1\ai,bi 00 01 11 10

0 0 0 1 0

1 0 1 1 1

si

ci

ai + bi+ci-1 = si + 2·ci

si = ai bi ci-1

ci= ai bi + ai ci-1 + bi ci-1= ai bi + ci-1 (ai bi)

0

11

iii

iiii baifa

baifcc

00

11

11

ii

ii

iii

i

baif

baif

baifc

c

4

Odejmowanie / Subtraction (A-B)

ci-1\ai,bi 00 01 11 10

0 0 1 0 1

1 1 0 1 0

ci-1\ai,bi 00 01 11 10

0 0 1 0 0

1 1 1 1 0

si

ci

ai - bi-ci-1 = si - 2·ci

si = ai bi ci-1

na czerwono różnica pomiędzy dodawaniemRed – difference between addition and subtruction

iiiiiii bcacbac 11

Kod uzupełnień do dwóch U2

Two’s Complement

1221

0

N

ii

iN

N bbbb

bit znaku

sign bit

negacja każdego bitu

Invert each bit

Odejmowanie bezpośrednie

Direct SubtructionAdd 1 to LSB

Zamiast odejmowania należy dokonać konwersji do kodu U2 liczby b oraz przeprowadzić zwykłą operację dodawania a+b’

Instead of performing a direct subtraction; a standard adder can be employed but B must be converted to 2’s complement code

5

Ripple Carry Adders in FPGAs

si= ai bi ci-1

Fragment of Virtex Configurable Logic Block (CLB)

0

11

iii

iiii baifa

baifcc

6

Carry Skip Adder (CSA)(sumator z przeskokiem przeniesień)

Tn= An + Bn (lub / or) Tn= An xor Bn

0

11

iii

iiii baifa

baifcc

7

Carry Skip Adder

Koszt (Area – A)

m- wielkość bitowa pojedynczego bloku

(width of a block)

Szybkość (propagation time - T)

AT= 1/Wydajność (efficiency)

8

Carry Select Adder

9

Altera Carry Select AdderApex, Cyclon

10

Porównanie układów dodających o szerokości Comparison of Different Adders Architectures

16 bitUkład / Architecture Opóźnienie

Propagation delayKosztArea

(AT)[104]

Carry Look Ahead 4 7392 2.94

Ripple CLA (m=4) 10 336 0.34

carry select (m=4) 6 992 0.6

carry skip 15 240 0.36

2-level carry skip 12 300 0.36

Ripple Carry 31 224 0.69

Układ /Architecture Opóźnienie Koszt (AT) [104]

Carry Look Ahead 4 50624 20.25

Ripple CLA (m=4) 34 1334 4.57

carry select (m=4) 6 2688 1.61

carry skip 29 960 2.50

2-level carry skip 28 1140 3.19

Ripple Carry 127 896 11.38

64 bity

11

HA Half Adder Pół Sumator

a0 b0

FA Full Adder Sumator

FA Full Adder Sumator

FA Full Adder Sumator

a1 b1 a2 b2 a3 b3

c0 c1 c2

HA Half Adder Pół Sumator

FA Full Adder Sumator

FA Full Adder Sumator

FA Full Adder Sumator

c3

s0 s2 s3 s1

Dodawanie 3-wejściowe z propagacją przeniesienia3+ input Carry Propagate Adder (CPA)

CPA

CPA

A B C

CPA – układ dodający np. ze skrośną propagacją przeniesienia (Ripple Carry), Carry Look Ahead, Carry Select Adder

S= A + B + C

Example of Ripple Carry Adder

12

Dodawanie 3-wejściowe / Addition 3 InputsZachowywanie przeniesienia.

Carry Save Adder (CSA)

FA Full Adder Sumator

a0 b0

FA Full Adder Sumator

FA Full Adder Sumator

FA Full Adder Sumator

a1 b1 a2 b2 a3 b3

t1 t2 t3 t4

c3 c2 c1 c0

s3 s2 s1 s0

A+B+C= 2 ·T + S

ai + bi+ci = 2·ti+1 + si

si = ai bi ci

ti+1= ai bi + ai ci + bi ci= ai bi + ci (ai bi)

Nie ma propagacji przeniesieniaBardzo szybki układ dodający przy powierzchni podobnej jak Ripple-Carry Adder

CSA

A B

T

C

S

13

CSA – 3+ inputs

CSA

A B

T

C

S

CPA

3-inputs 4-inputs 6-inputs

CSA

A B C

CSA

D

CPA

CSA

A B C

CSA

CSA

CSA

D E F

CPA

In FPGA dedicated carry logic is available therefore CSA is not so popular as in ASIC technology

14

Materiały dodatkowe

15

Manchester Adder

ci-1

aibi

0

1 aibi

aibi

ci

00

11

11

ii

ii

iii

i

baif

baif

baifc

c

16

Superblock of carry-skip adder

17

Superblock of carry-skip adderCzas propagacji

18

Carry Lookahead Adder

Si = Ai Bi Ci-1

Ci= Ai Bi + Ai Ci-1 + Bi Ci-1= Ai Bi + Ci-1 (Ai Bi) 

Gi= Ai Bi – Generate - Propagate

Pi= AiBi - Propagate bo: - Generate 

Si= Pi Ci-1

Ci= Gi + Pi Ci-1

 

S0= P0 C-1

C0= G0 + P0 C-1

S1= P1 C0

C1= G1 + P1 C0= G1 + P1(G0 + P0 C-1)= G1 + P1G0 + P1P0C-1

S2 = P2 C1

C2= G2 + P2 C1= G2 + P2G1 + P2P1G0 + P2P1P0C-1

0

11

iii

iiii baifa

baifcc

19

Carry-lookahead adderSumator z antycypacją przeniesień

20

Ripple Carry-Lookahead Adder

21

RCLA koszt i szybkość

Koszt A Czas prop. T

AT= 1/Wydajność