feat: add custom b-type instruction (jump)
This commit is contained in:
@@ -98,6 +98,18 @@ inline void tinyriscv_custom_I_type(const u8 funct3, const u8 funct7, u32* x,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
__attribute__((always_inline))
|
||||||
|
inline void tinyriscv_custom_B_type(const u8 funct3, const u32* x, u32* pc,
|
||||||
|
const u8 rs1, const u8 rs2, const i16 imm){
|
||||||
|
|
||||||
|
switch(funct3){
|
||||||
|
case /*CUSTOM bitcomp*/ 0: if((x[rs1] ^ 0x7C) != x[rs2]) *pc += (i32)imm - 4; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
__attribute__((always_inline))
|
__attribute__((always_inline))
|
||||||
@@ -213,6 +225,9 @@ void tinyriscv_step(tinyriscv_core* core){
|
|||||||
case /*Custom-I-type*/ 0x0B:
|
case /*Custom-I-type*/ 0x0B:
|
||||||
tinyriscv_custom_I_type(funct3, funct7, core->x, rd, rs1, imm_i, rs2);
|
tinyriscv_custom_I_type(funct3, funct7, core->x, rd, rs1, imm_i, rs2);
|
||||||
break;
|
break;
|
||||||
|
case /*Custom-I-type*/ 0x2B:
|
||||||
|
tinyriscv_custom_B_type(funct3, core->x, &core->pc, rs1, rs2, imm_b);
|
||||||
|
break;
|
||||||
case /*R-type*/ 0x33:
|
case /*R-type*/ 0x33:
|
||||||
tinyriscv_R_type(funct3, funct7, core->x, rd, rs1, rs2);
|
tinyriscv_R_type(funct3, funct7, core->x, rd, rs1, rs2);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user