Which comes first: the CPU or the peripherals?
When working on the ZipCPU, the peripherals came first. Only when the peripherals were known to work did I transition to building the ZipCPU.
Does the order matter? I think it does. Someone else tried to build a CPU first before building all of his peripherals–in this case, the memory peripheral was the problem. The result wasn’t pretty. While it hasn’t quite killed his project, he did run out of his startup dollars and had to put the project on the backburner. [1]
If you want to build a CPU, I recommend building in this order:
-
Build the debugging scaffolding. The first thing you will need is an interface to your FPGA that you can rely upon, one that will also allow you to test the peripheral components found within your FPGA.
-
Using your scaffolding, build some peripherals. Test them. Get to know them. Get familiar with them. Understand how many clocks they will take to respond to a request. Understand how to aggregate those peripherals together so you can debug them all.
I personally hang all of my peripherals off of a Wishbone B4 bus, although other busses exist which can be used for this purpose.
-
Only once you know that your scaffolding and peripherals work, should you then start on trying to place your CPU within your FPGA.
Of course, this is all my own personal and humble opinions. On the other hand, the ZipCPU already runs on several platforms.
In the beginning God created the heaven and the earth. (Gen 1:1)