A turing complete Von-Neumann 8-bit computer build entirely in Logisim Evolution.
On the diagramm below the spatial positon of different modules inside the computer can be seen. Thick lines represent the data flow and thin lines show the clock propagation paths.
In order to be able to experiment and test the 8-bit-compuer the Logisim Evoltuion is required. It is simple:
- Install Logisim Evoltuion on your system.
- Open the 8_bit_computer.circ.
The standard Logisim might work, though this has never been tested.
This computer has a total of 16 byte of RAM and has the following set of assembly instructions:
NOP
->0000
-> No operationLDA X
->0001
-> Load a value from RAM at the addressX
into theA rigister
ADD X
->0010
-> Add a value from RAM at the addressX
to theA rigister
and store it in theA rigister
SUB X
->0011
-> Subtruct a value from RAM at the addressX
fromA rigister
and store it in theA rigister
STA X
->0100
-> Load a value from theA rigister
into RAM at the addressX
LDI X
->0101
-> LoadX
into theA rigister
JMP X
->0110
-> Jump to the instructionX
JC X
->0111
-> Jump to the instructionX
if the carry flag is setJZ X
->1000
-> Jump to the instructionX
if the zero flag is setOUT
->1110
-> Output the contents of theA rigister
HLT
->1111
-> Halt (Not implemented yet)
- Create a file containing your valid assembly instruction ( please think of the the limitaions of the 16-byte RAM)
- Compile it using the
assembly-compiler
:- Make sure you have
RUST
installed on your machine - Navigate to the
assembly-compiler
folder - Compile using the following command
cargo run -- -i <your_assembly_file> -o <output_file_path> -l
- Make sure you have
- Copy the contents of the output file into the RAM module:
- Right click on the
PRAM
- Select
Edit Contents...
. - Select the fist address.
- Paste the contens of your compiled code using
v.3.0 hex
,words
andaddressed
as settings. - Click
Ok
.
- Right click on the
- Set
PRAM
pin to1/High
in order to switch to programmable memory. - Start the clock (cmd + k)
- Set the
MANUAL
pin to1/High
- Set the
RI
pin1/High
- Set the address using the pins
A0
-A3
- Set the assembly opcode (and the
X
if needed) usingD0
-D7
- Puls the clock
High
andLow
(cmd + t) - Repeat for all the other instruction After writing all the instructions and data to the RAM:
- Set the
MANUAL
pin back to0/Low
- Reset the computer using the
RESET
button - Start the clock (cmd + k)
For Control Unit to work correctly it has to be programmed. The code for generatin of the ROM microinstruction is written in C and produces a file called control_unit which has the microcode in it. In most cases one does not have to reprogramm the ROM. In case if it has to be done:
- Modify the microcode_gen.c if needed.
- Compile and run the program.
- Open 8_bit_computer.circ in Logisim Evolution.
- Right click on the Control Unit ROM.
- Select
Edit Contents...
. - Select the fist address.
- Paste the contens of generated control_unit using
v.3.0 hex
,words
andaddressed
as settings. - Click
Ok
.
This project was inspited by the works of Ben Eater and his tutorial series on building an 8-bit breadboard computer!. Some of the designs were take directly from his videos and some were modified. Also some parts of microcode_gen.c were taken from the eeprom-programmer of Ben Eater.