Here I've created a "little" computer architecture with a compiler that can handle any simple task
collatz_conjecture.mp4
It's created by Logisim evolution, a simple simulation program that allows you to design a large project with simple elements such as logic gates (AND, NOR...), multiplexers, registers, etc.
Every component, including ALU, CU, CONTROLLER, and etc. is created by hand
Aside from that architecture, I also created an assembly language with specific commands, so that you can write any simple task with it
Take a look at each of the files we have to better understand how these things work
- myCPU.circ - Logisim file with all of these architectures and circuits
- Instructions.xlsx - In an Excel document, I explained what commands we have and what the options are for operands.
Most commands consist of three parameters: [operation] [operand1] [operand2]
You can also see an example of the collatz_conjecture code (which runs in that video above) with descriptions of each line
- evenOdd.txt - The program is written here.
in this case, I wrote code for the collatz_conjecture problem which suggests that repeating two simple arithmetic operations will eventually result in every positive integer becoming 1.
these operations are
- If the number is even, divide it by two.
- If the number is odd, triple it and add one.
You can find more information in the excel file where I commented on each line of code.
- compilator.ipynb - A Python file that converts a code file into an array that will be written in instructions.txt.
- instructions.txt - This is the code generated by the compiler that should be added to the ram inside Logisim simulation (you can click edit on RAM and paste this hex code there)
- first of all, you need to write assembly code (using instructions excel file) in a text file
- run compiler.py
python compiler.py yourcode.txt outputname.txt
- open myCPU.circ and copy generated outputname.txt code into ram
- enable clock