



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Comp 411 Computer Organization Fall 2007
Problem Set # Issued Thursday, 10/10/06; Due Thursday, 10/17/
Homework Information: Some of the problems are probably too time consuming to be done the night before the due date, so plan accordingly. Late homework will not be accepted. Feel free to get help from others, but the work you hand in should be your own.
Problem 1. Adder Latency
The basic building block used in adder and multiplier circuits is the full adder, a 3-input, 2- output combinational logic circuit we’ve seen before:
A
B
CIN
COUT = A B + CIN(A ⊕ B)
S = A ⊕ B ⊕ CIN
The simplest adder architecture is the ripple-carry adder shown in the following diagram. This adder gets its name from the observation that the carry signal ripples from one full adder to the next.
A 0 B 0 S 0
S 1
S 2
SN-
A 1 B 1
A 2 B 2
AN- BN-
…
CIN
COUT
In the questions below, assume that (1) the tPD for each gate (INVERTER, AND, OR, XOR) is 1 time unit, (2) the XOR gate has only two inputs, and (3) the other multi-input gates (AND, OR) can have at most four inputs.
(A) It’s clear from the schematic for the ripple-carry adder that the longest path involves the propagation of the carries from the least-significant bit (bit 0) to the most-significant bit (bit N-1). Compute tPD for a 20-bit ripple-carry adder and identify the path through the schematic which has this worst-case delay – this path is called the critical path. What values for the inputs would exercise the critical path, i.e., what value for A 0 , …, A 19 , B 0 , …, B 19 and CIN would result in an actual propagation delay that comes closest to tPD?
Since the COUT signals of each full adder are in the critical path, let’s see if we can’t improve the adder’s performance by generating the COUT signals more quickly. First let’s rewrite the equation for COUT:
where G = A B is true if a carry is generated by the full adder and P = A ⊕ B is true if the carry is propagated by the full adder from CIN to COUT. Note that P and G depend only on A and B and not on CIN. We can generalize the notion of P and G to blocks of several bits. For example, consider a two-bit adder:
A 0 B 0 S 0
S 1
A 1 B 1
CIN
COUT
Define the block generate signal G0,1 as G0,1 = G 1 + G 0 P 1 , i.e., the 2-bit block will generate a carry if a carry is generated in bit 1 (G 1 ) or if a carry is generated in bit 0 and propagated by bit 1 (G 0 P 1 ). Similarly we can define the block propagate signal P0,1 as P0,1 = P 0 P 1 , i.e., CIN will be propagated to COUT only if both bits are propagating their carry-ins.
(B) Draw a logic diagram using gates for the block generate signal G0,3 and block propagate signal P0,3 for a 4-bit adder in terms of the generate signals (G 0 , G 1 , G 2 , G 3 ) and propagate signals (P 0 , P 1 , P 2 , P 3 ) for each bit.
(C) Using the block generate and block propagate signals, the carry-out of the 4-bit adder is just COUT = C 3 = G0,3 + P0,3 CIN. Recalling that gates with up to four inputs have a tPD of 1 time unit, how long will it take to compute COUT from A 0 , …, A 3 , B 0 , …, B 3 and CIN if we use G0,3 and P0,3? Compare this to the time would take to compute COUT in a 4-bit ripple carry adder.
(D) Now suppose we built our 20-bit adder using five of the improved 4-bit blocks from part (C). How long will it take compute COUT from A 0 , …, A 19 , B 0 , …, B 19 and CIN? Compare this to the time it would take to compute COUT in a 20-bit ripple carry adder. Hint: the answer isn’t just five times the delay of a 4-bit block!
(E) Adders built using the architecture suggested in part (D) are called carry-skip adders. Briefly explain where the name comes from. Hint: look at your timing analysis from part (D) and think how the carry would propagate from bit 0 to bit 19.
(F) [Hard] There’s no reason that the blocks in a carry-skip adder all have to process the same number of bits. Use this idea to suggest a slightly different carry-skip adder that has improves on the latency of COUT over that of the adder in part (D).
Problem 3. “May Your Carries Overflowith”
In Lecture 10, overflows were defined as the case when either the sum two negative numbers gives a positive result, or the sum of two positive numbers gives negative result. This can be expressed as the following expression:
V = An-1Bn-1Sn-1 + An-1Bn-1Sn+
where An-1, Bn-1 are the inputs to most significant adder, and Sn-1 is the most significant bit’s sum output.
a) An alternative way of computing overflow considers only the carry inputs and outputs of the most significant bit’s adder, and it can be expressed as: V = XOR(Cout, Cin). Prove these two different implementations give identical results. b) Overflows can also be generated by subtraction. In particular, when a negative number subtracted from a positive number yields a negative result, or when a positive number is subtracted from a negative one and a positive result is generated. Compare both of the two given approaches for computing overflows in these cases. Do they work? If so, under what assumptions. If not, explain why. c) We can also define a notion of overflow when adding unsigned numbers. Basically, an overflow occurs when the correct result cannot be represented given the finite representation. What logical combination of the condition codes Z (zero), N (negative), C (carry), and V (overflow) detect this case? d) The distinction between the MIPS’ add and addu instructions is that the “unsigned” version of the instruction ignores overflows (i.e. it takes no special actions when an overflowed result is generated). Does this mean that the addu can be used for signed 2’s- complement arithmetic? Explain why or why not.
Problem #4. “An Adder’s Bite”
Consider the follow two circuits for adding 3, 4-bit numbers (i.e. W = X + Y + Z):
a) Ignoring the speed of the calculation, do both 3-input adder designs compute the same result? If not, how do they differ? b) Assume a unit delay for each full-adder (i.e. the output will become valid one time unit after all inputs are valid). Which design computes all bits of the sum fastest? Which design computes the first (least-significant) bit fastest? c) Obviously, design #1 uses one more adder than design #2. Explain how design #1 can be modified slightly to use one fewer full-adder. After this change, which design computes all bits of its sum fastest? d) Both designs could be improved by incorporating carry-lookahead logic in place of their carry-propagation chains. Which design would requires less logic to implement carry lookahead? Explain. e) Modify both designs to support the following operations: W = X + Y + Z or W = X – Y – Z, based on the value of a control signal (CTRL).
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
0 Z3 Z2 Z1 Z
X3 Y3 X2 Y2 X1 Y1 X0 Y
W5 W4 W3 W2 W1 W
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
0
0
0
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
A B Co FA Ci S
X3 Y3 Z3 X2 Y2 Z3 X Y1 Z1 X0 Y0 Z
W5 W4 W3 W2 W1 W
0