Shift_C

sail-arm's definition a32.sail

val Shift_C : forall 'N 'amount, 'N >= 0.
  (bits('N), SRType, int('amount), bits(1)) -> (bits('N), bits(1))

function Shift_C (value_name, srtype, amount, carry_in) = {
    assert(not_bool(srtype == SRType_RRX & amount != 1));
    result : bits('N) = undefined;
    carry_out : bits(1) = undefined;
    if amount == 0 then {
        (result, carry_out) = (value_name, carry_in)
    } else {
        match srtype {
          SRType_LSL => {
              (result, carry_out) = LSL_C(value_name, amount)
          },
          SRType_LSR => {
              (result, carry_out) = LSR_C(value_name, amount)
          },
          SRType_ASR => {
              assert(constraint(('N >= 0 & 'amount >= 0)));
              (result, carry_out) = ASR_C(value_name, amount)
          },
          SRType_ROR => {
              assert(constraint('N > 0));
              (result, carry_out) = ROR_C(value_name, amount)
          },
          SRType_RRX => {
              assert(constraint('N > 1));
              (result, carry_out) = RRX_C(value_name, carry_in)
          }
        }
    };
    return((result, carry_out))
}

Used by


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.