Compound Gates and Static CMOS Design
Turn a logic function into one static CMOS gate: a pull-down network, its dual as the pull-up network, and the transistor sizes.
You Will Be Able To
- Derive the pull-down network of a gate from its function.
- Build the pull-up network as the dual of the pull-down network.
- Count the transistors of a function built as one compound gate and as simple gates.
- Size a compound gate so that its worst path matches a unit inverter.
- Lesson
- G9.5
- Time
- 30 min
- Runs on
- ngspice
- Check
- 5 questions
A block needed y = NOT(a AND b OR c). The first netlist used a NAND, an inverter and a NOR: ten transistors in three stages. The library also had one gate for the whole function. It has six transistors, and here it answers 59.1 ps sooner.
a rises. Input b is 1 and c is 0, so both outputs must fall. Each output drives 10 fF.- v(in)
- v(ya), AOI21
- v(yg), three gates
- Time 225 psv(in) = 900 mV · v(ya), AOI21 = 1.955 V · v(yg), three gates = 1.8 V
The input crosses 0.9 V. Both delays are counted from here.
- Time 262.4 psv(in) = 1.8 V · v(ya), AOI21 = 900.5 mV · v(yg), three gates = 1.874 V
The compound gate crosses 0.9 V after 37.4 ps. The signal passed one stage.
- Time 321.5 psv(in) = 1.8 V · v(ya), AOI21 = 11.38 mV · v(yg), three gates = 900.1 mV
The three-gate version crosses after 96.5 ps. The signal passed a NAND, an inverter and a NOR.
Read the plot as a table
| Time | v(in) | v(ya), AOI21 | v(yg), three gates |
|---|---|---|---|
| 0 s | 0 V | 1.8 V | 1.8 V |
| 200 ps | 0 V | 1.8 V | 1.8 V |
| 225 ps | 900 mV | 1.955 V | 1.8 V |
| 262.4 ps | 1.8 V | 900.5 mV | 1.874 V |
| 321.5 ps | 1.8 V | 11.38 mV | 900.1 mV |
| 400 ps | 1.8 V | 17.45 µV | 1.322 mV |
| 600 ps | 1.8 V | 710.3 nV | 372.4 nV |
| 800 ps | 1.8 V | 710.5 nV | 371.3 nV |
| 1 ns | 0 V | 1.678 V | 1.334 V |
| 1.2 ns | 0 V | 1.8 V | 1.799 V |
| 1.4 ns | 0 V | 1.8 V | 1.8 V |
| 1.6 ns | 0 V | 1.8 V | 1.8 V |
Measured with ngspice 42 on SKY130, 1.8 V, 50 ps input edge. Both versions are sized for unit drive.
From the Function to the Pull-Down Network
A static CMOS gate has two networks. The NMOS pull-down network connects the output to ground. So it must conduct exactly when the output is 0.
Write the function as y = NOT(f). The pull-down network then builds f directly. An AND in f becomes NMOS in series. An OR in f becomes NMOS in parallel.
- Neutral
- Device
- Structure
- Read the function under the NOT
The part under the NOT is a AND b OR c. It says when the output is 0.
- Build the pull-down network
a AND b: two NMOS in series. OR c: one NMOS in parallel with that pair.
- Take the dual for the pull-up network
Swap series and parallel. The PMOS of a and b go in parallel. The PMOS of c goes in series with them.
- Choose the widths
Each path must be as strong as the unit inverter. A transistor on a path of two gets twice the width.
Read the diagram as text
- Function: y = NOT(a AND b OR c)
- Pull-down network: a, b in series; c in parallel
- Pull-up network: a, b in parallel; c in series
- Widths: by transistors in series
- Function → Pull-down network: AND: series, OR: parallel
- Pull-down network → Pull-up network: take the dual
- Pull-up network → Widths: match the inverter
The same four steps work for any function of the form NOT(AND and OR of inputs).
- a = 0, b = 0, c = 0: y = 1
All three PMOS are on. PC connects the supply to the inner node, and PA and PB both connect it to
y. No NMOS is on. - a = 1, b = 0, c = 0: y = 1
PA is off, but PB is still on, and so is PC. One path to the supply is enough. NA is on, but NB is off, so the series path is open.
- a = 1, b = 1, c = 0: y = 0
NA and NB are both on, so the series path connects
yto ground. PA and PB are both off, so the pull-up is open. - a = 0, b = 0, c = 1: y = 0
NC alone connects
yto ground. PC is off, and it is in series with the rest of the pull-up, so no path reaches the supply. - a = 1, b = 1, c = 1: y = 0
Both pull-down paths conduct. Every PMOS is off.
Read the circuit as text
- PC PMOS transistor: gate →
n1, source →VDD, drain →n2 - PA PMOS transistor: gate →
n3, source →n2, drain →n4 - PB PMOS transistor: gate →
n5, source →n2, drain →n4 - NA NMOS transistor: gate →
n6, drain →n4, source →n7 - NB NMOS transistor: gate →
n8, drain →n7, source →0 - NC NMOS transistor: gate →
n9, drain →n4, source →0 - c port: terminal →
n1 - a port: terminal →
n3 - b port: terminal →
n5 - a port: terminal →
n6 - b port: terminal →
n8 - c port: terminal →
n9 - y port: terminal →
n4
For each of the eight input rows exactly one network conducts.
This gate is called AOI21: AND-OR-INVERT, with a two-input AND and one more input. A gate that mixes series and parallel like this is a compound gate.
The Pull-Up Network Is the Dual
The PMOS pull-up network must conduct exactly when the pull-down network does not. The rule that gives this is duality: swap series and parallel, at every level.
In the AOI21 the pull-down is "a series b, in parallel with c". The dual is "a parallel b, in series with c". A PMOS turns on with a 0, so the dual network conducts for the opposite rows.
Swap the roles of the two networks and you get the OAI21: y = NOT((a OR b) AND c). Its NMOS of a and b are in parallel, with c in series.
| Gate | Function | Pull-down (NMOS) | Pull-up (PMOS) | Transistors |
|---|---|---|---|---|
| AOI21 | NOT(a AND b OR c) | (a series b) parallel c | (a parallel b) series c | 6 |
| OAI21 | NOT((a OR b) AND c) | (a parallel b) series c | (a series b) parallel c | 6 |
| AOI22 | NOT(a AND b OR c AND d) | (a series b) parallel (c series d) | (a parallel b) series (c parallel d) | 8 |
| NAND3 | NOT(a AND b AND c) | 3 in series | 3 in parallel | 6 |
Each input adds one NMOS and one PMOS, so a gate with n inputs has 2n transistors.
Counting Transistors for One Function
Every CMOS stage inverts. So AND and OR are not single gates: each is a NAND or a NOR followed by an inverter. A design that ignores this pays in transistors and in stages.
| How y = NOT(a AND b OR c) is built | Gates | Transistors | Stages from a to y |
|---|---|---|---|
| One compound gate | AOI21 | 6 | 1 |
| Simple gates | NAND2, inverter, NOR2 | 4 + 2 + 4 = 10 | 3 |
| NAND gates and inverters only | NAND2, inverter for c, NAND2, inverter | 4 + 2 + 4 + 2 = 12 | 3 |
The transistor counts follow from 2 transistors per gate input.
Fewer stages are also faster here. In the figure the compound gate falls after 37.4 ps and rises after 53.5 ps. The three-gate version needs 96.5 ps and 102.7 ps.
Sizing a Compound Gate
The unit inverter of this module has a 1 µm NMOS and a 2 µm PMOS. A gate has unit drive when its weakest pull-up and pull-down paths match that inverter.
Two transistors in series pass about half the current of one. So each gets twice the width. Count the transistors in series on the longest path through each transistor.
| Transistor | In series on its path | Width |
|---|---|---|
| NA, NB | 2 NMOS | 2 × 1 µm = 2 µm |
| NC | 1 NMOS | 1 µm |
| PA, PB, PC | 2 PMOS (PC with PA or PB) | 2 × 2 µm = 4 µm |
The AOI21 sized for unit drive. Its total width is 17 µm; the unit inverter has 3 µm.
| Switching input | Sized gate: fall / rise | Every width 1 µm: fall / rise |
|---|---|---|
| a (b = 1, c = 0) | 37.4 / 53.5 ps | 52.7 / 153.9 ps |
| b (a = 1, c = 0) | 40.2 / 63.0 ps | 55.5 / 172.7 ps |
| c (a = 0, b = 1) | 57.1 / 63.0 ps | 40.0 / 163.5 ps |
Measured: 10 fF load, 50 ps input edge, 50 % to 50 %. The unit inverter into the same load: 37.3 / 45.7 ps.
The sized gate is still slower than the inverter. Its wide transistors add their own capacitance at the output. Here that is gate overlap only, since these netlists leave the drain junctions at zero area. The slowest case is 63.0 ps.
With every width at 1 µm the rise takes up to 172.7 ps. Two weak PMOS in series charge the load.
Asked in interviews
How do you draw the CMOS gate for a given function?
Write it as NOT(f). Build f with NMOS between the output and ground: AND as series, OR as parallel. Then build the PMOS network as the dual, with series and parallel swapped, between the supply and the output.
What is an AOI gate and why use one?
AND-OR-INVERT: one CMOS stage that computes the inverse of an OR of ANDs. An AOI21 has 6 transistors. The same function from a NAND, an inverter and a NOR has 10 transistors and three stages.
How do you size a compound gate?
Make the worst pull-up path and the worst pull-down path as strong as the reference inverter. A transistor that sits in a series path of k transistors gets k times the unit width.
Try It
Each line is one delay in seconds. fall_a is the output falling after input a rises: 37.4 ps. rise_c is the output rising after input c falls: 63.0 ps.
Each copy holds the two other inputs so that the output follows the switching input. Copy C sets a to 0, so the only pull-up path is through PC and PB.
Set every W= value to 1 and run again. The falls change little, but the rises grow to 153.9 ps, 172.7 ps and 163.5 ps.
Run the netlist to draw its plots here.
fall_a = 3.744717e-11 targ= 1.062447e-09 trig= 1.025000e-09 rise_a = 5.349145e-11 targ= 3.128491e-09 trig= 3.075000e-09 fall_b = 4.021135e-11 targ= 1.065211e-09 trig= 1.025000e-09 rise_b = 6.302022e-11 targ= 3.138020e-09 trig= 3.075000e-09 fall_c = 5.713586e-11 targ= 1.082136e-09 trig= 1.025000e-09 rise_c = 6.302874e-11 targ= 3.138029e-09 trig= 3.075000e-09Check Yourself
Common Mistakes
Wrong Build the pull-up network with the same shape as the pull-down network.
Some rows then turn on both networks or neither. The switch-level run prints x or z for them.
Fix Swap series and parallel everywhere: series below means parallel above.
pmos pa (p, vdd, a); // series, like the NMOS
pmos pb (y, p, b);
pmos pc (y, vdd, c);pmos pc (p, vdd, c); // c in series
pmos pa (y, p, a); // with a, b in parallel
pmos pb (y, p, b);Wrong Forget that one CMOS stage inverts, and expect an AND-OR gate from six transistors.
NMOS can only pull down, so the six-transistor gate gives NOT(a AND b OR c). The true AND-OR needs an inverter after it: eight transistors.
Fix Design with inverting gates. Add an inverter only where the logic needs the true form.
Wrong Give every transistor of a compound gate the same width.
With every width at 1 µm the output rises in up to 172.7 ps here. The sized gate needs at most 63.0 ps.
Fix Widen each transistor by the number of transistors in series on its path.
Wrong Build a small function from NAND gates only, out of habit.
For NOT(a AND b OR c) that takes 12 transistors and three stages. The compound gate takes 6 transistors and one stage.
Fix Check whether the function, or its inverse, fits one compound gate first.
Remember
- Write the function as NOT(f). The NMOS network builds f: AND is series, OR is parallel.
- The PMOS network is the dual: swap series and parallel at every level.
- A gate with n inputs has 2n transistors. AOI21 and OAI21 have 6.
- Every stage inverts, so AND and OR cost an extra inverter.
- For unit drive, multiply each width by the number of transistors in series on its path.