A RISC-V assembler and simulator implementation that converts RISC-V assembly code to binary and simulates its execution.
assembler_project.py: The RISC-V assembler implementation that converts assembly instructions to binary formatsimulator.py: A RISC-V instruction set simulator that executes binary instructions
- Supports RISC-V RV32I base integer instruction set
- Converts assembly instructions to 32-bit binary format
- Handles various instruction formats (R-type, I-type, S-type, B-type, U-type)
- Supports register mapping for all 32 RISC-V registers
- Emulates RISC-V instruction execution
- Maintains register file (32 general-purpose registers)
- Implements memory management with code and stack segments
- Supports instruction execution with proper state tracking
- Provides debugging capabilities through state dumps
The assembler and simulator support the following RISC-V instructions:
- Arithmetic:
add,sub,slt,sltu - Logical:
and,or,xor - Memory:
lw,sw - Control Flow:
beq,bne,blt,jal,jalr - Immediate:
addi
- Write your RISC-V assembly code
- Use the assembler to convert it to binary
- Run the simulator to execute the binary instructions
- Python 3.x
This project is open source and available for educational purposes.