Transmission Gates and Tri-State
Explain why a pass gate needs both transistor types, and build a mux, a latch and a tri-state driver from transmission gates.
You Will Be Able To
- State which level an NMOS and a PMOS pass at full strength.
- Build a transmission gate and a 2-to-1 mux from switches.
- Explain what
zmeans and how a tri-state driver shares a bus. - Predict the bus value when two drivers are enabled together.
- Lesson
- G9.3
- Time
- 25 min
- Runs on
- ngspice
- Check
- 5 questions
A designer used single NMOS transistors as switches to save area. A 1 went through one switch and came out at 1.163 V, not 1.8 V. That weak 1 drove the gate of a second switch, and its output reached only 0.692 V. The next inverter reads any input below 0.703 V as a 0.
- v(in)
- v(n)
- v(p)
- v(t)
- Time 500 psv(in) = 0 V · v(n) = 0.001955 fV · v(p) = 210.9 mV · v(t) = 1.475 nV
The input is 0 V and all three outputs are at 0 V.
- Time 19 nsv(in) = 1.8 V · v(n) = 1.163 V · v(p) = 1.8 V · v(t) = 1.8 V
The input has been at 1.8 V for 18 ns.
v(p)andv(t)are at 1.8 V.v(n), behind the NMOS, has only reached 1.163 V. - Time 39 nsv(in) = 0 V · v(n) = -810.9 pV · v(p) = 635.9 mV · v(t) = 5.608 nV
The input has been back at 0 V for 18 ns.
v(n)andv(t)are at 0 V.v(p), behind the PMOS, is still at 0.636 V.
Read the plot as a table
| Time | v(in) | v(n) | v(p) | v(t) |
|---|---|---|---|---|
| 0 s | 0 V | 0 V | 210.9 mV | 1.475 nV |
| 500 ps | 0 V | 0.001955 fV | 210.9 mV | 1.475 nV |
| 5 ns | 1.8 V | 1.109 V | 1.8 V | 1.8 V |
| 10 ns | 1.8 V | 1.139 V | 1.8 V | 1.8 V |
| 15 ns | 1.8 V | 1.154 V | 1.8 V | 1.8 V |
| 19 ns | 1.8 V | 1.163 V | 1.8 V | 1.8 V |
| 20 ns | 1.8 V | 1.165 V | 1.8 V | 1.8 V |
| 25 ns | 0 V | 3.088 nV | 715.1 mV | 16.95 nV |
| 30 ns | 0 V | -1.425 nV | 671.9 mV | 11.15 nV |
| 35 ns | 0 V | 1.307 nV | 648.9 mV | -4.587 nV |
| 39 ns | 0 V | -810.9 pV | 635.9 mV | 5.608 nV |
| 40 ns | 0 V | 724.5 pV | 633.1 mV | -2.236 nV |
Measured with ngspice 42 on SKY130, 1.8 V (400 of 4020 points). v(t) is the transmission gate.
Each Transistor Passes One Level Well
In the gates of G9.1 and G9.2 a transistor connects the output to a supply rail. A pass transistor is used differently: it connects a signal to another wire, like a switch in a path.
An NMOS is on only while its gate is higher than its source by a threshold voltage. When it passes a 1, the output is the source. As the output rises, the transistor turns itself off before the output reaches 1.8 V.
A PMOS has the opposite problem. It passes a 1 fully, but it turns itself off before the output reaches 0 V.
| Switch | Passing 1.8 V | Passing 0 V |
|---|---|---|
| NMOS alone | 1.163 V: a weak 1 | 0 V |
| PMOS alone | 1.8 V | 0.636 V: a weak 0 |
| Both side by side | 1.8 V | 0 V |
Measured with ngspice on SKY130: 1 µm transistors, 10 fF load, 18 ns after the input edge.
This is the reason behind the gates of G9.2. The NMOS pulls down, because it passes a 0 well. The PMOS pulls up, because it passes a 1 well.
A wider transistor does not repair the weak level. With 4 µm in place of 1 µm the NMOS output reaches 1.225 V. The loss comes from the threshold, not from the size.
The Transmission Gate
A transmission gate is an NMOS and a PMOS side by side, between the same two wires. The NMOS carries the low levels and the PMOS carries the high levels. Together they pass every level fully: 1.8 V and 0 V in the measurement.
The two gates need opposite control levels. To turn the pair on, the NMOS gate gets 1 and the PMOS gate gets 0. One inverter makes the second control signal.
cmos.cmos t1 (y, d, en, ~en); // output, input, NMOS gate, PMOS gateWhen the pair is off, nothing drives the output. The simulator shows this state as z, which stands for high impedance. A wire at z is not 0 and not 1. It floats.
A Mux and a Latch from Transmission Gates
Two transmission gates with opposite controls make a 2-to-1 mux. Exactly one pair is on, so exactly one input reaches the output.
a while s is 0. The lower pair passes b while s is 1. sn is the inverse of s, made by one inverter that is not drawn.- s = 0: y = a
snis 1, so NA is on.sis 0, so PA is on. The upper pair connectsatoy. NB and PB are both off, sobis cut off.a passes
- s = 1: y = b
sis 1, so NB is on.snis 0, so PB is on. The lower pair connectsbtoy. NA and PA are both off, soais cut off.b passes
Read the circuit as text
- NA NMOS transistor: gate →
n1, drain →n2, source →n3 - PA PMOS transistor: gate →
n4, source →n3, drain →n2 - NB NMOS transistor: gate →
n4, drain →n2, source →n5 - PB PMOS transistor: gate →
n6, source →n5, drain →n2 - a port: terminal →
n3 - b port: terminal →
n5 - y port: terminal →
n2 - sn port: terminal →
n1 - s port: terminal →
n4 - sn port: terminal →
n6
Four transistors and one inverter: six transistors for a 2-to-1 mux.
The mux needs six transistors: four in the two pairs and two in the inverter for sn. A mux from three NAND gates and an inverter needs 14.
The same parts make a D latch, the storage element of G5.5. One transmission gate lets d in. A second one closes a loop of two inverters.
- I/O
- Device
- Storage
- Data
- clk = 1: the latch is open
T1 is on and T2 is off. The value of
dgoes through T1 and the two inverters toq. The output follows the input.Follow the calls, values and waits
- data value: Input d → Gate T1
- data value: Gate T1 → Two inverters
- data value: Two inverters → Output q
- clk = 0: the latch holds
T1 is off, so
dis cut off. T2 is on and feedsqback to noden. The two inverters and T2 form a loop that keeps the value.Follow the calls, values and waits
- data value: Two inverters → Gate T2
- data value: Gate T2 → Two inverters
Read the diagram as text
- Input d: the new value
- Gate T1: on while clk is 1
- Two inverters: node n to output q
- Output q: the stored value
- Gate T2: on while clk is 0
- Input d → Gate T1: d
- Gate T1 → Two inverters: to node n
- Two inverters → Output q: q
- Two inverters → Gate T2: q fed back
- Gate T2 → Two inverters: to node n
Two transmission gates and two inverters: eight transistors, plus the inverter for the clock.
Tri-State Drivers and Buses
A tri-state driver has three output states: 0, 1 and z. An enable input chooses between driving and floating. In SystemVerilog one line describes it: assign bus = en ? d : 1'bz;.
Several tri-state drivers can share one wire, a bus. The rule is strict: at most one driver is enabled at a time. The others stay at z and do not disturb it.
| Driver A (sends 1) | Driver B (sends 0) | Bus in Icarus | Meaning |
|---|---|---|---|
| enabled | off | 1 | A owns the bus |
| off | enabled | 0 | B owns the bus |
| enabled | enabled | x | contention: the two drivers fight |
| off | off | z | nobody drives: the bus floats |
Measured on Icarus Verilog with two cmos switches on one wire: the program prints 10xz.
In a real chip, contention is worse than an unknown value. One driver pulls the wire up while the other pulls it down. A large current then flows from VDD to ground through both.
Inside a chip, designers mostly use muxes in place of tri-state buses. Tri-state drivers remain common on the pins of a chip, where one wire carries data in both directions.
Asked in interviews
Why does a transmission gate use both an NMOS and a PMOS?
An NMOS passes a 0 fully but loses a threshold voltage on a 1. A PMOS passes a 1 fully but leaves a weak 0. Side by side, one of them always passes the level well, so the pair passes both levels at full strength.
What is a tri-state output?
An output with three states: 0, 1 and high impedance, written
z. In the third state the driver is off and does not affect the wire. This lets several drivers share one bus, as long as only one is enabled at a time.What is bus contention?
Two drivers are enabled on one wire and drive opposite values. The level on the wire is unknown, and a large current flows between the supplies through both drivers. The enables must never overlap.
Try It
Each line is one output voltage, taken 18 ns after an input edge. n_high = 1.162951e+00 is the weak 1 behind the NMOS. p_low = 6.358927e-01 is the weak 0 behind the PMOS.
The transmission gate gives t_high = 1.800000e+00 and a t_low of 1.5 nV, which is 0 V for any gate. Open the Plots tab to see the three outputs follow the input.
Change W=1 to W=4 on the line that starts with XN1, then run. n_high becomes 1.225 V. Four times the width gains only 62 mV.
Run the netlist to draw its plots here.
n_high = 1.162951e+00 p_high = 1.800000e+00 p_low = 6.358927e-01 t_high = 1.800000e+00Check Yourself
Common Mistakes
Wrong Chain NMOS pass transistors with no buffer between them to restore the level.
Each extra switch slows the weak 1: after 18 ns in ngspice, one switch gives 1.163 V and three give 1.086 V.
Fix Use transmission gates, and put an inverter or a buffer after a few of them.
Wrong Enable two tri-state drivers on one bus at the same time.
One driver pulls up while the other pulls down, so the level is unknown: Icarus prints x for the bus.
Fix Make the enables exclusive: at most one driver is on in any cycle.
assign bus = en_a ? a : 1'bz;
assign bus = en_b ? b : 1'bz;
// en_a and en_b can both be 1assign bus = sel ? b : a;
// or: en_b is always the inverse of en_aWrong Read z as a 0.
A z means that nothing drives the wire, so its voltage is whatever charge was left on it.
Fix Make sure some driver is on whenever the bus is read, or add a weak pull-up or pull-down.
Wrong Connect both gates of a transmission gate to the same select signal.
One of the two transistors is then always on: Icarus prints xx for a mux built this way.
Fix Drive the PMOS gate with the inverse of the NMOS gate. That takes one inverter.
cmos ta (y, a, s, s); // PMOS gate also on s
cmos tb (y, b, s, s);cmos ta (y, a, sn, s); // passes a while s is 0
cmos tb (y, b, s, sn); // passes b while s is 1Remember
- An NMOS passes a full 0 and a weak 1. A PMOS passes a full 1 and a weak 0.
- A transmission gate is both side by side, with opposite gate signals. It passes both levels fully.
- Two transmission gates and an inverter make a 2-to-1 mux of six transistors.
zmeans that no driver is on. A tri-state driver uses it to release a bus.- Only one driver may be enabled on a bus. Two at once give contention.