source: rtems/bsps/mips/shared/gdbstub/mips_opcode.h @ 828276b

5
Last change on this file since 828276b was 828276b, checked in by Sebastian Huber <sebastian.huber@…>, on 03/05/19 at 06:58:18

bsps: Adjust shared Doxygen groups

Update #3706.

  • Property mode set to 100644
File size: 6.7 KB
Line 
1/**
2 * @file
3 * @ingroup
4 * @brief Instruction formats and opcode values for MIPS
5 */
6
7/*
8 * Copyright (c) 1992 The Regents of the University of California.
9 * All rights reserved.
10 *
11 * This code is derived from software contributed to Berkeley by
12 * Ralph Campbell.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 *    notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 *    notice, this list of conditions and the following disclaimer in the
21 *    documentation and/or other materials provided with the distribution.
22 * 3. All advertising materials mentioning features or use of this software
23 *    must display the following acknowledgement:
24 *      This product includes software developed by the University of
25 *      California, Berkeley and its contributors.
26 * 4. Neither the name of the University nor the names of its contributors
27 *    may be used to endorse or promote products derived from this software
28 *    without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * SUCH DAMAGE.
41 *
42 * from: @(#)mips_opcode.h      7.1 (Berkeley) 3/19/92
43 * via: mips_opcode.h,v 1.1 1994/03/10 16:15:10 (algorithmics)
44 */
45
46/*
47 * Define the instruction formats and opcode values for the
48 * MIPS instruction set.
49 */
50
51#ifndef _MIPS_OPCODE_H
52#define _MIPS_OPCODE_H
53
54/**
55 * @defgroup mips_ops MIPS Opcodes
56 * @ingroup RTEMSBSPsMIPSShared
57 * @brief MIPS Instruction Formats and Opcode Values
58 * @{
59 */
60
61/**
62 * @name Instruction formats
63 * @{
64 */
65
66typedef union {
67    unsigned word;
68
69#ifdef MIPSEL
70    struct {
71        unsigned imm: 16;
72        unsigned rt: 5;
73        unsigned rs: 5;
74        unsigned op: 6;
75    } IType;
76
77    struct {
78        unsigned target: 26;
79        unsigned op: 6;
80    } JType;
81
82    struct {
83        unsigned func: 6;
84        unsigned shamt: 5;
85        unsigned rd: 5;
86        unsigned rt: 5;
87        unsigned rs: 5;
88        unsigned op: 6;
89    } RType;
90
91    struct {
92        unsigned func: 6;
93        unsigned fd: 5;
94        unsigned fs: 5;
95        unsigned ft: 5;
96        unsigned fmt: 4;
97        unsigned : 1;           /* always '1' */
98        unsigned op: 6;         /* always '0x11' */
99    } FRType;
100#else
101    struct {
102        unsigned op: 6;
103        unsigned rs: 5;
104        unsigned rt: 5;
105        unsigned imm: 16;
106    } IType;
107
108    struct {
109        unsigned op: 6;
110        unsigned target: 26;
111    } JType;
112
113    struct {
114        unsigned op: 6;
115        unsigned rs: 5;
116        unsigned rt: 5;
117        unsigned rd: 5;
118        unsigned shamt: 5;
119        unsigned func: 6;
120    } RType;
121
122    struct {
123        unsigned op: 6;         /* always '0x11' */
124        unsigned : 1;           /* always '1' */
125        unsigned fmt: 4;
126        unsigned func: 6;
127        unsigned ft: 5;
128        unsigned fs: 5;
129        unsigned fd: 5;
130    } FRType;
131#endif
132} InstFmt;
133
134/** @} */
135
136/**
137 * @name 'op' field values
138 * @{
139 */
140
141#define OP_SPECIAL      000
142#define OP_REGIMM       001
143#define OP_J            002
144#define OP_JAL          003
145#define OP_BEQ          004
146#define OP_BNE          005
147#define OP_BLEZ         006
148#define OP_BGTZ         007
149
150#define OP_ADDI         010
151#define OP_ADDIU        011
152#define OP_SLTI         012
153#define OP_SLTIU        013
154#define OP_ANDI         014
155#define OP_ORI          015
156#define OP_XORI         016
157#define OP_LUI          017
158
159#define OP_COP0         020
160#define OP_COP1         021
161#define OP_COP2         022
162#define OP_BEQL         024
163#define OP_BNEL         025
164#define OP_BLEZL        026
165#define OP_BGTZL        027
166
167#define OP_DADDI        030
168#define OP_DADDIU       031
169#define OP_LDL          032
170#define OP_LDR          033
171
172#define OP_LB           040
173#define OP_LH           041
174#define OP_LWL          042
175#define OP_LW           043
176#define OP_LBU          044
177#define OP_LHU          045
178#define OP_LWR          046
179#define OP_LWU          047
180
181#define OP_SB           050
182#define OP_SH           051
183#define OP_SWL          052
184#define OP_SW           053
185#define OP_SDL          054
186#define OP_SDR          055
187#define OP_SWR          056
188#define OP_CACHE        057
189
190#define OP_LL           060
191#define OP_LWC1         061
192#define OP_LWC2         062
193#define OP_LLD          064
194#define OP_LDC1         065
195#define OP_LDC2         066
196#define OP_LD           067
197
198#define OP_SC           070
199#define OP_SWC1         071
200#define OP_SWC2         072
201#define OP_SCD          074
202#define OP_SDC1         075
203#define OP_SDC2         076
204#define OP_SD           077
205
206/**
207 * @name 'func' field values when 'op' == OP_SPECIAL.
208 * @{
209 */
210
211#define OP_SLL          000
212#define OP_SRL          002
213#define OP_SRA          003
214#define OP_SLLV         004
215#define OP_SRLV         006
216#define OP_SRAV         007
217
218#define OP_JR           010
219#define OP_JALR         011
220#define OP_SYSCALL      014
221#define OP_BREAK        015
222#define OP_SYNC         017
223
224#define OP_MFHI         020
225#define OP_MTHI         021
226#define OP_MFLO         022
227#define OP_MTLO         023
228#define OP_DSLLV        024
229#define OP_DSRLV        026
230#define OP_DSRAV        027
231
232#define OP_MULT         030
233#define OP_MULTU        031
234#define OP_DIV          032
235#define OP_DIVU         033
236#define OP_DMULT        034
237#define OP_DMULTU       035
238#define OP_DDIV         036
239#define OP_DDIVU        037
240
241#define OP_ADD          040
242#define OP_ADDU         041
243#define OP_SUB          042
244#define OP_SUBU         043
245#define OP_AND          044
246#define OP_OR           045
247#define OP_XOR          046
248#define OP_NOR          047
249
250#define OP_SLT          052
251#define OP_SLTU         053
252#define OP_DADD         054
253#define OP_DADDU        055
254#define OP_DSUB         056
255#define OP_DSUBU        057
256
257#define OP_TGE          060
258#define OP_TGEU         061
259#define OP_TLT          062
260#define OP_TLTU         063
261#define OP_TEQ          064
262#define OP_TNE          066
263
264#define OP_DSLL         070
265#define OP_DSRL         072
266#define OP_DSRA         073
267#define OP_DSLL32       074
268#define OP_DSRL32       076
269#define OP_DSRA32       077
270
271/** @} */
272
273/**
274 * 'func' field values when 'op' == OP_REGIMM.
275 * @{
276 */
277
278#define OP_BLTZ         000
279#define OP_BGEZ         001
280#define OP_BLTZL        002
281#define OP_BGEZL        003
282
283#define OP_TGEI         010
284#define OP_TGEIU        011
285#define OP_TLTI         012
286#define OP_TLTIU        013
287#define OP_TEQI         014
288#define OP_TNEI         016
289
290#define OP_BLTZAL       020
291#define OP_BGEZAL       021
292#define OP_BLTZALL      022
293#define OP_BGEZALL      023
294
295/** @} */
296
297/**
298 * @name 'rs' field values when 'op' == OP_COPz.
299 * @{
300 */
301
302#define OP_MF           000
303#define OP_DMF          001
304#define OP_CF           002
305#define OP_MT           004
306#define OP_DMT          005
307#define OP_CT           006
308#define OP_BC           010
309
310/** @} */
311
312/**
313 * @name 'rt' field values when 'op' == OP_COPz and 'rt' == OP_BC.
314 * @{
315 */
316
317#define COPz_BCF        0x00
318#define COPz_BCT        0x01
319#define COPz_BCFL       0x02
320#define COPz_BCTL       0x03
321
322/** @} */
323
324/**
325 * @name Instructions with specal significance to debuggers.
326 * @{
327 */
328
329#define BREAK_INSTR     0x0000000d      ///< @brief instruction code for break
330#define NOP_INSTR       0x00000000      ///< @brief instruction code for no-op
331
332/** @} */
333
334/** @} */
335
336#endif  /* _MIPS_OPCODE_H */
Note: See TracBrowser for help on using the repository browser.