## 2.6.1   Datapath Elements

Figure 2.21 shows some typical datapath symbols for an adder (people rarely use the IEEE standards in ASIC datapath libraries). I use heavy lines (they are 1.5 point wide) with a stroke to denote a data bus (that flows in the horizontal direction in a datapath), and regular lines (0.5 point) to denote the control signals (that flow vertically in a datapath). At the risk of adding confusion where there is none, this stroke to indicate a data bus has nothing to do with mixed-logic conventions. For a bus, A[31:0] denotes a 32-bit bus with A as the leftmost or most-significant bit or MSB , and A as the least-significant bit or LSB . Sometimes we shall use A[MSB] or A[LSB] to refer to these bits. Notice that if we have an n -bit bus and LSB = 0, then MSB =  n   1. Also, for example, A is the fifth bit on the bus (from the LSB). We use a ' S ' or 'ADD' inside the symbol to denote an adder instead of '+', so we can attach '' or '+/' to the inputs for a subtracter or adder/subtracter. FIGURE 2.21  Symbols for a datapath adder. (a) A data bus is shown by a heavy line (1.5 point) and a bus symbol. If the bus is n -bits wide then MSB =  n  – 1. (b) An alternative symbol for an adder. (c) Control signals are shown as lightweight (0.5 point) lines.

Some schematic datapath symbols include only data signals and omit the control signalsbut we must not forget them. In Figure 2.21, for example, we may need to explicitly tie CIN to VSS and use COUT[MSB] and COUT[MSB  1] to detect overflow. Why might we need both of these control signals? Table 2.11 shows the process of simple arithmetic for the different binary number representations, including unsigned, signed magnitude, ones' complement, and two's complement.

 TABLE 2.11    Binary arithmetic. Operation Binary Number Representation Unsigned Signed magnitude Ones' complement Two's complement no change if positive then MSB = 0 else MSB = 1 if negative then flip bits if negative then {flip bits; add 1} 3 = 0011 0011 0011 0011 3 = NA 1011 1100 1101 zero = 0000 0000 or 1000 1111 or 0000 0000 max. positive = 1111 = 15 0111 = 7 0111 = 7 0111 = 7 max. negative = 0000  = 0 1111 = 7 1000 = 7 1000 = 8 addition = S =  A + B = addend + augend   SG(A) = sign of A S = A + B if SG(A) = SG(B) then S = A + B else { if B < A then S = A  B else S = B  A} S =  A + B + COUT[MSB]   COUT is carry out S = A + B addition result: OV = overflow, OR = out of range OR = COUT[MSB]   COUT is carry out if SG(A) = SG(B) then OV = COUT[MSB] else OV = 0 (impossible) OV =  XOR(COUT[MSB], COUT[MSB1]) OV =  XOR(COUT[MSB], COUT[MSB  1]) SG(S) = sign of S    S =  A + B NA if SG(A) = SG(B) then SG(S) = SG(A) else { if B < A then SG(S) = SG(A) else SG(S) = SG(B)} NA NA subtraction = D =  A  B = minuend   subtrahend D = A  B SG(B) = NOT(SG(B)); D = A + B Z = B (negate); D = A + Z Z = B (negate); D = A + Z subtraction result : OV = overflow, OR = out of range OR = BOUT[MSB] BOUT is borrow out as in addition as in addition as in addition negation : Z = A (negate) NA Z = A; SG(Z) = NOT(SG(A)) Z = NOT(A) Z = NOT(A) + 1