OpCode32SimdMemPair.cs 1.6 KB

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