Skip to content

Commit

Permalink
Add RV32 restriction for compressed shift instructions
Browse files Browse the repository at this point in the history
The restriction was present for `C.SLLI` but was missing for `C.SRLI` and `C.SRAI`.

The format is copied from `C.SLLI`.

Fixes riscv#356
  • Loading branch information
Timmmm committed Mar 19, 2024
1 parent c287c34 commit d6ff4ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions model/riscv_insts_cext.sail
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ mapping clause assembly = C_LUI(imm, rd)
union clause ast = C_SRLI : (bits(6), cregidx)

mapping clause encdec_compressed = C_SRLI(nzui5 @ nzui40, rsd)
if nzui5 @ nzui40 != 0b000000
if nzui5 @ nzui40 != 0b000000 & (sizeof(xlen) == 64 | nzui5 == 0b0)
<-> 0b100 @ nzui5 : bits(1) @ 0b00 @ rsd : cregidx @ nzui40 : bits(5) @ 0b01
if nzui5 @ nzui40 != 0b000000
if nzui5 @ nzui40 != 0b000000 & (sizeof(xlen) == 64 | nzui5 == 0b0)

function clause execute (C_SRLI(shamt, rsd)) = {
let rsd = creg2reg_idx(rsd);
Expand All @@ -242,9 +242,9 @@ mapping clause assembly = C_SRLI(shamt, rsd)
union clause ast = C_SRAI : (bits(6), cregidx)

mapping clause encdec_compressed = C_SRAI(nzui5 @ nzui40, rsd)
if nzui5 @ nzui40 != 0b000000
if nzui5 @ nzui40 != 0b000000 & (sizeof(xlen) == 64 | nzui5 == 0b0)
<-> 0b100 @ nzui5 : bits(1) @ 0b01 @ rsd : cregidx @ nzui40 : bits(5) @ 0b01
if nzui5 @ nzui40 != 0b000000
if nzui5 @ nzui40 != 0b000000 & (sizeof(xlen) == 64 | nzui5 == 0b0)

function clause execute (C_SRAI(shamt, rsd)) = {
let rsd = creg2reg_idx(rsd);
Expand Down

0 comments on commit d6ff4ee

Please sign in to comment.