OpCode32SimdMemSingle.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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);
  17. public OpCode32SimdMemSingle(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
  18. {
  19. Vd = (opCode >> 12) & 0xf;
  20. Vd |= (opCode >> 18) & 0x10;
  21. IndexAlign = (opCode >> 4) & 0xf;
  22. Size = (opCode >> 10) & 0x3;
  23. Replicate = Size == 3;
  24. if (Replicate)
  25. {
  26. Size = (opCode >> 6) & 0x3;
  27. Increment = ((opCode >> 5) & 1) + 1;
  28. Index = 0;
  29. }
  30. else
  31. {
  32. Increment = (((IndexAlign >> Size) & 1) == 0) ? 1 : 2;
  33. Index = IndexAlign >> (1 + Size);
  34. }
  35. Rm = (opCode >> 0) & 0xf;
  36. Rn = (opCode >> 16) & 0xf;
  37. WBack = Rm != RegisterAlias.Aarch32Pc;
  38. RegisterIndex = Rm != RegisterAlias.Aarch32Pc && Rm != RegisterAlias.Aarch32Sp;
  39. }
  40. }
  41. }