📄 ch02.6.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML EXPERIMENTAL 970324//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Adobe FrameMaker 5.5/HTML Export Filter">
<TITLE> 2.6 Datapath Logic Cells</TITLE></HEAD><!--#include file="top.html"--><!--#include file="header.html"-->
<DIV>
<P>[ <A HREF="CH02.htm">Chapter start</A> ] [ <A HREF="CH02.5.htm">Previous page</A> ] [ <A HREF="CH02.7.htm">Next page</A> ]</P><!--#include file="AmazonAsic.html"--><HR></DIV>
<H1 CLASS="Heading1">
<A NAME="pgfId=83860">
</A>
2.6 Datapath Logic Cells</H1>
<P CLASS="BodyAfterHead">
<A NAME="pgfId=88254">
</A>
Suppose we wish to build an <SPAN CLASS="EmphasisPrefix">
n</SPAN>
-bit adder (that adds two <SPAN CLASS="EmphasisPrefix">
n</SPAN>
-bit numbers) and to exploit the regularity of this function in the layout. We can do so using a datapath structure.</P>
<P CLASS="Body">
<A NAME="pgfId=142353">
</A>
The following two functions, SUM and COUT, implement the sum and carry out for a <SPAN CLASS="Definition">
full adder</SPAN>
(<SPAN CLASS="Definition">
FA</SPAN>
) with two data inputs (A, B) and a carry in, CIN: </P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableEqnLeft">
<A NAME="pgfId=380351">
</A>
SUM = A <SPAN CLASS="Symbol">
⊕</SPAN>
B <SPAN CLASS="Symbol">
⊕</SPAN>
CIN = SUM(A, B, CIN) = PARITY(A, B, CIN) ,</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableEqnNumber">
<A NAME="pgfId=380353">
</A>
(2.38)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="EquationAlign">
<A NAME="pgfId=380355">
</A>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableEqn">
<A NAME="pgfId=380357">
</A>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableEqnLeft">
<A NAME="pgfId=380359">
</A>
COUT = A · B + A · CIN + B · CIN = MAJ(A, B, CIN).</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableEqnNumber">
<A NAME="pgfId=380361">
</A>
(2.39)</P>
</TD>
</TR>
</TABLE>
<P CLASS="BodyAfterHead">
<A NAME="pgfId=99872">
</A>
The sum uses the <SPAN CLASS="Definition">
parity function</SPAN>
('1' if there are an odd numbers of '1's in the inputs). The carry out, COUT, uses the 2-of-3 <SPAN CLASS="Definition">
majority function</SPAN>
('1' if the majority of the inputs are '1'). We can combine these two functions in a single FA logic cell, ADD(A[<SPAN CLASS="EquationVariables">
i</SPAN>
], B[<SPAN CLASS="EquationVariables">
i</SPAN>
], CIN, S[<SPAN CLASS="EquationVariables">
i</SPAN>
], COUT), shown in Figure 2.20(a), where </P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableEqnLeft">
<A NAME="pgfId=380377">
</A>
S[<SPAN CLASS="EquationVariables">
i</SPAN>
] = SUM (A[<SPAN CLASS="EquationVariables">
i</SPAN>
], B[<SPAN CLASS="EquationVariables">
i</SPAN>
], CIN) ,</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableEqnNumber">
<A NAME="pgfId=380379">
</A>
(2.40)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="EquationAlign">
<A NAME="pgfId=380381">
</A>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableEqn">
<A NAME="pgfId=380383">
</A>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableEqnLeft">
<A NAME="pgfId=380385">
</A>
COUT = MAJ (A[<SPAN CLASS="EquationVariables">
i</SPAN>
], B[<SPAN CLASS="EquationVariables">
i</SPAN>
], CIN) .</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableEqnNumber">
<A NAME="pgfId=380387">
</A>
(2.41)</P>
</TD>
</TR>
</TABLE>
<P CLASS="Body">
<A NAME="pgfId=105349">
</A>
Now we can build a 4-bit <SPAN CLASS="Definition">
ripple-carry adder</SPAN>
(<SPAN CLASS="Definition">
RCA</SPAN>
) by connecting four of these ADD cells together as shown in Figure 2.20(b). The <SPAN CLASS="EquationVariables">
i </SPAN>
th ADD cell is arranged with the following: two bus inputs A[<SPAN CLASS="EquationVariables">
i</SPAN>
], B[<SPAN CLASS="EquationVariables">
i</SPAN>
]; one bus output S[<SPAN CLASS="EquationVariables">
i</SPAN>
]; an input, CIN, that is the carry in from stage (<SPAN CLASS="EquationVariables">
i</SPAN>
– 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 (<SPAN CLASS="EquationVariables">
i</SPAN>
+ 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.</P>
<P CLASS="Body">
<A NAME="pgfId=87115">
</A>
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 <SPAN CLASS="Definition">
data</SPAN>
signals. Other signals can enter or exit from the top or bottom and run vertically across the datapath in m2—we call these <SPAN CLASS="Definition">
control</SPAN>
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.</P>
<P CLASS="Body">
<A NAME="pgfId=87469">
</A>
The layout of buswide logic that operates on data signals in this fashion is called a <SPAN CLASS="Definition">
datapath</SPAN>
. The module ADD is a <SPAN CLASS="Definition">
datapath cell</SPAN>
or <SPAN CLASS="Definition">
datapath element</SPAN>
. 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. </P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableFigure">
<A NAME="pgfId=87029">
</A>
</P>
<DIV>
<IMG SRC="CH02-32.gif">
</DIV>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableFigureTitle">
<A NAME="pgfId=87032">
</A>
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.</P>
</TD>
</TR>
</TABLE>
<P CLASS="Body">
<A NAME="pgfId=85578">
</A>
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:</P>
<UL>
<LI CLASS="BulletFirst">
<A NAME="pgfId=88273">
</A>
Regular layout produces predictable and equal delay for each bit.</LI>
<LI CLASS="BulletLast">
<A NAME="pgfId=88274">
</A>
Interconnect between cells can be built into each cell.</LI>
</UL>
<P CLASS="Body">
<A NAME="pgfId=88276">
</A>
There are some disadvantages of using a datapath:</P>
<UL>
<LI CLASS="BulletFirst">
<A NAME="pgfId=88277">
</A>
The overhead (buffering and routing the control signals, for example) can make a narrow (small number of bits) datapath larger and slower than a standard-cell (or even gate-array) implementation.</LI>
<LI CLASS="BulletList">
<A NAME="pgfId=88278">
</A>
Datapath cells have to be predesigned (otherwise we are using full-custom design) for use in a wide range of datapath sizes. Datapath cell design can be harder than designing gate-array macros or standard cells.</LI>
<LI CLASS="BulletLast">
<A NAME="pgfId=88279">
</A>
Software to assemble a datapath is more complex and not as widely used as software for assembling standard cells or gate arrays.</LI>
</UL>
<P CLASS="Body">
<A NAME="pgfId=142366">
</A>
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.</P>
<DIV>
<H3 CLASS="Heading2">
<A NAME="pgfId=83863">
</A>
2.6.1 Datapath Elements</H3>
<P CLASS="BodyAfterHead">
<A NAME="pgfId=129197">
</A>
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 <SPAN CLASS="Definition">
most-significant bit</SPAN>
or <SPAN CLASS="Definition">
MSB</SPAN>
, and A[0] as the <SPAN CLASS="Definition">
least-significant bit</SPAN>
or <SPAN CLASS="Definition">
LSB</SPAN>
. Sometimes we shall use A[MSB] or A[LSB] to refer to these bits. Notice that if we have an <SPAN CLASS="EquationVariables">
n</SPAN>
-bit bus and LSB = 0, then MSB = <SPAN CLASS="EquationVariables">
n</SPAN>
– 1. Also, for example, A[4] is the fifth bit on the bus (from the LSB). We use a '<SPAN CLASS="Symbol">
S</SPAN>
' 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.</P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableFigure">
<A NAME="pgfId=162514">
</A>
</P>
<DIV>
<IMG SRC="CH02-33.gif">
</DIV>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableFigureTitle">
<A NAME="pgfId=162517">
</A>
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 <SPAN CLASS="EmphasisPrefix">
n</SPAN>
-bits wide then MSB = <SPAN CLASS="EquationVariables">
n</SPAN>
– 1. (b) An alternative symbol for an adder. (c) Control signals are shown as lightweight (0.5 point) lines.</P>
</TD>
</TR>
</TABLE>
<P CLASS="Body">
<A NAME="pgfId=162204">
</A>
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.</P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="5">
<P CLASS="TableTitle">
<A NAME="pgfId=162232">
</A>
TABLE 2.11 Binary arithmetic.</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="2" COLSPAN="1">
<P CLASS="TableFirst">
<A NAME="pgfId=162242">
</A>
<SPAN CLASS="TableHeads">
Operation</SPAN>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="4">
<P CLASS="TableFirst">
<A NAME="pgfId=162244">
</A>
<SPAN CLASS="TableHeads">
Binary Number Representation</SPAN>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableFirst">
<A NAME="pgfId=162254">
</A>
<SPAN CLASS="TableHeads">
Unsigned</SPAN>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableFirst">
<A NAME="pgfId=162256">
</A>
<SPAN CLASS="TableHeads">
Signed</SPAN>
</P>
<P CLASS="TableFirst">
<A NAME="pgfId=162257">
</A>
<SPAN CLASS="TableHeads">
magnitude</SPAN>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableFirst">
<A NAME="pgfId=162259">
</A>
<SPAN CLASS="TableHeads">
Ones’ </SPAN>
</P>
<P CLASS="TableFirst">
<A NAME="pgfId=162260">
</A>
<SPAN CLASS="TableHeads">
complement</SPAN>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableFirst">
<A NAME="pgfId=162262">
</A>
<SPAN CLASS="TableHeads">
Two’s</SPAN>
</P>
<P CLASS="TableFirst">
<A NAME="pgfId=162263">
</A>
<SPAN CLASS="TableHeads">
complement</SPAN>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableLeft">
<A NAME="pgfId=162265">
</A>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableLeft">
<A NAME="pgfId=162267">
</A>
no change</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableLeft">
<A NAME="pgfId=162269">
</A>
<B CLASS="Keyword">
if</B>
positive<B CLASS="Keyword">
then</B>
MSB = 0</P>
<P CLASS="TableLeft">
<A NAME="pgfId=162270">
</A>
<B CLASS="Keyword">
else</B>
MSB = 1</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableLeft">
<A NAME="pgfId=162272">
</A>
<B CLASS="Keyword">
if</B>
negative <B CLASS="Keyword">
then</B>
flip bits</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableLeft">
<A NAME="pgfId=162274">
</A>
<B CLASS="Keyword">
if</B>
negative <B CLASS="Keyword">
then</B>
{flip bits; add 1}</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableLeft">
<A NAME="pgfId=162276">
</A>
3 =</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableLeft">
<A NAME="pgfId=162278">
</A>
0011</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableLeft">
<A NAME="pgfId=162280">
</A>
0011</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableLeft">
<A NAME="pgfId=162282">
</A>
0011</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableLeft">
<A NAME="pgfId=162284">
</A>
0011</P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -