Skip to content

Commit 1527aba

Browse files
committed
feat(decode): implement shift instructions
1 parent ee2bf29 commit 1527aba

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sim/src/decode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ void decode_exec(Decode *s){
8686
INSTPAT("??????? ????? ????? 010 ????? 00100 11", slti , I, R(rd) = (int64_t)src1 < (int64_t)imm);
8787
INSTPAT("??????? ????? ????? 011 ????? 00100 11", sltiu , I, R(rd) = src1 < imm);
8888
// SLLI, SRLI, SRAI
89+
INSTPAT("0000000 ????? ????? 001 ????? 00100 11", slli , I, R(rd) = src1 << (imm & 0x3f));
90+
INSTPAT("0000000 ????? ????? 101 ????? 00100 11", srli , I, R(rd) = src1 >> (imm & 0x3f));
91+
INSTPAT("0100000 ????? ????? 101 ????? 00100 11", srai , I, R(rd) = (int64_t)src1 >> (imm & 0x3f));
8992
// XORI, ORI, ANDI
9093
// ADDIW
9194
// SLLI, SRLI, SRAI, SLLIW, SRLIW, SRAIW

0 commit comments

Comments
 (0)