Inside the Machine Hardware and Software Synergy
Transistors and Boolean Logic
From Voltage to Values
At its core, a computer doesn't understand code, numbers, or images. It only understands electricity: is a current flowing or not? The entire digital world is built on this simple, physical distinction. To make electricity perform useful work, we need a way to control its flow precisely and incredibly quickly. We need a switch.
But not a mechanical switch like the one on your wall. We need one with no moving parts, one that can be miniaturized by the billion, and one that can flip states millions of times per second. This is where the MOSFET comes in.
A MOSFET (Metal-Oxide-Semiconductor Field-Effect Transistor) acts as a voltage-controlled switch. When a voltage is applied to its 'gate', it allows current to flow between its 'source' and 'drain'. When the voltage is removed, the flow stops. It's an elegantly simple mechanism.
This on/off behavior is the physical reality that underpins all digital computation. We can create a powerful abstraction: let's agree that a 'high' voltage state (current flowing) represents the number 1, and a 'low' voltage state (no current) represents the number 0. Suddenly, we are no longer just manipulating electricity; we are manipulating information. We have translated the physical state of a transistor into the abstract concept of a binary digit, or 'bit'.
The Rules of Logic
Now that we have bits, we need a set of rules to operate on them. We need a way to combine 0s and 1s to perform calculations. Fortunately, a 19th-century mathematician named George Boole had already worked this out. His system, now called Boolean algebra, provides a formal way to work with true/false values, which maps perfectly to our 1s and 0s.
In digital electronics, we implement Boolean operations using circuits called logic gates. These are arrangements of transistors that take one or more binary inputs and produce a single binary output based on a simple logical rule.
The three most fundamental gates are AND, OR, and NOT. You can think of them as simple decision-makers.
- An AND gate outputs 1 only if all of its inputs are 1.
- An OR gate outputs 1 if at least one of its inputs is 1.
- A NOT gate, or inverter, has only one input and simply flips it. A 1 becomes a 0, and a 0 becomes a 1.
Every logical operation a computer performs can be broken down into combinations of these simple gates. We can see how they work by looking at their truth tables, which show the output for every possible combination of inputs.
| A | B | A AND B | A OR B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 |
| A | NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
Building Blocks of Arithmetic
Logic gates are powerful, but how do we get from simple ANDs and ORs to adding numbers? We build bigger, more complex circuits. The first step is to create a circuit that can add two bits together. This is called a half-adder.
When you add two bits, say and , you get two results: a Sum () and a Carry (). Think about adding 1 + 1 in binary. The result is 10 (which is 2 in decimal). The '0' is the sum, and the '1' is the carry-out, just like carrying the one in grade-school arithmetic.
The logic for the Sum is that it's 1 if is 1 or is 1, but not if both are 1. This is the definition of an Exclusive OR, or XOR gate. The logic for the Carry is simpler: it's 1 only if both and are 1, which is a job for an AND gate.
The half-adder is a great start, but it's missing a key feature. To add numbers with more than one digit (like 11 + 01), we need to handle a carry-in from the previous column of digits. This requires a full-adder.
A full-adder takes three inputs: A, B, and a Carry-in (). It still produces a Sum and a Carry-out (). A clever way to build one is to link two half-adders together. The first half-adder adds A and B. Its sum is then added to the using a second half-adder. The final is produced if either of the half-adders generated a carry.
By chaining these full-adders together, one for each bit, we can create circuits that add binary numbers of any length. An 8-bit adder is just eight full-adders linked in a chain, with the carry-out of one feeding into the carry-in of the next.
This is the essence of digital computation: starting with a simple switch, abstracting it to a bit, defining logical rules with gates, and combining those gates into modules that perform complex tasks like arithmetic. Every action your computer takes, from loading a webpage to playing a video, is ultimately a storm of billions of switching on and off, executing these fundamental rules of logic.
Check your understanding of these fundamental building blocks.
What is the fundamental role of a MOSFET in a digital computer?
A 'high' voltage state in a transistor, where current is flowing, is used to represent the binary digit ____.
With these concepts, we've built the first layer of abstraction, moving from raw electrical signals to meaningful computation. These logical structures form the bedrock on which all software is built.

