The program generates a static CMOS circuit with a series parallel style NMOS stack and the PMOS stack is constrained to be the exact dual of the NMOS stack. The height of the cell is assumed to be fixed and only the width is varied. When the source or drain of two adjacent transistors may be connected by abutting them and making the diffusion area continuous or by leaving them apart and connecting them with a metal layer. Either way when two transistors are not abutted against each other there should be a diffusion gap between them. This gap is usually as wide as a transistor if not more. To minimize area we need to use as few diffusion gaps as possible. So we need to be able to generate layouts where as many transistors abutt each other as possible. It is possible to implement any static CMOS circuit as a single row of P transistors and a single row of N transistors below the P transistors with the gates of vertically aligned PMOS and NMOS transistors sharing a common input. In fact a single vertical poly line is used to implement the gates of both the transistors. This is the implementation style used by the cell generator described here. Given such an organization the area of the circuit grows linearly with the number of inputs and diffusion gaps. To minimize the area the cell generator needs to reduce the number of gaps by finding continuous stretches of transistors that can be abutted.
Fig 1. Static CMOS implementation style
| Vari |
|->able<---|
___ ___ ___ | ___ | ___
|###| |###| |###| |###| |###|
+---###----+---###----+---###----+ -- +---###------------###----+
| |###| | |###| | |###| | | | |###| | | |###| |
| |###| | |###| | |###| | PMOS | | |###| | | |###| |
| |###| | |###| | |###| | STACK + | |###| |...| |###| |
| |###| | |###| | |###| | F | |###| | | |###| |
| |###| | |###| | |###| | ... i | |###| |...| |###| |
| |###| | |###| | |###| | x | |###| | | |###| |
| |###| | |###| | |###| | e | |###| | | |###| |
| |###| | |###| | |###| | d | |###| | | |###| |
| |###| | |###| | |###| | ^ | |###| | | |###| |
| |###| | |###| | |###| | | | |###| | | |###| |
+---###----+--|###|---+---###----+ -- +----##-------------##---+-
|###| |###| |###| |###| |###|
|###| |###| |###| |###| |###|
|###| |###| |###| |###| |###|
+---###----+---###----+---###----+ +---###------------###----+
| |###| | |###| | |###| | | |###| | | |###| |
| |###| | |###| | |###| | NMOS | |###| | | |###| |
| |###| | |###| | |###| | STACK | |###| | | |###| |
| |###| | |###| | |###| | | |###| |...| |###| |
| |###| | |###| | |###| | ... | |###| | | |###| |
| |###| | |###| | |###| | | |###| | | |###| |
| |###| | |###| | |###| | | |###| |...| |###| |
| |###| | |###| | |###| | | |###| | | |###| |
| |###| | |###| | |###| | | |###| | | |###| |
| |###| | |###| | |###| | | |###| | | |###| |
+---###----+--|###|---+---###----+ +---###------------###----+
|###| |###| |###| |###| |###|
----- ----- ----- ----- -----
Poly Poly Poly Poly Poly
|-----------> Run <--------------|-->GAP<---|-------> Run <------------|
In addition, the requirement that vertically aligned
PMOS and NMOS transistors share a common input means that
such a continuous stretch of transistors should describe a
path through the graph of the dual circuits that have the
same sequence of labels on the edges. Such a path is called
a dual Eulerian path and the next section provides a brief
introduction to the graph theoretic background required to
understand how the cell generator works.
eg:
0--------0
A
Fig. 2
If A and B are TTSPMGs then A * B and A + B are also TTSPMGs
where '*' is the series operator and '+' is the parallel
operator.
eg:
A * B: 0-------0-------0
A B
A + B: -------
/ A \
/ \
0 0
\ B /
\-------/
Fig. 3
The only possible TTSPMGs are ones produced by repeated
application of these rules. The NMOS and PMOS parts of a
circuit may considered as independent TTSPMGs. Given the a
boolean and or equation for compliment of a function the two
terminal representation of the NMOS circuit for the function
may be constructed by replacing each boolean and by the
series operator '*' and every boolean or by the parallel
operator '+' and constructing the graph described by the
resulting equation. Similarly the dual PMOS circuit may be
constructed by replacing each boolean and by the parallel
operator '+' and every boolean or by the series operator '*'
and constructing the graph described by the resulting
equation. Normally we keep only a single representation of
the TTSPMG equation and generate both the NMOS and PMOS
circuits from it. For this purpose we define the combined
series/parallel operator */+ such that A */B is equivalent
to doing A*B to the NMOS half and A+B to the PMOS
half. Similarly the parallel/series operator +/* when
applied to A and B does A+B to the NMOS circuit and A*B to
the PMOS half. Internally the cell generator represents
boolean functions as the parse tree of the TTSPMG equation
describing their static CMOS implementation.
Our implementation style requires the same input to be fed to the gates of vertically aligned PMOS and NMOS transistors. For this purpose we need to find an Eulerian path which is identical for both the stacks. Such a path is called a dual Eulerian path. If a single dual Eulerian path does not exist we need to find dual Eulerian paths for sub-graphs of both the stacks. In the course of subdividing the graph we are free to reorder them without changing the functionality of the circuit. It is easy to see that the problem is not easy to implement efficiently since there is the potential for a combinatorial explosion in the number of possibilities.
Maziasz and Hayes demonstrate using an exhaustive search of all possible circuits of reasonable size that there are only 42 basic types of TTSPMG representations of static circuits and that the Uehara-vanCleemput method optimally handles only a few of the 42 cases. However their treatment of the subject is not detailed enough (and clearly written) to base an actual implementation on. Most of the available literature refers to only the Uehara-vanCleemput method. The cell generator program described here borrows the concept of the TTSPMG parse tree (called Composition tree in the original paper) from Maziasz and Hayes and applies the osuedo-edge technique to the parse tree to achieve very fast layout generation.
Boolean form Postfix form A and B A B * A or B A B + ( A ) AAny boolean equation may be transformed into its equivalent RPN form by repeated application of the above rules. Note that RPN does not need parenthesis for expressing the precedence.
eg: Boolean Postfix (A + B)* C A B + C * (A + B)* (C + D) A B + C D + * (A + B)+C A B + C +
The cell generator will transform each equation into a functional cell. Equations may depend on each other.
The input file consists of a set of equations specified in the format
var_name: postfix_equation ; or !var_name: postfix_equation ; eg: z1: a b * z2 +; !z2: p q * r *;
Where var_name appears on the left hand side of only one equation while it may appear anywhere in the body of any other equation. It is possible to refer to an variable name before it is defined as in the case of the variable z2 in the previous example. All constructs are terminated by a semi-colon (*not end of line*). The !var_name form indicates that the equation given is actually the compliment of the function to be implemented. This form is more efficient since it can save an inverter. There are two additional constructs named '.input' and '.output' to specify the inputs and observable outputs respectively. The keywords VDD, VSS, 1 and 0 are predefined with their conventional meanings.
During the same search pseudo inputs are added to gates that have an even number of inputs since this helps in generating the dual Eulerian path as described in a previous section. To minimize the number of gaps the position of the pseudo edges has to be carefully adjusted. A good heuristic is to add the pseudo edge on the side of the gate that is closest to the edge of the graph in a planar representation of the logic circuit.
+/*
|
|
----------------------------------------
| | |
| | |
| | |
*/+ */+ */+
| | |
/\ /\ ..... /\
/ \ ... / \ / \
/ \ / \ / \
/ ... \ / \ / \
/ \ / \ / \
Logic
Cone <===== Pseudo === == Pseudo ====>
Edges Edges
Oriented Oriented
towards towards
nearest nearest
edge of edge of
graph graph
Fig. 4
Depending on the success of this heuristic the pseudo-transistors will not interlace much with the real ones and will turn up at either the top end of the circuit (near VDD) or the bottom end (near VSS) and may be optimized out leading to lesser number of diffusion gaps.
+--------------------+---------------------+---- Terminal-1
| | |
------+ +------+ +------+ +------+ +-------
| | | | | | | | | |
+---+ | +---+ +---+ | +---+
----- | ----- ----- | -----
0 | 0 0 | 0
| | | | | |
A | B C | D
+---------------------+--------------- Terminal-2
Fig: 5a Parallel connection of even number of transistors
+--------------------+
| |
Terminal-1------+ +------+ +------+ +------Terminal-2
| | | | | | | |
+---+ | +---+ +---+ |
----- | ----- ----- |
0 | 0 0 |
| | | | |
A | B C |
+---------------------+
Fig: 5b Parallel connection of an odd number of transistors
Circuit generation is slightly complicated by the fact that the even numbered stack in 5b has a terminal at either end and may be easily incorporated into the stack by abutting while the odd numbered one in 5a may be abutted only at one end and the other end needs to be protected to avoid a short circuit through the metal of terminal-1. Since this stack corresponds to one of the original even numbered gates (pseudo transistor not shown in fig 5a) there will be a gap on the side of the stack that was closest to the edge of the graph (ref Fig 4). For this configuration, care is taken during circuit generation to abut terminal-1 on the opposite side of the gap and use a metal interconnection to terminal 2 over the gap.
During the circuit generation phase all other sub-circuits that the primary output depends on are also recursively generated and each circuit is placed in its own functional cell. No functional cell is duplicated. Interconnection between the sub-circuits should be handled by the post-processor program that routes the metal. After generating the functional cell inverters are placed to correct the polarity of the output if the original equation represented the function. If the equation was given in the !var_name form (i.e. the compliment of the required function was given) then the inverter is not required.
.ntran src gate drain .ptran src gate drainInstantiates a transistor (n or p type) and assigns names for the source and the drain terminals and specifies the name of the variable applied to the gate of the transistor.
.metal t1 t2 t3 t4 t5 ....Specifies that a post-processor should route a metal layer to interconnect points t1, t2 etc.
.abutt t1 t2Specifies that terminals t1 and t2 are connected by abutting. Both t1 and t2 are source or drain terminals that would have been instantiated in a previous .ntran or .ptran section.
.alias varname tBinds the variable named var_name to the terminal named t.
In addition the output file contains comments to help a human understand the output. The transistor order is shown in comments and the boundaries of functional cells and inverters are marked with comments.
The Cgen program is available under GPL. You can download it here.