more on encodings

We’ve seen how we can use dual-rail logic (R2) to easily build a NOT gate. So why did we bother with single-rail logic (R1) in the first place?

compactness

00/0000/00
loading…

le vs pe

The R2 stream carries the same information, but takes twice as much space. Disks are not big! Often we need to prioritise keeping our devices compact, for which R1 is perfect.

native interface

Many expect their input to be R1. For example, a turn turn functions as both an AND and OR gate — but only under R1.

If we have to, we can use R2 with these by just taking the 1 channel and routing the 0 around. But again, this takes up extra space, and is less elegant than directly using R1.

adapters

Fortunately, we don’t have to choose a single encoding — we can mix and match within the same pattern. But we’ll need an adapter to convert between the different encodings.

Think of it like an international company — one branch might speak English, another Spanish, and a third one Romansh. Each branch can function perfectly well internally, but to talk to another branch, they need a translator.

R2 to R1

Converting from R2 to R1 is easy — in fact, we don’t have to do anything:

00/0000/00
loading…

convert le to pe

The 1s column already contains R1! So to convert, we can just take this column.

Similarly, the 0s column contains the inverted values of the stream. It’s like we’re carrying around the output of a NOT gate.

R1 to R2

To convert R1 to R2, we’ll need a reservoir:

00/0000/00
loading…

convert pe to le

The reservoir reads the stream and outputs an R2 encoding.

If you think about it, this has always been the point of a switch switch — it converts marble into r, and hole into l!

summary

We now know how to represent bits1s and 0s — and manipulate them via logic gates.

In the next sequence, we’ll learn how to combine bits together to represent more meaningful pieces of data, like numbers and text.

finish