From 9540a78e3ebd318ebb476025abab1b951d61f14e Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sun, 18 Apr 2021 00:51:28 +0200 Subject: [PATCH] added CPU docs --- docs/CPU.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/CPU.md diff --git a/docs/CPU.md b/docs/CPU.md new file mode 100644 index 0000000..e3a6668 --- /dev/null +++ b/docs/CPU.md @@ -0,0 +1,13 @@ +# The CPU + +The CPU emulates some RISC-V instructions: + + * all loads/stores: `lb, lh, lw, lbu, lhu, sw, sh, sb` + * supported arg format is either `rd, imm(reg)` or `reg, reg, imm` + * all branch statements: `beq, bne, blt, bge, bltu, bgeu` + * all jumps `j, jal, jalr, ret` + * basic arithmetic: `add, addi, sub` (not `lui, auipc`) + * shifts: `sll, slli, srl, srli, sra, srai` + * `scall, ecall, sbreak, ebreak` (both `s` and `e` version are the same instrcution) + * compares (non immediate): `slt, sltu`, not `slti, sltiu` + * logiacl (non immediate): `and, or, xor` not (`andi, ori, xori`)