aboutsummaryrefslogtreecommitdiff
path: root/src/ARMeilleure/Decoders/OpCodeSimdFmov.cs
blob: 662abe28401eac36580fcdc0e36833819790d7ba (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
30
31
32
namespace ARMeilleure.Decoders
{
    class OpCodeSimdFmov : OpCode, IOpCodeSimd
    {
        public int Rd { get; }
        public long Immediate { get; }
        public int Size { get; }

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

        public OpCodeSimdFmov(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
        {
            int type = (opCode >> 22) & 0x3;

            Size = type;

            long imm;

            Rd = (opCode >> 0) & 0x1f;
            imm = (opCode >> 13) & 0xff;

            if (type == 0)
            {
                Immediate = (long)DecoderHelper.Imm8ToFP32Table[(int)imm];
            }
            else /* if (type == 1) */
            {
                Immediate = (long)DecoderHelper.Imm8ToFP64Table[(int)imm];
            }
        }
    }
}