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 z means 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.

TransientOne Pulse Through Three Kinds of SwitchThe input rises to 1.8 V and later falls to 0 V. Each switch is on all the time and drives a 10 fF load.
  • v(in)
  • v(n)
  • v(p)
  • v(t)
-0.5 V00.5 V1.0 V1.5 V2.0 VVoltage05 ns10 ns15 ns20 ns25 ns30 ns35 ns40 nsTimeNMOS alone: 1.163 V for a 1PMOS alone: 0.636 V for a 0-0.5 V00.5 V1.0 V1.5 V2.0 VVoltage010 ns20 ns30 ns40 nsTimeNMOS alone: 1.163 V for a 1PMOS alone: 0.636 V for a 0
  1. 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.

  2. 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) and v(t) are at 1.8 V. v(n), behind the NMOS, has only reached 1.163 V.

  3. 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) and v(t) are at 0 V. v(p), behind the PMOS, is still at 0.636 V.

Read the plot as a table
Timev(in)v(n)v(p)v(t)
0 s0 V0 V210.9 mV1.475 nV
500 ps0 V0.001955 fV210.9 mV1.475 nV
5 ns1.8 V1.109 V1.8 V1.8 V
10 ns1.8 V1.139 V1.8 V1.8 V
15 ns1.8 V1.154 V1.8 V1.8 V
19 ns1.8 V1.163 V1.8 V1.8 V
20 ns1.8 V1.165 V1.8 V1.8 V
25 ns0 V3.088 nV715.1 mV16.95 nV
30 ns0 V-1.425 nV671.9 mV11.15 nV
35 ns0 V1.307 nV648.9 mV-4.587 nV
39 ns0 V-810.9 pV635.9 mV5.608 nV
40 ns0 V724.5 pV633.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.

SwitchPassing 1.8 VPassing 0 V
NMOS alone1.163 V: a weak 10 V
PMOS alone1.8 V0.636 V: a weak 0
Both side by side1.8 V0 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.

Icarus Verilog has the transmission gate as the primitive cmos.
cmos t1 (y, d, en, ~en);   // output, input, NMOS gate, PMOS gate

When 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 Mux from Two Transmission GatesThe upper pair passes 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.
A mux from two transmission gatesNAPANBPBabysnssn
  1. NA · NMOS transistorgate → n1 · drain → n2 · source → n3
  2. PA · PMOS transistorgate → n4 · source → n3 · drain → n2
  3. NB · NMOS transistorgate → n4 · drain → n2 · source → n5
  4. PB · PMOS transistorgate → n6 · source → n5 · drain → n2
  5. a · portterminal → n3
  6. b · portterminal → n5
  7. y · portterminal → n2
  8. sn · portterminal → n1
  9. s · portterminal → n4
  10. sn · portterminal → n6
  1. s = 0: y = a

    sn is 1, so NA is on. s is 0, so PA is on. The upper pair connects a to y. NB and PB are both off, so b is cut off.

    a passes

  2. s = 1: y = b

    s is 1, so NB is on. sn is 0, so PB is on. The lower pair connects b to y. NA and PA are both off, so a is 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.

A D Latch from Two Transmission GatesArrows show where a value goes. Only one of the two transmission gates is on at a time.
  • I/O
  • Device
  • Storage
  • Data
CallValueReturnWaiting
A D latch from two transmission gatesArrows show where a value goes. Only one of the two transmission gates is on at a time. io Input d the new value device Gate T1 on while clk is 1 storage Two inverters node n to output q io Output q the stored value device Gate T2 on while clk is 0 dto node nqq fed backto node n
  1. io Input dthe new value
    • d → Gate T1
  2. device Gate T1on while clk is 1
    • to node n → Two inverters
  3. storage Two invertersnode n to output q
    • q → Output q
    • q fed back → Gate T2
  4. io Output qthe stored value
  5. device Gate T2on while clk is 0
    • to node n → Two inverters
  1. clk = 1: the latch is open

    T1 is on and T2 is off. The value of d goes through T1 and the two inverters to q. The output follows the input.

    Follow the calls, values and waits
    1. data value: Input d → Gate T1
    2. data value: Gate T1 → Two inverters
    3. data value: Two inverters → Output q
  2. clk = 0: the latch holds

    T1 is off, so d is cut off. T2 is on and feeds q back to node n. The two inverters and T2 form a loop that keeps the value.

    Follow the calls, values and waits
    1. data value: Two inverters → Gate T2
    2. 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 IcarusMeaning
enabledoff1A owns the bus
offenabled0B owns the bus
enabledenabledxcontention: the two drivers fight
offoffznobody 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
  1. 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.

  2. 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.

  3. 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.

SPICEngspice 42 · simulator service
Edit the netlist, then run it
Expected measurements: n_high = 1.162951e+00 p_high = 1.800000e+00 p_low = 6.358927e-01 t_high = 1.800000e+00

Check Yourself

Predict the outputThis is the D latch from two transmission gates. The program prints q after each of five steps. Predict the exact line.
module tb;
  logic d, clk;
  wire  n, q, qb;
  cmos t1 (n, d, clk, ~clk);   // on while clk is 1: d enters
  cmos t2 (n, q, ~clk, clk);   // on while clk is 0: the loop holds
  not  i1 (qb, n);
  not  i2 (q, qb);
  initial begin
    clk = 1; d = 1; #1 $write("%b", q);
    d = 0;          #1 $write("%b", q);
    clk = 0; d = 1; #1 $write("%b", q);
    d = 0;          #1 $write("%b", q);
    clk = 1; d = 1; #1 $display("%b", q);
  end
endmodule
ConceptA single NMOS transistor, with 1.8 V on its gate, passes a 1.8 V signal into a small load. What level did the measurement show behind it?
ConceptHow many transistors does the transmission-gate mux of this lesson need, with its inverter?
ConceptYou must pass a signal that is always a 1 when it matters, and you may use only one transistor. Which one keeps the full level?
ConceptBoth transmission gates of a mux are off for a moment, because the select signal and its inverse are both 0. What is on the output y?

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.

Before
assign bus = en_a ? a : 1'bz;
assign bus = en_b ? b : 1'bz;
// en_a and en_b can both be 1
After
assign bus = sel ? b : a;
// or: en_b is always the inverse of en_a

Wrong 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.

Before
cmos ta (y, a, s, s);    // PMOS gate also on s
cmos tb (y, b, s, s);
After
cmos ta (y, a, sn, s);   // passes a while s is 0
cmos tb (y, b, s, sn);   // passes b while s is 1

Remember

  • 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.
  • z means 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.

Practice

Report a problem with this page