Simple CPU Instruction Set Design
It actually takes very little hardware to implement a CPU if you don't need high performance. Today in class we built a CPU with the very basics:
- An instruction fetch unit, which grabs the next instruction.
- A register file, from which operands are read, and results are written.
- An arithmetic unit, which performs operations on the operands.
There are a few key tricks used throughout these designs:
- A multiplexor selects one input from a set. This is used on each read port to get data from the register file, and to pick one arithmetic operation from those listed in the ALU.
- All the registers are edge-triggered. To avoid timing bugs, we fetch the next instruction on one edge of the clock, and write the results on the opposite edge of the clock. In a more complex design, we might need to keep a shift register to cycle between operating stages within a single instruction.
Here's the 24-bit instruction set CPU we built in class in 2016.
Here's an 8-bit instruction CPU we built in class in 2014. A few more examples are listed at my 2012 CPU design page.
CS 441 Lecture Note, Dr. Orion Lawlor, UAF Computer Science Department.