OpCode32SimdMemSingle.cs 1.7 KB

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