Roll your own CPU

    If you are like me, you have probably dabbled with a few microcontrollers without ever really understanding what is going on inside of the little black package. This is something that I have wondered about for some time but never really spend any amount of time learning about. I hope to change that.
    This (hopefully) series of articles will attempt to create a CPU from scratch using the Xilinx Spartan 3A FPGA. It will likely be rife with errors as it progresses, as I will be learning as I go and this will be my experiences along the way...

Let's Begin!

    First off, this would not be possible without the fantastic reference
-Computer Systems Organization and Architecture-
The chapter of most use is Chapter 6 "CPU Design". You can download the chapter from the website here. To begin my foray into CPU creation, I first need to start small. To that end, I will duplicate the 4 bit processor first described in the sample chapter.
    I will need a way to monitor what's going on with the CPU. I won't be able to watch all the action that is happening inside the CPU, but what I can do is watch all the lines going into and out of the chip. What I've devised is to use a Propeller microcontroller connected directly to the Spartan 3A.

    Above left you will see the functional outline of the setup. 21 lines in total are used to interface the new CPU to the Propeller. The Propeller in turn is connected by serial port to a PC. This allows us to use the Propeller as a virtual RAM/ROM which can be changed on the fly from the PC. Also, we can control the CLK line and pulse it at will and see the changes of the interface real time. Above right is the schematic for the connections to the Propeller. Click for a larger image.
    The PC software is a work in progress and I will release it when I have a working CPU, as well as the source code for the Propeller chip. I am waiting for some parts to arrive, and once here I will update with my first test result and the schematic captures in the Xilinx software.    

Copyright © 2011 by 100RandomTasks. All rights reserved.