Close
0%
0%

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:
http://minnie.tuhs.org/CompArch/Tutes/week03.html
http://minnie.tuhs.org/CompArch/Tutes/week04.html
http://minnie.tuhs.org/Programs/UcodeCPU/index.html

Yann Guidon's notes on Processor Design Principles:
https://hackaday.io/project/46000

  • Another Test Program - Graphics

    Martian05/13/2020 at 15:15 0 comments

    On Logisim:

    On virtual CPU:


  • Sample Program

    Martian05/13/2020 at 13:12 0 comments

    I use the following program to print the text from Edgar Allan Poe's The Raven from RAM to the TTY output, it loops until system reset.

    $0000 loads the hex number #1000 into register R0
    $0002 loads the hex number #0001 into register R1
    $0004 load value of register R0 into register R3
    $0005 output R3 to I/O channel 0 (TTY)
    $0006 into R0 add R1
    $0007 jump back to address $0004
    

     Assembled program:

    0000     1400 1000      LDW R0, #1000   
    0002     1410 0001      LDW R1, #0001   
    0004     1230 ----      LDW R3, $R0   
    0005     4230 ----      PUT R3, @0   
    0006     8001 ----      ADD R0, R1   
    0007     7000 0004      JMP $0004   
    0009     0000 ----      HLT 

     'The Raven' text encoded from address $1000 onwards (below is an example):

    1000      0045  0064  0067  0061  0072  0020  0041  006C 
    1008      006C  0061  006E  0020  0050  006F  0065  000D 
    
    ...etc...

  • CPU Instructions

    Martian05/13/2020 at 12:48 1 comment

    The instruction decoder takes the 16-bit contents of the Instruction Register, 12-bit microcodes determine which control signals are sent out to operate the various parts of the CPU and computer.

  • Computer Layout

    Martian05/13/2020 at 12:36 0 comments

    Here is an overall layout for a complete computer.  The CPU is connected to selectable RAM and ROM memory, the current address and word are displayed on 7-seg LEDs.  There are 16 separate I/O channels, connected are a keyboard, a TTY display and a LED matrix for simple graphics.

    Some additional peripherals can be added later, a data storage device and speaker are planned.

  • CPU

    Martian05/13/2020 at 12:30 0 comments

  • Instruction Decoder

    Martian05/13/2020 at 12:27 1 comment

    Instruction Decoder

  • Register File

    Martian05/13/2020 at 12:26 0 comments

  • ALU

    Martian05/13/2020 at 12:25 0 comments

    ALU

  • CPU-16 Final Design

    Martian05/13/2020 at 12:10 0 comments

    First I'd like to thank people who have contacted me, liked, followed or asked to join the project.  I'd like to everyone who has given me advice and helped me learn something new.

    After a hiatus, I have finalised the design for my 16-bit CPU.  I had to rework it as I moved from Logisim to Logisim Evolution.  I'm going to upload the diagrams, starting with the ALU, then the Register File, Instruction decoder then the actual CPU and a working computer based around it.  Then I will give an example program, instruction set etc. etc.

    More to follow....

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

View all 12 project logs

Enjoy this project?

Share

Discussions

jsriesen wrote 01/22/2022 at 12:28 point

Hi, I am trying to teach myself how the circuits in computers work for the CPU I am attempting to recreate your circuit but for a 64 bit CPU I was wondering if I could run some of my subcircuits past you to get your opinion on them.

  Are you sure? yes | no

gothic.clown wrote 03/03/2021 at 07:06 point

Well done, why didn't anyone leave a message?Is the project continuing?

  Are you sure? yes | no

Martian wrote 09/22/2021 at 21:51 point

Hi, there has been a lot of comments and messages.  They seemed to vanish when I deleted and re-wrote the Project Log entries.

The project is more or less complete.  The CPU appears to work and no more major changes will be made to that, only the overall system.

I moved the project from Logisim to Logisim Evolution but found the performance to be unacceptable, so I have gone back to the original Logisim and I will make some updates to this site when I can.

  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