aboutsummaryrefslogtreecommitdiff
path: root/src/ARMeilleure/Decoders/OpCodeAluRs.cs
blob: 9498333630aefc3beb01d7a699055c1cc6faf664 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespace ARMeilleure.Decoders
{
    class OpCodeAluRs : OpCodeAlu, IOpCodeAluRs
    {
        public int Shift { get; }
        public int Rm    { get; }

        public ShiftType ShiftType { get; }

        public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeAluRs(inst, address, opCode);

        public OpCodeAluRs(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
        {
            int shift = (opCode >> 10) & 0x3f;

            if (shift >= GetBitsCount())
            {
                Instruction = InstDescriptor.Undefined;

                return;
            }

            Shift = shift;

            Rm        =             (opCode >> 16) & 0x1f;
            ShiftType = (ShiftType)((opCode >> 22) & 0x3);
        }
    }
}