aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Decoders/OpCodeSimd.cs
blob: 85713690a7f5d8ce4b5f8a9e26ca64789cf53bd2 (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
namespace ARMeilleure.Decoders
{
    class OpCodeSimd : OpCode, IOpCodeSimd
    {
        public int Rd   { get; }
        public int Rn   { get; }
        public int Opc  { get; }
        public int Size { get; protected set; }

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

        public OpCodeSimd(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
        {
            Rd   = (opCode >>  0) & 0x1f;
            Rn   = (opCode >>  5) & 0x1f;
            Opc  = (opCode >> 15) & 0x3;
            Size = (opCode >> 22) & 0x3;

            RegisterSize = ((opCode >> 30) & 1) != 0
                ? RegisterSize.Simd128
                : RegisterSize.Simd64;
        }
    }
}