A 16-bit CPU in Logisim

A custom 16-bit CPU created in Logisim

Similar projects worth following
Based on an older (scrapped) project for an 8-bit computer, this is a 16-bit CPU created in Logisim.

I am simultaneously emulating the CPU (and computer) in Python, to develop programs and test ideas.

Eventually, I will implement the entire thing as a working computer in hardware, probably using a low-cost Arduino. That will probably be a separate project.

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:

  • Update - November 2019

    Martian11/11/2019 at 12:55 2 comments

    I've not done anymore work on this since the summer, but I think it's essentially working.  I had planned to create more test programs etc. but that hasn't worked out this year.  I am planning to move in the near future and will start working on all my projects again.

    What I will do is upload the files I have as soon as I can.  The CPU instruction set, the Logisim files and a couple of programs samples.  Then others can look and play with what I've done, maybe help find any bugs or make some sample programs of their own, or use it to do their own thing.

  • Computer Layout (updated)

    Martian11/23/2018 at 11:37 6 comments

    Sorry I uploaded the wrong layout yesterday...

    This is the current 'computer' I've built around the CPU.

    The lower half is 'inside' the computer, the upper half are external devices.  

    On the upper half is a Mux and Demux which provide I/O channel control, allowing 16 input devices and 16 output devices to be connected to the I/O bus (the four horizontal lines in the centre).  There is a terminal screen and keyboard.  There is a TEMPORARY 16x32 graphic display that I'm playing with, also some 7-segment LEDs display the current RAM address and DATA pointed to by the CPU.  I've also experimented with a secondary storage system and even a buzzer to make sound effects! (thanks to a Logisim add-on).

    On the lower half, inside the computer is the CPU itself connected to the I/O bus above and the memory bus below, along with the clock and reset lines.  There is 64K of 16bit words of memory connected to the  bus, MEM-SEL toggles between RAM or a ROM.

  • CPU Layout

    Martian11/22/2018 at 09:53 3 comments

    I'm 99.9% sure this is complete.

  • Project Status - Nov. 19th 2018

    Martian11/19/2018 at 11:39 0 comments

    With the CPU design essentially completed, I've decided I will be bringing THIS project to a completed state.  It will be a working 16-bit CPU in Logisim.   I will share all the applicable files, layouts and a few test programs.

    That does NOT mean that I'm no longer doing any more with THIS CPU!   I am still developing the emulator in Python and I will eventually create some kind of hardware, but these will be additional projects.

    The objective for THIS project is to show the CPU itself working as it should and make it available for others to play around with and modify, improve etc.

  • Project Update - Summer 2018

    Martian10/17/2018 at 19:11 0 comments

    Over the summer months, little work was done - I made a few tweaks to the layout in Logisim and I believe I have eliminated any remaining bugs in the microcode and wiring.  I am probably as confident as I ever will be in saying the CPU itself, is complete.

    So at this point, any more changes in Logisim are to the parts of the machine outside the CPU, ie. the wider computer itself.   I have been experimenting with ideas for simple graphic displays and secondary storage.

    Current layout:

  • Hello World - Edgar Allan Poe Style

    Martian04/26/2018 at 01:46 0 comments

    There is still a lot of the instruction set to be microcoded in Logisim, but enough has been done to run the same first test program on it and in the emulator.  



  • 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.

  • 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:


    OK, briefly about the ALU.   I was starting to get too obsessed and distracted with it, I wanted more functions so I've kind of compromised:

    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.

  • 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 9 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