val ShiftReg : forall 'N 'amount 'reg,
'N in {8, 16, 32, 64}.
(int('reg), ShiftType, int('amount), int('N)) -> bits('N)
function ShiftReg (reg, shiftype, amount, N) = {
result : bits('N) = X_read(reg, N);
match shiftype {
ShiftType_LSL => {
result = LSL(result, amount)
},
ShiftType_LSR => {
result = LSR(result, amount)
},
ShiftType_ASR => {
result = ASR(result, amount)
},
ShiftType_ROR => {
assert(constraint(('N > 0 & 'amount >= 0)));
result = ROR(result, amount)
}
};
return(result)
}
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.