< Back to posts

My 8 Bit CPU

Published 3 August 2020


My website

Yes, I redid my website again in jekyll, but I seem to keep getting distracted by that. On with the post!

The ORION-1

The ORION-1 is an 8 Bit CPU that was heavily inspired by Ben Eater’s CPU. Currently, it has 16 bytes of ram, which implies a 4 bit address register. Obviously 16 bytes isn’t really enough to do anything at all, but fear not! I have upgrades planned.

ALU

The ALU stands for the Arithmetic and Logic Unit. It can currently add and subtract 2 8 bit numbers in binary. The add and subtract circuits are actually the same circuit, but with the subtract, I convert the second number to Two’s Complement. Two’s Complement is basically turning a number negative, using the carry bit. What does that mean? Since it’s much more difficult to grasp concepts in binary, let’s translate it to decimal. Imagine we want to subtract 50 - 30. Just from looking at it, we can see that it’s equal to 20, but how can we get there from addition? Well, we can alter the second number. If we invert the second number, which means subtract it from 100, (yes, I know this is cheating, but bear with me) We get 70 as the answer. Now, add the two numbers, 50 + 70, and the result is 120. Obviously, 120 isn’t equal to 20, but here’s the thing. If we just shift off that last decimal place, we are left with 20! In binary, we can easily shift off that last place, because it is contained in 1 wire, so all that needs to be done is to disconnect that wire. And the reason we are allowed to subtract the value from 100 is because in binary, to invert the value, there are 2 simple steps.

  1. Invert all the bits. This effectively subtracts the value from 256, which is 2^8, just as we subtract the value from 100, which is 10^2.
  2. Add 1. Since this is binary, the value is actually going to be 1 less than what it should be, because counting starts at 0 and goes to 255. After those 2 steps, you have successfully turned a binary value negative! This does mean, however, that you can only use 7 of the bits to store the number.

Registers

There are 2 special purpose registers (A & B) which are both hooked up directly to the ALU. They use 74LS173’s with 74LS245’s as bus transcievers.

Speed

The current (predicted) maximum speed of the CPU is around 6.66 MHz, because the slowest chips in this build by far are the EEPROMS. Their switching speed is about 150ns, which is faster than any human can percieve, but if that was the switching speed of your CPU, you probabaly would still be launching your web browser. The slow speed from the EEPROMs is expected, however, because it takes time for the decoders inside to decode the address and retrieve the data from the address.

Future Upgrades

As I said earlier, I do plan to make upgrades to it. I will be upgrading the 16 bytes of SRAM to hopefully 32K SRAM and 32K ROM. This way I can upload a program from my (desktop) computer onto the ROM and plug it into the CPU for fast testing! (Fast compared to what I have now: a couple DIP switches for manually programming each byte into RAM whenever the computer turns on) Another upgrade I want to make is to disconnect the A and B registers from the ALU, which would allow me to add more general purpose registers, which can all interface with the ALU. It would also allow me to more easily add upgrades to the ALU, such as bitwise logic, and hardware multiplication/division. Another quick upgrade I wanted to add was a 16x2 LCD screen, which should be fairly easy to implement. All I would need to do is to connect the data pins to the bus, clock to the clock, and some control signals for inputting data. The last thing I wanted to do is to convert the CPU from all breadboards to all PCB’s with labels. I could then be a lot less fragile with everything, and everything could be portable!

Video

I have a youtube channel which I just posted a video on what I have so far. Since you are reading this, you should definitely check it out!


Tags: Post Cpu

Avatar

Elijah Tarr (oriont)

My name is Elijah Tarr, aka oriont. I am currently a senior at Tamalpais High School in California. I love to learn new things, and I especially love coding! I hope to attend college for math or computer science. You can view my about page to learn more about me.