A 32-bit RISC-V CPU emulator and assembler, built from scratch in C++, with a browser-based interface for writing, assembling, running and debugging RISC-V assembly.
Features:
- Full RV32I base instruction set + M extension
- Step-by-step or continuous execution on a live CPU emulator
- Live register file, memory-mapped framebuffer views
- Console I/O via RARS-style RISC-V
ecallsyscalls (integer, string, character) - Integrated terminal for runtime I/O
- Isolated server-side CPU instance per session
- Built-in docs, example programs, and an MCP-powered AI assistant
To run locally you need to have the following installed:
-
uv: Python package/project manager (handles the AI backend's dependencies):curl -LsSf https://astral.sh/uv/install.sh | sh -
crow: C++ HTTP micro-framework for the backend server. Install it system-wide so the Makefile can find the headers:- macOS (Homebrew):
brew install crow - Linux:
.debfile from the main repo - Windows: not tested, it is recommended to use emulation tools like WSL
- macOS (Homebrew):
-
npm: Node.js package manager (ships with Node.js; used for the frontend) -
.env(optional): copy.env.exampleto a new file named.envand setOLLAMA_MODELto be the pulled model (see below).GEMINI_API_KEYis only needed for the Gemini fallback. -
ollama(optional): local LLM runtime for the AI assistant. Install from https://ollama.com, then pull a model, e.g.:ollama pull qwen2.5:7b
Build from scratch after downloading dependencies.
git clone https://github.com/NomadAvian/MonoC-CPU-Emulator
cd "MonoC-CPU-Emulator"
chmod +x start_monoc.sh
./start_monoc.sh Then open http://localhost:5173 in your browser.
You can also use MonoC via Docker. For detailed guide check hosting & usage guide.
- Emulator: C++20 from-scratch RV32 core (fetch / decode / execute), ALU with the M-extension, sparse unified RAM hosting a memory-mapped framebuffer
- Assembler: Supports pseudo-instructions, labels, data directives and predefined constants (e.g. SCREEN).
- Backend: Crow C++ REST server; each client session owns an isolated
SessionInstance(CPU + per-session ROM + console I/O payload) managed by a thread-safe session registry. - Frontend:
React+Vitesingle-page app;Zustandstores for editor/emulator/console/memory state, CodeMirror editor (@uiw/react-codemirror),motionfor panel animations. - AI Service: Python
FastAPImicroservice running user-configurable local LLM viaOllamaorGeminiAPI, connected to the emulator throughMCP serverso it can inspect live CPU state. - Deployment: Containerized with
Dockerand deployed on VPS usingCaddyas reverse proxy withCI/CD.


