If you have the time, I highly recommend a youtube series by Ben Eater, in which he shows how a simple CPU can be made almost from bare transistors.
He shows how a few transistors (electronic switches) can be combined together to make _gates_. Gates usually have 2 inputs, and 1 output. With an XOR gate, for example, if one of the inputs is zero voltage, and the other is a positive voltage the output have a positive voltage; otherwise the output will have zero voltage.
He then shows how a few gates can be connected to make a _flip-flip_. The key to a flip-flop is that the output of the gates are connected to to inputs of other gates, in a loop. This results in the flip-flops having state: the outputs can have a voltage even when the inputs have been switched off.
Building from that, flip-flips can be combined to make _registers_, which are like tiny bits of RAM.
Gates can also be connected together in a different way to make _arithmetic logic units_ and _control logic_. Control logic, which to me was the most mysterious part of a CPU, is actually the least interesting, I found. It’s just a lot of gates wired together so that any particular machine code instruction (just a series of on/off bits) results in a particular set of components inside the CPU being activated or not.
Finally, everything is connected together with a _clock_, a device that pulses regularly, and causes all the other components to do their thing at the same time.
Latest Answers