smartmips.igen 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // -*- C -*-
  2. //
  3. // Simulator definition for the SmartMIPS extensions.
  4. // Copyright (C) 2005-2015 Free Software Foundation, Inc.
  5. // Contributed by Nigel Stephens (nigel@mips.com) and
  6. // David Ung (davidu@mips.com) of MIPS Technologies.
  7. //
  8. // This file is part of GDB, the GNU debugger.
  9. //
  10. // This program is free software; you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation; either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. 011100,5.BASE,5.INDEX,5.RD,00010,001000:SPECIAL:32::LWXS
  23. "lwxs r<RD>, <INDEX>(r<BASE>)"
  24. *smartmips:
  25. {
  26. GPR[RD] = EXTEND32 (do_load(SD_, AccessLength_WORD, GPR[BASE], GPR[INDEX]<<2));
  27. }
  28. 011100,5.RS,5.RT,00000,10001,000001:SPECIAL:32::MADDP
  29. "maddp r<RS>, r<RT>"
  30. *smartmips:
  31. {
  32. unsigned64 res;
  33. unsigned64 rs, rt;
  34. int i;
  35. check_mult_hilo (SD_, HIHISTORY, LOHISTORY);
  36. TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
  37. res = 0;
  38. rs = GPR[RS];
  39. rt = GPR[RT];
  40. for (i = 0; i < 32; i++)
  41. {
  42. if (rs & 1)
  43. res ^= rt;
  44. rs >>= 1;
  45. rt <<= 1;
  46. }
  47. LO ^= EXTEND32 (VL4_8 (res));
  48. HI ^= EXTEND32 (VH4_8 (res));
  49. TRACE_ALU_RESULT2 (HI, LO);
  50. }
  51. 000000,0000000000,5.RD,00001,010010:SPECIAL:32::MFLHXU
  52. "mflhxu r<RD>"
  53. *smartmips:
  54. {
  55. check_mf_hilo (SD_, HIHISTORY, LOHISTORY);
  56. TRACE_ALU_INPUT3 (ACX,HI,LO);
  57. GPR[RD] = LO;
  58. LO = HI;
  59. HI = ACX;
  60. ACX = 0;
  61. TRACE_ALU_RESULT4 (ACX,HI,LO,GPR[RD]);
  62. }
  63. 000000,5.RS,000000000000001,010011:SPECIAL:32::MTLHX
  64. "mtlhx r<RS>"
  65. *smartmips:
  66. {
  67. check_mf_hilo (SD_, HIHISTORY, LOHISTORY);
  68. TRACE_ALU_INPUT3 (HI,LO,GPR[RS]);
  69. ACX = HI;
  70. HI = LO;
  71. LO = GPR[RS];
  72. TRACE_ALU_RESULT4 (ACX,HI,LO,GPR[RS]);
  73. }
  74. 000000,5.RS,5.RT,00000,10001,011001:SPECIAL:32::MULTP
  75. "multp r<RS>, r<RT>"
  76. *smartmips:
  77. {
  78. unsigned64 res;
  79. unsigned64 rs, rt;
  80. int i;
  81. check_mult_hilo (SD_, HIHISTORY, LOHISTORY);
  82. TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]);
  83. res = 0;
  84. rs = GPR[RS];
  85. rt = GPR[RT];
  86. for (i = 0; i < 32; i++)
  87. {
  88. if (rs & 1)
  89. res ^= rt;
  90. rs >>= 1;
  91. rt <<= 1;
  92. }
  93. LO = EXTEND32 (VL4_8 (res));
  94. HI = EXTEND32 (VH4_8 (res));
  95. ACX = 0;
  96. TRACE_ALU_RESULT2 (HI, LO);
  97. }
  98. 011100,5.RS,5.RT,00000,10010,000001:SPECIAL:32::PPERM
  99. "pperm r<RS>, r<RT>"
  100. *smartmips:
  101. {
  102. int i;
  103. ACX = (ACX << 6) | MSEXTRACTED(HI,26,31);
  104. HI = EXTEND32 ((HI << 6) | MSEXTRACTED(LO,26,31));
  105. LO = EXTEND32 (LO << 6);
  106. for (i = 0; i < 6; i++) {
  107. int sbit = 5*i;
  108. int ebit = sbit + 4;
  109. int tbit = EXTRACTED(GPR[RT],sbit,ebit);
  110. LO |= MSEXTRACTED(GPR[RS],tbit,tbit) << i;
  111. }
  112. }