Spring 2015 Week 9 Module 51 Digital Circuits and Systems Fast Adder Shankar Balachandran* Associate Professor, CSE Department Indian Institute of Technology Madras *Currently a Visiting Professor at IIT Bombay
Recursive Doubling Technique From previous stages if any; To find the prefix sum of 8 numbers : This input is assumed to be stable; 8 7 6 5 4 3 2 1 0 27 0 -15 6 -8 7 3 -2 1 Request Data From Next step will have : 8,7 7,6 6,5 5,4 4,3 3,2 2,1 1,0 0
Step 2 8 7 6 5 4 3 2 1 0 0 12 -9 -2 -1 10 1 -1 1 Next step will have : 8,7,6,5 7,6,5,4 6,5,4,3 5,4,3,2 4,3,2,1 3,2,1,0 2,1,0 1,0 0
Step 3 8 7 6 5 4 3 2 1 0 10 -10 8 0 9 2 -1 1 0 Next step will have : 8->1 7->0 6->0 5->0 4->0 3,2,1,0 2,1,0 1,0 0
Step 4 0 19 -8 7 1 9 2 -1 1 Next step will have : 8->0 7->0 6->0 5->0 4->0 3,2,1,0 2,1,0 1,0 0
Summary Prefix Sum of n numbers in log n steps Applicable for any semigroup operator like min , max , add, mul etc. that is associative Reading Assignment : Change the last stage input 0 to 5 and start from Step 1. Check if you get 24 -3 12 6 14 7 4 6
To Learn High speed Addition as a circuit
n-bit Carry Ripple Addition B(n-1) A(n-1) B(2) A(2) B(1) A(1) B(0) A(0) C(n-2) C(0) FA(2) FA(n-1) FA(1) FA(0) C(n) C(3) C(2) C(1) S(n-1) S(1) S(2) S(0) Requires n steps in the worst case.
There’s Something About Carry a(j) b(j) c(j) c(j+1) 0 0 0 0 0 0 1 0 If a(j) = b(j) then 0 1 0 0 c(j+1) = a(j) = b(j) 0 1 1 1 1 0 0 0 If a(j) != b(j) then 1 0 1 1 c(j+1) = c(j) 1 1 0 1 1 1 1 1
Carry Look Ahead – Generate and Propagate a(j) b(j) c(j+1) Status ( x(j+1) ) 0 0 0 Kill ( k ) 0 1 c(j) Propagate ( p ) 1 0 c(j) Propagate ( p ) 1 1 1 Generate ( g )
CLA – Operation (*) x(j+1) (*) k p g New (j+1)th carry status k k k g as influenced by x(j) x(j) p k p g (*) is associative g k g g y(j) = x(0) (*) x(1) (*) … x(j) x(0) = k If y(j) = k then c(j) = 0 If y(j) = g then c(j) = 1 Note that y(j) != p
Carry Calculation A prefix computation y(0) = x(0) = k y(1) = x(0) (*) x(1) y(2) = x(0) (*) x(1) (*) x(2) ……. y(n) = x(0) (*) x(1) (*) …. x(n)
An 8-node Carry Look Ahead Adder
Parallel Prefix circuit • Input x(1), … x(n) – for an n-bit CLA • Let x(0) = k if there is no carry in • If carry is available x(0) = g • Each x(i) is a 2-bit vector • We use the Recursive Doubling Technique described earlier
Example • Add two binary numbers 1 0 1 0 1 1 0 1 0 1 1 1 0 1 Expected 1 0 1 1 0 0 1 1
Example • Generate sums in parallel 1 0 1 0 1 1 0 1 0 1 1 1 0 1 Expected 1 0 1 1 0 0 1 1 Sum 0 0 0 1 0 1 1 Ignore carries for now
Example • Generate carries in parallel 1 0 1 0 1 1 0 1 0 1 1 1 0 1 Expected 1 0 1 1 0 0 1 1 Sum 0 0 0 1 0 1 1 Carry 1 0 1 0 1 0 0 Generate carries in parallel
Example • Add sum and carry now (ignoring any carries that are generated in this process 1 0 1 0 1 1 0 1 0 1 1 1 0 1 Expected 1 0 1 1 0 0 1 1 Sum 0 0 0 1 0 1 1 Carry 1 0 1 0 1 0 0 Wrong in this position Add 1 0 1 0 0 0 1 1
Prefix Idea for Carry • Generate sum in parallel – keep aside • Generate k, p or g also in parallel • Do parallel prefix carry computation
7-Bit Carry Generation 1 0 1 0 1 1 0 Stable 1 0 1 1 1 0 1 Carry In g k g p g p p k (Decimal example in first few slides is for 8 nodes, this example is for 7 bits )
7-Bit Carry Generation Stable Carry In g k g p g p p k g k g g g p k g k g g g k k g k g g g k k
Finally assign bits Stable Carry In g k g p g p p k g k g g g p k g k g g g k k g k g g g k k 1 0 1 1 1 0 0
Getting back to addition • Add sum and carry now (ignoring any carries that are generated in this process) 1 0 1 0 1 1 0 1 0 1 1 1 0 1 Expected 1 0 1 1 0 0 1 1 Sum 0 0 0 1 0 1 1 Carry 1 0 1 1 1 0 0 Ignore carries now Add 1 0 1 1 0 0 1 1
End of Week 9: Module 51 Thank You Fast Adders 24
Recommend
More recommend