What's a Wire?

Introduction

We can define a wire as follows:

A Kool-Aid Analogy

Sometimes it helps to visualize a wire like a large pipe or canal. Let's assume there are two kinds of kool aid. (Kool aid is a sweet, artificially colored, artificially flavored drink for those unfamiliar with it, and is made from a sweetened powder). Let's say that green Kool Aid is 1, and red Kool Aid is 0.

When a device wishes to write a 1 to a wire, that's like pumping green Kool Aid into the pipe.

When a device wishes to write a 0 to a wire, that's like pumping red Kool Aid into the pipe.

Clearly, we don't want two devices writing a 0 and a 1 to the wire, because this would cause the pipe to have red and green Kool Aid, which would probably result in something brown.

Unfortunately, devices that read off the wire only read 0 or 1. It's already difficult enough to determine a 0 from a 1, so certainly devices are not made that can read, say, 0.5 from the wire.

Thus, we want to avoid devices trying to "read" the color of the Kool Aid when it's red and green mixed together.

Wires Don't Have Memory.

The analogy works well for another reason. A device does not simply write to the wire, and the wire stores the value. A device must continuously write a 0 or 1 to the wire. If the device stops writing to the wire, then the wire has value Z, i.e., no value.

We can think of a similar analogy. Suppose someone is trying to send you signals using a red and green flashlight (producing red and green light, respectively). Once the flashlight is off, there's no signal being sent.

Diagram of Wire

In this diagram, we have four devices. D1 writes to the wire, while D2, D3, D4 read from the wire. We'll assume a device has two connections to the wire: one to read, and one to write. It's possible to have a single connection, which would mean the device could only read or write at any one time. Although, practically speaking a device usually only reads or writes at any one time. There's almost no reason to do both, since a device that writes knows what value it's writing.

The diagram tries to emphasize the idea that, at most, one device should be writing, but more than one device can read. Devices are not obligated to read.

What are devices? These devices can be, for example, memory, CPU, or I/O devices. We keep them generic since there's no need for them to be specific.

Wire Truth Table

Imagine two devices attempting to write to a wire. Each device can either write a 0 or a 1 or not write at all (we'll indicate this by using Z).
Device One Device Two Result
0 0 ???
0 1 ???
0 Z 0
1 0 ???
1 1 ???
1 Z 1
Z 0 0
Z 1 1
Z Z Z

??? is a garbage value, and occurs when two devices write to the wire. It's like when the red and green kool Aid mix. A device attempting to read is not guaranteed to read 0 always or 1 always. Think of reading as a non-deterministic operation where sometimes it reads a 1 and sometimes it reads a 0. We want to avoid such situations.

As you can see, the "truth table" (which has 3 possible values, instead of the usual two) is conservative. We assume the wire has garbage value even when both devices attempt to write a 1 or when both devices attempt to write a 0. This is probably not true in reality, but underscores our desire to avoid having two devices write to a wire at any one time.

When no device writes to the bus, then there's no Kool Aid, and again devices attempting to read will read a value of 0 sometimes and 1 sometimes.

The difference between ??? and Z is that once a device does write a value, and the wir has Z, then the bus has a valid value (whatever is being written). However, if the wire already has ???, then any additional devices does not improve the situation. Devices attempting to read from a wire with ??? still have problems.

Summary

A wire can transmit a 0 or 1. We want to have at most one device writing to a wire (this may require rules or protocols to determine which device has the right to write to the wire). However, there can be more than one device reading the value off the wire.

A wire has no memory. That is, when a device writes to a wire, the wire does not store that value. Thus, a device must continuously write to the wire. If it stops writing, then the wire goes back to Z (i.e., having no value).

Web Accessibility