-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Once the execution loop works need to implement the instruction handlers for arithmetic (ADD, SUB, ADDI, MUL, DIV, DIVU, REM, REMU, LUI, AUIPC), logic (AND, ANDI, OR, ORI, XOR, XORI, SLL, SLLI, SRL, SRLI, SRA, SRAI), comparison (SLT, SLTU, SLTI, SLTIU), and memory (loads LB/LH/LW/LBU/LHU, stores SB/SH/SW).
Most are straightforward like ADD is just rd = rs1 + rs2 but watch out for register x0 always reading as 0 and ignoring writes, division by zero should set rd to -1 (or 0 for unsigned, check spec), shifts mask amount to 5 bits (0-31), loads/stores need bounds and alignment checking, sign extension vs zero extension for loads. Test overflow/underflow, edge cases like shift by 0 or 31, signed vs unsigned comparisons. Needs execution loop from #6