val DecodeImmShift : (bits(2), bits(5)) -> (SRType, int)
function DecodeImmShift (srtype, imm5) = {
shift_t : SRType = undefined;
shift_n : range(0, 32) = undefined;
match srtype {
0b00 => {
shift_t = SRType_LSL;
shift_n = UInt(imm5)
},
0b01 => {
shift_t = SRType_LSR;
shift_n = if imm5 == 0b00000 then 32 else UInt(imm5)
},
0b10 => {
shift_t = SRType_ASR;
shift_n = if imm5 == 0b00000 then 32 else UInt(imm5)
},
0b11 => {
if imm5 == 0b00000 then {
shift_t = SRType_RRX;
shift_n = 1
} else {
shift_t = SRType_ROR;
shift_n = UInt(imm5)
}
}
};
let 'shift_n = shift_n;
return((shift_t, shift_n))
}
Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.