| 1 |
17 |
khays |
/* TI C6X instruction format information.
|
| 2 |
|
|
Copyright 2010
|
| 3 |
|
|
Free Software Foundation, Inc.
|
| 4 |
|
|
|
| 5 |
|
|
This program is free software; you can redistribute it and/or modify
|
| 6 |
|
|
it under the terms of the GNU General Public License as published by
|
| 7 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
| 8 |
|
|
(at your option) any later version.
|
| 9 |
|
|
|
| 10 |
|
|
This program is distributed in the hope that it will be useful,
|
| 11 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
|
|
GNU General Public License for more details.
|
| 14 |
|
|
|
| 15 |
|
|
You should have received a copy of the GNU General Public License
|
| 16 |
|
|
along with this program; if not, write to the Free Software
|
| 17 |
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
| 18 |
|
|
MA 02110-1301, USA. */
|
| 19 |
|
|
|
| 20 |
|
|
/* Define the FMT macro before including this file; it takes a name
|
| 21 |
|
|
and the fields from tic6x_insn_format (defined in tic6x.h). */
|
| 22 |
|
|
|
| 23 |
|
|
#define FLD(name, pos, width) { CONCAT2(tic6x_field_,name), (pos), (width) }
|
| 24 |
|
|
#define CFLDS FLD(p, 0, 1), FLD(creg, 29, 3), FLD(z, 28, 1)
|
| 25 |
|
|
#define CFLDS2(a, b) 5, { CFLDS, a, b }
|
| 26 |
|
|
#define CFLDS3(a, b, c) 6, { CFLDS, a, b, c }
|
| 27 |
|
|
#define CFLDS4(a, b, c, d) 7, { CFLDS, a, b, c, d }
|
| 28 |
|
|
#define CFLDS5(a, b, c, d, e) 8, { CFLDS, a, b, c, d, e }
|
| 29 |
|
|
#define CFLDS6(a, b, c, d, e, f) 9, { CFLDS, a, b, c, d, e, f }
|
| 30 |
|
|
#define CFLDS7(a, b, c, d, e, f, g) 10, { CFLDS, a, b, c, d, e, f, g }
|
| 31 |
|
|
#define CFLDS8(a, b, c, d, e, f, g, h) 11, { CFLDS, a, b, c, d, e, f, g, h }
|
| 32 |
|
|
#define NFLDS FLD(p, 0, 1)
|
| 33 |
|
|
#define NFLDS1(a) 2, { NFLDS, a }
|
| 34 |
|
|
#define NFLDS2(a, b) 3, { NFLDS, a, b }
|
| 35 |
|
|
#define NFLDS3(a, b, c) 4, { NFLDS, a, b, c }
|
| 36 |
|
|
#define NFLDS5(a, b, c, d, e) 6, { NFLDS, a, b, c, d, e }
|
| 37 |
|
|
#define NFLDS6(a, b, c, d, e, f) 7, { NFLDS, a, b, c, d, e, f }
|
| 38 |
|
|
#define NFLDS7(a, b, c, d, e, f, g) 8, { NFLDS, a, b, c, d, e, f, g }
|
| 39 |
|
|
|
| 40 |
|
|
/* These are in the order from SPRUFE8, appendices C-H. */
|
| 41 |
|
|
|
| 42 |
|
|
/* Appendix C 32-bit formats. */
|
| 43 |
|
|
|
| 44 |
|
|
FMT(d_1_or_2_src, 32, 0x40, 0x7c,
|
| 45 |
|
|
CFLDS5(FLD(s, 1, 1), FLD(op, 7, 6), FLD(src1, 13, 5), FLD(src2, 18, 5),
|
| 46 |
|
|
FLD(dst, 23, 5)))
|
| 47 |
|
|
FMT(d_ext_1_or_2_src, 32, 0x830, 0xc3c,
|
| 48 |
|
|
CFLDS6(FLD(s, 1, 1), FLD(op, 6, 4), FLD(x, 12, 1), FLD(src1, 13, 5),
|
| 49 |
|
|
FLD(src2, 18, 5), FLD(dst, 23, 5)))
|
| 50 |
|
|
FMT(d_load_store, 32, 0x4, 0xc,
|
| 51 |
|
|
CFLDS8(FLD(s, 1, 1), FLD(op, 4, 3), FLD(y, 7, 1), FLD(r, 8, 1),
|
| 52 |
|
|
FLD(mode, 9, 4), FLD(offsetR, 13, 5), FLD(baseR, 18, 5),
|
| 53 |
|
|
FLD(srcdst, 23, 5)))
|
| 54 |
|
|
/* The nonaligned loads and stores have the formats shown in the
|
| 55 |
|
|
individual instruction descriptions; the appendix is incorrect. */
|
| 56 |
|
|
FMT(d_load_nonaligned, 32, 0x124, 0x17c,
|
| 57 |
|
|
CFLDS7(FLD(s, 1, 1), FLD(y, 7, 1), FLD(mode, 9, 4), FLD(offsetR, 13, 5),
|
| 58 |
|
|
FLD(baseR, 18, 5), FLD(sc, 23, 1), FLD(dst, 24, 4)))
|
| 59 |
|
|
FMT(d_store_nonaligned, 32, 0x174, 0x17c,
|
| 60 |
|
|
CFLDS7(FLD(s, 1, 1), FLD(y, 7, 1), FLD(mode, 9, 4), FLD(offsetR, 13, 5),
|
| 61 |
|
|
FLD(baseR, 18, 5), FLD(sc, 23, 1), FLD(src, 24, 4)))
|
| 62 |
|
|
FMT(d_load_store_long, 32, 0xc, 0xc,
|
| 63 |
|
|
CFLDS5(FLD(s, 1, 1), FLD(op, 4, 3), FLD(y, 7, 1), FLD(offsetR, 8, 15),
|
| 64 |
|
|
FLD(dst, 23, 5)))
|
| 65 |
|
|
FMT(d_adda_long, 32, 0x1000000c, 0xf000000c,
|
| 66 |
|
|
NFLDS5(FLD(s, 1, 1), FLD(op, 4, 3), FLD(y, 7, 1), FLD(offsetR, 8, 15),
|
| 67 |
|
|
FLD(dst, 23, 5)))
|
| 68 |
|
|
|
| 69 |
|
|
/* Appendix C 16-bit formats will go here. */
|
| 70 |
|
|
|
| 71 |
|
|
/* Appendix D 32-bit formats. */
|
| 72 |
|
|
|
| 73 |
|
|
FMT(l_1_or_2_src, 32, 0x18, 0x1c,
|
| 74 |
|
|
CFLDS6(FLD(s, 1, 1), FLD(op, 5, 7), FLD(x, 12, 1), FLD(src1, 13, 5),
|
| 75 |
|
|
FLD(src2, 18, 5), FLD(dst, 23, 5)))
|
| 76 |
|
|
FMT(l_1_or_2_src_noncond, 32, 0x10000018, 0xf000001c,
|
| 77 |
|
|
NFLDS6(FLD(s, 1, 1), FLD(op, 5, 7), FLD(x, 12, 1), FLD(src1, 13, 5),
|
| 78 |
|
|
FLD(src2, 18, 5), FLD(dst, 23, 5)))
|
| 79 |
|
|
FMT(l_unary, 32, 0x358, 0xffc,
|
| 80 |
|
|
CFLDS5(FLD(s, 1, 1), FLD(x, 12, 1), FLD(op, 13, 5), FLD(src2, 18, 5),
|
| 81 |
|
|
FLD(dst, 23, 5)))
|
| 82 |
|
|
|
| 83 |
|
|
/* Appendix D 16-bit formats will go here. */
|
| 84 |
|
|
|
| 85 |
|
|
/* Appendix E 32-bit formats. */
|
| 86 |
|
|
|
| 87 |
|
|
FMT(m_compound, 32, 0x30, 0x83c,
|
| 88 |
|
|
CFLDS6(FLD(s, 1, 1), FLD(op, 6, 5), FLD(x, 12, 1), FLD(src1, 13, 5),
|
| 89 |
|
|
FLD(src2, 18, 5), FLD(dst, 23, 5)))
|
| 90 |
|
|
FMT(m_1_or_2_src, 32, 0x10000030, 0xf000083c,
|
| 91 |
|
|
NFLDS6(FLD(s, 1, 1), FLD(op, 6, 5), FLD(x, 12, 1), FLD(src1, 13, 5),
|
| 92 |
|
|
FLD(src2, 18, 5), FLD(dst, 23, 5)))
|
| 93 |
|
|
/* Contrary to SPRUFE8, this does have predicate fields. */
|
| 94 |
|
|
FMT(m_unary, 32, 0xf0, 0xffc,
|
| 95 |
|
|
CFLDS5(FLD(s, 1, 1), FLD(x, 12, 1), FLD(op, 13, 5), FLD(src2, 18, 5),
|
| 96 |
|
|
FLD(dst, 23, 5)))
|
| 97 |
|
|
|
| 98 |
|
|
/* M-unit formats missing from Appendix E. */
|
| 99 |
|
|
FMT(m_mpy, 32, 0x0, 0x7c,
|
| 100 |
|
|
CFLDS6(FLD(s, 1, 1), FLD(op, 7, 5), FLD(x, 12, 1), FLD(src1, 13, 5),
|
| 101 |
|
|
FLD(src2, 18, 5), FLD(dst, 23, 5)))
|
| 102 |
|
|
|
| 103 |
|
|
/* Appendix E 16-bit formats will go here. */
|
| 104 |
|
|
|
| 105 |
|
|
/* Appendix F 32-bit formats. */
|
| 106 |
|
|
|
| 107 |
|
|
FMT(s_1_or_2_src, 32, 0x20, 0x3c,
|
| 108 |
|
|
CFLDS6(FLD(s, 1, 1), FLD(op, 6, 6), FLD(x, 12, 1), FLD(src1, 13, 5),
|
| 109 |
|
|
FLD(src2, 18, 5), FLD(dst, 23 ,5)))
|
| 110 |
|
|
FMT(s_ext_1_or_2_src, 32, 0xc30, 0xc3c,
|
| 111 |
|
|
CFLDS6(FLD(s, 1, 1), FLD(op, 6, 4), FLD(x, 12, 1), FLD(src1, 13, 5),
|
| 112 |
|
|
FLD(src2, 18, 5), FLD(dst, 23, 5)))
|
| 113 |
|
|
FMT(s_ext_1_or_2_src_noncond, 32, 0xc30, 0xe0000c3c,
|
| 114 |
|
|
NFLDS7(FLD(s, 1, 1), FLD(op, 6, 4), FLD(x, 12, 1), FLD(src1, 13, 5),
|
| 115 |
|
|
FLD(src2, 18, 5), FLD(dst, 23, 5), FLD(z, 28, 1)))
|
| 116 |
|
|
FMT(s_unary, 32, 0xf20, 0xffc,
|
| 117 |
|
|
CFLDS5(FLD(s, 1, 1), FLD(x, 12, 1), FLD(op, 13, 5), FLD(src2, 18, 5),
|
| 118 |
|
|
FLD(dst, 23, 5)))
|
| 119 |
|
|
FMT(s_ext_branch_cond_imm, 32, 0x10, 0x7c,
|
| 120 |
|
|
CFLDS2(FLD(s, 1, 1), FLD(cst, 7, 21)))
|
| 121 |
|
|
FMT(s_call_imm_nop, 32, 0x10, 0xe000007c,
|
| 122 |
|
|
NFLDS3(FLD(s, 1, 1), FLD(cst, 7, 21), FLD(z, 28, 1)))
|
| 123 |
|
|
FMT(s_branch_nop_cst, 32, 0x120, 0x1ffc,
|
| 124 |
|
|
CFLDS3(FLD(s, 1, 1), FLD(src1, 13, 3), FLD(src2, 16, 12)))
|
| 125 |
|
|
FMT(s_branch_nop_reg, 32, 0x800360, 0xf830ffc,
|
| 126 |
|
|
CFLDS4(FLD(s, 1, 1), FLD(x, 12, 1), FLD(src1, 13, 3), FLD(src2, 18, 5)))
|
| 127 |
|
|
FMT(s_branch, 32, 0x360, 0xf83effc,
|
| 128 |
|
|
CFLDS3(FLD(s, 1, 1), FLD(x, 12, 1), FLD(src2, 18, 5)))
|
| 129 |
|
|
FMT(s_mvk, 32, 0x28, 0x3c,
|
| 130 |
|
|
CFLDS4(FLD(s, 1, 1), FLD(h, 6, 1), FLD(cst, 7, 16), FLD(dst, 23, 5)))
|
| 131 |
|
|
FMT(s_field, 32, 0x8, 0x3c,
|
| 132 |
|
|
CFLDS6(FLD(s, 1, 1), FLD(op, 6, 2), FLD(cstb, 8, 5), FLD(csta, 13, 5),
|
| 133 |
|
|
FLD(src2, 18, 5), FLD(dst, 23, 5)))
|
| 134 |
|
|
|
| 135 |
|
|
/* S-unit formats missing from Appendix F. */
|
| 136 |
|
|
FMT(s_addk, 32, 0x50, 0x7c,
|
| 137 |
|
|
CFLDS3(FLD(s, 1, 1), FLD(cst, 7, 16), FLD(dst, 23, 5)))
|
| 138 |
|
|
FMT(s_addkpc, 32, 0x160, 0x1ffc,
|
| 139 |
|
|
CFLDS4(FLD(s, 1, 1), FLD(src2, 13, 3), FLD(src1, 16, 7), FLD(dst, 23, 5)))
|
| 140 |
|
|
FMT(s_b_irp, 32, 0x1800e0, 0x7feffc,
|
| 141 |
|
|
CFLDS3(FLD(s, 1, 1), FLD(x, 12, 1), FLD(dst, 23, 5)))
|
| 142 |
|
|
FMT(s_b_nrp, 32, 0x1c00e0, 0x7feffc,
|
| 143 |
|
|
CFLDS3(FLD(s, 1, 1), FLD(x, 12, 1), FLD(dst, 23, 5)))
|
| 144 |
|
|
FMT(s_bdec, 32, 0x1020, 0x1ffc,
|
| 145 |
|
|
CFLDS3(FLD(s, 1, 1), FLD(src, 13, 10), FLD(dst, 23, 5)))
|
| 146 |
|
|
FMT(s_bpos, 32, 0x20, 0x1ffc,
|
| 147 |
|
|
CFLDS3(FLD(s, 1, 1), FLD(src, 13, 10), FLD(dst, 23, 5)))
|
| 148 |
|
|
|
| 149 |
|
|
/* Appendix F 16-bit formats will go here. */
|
| 150 |
|
|
|
| 151 |
|
|
/* Appendix G 16-bit formats will go here. */
|
| 152 |
|
|
|
| 153 |
|
|
/* Appendix H 32-bit formats. */
|
| 154 |
|
|
|
| 155 |
|
|
FMT(nfu_loop_buffer, 32, 0x00020000, 0x00021ffc,
|
| 156 |
|
|
CFLDS4(FLD(s, 1, 1), FLD(op, 13, 4), FLD(csta, 18, 5), FLD(cstb, 23, 5)))
|
| 157 |
|
|
/* Corrected relative to Appendix H. */
|
| 158 |
|
|
FMT(nfu_nop_idle, 32, 0x00000000, 0xfffe1ffc,
|
| 159 |
|
|
NFLDS2(FLD(s, 1, 1), FLD(op, 13, 4)))
|
| 160 |
|
|
|
| 161 |
|
|
/* No-unit formats missing from Appendix H (given the NOP and IDLE
|
| 162 |
|
|
correction). */
|
| 163 |
|
|
FMT(nfu_dint, 32, 0x10004000, 0xfffffffc,
|
| 164 |
|
|
NFLDS1(FLD(s, 1, 1)))
|
| 165 |
|
|
FMT(nfu_rint, 32, 0x10006000, 0xfffffffc,
|
| 166 |
|
|
NFLDS1(FLD(s, 1, 1)))
|
| 167 |
|
|
FMT(nfu_swe, 32, 0x10000000, 0xfffffffc,
|
| 168 |
|
|
NFLDS1(FLD(s, 1, 1)))
|
| 169 |
|
|
FMT(nfu_swenr, 32, 0x10002000, 0xfffffffc,
|
| 170 |
|
|
NFLDS1(FLD(s, 1, 1)))
|
| 171 |
|
|
/* Although formally covered by the loop buffer format, the fields in
|
| 172 |
|
|
that format are not useful for all such instructions and not all
|
| 173 |
|
|
instructions can be predicated. */
|
| 174 |
|
|
FMT(nfu_spkernel, 32, 0x00034000, 0xf03ffffc,
|
| 175 |
|
|
NFLDS2(FLD(s, 1, 1), FLD(fstgfcyc, 22, 6)))
|
| 176 |
|
|
FMT(nfu_spkernelr, 32, 0x00036000, 0xfffffffc,
|
| 177 |
|
|
NFLDS1(FLD(s, 1, 1)))
|
| 178 |
|
|
FMT(nfu_spmask, 32, 0x00020000, 0xfc021ffc,
|
| 179 |
|
|
NFLDS3(FLD(s, 1, 1), FLD(op, 13, 4), FLD(mask, 18, 8)))
|
| 180 |
|
|
|
| 181 |
|
|
/* Appendix H 16-bit formats will go here. */
|
| 182 |
|
|
|
| 183 |
|
|
#undef FLD
|
| 184 |
|
|
#undef CFLDS
|
| 185 |
|
|
#undef CFLDS2
|
| 186 |
|
|
#undef CFLDS3
|
| 187 |
|
|
#undef CFLDS4
|
| 188 |
|
|
#undef CFLDS5
|
| 189 |
|
|
#undef CFLDS6
|
| 190 |
|
|
#undef CFLDS7
|
| 191 |
|
|
#undef CFLDS8
|
| 192 |
|
|
#undef NFLDS
|
| 193 |
|
|
#undef NFLDS1
|
| 194 |
|
|
#undef NFLDS2
|
| 195 |
|
|
#undef NFLDS3
|
| 196 |
|
|
#undef NFLDS5
|
| 197 |
|
|
#undef NFLDS6
|
| 198 |
|
|
#undef NFLDS7
|