Chapter start ] [ Previous page ] [ Next page ]

Portions from Application-Specific Integrated Circuits Copyright © 1997 by Addison Wesley Longman, Inc.

2.6 Datapath Logic Cells

Suppose we wish to build an n -bit adder (that adds two n -bit numbers) and to exploit the regularity of this function in the layout. We can do so using a datapath structure.

The following two functions, SUM and COUT, implement the sum and carry out for a full adder ( FA ) with two data inputs (A, B) and a carry in, CIN:  

SUM = A B CIN = SUM(A, B, CIN) = PARITY(A, B, CIN) ,

(2.38)

 

 

COUT = A · B + A · CIN + B · CIN = MAJ(A, B, CIN).

(2.39)

The sum uses the parity function ('1' if there are an odd numbers of '1's in the inputs). The carry out, COUT, uses the 2-of-3 majority function ('1' if the majority of the inputs are '1'). We can combine these two functions in a single FA logic cell, ADD(A[ i ], B[ i ], CIN, S[ i ], COUT), shown in Figure 2.20(a), where  

S[ i ] = SUM (A[ i ], B[ i ], CIN) ,

(2.40)

 

 

COUT = MAJ (A[ i ], B[ i ], CIN) .

(2.41)

Now we can build a 4-bit ripple-carry adder ( RCA ) by connecting four of these ADD cells together as shown in Figure 2.20(b). The i th ADD cell is arranged with the following: two bus inputs A[ i ], B[ i ]; one bus output S[ i ]; an input, CIN, that is the carry in from stage ( i – 1) below and is also passed up to the cell above as an output; and an output, COUT, that is the carry out to stage ( i + 1) above. In the 4-bit adder shown in Figure 2.20(b) we connect the carry input, CIN[0], to VSS and use COUT[3] and COUT[2] to indicate arithmetic overflow (in Section 2.6.1 we shall see why we may need both signals). Notice that we build the ADD cell so that COUT[2] is available at the top of the datapath when we need it.

Figure 2.20(c) shows a layout of the ADD cell. The A inputs, B inputs, and S outputs all use m1 interconnect running in the horizontal direction—we call these data signals. Other signals can enter or exit from the top or bottom and run vertically across the datapath in m2—we call these control signals. We can also use m1 for control and m2 for data, but we normally do not mix these approaches in the same structure. Control signals are typically clocks and other signals common to elements. For example, in Figure 2.20(c) the carry signals, CIN and COUT, run vertically in m2 between cells. To build a 4-bit adder we stack four ADD cells creating the array structure shown in Figure 2.20(d). In this case the A and B data bus inputs enter from the left and bus S, the sum, exits at the right, but we can connect A, B, and S to either side if we want.

The layout of buswide logic that operates on data signals in this fashion is called a datapath . The module ADD is a datapath cell or datapath element . Just as we do for standard cells we make all the datapath cells in a library the same height so we can abut other datapath cells on either side of the adder to create a more complex datapath. When people talk about a datapath they always assume that it is oriented so that increasing the size in bits makes the datapath grow in height, upwards in the vertical direction, and adding different datapath elements to increase the function makes the datapath grow in width, in the horizontal direction—but we can rotate and position a completed datapath in any direction we want on a chip.

 

FIGURE 2.20 A datapath adder. (a) A full-adder (FA) cell with inputs (A and B), a carry in, CIN, sum output, S, and carry out, COUT. (b) A 4-bit adder. (c) The layout, using two-level metal, with data in m1 and control in m2. In this example the wiring is completed outside the cell; it is also possible to design the datapath cells to contain the wiring. Using three levels of metal, it is possible to wire over the top of the datapath cells. (d) The datapath layout.

What is the difference between using a datapath, standard cells, or gate arrays? Cells are placed together in rows on a CBIC or an MGA, but there is no generally no regularity to the arrangement of the cells within the rows—we let software arrange the cells and complete the interconnect. Datapath layout automatically takes care of most of the interconnect between the cells with the following advantages:

There are some disadvantages of using a datapath:

There are some newer standard-cell and gate-array tools that can take advantage of regularity in a design and position cells carefully. The problem is in finding the regularity if it is not specified. Using a datapath is one way to specify regularity to ASIC design tools.

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[31] as the leftmost or most-significant bit or MSB , and A[0] 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[4] 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 signals—but we must not forget them. In Figure 2.21, for example, we may need to explicitly tie CIN[0] 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[MSB–1])

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

2.6.2 Adders

We can view addition in terms of generate , G[ i ], and propagate , P[ i ], signals.

method 1

method 2

 

G[i] = A[i] · B[i]

G[ i ] = A[ i ] · B[ i ]

(2.42)

P[ i ] = A[ i ] B[ i

P[ i ] = A[ i ] + B[ i ]

(2.43)

C[ i ] = G[ i ] + P[ i ] · C[ i –1]

C[ i ] = G[ i ] + P[ i ] · C[ i –1]

(2.44)

S[ i ] = P[ i ] C[ i –1]

S[ i ] = A[ i ] B[ i ] C[ i –1]

(2.45)

where C[ i ] is the carry-out signal from stage i , equal to the carry in of stage ( i + 1). Thus, C[ i ] = COUT[ i ] = CIN[ i + 1]. We need to be careful because C[0] might represent either the carry in or the carry out of the LSB stage. For an adder we set the carry in to the first stage (stage zero), C[–1] or CIN[0], to '0'. Some people use delete (D) or kill (K) in various ways for the complements of G[i] and P[i], but unfortunately others use C for COUT and D for CIN—so I avoid using any of these. Do not confuse the two different methods (both of which are used) in Eqs.  2.42–2.45 when forming the sum, since the propagate signal, P[ i ] , is different for each method.

Figure 2.22(a) shows a conventional RCA. The delay of an n -bit RCA is proportional to n and is limited by the propagation of the carry signal through all of the stages. We can reduce delay by using pairs of “go-faster” bubbles to change AND and OR gates to fast two-input NAND gates as shown in Figure 2.22(a). Alternatively, we can write the equations for the carry signal in two different ways: