Homebrew 16-bit CPU in Logisim

A homebrew 16-bit CPU and computer, developed in Logisim then implemented in hardware using an Arduino.

Similar projects worth following
Risen from the ashes of my failed 8-bit CPU project, I am now working on a 16-bit CPU. Developed in Logisim, emulated on PC and implemented in hardware using an Arduino Due as a 'host' (unless I can learn more about FPGAs)

Thanks to the following:

But How Do It Know? The Basic Principles of Computers for Everyone by J. Clark Scott

Warren Toomey's online notes etc:

Yann Guidon's notes on Processor Design Principles:

  • Project Update: October 17th, 2018

    Martian10/17/2018 at 19:11 0 comments

    Over the summer months I did little improvements at present the CPU itself is finished in Logisim, apart from tweaking the wiring, no major changes to the overall design have been made for a while now, so in terms of instructions set and operation etc, it's done.  ...unless I find any bugs in the microcode which I think I've eliminated now.

    The changes have been made to the overall computer design. 

    A secondary storage system added, it's a kludge really, a 16MB chunk of 24-bit addressable memory, it has three registers, two supply the 24-bit address and a third for the data.

    Further work will need to be done with the virtual version in Python, adding the storage system - the 16x32 graphics mode was added over the summer and the demo works.

    Once I get the VM/emulator to the same level as the Logisim implementation, I will create a simple OS to boot from the secondary storage and allow programs to be loaded and saved.  Also create a VERY simple language to save my sanity from assembler,  either native or using Python - or both.

    So, long term objectives:

    • The complete system in Logisim and virtual in Python.
    • Simple OS to manage programs and data on secondary storage.
    • Make some demo programs.
    • Very simple programming language.
    • Boot menu.
    • Calendar program.
    • Calculator.
    • Simple database.
    • Editor.

    THEN, adapt it all for an Arduino Due with MicroSD for hardware implementation - like my CP/M computer project. (or perhaps a Raspberry Pi based baremetal implementation)

    SHARE it all and let others do their own thing with it.

  • Update - July 9th, 2018

    Martian07/09/2018 at 20:48 0 comments

    It's been a while since I last gave an update, the weather is hot and my ability to think much is limited by cold beers and siestas.  

    The project is very much alive although I've slowed the pace, I've been thinking beyond the processor to the computer itself, especially secondary storage (16MB).

    Work continues on the VM, little modifications here and there as I begin to implement the secondary storage solution.  Having spent a little while looking at FPGAs etc, I'm still aiming for implementation with an Arduino, but I also have some Pi Zeros around and I've looked at some ways of implementing a bare metal CPU emulator/VM on those.

  • Using a Chromebook - Apr 29, 2018

    Martian04/29/2018 at 20:51 0 comments

    Apparently Chrome OS will begin supporting Linux applications, using containers as they currently do with ARC++ to run Android apps out of the box.  So, I've put my Chromebook into dev mode and used Crouton to get Debian Stretch running in a chroot.  Now I can run Logisim, very nicely, on my Chromebook.  Working on a secondary storage device and I will write some code for my CPU to boot a simple OS and load a menu system to run further programs.

  • Emulator Update - Apr 26th, 2018

    Martian04/26/2018 at 01:46 0 comments

    The Emulator is now running the same programs as the Logisim version, this is the Raven program shown before..

    There are a few more instructions to implement in the emulator, then it's time to think about more useful programs.

  • Using a Chromebook - Apr 24, 2018

    Martian04/24/2018 at 17:42 0 comments

    To cut a long story short, I'm without a PC - I've been borrowing one to work from until today, my new Chromebook (Acer CB3-431) arrived and I'm using this to work on until next month when I will have a new, additional, PC.

    I was pleased to find out that Chrome OS now runs Android stuff without tinkering and Termux is fully usable.  Termux is a sandboxed non-root Linux environment that allows the installation of all the good stuff you'd normally get in a terminal, GCC, openSSH, vim, python etc. etc.   So I'm continuing my CPU emulator development on a Chromebook(!) and it's a nice environment, python3 seems to fly at warp speed!

    I've also got a Raspberry Pi running a desktop that I can access via VNC and I can even run Logisim, it works well enough to make changes to the design, obviously running the simulation is slower than my old PC. 

  • CPU emulator almost complete - Apr 23, 2018

    Martian04/23/2018 at 18:53 0 comments

    Recycled the Python code from my previous custom CPU emulators and have it mostly working, although there are some bugs to fix.

    Things to do...

    • Fix bugs in Emulator
    • Test progs in Emulator already created in the Logisim version
    • Clean-up CPU design in Logisim
    • Concentrate on just writing programs for the CPU, probably over the summer.

  • 16x16 Matrix Graphics

    Martian04/18/2018 at 09:22 0 comments

    I've added a little graphical output, 16 by 16 pixels for stunning high resolution graphics, ok, maybe not but nifty little bitmaps output via the OUT instruction,

    And the overall computer is now a sprawling mass of connections, of course it will be cleaned up, parts separated as components etc. for now I want to see everything in one place and how it all works:

    OK, briefly about the ALU, I was starting to get too obsessed with it, I wanted more functions so I've gone with the one shown in above...  at least for now.  

    But, importantly it IS operationally compatible with the optimised one I had.  So if I want to do the ALU at a lower level, the control line is still there to do the combined Add/Subtract circuit with the XOR.  Also it doesn't affect any the instruction set or internal microcoding.

  • Quoth the Raven... Hello World

    Martian04/14/2018 at 23:41 2 comments

    The CPU has had the newer ALU added and the appropriate microcodes done to run a first program, using a register to point to a RAM address, incrementing in a loop I can now handle strings MUCH better than my last 8-bit CPU.  Here it is copying text in RAM to the console output:

    And the ALU:

  • ALU designs

    Martian04/14/2018 at 06:42 0 comments

    After reading Yann Guidon's notes about ALU design and reading Warren Toomey's ALU tutorial here:

    I took those ideas and I am testing this in my current CPU layout in Logisim.

    The add/subtract unit is how Yann described, using an adder's Carry In and a XOR gate to do subtraction:

  • Experiments, experiments and errors

    Martian04/12/2018 at 20:58 5 comments

    First I'd like to thank Yann Guidon's advice from his Processor Design Principles (PDP).

    So this is the Phoenix, the Ph-16.  A wholly 16-bit system with 16 registers and 64K of RAM.  This is at the highly experimental/research stage, I've come up with a basic layout in Logisim.

    Ignore the lower left, it's not connected. It will eventually be the instruction decoder and the 4K ROM will hold the 12-bit microcode, I will look at hardwiring it or doing it with another project, but microcode is just easier for me to fix.   But I did follow Yann Guidon's advice of having 16 registers for a 16 bit machine and they can point to the whole 64K.

    The top left is the keyboard and top right is the TTY output, the big multiplexor allows crude channels for other devices, currently. INP and OUT instructions will input/output to/from a given register.

    At present I'm playing with the control lines, figuring out what I can get it to do, working out the microcode, instruction set etc.

View all 10 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

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