Skip to content

Commit

Permalink
riscv_base: Implement Zicond interpreting
Browse files Browse the repository at this point in the history
- This extension isn't checked by riscv-tests yet
- Couldn't observe any usage of it when building Buildroot with zicond in march string
- No JIT support yet
- TODO: Test this properly
  • Loading branch information
LekKit committed Mar 27, 2024
1 parent 1f41839 commit fc406a9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cpu/riscv_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ static forceinline void riscv_emulate_i_opc_op(rvvm_hart_t* vm, const uint32_t i
case 0x30: // ror (Zbb)
riscv_write_reg(vm, rds, bit_rotr(reg1, reg2 & bit_mask(SHAMT_BITS)));
return;
case 0x7: // czero.eqz (Zicond)
riscv_write_reg(vm, rds, reg2 ? reg1 : 0);
return;
}
break;
case 0x6:
Expand Down Expand Up @@ -589,6 +592,9 @@ static forceinline void riscv_emulate_i_opc_op(rvvm_hart_t* vm, const uint32_t i
case 0x5: // maxu (Zbb)
riscv_write_reg(vm, rds, EVAL_MAX(reg1, reg2));
return;
case 0x7: // czero.nez (Zicond)
riscv_write_reg(vm, rds, reg2 ? 0 : reg1);
return;
}
break;
}
Expand Down

0 comments on commit fc406a9

Please sign in to comment.