Trace: » cpu_from_scratch


You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.


CPU from scratch

Recently I decided to take on a very ambitious project to design my own microprocessor from scratch. A couple of things inspired me on this project, the first being a book I finished, Digital Apollo by David A. Mindell. This book details the design and engineering behind the AGC (Apollo guidance computer) and I was amazed to learn how well designed both the hardware and software were for it's time. The fact that it was designed completely with 3-input nor gates made it even more amazing. The second reason is the fact that several other people have done the exact same thing, built entire computers from basic TTL logic. A few blog posts have been floating around the internet detailing other peoples CPU designs, looking at these I knew it was something I could easily do myself and would be a very fun project.

The idea of designing a cpu from complete scratch using all TTL logic is just exciting. Having the flexibility to design the architecture from scratch, create the instruction set, and be able to create a machine from standard TTL logic that can truly be considered a computer that has a processor that I design really pushed me to start this project.

The specifications of my cpu will be as follows:

  • Von Neumann architecture. (instructions and data in same memory)
  • 8 Bit data bus.
  • 16 bit address bus.
  • Four general purpose 8 bit registers.
  • 24 bit instruction (8 bit opcode followed by a 16 bit address)
  • 1 Mhz initial clock speed.

The supporting hardware to the cpu will be:

  • 16K of ram
  • Real-time clock
  • Memory-mapped i/o for output display, and input.

When first designing the cpu, I had initially planned to design the ALUs from scratch using binary full adders and shift registers. Later in the design I decided to use a standard TTL ALU instead to simplify the initial design. There are two ALUs available in the 7400 TTL family, the 74181 and the 74381. The 74181 is powerful offering a total of 16 arithmetic and logic operations. The 74381 is simpler offering only 8 arithmetic operations and logic ops which is what I chose since it’s operations (a + b, a - b, b - a, logical and, logical or, logical ex-or) were enough for my initial design. I can always easily create my own custom ALU at a later time, using the 74381s will greatly speed my design process.

These ALUs are only 4 bit units, so two will be required to form the 8 bit ALU. You can easily link the two together by use of the carry output. You can either use a simple ripple carry or implement a look-ahead carry using the 74182. For a simple 8 bit design with two 4 bit ALUs, lookahead carry really isn’t necessary but I chose the lookahead carry anyway simply because I could and had the integrated circuits on hand.

Initial hardware design:


Instead of physically hardwiring all of the control lines to discrete logic, I decided to burn the opcode into several EPROMS. This gives me the flexibility of changing the opcode if I make a design mistake easily without having to remove and replace a bunch of wires. This also gives me the option of adding future instructions easily by simply burning more to the EPROMS. The 8 bit opcode will allow this system to have 256 possible instructions which is definitely more than enough than needed.

Physical Design:

I am building the entire CPU using wire-wrap assembly methods. I have a large amount of good sized wire-wrap boards that will be perfect for assembly. There is also something cool about the look of these boards that gives the system a very vintage look.

All integrated circuits will be 7400 series TTL logic. Most will be 74S and 74F series strictly because what is I have on hand. Since I don't have a lot of LS or ALS low-power logic around, i'm sure this CPU will end up pulling several amps at 5v. :D