A full-stack RISC-V assembler with a modern web-based visualizer. Write assembly code, assemble it to machine code, and step through execution line by line.
- RISC-V Assembler (C++) — Translates
.asmsource files to.mcmachine code files - Web Visualizer (React + Vite) — Syntax-highlighted assembly editor with side-by-side machine code output
- Line-by-line Execution — Step forward/backward through instructions, or use Auto Run with adjustable speed
- Animated Progress Bar — Live execution progress with current PC address
- Copy to Clipboard — One-click copy of the full machine code output
- ISA Reference Panel — Expandable quick-reference listing all supported instructions
- Syntax Highlighting — Keywords, registers, immediates, and labels are color-coded in the editor view
| Format | Instructions |
|---|---|
| R-Type | add, sub, and, or, xor, sll, srl, sra, slt, mul, div, rem, addw, subw, mulw, divw, remw |
| I-Type | addi, andi, ori, addiw, lb, lh, lw, ld, jalr |
| S-Type | sb, sh, sw, sd |
| B-Type | beq, bne, blt, bge |
| U-Type | lui, auipc |
| J-Type | jal |
| System | ecall |
Assembler/
├── assembly.cpp # RISC-V assembler source (C++)
├── assembler # Compiled assembler binary
├── input.asm # Input assembly file (written by server on each request)
├── output.mc # Output machine code file
├── server/
│ └── index.js # Express API server — runs assembler binary and returns output
├── src/
│ ├── App.jsx # React frontend — editor, visualizer, controls
│ ├── styles.css # Dark theme UI styles
│ └── main.jsx # React entry point
├── package.json
└── vite.config.js
- Node.js v18+ and npm
- g++ (C++17) to (re)compile the assembler
git clone https://github.com/hima1323/Assembler.git
cd Assemblernpm installThe pre-built assembler binary is included. If you want to recompile from source:
g++ -std=c++17 -O2 -o assembler assembly.cppnpm run devThis starts both servers concurrently:
- Vite frontend →
http://localhost:5173 - Express API server →
http://localhost:5050
Open http://localhost:5173 in your browser.
- Write your RISC-V assembly code in the editor panel (left side)
- Click Assemble — the code is sent to the server, assembled by the C++ binary, and the machine code appears on the right
- Step through instructions using
← Prev/Next →, or use ▶ Run for automatic execution - Adjust speed with the Speed selector (Slow / Normal / Fast / Turbo)
- Copy the machine code output with the Copy button
- ISA Reference — click the button in the controls bar to toggle the instruction reference panel
.text
addi x1, x0, 10
addi x2, x0, 5
add x3, x1, x2
beq x1, x2, end
sub x4, x1, x2
end:
ecall- Comments start with
# - Labels end with
: - Directives:
.text,.data,.word,.space,.string,.asciiz,.align - Registers:
x0–x31, or ABI aliases (zero,ra,sp,gp,tp,t0–t6,s0–s11,a0–a7,fp) - Immediates: decimal (
42), hex (0xFF), binary (0b1010), or character ('A') - Load/Store:
lw x1, 4(x2)— offset(base) syntax - JALR: supports both
jalr rd, rs1, immandjalr rd, imm(rs1)
| Layer | Technology |
|---|---|
| Assembler backend | C++17 |
| API server | Node.js + Express |
| Frontend framework | React 18 + Vite 5 |
| Styling | Vanilla CSS (dark glassmorphism theme) |
| Fonts | Inter + JetBrains Mono (Google Fonts) |
MIT