Chapter 9. A Basic Processor

In this chapter, we will design a basic processor and write some code to run on it. In their most basic form, processors aren’t that complicated. They are more or less a programmable FSM. However, the latest processors from Intel or AMD are insanely complex devices that utilize many clever improvements over our basic design to squeeze out more performance. Look at this example as a starting point that you can modify and improve in the future.

Why even bother with a processor? Processors have three big advantages. The first is that you can drastically change their behavior by only changing the contents of a ROM. The exact same hardware can do many tasks. If you make your ROM external, the FPGA design doesn’t even need to change for it to perform different tasks (like a computer). The second is that processors can easily handle sequential tasks. With just hardware, it can be complicated to coordinate complicated tasks that need to come in sequence. You usually end up with a lot of FSMs, which basically turn out to be nonprogrammable processors. The final and possibly biggest benefit is that processors are extremely resource efficient. This is because a processor has a single adder, multiplier, comparison circuit, and so forth, and each one is used every time your code calls for that operation. If you need to do two multiplications in a hardware pipeline (with each step of your task performed by a different stage in parallel), you need to instantiate ...

Get Learning FPGAs now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.