Download ppt

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
‫מבנה המחשב – מבוא למחשבים ספרתיים‬
‫‪Parallel Prefix Computation‬‬
The PPC Circuit
Fan-out of a PPC Circuit
Upper Bound:
• There is a constant maximum number of splits
per layer.
• There are O(log n) layers.
• Therefore, the total number of splits is O(log n).
Fan-out of a PPC circuit (2)
Lower Bound:
• For simplicity, let us renumber the terminals
beginning with 1 instead of 0.
• Observe that the even numbered outputs are
split once just before the exit.
• Also observe that even numbered outputs of
each circuit come from an internal circuit.
Fan-out of a PPC circuit (3)
• Let us look at the n/2 = 2(log n)-1 output
terminal.
• It will be an Even numbered output
terminal of log(n)–2 circuits in the
recursive construction.
Output Terminal Splitting
log n -1 depth
log n - 2 depth
This is the n/2th = 2(log
n)-1 output terminal of
the full circuit
2 depth
1 depth
Fan-out of a PPC circuit (4)
• Thus, the right most terminal will split
log(n)-2 times and have a fan-out of
log n - 1.
• Since we have shown an example that
achieves the Upper Bound, the Lower
Bound must be equal to the Upper Bound.
Operator *
i  0, j  i.[ j : i ]  1 
 [ j ]  1  [ j  1 : i ]  1 
k  [ j : i ]. [k ]  1 
k  [ j : i ]. A[i ]  B[i ]  1 
A[ j : i ]  B[ j : i ]  1
(2
j 1
 1)  (2  1)  2
i
j i 1 i
j 1
0 
2
i
Operator *
[i : 1]  2 
( [i ]  2)   [i ]  1  [i  1 : 1]  2  
i  1  k  0. [i : i  k ]  1 2 
k
j  0.C[ j ]  1  l  j.C[l ]  C[l  1] 
C[i  1]  1  A[i : 0]  B[i : 0]  C[0]  2
i 1
PPC for Decimal Addition
• Reduction to carry bit computation:
S[i] = mod( A[i]+B[i]+C[i] , 10 )
• This is a constant time reduction since the addition of 3
BCD coded decimal digits can be done in constant time.
• The price is linear since it is a constant price per decimal
digit.
The problem is reduced to the calculation of the carry bits.
Defining the Alphabet
For i=-1:
2·C[0] = 0 or 2
σ[i] =
For i≥0:
0 if A[i]+B[i] < 9 (kill carry)
1 if A[i]+B[i] = 9 (propagate carry)
2 if A[i]+B[i] > 9 (generate carry)
The Operator
• The original * operator is what we need.
• The meaning of the alphabet is the same as the
one used in class:
– 0 = kill carry
– 1 = propagate the carry
– 2 = generate a carry
• Go through the lecture notes and convince
yourselves that it works.
The Circuit
• The carry bits are calculated using the
PPC circuit.
• We then use a BCD adder for each of the
output digits:
S[i]=mod(A[i],B[i],C[i],10)
2’s Complement Overflow
a[n  1]  b[n  1]  c[n  1]  2c[n]  s[n  1] 
a[n  1]  b[n  1]  0  2c[n]  s[n  1]  c[n  1] 
c[n]  0  s[n  1]  c[n  1]
s[n  1]  1  a[n  1]  c[n  1]  1
a[n  1]  b[n  1]  1 
2c[n]  s[n  1]  2  c[n]  1 
s[n  1]  c[n  1]
s[n  1]  0  c[n  1]  0
2’s Complement Overflow
c[n  1]  c[n] 
c[n]  1, c[n  1]  0  a[n  1]  b[n  1]  2 
a[n  1]  b[n  1]  1
s[n  1]  0
c[n]  0, c[n  1]  1 
a[n  1]  b[n  1]  0 
a[n  1]  b[n  1]  0
s[n  1]  c[n  1]  1
Related documents