Simplistic RISC-V emulator
Go to file
2021-04-18 19:33:39 +02:00
.idea parsing of tokenized asm into MemorySections works 2021-04-17 13:39:56 +02:00
docs stack allocation now fixed 2021-04-18 12:55:57 +02:00
examples fixed isinstance check in write syscall 2021-04-18 18:39:32 +02:00
riscemu syscall symbols now work as global symbols 2021-04-18 19:30:25 +02:00
test added basic tests 2021-04-18 00:57:53 +02:00
.gitignore initial commit 2021-04-16 23:52:13 +02:00
fibs.asm stack allocation now fixed 2021-04-18 12:55:57 +02:00
LICENSE now officially MIT licensed 2021-04-18 19:33:39 +02:00
README.md readme rework 2021-04-18 02:07:37 +02:00
requirements.txt initial commit 2021-04-16 23:52:13 +02:00
run.py minor bugfixes and missing members corrected 2021-04-18 00:09:26 +02:00

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