MOV (immediate)

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

fixed bit field field the encoding fixes should be

A1

313029282726252423222120191817161514131211109876543210
cond0011101S0000Rdimm12

xxxx0011101x0000xxxxxxxxxxxxxxxx
cond != 1111

Decode Sail

if ConditionPassed() then {
    assert(cond != 0b1111);
    carry : bits(1) = undefined;
    imm32 : bits(32) = undefined;
    let 'd = UInt(Rd);
    let setflags : bool = S == 0b1;
    (imm32, carry) = A32ExpandImm_C(imm12, PSTATE.C);
    execute_aarch32_instrs_MOV_i_Op_A_txt(carry, d, imm32, setflags)
};
()

A2

313029282726252423222120191817161514131211109876543210
cond00110000imm4Rdimm12

xxxx00110000xxxxxxxxxxxxxxxxxxxx
cond != 1111

Decode Sail

if ConditionPassed() then {
    assert(cond != 0b1111);
    carry : bits(1) = undefined;
    let 'd = UInt(Rd);
    let setflags : bool = false;
    let imm32 : bits(32) = ZeroExtend(imm4 @ imm12, 32);
    if d == 15 then {
        throw(Error_Unpredictable())
    };
    let carry = carry;
    execute_aarch32_instrs_MOV_i_Op_A_txt(carry, d, imm32, setflags)
};
()

T1

1514131211109876543210
00100Rdimm8

00100xxxxxxxxxxx

Decode Sail

if ConditionPassed() then {
    let 'd = UInt(Rd);
    let setflags : bool = not_bool(InITBlock());
    let imm32 : bits(32) = ZeroExtend(imm8, 32);
    let carry : bits(1) = PSTATE.C;
    execute_aarch32_instrs_MOV_i_Op_A_txt(carry, d, imm32, setflags)
};
()

Operation Sail

let result : bits(32) = imm32;
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.