This blog post is the first in a series where I plan to document where I plan to document the design and eventual build process for an 8-bit computer using logic chips (ie. no microprocessor). I have made several posts on my blog that cover concepts I’ll be referring to and using in this series and will link to them in each post as these topics come up. This post will be going into detail about the individual parts of a CPU and adds more depth to the topics discussed in my first post: What’s a Computer and what’s it thinking?. I would recommend reading that and another one of my posts, Basics of Binary, to be able to follow along.
The computer I will be designing will be based upon Von Neumann architecture which will consist of registers, an arithmetic logic unit, a system bus, memory and a memory management unit, a control unit, and a means for basic input/output. The goal of this post is to break down each of these parts and explain what they will do before I dive into the design process in future posts.
Registers act as memory for a single unit of data that can be readily accessed by the computer without the need to load from memory. In the case of my computer design, these will store a single byte (8 bits) of data that can be used by the other parts of the computer as they are needed.
Arithmetic Logic Unit
The arithmetic logic unit (ALU) is the piece of the computer that will be able to perform mathematical operations on data that is sent to it. I plan to design my ALU to operate using two input registers, Register A and B, and a single output register, Register C. It will be designed such that it can perform the following operations: Add (ADD), which adds registers A and B; Shift Right (SHR), which shifts register A one bit to the right (dividing by two); Shift Left (SHL), which shifts register A left one bit (multiplying by two); Logical And (AND), which takes the AND of registers A and B; Logical Or (OR), which takes the OR of registers A and B; Logical Exclusive Or (XOR), which takes the XOR of registers A and B; and Logical Not (NOT), which takes the NOT of register A. I will not need to implement circuitry to perform subtraction as by using these operations I can subtract two numbers albeit with multiple steps. This concept is covered in my previous post How computers represent negative (integer) numbers.
The system bus is the network of wires that information is shared between the individual elements of the computer. The system bus will further be broken down into a 16-bit address bus (this is to allow me to address 64k of memory), an 8-bit data bus, and a control bus (the size will be determined later in the design process).
Memory and Memory Management Unit
The memory of the CPU will consist of 64k of addressable memory. I plan on reserving the first 8k for ROM and having the remaining 56k available for RAM and I/O devices. The memory management unit controls the memory and is capable of reading memory to and from the data bus at the location provided to it via the address bus.
The control unit is perhaps the most complicated part of the whole system. It is what controls the timing and operation of all other elements in the computer. This is done by keeping track of where the computer is within a program via the Program Counter and executing a mini-program for each instruction that activates and deactivates the other elements in concert to perform an operation. By way of the control bus, this unit is what allows all element to share common data and address buses without trying to write/read different information simultaneously (Bus contention). I will cover this in far more detail in a future post as it is likely where most of the time spent designing the computer will be focused.
My goal is to make the input/output as generalized as possible so it is simple for me to attach virtually any device without too much added circuitry. Currently, I would like to have some sort of keyboard/text input and a display device. The details of this will be covered further in a future post.
The Next Steps
I plan to break down the design and build process into the individual elements I have described here and document the progress with regular posts. My next post on this topic will cover the design of the ALU. Please follow my blog if you’d like to be updated when I post and follow this project!