OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [cpu/] [or32/] [or32.c] - Blame information for rev 1597

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 133 markom
/* Table of opcodes for the OpenRISC 1000 ISA.
2
   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
3
   Contributed by Damjan Lampret (lampret@opencores.org).
4
 
5 717 markom
This file is part of gen_or1k_isa, or1ksim, GDB and GAS.
6 133 markom
 
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
 
21 1114 lampret
/*
22
 * $Log: not supported by cvs2svn $
23 1597 nogj
 * Revision 1.48  2005/11/03 19:01:50  lampret
24
 * Added l.fl1
25
 *
26 1590 lampret
 * Revision 1.47  2005/09/05 08:47:44  nogj
27
 * Fix most warnings issued by gcc4
28
 *
29 1557 nogj
 * Revision 1.46  2005/08/18 22:13:27  phoenix
30
 * fixed l.maci encoding
31
 *
32 1554 phoenix
 * Revision 1.45  2005/04/27 19:13:13  nogj
33
 * l.rfe does not have a delay slot.  Don't mark it as such.
34
 *
35 1475 nogj
 * Revision 1.44  2005/03/31 16:09:57  nogj
36
 * Implement a dynamic recompiler to speed up the execution
37
 *
38 1452 nogj
 * Revision 1.43  2005/03/31 16:01:59  nogj
39
 * Reclasify l.trap and l.sys to be an exception instruction
40
 *
41 1440 nogj
 * Revision 1.42  2005/03/16 12:25:56  nogj
42
 * Fix the parameters to the l.ff1/l.maci instructions
43
 *
44 1384 nogj
 * Revision 1.41  2005/02/09 17:41:03  nogj
45
 * Mark a simulated cpu address as such, by introducing the new oraddr_t type
46
 *
47 1350 nogj
 * Revision 1.40  2005/01/27 14:14:13  nogj
48
 * Remove the global op structure
49
 *
50 1346 nogj
 * Revision 1.39  2005/01/27 13:35:40  nogj
51
 *  * Fix generate.c to produce a execgen.c with less warnings.
52
 *  * Fix the --enable-simple configure option.
53
 *
54 1342 nogj
 * Revision 1.38  2005/01/27 13:15:50  nogj
55
 * Mark wich operand is the destination operand in the architechture definition
56
 *
57 1341 nogj
 * Revision 1.37  2005/01/11 15:41:58  andreje
58
 * l.ff1 instruction added
59
 *
60 1338 andreje
 * Revision 1.36  2004/07/22 20:17:23  phoenix
61
 * removed includes
62
 *
63 1309 phoenix
 * Revision 1.35  2004/07/19 23:07:37  phoenix
64
 * Gyorgy Jeney: extensive cleanup
65
 *
66 1308 phoenix
 * Revision 1.34  2004/06/27 22:56:48  lampret
67
 * Updated instruction set descriptions. Changed FP instructions encoding.
68
 *
69 1295 lampret
 * Revision 1.33  2004/05/09 19:52:31  lampret
70
 * Changed desciption of the l.cust5 insns
71
 *
72 1285 lampret
 * Revision 1.31  2003/07/01 19:34:49  csanchez
73
 * Added support for l.addc instruction.
74
 *
75 1169 csanchez
 * Revision 1.30  2003/01/28 03:49:24  lampret
76
 * Added cvs log keywords
77
 *
78 1114 lampret
 */
79
 
80 133 markom
#include <string.h>
81
#include <stdio.h>
82
#include <stdlib.h>
83 371 markom
#include <ctype.h>
84 133 markom
 
85 371 markom
 
86 138 markom
#ifdef HAVE_CONFIG_H
87
# include "config.h"
88
#endif
89 1342 nogj
#ifdef HAS_EXECUTION
90 1350 nogj
# ifdef HAVE_INTTYPES_H
91
#  include <inttypes.h> /* ...but to get arch.h we need uint{8,16,32}_t... */
92
# endif
93
# include "port.h"
94
# include "arch.h" /* ...but to get abstract.h, we need oraddr_t... */
95
# include "abstract.h" /* To get struct iqueue_entry... */
96 1557 nogj
# include "debug.h" /* To get debug() */
97 1342 nogj
#endif
98 133 markom
#include "opcode/or32.h"
99
 
100
/* **INDENT-OFF** */
101
 
102 1342 nogj
/* We treat all letters the same in encode/decode routines so
103
   we need to assign some characteristics to them like signess etc.*/
104 133 markom
CONST struct or32_letter or32_letters[] =
105
{
106
{ 'A', NUM_UNSIGNED },
107
{ 'B', NUM_UNSIGNED },
108
{ 'D', NUM_UNSIGNED },
109
{ 'I', NUM_SIGNED },
110
{ 'K', NUM_UNSIGNED },
111
{ 'L', NUM_UNSIGNED },
112
{ 'N', NUM_SIGNED },
113
{ '0', NUM_UNSIGNED },
114
{ '\0', 0 }     /* dummy entry */
115
};
116
 
117
/* Opcode encoding:
118
   machine[31:30]: first two bits of opcode
119
                   00 - neither of source operands is GPR
120
                   01 - second source operand is GPR (rB)
121
                   10 - first source operand is GPR (rA)
122
                   11 - both source operands are GPRs (rA and rB)
123
   machine[29:26]: next four bits of opcode
124
   machine[25:00]: instruction operands (specific to individual instruction)
125
 
126
  Recommendation: irrelevant instruction bits should be set with a value of
127
  bits in same positions of instruction preceding current instruction in the
128
  code (when assembling).
129
*/
130
 
131 1341 nogj
#ifdef HAS_EXECUTION
132
# if SIMPLE_EXECUTION
133
#  define EFN &l_none
134
#  define EF(func) &(func)
135
#  define EFI &l_invalid
136 1452 nogj
# elif COMPLEX_EXECUTION
137 1341 nogj
#  define EFN "l_none"
138
#  define EFI "l_invalid"
139
#  ifdef __GNUC__
140
#   define EF(func) #func
141
#  else
142
#   define EF(func) "func"
143
#  endif
144 1452 nogj
# else /* DYNAMIC_EXECUTION */
145
#  define EFN &l_none
146
#  define EF(func) &(gen_ ##func)
147
#  define EFI &gen_l_invalid
148
# endif
149 1341 nogj
#else /* HAS_EXECUTION */
150
# define EFN &l_none
151
# define EF(func) EFN
152
# define EFI EFN
153 133 markom
#endif /* HAS_EXECUTION */
154
 
155
CONST struct or32_opcode or32_opcodes[] =
156
{
157
 
158 1346 nogj
{ "l.j",       "N",            "00 0x0  NNNNN NNNNN NNNN NNNN NNNN NNNN",
159
  EF(l_j), OR32_IF_DELAY, it_jump },
160
{ "l.jal",     "N",            "00 0x1  NNNNN NNNNN NNNN NNNN NNNN NNNN",
161
  EF(l_jal), OR32_IF_DELAY, it_jump },
162
{ "l.bnf",     "N",            "00 0x3  NNNNN NNNNN NNNN NNNN NNNN NNNN",
163
  EF(l_bnf), OR32_IF_DELAY | OR32_R_FLAG, it_branch },
164
{ "l.bf",      "N",            "00 0x4  NNNNN NNNNN NNNN NNNN NNNN NNNN",
165
  EF(l_bf), OR32_IF_DELAY | OR32_R_FLAG, it_branch },
166
{ "l.nop",     "K",            "00 0x5  01--- ----- KKKK KKKK KKKK KKKK",
167
  EF(l_nop), 0, it_nop },
168
{ "l.movhi",   "rD,K",         "00 0x6  DDDDD ----0 KKKK KKKK KKKK KKKK",
169
  EF(l_movhi), 0, it_movimm },
170
{ "l.macrc",   "rD",           "00 0x6  DDDDD ----1 0000 0000 0000 0000",
171
  EF(l_macrc), 0, it_mac },
172
{ "l.sys",     "K",            "00 0x8  00000 00000 KKKK KKKK KKKK KKKK",
173 1440 nogj
  EF(l_sys), 0, it_exception },
174 1346 nogj
{ "l.trap",    "K",            "00 0x8  01000 00000 KKKK KKKK KKKK KKKK",
175 1440 nogj
  EF(l_trap), 0, it_exception },
176 1346 nogj
{ "l.msync",   "",             "00 0x8  10000 00000 0000 0000 0000 0000", EFN,
177
  0, it_unknown },
178
{ "l.psync",   "",             "00 0x8  10100 00000 0000 0000 0000 0000", EFN,
179
  0, it_unknown },
180
{ "l.csync",   "",             "00 0x8  11000 00000 0000 0000 0000 0000", EFN,
181
  0, it_unknown },
182
{ "l.rfe",     "",             "00 0x9  ----- ----- ---- ---- ---- ----",
183 1475 nogj
  EF(l_rfe), 0, it_exception },
184 1346 nogj
{ "lv.all_eq.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0x0", EFI, 0,
185
  it_unknown },
186
{ "lv.all_eq.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0x1", EFI, 0,
187
  it_unknown },
188
{ "lv.all_ge.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0x2", EFI, 0,
189
  it_unknown },
190
{ "lv.all_ge.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0x3", EFI, 0,
191
  it_unknown },
192
{ "lv.all_gt.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0x4", EFI, 0,
193
  it_unknown },
194
{ "lv.all_gt.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0x5", EFI, 0,
195
  it_unknown },
196
{ "lv.all_le.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0x6", EFI, 0,
197
  it_unknown },
198
{ "lv.all_le.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0x7", EFI, 0,
199
  it_unknown },
200
{ "lv.all_lt.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0x8", EFI, 0,
201
  it_unknown },
202
{ "lv.all_lt.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0x9", EFI, 0,
203
  it_unknown },
204
{ "lv.all_ne.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0xA", EFI, 0,
205
  it_unknown },
206
{ "lv.all_ne.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x1 0xB", EFI, 0,
207
  it_unknown },
208
{ "lv.any_eq.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0x0", EFI, 0,
209
  it_unknown },
210
{ "lv.any_eq.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0x1", EFI, 0,
211
  it_unknown },
212
{ "lv.any_ge.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0x2", EFI, 0,
213
  it_unknown },
214
{ "lv.any_ge.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0x3", EFI, 0,
215
  it_unknown },
216
{ "lv.any_gt.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0x4", EFI, 0,
217
  it_unknown },
218
{ "lv.any_gt.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0x5", EFI, 0,
219
  it_unknown },
220
{ "lv.any_le.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0x6", EFI, 0,
221
  it_unknown },
222
{ "lv.any_le.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0x7", EFI, 0,
223
  it_unknown },
224
{ "lv.any_lt.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0x8", EFI, 0,
225
  it_unknown },
226
{ "lv.any_lt.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0x9", EFI, 0,
227
  it_unknown },
228
{ "lv.any_ne.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0xA", EFI, 0,
229
  it_unknown },
230
{ "lv.any_ne.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x2 0xB", EFI, 0,
231
  it_unknown },
232
{ "lv.add.b",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0x0", EFI, 0,
233
  it_unknown },
234
{ "lv.add.h",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0x1", EFI, 0,
235
  it_unknown },
236
{ "lv.adds.b", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0x2", EFI, 0,
237
  it_unknown },
238
{ "lv.adds.h", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0x3", EFI, 0,
239
  it_unknown },
240
{ "lv.addu.b", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0x4", EFI, 0,
241
  it_unknown },
242
{ "lv.addu.h", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0x5", EFI, 0,
243
  it_unknown },
244
{ "lv.addus.b","rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0x6", EFI, 0,
245
  it_unknown },
246
{ "lv.addus.h","rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0x7", EFI, 0,
247
  it_unknown },
248
{ "lv.and",    "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0x8", EFI, 0,
249
  it_unknown },
250
{ "lv.avg.b",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0x9", EFI, 0,
251
  it_unknown },
252
{ "lv.avg.h",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x3 0xA", EFI, 0,
253
  it_unknown },
254
{ "lv.cmp_eq.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0x0", EFI, 0,
255
  it_unknown },
256
{ "lv.cmp_eq.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0x1", EFI, 0,
257
  it_unknown },
258
{ "lv.cmp_ge.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0x2", EFI, 0,
259
  it_unknown },
260
{ "lv.cmp_ge.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0x3", EFI, 0,
261
  it_unknown },
262
{ "lv.cmp_gt.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0x4", EFI, 0,
263
  it_unknown },
264
{ "lv.cmp_gt.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0x5", EFI, 0,
265
  it_unknown },
266
{ "lv.cmp_le.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0x6", EFI, 0,
267
  it_unknown },
268
{ "lv.cmp_le.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0x7", EFI, 0,
269
  it_unknown },
270
{ "lv.cmp_lt.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0x8", EFI, 0,
271
  it_unknown },
272
{ "lv.cmp_lt.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0x9", EFI, 0,
273
  it_unknown },
274
{ "lv.cmp_ne.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0xA", EFI, 0,
275
  it_unknown },
276
{ "lv.cmp_ne.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x4 0xB", EFI, 0,
277
  it_unknown },
278
{ "lv.madds.h","rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0x4", EFI, 0,
279
  it_unknown },
280
{ "lv.max.b",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0x5", EFI, 0,
281
  it_unknown },
282
{ "lv.max.h",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0x6", EFI, 0,
283
  it_unknown },
284
{ "lv.merge.b","rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0x7", EFI, 0,
285
  it_unknown },
286
{ "lv.merge.h","rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0x8", EFI, 0,
287
  it_unknown },
288
{ "lv.min.b",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0x9", EFI, 0,
289
  it_unknown },
290
{ "lv.min.h",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0xA", EFI, 0,
291
  it_unknown },
292
{ "lv.msubs.h","rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0xB", EFI, 0,
293
  it_unknown },
294
{ "lv.muls.h", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0xC", EFI, 0,
295
  it_unknown },
296
{ "lv.nand",   "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0xD", EFI, 0,
297
  it_unknown },
298
{ "lv.nor",    "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0xE", EFI, 0,
299
  it_unknown },
300
{ "lv.or",     "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x5 0xF", EFI, 0,
301
  it_unknown },
302
{ "lv.pack.b", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0x0", EFI, 0,
303
  it_unknown },
304
{ "lv.pack.h", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0x1", EFI, 0,
305
  it_unknown },
306
{ "lv.packs.b","rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0x2", EFI, 0,
307
  it_unknown },
308
{ "lv.packs.h","rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0x3", EFI, 0,
309
  it_unknown },
310
{ "lv.packus.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0x4", EFI, 0,
311
  it_unknown },
312
{ "lv.packus.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0x5", EFI, 0,
313
  it_unknown },
314
{ "lv.perm.n", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0x6", EFI, 0,
315
  it_unknown },
316
{ "lv.rl.b",   "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0x7", EFI, 0,
317
  it_unknown },
318
{ "lv.rl.h",   "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0x8", EFI, 0,
319
  it_unknown },
320
{ "lv.sll.b",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0x9", EFI, 0,
321
  it_unknown },
322
{ "lv.sll.h",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0xA", EFI, 0,
323
  it_unknown },
324
{ "lv.sll",    "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0xB", EFI, 0,
325
  it_unknown },
326
{ "lv.srl.b",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0xC", EFI, 0,
327
  it_unknown },
328
{ "lv.srl.h",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0xD", EFI, 0,
329
  it_unknown },
330
{ "lv.sra.b",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0xE", EFI, 0,
331
  it_unknown },
332
{ "lv.sra.h",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x6 0xF", EFI, 0,
333
  it_unknown },
334
{ "lv.srl",    "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0x0", EFI, 0,
335
  it_unknown },
336
{ "lv.sub.b",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0x1", EFI, 0,
337
  it_unknown },
338
{ "lv.sub.h",  "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0x2", EFI, 0,
339
  it_unknown },
340
{ "lv.subs.b", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0x3", EFI, 0,
341
  it_unknown },
342
{ "lv.subs.h", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0x4", EFI, 0,
343
  it_unknown },
344
{ "lv.subu.b", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0x5", EFI, 0,
345
  it_unknown },
346
{ "lv.subu.h", "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0x6", EFI, 0,
347
  it_unknown },
348
{ "lv.subus.b","rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0x7", EFI, 0,
349
  it_unknown },
350
{ "lv.subus.h","rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0x8", EFI, 0,
351
  it_unknown },
352
{ "lv.unpack.b","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0x9", EFI, 0,
353
  it_unknown },
354
{ "lv.unpack.h","rD,rA,rB",    "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0xA", EFI, 0,
355
  it_unknown },
356
{ "lv.xor",    "rD,rA,rB",     "00 0xA  DDDDD AAAAA BBBB B--- 0x7 0xB", EFI, 0,
357
  it_unknown },
358
{ "lv.cust1",  "",             "00 0xA  ----- ----- ---- ---- 0xC ----", EFI, 0,
359
  it_unknown },
360
{ "lv.cust2",  "",             "00 0xA  ----- ----- ---- ---- 0xD ----", EFI, 0,
361
  it_unknown },
362
{ "lv.cust3",  "",             "00 0xA  ----- ----- ---- ---- 0xE ----", EFI, 0,
363
  it_unknown },
364
{ "lv.cust4",  "",             "00 0xA  ----- ----- ---- ---- 0xF ----", EFI, 0,
365
  it_unknown },
366 676 markom
 
367 1346 nogj
{ "l.jr",      "rB",           "01 0x1  ----- ----- BBBB B--- ---- ----",
368
  EF(l_jr), OR32_IF_DELAY, it_jump },
369
{ "l.jalr",    "rB",           "01 0x2  ----- ----- BBBB B--- ---- ----",
370
  EF(l_jalr), OR32_IF_DELAY, it_jump },
371 1554 phoenix
{ "l.maci",    "rA,I",         "01 0x3  IIIII AAAAA ---- -III IIII IIII",
372 1346 nogj
  EF(l_mac), 0, it_mac },
373
{ "l.cust1",   "",             "01 0xC  ----- ----- ---- ---- ---- ----",
374
  EF(l_cust1), 0, it_unknown },
375
{ "l.cust2",   "",             "01 0xD  ----- ----- ---- ---- ---- ----",
376
  EF(l_cust2), 0, it_unknown },
377
{ "l.cust3",   "",             "01 0xE  ----- ----- ---- ---- ---- ----",
378
  EF(l_cust3), 0, it_unknown },
379
{ "l.cust4",   "",             "01 0xF  ----- ----- ---- ---- ---- ----",
380
  EF(l_cust4), 0, it_unknown },
381 133 markom
 
382 1346 nogj
{ "l.ld",      "rD,I(rA)",     "10 0x0  DDDDD AAAAA IIII IIII IIII IIII", EFI,
383
  0, it_load },
384
{ "l.lwz",     "rD,I(rA)",     "10 0x1  DDDDD AAAAA IIII IIII IIII IIII",
385
  EF(l_lwz), 0, it_load },
386
{ "l.lws",     "rD,I(rA)",     "10 0x2  DDDDD AAAAA IIII IIII IIII IIII", EFI,
387
  0, it_load },
388
{ "l.lbz",     "rD,I(rA)",     "10 0x3  DDDDD AAAAA IIII IIII IIII IIII",
389
  EF(l_lbz), 0, it_load },
390
{ "l.lbs",     "rD,I(rA)",     "10 0x4  DDDDD AAAAA IIII IIII IIII IIII",
391
  EF(l_lbs), 0, it_load },
392
{ "l.lhz",     "rD,I(rA)",     "10 0x5  DDDDD AAAAA IIII IIII IIII IIII",
393
  EF(l_lhz), 0, it_load },
394
{ "l.lhs",     "rD,I(rA)",     "10 0x6  DDDDD AAAAA IIII IIII IIII IIII",
395
  EF(l_lhs), 0, it_load },
396 133 markom
 
397 1346 nogj
{ "l.addi",    "rD,rA,I",      "10 0x7  DDDDD AAAAA IIII IIII IIII IIII",
398
  EF(l_add), OR32_W_FLAG, it_arith },
399
{ "l.addic",   "rD,rA,I",      "10 0x8  DDDDD AAAAA IIII IIII IIII IIII", EFI,
400
  0, it_arith },
401
{ "l.andi",    "rD,rA,K",      "10 0x9  DDDDD AAAAA KKKK KKKK KKKK KKKK",
402
  EF(l_and), OR32_W_FLAG, it_arith },
403
{ "l.ori",     "rD,rA,K",      "10 0xA  DDDDD AAAAA KKKK KKKK KKKK KKKK",
404
  EF(l_or), 0, it_arith },
405
{ "l.xori",    "rD,rA,I",      "10 0xB  DDDDD AAAAA IIII IIII IIII IIII",
406
  EF(l_xor), 0, it_arith },
407
{ "l.muli",    "rD,rA,I",      "10 0xC  DDDDD AAAAA IIII IIII IIII IIII",
408
  EF(l_mul), 0, it_arith },
409
{ "l.mfspr",   "rD,rA,K",      "10 0xD  DDDDD AAAAA KKKK KKKK KKKK KKKK",
410
  EF(l_mfspr), 0, it_move },
411
{ "l.slli",    "rD,rA,L",      "10 0xE  DDDDD AAAAA ---- ---- 00LL LLLL",
412
  EF(l_sll), 0, it_shift },
413
{ "l.srli",    "rD,rA,L",      "10 0xE  DDDDD AAAAA ---- ---- 01LL LLLL",
414
  EF(l_srl), 0, it_shift },
415
{ "l.srai",    "rD,rA,L",      "10 0xE  DDDDD AAAAA ---- ---- 10LL LLLL",
416
  EF(l_sra), 0, it_shift },
417
{ "l.rori",    "rD,rA,L",      "10 0xE  DDDDD AAAAA ---- ---- 11LL LLLL", EFI,
418
  0, it_shift },
419 133 markom
 
420 1346 nogj
{ "l.sfeqi",   "rA,I",         "10 0xF  00000 AAAAA IIII IIII IIII IIII",
421
  EF(l_sfeq), OR32_W_FLAG, it_compare },
422
{ "l.sfnei",   "rA,I",         "10 0xF  00001 AAAAA IIII IIII IIII IIII",
423
  EF(l_sfne), OR32_W_FLAG, it_compare },
424
{ "l.sfgtui",  "rA,I",         "10 0xF  00010 AAAAA IIII IIII IIII IIII",
425
  EF(l_sfgtu), OR32_W_FLAG, it_compare },
426
{ "l.sfgeui",  "rA,I",         "10 0xF  00011 AAAAA IIII IIII IIII IIII",
427
  EF(l_sfgeu), OR32_W_FLAG, it_compare },
428
{ "l.sfltui",  "rA,I",         "10 0xF  00100 AAAAA IIII IIII IIII IIII",
429
  EF(l_sfltu), OR32_W_FLAG, it_compare },
430
{ "l.sfleui",  "rA,I",         "10 0xF  00101 AAAAA IIII IIII IIII IIII",
431
  EF(l_sfleu), OR32_W_FLAG, it_compare },
432
{ "l.sfgtsi",  "rA,I",         "10 0xF  01010 AAAAA IIII IIII IIII IIII",
433
  EF(l_sfgts), OR32_W_FLAG, it_compare },
434
{ "l.sfgesi",  "rA,I",         "10 0xF  01011 AAAAA IIII IIII IIII IIII",
435
  EF(l_sfges), OR32_W_FLAG, it_compare },
436
{ "l.sfltsi",  "rA,I",         "10 0xF  01100 AAAAA IIII IIII IIII IIII",
437
  EF(l_sflts), OR32_W_FLAG, it_compare },
438
{ "l.sflesi",  "rA,I",         "10 0xF  01101 AAAAA IIII IIII IIII IIII",
439
  EF(l_sfles), OR32_W_FLAG, it_compare },
440 133 markom
 
441 1346 nogj
{ "l.mtspr",   "rA,rB,K",      "11 0x0  KKKKK AAAAA BBBB BKKK KKKK KKKK",
442
  EF(l_mtspr), 0, it_move },
443
{ "l.mac",     "rA,rB",        "11 0x1  ----- AAAAA BBBB B--- ---- 0x1",
444
  EF(l_mac), 0, it_mac },
445
{ "l.msb",     "rA,rB",        "11 0x1  ----- AAAAA BBBB B--- ---- 0x2",
446
  EF(l_msb), 0, it_mac },
447 133 markom
 
448 1346 nogj
{ "lf.add.s",   "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x0 0x0",
449
  EF(lf_add_s), 0, it_float },
450
{ "lf.sub.s",   "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x0 0x1",
451
  EF(lf_sub_s), 0, it_float },
452
{ "lf.mul.s",   "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x0 0x2",
453
  EF(lf_mul_s), 0, it_float },
454
{ "lf.div.s",   "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x0 0x3",
455
  EF(lf_div_s), 0, it_float },
456
{ "lf.itof.s",  "rD,rA",       "11 0x2  DDDDD AAAAA 0000 0--- 0x0 0x4",
457
  EF(lf_itof_s), 0, it_float },
458
{ "lf.ftoi.s",  "rD,rA",       "11 0x2  DDDDD AAAAA 0000 0--- 0x0 0x5",
459
  EF(lf_ftoi_s), 0, it_float },
460
{ "lf.rem.s",   "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x0 0x6",
461
  EF(lf_rem_s), 0, it_float },
462
{ "lf.madd.s",  "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x0 0x7",
463
  EF(lf_madd_s), 0, it_float },
464
{ "lf.sfeq.s",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x0 0x8",
465
  EF(lf_sfeq_s), 0, it_float },
466
{ "lf.sfne.s",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x0 0x9",
467
  EF(lf_sfne_s), 0, it_float },
468
{ "lf.sfgt.s",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x0 0xA",
469
  EF(lf_sfgt_s), 0, it_float },
470
{ "lf.sfge.s",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x0 0xB",
471
  EF(lf_sfge_s), 0, it_float },
472
{ "lf.sflt.s",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x0 0xC",
473
  EF(lf_sflt_s), 0, it_float },
474
{ "lf.sfle.s",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x0 0xD",
475
  EF(lf_sfle_s), 0, it_float },
476
{ "lf.cust1.s", "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0xD ----", EFI,
477
  0, it_float },
478 133 markom
 
479 1346 nogj
{ "lf.add.d",   "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x1 0x0", EFI, 0,
480
  it_float },
481
{ "lf.sub.d",   "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x1 0x1", EFI, 0,
482
  it_float },
483
{ "lf.mul.d",   "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x1 0x2", EFI, 0,
484
  it_float },
485
{ "lf.div.d",   "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x1 0x3", EFI, 0,
486
  it_float },
487
{ "lf.itof.d",  "rD,rA",       "11 0x2  DDDDD AAAAA 0000 0--- 0x1 0x4", EFI, 0,
488
  it_float },
489
{ "lf.ftoi.d",  "rD,rA",       "11 0x2  DDDDD AAAAA 0000 0--- 0x1 0x5", EFI, 0,
490
  it_float },
491
{ "lf.rem.d",   "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x1 0x6", EFI, 0,
492
  it_float },
493
{ "lf.madd.d",  "rD,rA,rB",    "11 0x2  DDDDD AAAAA BBBB B--- 0x1 0x7", EFI, 0,
494
  it_float },
495
{ "lf.sfeq.d",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x1 0x8", EFI, 0,
496
  it_float },
497
{ "lf.sfne.d",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x1 0x9", EFI, 0,
498
  it_float },
499
{ "lf.sfgt.d",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x1 0xA", EFI, 0,
500
  it_float },
501
{ "lf.sfge.d",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x1 0xB", EFI, 0,
502
  it_float },
503
{ "lf.sflt.d",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x1 0xC", EFI, 0,
504
  it_float },
505
{ "lf.sfle.d",  "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0x1 0xD", EFI, 0,
506
  it_float },
507
{ "lf.cust1.d", "rA,rB",       "11 0x2  ----- AAAAA BBBB B--- 0xE ----", EFI, 0,
508
  it_float },
509 676 markom
 
510 1346 nogj
{ "l.sd",      "I(rD),rB",     "11 0x4  IIIII DDDDD BBBB BIII IIII IIII", EFI,
511
  0, it_store },
512
{ "l.sw",      "I(rD),rB",     "11 0x5  IIIII DDDDD BBBB BIII IIII IIII",
513
  EF(l_sw), 0, it_store },
514
{ "l.sb",      "I(rD),rB",     "11 0x6  IIIII DDDDD BBBB BIII IIII IIII",
515
  EF(l_sb), 0, it_store },
516
{ "l.sh",      "I(rD),rB",     "11 0x7  IIIII DDDDD BBBB BIII IIII IIII",
517
  EF(l_sh), 0, it_store },
518 1295 lampret
 
519 1346 nogj
{ "l.add",     "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 ---- 0x0",
520
  EF(l_add), OR32_W_FLAG, it_arith },
521
{ "l.addc",    "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 ---- 0x1",
522
  EF(l_addc), OR32_W_FLAG, it_arith },
523
{ "l.sub",     "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 ---- 0x2",
524
  EF(l_sub), 0, it_arith },
525
{ "l.and",     "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 ---- 0x3",
526
  EF(l_and), OR32_W_FLAG, it_arith },
527
{ "l.or",      "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 ---- 0x4",
528
  EF(l_or), 0, it_arith },
529
{ "l.xor",     "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 ---- 0x5",
530
  EF(l_xor), 0, it_arith },
531
{ "l.mul",     "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-11 ---- 0x6",
532
  EF(l_mul), 0, it_arith },
533 1295 lampret
 
534 1346 nogj
{ "l.sll",     "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 00-- 0x8",
535
  EF(l_sll), 0, it_shift },
536
{ "l.srl",     "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 01-- 0x8",
537
  EF(l_srl), 0, it_shift },
538
{ "l.sra",     "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 10-- 0x8",
539
  EF(l_sra), 0, it_shift },
540
{ "l.ror",     "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 11-- 0x8", EFI,
541
  0, it_shift },
542
{ "l.div",     "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-11 ---- 0x9",
543
  EF(l_div), 0, it_arith },
544
{ "l.divu",    "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-11 ---- 0xA",
545
  EF(l_divu), 0, it_arith },
546
{ "l.mulu",    "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-11 ---- 0xB", EFI,
547
  0, it_arith },
548
{ "l.extbs",   "rD,rA",     "11 0x8  DDDDD AAAAA ---- --00 01-- 0xC",
549
  EF(l_extbs), 0, it_move },
550
{ "l.exths",   "rD,rA",     "11 0x8  DDDDD AAAAA ---- --00 00-- 0xC",
551
  EF(l_exths), 0, it_move },
552
{ "l.extws",   "rD,rA",     "11 0x8  DDDDD AAAAA ---- --00 00-- 0xD",
553
  EF(l_extws), 0, it_move },
554
{ "l.extbz",   "rD,rA",     "11 0x8  DDDDD AAAAA ---- --00 11-- 0xC",
555
  EF(l_extbz), 0, it_move },
556
{ "l.exthz",   "rD,rA",     "11 0x8  DDDDD AAAAA ---- --00 10-- 0xC",
557
  EF(l_exthz), 0, it_move },
558
{ "l.extwz",   "rD,rA",     "11 0x8  DDDDD AAAAA ---- --00 01-- 0xD",
559
  EF(l_extwz), 0, it_move },
560
{ "l.cmov",    "rD,rA,rB",     "11 0x8  DDDDD AAAAA BBBB B-00 ---- 0xE",
561
  EF(l_cmov), OR32_R_FLAG, it_move },
562 1384 nogj
{ "l.ff1",     "rD,rA",     "11 0x8  DDDDD AAAAA ---- --00 ---- 0xF", EFI, 0,
563
  it_arith },
564 1590 lampret
{ "l.fl1",     "rD,rA",     "11 0x8  DDDDD AAAAA ---- --01 ---- 0xF", EFI, 0,
565
  it_arith },
566 133 markom
 
567 1346 nogj
{ "l.sfeq",    "rA,rB",        "11 0x9  00000 AAAAA BBBB B--- ---- ----",
568
  EF(l_sfeq), OR32_W_FLAG, it_compare },
569
{ "l.sfne",    "rA,rB",        "11 0x9  00001 AAAAA BBBB B--- ---- ----",
570
  EF(l_sfne), OR32_W_FLAG, it_compare },
571
{ "l.sfgtu",   "rA,rB",        "11 0x9  00010 AAAAA BBBB B--- ---- ----",
572
  EF(l_sfgtu), OR32_W_FLAG, it_compare },
573
{ "l.sfgeu",   "rA,rB",        "11 0x9  00011 AAAAA BBBB B--- ---- ----",
574
  EF(l_sfgeu), OR32_W_FLAG, it_compare },
575
{ "l.sfltu",   "rA,rB",        "11 0x9  00100 AAAAA BBBB B--- ---- ----",
576
  EF(l_sfltu), OR32_W_FLAG, it_compare },
577
{ "l.sfleu",   "rA,rB",        "11 0x9  00101 AAAAA BBBB B--- ---- ----",
578
  EF(l_sfleu), OR32_W_FLAG, it_compare },
579
{ "l.sfgts",   "rA,rB",        "11 0x9  01010 AAAAA BBBB B--- ---- ----",
580
  EF(l_sfgts), OR32_W_FLAG, it_compare },
581
{ "l.sfges",   "rA,rB",        "11 0x9  01011 AAAAA BBBB B--- ---- ----",
582
  EF(l_sfges), OR32_W_FLAG, it_compare },
583
{ "l.sflts",   "rA,rB",        "11 0x9  01100 AAAAA BBBB B--- ---- ----",
584
  EF(l_sflts), OR32_W_FLAG, it_compare },
585
{ "l.sfles",   "rA,rB",        "11 0x9  01101 AAAAA BBBB B--- ---- ----",
586
  EF(l_sfles), OR32_W_FLAG, it_compare },
587 676 markom
 
588 1346 nogj
{ "l.cust5",   "rD,rA,rB,L,K", "11 0xC  DDDDD AAAAA BBBB BLLL LLLK KKKK", EFI,
589
  0, it_unknown },
590
{ "l.cust6",   "",             "11 0xD  ----- ----- ---- ---- ---- ----", EFI,
591
  0, it_unknown },
592
{ "l.cust7",   "",             "11 0xE  ----- ----- ---- ---- ---- ----", EFI,
593
  0, it_unknown },
594
{ "l.cust8",   "",             "11 0xF  ----- ----- ---- ---- ---- ----", EFI,
595
  0, it_unknown },
596 133 markom
 
597 221 markom
/* This section should not be defined in or1ksim, since it contains duplicates,
598
   which would cause machine builder to complain.  */
599 374 simons
#ifdef HAS_CUST
600 1346 nogj
{ "l.cust5_1",   "rD",         "11 0xC  DDDDD ----- ---- ---- ---- ----", EFI,
601
  0, it_unknown },
602
{ "l.cust5_2",   "rD,rA"   ,   "11 0xC  DDDDD AAAAA ---- ---- ---- ----", EFI,
603
  0, it_unknown },
604
{ "l.cust5_3",   "rD,rA,rB",   "11 0xC  DDDDD AAAAA BBBB B--- ---- ----", EFI,
605
  0, it_unknown },
606 221 markom
 
607 1346 nogj
{ "l.cust6_1",   "rD",         "11 0xD  DDDDD ----- ---- ---- ---- ----", EFI,
608
  0, it_unknown },
609
{ "l.cust6_2",   "rD,rA"   ,   "11 0xD  DDDDD AAAAA ---- ---- ---- ----", EFI,
610
  0, it_unknown },
611
{ "l.cust6_3",   "rD,rA,rB",   "11 0xD  DDDDD AAAAA BBBB B--- ---- ----", EFI,
612
  0, it_unknown },
613 221 markom
 
614 1346 nogj
{ "l.cust7_1",   "rD",         "11 0xE  DDDDD ----- ---- ---- ---- ----", EFI,
615
  0, it_unknown },
616
{ "l.cust7_2",   "rD,rA"   ,   "11 0xE  DDDDD AAAAA ---- ---- ---- ----", EFI,
617
  0, it_unknown },
618
{ "l.cust7_3",   "rD,rA,rB",   "11 0xE  DDDDD AAAAA BBBB B--- ---- ----", EFI,
619
  0, it_unknown },
620 221 markom
 
621 1346 nogj
{ "l.cust8_1",   "rD",         "11 0xF  DDDDD ----- ---- ---- ---- ----", EFI,
622
  0, it_unknown },
623
{ "l.cust8_2",   "rD,rA"   ,   "11 0xF  DDDDD AAAAA ---- ---- ---- ----", EFI,
624
  0, it_unknown },
625
{ "l.cust8_3",   "rD,rA,rB",   "11 0xF  DDDDD AAAAA BBBB B--- ---- ----", EFI,
626
  0, it_unknown },
627 221 markom
#endif
628
 
629 1346 nogj
{ "", "", "", EFI, 0, 0 }  /* Dummy entry, not included in num_opcodes.  This
630
                            * lets code examine entry i+1 without checking
631
                            * if we've run off the end of the table.  */
632 133 markom
};
633
 
634
#undef EFI
635
#undef EFN
636
#undef EF 
637
 
638
/* **INDENT-ON** */
639
 
640 371 markom
/* Define dummy, if debug is not defined.  */
641 1341 nogj
#ifndef HAS_DEBUG
642
#define debug(l, fmt...) ;
643 371 markom
#endif
644 133 markom
 
645 371 markom
CONST int num_opcodes = ((sizeof(or32_opcodes)) / (sizeof(struct or32_opcode))) - 1;
646
 
647 138 markom
/* Calculates instruction length in bytes. Always 4 for OR32. */
648
int
649
insn_len(int insn_index)
650 133 markom
{
651
  insn_index = 0; /* Just to get rid that warning.  */
652
  return 4;
653
}
654
 
655
/* Is individual insn's operand signed or unsigned? */
656 138 markom
int
657
letter_signed(char l)
658 133 markom
{
659
  CONST struct or32_letter *pletter;
660
 
661
  for(pletter = or32_letters; pletter->letter != '\0'; pletter++)
662
    if (pletter->letter == l)
663
      return pletter->sign;
664
 
665
  printf("letter_signed(%c): Unknown letter.\n", l);
666
  return 0;
667
}
668
 
669 703 markom
/* Simple cache for letter ranges */
670
static int range_cache[256] = {0};
671
 
672 133 markom
/* Number of letters in the individual lettered operand. */
673 138 markom
int
674
letter_range(char l)
675 133 markom
{
676
  CONST struct or32_opcode *pinsn;
677
  char *enc;
678
  int range = 0;
679 703 markom
 
680
  /* Is value cached? */
681 1308 phoenix
  if ((range = range_cache[(unsigned char)l])) return range;
682 133 markom
 
683 138 markom
  for(pinsn = or32_opcodes; strlen(pinsn->name); pinsn++)
684
    {
685
      if (strchr(pinsn->encoding,l))
686
        {
687
          for (enc = pinsn->encoding; *enc != '\0'; enc++)
688
            if ((*enc == '0') && (*(enc+1) == 'x'))
689
              enc += 2;
690
            else if (*enc == l)
691
              range++;
692 703 markom
          return range_cache[(unsigned char)l] = range;
693 133 markom
        }
694
    }
695 703 markom
 
696 133 markom
  printf("\nABORT: letter_range(%c): Never used letter.\n", l);
697
  exit(1);
698
}
699
 
700
/* MM: Returns index of given instruction name.  */
701 138 markom
int
702
insn_index (char *insn)
703
{
704 133 markom
  int i, found = -1;
705 371 markom
  for (i = 0; i < num_opcodes; i++)
706 138 markom
    if (!strcmp (or32_opcodes[i].name, insn))
707
      {
708
        found = i;
709
        break;
710
      }
711 133 markom
  return found;
712
}
713
 
714 717 markom
/* Returns name of the specified instruction index */
715
CONST char *
716
insn_name(int index)
717 138 markom
{
718 371 markom
  if (index >= 0 && index < num_opcodes)
719 133 markom
    return or32_opcodes[index].name;
720
  else
721
    return "???";
722
}
723
 
724 1342 nogj
#if defined(HAS_EXECUTION) && SIMPLE_EXECUTION
725 717 markom
void
726 1342 nogj
l_none(struct iqueue_entry *current)
727
{
728
}
729 1452 nogj
#elif defined(HAS_EXECUTION) && DYNAMIC_EXECUTION
730
void
731
l_none(struct op_queue *opq, int *param_t, orreg_t *param, int delay_slot)
732
{
733
}
734 1342 nogj
#else
735
void
736 717 markom
l_none()
737 138 markom
{
738 133 markom
}
739 1342 nogj
#endif
740 133 markom
 
741
/*** Finite automata for instruction decoding building code ***/
742
 
743 1341 nogj
/* Find symbols in encoding.  */
744 706 markom
unsigned long
745 133 markom
insn_extract(param_ch, enc_initial)
746
     char param_ch;
747
     char *enc_initial;
748
{
749
  char *enc;
750
  unsigned long ret = 0;
751
  unsigned opc_pos = 32;
752
  for (enc = enc_initial; *enc != '\0'; )
753
    if ((*enc == '0') && (*(enc+1) == 'x'))
754
      {
755
        unsigned long tmp = strtol(enc+2, NULL, 16);
756
        opc_pos -= 4;
757 138 markom
        if (param_ch == '0' || param_ch == '1')
758
          {
759
            if (param_ch == '0')
760
              tmp = 15 - tmp;
761
            ret |= tmp << opc_pos;
762
          }
763 133 markom
        enc += 3;
764
      }
765 138 markom
    else
766
      {
767
        if (*enc == '0' || *enc == '1' || *enc == '-' || isalpha(*enc) )
768
          {
769
            opc_pos--;
770
            if (param_ch == *enc)
771
              ret |= 1 << opc_pos;
772
          }
773
        enc++;
774 133 markom
      }
775
  return ret;
776
}
777
 
778 138 markom
#define MAX_AUTOMATA_SIZE (1200)
779
#define MAX_OP_TABLE_SIZE (1200)
780 133 markom
#define MAX_LEN           (8)
781
 
782
#ifndef MIN
783
# define MIN(x,y)          ((x) < (y) ? (x) : (y))
784
#endif
785
 
786
unsigned long *automata;
787
int nuncovered;
788
int curpass = 0;
789
 
790 1341 nogj
/* MM: Struct that holds runtime build information about instructions.  */
791 1342 nogj
struct temp_insn_struct *ti;
792 138 markom
 
793
struct insn_op_struct *op_data, **op_start;
794
 
795
/* Recursive utility function used to find best match and to build automata.  */
796
 
797
static unsigned long *
798
cover_insn (unsigned long *cur, int pass, unsigned int mask)
799
{
800 133 markom
  int best_first = 0, best_len = 0, i, last_match = -1, ninstr = 0;
801
  unsigned long cur_mask = mask;
802
  unsigned long *next;
803
 
804
  for (i = 0; i < num_opcodes; i++)
805 138 markom
    if (ti[i].in_pass == pass)
806
      {
807
        cur_mask &= ti[i].insn_mask;
808
        ninstr++;
809
        last_match = i;
810
      }
811
 
812 344 markom
  debug(8, "%08X %08X\n", mask, cur_mask);
813 138 markom
  if (ninstr == 0)
814
    return 0;
815
  if (ninstr == 1)
816
    {
817
      /* Leaf holds instruction index. */
818 344 markom
      debug(8, "%i>I%i %s\n", cur - automata, last_match, or32_opcodes[last_match].name);
819 138 markom
      *cur = LEAF_FLAG | last_match;
820
      cur++;
821
      nuncovered--;
822
    } else {
823
      /* Find longest match.  */
824
      for (i = 0; i < 32; i++)
825
        {
826
          int len;
827
          for (len = best_len + 1; len < MIN(MAX_LEN, 33 - i); len++)
828
            {
829
              unsigned long m = (1UL << ((unsigned long)len)) - 1;
830 344 markom
              debug(9, " (%i(%08X & %08X>>%i = %08X, %08X)",len,m, cur_mask, i, (cur_mask >> (unsigned)i), (cur_mask >> (unsigned)i) & m);
831 138 markom
              if ((m & (cur_mask >> (unsigned)i)) == m)
832
                {
833
                  best_len = len;
834
                  best_first = i;
835 344 markom
                  debug(9, "!");
836 138 markom
                }
837
              else
838
                break;
839
            }
840
        }
841 344 markom
      debug(9, "\n");
842 138 markom
      if (!best_len)
843
        {
844
          fprintf (stderr, "%i instructions match mask 0x%08X:\n", ninstr, mask);
845
          for (i = 0; i < num_opcodes; i++)
846
            if (ti[i].in_pass == pass)
847
              fprintf (stderr, "%s ", or32_opcodes[i].name);
848
 
849
          fprintf (stderr, "\n");
850
          exit (1);
851
        }
852 344 markom
      debug(8, "%i> #### %i << %i (%i) ####\n", cur - automata, best_len, best_first, ninstr);
853 138 markom
      *cur = best_first;
854
      cur++;
855
      *cur = (1 << best_len) - 1;
856
      cur++;
857
      next = cur;
858
      /* Allocate space for pointers.  */
859
      cur += 1 << best_len;
860
      cur_mask = (1 << (unsigned long)best_len) - 1;
861
 
862
      for (i = 0; i < (1 << (unsigned long)best_len); i++)
863
        {
864
          int j;
865
          unsigned long *c;
866
          curpass++;
867
          for (j = 0; j < num_opcodes; j++)
868
            if (ti[j].in_pass == pass
869 371 markom
                && ((ti[j].insn >> best_first) & cur_mask) == (unsigned long) i
870 138 markom
                && ((ti[j].insn_mask >> best_first) & cur_mask) == cur_mask)
871
              ti[j].in_pass = curpass;
872
 
873 344 markom
          debug(9, "%08X %08X %i\n", mask, cur_mask, best_first);
874 138 markom
          c = cover_insn (cur, curpass, mask & (~(cur_mask << best_first)));
875
          if (c)
876
            {
877 344 markom
              debug(8, "%i> #%X -> %u\n", next - automata, i, cur - automata);
878 138 markom
              *next = cur - automata;
879
              cur = c;
880
            }
881
          else
882
            {
883 344 markom
              debug(8, "%i> N/A\n", next - automata);
884 138 markom
              *next = 0;
885
            }
886
          next++;
887
        }
888 133 markom
    }
889 138 markom
  return cur;
890
}
891 133 markom
 
892 138 markom
/* Returns number of nonzero bits. */
893
static int
894
num_ones (unsigned long value)
895
{
896
  int c = 0;
897
  while (value)
898
    {
899
      if (value & 1)
900
        c++;
901
      value >>= 1;
902 133 markom
    }
903 138 markom
  return c;
904
}
905 133 markom
 
906 138 markom
/* Utility function, which converts parameters from or32_opcode format to more binary form.
907
   Parameters are stored in ti struct.  */
908
 
909
static struct insn_op_struct *
910
parse_params (CONST struct or32_opcode *opcode, struct insn_op_struct *cur)
911
{
912
  char *args = opcode->args;
913
  int i, type;
914 1346 nogj
  int num_cur_op = 0;;
915 138 markom
 
916
  i = 0;
917
  type = 0;
918 262 markom
  /* In case we don't have any parameters, we add dummy read from r0.  */
919
  if (!(*args)) {
920 263 markom
    cur->type = OPTYPE_REG | OPTYPE_OP | OPTYPE_LAST;
921 262 markom
    cur->data = 0;
922 355 markom
    debug(9, "#%08X %08X\n", cur->type, cur->data);
923 262 markom
    cur++;
924
    return cur;
925
  }
926
 
927 138 markom
  while (*args != '\0')
928
    {
929
      if (*args == 'r')
930
        {
931
          args++;
932
          type |= OPTYPE_REG;
933 1597 nogj
          if(*args == 'D')
934 1341 nogj
            type |= OPTYPE_DST;
935 133 markom
        }
936 138 markom
      else if (isalpha (*args))
937
        {
938
          unsigned long arg;
939
          arg = insn_extract(*args, opcode->encoding);
940 355 markom
          debug(9, "%s : %08X ------\n", opcode->name, arg);
941 138 markom
          if (letter_signed (*args))
942
            {
943
              type |= OPTYPE_SIG;
944
              type |= ((num_ones (arg) - 1) << OPTYPE_SBIT_SHR) & OPTYPE_SBIT;
945
            }
946
 
947 1346 nogj
          num_cur_op = 0;
948 138 markom
          /* Split argument to sequences of consecutive ones.  */
949
          while (arg)
950
            {
951
              int shr = 0;
952
              unsigned long tmp = arg, mask = 0;
953
              while ((tmp & 1) == 0)
954
                {
955
                  shr++;
956
                  tmp >>= 1;
957
                }
958
              while (tmp & 1)
959
                {
960
                  mask++;
961
                  tmp >>= 1;
962
                }
963
              cur->type = type | shr;
964
              cur->data = mask;
965
              arg &= ~(((1 << mask) - 1) << shr);
966 355 markom
              debug(6, "|%08X %08X\n", cur->type, cur->data);
967 138 markom
              cur++;
968 1346 nogj
              num_cur_op++;
969 138 markom
            }
970
          args++;
971
        }
972
      else if (*args == '(')
973
        {
974
          /* Next param is displacement.  Later we will treat them as one operand.  */
975 1346 nogj
          /* Set the OPTYPE_DIS flag on all insn_op_structs that belong to this
976
           * operand */
977
          while(num_cur_op > 0) {
978
            cur[-num_cur_op].type |= type | OPTYPE_DIS;
979
            num_cur_op--;
980
          }
981
          cur[-1].type |= OPTYPE_OP;
982 355 markom
          debug(9, ">%08X %08X\n", cur->type, cur->data);
983 138 markom
          type = 0;
984
          i++;
985
          args++;
986
        }
987
      else if (*args == OPERAND_DELIM)
988
        {
989
          cur--;
990
          cur->type = type | cur->type | OPTYPE_OP;
991 355 markom
          debug(9, ">%08X %08X\n", cur->type, cur->data);
992 138 markom
          cur++;
993
          type = 0;
994
          i++;
995
          args++;
996
        }
997
      else if (*args == '0')
998
        {
999
          cur->type = type;
1000
          cur->data = 0;
1001 355 markom
          debug(9, ">%08X %08X\n", cur->type, cur->data);
1002 138 markom
          cur++;
1003
          type = 0;
1004
          i++;
1005
          args++;
1006
        }
1007
      else if (*args == ')')
1008
        args++;
1009
      else
1010
        {
1011
          fprintf (stderr, "%s : parse error in args.\n", opcode->name);
1012
          exit (1);
1013
        }
1014 133 markom
    }
1015 138 markom
  cur--;
1016
  cur->type = type | cur->type | OPTYPE_OP | OPTYPE_LAST;
1017 355 markom
  debug(9, "#%08X %08X\n", cur->type, cur->data);
1018 138 markom
  cur++;
1019 133 markom
  return cur;
1020
}
1021
 
1022 138 markom
/* Constructs new automata based on or32_opcodes array.  */
1023
 
1024
void
1025
build_automata()
1026
{
1027 371 markom
  int i;
1028 133 markom
  unsigned long *end;
1029 138 markom
  struct insn_op_struct *cur;
1030
 
1031 133 markom
  automata = (unsigned long *) malloc (MAX_AUTOMATA_SIZE * sizeof (unsigned long));
1032 138 markom
  ti = (struct temp_insn_struct *) malloc (sizeof (struct temp_insn_struct) * num_opcodes);
1033 133 markom
 
1034
  nuncovered = num_opcodes;
1035 709 markom
 
1036
#ifdef HAS_EXECUTION
1037 138 markom
  printf("Building automata... ");
1038 709 markom
#endif
1039
 
1040 133 markom
  /* Build temporary information about instructions.  */
1041 138 markom
  for (i = 0; i < num_opcodes; i++)
1042
    {
1043
      unsigned long ones, zeros;
1044
      char *encoding = or32_opcodes[i].encoding;
1045
      ones  = insn_extract('1', encoding);
1046
      zeros = insn_extract('0', encoding);
1047
      ti[i].insn_mask = ones | zeros;
1048
      ti[i].insn = ones;
1049
      ti[i].in_pass = curpass = 0;
1050 344 markom
      /*debug(9, "%s: %s %08X %08X\n", or32_opcodes[i].name,
1051 138 markom
        or32_opcodes[i].encoding, ti[i].insn_mask, ti[i].insn);*/
1052
    }
1053 133 markom
 
1054
  /* Until all are covered search for best criteria to separate them.  */
1055 138 markom
  end = cover_insn (automata, curpass, 0xFFFFFFFF);
1056
  if (end - automata > MAX_AUTOMATA_SIZE)
1057
    {
1058
      fprintf (stderr, "Automata too large. Increase MAX_AUTOMATA_SIZE.");
1059
      exit (1);
1060
    }
1061 709 markom
#ifdef HAS_EXECUTION
1062 138 markom
  printf("done, num uncovered: %i/%i.\n", nuncovered, num_opcodes);
1063 709 markom
#endif
1064 371 markom
 
1065 709 markom
#ifdef HAS_EXECUTION
1066 138 markom
  printf("Parsing operands data... ");
1067 709 markom
#endif
1068 138 markom
  op_data = (struct insn_op_struct *) malloc (MAX_OP_TABLE_SIZE * sizeof (struct insn_op_struct));
1069
  op_start = (struct insn_op_struct **) malloc (num_opcodes * sizeof (struct insn_op_struct *));
1070
  cur = op_data;
1071
  for (i = 0; i < num_opcodes; i++)
1072
    {
1073
      op_start[i] = cur;
1074
      cur = parse_params (&or32_opcodes[i], cur);
1075
      if (cur - op_data > MAX_OP_TABLE_SIZE)
1076
        {
1077
          fprintf (stderr, "Operands table too small, increase MAX_OP_TABLE_SIZE.\n");
1078
          exit (1);
1079
        }
1080
    }
1081 709 markom
#ifdef HAS_EXECUTION
1082 138 markom
  printf("done.\n");
1083 709 markom
#endif
1084 133 markom
}
1085
 
1086 138 markom
void destruct_automata ()
1087
{
1088
  free (ti);
1089 133 markom
  free (automata);
1090 138 markom
  free (op_data);
1091
  free (op_start);
1092 133 markom
}
1093
 
1094
/* Decodes instruction and returns instruction index.  */
1095 138 markom
int insn_decode (unsigned int insn)
1096
{
1097 133 markom
  unsigned long *a = automata;
1098 138 markom
  int i;
1099
  while (!(*a & LEAF_FLAG))
1100
    {
1101
      unsigned int first = *a;
1102 703 markom
      //debug(9, "%i ", a - automata);
1103 138 markom
      a++;
1104
      i = (insn >> first) & *a;
1105
      a++;
1106
      if (!*(a + i))
1107
        { /* Invalid instruction found?  */
1108 703 markom
          //debug(9, "XXX\n", i);
1109 138 markom
          return -1;
1110
        }
1111
      a = automata + *(a + i);
1112
    }
1113
  i = *a & ~LEAF_FLAG;
1114 703 markom
  //debug(9, "%i\n", i);
1115 138 markom
  /* Final check - do we have direct match?
1116
     (based on or32_opcodes this should be the only possibility,
1117
     but in case of invalid/missing instruction we must perform a check)  */
1118
  if ((ti[i].insn_mask & insn) == ti[i].insn)
1119
    return i;
1120
  else
1121
    return -1;
1122 133 markom
}
1123 371 markom
 
1124
static char disassembled_str[50];
1125
char *disassembled = &disassembled_str[0];
1126
 
1127
/* Automagically does zero- or sign- extension and also finds correct
1128
   sign bit position if sign extension is correct extension. Which extension
1129
   is proper is figured out from letter description. */
1130
 
1131 879 markom
unsigned long
1132 371 markom
extend_imm(unsigned long imm, char l)
1133
{
1134
  unsigned long mask;
1135
  int letter_bits;
1136
 
1137
  /* First truncate all bits above valid range for this letter
1138
     in case it is zero extend. */
1139
  letter_bits = letter_range(l);
1140
  mask = (1 << letter_bits) - 1;
1141
  imm &= mask;
1142
 
1143
  /* Do sign extend if this is the right one. */
1144
  if (letter_signed(l) && (imm >> (letter_bits - 1)))
1145
    imm |= (~mask);
1146
 
1147
  return imm;
1148
}
1149
 
1150 879 markom
unsigned long
1151 371 markom
or32_extract(param_ch, enc_initial, insn)
1152
     char param_ch;
1153
     char *enc_initial;
1154
     unsigned long insn;
1155
{
1156
  char *enc;
1157
  unsigned long ret = 0;
1158
  int opc_pos = 0;
1159
  int param_pos = 0;
1160
 
1161
  for (enc = enc_initial; *enc != '\0'; enc++)
1162
    if (*enc == param_ch)
1163
      {
1164
        if (enc - 2 >= enc_initial && (*(enc - 2) == '0') && (*(enc - 1) == 'x'))
1165
          continue;
1166
        else
1167
          param_pos++;
1168
      }
1169
 
1170
#if DEBUG
1171
  printf("or32_extract: %x ", param_pos);
1172
#endif
1173
  opc_pos = 32;
1174
  for (enc = enc_initial; *enc != '\0'; )
1175
    if ((*enc == '0') && (*(enc+1) == 'x'))
1176
      {
1177
        opc_pos -= 4;
1178
        if ((param_ch == '0') || (param_ch == '1'))
1179
          {
1180
            unsigned long tmp = strtol(enc, NULL, 16);
1181
#if DEBUG
1182
            printf(" enc=%s, tmp=%x ", enc, tmp);
1183
#endif
1184
            if (param_ch == '0')
1185
              tmp = 15 - tmp;
1186
            ret |= tmp << opc_pos;
1187
          }
1188
        enc += 3;
1189
      }
1190
    else if ((*enc == '0') || (*enc == '1'))
1191
      {
1192
        opc_pos--;
1193
        if (param_ch == *enc)
1194
          ret |= 1 << opc_pos;
1195
        enc++;
1196
      }
1197
    else if (*enc == param_ch)
1198
      {
1199
        opc_pos--;
1200
        param_pos--;
1201
#if DEBUG
1202
        printf("\n  ret=%x opc_pos=%x, param_pos=%x\n", ret, opc_pos, param_pos);
1203
#endif  
1204
        if (islower(param_ch))
1205
          ret -= ((insn >> opc_pos) & 0x1) << param_pos;
1206
        else
1207
          ret += ((insn >> opc_pos) & 0x1) << param_pos;
1208
        enc++;
1209
      }
1210
    else if (isalpha(*enc))
1211
      {
1212
        opc_pos--;
1213
        enc++;
1214
      }
1215
    else if (*enc == '-')
1216
      {
1217
        opc_pos--;
1218
        enc++;
1219
      }
1220
    else
1221
      enc++;
1222
 
1223
#if DEBUG
1224
  printf ("ret=%x\n", ret);
1225
#endif
1226
  return ret;
1227
}
1228
 
1229
/* Print register. Used only by print_insn. */
1230
 
1231 703 markom
static char *
1232
or32_print_register (dest, param_ch, encoding, insn)
1233
     char *dest;
1234 371 markom
     char param_ch;
1235
     char *encoding;
1236
     unsigned long insn;
1237
{
1238
  int regnum = or32_extract(param_ch, encoding, insn);
1239
 
1240 703 markom
  sprintf (dest, "r%d", regnum);
1241
  while (*dest) dest++;
1242
  return dest;
1243 371 markom
}
1244
 
1245
/* Print immediate. Used only by print_insn. */
1246
 
1247 703 markom
static char *
1248
or32_print_immediate (dest, param_ch, encoding, insn)
1249
     char *dest;
1250 371 markom
     char param_ch;
1251
     char *encoding;
1252
     unsigned long insn;
1253
{
1254
  int imm = or32_extract (param_ch, encoding, insn);
1255
 
1256
  imm = extend_imm(imm, param_ch);
1257
 
1258
  if (letter_signed(param_ch))
1259
    {
1260
      if (imm < 0)
1261 703 markom
        sprintf (dest, "%d", imm);
1262 371 markom
      else
1263 703 markom
        sprintf (dest, "0x%x", imm);
1264 371 markom
    }
1265
  else
1266 703 markom
    sprintf (dest, "%#x", imm);
1267
  while (*dest) dest++;
1268
  return dest;
1269 371 markom
}
1270
 
1271
/* Disassemble one instruction from insn to disassemble.
1272
   Return the size of the instruction.  */
1273
 
1274
int
1275
disassemble_insn (insn)
1276
     unsigned long insn;
1277
{
1278 703 markom
  return disassemble_index (insn, insn_decode (insn));
1279
}
1280 371 markom
 
1281 703 markom
/* Disassemble one instruction from insn index.
1282
   Return the size of the instruction.  */
1283
 
1284
int
1285
disassemble_index (insn, index)
1286
     unsigned long insn;
1287
     int index;
1288
{
1289
  char *dest = disassembled;
1290 371 markom
  if (index >= 0)
1291
    {
1292
      struct or32_opcode const *opcode = &or32_opcodes[index];
1293
      char *s;
1294
 
1295 703 markom
      strcpy (dest, opcode->name);
1296
      while (*dest) dest++;
1297
      *dest++ = ' ';
1298
      *dest = 0;
1299
 
1300 371 markom
      for (s = opcode->args; *s != '\0'; ++s)
1301
        {
1302
          switch (*s)
1303
            {
1304
            case '\0':
1305 703 markom
              return insn_len (insn);
1306 714 markom
 
1307 371 markom
            case 'r':
1308 703 markom
              dest = or32_print_register(dest, *++s, opcode->encoding, insn);
1309 371 markom
              break;
1310 714 markom
 
1311 371 markom
            default:
1312
              if (strchr (opcode->encoding, *s))
1313 703 markom
                dest = or32_print_immediate (dest, *s, opcode->encoding, insn);
1314
              else {
1315
                *dest++ = *s;
1316
                *dest = 0;
1317
              }
1318 371 markom
            }
1319
        }
1320
    }
1321
  else
1322
    {
1323
      /* This used to be %8x for binutils.  */
1324 1308 phoenix
      sprintf(dest, ".word 0x%08lx", insn);
1325 703 markom
      while (*dest) dest++;
1326 371 markom
    }
1327
  return insn_len (insn);
1328
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.