1 /***************************************************************************
2 * Copyright (C) 2013 Andes Technology *
3 * Hsiangkai Wang <hkwang@andestech.com> *
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 2 of the License, or *
8 * (at your option) any later version. *
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. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
19 ***************************************************************************/
25 #include <helper/log.h>
26 #include <target/target.h>
27 #include "nds32_disassembler.h"
29 static const int enable4_bits
[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
31 int nds32_read_opcode(struct nds32
*nds32
, uint32_t address
, uint32_t *value
)
33 struct target
*target
= nds32
->target
;
36 if (!target_was_examined(target
)) {
37 LOG_ERROR("Target not examined yet");
41 int retval
= target_read_buffer(target
, address
, 4, value_buf
);
43 if (retval
== ERROR_OK
) {
44 /* instructions are always big-endian */
45 *value
= be_to_h_u32(value_buf
);
47 LOG_DEBUG("address: 0x%8.8" PRIx32
", value: 0x%8.8" PRIx32
"",
52 LOG_DEBUG("address: 0x%8.8" PRIx32
" failed",
59 static int nds32_parse_type_0(uint32_t opcode
, int32_t *imm
)
61 *imm
= opcode
& 0x1FFFFFF;
66 static int nds32_parse_type_1(uint32_t opcode
, uint8_t *rt
, int32_t *imm
)
68 *rt
= (opcode
>> 20) & 0x1F;
69 *imm
= opcode
& 0xFFFFF;
74 static int nds32_parse_type_2(uint32_t opcode
, uint8_t *rt
, uint8_t *ra
, int32_t *imm
)
76 *rt
= (opcode
>> 20) & 0x1F;
77 *ra
= (opcode
>> 15) & 0x1F;
78 *imm
= opcode
& 0x7FFF;
83 static int nds32_parse_type_3(uint32_t opcode
, uint8_t *rt
, uint8_t *ra
,
84 uint8_t *rb
, int32_t *imm
)
86 *rt
= (opcode
>> 20) & 0x1F;
87 *ra
= (opcode
>> 15) & 0x1F;
88 *rb
= (opcode
>> 10) & 0x1F;
89 *imm
= opcode
& 0x3FF;
94 static int nds32_parse_type_4(uint32_t opcode
, uint8_t *rt
, uint8_t *ra
,
95 uint8_t *rb
, uint8_t *rd
, uint8_t *sub_opc
)
97 *rt
= (opcode
>> 20) & 0x1F;
98 *ra
= (opcode
>> 15) & 0x1F;
99 *rb
= (opcode
>> 10) & 0x1F;
100 *rd
= (opcode
>> 5) & 0x1F;
101 *sub_opc
= opcode
& 0x1F;
106 /* LBI, LHI, LWI, LBI.bi, LHI.bi, LWI.bi */
107 static int nds32_parse_group_0_insn(struct nds32
*nds32
, uint32_t opcode
,
109 struct nds32_instruction
*instruction
)
113 opc_6
= instruction
->info
.opc_6
;
115 switch (opc_6
& 0x7) {
117 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
118 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
119 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 17; /* sign-extend */
120 instruction
->type
= NDS32_INSN_LOAD_STORE
;
121 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
122 &(instruction
->access_start
));
123 instruction
->access_start
+= instruction
->info
.imm
;
124 instruction
->access_end
= instruction
->access_start
+ 1;
125 snprintf(instruction
->text
,
127 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
128 "\tLBI\t$r%" PRIu8
",[$r%" PRIu8
"+#%" PRId32
"]",
130 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
131 instruction
->info
.imm
);
134 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
135 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
136 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 16; /* sign-extend */
137 instruction
->type
= NDS32_INSN_LOAD_STORE
;
138 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
139 &(instruction
->access_start
));
140 instruction
->access_start
+= instruction
->info
.imm
;
141 instruction
->access_end
= instruction
->access_start
+ 2;
142 snprintf(instruction
->text
,
144 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
145 "\tLHI\t$r%" PRIu8
",[$r%" PRIu8
"+#%" PRId32
"]",
147 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
148 instruction
->info
.imm
);
151 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
152 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
153 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 15; /* sign-extend */
154 instruction
->type
= NDS32_INSN_LOAD_STORE
;
155 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
156 &(instruction
->access_start
));
157 instruction
->access_start
+= instruction
->info
.imm
;
158 instruction
->access_end
= instruction
->access_start
+ 4;
159 snprintf(instruction
->text
,
161 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
162 "\tLWI\t$r%" PRIu8
",[$r%" PRIu8
"+#%" PRId32
"]",
164 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
165 instruction
->info
.imm
);
168 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
169 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
170 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 17; /* sign-extend */
171 instruction
->type
= NDS32_INSN_LOAD_STORE
;
172 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
173 &(instruction
->access_start
));
174 instruction
->access_end
= instruction
->access_start
+ 1;
175 snprintf(instruction
->text
,
177 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
178 "\tLBI.bi\t$r%" PRIu8
",[$r%" PRIu8
"],#%" PRId32
,
180 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
181 instruction
->info
.imm
);
184 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
185 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
186 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 16; /* sign-extend */
187 instruction
->type
= NDS32_INSN_LOAD_STORE
;
188 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
189 &(instruction
->access_start
));
190 instruction
->access_end
= instruction
->access_start
+ 2;
191 snprintf(instruction
->text
,
193 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
194 "\tLHI.bi\t$r%" PRIu8
",[$r%" PRIu8
"],#%" PRId32
,
196 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
197 instruction
->info
.imm
);
200 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
201 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
202 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 15; /* sign-extend */
203 instruction
->type
= NDS32_INSN_LOAD_STORE
;
204 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
205 &(instruction
->access_start
));
206 instruction
->access_end
= instruction
->access_start
+ 4;
207 snprintf(instruction
->text
,
209 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
210 "\tLWI.bi\t$r%" PRIu8
",[$r%" PRIu8
"],#%" PRId32
"",
212 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
213 instruction
->info
.imm
);
216 snprintf(instruction
->text
,
218 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
227 static int nds32_parse_group_1_insn(struct nds32
*nds32
, uint32_t opcode
,
228 uint32_t address
, struct nds32_instruction
*instruction
)
232 opc_6
= instruction
->info
.opc_6
;
234 switch (opc_6
& 0x7) {
236 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
237 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
238 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 17; /* sign-extend */
239 instruction
->type
= NDS32_INSN_LOAD_STORE
;
240 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
241 &(instruction
->access_start
));
242 instruction
->access_start
+= instruction
->info
.imm
;
243 instruction
->access_end
= instruction
->access_start
+ 1;
244 snprintf(instruction
->text
,
246 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
247 "\tSBI\t$r%" PRIu8
",[$r%" PRIu8
"+#%" PRId32
"]",
249 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
250 instruction
->info
.imm
);
253 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
254 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
255 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 16; /* sign-extend */
256 instruction
->type
= NDS32_INSN_LOAD_STORE
;
257 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
258 &(instruction
->access_start
));
259 instruction
->access_start
+= instruction
->info
.imm
;
260 instruction
->access_end
= instruction
->access_start
+ 2;
261 snprintf(instruction
->text
,
263 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
264 "\tSHI\t$r%" PRIu8
",[$r%" PRIu8
"+#%" PRId32
"]",
266 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
267 instruction
->info
.imm
);
270 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
271 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
272 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 15; /* sign-extend */
273 instruction
->type
= NDS32_INSN_LOAD_STORE
;
274 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
275 &(instruction
->access_start
));
276 instruction
->access_start
+= instruction
->info
.imm
;
277 instruction
->access_end
= instruction
->access_start
+ 4;
278 snprintf(instruction
->text
,
280 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
281 "\tSWI\t$r%" PRIu8
",[$r%" PRIu8
"+#%" PRId32
"]",
283 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
284 instruction
->info
.imm
);
287 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
288 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
289 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 17; /* sign-extend */
290 instruction
->type
= NDS32_INSN_LOAD_STORE
;
291 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
292 &(instruction
->access_start
));
293 instruction
->access_end
= instruction
->access_start
+ 1;
294 snprintf(instruction
->text
,
296 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
297 "\tSBI.bi\t$r%" PRIu8
",[$r%" PRIu8
"],#%" PRId32
,
299 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
300 instruction
->info
.imm
);
303 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
304 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
305 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 16; /* sign-extend */
306 instruction
->type
= NDS32_INSN_LOAD_STORE
;
307 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
308 &(instruction
->access_start
));
309 instruction
->access_end
= instruction
->access_start
+ 2;
310 snprintf(instruction
->text
,
312 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
313 "\tSHI.bi\t$r%" PRIu8
",[$r%" PRIu8
"],#%" PRId32
,
315 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
316 instruction
->info
.imm
);
319 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
320 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
321 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 15; /* sign-extend */
322 instruction
->type
= NDS32_INSN_LOAD_STORE
;
323 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
324 &(instruction
->access_start
));
325 instruction
->access_end
= instruction
->access_start
+ 4;
326 snprintf(instruction
->text
,
328 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
329 "\tSWI.bi\t$r%" PRIu8
",[$r%" PRIu8
"],#%" PRId32
,
331 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
332 instruction
->info
.imm
);
335 snprintf(instruction
->text
,
337 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
346 static int nds32_parse_group_2_insn(struct nds32
*nds32
, uint32_t opcode
,
347 uint32_t address
, struct nds32_instruction
*instruction
)
351 opc_6
= instruction
->info
.opc_6
;
353 switch (opc_6
& 0x7) {
355 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
356 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
357 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 17; /* sign-extend */
358 instruction
->type
= NDS32_INSN_LOAD_STORE
;
359 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
360 &(instruction
->access_start
));
361 instruction
->access_start
+= instruction
->info
.imm
;
362 instruction
->access_end
= instruction
->access_start
+ 1;
363 snprintf(instruction
->text
,
365 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
366 "\tLBSI\t$r%" PRIu8
",[$r%" PRIu8
"+#%" PRId32
"]",
368 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
369 instruction
->info
.imm
);
372 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
373 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
374 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 16; /* sign-extend */
375 instruction
->type
= NDS32_INSN_LOAD_STORE
;
376 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
377 &(instruction
->access_start
));
378 instruction
->access_start
+= instruction
->info
.imm
;
379 instruction
->access_end
= instruction
->access_start
+ 2;
380 snprintf(instruction
->text
,
382 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
383 "\tLHSI\t$r%" PRIu8
",[$r%" PRIu8
"+#%" PRId32
"]",
385 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
386 instruction
->info
.imm
);
388 case 3: { /* DPREFI */
390 nds32_parse_type_2(opcode
, &sub_type
, &(instruction
->info
.ra
),
391 &(instruction
->info
.imm
));
392 instruction
->info
.sub_opc
= sub_type
& 0xF;
393 instruction
->type
= NDS32_INSN_MISC
;
394 if (sub_type
& 0x10) { /* DPREFI.d */
396 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 14;
397 snprintf(instruction
->text
,
399 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
400 "\tDPREFI.d\t%" PRIu8
",[$r%" PRIu8
"+#%" PRId32
"]",
402 opcode
, instruction
->info
.sub_opc
,
403 instruction
->info
.ra
, instruction
->info
.imm
);
404 } else { /* DPREFI.w */
406 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 15;
407 snprintf(instruction
->text
,
409 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
410 "\tDPREFI.w\t%" PRIu8
",[$r%" PRIu8
"+#%" PRId32
"]",
412 opcode
, instruction
->info
.sub_opc
,
413 instruction
->info
.ra
, instruction
->info
.imm
);
417 case 4: /* LBSI.bi */
418 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
419 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
420 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 17; /* sign-extend */
421 instruction
->type
= NDS32_INSN_LOAD_STORE
;
422 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
423 &(instruction
->access_start
));
424 instruction
->access_end
= instruction
->access_start
+ 1;
425 snprintf(instruction
->text
,
427 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
428 "\tLBSI.bi\t$r%" PRIu8
",[$r%" PRIu8
"],#%" PRId32
,
430 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
431 instruction
->info
.imm
);
433 case 5: /* LHSI.bi */
434 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
435 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
436 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 16; /* sign-extend */
437 instruction
->type
= NDS32_INSN_LOAD_STORE
;
438 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
439 &(instruction
->access_start
));
440 instruction
->access_end
= instruction
->access_start
+ 2;
441 snprintf(instruction
->text
,
443 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
444 "\tLHSI.bi\t$r%" PRIu8
",[$r%" PRIu8
"],#%" PRId32
,
446 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
447 instruction
->info
.imm
);
450 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
), &(instruction
->info
.imm
));
451 instruction
->type
= NDS32_INSN_LOAD_STORE
;
452 if ((instruction
->info
.imm
>> 19) & 0x1) { /* LBSI.gp */
453 instruction
->info
.imm
= (instruction
->info
.imm
<< 13) >> 13;
454 nds32_get_mapped_reg(nds32
, R29
, &(instruction
->access_start
));
455 instruction
->access_start
+= instruction
->info
.imm
;
456 instruction
->access_end
= instruction
->access_start
+ 1;
457 snprintf(instruction
->text
,
459 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
460 "\tLBSI.gp\t$r%" PRIu8
",[#%" PRId32
"]",
462 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
463 } else { /* LBI.gp */
464 instruction
->info
.imm
= (instruction
->info
.imm
<< 13) >> 13;
465 nds32_get_mapped_reg(nds32
, R29
, &(instruction
->access_start
));
466 instruction
->access_start
+= instruction
->info
.imm
;
467 instruction
->access_end
= instruction
->access_start
+ 1;
468 snprintf(instruction
->text
,
470 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
471 "\tLBI.gp\t$r%" PRIu8
",[#%" PRId32
"]",
473 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
477 snprintf(instruction
->text
,
479 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
488 static int nds32_parse_mem(struct nds32
*nds32
, uint32_t opcode
, uint32_t address
,
489 struct nds32_instruction
*instruction
)
491 uint32_t sub_opcode
= opcode
& 0x3F;
492 uint32_t val_ra
, val_rb
;
493 switch (sub_opcode
>> 3) {
495 switch (sub_opcode
& 0x7) {
497 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
498 &(instruction
->info
.ra
), \
499 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
500 instruction
->type
= NDS32_INSN_LOAD_STORE
;
501 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
502 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
503 instruction
->access_start
= val_ra
+
504 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
505 instruction
->access_end
= instruction
->access_start
+ 1;
506 snprintf(instruction
->text
,
508 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
509 "\tLB\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
511 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
512 instruction
->info
.rb
,
513 (instruction
->info
.imm
>> 8) & 0x3);
516 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
517 &(instruction
->info
.ra
),
518 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
519 instruction
->type
= NDS32_INSN_LOAD_STORE
;
520 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
521 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
522 instruction
->access_start
= val_ra
+
523 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
524 instruction
->access_end
= instruction
->access_start
+ 2;
525 snprintf(instruction
->text
,
527 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
528 "\tLH\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
530 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
531 instruction
->info
.rb
,
532 (instruction
->info
.imm
>> 8) & 0x3);
535 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
536 &(instruction
->info
.ra
),
537 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
538 instruction
->type
= NDS32_INSN_LOAD_STORE
;
539 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
540 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
541 instruction
->access_start
= val_ra
+
542 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
543 instruction
->access_end
= instruction
->access_start
+ 4;
544 snprintf(instruction
->text
,
546 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
547 "\tLW\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
549 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
550 instruction
->info
.rb
,
551 (instruction
->info
.imm
>> 8) & 0x3);
554 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
555 &(instruction
->info
.ra
),
556 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
557 instruction
->type
= NDS32_INSN_LOAD_STORE
;
558 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
559 &(instruction
->access_start
));
560 instruction
->access_end
= instruction
->access_start
+ 1;
561 snprintf(instruction
->text
,
563 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
564 "\tLB.bi\t$r%" PRIu8
",[$r%" PRIu8
"],($r%" PRIu8
"<<%" PRId32
")",
566 opcode
, instruction
->info
.rt
,
567 instruction
->info
.ra
, instruction
->info
.rb
,
568 (instruction
->info
.imm
>> 8) & 0x3);
571 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
572 &(instruction
->info
.ra
),
573 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
574 instruction
->type
= NDS32_INSN_LOAD_STORE
;
575 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
576 &(instruction
->access_start
));
577 instruction
->access_end
= instruction
->access_start
+ 2;
578 snprintf(instruction
->text
,
580 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
581 "\tLH.bi\t$r%" PRIu8
",[$r%" PRIu8
"],($r%" PRIu8
"<<%" PRId32
")",
583 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
584 instruction
->info
.rb
,
585 (instruction
->info
.imm
>> 8) & 0x3);
588 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
589 &(instruction
->info
.ra
),
590 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
591 instruction
->type
= NDS32_INSN_LOAD_STORE
;
592 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
593 &(instruction
->access_start
));
594 instruction
->access_end
= instruction
->access_start
+ 4;
595 snprintf(instruction
->text
,
597 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
598 "\tLW.bi\t$r%" PRIu8
",[$r%" PRIu8
"],($r%" PRIu8
"<<%" PRId32
")",
600 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
601 instruction
->info
.rb
,
602 (instruction
->info
.imm
>> 8) & 0x3);
607 switch (sub_opcode
& 0x7) {
609 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
610 &(instruction
->info
.ra
),
611 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
612 instruction
->type
= NDS32_INSN_LOAD_STORE
;
613 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
614 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
615 instruction
->access_start
= val_ra
+
616 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
617 instruction
->access_end
= instruction
->access_start
+ 1;
618 snprintf(instruction
->text
,
620 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
621 "\tSB\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
623 opcode
, instruction
->info
.rt
,
624 instruction
->info
.ra
, instruction
->info
.rb
,
625 (instruction
->info
.imm
>> 8) & 0x3);
628 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
629 &(instruction
->info
.ra
),
630 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
631 instruction
->type
= NDS32_INSN_LOAD_STORE
;
632 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
633 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
634 instruction
->access_start
= val_ra
+
635 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
636 instruction
->access_end
= instruction
->access_start
+ 2;
637 snprintf(instruction
->text
,
639 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
640 "\tSH\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
642 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
643 instruction
->info
.rb
,
644 (instruction
->info
.imm
>> 8) & 0x3);
647 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
648 &(instruction
->info
.ra
),
649 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
650 instruction
->type
= NDS32_INSN_LOAD_STORE
;
651 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
652 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
653 instruction
->access_start
= val_ra
+
654 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
655 instruction
->access_end
= instruction
->access_start
+ 4;
656 snprintf(instruction
->text
,
658 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
659 "\tSW\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
661 opcode
, instruction
->info
.rt
,
662 instruction
->info
.ra
, instruction
->info
.rb
,
663 (instruction
->info
.imm
>> 8) & 0x3);
666 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
667 &(instruction
->info
.ra
),
668 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
669 instruction
->type
= NDS32_INSN_LOAD_STORE
;
670 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
671 &(instruction
->access_start
));
672 instruction
->access_end
= instruction
->access_start
+ 1;
673 snprintf(instruction
->text
,
675 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
676 "\tSB.bi\t$r%" PRIu8
",[$r%" PRIu8
"],($r%" PRIu8
"<<%" PRId32
")",
678 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
679 instruction
->info
.rb
,
680 (instruction
->info
.imm
>> 8) & 0x3);
683 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
684 &(instruction
->info
.ra
),
685 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
686 instruction
->type
= NDS32_INSN_LOAD_STORE
;
687 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
688 &(instruction
->access_start
));
689 instruction
->access_end
= instruction
->access_start
+ 2;
690 snprintf(instruction
->text
,
692 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
693 "\tSH.bi\t$r%" PRIu8
",[$r%" PRIu8
"],($r%" PRIu8
"<<%" PRId32
")",
695 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
696 instruction
->info
.rb
,
697 (instruction
->info
.imm
>> 8) & 0x3);
700 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
701 &(instruction
->info
.ra
),
702 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
703 instruction
->type
= NDS32_INSN_LOAD_STORE
;
704 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
705 &(instruction
->access_start
));
706 instruction
->access_end
= instruction
->access_start
+ 4;
707 snprintf(instruction
->text
,
709 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
710 "\tSW.bi\t$r%" PRIu8
",[$r%" PRIu8
"],($r%" PRIu8
"<<%" PRId32
")",
712 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
713 instruction
->info
.rb
,
714 (instruction
->info
.imm
>> 8) & 0x3);
719 switch (sub_opcode
& 0x7) {
721 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
722 &(instruction
->info
.ra
),
723 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
724 instruction
->type
= NDS32_INSN_LOAD_STORE
;
725 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
726 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
727 instruction
->access_start
= val_ra
+
728 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
729 instruction
->access_end
= instruction
->access_start
+ 1;
730 snprintf(instruction
->text
,
732 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
733 "\tLBS\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
735 opcode
, instruction
->info
.rt
,
736 instruction
->info
.ra
, instruction
->info
.rb
,
737 (instruction
->info
.imm
>> 8) & 0x3);
740 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
741 &(instruction
->info
.ra
),
742 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
743 instruction
->type
= NDS32_INSN_LOAD_STORE
;
744 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
745 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
746 instruction
->access_start
= val_ra
+
747 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
748 instruction
->access_end
= instruction
->access_start
+ 2;
749 snprintf(instruction
->text
,
751 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
752 "\tLHS\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
754 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
755 instruction
->info
.rb
,
756 (instruction
->info
.imm
>> 8) & 0x3);
759 nds32_parse_type_3(opcode
, &(instruction
->info
.sub_opc
),
760 &(instruction
->info
.ra
),
761 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
762 instruction
->type
= NDS32_INSN_MISC
;
763 snprintf(instruction
->text
,
765 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
766 "\tDPREF\t#%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<#%" PRId32
")]",
768 opcode
, instruction
->info
.sub_opc
,
769 instruction
->info
.ra
, instruction
->info
.rb
,
770 (instruction
->info
.imm
>> 8) & 0x3);
773 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
774 &(instruction
->info
.ra
),
775 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
776 instruction
->type
= NDS32_INSN_LOAD_STORE
;
777 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
778 &(instruction
->access_start
));
779 instruction
->access_end
= instruction
->access_start
+ 1;
780 snprintf(instruction
->text
,
782 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
783 "\tLBS.bi\t$r%" PRIu8
",[$r%" PRIu8
"],($r%" PRIu8
"<<%" PRId32
")",
785 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
786 instruction
->info
.rb
,
787 (instruction
->info
.imm
>> 8) & 0x3);
790 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
791 &(instruction
->info
.ra
),
792 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
793 instruction
->type
= NDS32_INSN_LOAD_STORE
;
794 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
795 &(instruction
->access_start
));
796 instruction
->access_end
= instruction
->access_start
+ 2;
797 snprintf(instruction
->text
,
799 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
800 "\tLHS.bi\t$r%" PRIu8
",[$r%" PRIu8
"],($r%" PRIu8
"<<%" PRId32
")",
802 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
803 instruction
->info
.rb
,
804 (instruction
->info
.imm
>> 8) & 0x3);
809 switch (sub_opcode
& 0x7) {
811 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
812 &(instruction
->info
.ra
),
813 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
814 instruction
->type
= NDS32_INSN_LOAD_STORE
;
815 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
816 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
817 instruction
->access_start
= val_ra
+
818 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
819 instruction
->access_end
= instruction
->access_start
+ 4;
820 snprintf(instruction
->text
,
822 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
823 "\tLLW\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
825 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
826 instruction
->info
.rb
,
827 (instruction
->info
.imm
>> 8) & 0x3);
830 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
831 &(instruction
->info
.ra
),
832 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
833 instruction
->type
= NDS32_INSN_LOAD_STORE
;
834 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
835 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
836 instruction
->access_start
= val_ra
+
837 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
838 instruction
->access_end
= instruction
->access_start
+ 4;
839 snprintf(instruction
->text
,
841 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
842 "\tSCW\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
844 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
845 instruction
->info
.rb
,
846 (instruction
->info
.imm
>> 8) & 0x3);
851 switch (sub_opcode
& 0x7) {
853 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
854 &(instruction
->info
.ra
),
855 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
856 instruction
->type
= NDS32_INSN_LOAD_STORE
;
857 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
858 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
859 instruction
->access_start
= val_ra
+
860 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
861 instruction
->access_end
= instruction
->access_start
+ 1;
862 snprintf(instruction
->text
,
864 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
865 "\tLBUP\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
867 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
868 instruction
->info
.rb
,
869 (instruction
->info
.imm
>> 8) & 0x3);
872 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
873 &(instruction
->info
.ra
),
874 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
875 instruction
->type
= NDS32_INSN_LOAD_STORE
;
876 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
877 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
878 instruction
->access_start
= val_ra
+
879 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
880 instruction
->access_end
= instruction
->access_start
+ 4;
881 snprintf(instruction
->text
,
883 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
884 "\tLWUP\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
886 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
887 instruction
->info
.rb
,
888 (instruction
->info
.imm
>> 8) & 0x3);
893 switch (sub_opcode
& 0x7) {
895 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
896 &(instruction
->info
.ra
),
897 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
898 instruction
->type
= NDS32_INSN_LOAD_STORE
;
899 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
900 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
901 instruction
->access_start
= val_ra
+
902 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
903 instruction
->access_end
= instruction
->access_start
+ 1;
904 snprintf(instruction
->text
,
906 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
907 "\tSBUP\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
909 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
910 instruction
->info
.rb
,
911 (instruction
->info
.imm
>> 8) & 0x3);
914 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
915 &(instruction
->info
.ra
),
916 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
917 instruction
->type
= NDS32_INSN_LOAD_STORE
;
918 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &val_ra
);
919 nds32_get_mapped_reg(nds32
, instruction
->info
.rb
, &val_rb
);
920 instruction
->access_start
= val_ra
+
921 (val_rb
<< ((instruction
->info
.imm
>> 8) & 0x3));
922 instruction
->access_end
= instruction
->access_start
+ 4;
923 snprintf(instruction
->text
,
925 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
926 "\tSWUP\t$r%" PRIu8
",[$r%" PRIu8
"+($r%" PRIu8
"<<%" PRId32
")]",
928 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
929 instruction
->info
.rb
,
930 (instruction
->info
.imm
>> 8) & 0x3);
935 snprintf(instruction
->text
,
937 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
946 static int nds32_calculate_lsmw_access_range(struct nds32
*nds32
,
947 struct nds32_instruction
*instruction
)
953 enable4
= (instruction
->info
.imm
>> 6) & 0xF;
954 ba
= (instruction
->info
.imm
>> 4) & 0x1;
955 id
= (instruction
->info
.imm
>> 3) & 0x1;
958 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &(instruction
->access_start
));
959 if (id
) { /* decrease */
960 /* access_end is the (last_element+1), so no need to minus 4 */
961 /* instruction->access_end -= 4; */
962 instruction
->access_end
= instruction
->access_start
;
963 } else { /* increase */
964 instruction
->access_start
+= 4;
967 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
, &(instruction
->access_start
));
968 instruction
->access_end
= instruction
->access_start
- 4;
971 if (id
) { /* decrease */
972 instruction
->access_start
= instruction
->access_end
-
973 4 * (instruction
->info
.rd
- instruction
->info
.rb
+ 1);
974 instruction
->access_start
-= (4 * enable4_bits
[enable4
]);
975 } else { /* increase */
976 instruction
->access_end
= instruction
->access_start
+
977 4 * (instruction
->info
.rd
- instruction
->info
.rb
+ 1);
978 instruction
->access_end
+= (4 * enable4_bits
[enable4
]);
984 static int nds32_parse_lsmw(struct nds32
*nds32
, uint32_t opcode
, uint32_t address
,
985 struct nds32_instruction
*instruction
)
987 if (opcode
& 0x20) { /* SMW, SMWA, SMWZB */
988 switch (opcode
& 0x3) {
992 nds32_parse_type_3(opcode
, &(instruction
->info
.rb
),
993 &(instruction
->info
.ra
),
994 &(instruction
->info
.rd
), &(instruction
->info
.imm
));
995 instruction
->type
= NDS32_INSN_LOAD_STORE
;
996 nds32_calculate_lsmw_access_range(nds32
, instruction
);
997 snprintf(instruction
->text
,
999 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1000 "\tSMW\t$r%" PRIu8
",[$r%" PRIu8
"],$r%" PRIu8
",%" PRId32
,
1002 opcode
, instruction
->info
.rb
, instruction
->info
.ra
,
1003 instruction
->info
.rd
,
1004 (instruction
->info
.imm
>> 6) & 0xF);
1007 nds32_parse_type_3(opcode
, &(instruction
->info
.rb
),
1008 &(instruction
->info
.ra
),
1009 &(instruction
->info
.rd
), &(instruction
->info
.imm
));
1010 instruction
->type
= NDS32_INSN_LOAD_STORE
;
1011 nds32_calculate_lsmw_access_range(nds32
, instruction
);
1012 snprintf(instruction
->text
,
1014 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1015 "\tSMWA\t$r%" PRIu8
",[$r%" PRIu8
"],$r%" PRIu8
",%" PRId32
,
1017 opcode
, instruction
->info
.rb
, instruction
->info
.ra
,
1018 instruction
->info
.rd
,
1019 (instruction
->info
.imm
>> 6) & 0xF);
1022 nds32_parse_type_3(opcode
, &(instruction
->info
.rb
),
1023 &(instruction
->info
.ra
),
1024 &(instruction
->info
.rd
), &(instruction
->info
.imm
));
1025 instruction
->type
= NDS32_INSN_LOAD_STORE
;
1026 /* TODO: calculate access_start/access_end */
1027 snprintf(instruction
->text
,
1029 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1030 "\tSMWZB\t$r%" PRIu8
",[$r%" PRIu8
"],$r%" PRIu8
",%" PRId32
,
1032 opcode
, instruction
->info
.rb
, instruction
->info
.ra
,
1033 instruction
->info
.rd
,
1034 (instruction
->info
.imm
>> 6) & 0xF);
1037 snprintf(instruction
->text
,
1039 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
1044 } else { /* LMW, LMWA, LMWZB */
1045 switch (opcode
& 0x3) {
1047 nds32_parse_type_3(opcode
, &(instruction
->info
.rb
),
1048 &(instruction
->info
.ra
),
1049 &(instruction
->info
.rd
), &(instruction
->info
.imm
));
1050 instruction
->type
= NDS32_INSN_LOAD_STORE
;
1051 nds32_calculate_lsmw_access_range(nds32
, instruction
);
1052 snprintf(instruction
->text
,
1054 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1055 "\tLMW\t$r%" PRIu8
",[$r%" PRIu8
"],$r%" PRIu8
",%" PRId32
,
1057 opcode
, instruction
->info
.rb
, instruction
->info
.ra
,
1058 instruction
->info
.rd
,
1059 (instruction
->info
.imm
>> 6) & 0xF);
1062 nds32_parse_type_3(opcode
, &(instruction
->info
.rb
),
1063 &(instruction
->info
.ra
),
1064 &(instruction
->info
.rd
), &(instruction
->info
.imm
));
1065 instruction
->type
= NDS32_INSN_LOAD_STORE
;
1066 nds32_calculate_lsmw_access_range(nds32
, instruction
);
1067 snprintf(instruction
->text
,
1069 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1070 "\tLMWA\t$r%" PRIu8
",[$r%" PRIu8
"],$r%" PRIu8
",%" PRId32
,
1072 opcode
, instruction
->info
.rb
, instruction
->info
.ra
,
1073 instruction
->info
.rd
,
1074 (instruction
->info
.imm
>> 6) & 0xF);
1077 nds32_parse_type_3(opcode
, &(instruction
->info
.rb
),
1078 &(instruction
->info
.ra
),
1079 &(instruction
->info
.rd
), &(instruction
->info
.imm
));
1080 instruction
->type
= NDS32_INSN_LOAD_STORE
;
1081 /* TODO: calculate access_start/access_end */
1082 snprintf(instruction
->text
,
1084 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1085 "\tLMWZB\t$r%" PRIu8
",[$r%" PRIu8
"],$r%" PRIu8
",%" PRId32
,
1087 opcode
, instruction
->info
.rb
, instruction
->info
.ra
,
1088 instruction
->info
.rd
,
1089 (instruction
->info
.imm
>> 6) & 0xF);
1092 snprintf(instruction
->text
,
1094 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
1104 static int nds32_parse_hwgp(struct nds32
*nds32
, uint32_t opcode
, uint32_t address
,
1105 struct nds32_instruction
*instruction
)
1107 switch ((opcode
>> 18) & 0x3) {
1108 case 0: /* LHI.gp */
1109 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
), &(instruction
->info
.imm
));
1110 instruction
->info
.imm
= (instruction
->info
.imm
<< 14) >> 13; /* sign-extend */
1111 instruction
->type
= NDS32_INSN_LOAD_STORE
;
1112 nds32_get_mapped_reg(nds32
, R29
, &(instruction
->access_start
));
1113 instruction
->access_start
+= instruction
->info
.imm
;
1114 instruction
->access_end
= instruction
->access_start
+ 2;
1115 snprintf(instruction
->text
,
1117 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1118 "\tLHI.gp\t$r%" PRIu8
",[#%" PRId32
"]",
1120 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
1122 case 1: /* LHSI.gp */
1123 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
), &(instruction
->info
.imm
));
1124 instruction
->info
.imm
= (instruction
->info
.imm
<< 14) >> 13; /* sign-extend */
1125 instruction
->type
= NDS32_INSN_LOAD_STORE
;
1126 nds32_get_mapped_reg(nds32
, R29
, &(instruction
->access_start
));
1127 instruction
->access_start
+= instruction
->info
.imm
;
1128 instruction
->access_end
= instruction
->access_start
+ 2;
1129 snprintf(instruction
->text
,
1131 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1132 "\tLHSI.gp\t$r%" PRIu8
",[#%" PRId32
"]",
1134 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
1136 case 2: /* SHI.gp */
1137 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
), &(instruction
->info
.imm
));
1138 instruction
->info
.imm
= (instruction
->info
.imm
<< 14) >> 13; /* sign-extend */
1139 instruction
->type
= NDS32_INSN_LOAD_STORE
;
1140 nds32_get_mapped_reg(nds32
, R29
, &(instruction
->access_start
));
1141 instruction
->access_start
+= instruction
->info
.imm
;
1142 instruction
->access_end
= instruction
->access_start
+ 2;
1143 snprintf(instruction
->text
,
1145 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1146 "\tSHI.gp\t$r%" PRIu8
",[#%" PRId32
"]",
1148 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
1151 instruction
->type
= NDS32_INSN_LOAD_STORE
;
1152 if ((opcode
>> 17) & 0x1) { /* SWI.gp */
1153 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
1154 &(instruction
->info
.imm
));
1156 instruction
->info
.imm
= (instruction
->info
.imm
<< 15) >> 13;
1157 nds32_get_mapped_reg(nds32
, R29
, &(instruction
->access_start
));
1158 instruction
->access_start
+= instruction
->info
.imm
;
1159 instruction
->access_end
= instruction
->access_start
+ 4;
1160 snprintf(instruction
->text
,
1162 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1163 "\tSWI.gp\t$r%" PRIu8
",[#%" PRId32
"]",
1165 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
1166 } else { /* LWI.gp */
1167 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
1168 &(instruction
->info
.imm
));
1170 instruction
->info
.imm
= (instruction
->info
.imm
<< 15) >> 13;
1171 nds32_get_mapped_reg(nds32
, R29
, &(instruction
->access_start
));
1172 instruction
->access_start
+= instruction
->info
.imm
;
1173 instruction
->access_end
= instruction
->access_start
+ 4;
1174 snprintf(instruction
->text
,
1176 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1177 "\tLWI.gp\t$r%" PRIu8
",[#%" PRId32
"]",
1179 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
1184 snprintf(instruction
->text
,
1186 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
1195 static int nds32_parse_sbgp(struct nds32
*nds32
, uint32_t opcode
, uint32_t address
,
1196 struct nds32_instruction
*instruction
)
1198 switch ((opcode
>> 19) & 0x1) {
1199 case 0: /* SBI.gp */
1200 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
), &(instruction
->info
.imm
));
1201 instruction
->info
.imm
= (instruction
->info
.imm
<< 13) >> 13; /* sign-extend */
1202 instruction
->type
= NDS32_INSN_LOAD_STORE
;
1203 nds32_get_mapped_reg(nds32
, R29
, &(instruction
->access_start
));
1204 instruction
->access_start
+= instruction
->info
.imm
;
1205 instruction
->access_end
= instruction
->access_start
+ 1;
1206 snprintf(instruction
->text
,
1208 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1209 "\tSBI.gp\t$r%" PRIu8
",[#%" PRId32
"]",
1211 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
1213 case 1: /* ADDI.gp */
1214 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
), &(instruction
->info
.imm
));
1215 instruction
->info
.imm
= (instruction
->info
.imm
<< 13) >> 13; /* sign-extend */
1216 instruction
->type
= NDS32_INSN_DATA_PROC
;
1217 snprintf(instruction
->text
,
1219 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1220 "\tADDI.gp\t$r%" PRIu8
",#%" PRId32
"",
1222 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
1225 snprintf(instruction
->text
,
1227 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
1236 static int nds32_parse_group_3_insn(struct nds32
*nds32
, uint32_t opcode
, uint32_t address
,
1237 struct nds32_instruction
*instruction
)
1241 opc_6
= instruction
->info
.opc_6
;
1243 switch (opc_6
& 0x7) {
1245 nds32_parse_mem(nds32
, opcode
, address
, instruction
);
1248 nds32_parse_lsmw(nds32
, opcode
, address
, instruction
);
1251 nds32_parse_hwgp(nds32
, opcode
, address
, instruction
);
1254 nds32_parse_sbgp(nds32
, opcode
, address
, instruction
);
1257 snprintf(instruction
->text
,
1259 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
1268 static int nds32_parse_alu_1(uint32_t opcode
, uint32_t address
,
1269 struct nds32_instruction
*instruction
)
1271 switch (opcode
& 0x1F) {
1273 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
), &(instruction
->info
.ra
),
1274 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1275 instruction
->type
= NDS32_INSN_DATA_PROC
;
1276 instruction
->info
.imm
= (instruction
->info
.imm
>> 5) & 0x1F;
1277 if (instruction
->info
.imm
)
1278 snprintf(instruction
->text
,
1280 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1281 "\tADD_SLLI\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",%" PRId32
,
1283 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1284 instruction
->info
.rb
,
1285 instruction
->info
.imm
);
1287 snprintf(instruction
->text
,
1289 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1290 "\tADD\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1292 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1293 instruction
->info
.rb
);
1296 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1297 &(instruction
->info
.ra
),
1298 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1299 instruction
->type
= NDS32_INSN_DATA_PROC
;
1300 instruction
->info
.imm
= (instruction
->info
.imm
>> 5) & 0x1F;
1301 if (instruction
->info
.imm
)
1302 snprintf(instruction
->text
,
1304 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1305 "\tSUB_SLLI\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",%" PRId32
,
1307 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1308 instruction
->info
.rb
,
1309 instruction
->info
.imm
);
1311 snprintf(instruction
->text
,
1313 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1314 "\tSUB\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
"",
1316 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1317 instruction
->info
.rb
);
1320 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1321 &(instruction
->info
.ra
),
1322 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1323 instruction
->type
= NDS32_INSN_DATA_PROC
;
1324 instruction
->info
.imm
= (instruction
->info
.imm
>> 5) & 0x1F;
1325 if (instruction
->info
.imm
)
1326 snprintf(instruction
->text
,
1328 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1329 "\tAND_SLLI\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",%" PRId32
,
1331 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1332 instruction
->info
.rb
,
1333 instruction
->info
.imm
);
1335 snprintf(instruction
->text
,
1337 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1338 "\tAND\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
"",
1340 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1341 instruction
->info
.rb
);
1344 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1345 &(instruction
->info
.ra
),
1346 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1347 instruction
->type
= NDS32_INSN_DATA_PROC
;
1348 instruction
->info
.imm
= (instruction
->info
.imm
>> 5) & 0x1F;
1349 if (instruction
->info
.imm
)
1350 snprintf(instruction
->text
,
1352 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1353 "\tXOR_SLLI\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",%" PRId32
,
1355 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1356 instruction
->info
.rb
,
1357 instruction
->info
.imm
);
1359 snprintf(instruction
->text
,
1361 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1362 "\tXOR\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1364 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1365 instruction
->info
.rb
);
1368 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1369 &(instruction
->info
.ra
),
1370 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1371 instruction
->type
= NDS32_INSN_DATA_PROC
;
1372 instruction
->info
.imm
= (instruction
->info
.imm
>> 5) & 0x1F;
1373 if (instruction
->info
.imm
)
1374 snprintf(instruction
->text
,
1376 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1377 "\tOR_SLLI\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",%" PRId32
,
1379 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1380 instruction
->info
.rb
,
1381 instruction
->info
.imm
);
1383 snprintf(instruction
->text
,
1385 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1386 "\tOR\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1388 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1389 instruction
->info
.rb
);
1392 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1393 &(instruction
->info
.ra
),
1394 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1395 instruction
->type
= NDS32_INSN_DATA_PROC
;
1396 snprintf(instruction
->text
,
1398 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1399 "\tNOR\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1401 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1402 instruction
->info
.rb
);
1405 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1406 &(instruction
->info
.ra
),
1407 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1408 instruction
->type
= NDS32_INSN_DATA_PROC
;
1409 snprintf(instruction
->text
,
1411 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1412 "\tSLT\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1414 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1415 instruction
->info
.rb
);
1418 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1419 &(instruction
->info
.ra
),
1420 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1421 instruction
->type
= NDS32_INSN_DATA_PROC
;
1422 snprintf(instruction
->text
,
1424 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1425 "\tSLTS\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1427 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1428 instruction
->info
.rb
);
1430 case 8: { /* SLLI */
1433 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1434 &(instruction
->info
.ra
),
1436 instruction
->info
.imm
= imm
;
1437 instruction
->type
= NDS32_INSN_DATA_PROC
;
1438 snprintf(instruction
->text
,
1440 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1441 "\tSLLI\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
1443 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1444 instruction
->info
.imm
);
1447 case 9: { /* SRLI */
1450 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1451 &(instruction
->info
.ra
),
1453 instruction
->info
.imm
= imm
;
1454 instruction
->type
= NDS32_INSN_DATA_PROC
;
1455 snprintf(instruction
->text
,
1457 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1458 "\tSRLI\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
1460 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1461 instruction
->info
.imm
);
1464 case 10: { /* SRAI */
1467 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1468 &(instruction
->info
.ra
),
1470 instruction
->info
.imm
= imm
;
1471 instruction
->type
= NDS32_INSN_DATA_PROC
;
1472 snprintf(instruction
->text
,
1474 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1475 "\tSRAI\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
1477 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1478 instruction
->info
.imm
);
1481 case 11: { /* ROTRI */
1484 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1485 &(instruction
->info
.ra
),
1487 instruction
->info
.imm
= imm
;
1488 instruction
->type
= NDS32_INSN_DATA_PROC
;
1489 snprintf(instruction
->text
,
1491 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1492 "\tROTRI\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
1494 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1495 instruction
->info
.imm
);
1498 case 12: { /* SLL */
1499 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1500 &(instruction
->info
.ra
),
1501 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1502 instruction
->type
= NDS32_INSN_DATA_PROC
;
1503 snprintf(instruction
->text
,
1505 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1506 "\tSLL\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1508 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1509 instruction
->info
.rb
);
1512 case 13: { /* SRL */
1513 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1514 &(instruction
->info
.ra
),
1515 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1516 instruction
->type
= NDS32_INSN_DATA_PROC
;
1517 snprintf(instruction
->text
,
1519 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1520 "\tSRL\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1522 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1523 instruction
->info
.rb
);
1526 case 14: { /* SRA */
1527 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1528 &(instruction
->info
.ra
),
1529 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1530 instruction
->type
= NDS32_INSN_DATA_PROC
;
1531 snprintf(instruction
->text
,
1533 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1534 "\tSRA\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1536 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1537 instruction
->info
.rb
);
1540 case 15: { /* ROTR */
1541 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1542 &(instruction
->info
.ra
),
1543 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1544 instruction
->type
= NDS32_INSN_DATA_PROC
;
1545 snprintf(instruction
->text
,
1547 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1548 "\tROTR\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1550 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1551 instruction
->info
.rb
);
1554 case 16: { /* SEB */
1555 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
1556 &(instruction
->info
.ra
),
1557 &(instruction
->info
.imm
));
1558 instruction
->type
= NDS32_INSN_DATA_PROC
;
1559 snprintf(instruction
->text
,
1561 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1562 "\tSEB\t$r%" PRIu8
",$r%" PRIu8
,
1564 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
1567 case 17: { /* SEH */
1568 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
1569 &(instruction
->info
.ra
),
1570 &(instruction
->info
.imm
));
1571 instruction
->type
= NDS32_INSN_DATA_PROC
;
1572 snprintf(instruction
->text
,
1574 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1575 "\tSEH\t$r%" PRIu8
",$r%" PRIu8
,
1577 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
1581 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1582 &(instruction
->info
.ra
),
1583 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1584 instruction
->type
= NDS32_INSN_DATA_PROC
;
1585 snprintf(instruction
->text
,
1587 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1588 "\tBITC\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1590 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1591 instruction
->info
.rb
);
1593 case 19: { /* ZEH */
1594 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
1595 &(instruction
->info
.ra
),
1596 &(instruction
->info
.imm
));
1597 instruction
->type
= NDS32_INSN_DATA_PROC
;
1598 snprintf(instruction
->text
,
1600 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1601 "\tZEH\t$r%" PRIu8
",$r%" PRIu8
,
1603 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
1606 case 20: { /* WSBH */
1607 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
1608 &(instruction
->info
.ra
),
1609 &(instruction
->info
.imm
));
1610 instruction
->type
= NDS32_INSN_DATA_PROC
;
1611 snprintf(instruction
->text
,
1613 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1614 "\tWSBH\t$r%" PRIu8
",$r%" PRIu8
,
1616 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
1619 case 21: /* OR_SRLI */
1620 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1621 &(instruction
->info
.ra
),
1622 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1623 instruction
->type
= NDS32_INSN_DATA_PROC
;
1624 instruction
->info
.imm
= (instruction
->info
.imm
>> 5) & 0x1F;
1625 if (instruction
->info
.imm
)
1626 snprintf(instruction
->text
,
1628 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1629 "\tOR_SRLI\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",%" PRId32
,
1631 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1632 instruction
->info
.rb
,
1633 instruction
->info
.imm
);
1635 snprintf(instruction
->text
,
1637 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1638 "\tOR\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1640 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1641 instruction
->info
.rb
);
1643 case 22: { /* DIVSR */
1644 nds32_parse_type_4(opcode
, &(instruction
->info
.rt
),
1645 &(instruction
->info
.ra
),
1646 &(instruction
->info
.rb
), &(instruction
->info
.rd
),
1647 &(instruction
->info
.sub_opc
));
1648 instruction
->type
= NDS32_INSN_DATA_PROC
;
1649 snprintf(instruction
->text
,
1651 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1652 "\tDIVSR\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1654 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1655 instruction
->info
.rb
,
1656 instruction
->info
.rd
);
1659 case 23: { /* DIVR */
1660 nds32_parse_type_4(opcode
, &(instruction
->info
.rt
),
1661 &(instruction
->info
.ra
),
1662 &(instruction
->info
.rb
), &(instruction
->info
.rd
),
1663 &(instruction
->info
.sub_opc
));
1664 instruction
->type
= NDS32_INSN_DATA_PROC
;
1665 snprintf(instruction
->text
,
1667 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1668 "\tDIVR\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1670 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1671 instruction
->info
.rb
,
1672 instruction
->info
.rd
);
1675 case 24: { /* SVA */
1676 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1677 &(instruction
->info
.ra
),
1678 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1679 instruction
->type
= NDS32_INSN_DATA_PROC
;
1680 snprintf(instruction
->text
,
1682 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1683 "\tSVA\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1685 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1686 instruction
->info
.rb
);
1689 case 25: { /* SVS */
1690 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1691 &(instruction
->info
.ra
),
1692 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1693 instruction
->type
= NDS32_INSN_DATA_PROC
;
1694 snprintf(instruction
->text
,
1696 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1697 "\tSVS\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1699 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1700 instruction
->info
.rb
);
1703 case 26: { /* CMOVZ */
1704 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1705 &(instruction
->info
.ra
),
1706 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1707 instruction
->type
= NDS32_INSN_MISC
;
1708 snprintf(instruction
->text
,
1710 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1711 "\tCMOVZ\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1713 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1714 instruction
->info
.rb
);
1717 case 27: { /* CMOVN */
1718 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1719 &(instruction
->info
.ra
),
1720 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1721 instruction
->type
= NDS32_INSN_MISC
;
1722 snprintf(instruction
->text
,
1724 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1725 "\tCMOVN\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1727 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1728 instruction
->info
.rb
);
1731 case 28: /* ADD_SRLI */
1732 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1733 &(instruction
->info
.ra
),
1734 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1735 instruction
->type
= NDS32_INSN_DATA_PROC
;
1736 instruction
->info
.imm
= (instruction
->info
.imm
>> 5) & 0x1F;
1737 if (instruction
->info
.imm
)
1738 snprintf(instruction
->text
,
1740 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1741 "\tADD_SRLI\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",%" PRId32
,
1743 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1744 instruction
->info
.rb
,
1745 instruction
->info
.imm
);
1747 snprintf(instruction
->text
,
1749 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1750 "\tADD\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1752 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1753 instruction
->info
.rb
);
1755 case 29: /* SUB_SRLI */
1756 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1757 &(instruction
->info
.ra
),
1758 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1759 instruction
->type
= NDS32_INSN_DATA_PROC
;
1760 instruction
->info
.imm
= (instruction
->info
.imm
>> 5) & 0x1F;
1761 if (instruction
->info
.imm
)
1762 snprintf(instruction
->text
,
1764 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1765 "\tSUB_SRLI\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",%" PRId32
,
1767 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1768 instruction
->info
.rb
,
1769 instruction
->info
.imm
);
1771 snprintf(instruction
->text
,
1773 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1774 "\tSUB\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1776 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1777 instruction
->info
.rb
);
1779 case 30: /* AND_SRLI */
1780 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1781 &(instruction
->info
.ra
),
1782 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1783 instruction
->type
= NDS32_INSN_DATA_PROC
;
1784 instruction
->info
.imm
= (instruction
->info
.imm
>> 5) & 0x1F;
1785 if (instruction
->info
.imm
)
1786 snprintf(instruction
->text
,
1788 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1789 "\tAND_SRLI\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",%" PRId32
,
1791 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1792 instruction
->info
.rb
,
1793 instruction
->info
.imm
);
1795 snprintf(instruction
->text
,
1797 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1798 "\tAND\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1800 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1801 instruction
->info
.rb
);
1803 case 31: /* XOR_SRLI */
1804 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1805 &(instruction
->info
.ra
),
1806 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1807 instruction
->type
= NDS32_INSN_DATA_PROC
;
1808 instruction
->info
.imm
= (instruction
->info
.imm
>> 5) & 0x1F;
1809 if (instruction
->info
.imm
)
1810 snprintf(instruction
->text
,
1812 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1813 "\tXOR_SRLI\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
",%" PRId32
,
1815 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1816 instruction
->info
.rb
,
1817 instruction
->info
.imm
);
1819 snprintf(instruction
->text
,
1821 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1822 "\tXOR\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1824 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1825 instruction
->info
.rb
);
1828 snprintf(instruction
->text
,
1830 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
1839 static int nds32_parse_alu_2(uint32_t opcode
, uint32_t address
,
1840 struct nds32_instruction
*instruction
)
1842 switch (opcode
& 0x3F) {
1844 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1845 &(instruction
->info
.ra
),
1846 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1847 instruction
->type
= NDS32_INSN_DATA_PROC
;
1848 snprintf(instruction
->text
,
1850 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1851 "\tMAX\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1853 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1854 instruction
->info
.rb
);
1857 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1858 &(instruction
->info
.ra
),
1859 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1860 instruction
->type
= NDS32_INSN_DATA_PROC
;
1861 snprintf(instruction
->text
,
1863 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1864 "\tMIN\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1866 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1867 instruction
->info
.rb
);
1870 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1871 &(instruction
->info
.ra
),
1872 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
1873 instruction
->type
= NDS32_INSN_DATA_PROC
;
1874 snprintf(instruction
->text
,
1876 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1877 "\tAVE\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
1879 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1880 instruction
->info
.rb
);
1883 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
1884 &(instruction
->info
.ra
),
1885 &(instruction
->info
.imm
));
1886 instruction
->type
= NDS32_INSN_DATA_PROC
;
1887 snprintf(instruction
->text
,
1889 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1890 "\tAVE\t$r%" PRIu8
",$r%" PRIu8
,
1892 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
1894 case 4: { /* CLIPS */
1896 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1897 &(instruction
->info
.ra
),
1898 &imm
, &(instruction
->info
.imm
));
1899 instruction
->info
.imm
= imm
;
1900 instruction
->type
= NDS32_INSN_DATA_PROC
;
1901 snprintf(instruction
->text
,
1903 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1904 "\tCLIPS\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
1906 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1907 instruction
->info
.imm
);
1910 case 5: { /* CLIP */
1912 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1913 &(instruction
->info
.ra
),
1914 &imm
, &(instruction
->info
.imm
));
1915 instruction
->info
.imm
= imm
;
1916 instruction
->type
= NDS32_INSN_DATA_PROC
;
1917 snprintf(instruction
->text
,
1919 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1920 "\tCLIP\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
1922 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1923 instruction
->info
.imm
);
1927 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
1928 &(instruction
->info
.ra
),
1929 &(instruction
->info
.imm
));
1930 instruction
->type
= NDS32_INSN_DATA_PROC
;
1931 snprintf(instruction
->text
,
1933 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1934 "\tCLO\t$r%" PRIu8
",$r%" PRIu8
,
1936 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
1939 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
1940 &(instruction
->info
.ra
),
1941 &(instruction
->info
.imm
));
1942 instruction
->type
= NDS32_INSN_DATA_PROC
;
1943 snprintf(instruction
->text
,
1945 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1946 "\tCLZ\t$r%" PRIu8
",$r%" PRIu8
,
1948 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
1950 case 8: { /* BSET */
1952 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1953 &(instruction
->info
.ra
),
1954 &imm
, &(instruction
->info
.imm
));
1955 instruction
->info
.imm
= imm
;
1956 instruction
->type
= NDS32_INSN_DATA_PROC
;
1957 snprintf(instruction
->text
,
1959 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1960 "\tBSET\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
1962 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1963 instruction
->info
.imm
);
1966 case 9: { /* BCLR */
1968 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1969 &(instruction
->info
.ra
),
1970 &imm
, &(instruction
->info
.imm
));
1971 instruction
->info
.imm
= imm
;
1972 instruction
->type
= NDS32_INSN_DATA_PROC
;
1973 snprintf(instruction
->text
,
1975 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1976 "\tBCLR\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
1978 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1979 instruction
->info
.imm
);
1982 case 10: { /* BTGL */
1984 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
1985 &(instruction
->info
.ra
),
1986 &imm
, &(instruction
->info
.imm
));
1987 instruction
->info
.imm
= imm
;
1988 instruction
->type
= NDS32_INSN_DATA_PROC
;
1989 snprintf(instruction
->text
,
1991 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
1992 "\tBTGL\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
1994 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
1995 instruction
->info
.imm
);
1998 case 11: { /* BTST */
2000 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
2001 &(instruction
->info
.ra
),
2002 &imm
, &(instruction
->info
.imm
));
2003 instruction
->info
.imm
= imm
;
2004 instruction
->type
= NDS32_INSN_DATA_PROC
;
2005 snprintf(instruction
->text
,
2007 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2008 "\tBTST\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
2010 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2011 instruction
->info
.imm
);
2015 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
2016 &(instruction
->info
.ra
),
2017 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2018 instruction
->type
= NDS32_INSN_DATA_PROC
;
2019 snprintf(instruction
->text
,
2021 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2022 "\tBSE\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2024 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2025 instruction
->info
.rb
);
2028 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
2029 &(instruction
->info
.ra
),
2030 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2031 instruction
->type
= NDS32_INSN_DATA_PROC
;
2032 snprintf(instruction
->text
,
2034 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2035 "\tBSP\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2037 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2038 instruction
->info
.rb
);
2041 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
2042 &(instruction
->info
.ra
),
2043 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2044 instruction
->type
= NDS32_INSN_DATA_PROC
;
2045 snprintf(instruction
->text
,
2047 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2048 "\tFFB\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2050 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2051 instruction
->info
.rb
);
2053 case 15: /* FFMISM */
2054 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
2055 &(instruction
->info
.ra
),
2056 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2057 instruction
->type
= NDS32_INSN_DATA_PROC
;
2058 snprintf(instruction
->text
,
2060 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2061 "\tFFMISM\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2063 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2064 instruction
->info
.rb
);
2066 case 23: /* FFZMISM */
2067 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
2068 &(instruction
->info
.ra
),
2069 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2070 instruction
->type
= NDS32_INSN_DATA_PROC
;
2071 snprintf(instruction
->text
,
2073 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2074 "\tFFZMISM\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2076 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2077 instruction
->info
.rb
);
2079 case 32: /* MFUSR */
2080 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2081 &(instruction
->info
.imm
));
2082 instruction
->type
= NDS32_INSN_RESOURCE_ACCESS
;
2083 snprintf(instruction
->text
,
2085 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2086 "\tMFUSR\t$r%" PRIu8
",#%" PRId32
,
2088 opcode
, instruction
->info
.rt
,
2089 (instruction
->info
.imm
>> 10) & 0x3FF);
2091 case 33: /* MTUSR */
2092 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2093 &(instruction
->info
.imm
));
2094 instruction
->type
= NDS32_INSN_RESOURCE_ACCESS
;
2095 snprintf(instruction
->text
,
2097 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2098 "\tMTUSR\t$r%" PRIu8
",#%" PRId32
,
2100 opcode
, instruction
->info
.rt
,
2101 (instruction
->info
.imm
>> 10) & 0x3FF);
2104 nds32_parse_type_3(opcode
, &(instruction
->info
.rt
),
2105 &(instruction
->info
.ra
),
2106 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2107 instruction
->type
= NDS32_INSN_DATA_PROC
;
2108 snprintf(instruction
->text
,
2110 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2111 "\tMUL\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2113 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2114 instruction
->info
.rb
);
2116 case 40: { /* MULTS64 */
2118 nds32_parse_type_3(opcode
, &dt_val
,
2119 &(instruction
->info
.ra
),
2120 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2121 instruction
->type
= NDS32_INSN_DATA_PROC
;
2122 snprintf(instruction
->text
,
2124 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2125 "\tMULTS64\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2127 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2128 instruction
->info
.rb
);
2131 case 41: { /* MULT64 */
2133 nds32_parse_type_3(opcode
, &dt_val
,
2134 &(instruction
->info
.ra
),
2135 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2136 instruction
->type
= NDS32_INSN_DATA_PROC
;
2137 snprintf(instruction
->text
,
2139 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2140 "\tMULT64\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2142 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2143 instruction
->info
.rb
);
2146 case 42: { /* MADDS64 */
2148 nds32_parse_type_3(opcode
, &dt_val
, &(instruction
->info
.ra
),
2149 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2150 instruction
->type
= NDS32_INSN_DATA_PROC
;
2151 snprintf(instruction
->text
,
2153 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2154 "\tMADDS64\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2156 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2157 instruction
->info
.rb
);
2160 case 43: { /* MADD64 */
2162 nds32_parse_type_3(opcode
, &dt_val
, &(instruction
->info
.ra
),
2163 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2164 instruction
->type
= NDS32_INSN_DATA_PROC
;
2165 snprintf(instruction
->text
,
2167 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2168 "\tMADD64\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2170 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2171 instruction
->info
.rb
);
2174 case 44: { /* MSUBS64 */
2176 nds32_parse_type_3(opcode
, &dt_val
, &(instruction
->info
.ra
),
2177 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2178 instruction
->type
= NDS32_INSN_DATA_PROC
;
2179 snprintf(instruction
->text
,
2181 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2182 "\tMSUBS64\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2184 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2185 instruction
->info
.rb
);
2188 case 45: { /* MSUB64 */
2190 nds32_parse_type_3(opcode
, &dt_val
, &(instruction
->info
.ra
),
2191 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2192 instruction
->type
= NDS32_INSN_DATA_PROC
;
2193 snprintf(instruction
->text
,
2195 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2196 "\tMSUB64\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2198 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2199 instruction
->info
.rb
);
2202 case 46: { /* DIVS */
2204 nds32_parse_type_3(opcode
, &dt_val
, &(instruction
->info
.ra
),
2205 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2206 instruction
->type
= NDS32_INSN_DATA_PROC
;
2207 snprintf(instruction
->text
,
2209 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2210 "\tDIVS\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2212 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2213 instruction
->info
.rb
);
2216 case 47: { /* DIV */
2218 nds32_parse_type_3(opcode
, &dt_val
, &(instruction
->info
.ra
),
2219 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2220 instruction
->type
= NDS32_INSN_DATA_PROC
;
2221 snprintf(instruction
->text
,
2223 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2224 "\tDIV\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2226 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2227 instruction
->info
.rb
);
2230 case 49: { /* MULT32 */
2232 nds32_parse_type_3(opcode
, &dt_val
, &(instruction
->info
.ra
),
2233 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2234 instruction
->type
= NDS32_INSN_DATA_PROC
;
2235 snprintf(instruction
->text
,
2237 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2238 "\tMULT32\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2240 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2241 instruction
->info
.rb
);
2244 case 51: { /* MADD32 */
2246 nds32_parse_type_3(opcode
, &dt_val
, &(instruction
->info
.ra
),
2247 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2248 instruction
->type
= NDS32_INSN_DATA_PROC
;
2249 snprintf(instruction
->text
,
2251 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2252 "\tMADD32\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2254 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2255 instruction
->info
.rb
);
2258 case 53: { /* MSUB32 */
2260 nds32_parse_type_3(opcode
, &dt_val
, &(instruction
->info
.ra
),
2261 &(instruction
->info
.rb
), &(instruction
->info
.imm
));
2262 instruction
->type
= NDS32_INSN_DATA_PROC
;
2263 snprintf(instruction
->text
,
2265 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2266 "\tMSUB32\t$D%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
2268 opcode
, (uint8_t)((dt_val
>> 1) & 0x1), instruction
->info
.ra
,
2269 instruction
->info
.rb
);
2273 snprintf(instruction
->text
,
2275 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
2284 static int nds32_parse_group_4_insn(struct nds32
*nds32
, uint32_t opcode
,
2285 uint32_t address
, struct nds32_instruction
*instruction
)
2289 opc_6
= instruction
->info
.opc_6
;
2291 switch (opc_6
& 0x7) {
2293 nds32_parse_alu_1(opcode
, address
, instruction
);
2296 nds32_parse_alu_2(opcode
, address
, instruction
);
2299 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2300 &(instruction
->info
.imm
));
2302 instruction
->info
.imm
= (instruction
->info
.imm
<< 12) >> 12;
2303 instruction
->type
= NDS32_INSN_DATA_PROC
;
2304 snprintf(instruction
->text
,
2306 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2307 "\tMOVI\t$r%" PRIu8
",#%" PRId32
,
2309 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2312 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2313 &(instruction
->info
.imm
));
2314 instruction
->type
= NDS32_INSN_DATA_PROC
;
2315 snprintf(instruction
->text
,
2317 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2318 "\tSETHI\t$r%" PRIu8
",0x%8.8" PRIx32
,
2320 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2323 nds32_parse_type_0(opcode
, &(instruction
->info
.imm
));
2325 instruction
->info
.imm
= (instruction
->info
.imm
<< 8) >> 8;
2326 instruction
->type
= NDS32_INSN_JUMP_BRANCH
;
2327 if ((instruction
->info
.imm
>> 24) & 0x1) { /* JAL */
2328 snprintf(instruction
->text
,
2330 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2333 opcode
, instruction
->info
.imm
);
2335 snprintf(instruction
->text
,
2337 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2340 opcode
, instruction
->info
.imm
);
2343 case 5: { /* JREG */
2345 nds32_parse_type_0(opcode
, &imm
);
2346 instruction
->info
.rb
= (imm
>> 10) & 0x1F;
2347 instruction
->type
= NDS32_INSN_JUMP_BRANCH
;
2348 switch (imm
& 0x1F) {
2351 if (imm
& 0x20) { /* RET */
2352 snprintf(instruction
->text
,
2354 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2357 opcode
, instruction
->info
.rb
);
2359 snprintf(instruction
->text
,
2361 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2364 opcode
, instruction
->info
.rb
);
2368 instruction
->info
.rt
= (imm
>> 20) & 0x1F;
2369 snprintf(instruction
->text
,
2371 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2372 "\tJRAL\t$r%" PRIu8
",$r%" PRIu8
,
2374 opcode
, instruction
->info
.rt
, instruction
->info
.rb
);
2377 snprintf(instruction
->text
,
2379 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2380 "\tJRNEZ\t$r%" PRIu8
,
2382 opcode
, instruction
->info
.rb
);
2384 case 3: /* JRALNEZ */
2385 instruction
->info
.rt
= (imm
>> 20) & 0x1F;
2386 if (instruction
->info
.rt
== R30
)
2387 snprintf(instruction
->text
,
2389 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2390 "\tJRALNEZ\t$r%" PRIu8
,
2392 opcode
, instruction
->info
.rb
);
2394 snprintf(instruction
->text
,
2396 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2397 "\tJRALNEZ\t$r%" PRIu8
",$r%" PRIu8
,
2400 instruction
->info
.rt
,
2401 instruction
->info
.rb
);
2409 nds32_parse_type_0(opcode
, &imm
);
2410 instruction
->type
= NDS32_INSN_JUMP_BRANCH
;
2411 if ((imm
>> 14) & 0x1) { /* BNE */
2412 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2413 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2415 instruction
->info
.imm
= (instruction
->info
.imm
<< 18) >> 18;
2416 snprintf(instruction
->text
,
2418 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2419 "\tBNE\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
2421 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2422 instruction
->info
.imm
);
2424 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2425 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2427 instruction
->info
.imm
= (instruction
->info
.imm
<< 18) >> 18;
2428 snprintf(instruction
->text
,
2430 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2431 "\tBEQ\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
2433 opcode
, instruction
->info
.rt
,
2434 instruction
->info
.ra
,
2435 instruction
->info
.imm
);
2442 nds32_parse_type_0(opcode
, &imm
);
2443 instruction
->type
= NDS32_INSN_JUMP_BRANCH
;
2444 switch ((imm
>> 16) & 0xF) {
2446 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2447 &(instruction
->info
.imm
));
2448 instruction
->info
.imm
= (instruction
->info
.imm
<< 16) >> 16;
2449 snprintf(instruction
->text
,
2451 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2452 "\tBEQZ\t$r%" PRIu8
",#%" PRId32
,
2454 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2457 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2458 &(instruction
->info
.imm
));
2459 instruction
->info
.imm
= (instruction
->info
.imm
<< 16) >> 16;
2460 snprintf(instruction
->text
,
2462 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2463 "\tBNEZ\t$r%" PRIu8
",#%" PRId32
,
2465 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2468 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2469 &(instruction
->info
.imm
));
2470 instruction
->info
.imm
= (instruction
->info
.imm
<< 16) >> 16;
2471 snprintf(instruction
->text
,
2473 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2474 "\tBGEZ\t$r%" PRIu8
",#%" PRId32
,
2476 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2479 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2480 &(instruction
->info
.imm
));
2481 instruction
->info
.imm
= (instruction
->info
.imm
<< 16) >> 16;
2482 snprintf(instruction
->text
,
2484 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2485 "\tBLTZ\t$r%" PRIu8
",#%" PRId32
,
2487 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2490 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2491 &(instruction
->info
.imm
));
2492 instruction
->info
.imm
= (instruction
->info
.imm
<< 16) >> 16;
2493 snprintf(instruction
->text
,
2495 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2496 "\tBGTZ\t$r%" PRIu8
",#%" PRId32
,
2498 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2501 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2502 &(instruction
->info
.imm
));
2503 instruction
->info
.imm
= (instruction
->info
.imm
<< 16) >> 16;
2504 snprintf(instruction
->text
,
2506 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2507 "\tBLEZ\t$r%" PRIu8
",#%" PRId32
,
2509 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2511 case 12: /* BGEZAL */
2512 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2513 &(instruction
->info
.imm
));
2514 instruction
->info
.imm
= (instruction
->info
.imm
<< 16) >> 16;
2515 snprintf(instruction
->text
,
2517 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2518 "\tBGEZAL\t$r%" PRIu8
",#%" PRId32
,
2520 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2522 case 13: /* BLTZAL */
2523 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2524 &(instruction
->info
.imm
));
2525 instruction
->info
.imm
= (instruction
->info
.imm
<< 16) >> 16;
2526 snprintf(instruction
->text
,
2528 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2529 "\tBLTZAL\t$r%" PRIu8
",#%" PRId32
,
2531 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2537 snprintf(instruction
->text
,
2539 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
2548 static int nds32_parse_group_5_insn(struct nds32
*nds32
, uint32_t opcode
,
2549 uint32_t address
, struct nds32_instruction
*instruction
)
2553 opc_6
= instruction
->info
.opc_6
;
2555 switch (opc_6
& 0x7) {
2557 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2558 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2559 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 17; /* sign-extend */
2560 instruction
->type
= NDS32_INSN_DATA_PROC
;
2561 snprintf(instruction
->text
,
2563 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2564 "\tADDI\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
2566 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2567 instruction
->info
.imm
);
2570 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2571 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2572 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 17; /* sign-extend */
2573 instruction
->type
= NDS32_INSN_DATA_PROC
;
2574 snprintf(instruction
->text
,
2576 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2577 "\tSUBRI\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
2579 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2580 instruction
->info
.imm
);
2583 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2584 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2585 instruction
->type
= NDS32_INSN_DATA_PROC
;
2586 snprintf(instruction
->text
,
2588 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2589 "\tANDI\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
2591 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2592 instruction
->info
.imm
);
2595 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2596 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2597 instruction
->type
= NDS32_INSN_DATA_PROC
;
2598 snprintf(instruction
->text
,
2600 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2601 "\tXORI\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
2603 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2604 instruction
->info
.imm
);
2607 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2608 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2609 instruction
->type
= NDS32_INSN_DATA_PROC
;
2610 snprintf(instruction
->text
,
2612 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2613 "\tORI\t$r%" PRIu8
",$r%" PRIu8
",0x%8.8" PRIx32
,
2615 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2616 instruction
->info
.imm
);
2619 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2620 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2621 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 17; /* sign-extend */
2622 instruction
->type
= NDS32_INSN_DATA_PROC
;
2623 snprintf(instruction
->text
,
2625 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2626 "\tSLTI\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
2628 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2629 instruction
->info
.imm
);
2632 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2633 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2634 instruction
->info
.imm
= (instruction
->info
.imm
<< 17) >> 17; /* sign-extend */
2635 instruction
->type
= NDS32_INSN_DATA_PROC
;
2636 snprintf(instruction
->text
,
2638 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2639 "\tSLTSI\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
2641 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2642 instruction
->info
.imm
);
2645 snprintf(instruction
->text
,
2647 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
2656 static int nds32_parse_group_6_insn(struct nds32
*nds32
, uint32_t opcode
,
2657 uint32_t address
, struct nds32_instruction
*instruction
)
2661 opc_6
= instruction
->info
.opc_6
;
2663 switch (opc_6
& 0x7) {
2664 case 2: { /* MISC */
2668 nds32_parse_type_0(opcode
, &imm
);
2670 sub_opc
= imm
& 0x1F;
2672 case 0: /* STANDBY */
2673 instruction
->type
= NDS32_INSN_MISC
;
2674 snprintf(instruction
->text
,
2676 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2677 "\tSTANDBY\t#%" PRIu32
,
2679 opcode
, (opcode
>> 5) & 0x3);
2683 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2684 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2685 instruction
->type
= NDS32_INSN_MISC
;
2686 snprintf(instruction
->text
,
2688 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tCCTL",
2693 nds32_parse_type_1(opcode
, &(instruction
->info
.rt
),
2694 &(instruction
->info
.imm
));
2695 instruction
->type
= NDS32_INSN_RESOURCE_ACCESS
;
2696 snprintf(instruction
->text
,
2698 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2699 "\tMFSR\t$r%" PRIu8
",#%" PRId32
,
2701 opcode
, instruction
->info
.rt
,
2702 (instruction
->info
.imm
>> 10) & 0x3FF);
2705 nds32_parse_type_1(opcode
, &(instruction
->info
.ra
),
2706 &(instruction
->info
.imm
));
2707 instruction
->type
= NDS32_INSN_RESOURCE_ACCESS
;
2708 snprintf(instruction
->text
,
2710 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2711 "\tMTSR\t$r%" PRIu8
",#%" PRId32
,
2713 opcode
, instruction
->info
.ra
,
2714 (instruction
->info
.imm
>> 10) & 0x3FF);
2717 instruction
->type
= NDS32_INSN_MISC
;
2718 snprintf(instruction
->text
,
2720 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tIRET",
2725 instruction
->type
= NDS32_INSN_MISC
;
2726 snprintf(instruction
->text
,
2728 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2729 "\tTRAP\t#%" PRId32
,
2731 opcode
, (imm
>> 5) & 0x7FFF);
2734 nds32_parse_type_1(opcode
, &(instruction
->info
.ra
),
2735 &(instruction
->info
.imm
));
2736 instruction
->type
= NDS32_INSN_MISC
;
2737 snprintf(instruction
->text
,
2739 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2740 "\tTEQZ\t$r%" PRIu8
",#%" PRId32
,
2742 opcode
, instruction
->info
.ra
,
2743 (instruction
->info
.imm
>> 5) & 0x7FFF);
2746 nds32_parse_type_1(opcode
, &(instruction
->info
.ra
),
2747 &(instruction
->info
.imm
));
2748 instruction
->type
= NDS32_INSN_MISC
;
2749 snprintf(instruction
->text
,
2751 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2752 "\tTNEZ\t$r%" PRIu8
",#%" PRId32
,
2754 opcode
, instruction
->info
.ra
,
2755 (instruction
->info
.imm
>> 5) & 0x7FFF);
2758 instruction
->type
= NDS32_INSN_MISC
;
2759 snprintf(instruction
->text
,
2761 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tDSB",
2766 instruction
->type
= NDS32_INSN_MISC
;
2767 snprintf(instruction
->text
,
2769 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tISB",
2773 case 10: /* BREAK */
2774 instruction
->type
= NDS32_INSN_MISC
;
2775 instruction
->info
.sub_opc
= imm
& 0x1F;
2776 instruction
->info
.imm
= (imm
>> 5) & 0x7FFF;
2777 snprintf(instruction
->text
,
2779 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2780 "\tBREAK\t#%" PRId32
,
2782 opcode
, instruction
->info
.imm
);
2784 case 11: /* SYSCALL */
2785 instruction
->type
= NDS32_INSN_MISC
;
2786 snprintf(instruction
->text
,
2788 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2789 "\tSYSCALL\t#%" PRId32
,
2791 opcode
, (imm
>> 5) & 0x7FFF);
2793 case 12: /* MSYNC */
2794 instruction
->type
= NDS32_INSN_MISC
;
2795 snprintf(instruction
->text
,
2797 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2798 "\tMSYNC\t#%" PRId32
,
2800 opcode
, (imm
>> 5) & 0x7);
2802 case 13: /* ISYNC */
2803 nds32_parse_type_1(opcode
, &(instruction
->info
.ra
),
2804 &(instruction
->info
.imm
));
2805 instruction
->type
= NDS32_INSN_MISC
;
2806 snprintf(instruction
->text
,
2808 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
2809 "\tISYNC\t$r%" PRIu8
,
2811 opcode
, instruction
->info
.ra
);
2813 case 14: /* TLBOP */
2815 nds32_parse_type_2(opcode
, &(instruction
->info
.rt
),
2816 &(instruction
->info
.ra
), &(instruction
->info
.imm
));
2817 instruction
->type
= NDS32_INSN_RESOURCE_ACCESS
;
2818 snprintf(instruction
->text
,
2820 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tTLBOP",
2829 snprintf(instruction
->text
,
2831 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
2840 static uint32_t field_mask
[9] = {
2852 static uint8_t nds32_extract_field_8u(uint16_t opcode
, uint32_t start
, uint32_t length
)
2854 if (0 < length
&& length
< 9)
2855 return (opcode
>> start
) & field_mask
[length
];
2860 static int nds32_parse_group_0_insn_16(struct nds32
*nds32
, uint16_t opcode
,
2861 uint32_t address
, struct nds32_instruction
*instruction
)
2863 switch ((opcode
>> 10) & 0x7) {
2865 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 5, 5);
2866 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 0, 5);
2867 instruction
->type
= NDS32_INSN_MISC
;
2868 snprintf(instruction
->text
,
2870 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2871 "\t\tMOV55\t$r%" PRIu8
",$r%" PRIu8
,
2873 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
2875 case 1: /* MOVI55 */
2876 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 5, 5);
2877 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 5);
2878 instruction
->info
.imm
= (instruction
->info
.imm
<< 27) >> 27;
2879 instruction
->type
= NDS32_INSN_MISC
;
2880 snprintf(instruction
->text
,
2882 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2883 "\t\tMOVI55\t$r%" PRIu8
",#%" PRId32
,
2885 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2887 case 2: /* ADD45, SUB45 */
2888 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 5, 4);
2889 instruction
->info
.rb
= nds32_extract_field_8u(opcode
, 0, 5);
2890 instruction
->type
= NDS32_INSN_DATA_PROC
;
2891 if (nds32_extract_field_8u(opcode
, 9, 1) == 0) { /* ADD45 */
2892 snprintf(instruction
->text
,
2894 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2895 "\t\tADD45\t$r%" PRIu8
",$r%" PRIu8
,
2897 opcode
, instruction
->info
.rt
, instruction
->info
.rb
);
2898 } else { /* SUB45 */
2899 snprintf(instruction
->text
,
2901 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2902 "\t\tSUB45\t$r%" PRIu8
",$r%" PRIu8
,
2904 opcode
, instruction
->info
.rt
, instruction
->info
.rb
);
2908 case 3: /* ADDI45, SUBI45 */
2909 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 5, 4);
2910 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 5);
2911 instruction
->type
= NDS32_INSN_DATA_PROC
;
2912 if (nds32_extract_field_8u(opcode
, 9, 1) == 0) { /* ADDI45 */
2913 snprintf(instruction
->text
,
2915 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2916 "\t\tADDI45\t$r%" PRIu8
",#%" PRId32
,
2918 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2919 } else { /* SUBI45 */
2920 snprintf(instruction
->text
,
2922 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2923 "\t\tSUBI45\t$r%" PRIu8
",#%" PRId32
,
2925 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2928 case 4: /* SRAI45, SRLI45 */
2929 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 5, 4);
2930 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 5);
2931 instruction
->type
= NDS32_INSN_DATA_PROC
;
2932 if (nds32_extract_field_8u(opcode
, 9, 1) == 0) { /* SRAI45 */
2933 snprintf(instruction
->text
,
2935 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2936 "\t\tSRAI45\t$r%" PRIu8
",#%" PRId32
,
2938 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2939 } else { /* SRLI45 */
2940 if ((instruction
->info
.rt
== 0) && (instruction
->info
.imm
== 0)) {
2941 snprintf(instruction
->text
,
2943 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
"\t\tNOP",
2947 snprintf(instruction
->text
,
2949 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2950 "\t\tSRLI45\t$r%" PRIu8
",#%" PRId32
,
2952 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
2957 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
2958 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
2959 instruction
->type
= NDS32_INSN_DATA_PROC
;
2960 if (nds32_extract_field_8u(opcode
, 9, 1) == 0) { /* SLLI333 */
2961 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 3);
2962 snprintf(instruction
->text
,
2964 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2965 "\t\tSLLI333\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
2967 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
2968 instruction
->info
.imm
);
2970 instruction
->info
.sub_opc
= nds32_extract_field_8u(opcode
, 0, 3);
2971 switch (instruction
->info
.sub_opc
) {
2973 snprintf(instruction
->text
,
2975 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2976 "\t\tZEB33\t$r%" PRIu8
",$r%" PRIu8
,
2978 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
2981 snprintf(instruction
->text
,
2983 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2984 "\t\tZEH33\t$r%" PRIu8
",$r%" PRIu8
,
2986 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
2989 snprintf(instruction
->text
,
2991 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
2992 "\t\tSEB33\t$r%" PRIu8
",$r%" PRIu8
,
2994 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
2997 snprintf(instruction
->text
,
2999 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3000 "\t\tSEH33\t$r%" PRIu8
",$r%" PRIu8
,
3002 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3004 case 4: /* XLSB33 */
3005 snprintf(instruction
->text
,
3007 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3008 "\t\tXLSB33\t$r%" PRIu8
",$r%" PRIu8
,
3010 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3012 case 5: /* XLLB33 */
3013 snprintf(instruction
->text
,
3015 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3016 "\t\tXLLB33\t$r%" PRIu8
",$r%" PRIu8
,
3018 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3020 case 6: /* BMSKI33 */
3021 instruction
->info
.ra
= 0;
3022 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 3, 3);
3023 snprintf(instruction
->text
,
3025 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3026 "\t\tBMSKI33\t$r%" PRIu8
",$r%" PRId32
,
3028 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3030 case 7: /* FEXTI33 */
3031 instruction
->info
.ra
= 0;
3032 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 3, 3);
3033 snprintf(instruction
->text
,
3035 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3036 "\t\tFEXTI33\t$r%" PRIu8
",$r%" PRId32
,
3038 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3041 snprintf(instruction
->text
,
3043 "0x%8.8" PRIx32
"\t0x%8.8" PRIx16
3044 "\tUNDEFINED INSTRUCTION",
3051 case 6: /* ADD333, SUB333 */
3052 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3053 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3054 instruction
->info
.rb
= nds32_extract_field_8u(opcode
, 0, 3);
3055 instruction
->type
= NDS32_INSN_DATA_PROC
;
3056 if (nds32_extract_field_8u(opcode
, 9, 1) == 0) { /* ADD333 */
3057 snprintf(instruction
->text
,
3059 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3060 "\t\tADD333\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
3062 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3063 instruction
->info
.rb
);
3064 } else { /* SUB333 */
3065 snprintf(instruction
->text
,
3067 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3068 "\t\tSUB333\t$r%" PRIu8
",$r%" PRIu8
",$r%" PRIu8
,
3070 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3071 instruction
->info
.rb
);
3074 case 7: /* ADDI333, SUBI333 */
3075 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3076 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3077 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 3);
3078 instruction
->type
= NDS32_INSN_DATA_PROC
;
3079 if (nds32_extract_field_8u(opcode
, 9, 1) == 0) { /* ADDI333 */
3080 snprintf(instruction
->text
,
3082 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3083 "\t\tADDI333\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
3085 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3086 instruction
->info
.imm
);
3087 } else { /* SUBI333 */
3088 snprintf(instruction
->text
,
3090 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3091 "\t\tSUBI333\t$r%" PRIu8
",$r%" PRIu8
",#%" PRId32
,
3093 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3094 instruction
->info
.imm
);
3098 snprintf(instruction
->text
,
3100 "0x%8.8" PRIx32
"\t0x%8.8" PRIx16
"\tUNDEFINED INSTRUCTION",
3109 static int nds32_parse_group_1_insn_16(struct nds32
*nds32
, uint16_t opcode
,
3110 uint32_t address
, struct nds32_instruction
*instruction
)
3112 switch ((opcode
>> 9) & 0xF) {
3113 case 0: /* LWI333 */
3114 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3115 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3116 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 3) << 2;
3117 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3118 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
3119 &(instruction
->access_start
));
3120 instruction
->access_start
+= instruction
->info
.imm
;
3121 instruction
->access_end
= instruction
->access_start
+ 4;
3122 snprintf(instruction
->text
,
3124 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3125 "\t\tLWI333\t$r%" PRIu8
",[$r%" PRIu8
"+(#%" PRId32
")]",
3127 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3128 instruction
->info
.imm
);
3130 case 1: /* LWI333.BI */
3131 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3132 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3133 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 3);
3134 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3135 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
3136 &(instruction
->access_start
));
3137 instruction
->access_end
= instruction
->access_start
+ 4;
3138 snprintf(instruction
->text
,
3140 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3141 "\t\tLWI333.BI\t$r%" PRIu8
",[$r%" PRIu8
"],#%" PRId32
,
3143 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3144 instruction
->info
.imm
<< 2);
3146 case 2: /* LHI333 */
3147 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3148 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3149 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 3) << 1;
3150 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3151 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
3152 &(instruction
->access_start
));
3153 instruction
->access_start
+= instruction
->info
.imm
;
3154 instruction
->access_end
= instruction
->access_start
+ 2;
3155 snprintf(instruction
->text
,
3157 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3158 "\t\tLHI333\t$r%" PRIu8
",[$r%" PRIu8
"+(#%" PRId32
")]",
3160 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3161 instruction
->info
.imm
);
3163 case 3: /* LBI333 */
3164 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3165 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3166 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 3);
3167 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3168 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
3169 &(instruction
->access_start
));
3170 instruction
->access_start
+= instruction
->info
.imm
;
3171 instruction
->access_end
= instruction
->access_start
+ 1;
3172 snprintf(instruction
->text
,
3174 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3175 "\t\tLBI333\t$r%" PRIu8
",[$r%" PRIu8
"+(#%" PRId32
")]",
3177 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3178 instruction
->info
.imm
);
3180 case 4: /* SWI333 */
3181 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3182 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3183 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 3) << 2;
3184 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3185 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
3186 &(instruction
->access_start
));
3187 instruction
->access_start
+= instruction
->info
.imm
;
3188 instruction
->access_end
= instruction
->access_start
+ 4;
3189 snprintf(instruction
->text
,
3191 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3192 "\t\tSWI333\t$r%" PRIu8
",[$r%" PRIu8
"+(#%" PRId32
")]",
3194 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3195 instruction
->info
.imm
);
3197 case 5: /* SWI333.BI */
3198 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3199 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3200 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 3) << 2;
3201 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3202 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
3203 &(instruction
->access_start
));
3204 instruction
->access_end
= instruction
->access_start
+ 4;
3205 snprintf(instruction
->text
,
3207 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3208 "\t\tSWI333.BI\t$r%" PRIu8
",[$r%" PRIu8
"],#%" PRId32
,
3210 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3211 instruction
->info
.imm
);
3213 case 6: /* SHI333 */
3214 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3215 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3216 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 3) << 1;
3217 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3218 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
3219 &(instruction
->access_start
));
3220 instruction
->access_start
+= instruction
->info
.imm
;
3221 instruction
->access_end
= instruction
->access_start
+ 2;
3222 snprintf(instruction
->text
,
3224 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3225 "\t\tSHI333\t$r%" PRIu8
",[$r%" PRIu8
"+(#%" PRId32
")]",
3227 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3228 instruction
->info
.imm
);
3230 case 7: /* SBI333 */
3231 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3232 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3233 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 3);
3234 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3235 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
3236 &(instruction
->access_start
));
3237 instruction
->access_start
+= instruction
->info
.imm
;
3238 instruction
->access_end
= instruction
->access_start
+ 1;
3239 snprintf(instruction
->text
,
3241 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3242 "\t\tSHI333\t$r%" PRIu8
",[$r%" PRIu8
"+(#%" PRId32
")]",
3244 opcode
, instruction
->info
.rt
, instruction
->info
.ra
,
3245 instruction
->info
.imm
);
3247 case 8: /* ADDRI36.SP */
3248 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3249 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 6) << 2;
3250 instruction
->type
= NDS32_INSN_DATA_PROC
;
3251 snprintf(instruction
->text
,
3253 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3254 "\t\tADDRI36.SP\t$r%" PRIu8
",#%" PRId32
,
3256 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3258 case 9: /* LWI45.FE */
3259 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 5, 4);
3260 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 5);
3261 instruction
->info
.imm
-= 32;
3262 instruction
->info
.imm
<<= 2;
3263 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3264 nds32_get_mapped_reg(nds32
, R8
, &(instruction
->access_start
));
3265 instruction
->access_start
+= instruction
->info
.imm
;
3266 instruction
->access_end
= instruction
->access_start
+ 4;
3267 snprintf(instruction
->text
,
3269 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3270 "\t\tLWI45.FE\t$r%" PRIu8
",[#%" PRId32
"]",
3272 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3274 case 10: /* LWI450 */
3275 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 5, 4);
3276 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 0, 5);
3277 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3278 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
3279 &(instruction
->access_start
));
3280 instruction
->access_end
= instruction
->access_start
+ 4;
3281 snprintf(instruction
->text
,
3283 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3284 "\t\tLWI450\t$r%" PRIu8
",$r%" PRIu8
,
3286 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3288 case 11: /* SWI450 */
3289 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 5, 4);
3290 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 0, 5);
3291 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3292 nds32_get_mapped_reg(nds32
, instruction
->info
.ra
,
3293 &(instruction
->access_start
));
3294 instruction
->access_end
= instruction
->access_start
+ 4;
3295 snprintf(instruction
->text
,
3297 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3298 "\t\tSWI450\t$r%" PRIu8
",$r%" PRIu8
,
3300 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3305 case 15: /* LWI37, SWI37 */
3306 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 8, 3);
3307 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 7) << 2;
3308 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3309 nds32_get_mapped_reg(nds32
, R28
, &(instruction
->access_start
));
3310 instruction
->access_start
+= instruction
->info
.imm
;
3311 instruction
->access_end
= instruction
->access_start
+ 4;
3312 if (nds32_extract_field_8u(opcode
, 7, 1) == 0) { /* LWI37 */
3313 snprintf(instruction
->text
,
3315 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3316 "\t\tLWI37\t$r%" PRIu8
",[fp+#%" PRId32
"]",
3318 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3319 } else { /* SWI37 */
3320 snprintf(instruction
->text
,
3322 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3323 "\t\tSWI37\t$r%" PRIu8
",[fp+#%" PRId32
"]",
3325 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3328 default: /* ERROR */
3329 snprintf(instruction
->text
,
3331 "0x%8.8" PRIx32
"\t0x%8.8" PRIx16
"\tUNDEFINED INSTRUCTION",
3340 static int nds32_parse_group_2_insn_16(struct nds32
*nds32
, uint16_t opcode
,
3341 uint32_t address
, struct nds32_instruction
*instruction
)
3343 switch ((opcode
>> 11) & 0x3) {
3344 case 0: /* BEQZ38 */
3345 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 8, 3);
3346 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 8);
3347 instruction
->info
.imm
= (instruction
->info
.imm
<< 24) >> 24;
3348 instruction
->type
= NDS32_INSN_JUMP_BRANCH
;
3349 snprintf(instruction
->text
,
3351 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3352 "\t\tBEQZ38\t$r%" PRIu8
",#%" PRId32
,
3354 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3356 case 1: /* BNEZ38 */
3357 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 8, 3);
3358 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 8);
3359 instruction
->info
.imm
= (instruction
->info
.imm
<< 24) >> 24;
3360 instruction
->type
= NDS32_INSN_JUMP_BRANCH
;
3361 snprintf(instruction
->text
,
3363 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3364 "\t\tBNEZ38\t$r%" PRIu8
",#%" PRId32
,
3366 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3368 case 2: /* BEQS38,J8 */
3369 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 8, 3);
3370 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 8);
3371 instruction
->info
.imm
= (instruction
->info
.imm
<< 24) >> 24;
3372 instruction
->type
= NDS32_INSN_JUMP_BRANCH
;
3373 if (instruction
->info
.rt
== 5) { /* J8 */
3374 snprintf(instruction
->text
,
3376 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3377 "\t\tJ8\t#%" PRId32
,
3379 opcode
, instruction
->info
.imm
);
3380 } else { /* BEQS38 */
3381 snprintf(instruction
->text
,
3383 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3384 "\t\tBEQS38\t$r%" PRIu8
",#%" PRId32
,
3386 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3389 case 3: /* BNES38, JR5, RET5, JRAL5 */
3390 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 8, 3);
3391 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 8);
3392 instruction
->info
.imm
= (instruction
->info
.imm
<< 24) >> 24;
3393 instruction
->type
= NDS32_INSN_JUMP_BRANCH
;
3394 if (instruction
->info
.rt
== 5) {
3395 instruction
->info
.imm
= 0;
3396 instruction
->info
.rb
= nds32_extract_field_8u(opcode
, 0, 5);
3397 switch (nds32_extract_field_8u(opcode
, 5, 3)) {
3399 snprintf(instruction
->text
,
3401 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3402 "\t\tJR5\t$r%" PRIu8
,
3404 opcode
, instruction
->info
.rb
);
3407 snprintf(instruction
->text
,
3409 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3410 "\t\tJRAL5\t$r%" PRIu8
,
3412 opcode
, instruction
->info
.rb
);
3414 case 2: /* EX9.IT */
3415 instruction
->info
.rb
= 0;
3416 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 5);
3417 /* TODO: implement real instruction semantics */
3418 snprintf(instruction
->text
,
3420 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3421 "\t\tEX9.IT\t#%" PRId32
,
3423 opcode
, instruction
->info
.imm
);
3426 snprintf(instruction
->text
,
3428 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3429 "\t\tRET5\t$r%" PRIu8
,
3431 opcode
, instruction
->info
.rb
);
3433 case 5: /* ADD5.PC */
3434 instruction
->info
.rt
= 0;
3435 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 0, 5);
3436 instruction
->type
= NDS32_INSN_DATA_PROC
;
3437 snprintf(instruction
->text
,
3439 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3440 "\t\tADD5.PC\t$r%" PRIu8
,
3442 opcode
, instruction
->info
.rt
);
3445 snprintf(instruction
->text
,
3447 "0x%8.8" PRIx32
"\t0x%8.8" PRIx16
3448 "\tUNDEFINED INSTRUCTION",
3453 } else { /* BNES38 */
3454 snprintf(instruction
->text
,
3456 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3457 "\t\tBNES38\t$r%" PRIu8
",#%" PRId32
,
3459 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3467 static int nds32_parse_group_3_insn_16(struct nds32
*nds32
, uint16_t opcode
,
3468 uint32_t address
, struct nds32_instruction
*instruction
)
3470 switch ((opcode
>> 11) & 0x3) {
3472 switch ((opcode
>> 9) & 0x3) {
3473 case 0: /* SLTS45 */
3474 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 5, 4);
3475 instruction
->info
.rb
= nds32_extract_field_8u(opcode
, 0, 5);
3476 instruction
->type
= NDS32_INSN_DATA_PROC
;
3477 snprintf(instruction
->text
,
3479 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3480 "\t\tSLTS45\t$r%" PRIu8
",$r%" PRIu8
,
3482 opcode
, instruction
->info
.ra
, instruction
->info
.rb
);
3485 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 5, 4);
3486 instruction
->info
.rb
= nds32_extract_field_8u(opcode
, 0, 5);
3487 instruction
->type
= NDS32_INSN_DATA_PROC
;
3488 snprintf(instruction
->text
,
3490 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3491 "\t\tSLT45\t$r%" PRIu8
",$r%" PRIu8
,
3493 opcode
, instruction
->info
.ra
, instruction
->info
.rb
);
3495 case 2: /* SLTSI45 */
3496 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 5, 4);
3497 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 5);
3498 instruction
->type
= NDS32_INSN_DATA_PROC
;
3499 snprintf(instruction
->text
,
3501 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3502 "\t\tSLTSI45\t$r%" PRIu8
",#%" PRId32
,
3504 opcode
, instruction
->info
.ra
, instruction
->info
.imm
);
3506 case 3: /* SLTI45 */
3507 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 5, 4);
3508 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 5);
3509 instruction
->type
= NDS32_INSN_DATA_PROC
;
3510 snprintf(instruction
->text
,
3512 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3513 "\t\tSLTI45\t$r%" PRIu8
",#%" PRId32
,
3515 opcode
, instruction
->info
.ra
, instruction
->info
.imm
);
3520 switch ((opcode
>> 9) & 0x3) {
3522 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 8);
3523 instruction
->info
.imm
= (instruction
->info
.imm
<< 24) >> 24;
3524 instruction
->type
= NDS32_INSN_JUMP_BRANCH
;
3525 if (nds32_extract_field_8u(opcode
, 8, 1) == 0) { /* BEQZS8 */
3526 snprintf(instruction
->text
,
3528 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3529 "\t\tBEQZS8\t#%" PRId32
,
3531 opcode
, instruction
->info
.imm
);
3532 } else { /* BNEZS8 */
3533 snprintf(instruction
->text
,
3535 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3536 "\t\tBNEZS8\t#%" PRId32
,
3538 opcode
, instruction
->info
.imm
);
3541 case 1: /* BREAK16 */
3542 if (((opcode
>> 5) & 0xF) == 0) {
3543 instruction
->type
= NDS32_INSN_MISC
;
3544 snprintf(instruction
->text
,
3546 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3547 "\t\tBREAK16\t#%" PRId16
,
3549 opcode
, (int16_t)(opcode
& 0x1F));
3550 } else { /* EX9.IT */
3551 instruction
->type
= NDS32_INSN_MISC
;
3552 /* TODO: implement real instruction semantics */
3553 snprintf(instruction
->text
,
3555 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3556 "\t\tEX9.IT\t#%" PRId16
,
3558 opcode
, (int16_t)(opcode
& 0x1FF));
3561 case 2: /* ADDI10S */
3563 instruction
->info
.imm
= opcode
& 0x3FF;
3564 instruction
->info
.imm
= (instruction
->info
.imm
<< 22) >> 22;
3565 instruction
->type
= NDS32_INSN_DATA_PROC
;
3566 snprintf(instruction
->text
,
3568 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3569 "\t\tADDI10.SP\t#%" PRId32
,
3571 opcode
, instruction
->info
.imm
);
3576 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 8, 3);
3577 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 7) << 2;
3578 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3579 nds32_get_mapped_reg(nds32
, R31
, &(instruction
->access_start
));
3580 instruction
->access_start
+= instruction
->info
.imm
;
3581 instruction
->access_end
= instruction
->access_start
+ 4;
3582 if (nds32_extract_field_8u(opcode
, 7, 1) == 0) { /* LWI37.SP */
3583 snprintf(instruction
->text
,
3585 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3586 "\t\tLWI37.SP\t$r%" PRIu8
",[+#%" PRId32
"]",
3588 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3589 } else { /* SWI37.SP */
3590 snprintf(instruction
->text
,
3592 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3593 "\t\tSWI37.SP\t$r%" PRIu8
",[+#%" PRId32
"]",
3595 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3599 switch ((opcode
>> 9) & 0x3) {
3600 case 0: /* IFCALL9 */
3601 instruction
->info
.imm
= opcode
& 0x1FF;
3602 instruction
->type
= NDS32_INSN_JUMP_BRANCH
;
3603 snprintf(instruction
->text
,
3605 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3606 "\t\tIFCALL9\t#%" PRId32
"",
3608 opcode
, instruction
->info
.imm
);
3610 case 1: /* MOVPI45 */
3611 instruction
->info
.imm
= nds32_extract_field_8u(opcode
, 0, 5) + 16;
3612 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 5, 4);
3613 instruction
->type
= NDS32_INSN_MISC
;
3614 snprintf(instruction
->text
,
3616 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3617 "\t\tMOVPI45\t$r%" PRIu8
",#%" PRId32
"",
3619 opcode
, instruction
->info
.rt
, instruction
->info
.imm
);
3621 case 2: /* PUSH25, POP25, MOVD44 */
3622 switch ((opcode
>> 7) & 0x3) {
3623 case 0: /* PUSH25 */
3628 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3629 instruction
->info
.imm
=
3630 nds32_extract_field_8u(opcode
, 0, 5) << 3;
3631 re
= nds32_extract_field_8u(opcode
, 5, 2);
3642 instruction
->info
.rd
= re
;
3643 /* GPRs list: R6 ~ Re and fp, gp, lp */
3644 gpr_count
= 3 + (re
- 5);
3646 nds32_get_mapped_reg(nds32
, R31
,
3647 &(instruction
->access_end
));
3648 instruction
->access_start
=
3649 instruction
->access_end
- (gpr_count
* 4);
3651 snprintf(instruction
->text
,
3653 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3654 "\t\tPUSH25\t$r%" PRIu8
",#%" PRId32
,
3656 opcode
, instruction
->info
.rd
,
3657 instruction
->info
.imm
);
3665 instruction
->type
= NDS32_INSN_LOAD_STORE
;
3666 instruction
->info
.imm
=
3667 nds32_extract_field_8u(opcode
, 0, 5) << 3;
3668 re
= nds32_extract_field_8u(opcode
, 5, 2);
3679 instruction
->info
.rd
= re
;
3680 /* GPRs list: R6 ~ Re and fp, gp, lp */
3681 gpr_count
= 3 + (re
- 5);
3683 nds32_get_mapped_reg(nds32
, R31
,
3684 &(instruction
->access_start
));
3685 instruction
->access_start
+= instruction
->info
.imm
;
3686 instruction
->access_end
=
3687 instruction
->access_start
+ (gpr_count
* 4);
3689 snprintf(instruction
->text
,
3691 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3692 "\t\tPOP25\t$r%" PRIu8
",#%" PRId32
,
3694 opcode
, instruction
->info
.rd
,
3695 instruction
->info
.imm
);
3698 case 2: /* MOVD44 */
3700 instruction
->info
.ra
=
3701 nds32_extract_field_8u(opcode
, 0, 4) * 2;
3702 instruction
->info
.rt
=
3703 nds32_extract_field_8u(opcode
, 4, 4) * 2;
3704 instruction
->type
= NDS32_INSN_MISC
;
3705 snprintf(instruction
->text
,
3707 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3708 "\t\tMOVD44\t$r%" PRIu8
",$r%" PRIu8
,
3710 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3714 case 3: /* NEG33, NOT33, MUL33, XOR33, AND33, OR33 */
3715 instruction
->info
.ra
= nds32_extract_field_8u(opcode
, 3, 3);
3716 instruction
->info
.rt
= nds32_extract_field_8u(opcode
, 6, 3);
3717 instruction
->type
= NDS32_INSN_DATA_PROC
;
3718 switch (opcode
& 0x7) {
3720 snprintf(instruction
->text
,
3722 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3723 "\t\tNEG33\t$r%" PRIu8
",$r%" PRIu8
,
3725 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3728 snprintf(instruction
->text
,
3730 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3731 "\t\tNOT33\t$r%" PRIu8
",$r%" PRIu8
,
3733 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3736 snprintf(instruction
->text
,
3738 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3739 "\t\tMUL33\t$r%" PRIu8
",$r%" PRIu8
,
3741 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3744 snprintf(instruction
->text
,
3746 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3747 "\t\tXOR33\t$r%" PRIu8
",$r%" PRIu8
,
3749 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3752 snprintf(instruction
->text
,
3754 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3755 "\t\tAND33\t$r%" PRIu8
",$r%" PRIu8
,
3757 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3760 snprintf(instruction
->text
,
3762 "0x%8.8" PRIx32
"\t0x%4.4" PRIx16
3763 "\t\tOR33\t$r%" PRIu8
",$r%" PRIu8
,
3765 opcode
, instruction
->info
.rt
, instruction
->info
.ra
);
3772 snprintf(instruction
->text
,
3774 "0x%8.8" PRIx32
"\t0x%8.8" PRIx16
"\tUNDEFINED INSTRUCTION",
3783 int nds32_evaluate_opcode(struct nds32
*nds32
, uint32_t opcode
, uint32_t address
,
3784 struct nds32_instruction
*instruction
)
3786 int retval
= ERROR_OK
;
3788 /* clear fields, to avoid confusion */
3789 memset(instruction
, 0, sizeof(struct nds32_instruction
));
3792 /* 16 bits instruction */
3793 instruction
->instruction_size
= 2;
3794 opcode
= (opcode
>> 16) & 0xFFFF;
3795 instruction
->opcode
= opcode
;
3797 switch ((opcode
>> 13) & 0x3) {
3799 retval
= nds32_parse_group_0_insn_16(nds32
, opcode
, address
, instruction
);
3802 retval
= nds32_parse_group_1_insn_16(nds32
, opcode
, address
, instruction
);
3805 retval
= nds32_parse_group_2_insn_16(nds32
, opcode
, address
, instruction
);
3808 retval
= nds32_parse_group_3_insn_16(nds32
, opcode
, address
, instruction
);
3811 snprintf(instruction
->text
,
3813 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
3819 /* 32 bits instruction */
3820 instruction
->instruction_size
= 4;
3821 instruction
->opcode
= opcode
;
3824 opc_6
= opcode
>> 25;
3825 instruction
->info
.opc_6
= opc_6
;
3827 switch ((opc_6
>> 3) & 0x7) {
3828 case 0: /* LBI, LHI, LWI, LBI.bi, LHI.bi, LWI.bi */
3829 retval
= nds32_parse_group_0_insn(nds32
, opcode
, address
, instruction
);
3831 case 1: /* SBI, SHI, SWI, SBI.bi, SHI.bi, SWI.bi */
3832 retval
= nds32_parse_group_1_insn(nds32
, opcode
, address
, instruction
);
3834 case 2: /* LBSI, LHSI, DPREFI, LBSI.bi, LHSI.bi, LBGP */
3835 retval
= nds32_parse_group_2_insn(nds32
, opcode
, address
, instruction
);
3837 case 3: /* MEM, LSMW, HWGP, SBGP */
3838 retval
= nds32_parse_group_3_insn(nds32
, opcode
, address
, instruction
);
3840 case 4: /* ALU_1, ALU_2, MOVI, SETHI, JI, JREG, BR1, BR2 */
3841 retval
= nds32_parse_group_4_insn(nds32
, opcode
, address
, instruction
);
3843 case 5: /* ADDI, SUBRI, ANDI, XORI, ORI, SLTI, SLTSI */
3844 retval
= nds32_parse_group_5_insn(nds32
, opcode
, address
, instruction
);
3847 retval
= nds32_parse_group_6_insn(nds32
, opcode
, address
, instruction
);
3849 default: /* ERROR */
3850 snprintf(instruction
->text
,
3852 "0x%8.8" PRIx32
"\t0x%8.8" PRIx32
"\tUNDEFINED INSTRUCTION",
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)