fast%adders%%...carnegie mellon 4 curseofthecarry % the$most$significant$outputsof$the$adder$...

31
Carnegie Mellon 1 Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak Adapted from Digital Design and Computer Architecture, David Money Harris & Sarah L. Harris ©2007 Elsevier http://www.syssec.ethz.ch/education/Digitaltechnik_14 Fast Adders

Upload: others

Post on 19-Mar-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

1  

Design  of  Digital  Circuits  2014  Srdjan  Capkun  Frank  K.  Gürkaynak  

Adapted  from  Digital  Design  and  Computer  Architecture,  David  Money  Harris  &  Sarah  L.  Harris  ©2007  Elsevier  

http://www.syssec.ethz.ch/education/Digitaltechnik_14  

Fast  Adders    

Page 2: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

2  

In  This  Lecture  ¢  What  slows  down  adders  

§  The  “curse  of  the  carry”  

¢  Fast  adder  principles  

¢  Parallel  Prefix  Adders  §  Graph  representaDon  for  parallel  prefix  adders  §  Some  example  fast  adders  

Page 3: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

3  

Ripple  Carry  Adder  (RCA)  

Page 4: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

4  

Curse  of  the  Carry  The  most  significant  outputs  of  the  adder    depends  on  the  least  significant  inputs  

 

 

 

 

 

 

Page 5: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

5  

Curse  of  the  Carry  The  most  significant  outputs  of  the  adder    depends  on  the  least  significant  inputs  

 

 

 

 

¢  The  carry  has  to  propagate  from  LSB  to  MSB  

¢  Fortunately  these  cases  are  rare  

Page 6: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

6  

Full-­‐Adder  Revisited,  Carry  PropagaHon  Consider  the  path  Ci  to  Co  

Page 7: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

7  

Full-­‐Adder  Revisited,  Carry  PropagaHon  Consider  the  path  Ci  to  Co  

¢  If  A=1  and  B=1  A  carry  is  generated  no  maKer  what  the  value  of  carry  input  (Ci)  is    

Generate  =  G  =  A  &  B  

Page 8: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

8  

Full-­‐Adder  Revisited,  Carry  PropagaHon  Consider  the  path  Ci  to  Co  

¢  If  A=1  and  B=1  A  carry  is  generated  no  maKer  what  the  value  of  carry  input  (Ci)  is    

Generate  =  G  =  A  &  B  

¢  If  only  A=1  or  only  B=1  The  value  of  carry  input  is  propagated  to  the  carry  output    

Propagate  =  P  =  A  ^  B  

Page 9: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

9  

Full-­‐Adder  with  Propagate  and  Generate  The  Full  Adder  funcHonality  can  be  expressed  by  propagate  (P)  and  generate  (G)  signals:      

             G  =  A  &  B    P  =  A  ^  B      S  =  P  ^  Ci  Co  =  G  |  (Ci  &  P)  

AB

Co Ci

S

G P

Page 10: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

10  

Fast  Adder  Architectures  The  speed  of  the  adder  depends  on  how  fast  the  carry  can  be  

propagated  /pre  calculated  

¢  Divide  a  large  adder  into  a  chain  of  small  adders  §  The  criDcal  path  is  extremely  rare  (Carry  Skip)  §  Worst  case  we  need  to  add  one  to  result  (Carry  Increment)  §  There  are  only  two  possible  values  of  carry  (Carry  Select)  §  Calculate  the  carry  in  advance  (Carry  Lookahead)  

Page 11: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

11  

Divide  and  Conquer  

Page 12: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

12  

Carry  Skip  Adder  

Page 13: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

13  

Carry  Skip  Adder  

¢  Pi-­‐1:k  =  0  (not  all  propagate  signals  from  bit  i-­‐1  to  bit  k  are  1),  the  result  of  the  carry  is  generated  within  this  block.  

Page 14: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

14  

Carry  Skip  Adder  

¢  Pi-­‐1:k  =  0  (not  all  propagate  signals  from  bit  i-­‐1  to  bit  k  are  1),  the  result  of  the  carry  is  generated  within  this  block.  

¢  Pi-­‐1:k  =  1,  the  carry  of  the  previous  block  is  propagated  

Page 15: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

15  

Carry  Increment  Adder  

¢  Cin  is  assumed  to  be  0  

¢  When  carry  is  known,  in  the  worst  case  the  output  is  incremented  

 

Page 16: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

16  

Carry  Select  Adder  

¢  Two  parallel  adders,  one  assumes  Cin  0,  the  other  1  

¢  Once  the  previous  stage  decides  on  the  Carry,  the  correct  calculaHon  is  selected.  

Page 17: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

17  

Carry  Lookahead  Adder  ¢  For  each  Si  you  need  to  know  what  is  Cin:i-­‐1.  This  calculaHon  can  

be  made  faster  (than  tradiHonal  ripple  carry  structure)  

 C0  =  Ci  

 C1  =  G0  +  P0Ci  

 C2  =  G1  +  P1G0  +  P1P0Ci  

 C3  =  G2  +  P2G1  +  P2P1G0  +  P2P1P0Ci  

   

Page 18: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

18  

Parallel  Prefix  Adders  Parallel  Prefix  Adders  (PPA)  represent  a  systema>c  approach  to  

designing  op>mized  adders  

¢  Parallel  Prefix  Adders  have  three  stages  §  Pre-­‐Processing  §  Carry  PropagaDon  §  Post-­‐Processing  

¢  Adders  differ  only  in  the  way  the  carry  propagaHon  is  calculated.  Pre  and  post  processing  is  idenHcal  

Page 19: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

19  

Parallel  Prefix  Adders  

Page 20: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

20  

Combined  (P)ropagate  (G)enerate  Signals  (Gi:jk,Pi:jk)    

¢  is  a  combined  Propagate  Generate  signal  covering  the  bit  range  1  to  j  at  the  kth  stage  of  carry  propagaHon.  

¢  The  iniHal  Propagate  Generate  signals  are  wriKen  as:  

(Gi:i0,Pi:i0)    

¢  The  goal  is  to  calculate    

(Gn:0k,Pn:0k)    

 for  all  n  in  any  number  of  k  stages.  

Page 21: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

21  

Parallel  Prefix  OperaHons  

¢  Merge:  Merges  two  adjacent  (P,G)  ranges  

¢  Feedthrough:  Just  copies  the  signals  to  next  stage  

(Gk-1i:j ,Pk-1i:j ) (Gk-1j-1:m,Pk-1j-1:m)

(Gki:m,Pki:m)(Gki:m,Pki:m)

(Gk-1i:j ,Pk-1i:j )

(Gki:j,Pki:j)(Gki:j,Pki:j)

Merge Feedthrough

bits from i to j bits from j-1 to m bits from i to j

bits from i to jbits from i to m

Page 22: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

22  

PPA:  Ripple  Carry  Adder  

Page 23: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

23  

Performance  Parameters  of  PPA  ¢  Number  of  black  dots:  Determines  the  circuit  area,  since  only  

the  merge  operators  contains  real  logic  

¢  Number  of  Stages:  Determines  the  criHcal  path,  the  more  stages,  the  longer  the  criHcal  path  

¢  Maximum  Fan  Out:  How  many  inputs  are  driven  by  a  single  cell,  determines  stage  delay,  the  more  connecHons,  the  higher  the  delay  

Page 24: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

24  

PPA:  Sklansky  

Page 25: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

25  

PPA:  Carry  Increment  Adder  

Page 26: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

26  

PPA:  Brent  Kung  Adder  

Page 27: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

27  

PPA:  Kogge  Stone  

Page 28: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

28  

PPA:  Huan  Carlsson  

Page 29: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

29  

Performance  Comparison  of  Adders  

Page 30: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

30  

Summary  Adders  ¢  RCA  is  a  very  efficient  adder  

§  It  is  the  smallest  and  simplest  adder,  for  small  bit  widths  it  is  not  too  slow  either  

¢  BK  offers  good  compromise  §  TradiDonal  Carry  Lookahead  Adder  is  BK  with  4-­‐bit  groups  

¢  SK  suffers  from  high  fanout  §  In  theory  it  is  very  fast,  high  fanout  slows  it  down  

¢  KS  and  HC  are  very  fast,  but  suffer  from  rouHng  §  The  fastest  adders,  resource  and  rouDng  intensive  

Page 31: Fast%Adders%%...Carnegie Mellon 4 CurseoftheCarry % The$most$significant$outputsof$the$adder$ $dependson$the$least$significant$inputs % % % % % %

Carnegie Mellon

31  

How  are  Adders  Implemented  in  Verilog?  ¢  You  simply  write  

assign    a  =  b  +  c;  

¢  The  synthesizer  will  figure  out  what  to  do  §  Most  synthesizers  have  a  large  library  of  adder  architectures  

§  Depending  on  the  design  constraints,  an  architecture  is  chosen  

¢  FPGA  design  is  slightly  special  §  Most  modern  FPGAs  have  embedded  fast  adders,  these  are  faster  than  

adders  mapped  to  logic.