Boolean Logic: Electronic Logic Gates
Boolean Logic: Electronic Logic Gates
Logic gates don't have to be electronic, per se, but it sure is nice when they are. Especially considering how many electronics people have, electricity's just the most common way that we use them.
Electronic logic gates work by manipulating current; in this case True means that a piece of the circuit has been turned on (1) and False means that the piece was turned off (0). The output of the logic gate is an electronic current that's either flowing or…not.
If both X and Y are on, then the output of an And Gate between X and Y would also be on (with a current flowing through it). If X and Y aren't both on, then the output's going to be off and current won't flow through the logic gate.
The Or gate is less picky, needing X or Y to be on (or both) for current to flow through that gate. With the Xor Gate, X or Y can be on for current to flow through the gate—but not both of them. The Not Gate takes an entire current from on to off (or off to on) depending on the current's flow.
Sounds simple enough. What’s the catch?
In computers—and almost literally nowhere else—there's this thing called a multiplexer. The multiplexer has a bunch of different logic gates all smashed together into one shared device and its system is optimized for computer use—but not human understanding.
At least in our experience.
Say there are two selection switches:
- breakfast.
- dinner.
For those selections, you have four food inputs to choose from:
- deviled eggs.
- oatmeal.
- pizza.
- pancakes.
When both switches are off (no breakfast or dinner? So sad), the multiplexer's going to choose deviled eggs, a common snack food. When only "breakfast" is on, we're going to have oatmeal. If only "dinner" is on, pizza's the Shmoop du Jour. And when they both are on (breakfast and dinner), we're having pancakes. (Brinner's our second-favorite meal, right after second breakfast.)
That's basically how a multiplexer works, minus the food. It has a number of selection switches equal to log2 (2inputs). Only the value of the selection switch determines which input becomes the output. A two input multiplexer has one selection switch, a four input one has two, an eight input one has three, and so on, and so forth.
Simple multiplexers can be made with only Nand gates, but more complex ones are a little too complex without using Not, And, and Or Gates. (Source)
Even with a multiplexer, the sheer amount of electronic logic gates needed to do anything useful on a computer could add up to several billion gates. It's tough converting binary into your Facebook Feed. (Source)