Custom 8-bit CPU and Computer (on an Arduino)

A custom 8-bit CPU implemented in Logisim, then on PC as a VM, then on hardware using an Arduino as a host.

Similar projects worth following
My objective is to build a very simple 8-bit computer, with a custom CPU instruction set. It will be designed in Logisim, tools and a VM written for Windows/Linux. Finally, hardware implementation will be done on the cheap by using an Arduino.

Over the last few years, I've been getting back into programming (probably since the 90's) creating 'virtual' CPUs on a PC, then writing little test programs etc.  I've also been adapting those to be 'hosted' on an Arduino, as the devices are cheap and I have quite a few of them, maybe one day I will move onto FPGAs.  

When I was a kid in the 80's, of all the popular home computers I had, my favourite was a 'Science Fair Microcomputer Trainer' kit from our local Tandy store. Little more than a TMS-1000 microprocessor and some LEDs and a hex keypad, I learned so much from it and later in life, long after I'd broken it in other 'projects' I wanted something like that again.

Recently, I became aware I had a limited understanding of what was going on at a lower level in a CPU, how the instruction set was related to the underlying hardware, how the control lines, registers and ALU worked.  I became aware of some free software called Logisim and decided to renew my project by designing my CPU and computer from a 'simulated' lower level.

  • The computer and CPU will be designed in Logisim.
  • Tools and a VM will be created for PC (Linux/Windows).
  • The CPU will 'hosted' on an Arduino and put in a case as a standalone working computer.

  • Update - 3rd October 2017

    Martian10/03/2017 at 17:29 0 comments

    The last project log has been deleted, as soon as I posted it, the information was becoming obsolete.  I had completed the microcoding, the instruction set had two horrible NOP's like holes in Swiss cheese.  I thought the 'slots' in the microcode for the NOPs could be used better, also 0x00 would execute as ADD r0, r0. I wanted 0x00's in RAM to do nothing.  So I've re-arranged the instruction set, 0x00 now is a NOP, it does nothing.  0xFF is a HALT, the CPU comes to a complete stop.

    Redesigned, re-optimised the layout.  There are now 4 input and 4 output 'channels' to connect to a terminal or other devices.  The IN and OUT instructions now read and write from a given register to I/O 'channel'.

    The current layout of the CPU is as follows:

    Note, 'm7' is now the name of the CPU, i.e. Model 7

    The Instruction Set is as follows:



  • Things fall apart, the centre cannot hold

    Martian09/18/2017 at 14:21 0 comments

    All of my testing, debugging etc has been done in Logisim with all the parts of the CPU on a single layout, so I can see all the parts working at once:

    I am fairly convinced I've done the microcoded ROM, the system above is running a program which is printing out some poetry by WB Yeats.   Lots of cool binary and hex LEDs blinking away too for added goodness.

    I started copying and pasting all the parts into separate layouts, weaving the control lines etc together, something has broken in the process, no doubt I've connected something wrong.

    Do I get Yeats on the display?

    To quote:

    "A gaze blank and pitiless as the sun"

  • Project Update: September 1st

    Martian09/02/2017 at 01:04 0 comments

    First I have to say how much I've learned and been inspired by this site:

    I have a 'working'* CPU in Logisim!  It is an 8-bit CPU with a 16bit address bus, with a maximum RAM of 64K.  There are 4 general purpose registers and a 4-function ALU.

    The ALU and 'register file' was quite straightforward to do, based on the tutorial noted above, but from there it became a nightmare.  I could not find any examples of an 8-bit CPU WITH 64k of RAM, they all seemed to max out at 256 bytes which is too small for a 'useful' machine.  I also had great difficulty understanding how an instruction on the IR register is actually turned into something useful.  I read various articles and chapters of books on hardwired and microcoded CPUs until my brain started to turn to mush.

    The Control Unit, which takes the data in the IR and actually switches the control lines on and off to actually make the computer work, is a messy kludge.  It is -currently- microcoded and is not completely finished, but enough is implemented for a few test programs to run.


  • August 2017 Update

    Martian08/16/2017 at 15:14 0 comments


      I recently discovered Logisim. So, after a long hiatus due to other commitments, I decided to 'reboot' the project.  

      I wanted to take a new approach by designing the machine from a lower level using Logisim. This is basically so I can learn more, filling in some gaps in my knowledge and get a better feel for building a CPU from the ground up.  

      So the project will be in three stages:

      1. Develop computer from logic circuits in Logisim, to a working model.
      2. Create an assembler and a VM in Python for Windows and Linux.
      3. Implement in hardware using an Arduino as a 'host' for my CPU.

View all 4 project logs

Enjoy this project?



Hacker404 wrote 09/20/2017 at 09:20 point

Who could resist a computer that had Bacon Lettuce and Tomato (BLT) :)

I haven't used Logisim but just looking at it, I would like to mention that most FPGA/CPLD IDE environments have schematic entry which is very much like what I see of Logisim. Schematic entry isn't very practical for large FPGAs but it's a good start to get used to the IDE. If you are going to try this then I recommend starting with Altera Quartus as it's easy to install and it's easy to find cheap CPLD breakouts with programmers cheep on ebay. Just use ebay to search for Altera CPLD and look for kits with a programmer.

  Are you sure? yes | no

Martian wrote 09/20/2017 at 21:09 point

Hi, thanks for the info.   I've not really much first-hand experience with FPGA, I worked for an optical networking firm that designed chips (on Xilinx?) about 15 years ago with Sun workstations, but I was busy running their UNIX network and never got to explore it properly.  I've only seen a few development boards in the past and they were a bit out of my price range (which is next to zero).  Arduino's have become a bit of a pooman's alternative for me to create stuff and flash it over.  I appreciate the info, I'll look into that Altera CPLD kit and read up on what's involved.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates