OpCode32SimdMemPair.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using ARMeilleure.State;
  2. using System;
  3. namespace ARMeilleure.Decoders
  4. {
  5. class OpCode32SimdMemPair : OpCode32, IOpCode32Simd
  6. {
  7. private static int[] RegsMap =
  8. {
  9. 1, 1, 4, 2,
  10. 1, 1, 3, 1,
  11. 1, 1, 2, 1,
  12. 1, 1, 1, 1
  13. };
  14. public int Vd { get; }
  15. public int Rn { get; }
  16. public int Rm { get; }
  17. public int Align { get; }
  18. public bool WBack { get; }
  19. public bool RegisterIndex { get; }
  20. public int Size { get; }
  21. public int Elems => 8 >> Size;
  22. public int Regs { get; }
  23. public int Increment { get; }
  24. public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdMemPair(inst, address, opCode);
  25. public OpCode32SimdMemPair(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
  26. {
  27. Vd = (opCode >> 12) & 0xf;
  28. Vd |= (opCode >> 18) & 0x10;
  29. Size = (opCode >> 6) & 0x3;
  30. Align = (opCode >> 4) & 0x3;
  31. Rm = (opCode >> 0) & 0xf;
  32. Rn = (opCode >> 16) & 0xf;
  33. WBack = Rm != RegisterAlias.Aarch32Pc;
  34. RegisterIndex = Rm != RegisterAlias.Aarch32Pc && Rm != RegisterAlias.Aarch32Sp;
  35. Regs = RegsMap[(opCode >> 8) & 0xf];
  36. Increment = Math.Min(Regs, ((opCode >> 8) & 0x1) + 1);
  37. }
  38. }
  39. }