mcore-opc.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /* Assembler instructions for Motorola's Mcore processor
  2. Copyright (C) 1999-2022 Free Software Foundation, Inc.
  3. This file is part of the GNU opcodes library.
  4. This library is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. It is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  11. License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  15. MA 02110-1301, USA. */
  16. #include "ansidecl.h"
  17. typedef enum
  18. {
  19. O0, OT, O1, OC, O2, X1, OI, OB,
  20. OMa, SI, I7, LS, BR, BL, LR, LJ,
  21. RM, RQ, JSR, JMP, OBRa, OBRb, OBRc, OBR2,
  22. O1R1, OMb, OMc, SIa,
  23. MULSH, OPSR,
  24. JC, JU, JL, RSI, DO21, OB2
  25. }
  26. mcore_opclass;
  27. typedef struct inst
  28. {
  29. const char * name;
  30. mcore_opclass opclass;
  31. unsigned char transfer;
  32. unsigned short inst;
  33. }
  34. mcore_opcode_info;
  35. #ifdef DEFINE_TABLE
  36. const mcore_opcode_info mcore_table[] =
  37. {
  38. { "bkpt", O0, 0, 0x0000 },
  39. { "sync", O0, 0, 0x0001 },
  40. { "rte", O0, 1, 0x0002 },
  41. { "rfe", O0, 1, 0x0002 },
  42. { "rfi", O0, 1, 0x0003 },
  43. { "stop", O0, 0, 0x0004 },
  44. { "wait", O0, 0, 0x0005 },
  45. { "doze", O0, 0, 0x0006 },
  46. { "idly4", O0, 0, 0x0007 },
  47. { "trap", OT, 0, 0x0008 },
  48. /* SPACE: 0x000C - 0x000F */
  49. /* SPACE: 0x0010 - 0x001F */
  50. { "mvc", O1, 0, 0x0020 },
  51. { "mvcv", O1, 0, 0x0030 },
  52. { "ldq", RQ, 0, 0x0040 },
  53. { "stq", RQ, 0, 0x0050 },
  54. { "ldm", RM, 0, 0x0060 },
  55. { "stm", RM, 0, 0x0070 },
  56. { "dect", O1, 0, 0x0080 },
  57. { "decf", O1, 0, 0x0090 },
  58. { "inct", O1, 0, 0x00A0 },
  59. { "incf", O1, 0, 0x00B0 },
  60. { "jmp", JMP, 2, 0x00C0 },
  61. #define MCORE_INST_JMP 0x00C0
  62. { "jsr", JSR, 0, 0x00D0 },
  63. #define MCORE_INST_JSR 0x00E0
  64. { "ff1", O1, 0, 0x00E0 },
  65. { "brev", O1, 0, 0x00F0 },
  66. { "xtrb3", X1, 0, 0x0100 },
  67. { "xtrb2", X1, 0, 0x0110 },
  68. { "xtrb1", X1, 0, 0x0120 },
  69. { "xtrb0", X1, 0, 0x0130 },
  70. { "zextb", O1, 0, 0x0140 },
  71. { "sextb", O1, 0, 0x0150 },
  72. { "zexth", O1, 0, 0x0160 },
  73. { "sexth", O1, 0, 0x0170 },
  74. { "declt", O1, 0, 0x0180 },
  75. { "tstnbz", O1, 0, 0x0190 },
  76. { "decgt", O1, 0, 0x01A0 },
  77. { "decne", O1, 0, 0x01B0 },
  78. { "clrt", O1, 0, 0x01C0 },
  79. { "clrf", O1, 0, 0x01D0 },
  80. { "abs", O1, 0, 0x01E0 },
  81. { "not", O1, 0, 0x01F0 },
  82. { "movt", O2, 0, 0x0200 },
  83. { "mult", O2, 0, 0x0300 },
  84. { "loopt", BL, 0, 0x0400 },
  85. { "subu", O2, 0, 0x0500 },
  86. { "sub", O2, 0, 0x0500 }, /* Official alias. */
  87. { "addc", O2, 0, 0x0600 },
  88. { "subc", O2, 0, 0x0700 },
  89. /* SPACE: 0x0800-0x08ff for a diadic operation */
  90. /* SPACE: 0x0900-0x09ff for a diadic operation */
  91. { "movf", O2, 0, 0x0A00 },
  92. { "lsr", O2, 0, 0x0B00 },
  93. { "cmphs", O2, 0, 0x0C00 },
  94. { "cmplt", O2, 0, 0x0D00 },
  95. { "tst", O2, 0, 0x0E00 },
  96. { "cmpne", O2, 0, 0x0F00 },
  97. { "mfcr", OC, 0, 0x1000 },
  98. { "psrclr", OPSR, 0, 0x11F0 },
  99. { "psrset", OPSR, 0, 0x11F8 },
  100. { "mov", O2, 0, 0x1200 },
  101. { "bgenr", O2, 0, 0x1300 },
  102. { "rsub", O2, 0, 0x1400 },
  103. { "ixw", O2, 0, 0x1500 },
  104. { "and", O2, 0, 0x1600 },
  105. { "xor", O2, 0, 0x1700 },
  106. { "mtcr", OC, 0, 0x1800 },
  107. { "asr", O2, 0, 0x1A00 },
  108. { "lsl", O2, 0, 0x1B00 },
  109. { "addu", O2, 0, 0x1C00 },
  110. { "add", O2, 0, 0x1C00 }, /* Official alias. */
  111. { "ixh", O2, 0, 0x1D00 },
  112. { "or", O2, 0, 0x1E00 },
  113. { "andn", O2, 0, 0x1F00 },
  114. { "addi", OI, 0, 0x2000 },
  115. #define MCORE_INST_ADDI 0x2000
  116. { "cmplti", OI, 0, 0x2200 },
  117. { "subi", OI, 0, 0x2400 },
  118. /* SPACE: 0x2600-0x27ff open for a register+immediate operation */
  119. { "rsubi", OB, 0, 0x2800 },
  120. { "cmpnei", OB, 0, 0x2A00 },
  121. { "bmaski", OMa, 0, 0x2C00 },
  122. { "divu", O1R1, 0, 0x2C10 },
  123. /* SPACE: 0x2c20 - 0x2c7f */
  124. { "bmaski", OMb, 0, 0x2C80 },
  125. { "bmaski", OMc, 0, 0x2D00 },
  126. { "andi", OB, 0, 0x2E00 },
  127. { "bclri", OB, 0, 0x3000 },
  128. /* SPACE: 0x3200 - 0x320f */
  129. { "divs", O1R1, 0, 0x3210 },
  130. /* SPACE: 0x3220 - 0x326f */
  131. { "bgeni", OBRa, 0, 0x3270 },
  132. { "bgeni", OBRb, 0, 0x3280 },
  133. { "bgeni", OBRc, 0, 0x3300 },
  134. { "bseti", OB, 0, 0x3400 },
  135. { "btsti", OB, 0, 0x3600 },
  136. { "xsr", O1, 0, 0x3800 },
  137. { "rotli", SIa, 0, 0x3800 },
  138. { "asrc", O1, 0, 0x3A00 },
  139. { "asri", SIa, 0, 0x3A00 },
  140. { "lslc", O1, 0, 0x3C00 },
  141. { "lsli", SIa, 0, 0x3C00 },
  142. { "lsrc", O1, 0, 0x3E00 },
  143. { "lsri", SIa, 0, 0x3E00 },
  144. /* SPACE: 0x4000 - 0x5fff */
  145. { "movi", I7, 0, 0x6000 },
  146. #define MCORE_INST_BMASKI_ALT 0x6000
  147. #define MCORE_INST_BGENI_ALT 0x6000
  148. { "mulsh", MULSH, 0, 0x6800 },
  149. { "muls.h", MULSH, 0, 0x6800 },
  150. /* SPACE: 0x6900 - 0x6FFF */
  151. { "jmpi", LJ, 1, 0x7000 },
  152. { "jsri", LJ, 0, 0x7F00 },
  153. #define MCORE_INST_JMPI 0x7000
  154. { "lrw", LR, 0, 0x7000 },
  155. #define MCORE_INST_JSRI 0x7F00
  156. { "ld", LS, 0, 0x8000 },
  157. { "ldw", LS, 0, 0x8000 },
  158. { "ld.w", LS, 0, 0x8000 },
  159. { "st", LS, 0, 0x9000 },
  160. { "stw", LS, 0, 0x9000 },
  161. { "st.w", LS, 0, 0x9000 },
  162. { "ldb", LS, 0, 0xA000 },
  163. { "ld.b", LS, 0, 0xA000 },
  164. { "stb", LS, 0, 0xB000 },
  165. { "st.b", LS, 0, 0xB000 },
  166. { "ldh", LS, 0, 0xC000 },
  167. { "ld.h", LS, 0, 0xC000 },
  168. { "sth", LS, 0, 0xD000 },
  169. { "st.h", LS, 0, 0xD000 },
  170. { "bt", BR, 0, 0xE000 },
  171. { "bf", BR, 0, 0xE800 },
  172. { "br", BR, 1, 0xF000 },
  173. #define MCORE_INST_BR 0xF000
  174. { "bsr", BR, 0, 0xF800 },
  175. #define MCORE_INST_BSR 0xF800
  176. /* The following are relaxable branches */
  177. { "jbt", JC, 0, 0xE000 },
  178. { "jbf", JC, 0, 0xE800 },
  179. { "jbr", JU, 1, 0xF000 },
  180. { "jbsr", JL, 0, 0xF800 },
  181. /* The following are aliases for other instructions */
  182. { "rts", O0, 2, 0x00CF }, /* jmp r15 */
  183. { "rolc", DO21, 0, 0x0600 }, /* addc rd,rd */
  184. { "rotlc", DO21, 0, 0x0600 }, /* addc rd,rd */
  185. { "setc", O0, 0, 0x0C00 }, /* cmphs r0,r0 */
  186. { "clrc", O0, 0, 0x0F00 }, /* cmpne r0,r0 */
  187. { "tstle", O1, 0, 0x2200 }, /* cmplti rd,1 */
  188. { "cmplei", OB, 0, 0x2200 }, /* cmplei rd,X -> cmplti rd,X+1 */
  189. { "neg", O1, 0, 0x2800 }, /* rsubi rd,0 */
  190. { "tstne", O1, 0, 0x2A00 }, /* cmpnei rd,0 */
  191. { "tstlt", O1, 0, 0x37F0 }, /* btsti rx,31 */
  192. { "mclri", OB2, 0, 0x3000 }, /* bclri rx,log2(imm) */
  193. { "mgeni", OBR2, 0, 0x3200 }, /* bgeni rx,log2(imm) */
  194. { "mseti", OB2, 0, 0x3400 }, /* bseti rx,log2(imm) */
  195. { "mtsti", OB2, 0, 0x3600 }, /* btsti rx,log2(imm) */
  196. { "rori", RSI, 0, 0x3800 },
  197. { "rotri", RSI, 0, 0x3800 },
  198. { "nop", O0, 0, 0x1200 }, /* mov r0, r0 */
  199. };
  200. #endif