digiwleeaLearn
Open the lab →

Signals: 0, 1, Z, X

The four values a wire can carry

5 min read

A digital wire can carry four states: 0 (driven low), 1 (driven high), Z (floating, driven by nothing), and X (contention, driven high and low at once). Telling them apart is essential to reading and debugging a circuit.

Build it in the lab →
Recall from the transistor that a switch only connects its channel pins when its gate tells it to. So a wire is not always being driven by something. That single fact is why a wire needs more than two values to describe it.
In this simulator every wire carries one of four signal values at any moment: 0, 1, Z, or X. The first two are the clean logic levels you expect. The last two describe what is, or is not, driving the wire.
  • 0: the wire is actively pulled LOW by a driver (for example an NMOS path to GND). The probe shows 0.
  • 1: the wire is actively pulled HIGH by a driver (for example a PMOS path to VCC). The probe shows 1.
  • Z: nothing is driving the wire at all. It is floating. The probe shows Z, not 0.
  • X: two or more drivers are fighting over the wire and disagree. One pulls HIGH, another pulls LOW at the same time. This is contention. The probe shows X.
An analogy for the four values: think of a wire as a seesaw between a VCC weight on one end and a GND weight on the other. A driver pulling it down firmly is 0; pulling it up firmly is 1. With nobody on it, the seesaw just hangs wherever, undecided: that is Z. And with someone heaving on each end at once, it splinters: that is X. A good circuit always has exactly one hand on the seesaw.
Floating is not zero. A Z wire is electrically disconnected from everything. In a real chip it drifts to an unpredictable voltage and picks up noise. In the simulator it stays Z and propagates confusion through any gate that reads it. If you see Z where you expected 0, look for a missing connection or a transistor whose gate is never turned on.

Where Z comes from: the pass switch

The simplest example of a floating wire is the pass switch: a single NMOS transistor with one channel pin tied to an input and the other tied to the output F. When the enable input EN is 0, the channel is open and nothing drives F, so the probe reads Z. Set EN to 1 and the switch closes, passing the input through, so F finally reads a real 0 or 1.
When EN is 0 the NMOS channel is open and F floats to Z. Open this in the lab, set EN to 1, and the switch closes so the input reaches F.

Where X comes from: contention

Contention happens when two drivers land on the same wire and try to force opposite values. If one path pulls the wire to 1 while another simultaneously pulls it to 0, the simulator marks it X. In real hardware this is a dead short between VCC and GND: it draws huge current and can physically destroy the transistors.
When debugging, drop a PROBE on any suspicious wire. A reading of Z means the wire has no driver at all. A reading of X means it has too many conflicting drivers. Both are design errors in a properly built static CMOS circuit, and the fix is usually one wire.
Check yourself
A probe reads X. Does the wire have too few drivers or too many? And what about a probe reading Z?
Every correctly designed static CMOS gate produces exactly 0 or 1, never Z or X. Its structure guarantees one driver is active and the other is off. The next lesson, Complementary CMOS, shows the arrangement that makes that guarantee, and it is the pattern behind every gate, adder, and register in the computer you will build.
Spot the fault
EN0IN1FZ
Look at F
Float (Z)
With EN = 0 the NMOS pass switch is open, so nothing drives F and it floats to Z. Remember Z is not 0: it means the wire is disconnected. Set EN = 1 to close the switch and pass IN through to F.

Frequently asked

What are the four values a wire can carry?

A digital wire carries one of four signal values: 0 (driven LOW by a path to GND), 1 (driven HIGH by a path to VCC), Z (floating, driven by nothing at all), and X (contention, driven HIGH and LOW at once). The first two are clean logic levels; the last two describe what is, or is not, driving the wire.

What does Z (high-impedance) mean on a wire?

Z means nothing is driving the wire at all: it is floating, electrically disconnected from everything. A probe shows Z, not 0. In a real chip a Z wire drifts to an unpredictable voltage and picks up noise, so if you see Z where you expected 0, look for a missing connection or a transistor whose gate is never turned on.

What is the difference between Z and X on a wire?

Z means too few drivers (zero, so the wire floats); X means too many conflicting drivers (two paths forcing opposite values, a short between VCC and GND). Memory hook: Z is the empty wire, X is the crowded one. The fix for Z is to connect one driver; the fix for X is to disconnect one.

Why is contention (X) dangerous?

Contention happens when two drivers force opposite values onto the same wire: one pulls it to 1 while another pulls it to 0. In real hardware this is a dead short between VCC and GND that draws huge current and can physically destroy the transistors.

You've got the theory. Now build it from scratch and watch it work.

Build it in the lab →
Found this useful? Share itShare on X