A simple single-cycle processor designed and simulated in Logisim Evolution, built as part of CS 382 at Stevens Institute of Technology. Includes a custom Python assembler that compiles human-readable assembly into hex image files loadable directly into the CPU's instruction memory.
The CPU contains 4 general-purpose registers (x0–x3) and 2 RAM modules (instruction memory and data memory).
- Addition (
ADD) - Subtraction (
SUB) - Load from memory (
LDR) - Store to memory (
STR)
Each instruction supports two operand modes, selected via a mode bit (M):
M = 0→ Immediate operandM = 1→ Register operand
| Instruction | Opcode | Format |
|---|---|---|
| ADD | 00 |
ADD Rt Rn Rm/IMM |
| SUB | 01 |
SUB Rt Rn Rm/IMM |
| LDR | 10 |
LDR Rt Rn Rm/IMM |
| STR | 11 |
STR Rt Rn Rm/IMM |
ADD: | 00 | M | Operand[7:0] | Rd | Rs |
SUB: | 01 | M | Operand[7:0] | Rd | Rs |
LDR: | 10 | M | Operand[7:0] | Rd | Rs |
STR: | 11 | M | Operand[7:0] | Rd | Rs |
Place simulation.py and simulation.txt in the same folder, then run:
python3 simulation.pyThis generates two files:
instruction_mem_img— load into Instruction Memorydata_mem_img— load into Data Memory
Note: Instructions in
simulation.txtare case sensitive.
- Open
JITerry.circin Logisim Evolution - Right-click Instruction Memory → Load Image → select
instruction_mem_img - Right-click Data Memory → Load Image → select
data_mem_img
Cycle through instructions using the clock. When the PC hits 6, inspect the register file to verify output values.
ADD Rd Rn Rm # Rd = Rn + Rm
SUB Rd Rn Rm # Rd = Rn - Rm
LDR Rd Rn Rm # Rd = Mem[Rn + Rm]
STR Rt Rn Rm # Mem[Rn + Rm] = Rt
Immediate values can replace Rm in any instruction.
| File | Description |
|---|---|
JITerry.circ |
Logisim Evolution circuit file |
simulation.py |
Python assembler — compiles .txt assembly to hex images |
simulation.txt |
Sample assembly program |
- Logisim Evolution — circuit design and simulation
- Python 3 — custom assembler
Built by Kritin Rane — Computer Science, Stevens Institute of Technology
I pledge my honor that I have abided by the Stevens Honor System.