diff --git a/src/tinyriscv.h b/src/tinyriscv.h index 6f25b4f..ee52e91 100644 --- a/src/tinyriscv.h +++ b/src/tinyriscv.h @@ -210,47 +210,4 @@ void tinyriscv_step(tinyriscv_hart* hart){ //////////////////////////////////////////////////////////////////////////////// -#endif //TINYRISCV_H - -#ifdef TESTING - -void step(){ - - //func7 and func3 are just bitmasked from the whole inst - - switch(opcode){ - case /*R-type*/ 0x33: - - switch(func3){ - case /*ADDI*/ 0x0: x[rd] = x[rs1] + (i32)imm; break; - case /*SLTI*/ 0x2000: x[rd] = (i32)x[rs1] < (i32)imm; break; - case /*SLTIU*/ 0x3000: x[rd] = x[rs1] < (u32)(i32)imm; break; - case /*XORI*/ 0x4000: x[rd] = x[rs1] ^ (i32)imm; break; - case /*ORI*/ 0x6000: x[rd] = x[rs1] | (i32)imm; break; - case /*ANDI*/ 0x7000: x[rd] = x[rs1] & (i32)imm; break; - default: - switch(funct7 | funct3){ - case /*SLLI*/ 0x1000: x[rd] = x[rs1] << rs2; break; - case /*SRLI*/ 0x5000: x[rd] = x[rs1] >> rs2; break; - case /*SRAI*/ 0x40005000: x[rd] = (i32)x[rs1] >> rs2; break; - } - } - - //TODO put this in inline functions , R-type() etc - - switch(funct7 | funct3){ - case /*ADD*/ 0x0: x[rd] = x[rs1] + x[rs2]; break; - case /*SUB*/ 0x40000000: x[rd] = x[rs1] - x[rs2]; break; - case /*SLL*/ 0x1000: x[rd] = x[rs1] << (x[rs2] & 0x1f); break; - case /*SLT*/ 0x2000: x[rd] = (i32)x[rs1] < (i32)x[rs2]; break; - case /*SLTU*/ 0x3000: x[rd] = x[rs1] < x[rs2]; break; - case /*XOR*/ 0x4000: x[rd] = x[rs1] ^ x[rs2]; break; - case /*SRL*/ 0x5000: x[rd] = x[rs1] >> (x[rs2] & 0x1f); break; - case /*SRA*/ 0x40005000: x[rd] = (i32)x[rs1] >> (x[rs2] & 0x1f); break; - case /*OR*/ 0x6000: x[rd] = x[rs1] | x[rs2]; break; - case /*AND*/ 0x7000: x[rd] = x[rs1] & x[rs2]; break; - } - } -} - -#endif \ No newline at end of file +#endif //TINYRISCV_H \ No newline at end of file