MOV (register)

A32: data processing and miscellaneous instructions / T32: 16-bit instructions

fixed bit field field the encoding fixes should be

A1

313029282726252423222120191817161514131211109876543210
cond0001101S0000Rdimm5stype0Rm

xxxx0001101x0000xxxxxxxxxxx0xxxx
cond != 1111

Decode Sail

if ConditionPassed() then {
    assert(cond != 0b1111);
    shift_n : int = undefined;
    shift_t : SRType = undefined;
    let 'd = UInt(Rd);
    let 'm = UInt(Rm);
    let setflags : bool = S == 0b1;
    (shift_t, shift_n) = DecodeImmShift(stype, imm5);
    let 'shift_n = shift_n;
    execute_aarch32_instrs_MOV_r_Op_A_txt(d, m, setflags, shift_n, shift_t)
};
()

T1

1514131211109876543210
01000110DRmRd

01000110xxxxxxxx

Decode Sail

if ConditionPassed() then {
    shift_n : int = undefined;
    shift_t : SRType = undefined;
    let 'd = UInt(D @ Rd);
    let 'm = UInt(Rm);
    let setflags : bool = false;
    (shift_t, shift_n) = (SRType_LSL, 0);
    let 'shift_n = shift_n;
    if (d == 15 & InITBlock()) & not_bool(LastInITBlock()) then {
        throw(Error_Unpredictable())
    };
    let shift_t = shift_t;
    let shift_n = shift_n;
    execute_aarch32_instrs_MOV_r_Op_A_txt(d, m, setflags, shift_n, shift_t)
};
()

T2

1514131211109876543210
0000000000RmRd

0000000000xxxxxx

Decode Sail

if ConditionPassed() then {
    shift_n : int = undefined;
    shift_t : SRType = undefined;
    let 'd = UInt(Rd);
    let 'm = UInt(Rm);
    let setflags : bool = true;
    (shift_t, shift_n) = (SRType_LSL, 0);
    let 'shift_n = shift_n;
    if InITBlock() then {
        throw(Error_Unpredictable())
    };
    let shift_t = shift_t;
    let shift_n = shift_n;
    execute_aarch32_instrs_MOV_r_Op_A_txt(d, m, setflags, shift_n, shift_t)
};
()

Operation Sail

carry : bits(1) = undefined;
shifted : bits(32) = undefined;
(shifted, carry) = Shift_C(R_read(m), shift_t, shift_n, PSTATE.C);
let result : bits(32) = shifted;
if d == 15 then {
    if setflags then {
        ALUExceptionReturn(result)
    } else {
        ALUWritePC(result)
    }
} else {
    R_set(d) = result;
    if setflags then {
        PSTATE.N = [result[31]];
        PSTATE.Z = IsZeroBit(result);
        PSTATE.C = carry
    };
    ()
}

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.