TARA CPU Simulator — 16-bit RISC teaching architecture (CS2300 at IIT Madras)
Project description
TARA CPU Simulator (CS2300 at IIT Madras)
A full-featured desktop simulator for the TARA (Teaching Architecture for RISC Assembly) ISA from CS2300 taught at IIT Madras, refer https://cse.iitm.ac.in/~ayon/courses/CS2300/CS2300.html
License
Copyright (C) 2026 Ayon Chakraborty, IIT Madras. All rights reserved.
This project is licensed under the GNU General Public License, version 3 or later
(GPL-3.0-or-later). See LICENSE.
Features
- Syntax-highlighted assembly editor with line numbers and 6 built-in example programs
- One-click assembler with error reporting
- Machine code listing with hex + colored binary fields, synchronized to PC
- Register file view — 8 registers in a 4x2 visual bank, with change highlighting
- Memory viewer — browse all 2 KB of byte-addressable memory, with optional Matplotlib colormap heatmap
- Display panel — 64x64 memory-mapped raster with 1-bit packed pixels and directional input byte
- Instruction decode panel — shows format, fields, and human-readable effect
- Execution log — per-instruction trace with register changes
- Step / Run / Stop / Reset controls
- Save Machine State / Boot State controls for pausing and continuing later
- Variable clock — 1 Hz to max speed via presets or custom frequency, adjustable while running
How to Run
pip install PyQt5 matplotlib
python3 run_sim.py
# or as a package:
python3 -m src.run_sim
Classroom Font Settings
The editor, machine-code listing, memory heatmap matrix, and register file use larger classroom-friendly defaults. You can also edit config/ui_settings.json before starting the simulator:
{
"base_font_size": 14,
"editor_font_size": 15,
"listing_font_size": 12,
"memory_font_size": 12,
"register_font_size": 16
}
The editor, listing, and memory matrix also have A- / A+ controls in the UI; those changes are saved back to the config file.
Project Layout
src/
assembler/ TARA assembler
simulation/ CPU core and ISA behavior
ui/ PyQt application, panels, theme, dialogs
examples/ bundled example programs
assets/logo/ application logos
config/
memory/ memory CSV dumps
cpu_state/ machine-state JSON dumps
Workflow
- Write or load assembly code in the editor (left panel)
- Click ⚙ Assemble & Load — errors appear below the editor
- Use ⏭ Step to execute one instruction at a time
- Or click ▶ Run with a chosen clock frequency
- Watch registers, memory, listing highlight, and the decode panel update in real time
- Click 💾 Save Machine State to write registers, PC, memory, counters, and source to JSON
- Later click ⤴ Boot State to restore the JSON state and continue computation
- Click ↺ Reset to reload the program and start over
TARA ISA Quick Reference
| Format | Instructions | Encoding |
|---|---|---|
| F0 | NOP, HLT, RET | op[15:11] 00000000000 |
| F1 | ADD, SUB, MUL, AND, OR, XOR, SLT | op rd rsA rsB 00 |
| F2 | MOV, NOT | op rd rs 00000 |
| F3 | LIL, LIH, ADDI, SHL, SHR | op rd imm8 |
| F4 | LDW, STW, LDB, STB | op rdata rbase off5 |
| F5 | BZ, BN | op rtest rel8 |
| F6 | JMP, CALL | op rel11 |
| F7 | PUSH, POP | op rstk 00000000 |
Memory Map
| Range | Use |
|---|---|
| 0x000–0x3FF | Program code |
| 0x400–0x4FF | Data / arrays |
| 0x500–0x5FE | Stack (R7) |
| 0x5FF | Display keyboard byte: bit0=left, bit1=right, bit2=up, bit3=down |
| 0x600–0x7FF | Display framebuffer, 64x64 pixels, 1 bit per pixel, 8 pixels per byte. Pixel values: 0 off, 1 on. |
Register Conventions
| Reg | Convention |
|---|---|
| R0–R5 | General purpose |
| R6 | Link register (CALL/RET) |
| R7 | Stack pointer (PUSH/POP) |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file taracpu-1.0.2.tar.gz.
File metadata
- Download URL: taracpu-1.0.2.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87a0051e3c383f888b401973aaaf0f6d19c7b13a343475d95e2245189c4d7f06
|
|
| MD5 |
840f86cedf7a64fc3bf7193e03352168
|
|
| BLAKE2b-256 |
8c126b14adf415f863fbe66bc226df0aa0a917d496f54fe520b003d071b6127c
|
File details
Details for the file taracpu-1.0.2-py3-none-any.whl.
File metadata
- Download URL: taracpu-1.0.2-py3-none-any.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df08e784de63bba149258d540107ea40fa9e84bd5bced1113899de5235b0ede4
|
|
| MD5 |
e942b2101670fe9712c4b3fc4939934f
|
|
| BLAKE2b-256 |
13afb7b5c9519027a8f10e336d11ba67abf130d47deb7f6d7cf0111b7c654c1a
|