מבנה המחשב +מבוא למחשבים ספרתיים תרגול #7 Addition Definition of a binary adder A binary adder with input length n is a combinational circuit specified as follows: Input : An - 1 : 0, Bn - 1 : 0 0,1 , and C[0] 0,1. n Output : Sn - 1 : 0 0,1 and C[n] 0,1. n Functional ity : n S 2 Cn A B C0 Claim: the functionality of Adder(n) is well defined. We show that for every A[n-1:0], B[n-1:0] and C[0] there exists S[n-1:0] and C[n] such that: n S 2 C n A B C 0 An 1 : 0 0,1 An 1 : 0 0,1, ,2 n 1 Bn 1 : 0 0,1 Bn 1 : 0 0,1, ,2 n 1 n n C 0 0,1 A B C0 0,1,,2 n 1 1 S n 1 : 0 0,1,,2 n 1 S n 1 : 0 0,1 n C n 0,1 if C n 0, then S 2n 0 0,1,,2 if C n 1, then S 2 n 1 0 2 ,1 2 ,,2 S 2n Cn n n 1 n n 1 2n 0,1,,2 1,2 ,2 1,,2 0,1,,2 1 n n n 1 n n 1 1 Lower bounds on the cost and delay of combinational circuits that implements Adder(n) We would like to show a lower bound of linear cost and logarithmic delay in n. It’s suffices to show that there exists at least one output, σ, of Adder(n) such that |cone(σ)| = n with respect to Adder(n) . We show that the cone size of the carry-out bit C[n] is 2n+1. Input bit A[i] , 0 ≤ i ≤ n-1, is in the cone of C[n]: Set A[n-1:i+1] = 0n-i-1, A[i-1:0] = 0i , B[n-1:0] = 1n , and C[0] = 0. If A[i] = 0, then A B C 0 0 2 n 1 0 2 n 1 Necessarily C[n] = 0, otherwise S 2 n C n 2 n 1 a contradiction. If A[i] = 1, then A B C 0 2 i 2 n 1 0 2 n Necessarily C[n] = 1, otherwise S 2 n C n 2 n 1 a contradiction. By symmetry, every bit in the string B[n-1:0] is also in the cone of C[n]. The carry-in bit C[0] is like A[0], therefore C[0] is also in the cone of C[n]. ConeCnwith respect to Adder(n) An 1 : 0, Bn 1 : 0, C0 Cost Adder n n Delay Addern log n Note that the same setting also proves: 0 j n 1. ConeC j 1 ConeS j A j : 0, B j : 0, C0 Conditional Sum Adder – CSA(n) Correctness Proof The proof is by induction on n. The induction basis, for n = 1, follows directly from the definition of a Full-Adder. The induction hypothesis, for m < n, is: Am 1 : 0 Bm 1 : 0 C 0 2 m C m S m 1 : 0 Induction step, we prove for n: hypothesis induction (1) Ak 1 : 0 Bk 1 : 0 C 0 2 k C k S k 1 : 0 hypothesis induction (2a) An 1 : k Bn 1 : k C0 n S0 n 1: k (2b) An 1 : k Bn 1 : k 2k C1n S1n 1: k If Ck 0 , then Sn - 1 : k S0 n - 1 : k and Cn C0 n (1) (2a) Ak 1 : 0 Bk 1 : 0 C0 An 1 : k Bn 1 : k 2 k 0 S k 1 : 0 2 n C0 n S 0 n 1 : k An 1 : 0 Bn 1 : 0 C 0 2 n C n S n 1 : 0 If Ck 1 , then Sn -1 : k S1n -1 : k and Cn C1n (1) (2b) Ak 1 : 0 Bk 1 : 0 C 0 An 1 : k Bn 1 : k 2 k 1 2 k 1 S k 1 : 0 2 n C1 n S1 n 1 : k An 1 : 0 Bn 1 : 0 C 0 2 n C n S n 1 : 0 QED CSA(n) - Delay and Cost analysis under fan-out limitations n–k+1 1 Assume that n = 2l and set k = n/2, if n 1 d FA d CSAn n n d CSA 2 log 2 d buf d MUX otherwise if n 1 c FA cCSAn n n 3 cCSA 2 n cbuf 2 1 cMUX otherwise n 2l , for simplicity : d FA d MUX d buf 1 d n d n2 log n2 1 d n2 logn log2 1 d n2 logn d 1 logn log n2 log n4 log2ni log2nl 1 l l 1 1 0 l 2 log 2 n cn 3 c n2 n2 1 cMUX n cbuf cn 3 c n2 n Master Theorem for recurrences provides: cn n log 2 3 n1.58 We didn’t take into account the fan-out of the input gates. Is it justified in the case of CSA(n)? Cost: Note that all input gates feed Full-Adder circuits only. How much FAs are there in CSA(n)? f n 3 f n2 3log 2 n n log 2 3 n1.58 The fan-out of all input gates together is Θ(n1.58). The total cost needed for buffers is Θ(n1.58). Delay: The MSBs A[n-1] and B[n-1] have the maximum fan-out. fan out An 1 fan out Bn 1 2log2 n The input gates’ fan-out in the case of CLA(n) is counted only once and it is at most: log 2 n log2 log n 2 To conclude, in CSA(n) design: • No change in cost asymptotics due to fan-out limitations. • Quadratic increase in delay asymptotics due to fan-out limitations.
© Copyright 2026 Paperzz