Simplistic RISC-V emulator
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Go to file
Anton Lydike 09844c8d38 fixed isinstance check in write syscall 4 years ago
.idea parsing of tokenized asm into MemorySections works 4 years ago
docs stack allocation now fixed 4 years ago
examples fixed isinstance check in write syscall 4 years ago
riscemu fixed isinstance check in write syscall 4 years ago
test added basic tests 4 years ago
.gitignore initial commit 4 years ago
README.md readme rework 4 years ago
fibs.asm stack allocation now fixed 4 years ago
requirements.txt initial commit 4 years ago
run.py minor bugfixes and missing members corrected 4 years ago

README.md

RISC-V (userspace) emulator in python

Implementing a basic RISC-V emulator, aimed at being easily extendable.

Currently supported (but not implemented) instructions:

lb, lh, lw, lbu, lhu, sb, sh, sw, sll, slli, srl, srli, sra, 
srai, add, addi, sub, lui, auipc, xor, xori, or, ori, and, 
andi, slt, slti, sltu, sltiu, beq, bne, blt, bge, bltu, bgeu, 
j, jr, jal, jalr, ret, scall, break, nop

See the docs on asembly and the cpu for more detail.

Currently, symbols (such as main:) are looked-up in runtime. This allows for better debugging, I believe.

Basic IO should work, as open, read, write and close are supported for stdin/stdout/stderr and even aribtrary file paths (if enabled)

Resources:

TODO:

  • add global symbol lookup table
  • better pseudo-ops
  • mmu inspect methods