OpCode32SimdMovGpElem.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. namespace ARMeilleure.Decoders
  2. {
  3. class OpCode32SimdMovGpElem : OpCode32, IOpCode32Simd
  4. {
  5. public int Size { get; }
  6. public int Vd { get; }
  7. public int Rt { get; }
  8. public int Op { get; }
  9. public bool U { get; }
  10. public int Index { get; }
  11. public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdMovGpElem(inst, address, opCode, false);
  12. public static OpCode CreateT32(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdMovGpElem(inst, address, opCode, true);
  13. public OpCode32SimdMovGpElem(InstDescriptor inst, ulong address, int opCode, bool isThumb) : base(inst, address, opCode)
  14. {
  15. IsThumb = isThumb;
  16. Op = (opCode >> 20) & 0x1;
  17. U = ((opCode >> 23) & 1) != 0;
  18. var opc = (((opCode >> 23) & 1) << 4) | (((opCode >> 21) & 0x3) << 2) | ((opCode >> 5) & 0x3);
  19. if ((opc & 0b01000) == 0b01000)
  20. {
  21. Size = 0;
  22. Index = opc & 0x7;
  23. }
  24. else if ((opc & 0b01001) == 0b00001)
  25. {
  26. Size = 1;
  27. Index = (opc >> 1) & 0x3;
  28. }
  29. else if ((opc & 0b11011) == 0)
  30. {
  31. Size = 2;
  32. Index = (opc >> 2) & 0x1;
  33. }
  34. else
  35. {
  36. Instruction = InstDescriptor.Undefined;
  37. return;
  38. }
  39. Vd = ((opCode >> 3) & 0x10) | ((opCode >> 16) & 0xf);
  40. Rt = (opCode >> 12) & 0xf;
  41. }
  42. }
  43. }