Andrew Que Sites list Photos
Projects Contact


Completed basic register set and ALU. Sadly, Logisim cannot really do bidirectional buses. If everything is on one page you can make a bidirectional bus. But that got too complected too quickly. I only need one true bi-directional bus--the system bus. For now I'm treating the system bus like two buses, one for in, one for out. There are 3 additional buses used by the registers: A, B, and C bus. A and B buses are fed into the ALU for math operations, and C bus is used for output from the ALU. There are 8x 8-bit registers. These registers can be assigned to use one of the 4 buses, system, A, B and C. Register can load their value from the system bus or bus C. Registers can output on the system bus, bus A or bus C.

Currently there are 16 control register lines for selecting the bus.

The plan is to have an instruction set that selects the source and destination registers. Consider:

add a, b, c

I shall use 1-bit to direct this instruction to the ALU, 5 bits to control the ALU, and 9-bits for register selection (3-bits for each parameter) for a total of 15 bits.

Created a muxed 8x register set that uses 4 buses: 2 in, and 2 out. In the actual design I would like 4 bidirectional buses to each register.

September 10, 2020

Designing a custom CPU

   I watched a video series on building your own CPU.  While I have known the basic about how a CPU works for a long time, this video series taught me several things I had never considered and some things I didn't know at all.  The biggest revelation when instruction decoding.  While I understood microcode, the concept of a CPU having a bunch of control lines to enable different parts of the CPU that is then driven by the microcode was something I had not seen before.  I watched the entire video series one after another, and before I knew it, I was thinking about how to design my own CPU.
   Another person had also had videos and designing a CPU, but they were doing this virtually rather than with discrete components.  They were using an open source program called Logisim.  If I wanted to play with designing my own CPU, this is where I would start.  Today I got Logisim installed and started playing around.  The first thing I wanted to do was find a library of 74xxx logic devices.  This would allow me to design a computer I could build out of discrete logic parts.  I was mostly interested in basing my computer around the 74181.  This is a 4-bit ALU that can add, subtract, AND, NAND, OR, NOR, XOR, NOT, decrement, and shift left.  You can connect multiple devices together and get an 8, 16, or 32-bit ALU.  This exactly what was done with the PDP-11 and Xerox Alto.  That saves a lot of time so I wanted to start with this device. 
   At first I couldn't get the library I downloaded implementation of the 74181 to work.  I started doing my own implementation of the device when I discovered I had been interpreting the data sheet incorrectly.   I wasn't able to get the results I expected because I was reading the section for inverted logic.  Once I made that discovery and made corrects, I successfully got an 8-bit ALU working.