1 /* Simulation code for the CR16 processor.
2 Copyright (C) 2008-2023 Free Software Foundation, Inc.
3 Contributed by M Ranga Swami Reddy <MR.Swami.Reddy@nsc.com>
5 This file is part of GDB, the GNU debugger.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* This must come before any other includes. */
25 #include <sys/types.h>
37 #include "sim-signal.h"
39 #include "target-newlib-syscall.h"
48 #define EXCEPTION(sig) sim_engine_halt (sd, cpu, NULL, PC, sim_stopped, sig)
109 PSR_MASK
= (PSR_I_BIT
119 /* The following bits in the PSR _can't_ be set by instructions such
121 PSR_HW_MASK
= (PSR_MASK
)
124 /* cond Code Condition True State
125 * EQ Equal Z flag is 1
126 * NE Not Equal Z flag is 0
127 * CS Carry Set C flag is 1
128 * CC Carry Clear C flag is 0
129 * HI Higher L flag is 1
130 * LS Lower or Same L flag is 0
131 * GT Greater Than N flag is 1
132 * LE Less Than or Equal To N flag is 0
133 * FS Flag Set F flag is 1
134 * FC Flag Clear F flag is 0
135 * LO Lower Z and L flags are 0
136 * HS Higher or Same Z or L flag is 1
137 * LT Less Than Z and N flags are 0
138 * GE Greater Than or Equal To Z or N flag is 1. */
140 static int cond_stat(int cc
)
144 case 0: return PSR_Z
; break;
145 case 1: return !PSR_Z
; break;
146 case 2: return PSR_C
; break;
147 case 3: return !PSR_C
; break;
148 case 4: return PSR_L
; break;
149 case 5: return !PSR_L
; break;
150 case 6: return PSR_N
; break;
151 case 7: return !PSR_N
; break;
152 case 8: return PSR_F
; break;
153 case 9: return !PSR_F
; break;
154 case 10: return !PSR_Z
&& !PSR_L
; break;
155 case 11: return PSR_Z
|| PSR_L
; break;
156 case 12: return !PSR_Z
&& !PSR_N
; break;
157 case 13: return PSR_Z
|| PSR_N
; break;
158 case 14: return 1; break; /*ALWAYS. */
160 // case NEVER: return false; break;
162 //panic("Shouldn't have NO_COND_CODE in an actual instruction!");
170 move_to_cr (SIM_DESC sd
, SIM_CPU
*cpu
, int cr
, creg_t mask
, creg_t val
, int psw_hw_p
)
172 /* A MASK bit is set when the corresponding bit in the CR should
174 /* This assumes that (VAL & MASK) == 0. */
185 "ERROR at PC 0x%x: ST can only be set when FX is set.\n", PC
);
186 EXCEPTION (SIM_SIGILL
);
188 /* keep an up-to-date psw around for tracing. */
189 State
.trace
.psw
= (State
.trace
.psw
& mask
) | val
;
194 /* only issue an update if the register is being changed. */
195 if ((State
.cregs
[cr
] & ~mask
) != val
)
196 SLOT_PEND_MASK (State
.cregs
[cr
], mask
, val
);
202 static void trace_input_func (SIM_DESC sd
,
208 #define trace_input(name, in1, in2, in3) do { if (cr16_debug) trace_input_func (sd, name, in1, in2, in3); } while (0)
210 #ifndef SIZE_INSTRUCTION
211 #define SIZE_INSTRUCTION 8
214 #ifndef SIZE_OPERANDS
215 #define SIZE_OPERANDS 18
219 #define SIZE_VALUES 13
222 #ifndef SIZE_LOCATION
223 #define SIZE_LOCATION 20
230 #ifndef SIZE_LINE_NUMBER
231 #define SIZE_LINE_NUMBER 2
235 trace_input_func (SIM_DESC sd
, const char *name
, enum op_types in1
, enum op_types in2
, enum op_types in3
)
244 const char *filename
;
245 const char *functionname
;
246 unsigned int linenumber
;
249 if ((cr16_debug
& DEBUG_TRACE
) == 0)
252 switch (State
.ins_type
)
255 case INS_UNKNOWN
: type
= " ?"; break;
258 if ((cr16_debug
& DEBUG_LINE_NUMBER
) == 0)
261 SIZE_PC
, (unsigned)PC
,
263 SIZE_INSTRUCTION
, name
);
269 if (STATE_TEXT_SECTION (sd
)
270 && byte_pc
>= STATE_TEXT_START (sd
)
271 && byte_pc
< STATE_TEXT_END (sd
))
273 filename
= (const char *)0;
274 functionname
= (const char *)0;
276 if (bfd_find_nearest_line (STATE_PROG_BFD (sd
),
277 STATE_TEXT_SECTION (sd
),
278 (struct bfd_symbol
**)0,
279 byte_pc
- STATE_TEXT_START (sd
),
280 &filename
, &functionname
, &linenumber
))
285 sprintf (p
, "#%-*d ", SIZE_LINE_NUMBER
, linenumber
);
290 sprintf (p
, "%-*s ", SIZE_LINE_NUMBER
+1, "---");
291 p
+= SIZE_LINE_NUMBER
+2;
296 sprintf (p
, "%s ", functionname
);
301 char *q
= strrchr (filename
, '/');
302 sprintf (p
, "%s ", (q
) ? q
+1 : filename
);
312 "0x%.*x %s: %-*.*s %-*s ",
313 SIZE_PC
, (unsigned)PC
,
315 SIZE_LOCATION
, SIZE_LOCATION
, buf
,
316 SIZE_INSTRUCTION
, name
);
324 for (i
= 0; i
< 3; i
++)
333 sprintf (p
, "%sr%d", comma
, OP
[i
]);
339 sprintf (p
, "%scr%d", comma
, OP
[i
]);
345 sprintf (p
, "%s%d", comma
, OP
[i
]);
351 sprintf (p
, "%s%d", comma
, SEXT4(OP
[i
]));
357 sprintf (p
, "%s%d", comma
, SEXT3(OP
[i
]));
363 sprintf (p
, "%s@r%d", comma
, OP
[i
]);
369 sprintf (p
, "%s@(%d,r%d)", comma
, (int16_t)OP
[i
], OP
[i
+1]);
375 sprintf (p
, "%s@%d", comma
, OP
[i
]);
382 if ((cr16_debug
& DEBUG_VALUES
) == 0)
386 sim_io_printf (sd
, "%s", buf
);
391 sim_io_printf (sd
, "%-*s", SIZE_OPERANDS
, buf
);
394 for (i
= 0; i
< 3; i
++)
400 sim_io_printf (sd
, "%*s", SIZE_VALUES
, "");
404 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
405 (uint16_t) GPR (OP
[i
]));
409 tmp
= (long)((((uint32_t) GPR (OP
[i
])) << 16) | ((uint32_t) GPR (OP
[i
] + 1)));
410 sim_io_printf (sd
, "%*s0x%.8lx", SIZE_VALUES
-10, "", tmp
);
414 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
415 (uint16_t) CREG (OP
[i
]));
419 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
424 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
425 (uint16_t)SEXT4(OP
[i
]));
429 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
430 (uint16_t)SEXT3(OP
[i
]));
434 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
436 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
437 (uint16_t)GPR (OP
[i
+ 1]));
444 sim_io_flush_stdout (sd
);
448 do_trace_output_flush (SIM_DESC sd
)
450 sim_io_flush_stdout (sd
);
454 do_trace_output_finish (SIM_DESC sd
)
457 " F0=%d F1=%d C=%d\n",
458 (State
.trace
.psw
& PSR_F_BIT
) != 0,
459 (State
.trace
.psw
& PSR_F_BIT
) != 0,
460 (State
.trace
.psw
& PSR_C_BIT
) != 0);
461 sim_io_flush_stdout (sd
);
466 trace_output_40 (SIM_DESC sd
, uint64_t val
)
468 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
471 " :: %*s0x%.2x%.8lx",
474 ((int)(val
>> 32) & 0xff),
475 ((unsigned long) val
) & 0xffffffff);
476 do_trace_output_finish ();
482 trace_output_32 (SIM_DESC sd
, uint32_t val
)
484 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
491 do_trace_output_finish (sd
);
496 trace_output_16 (SIM_DESC sd
, uint16_t val
)
498 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
505 do_trace_output_finish (sd
);
510 trace_output_void (SIM_DESC sd
)
512 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
514 sim_io_printf (sd
, "\n");
515 do_trace_output_flush (sd
);
520 trace_output_flag (SIM_DESC sd
)
522 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
528 do_trace_output_finish (sd
);
536 #define trace_input(NAME, IN1, IN2, IN3)
537 #define trace_output(RESULT)
542 OP_2C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
545 uint8_t a
= OP
[0] & 0xff;
546 uint16_t b
= (GPR (OP
[1])) & 0xff;
547 trace_input ("addub", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
548 tmp
= (a
+ b
) & 0xff;
549 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
550 trace_output_16 (sd
, tmp
);
555 OP_2CB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
558 uint8_t a
= ((OP
[0]) & 0xff), b
= (GPR (OP
[1])) & 0xff;
559 trace_input ("addub", OP_CONSTANT16
, OP_REG
, OP_VOID
);
560 tmp
= (a
+ b
) & 0xff;
561 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
562 trace_output_16 (sd
, tmp
);
567 OP_2D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
569 uint8_t a
= (GPR (OP
[0])) & 0xff;
570 uint8_t b
= (GPR (OP
[1])) & 0xff;
571 uint16_t tmp
= (a
+ b
) & 0xff;
572 trace_input ("addub", OP_REG
, OP_REG
, OP_VOID
);
573 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
574 trace_output_16 (sd
, tmp
);
579 OP_2E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
582 uint16_t b
= GPR (OP
[1]);
583 uint16_t tmp
= (a
+ b
);
584 trace_input ("adduw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
585 SET_GPR (OP
[1], tmp
);
586 trace_output_16 (sd
, tmp
);
591 OP_2EB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
594 uint16_t b
= GPR (OP
[1]);
595 uint16_t tmp
= (a
+ b
);
596 trace_input ("adduw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
597 SET_GPR (OP
[1], tmp
);
598 trace_output_16 (sd
, tmp
);
603 OP_2F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
605 uint16_t a
= GPR (OP
[0]);
606 uint16_t b
= GPR (OP
[1]);
607 uint16_t tmp
= (a
+ b
);
608 trace_input ("adduw", OP_REG
, OP_REG
, OP_VOID
);
609 SET_GPR (OP
[1], tmp
);
610 trace_output_16 (sd
, tmp
);
615 OP_30_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
618 uint8_t b
= (GPR (OP
[1]) & 0xff);
619 uint16_t tmp
= (a
+ b
) & 0xff;
620 trace_input ("addb", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
621 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
622 SET_PSR_C (tmp
> 0xFF);
623 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
624 trace_output_16 (sd
, tmp
);
629 OP_30B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
631 uint8_t a
= (OP
[0]) & 0xff;
632 uint8_t b
= (GPR (OP
[1]) & 0xff);
633 uint16_t tmp
= (a
+ b
) & 0xff;
634 trace_input ("addb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
635 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
636 SET_PSR_C (tmp
> 0xFF);
637 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
638 trace_output_16 (sd
, tmp
);
643 OP_31_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
645 uint8_t a
= (GPR (OP
[0]) & 0xff);
646 uint8_t b
= (GPR (OP
[1]) & 0xff);
647 uint16_t tmp
= (a
+ b
) & 0xff;
648 trace_input ("addb", OP_REG
, OP_REG
, OP_VOID
);
649 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
650 SET_PSR_C (tmp
> 0xFF);
651 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
652 trace_output_16 (sd
, tmp
);
657 OP_32_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
660 uint16_t tmp
, b
= GPR (OP
[1]);
662 trace_input ("addw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
663 SET_GPR (OP
[1], tmp
);
664 SET_PSR_C (tmp
> 0xFFFF);
665 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
666 trace_output_16 (sd
, tmp
);
671 OP_32B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
674 uint16_t tmp
, b
= GPR (OP
[1]);
676 trace_input ("addw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
677 SET_GPR (OP
[1], tmp
);
678 SET_PSR_C (tmp
> 0xFFFF);
679 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
680 trace_output_16 (sd
, tmp
);
685 OP_33_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
687 uint16_t tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
688 trace_input ("addw", OP_REG
, OP_REG
, OP_VOID
);
690 SET_GPR (OP
[1], tmp
);
691 SET_PSR_C (tmp
> 0xFFFF);
692 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
693 trace_output_16 (sd
, tmp
);
698 OP_34_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
700 uint8_t tmp
, a
= OP
[0] & 0xff, b
= (GPR (OP
[1])) & 0xff;
701 trace_input ("addcb", OP_CONSTANT4_1
, OP_REG
, OP_REG
);
702 tmp
= (a
+ b
+ PSR_C
) & 0xff;
703 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
704 SET_PSR_C (tmp
> 0xFF);
705 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
706 trace_output_16 (sd
, tmp
);
711 OP_34B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
713 int8_t a
= OP
[0] & 0xff;
714 uint8_t b
= (GPR (OP
[1])) & 0xff;
715 uint8_t tmp
= (a
+ b
+ PSR_C
) & 0xff;
716 trace_input ("addcb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
717 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
718 SET_PSR_C (tmp
> 0xFF);
719 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
720 trace_output_16 (sd
, tmp
);
725 OP_35_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
727 uint8_t a
= (GPR (OP
[0])) & 0xff;
728 uint8_t b
= (GPR (OP
[1])) & 0xff;
729 uint8_t tmp
= (a
+ b
+ PSR_C
) & 0xff;
730 trace_input ("addcb", OP_REG
, OP_REG
, OP_VOID
);
731 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
732 SET_PSR_C (tmp
> 0xFF);
733 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
734 trace_output_16 (sd
, tmp
);
739 OP_36_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
742 uint16_t b
= GPR (OP
[1]);
743 uint16_t tmp
= (a
+ b
+ PSR_C
);
744 trace_input ("addcw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
745 SET_GPR (OP
[1], tmp
);
746 SET_PSR_C (tmp
> 0xFFFF);
747 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
748 trace_output_16 (sd
, tmp
);
753 OP_36B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
756 uint16_t b
= GPR (OP
[1]);
757 uint16_t tmp
= (a
+ b
+ PSR_C
);
758 trace_input ("addcw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
759 SET_GPR (OP
[1], tmp
);
760 SET_PSR_C (tmp
> 0xFFFF);
761 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
762 trace_output_16 (sd
, tmp
);
767 OP_37_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
769 uint16_t a
= GPR (OP
[1]);
770 uint16_t b
= GPR (OP
[1]);
771 uint16_t tmp
= (a
+ b
+ PSR_C
);
772 trace_input ("addcw", OP_REG
, OP_REG
, OP_VOID
);
773 SET_GPR (OP
[1], tmp
);
774 SET_PSR_C (tmp
> 0xFFFF);
775 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
776 trace_output_16 (sd
, tmp
);
781 OP_60_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
784 uint32_t b
= GPR32 (OP
[1]);
785 uint32_t tmp
= (a
+ b
);
786 trace_input ("addd", OP_CONSTANT4_1
, OP_REGP
, OP_VOID
);
787 SET_GPR32 (OP
[1], tmp
);
788 SET_PSR_C (tmp
> 0xFFFFFFFF);
789 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
790 trace_output_32 (sd
, tmp
);
795 OP_60B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
797 int32_t a
= (SEXT16(OP
[0]));
798 uint32_t b
= GPR32 (OP
[1]);
799 uint32_t tmp
= (a
+ b
);
800 trace_input ("addd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
801 SET_GPR32 (OP
[1], tmp
);
802 SET_PSR_C (tmp
> 0xFFFFFFFF);
803 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
804 trace_output_32 (sd
, tmp
);
809 OP_61_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
811 uint32_t a
= GPR32 (OP
[0]);
812 uint32_t b
= GPR32 (OP
[1]);
813 uint32_t tmp
= (a
+ b
);
814 trace_input ("addd", OP_REGP
, OP_REGP
, OP_VOID
);
815 SET_GPR32 (OP
[1], tmp
);
816 trace_output_32 (sd
, tmp
);
817 SET_PSR_C (tmp
> 0xFFFFFFFF);
818 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
823 OP_4_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
826 uint32_t b
= GPR32 (OP
[1]);
828 trace_input ("addd", OP_CONSTANT20
, OP_REGP
, OP_VOID
);
830 SET_GPR32 (OP
[1], tmp
);
831 SET_PSR_C (tmp
> 0xFFFFFFFF);
832 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
833 trace_output_32 (sd
, tmp
);
838 OP_2_C (SIM_DESC sd
, SIM_CPU
*cpu
)
841 uint32_t b
= GPR32 (OP
[1]);
843 trace_input ("addd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
845 SET_GPR32 (OP
[1], tmp
);
846 SET_PSR_C (tmp
> 0xFFFFFFFF);
847 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
848 trace_output_32 (sd
, tmp
);
853 OP_20_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
855 uint8_t tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
856 trace_input ("andb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
858 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
859 trace_output_16 (sd
, tmp
);
864 OP_20B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
866 uint8_t tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
867 trace_input ("andb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
869 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
870 trace_output_16 (sd
, tmp
);
875 OP_21_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
877 uint8_t tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
878 trace_input ("andb", OP_REG
, OP_REG
, OP_VOID
);
880 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
881 trace_output_16 (sd
, tmp
);
886 OP_22_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
888 uint16_t tmp
, a
= OP
[0], b
= GPR (OP
[1]);
889 trace_input ("andw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
891 SET_GPR (OP
[1], tmp
);
892 trace_output_16 (sd
, tmp
);
897 OP_22B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
899 uint16_t tmp
, a
= OP
[0], b
= GPR (OP
[1]);
900 trace_input ("andw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
902 SET_GPR (OP
[1], tmp
);
903 trace_output_16 (sd
, tmp
);
908 OP_23_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
910 uint16_t tmp
, a
= GPR (OP
[0]), b
= GPR (OP
[1]);
911 trace_input ("andw", OP_REG
, OP_REG
, OP_VOID
);
913 SET_GPR (OP
[1], tmp
);
914 trace_output_16 (sd
, tmp
);
919 OP_4_C (SIM_DESC sd
, SIM_CPU
*cpu
)
921 uint32_t tmp
, a
= OP
[0], b
= GPR32 (OP
[1]);
922 trace_input ("andd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
924 SET_GPR32 (OP
[1], tmp
);
925 trace_output_32 (sd
, tmp
);
930 OP_14B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
932 uint32_t tmp
, a
= (GPR32 (OP
[0])), b
= (GPR32 (OP
[1]));
933 trace_input ("andd", OP_REGP
, OP_REGP
, OP_VOID
);
935 SET_GPR32 (OP
[1], tmp
);
936 trace_output_32 (sd
, tmp
);
941 OP_5_C (SIM_DESC sd
, SIM_CPU
*cpu
)
943 uint32_t tmp
, a
= (OP
[0]), b
= GPR32 (OP
[1]);
944 trace_input ("ord", OP_CONSTANT32
, OP_REG
, OP_VOID
);
946 SET_GPR32 (OP
[1], tmp
);
947 trace_output_32 (sd
, tmp
);
952 OP_149_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
954 uint32_t tmp
, a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
955 trace_input ("ord", OP_REGP
, OP_REGP
, OP_VOID
);
957 SET_GPR32 (OP
[1], tmp
);
958 trace_output_32 (sd
, tmp
);
963 OP_6_C (SIM_DESC sd
, SIM_CPU
*cpu
)
965 uint32_t tmp
, a
= (OP
[0]), b
= GPR32 (OP
[1]);
966 trace_input ("xord", OP_CONSTANT32
, OP_REG
, OP_VOID
);
968 SET_GPR32 (OP
[1], tmp
);
969 trace_output_32 (sd
, tmp
);
974 OP_14A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
976 uint32_t tmp
, a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
977 trace_input ("xord", OP_REGP
, OP_REGP
, OP_VOID
);
979 SET_GPR32 (OP
[1], tmp
);
980 trace_output_32 (sd
, tmp
);
986 OP_1_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
988 uint32_t tmp
= 0, cc
= cond_stat (OP
[0]);
989 trace_input ("b", OP_CONSTANT4
, OP_DISPE9
, OP_VOID
);
993 tmp
= (PC
- (OP
[1]));
995 tmp
= (PC
+ (OP
[1]));
996 /* If the resulting PC value is less than 0x00_0000 or greater
997 than 0xFF_FFFF, this instruction causes an IAD trap.*/
999 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1001 trace_output_void (sd
);
1002 EXCEPTION (SIM_SIGBUS
);
1007 sign_flag
= 0; /* Reset sign_flag. */
1008 trace_output_32 (sd
, tmp
);
1013 OP_18_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1015 uint32_t tmp
= 0, cc
= cond_stat (OP
[0]);
1016 trace_input ("b", OP_CONSTANT4
, OP_DISP17
, OP_VOID
);
1023 /* If the resulting PC value is less than 0x00_0000 or greater
1024 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1026 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1028 trace_output_void (sd
);
1029 EXCEPTION (SIM_SIGBUS
);
1034 sign_flag
= 0; /* Reset sign_flag. */
1035 trace_output_32 (sd
, tmp
);
1040 OP_10_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
1042 uint32_t tmp
= 0, cc
= cond_stat (OP
[0]);
1043 trace_input ("b", OP_CONSTANT4
, OP_DISP25
, OP_VOID
);
1047 tmp
= (PC
- (OP
[1]));
1049 tmp
= (PC
+ (OP
[1]));
1050 /* If the resulting PC value is less than 0x00_0000 or greater
1051 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1053 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1055 trace_output_void (sd
);
1056 EXCEPTION (SIM_SIGBUS
);
1061 sign_flag
= 0; /* Reset sign_flag. */
1062 trace_output_32 (sd
, tmp
);
1067 OP_C0_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1070 trace_input ("bal", OP_REG
, OP_DISP17
, OP_VOID
);
1071 tmp
= ((PC
+ 4) >> 1); /* Store PC in RA register. */
1072 SET_GPR32 (14, tmp
);
1074 tmp
= (PC
- (OP
[1]));
1076 tmp
= (PC
+ (OP
[1]));
1078 /* If the resulting PC value is less than 0x00_0000 or greater
1079 than 0xFF_FFFF, this instruction causes an IAD trap. */
1081 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1083 trace_output_void (sd
);
1084 EXCEPTION (SIM_SIGBUS
);
1088 sign_flag
= 0; /* Reset sign_flag. */
1089 trace_output_32 (sd
, tmp
);
1095 OP_102_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1098 trace_input ("bal", OP_REGP
, OP_DISP25
, OP_VOID
);
1099 tmp
= (((PC
) + 4) >> 1); /* Store PC in reg pair. */
1100 SET_GPR32 (OP
[0], tmp
);
1102 tmp
= ((PC
) - (OP
[1]));
1104 tmp
= ((PC
) + (OP
[1]));
1105 /* If the resulting PC value is less than 0x00_0000 or greater
1106 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1108 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1110 trace_output_void (sd
);
1111 EXCEPTION (SIM_SIGBUS
);
1115 sign_flag
= 0; /* Reset sign_flag. */
1116 trace_output_32 (sd
, tmp
);
1121 OP_148_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1124 trace_input ("jal", OP_REGP
, OP_REGP
, OP_VOID
);
1125 SET_GPR32 (OP
[0], (((PC
) + 4) >> 1)); /* Store next PC in RA */
1126 tmp
= GPR32 (OP
[1]);
1127 tmp
= SEXT24(tmp
<< 1);
1128 /* If the resulting PC value is less than 0x00_0000 or greater
1129 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1131 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
1133 trace_output_void (sd
);
1134 EXCEPTION (SIM_SIGBUS
);
1139 trace_output_32 (sd
, tmp
);
1145 OP_D_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1148 trace_input ("jal", OP_REGP
, OP_VOID
, OP_VOID
);
1149 SET_GPR32 (14, (((PC
) + 2) >> 1)); /* Store next PC in RA */
1150 tmp
= GPR32 (OP
[0]);
1151 tmp
= SEXT24(tmp
<< 1);
1152 /* If the resulting PC value is less than 0x00_0000 or greater
1153 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1155 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
1157 trace_output_void (sd
);
1158 EXCEPTION (SIM_SIGBUS
);
1163 trace_output_32 (sd
, tmp
);
1169 OP_C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1172 uint8_t a
= (GPR (OP
[0]) & 0xFF);
1173 trace_input ("beq0b", OP_REG
, OP_DISP5
, OP_VOID
);
1178 addr
= (PC
- OP
[1]);
1180 addr
= (PC
+ OP
[1]);
1184 sign_flag
= 0; /* Reset sign_flag. */
1185 trace_output_void (sd
);
1190 OP_D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1193 uint8_t a
= (GPR (OP
[0]) & 0xFF);
1194 trace_input ("bne0b", OP_REG
, OP_DISP5
, OP_VOID
);
1199 addr
= (PC
- OP
[1]);
1201 addr
= (PC
+ OP
[1]);
1205 sign_flag
= 0; /* Reset sign_flag. */
1206 trace_output_void (sd
);
1211 OP_E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1214 uint16_t a
= GPR (OP
[0]);
1215 trace_input ("beq0w", OP_REG
, OP_DISP5
, OP_VOID
);
1220 addr
= (PC
- OP
[1]);
1222 addr
= (PC
+ OP
[1]);
1226 sign_flag
= 0; /* Reset sign_flag. */
1227 trace_output_void (sd
);
1232 OP_F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1235 uint16_t a
= GPR (OP
[0]);
1236 trace_input ("bne0w", OP_REG
, OP_DISP5
, OP_VOID
);
1241 addr
= (PC
- OP
[1]);
1243 addr
= (PC
+ OP
[1]);
1247 sign_flag
= 0; /* Reset sign_flag. */
1248 trace_output_void (sd
);
1254 OP_A0_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1257 trace_input ("jeq", OP_REGP
, OP_VOID
, OP_VOID
);
1260 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits. */
1261 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit. */
1263 trace_output_32 (sd
, tmp
);
1268 OP_A1_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1271 trace_input ("jne", OP_REGP
, OP_VOID
, OP_VOID
);
1274 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits. */
1275 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit. */
1277 trace_output_32 (sd
, tmp
);
1282 OP_A2_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1285 trace_input ("jcs", OP_REGP
, OP_VOID
, OP_VOID
);
1288 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1289 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1291 trace_output_32 (sd
, tmp
);
1296 OP_A3_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1299 trace_input ("jcc", OP_REGP
, OP_VOID
, OP_VOID
);
1302 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1303 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1305 trace_output_32 (sd
, tmp
);
1310 OP_A4_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1313 trace_input ("jhi", OP_REGP
, OP_VOID
, OP_VOID
);
1316 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1317 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1319 trace_output_32 (sd
, tmp
);
1324 OP_A5_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1327 trace_input ("jls", OP_REGP
, OP_VOID
, OP_VOID
);
1330 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1331 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1333 trace_output_32 (sd
, tmp
);
1338 OP_A6_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1341 trace_input ("jgt", OP_REGP
, OP_VOID
, OP_VOID
);
1344 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1345 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1347 trace_output_32 (sd
, tmp
);
1352 OP_A7_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1355 trace_input ("jle", OP_REGP
, OP_VOID
, OP_VOID
);
1358 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1359 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1361 trace_output_32 (sd
, tmp
);
1367 OP_A8_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1370 trace_input ("jfs", OP_REGP
, OP_VOID
, OP_VOID
);
1373 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1374 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1376 trace_output_32 (sd
, tmp
);
1381 OP_A9_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1384 trace_input ("jfc", OP_REGP
, OP_VOID
, OP_VOID
);
1387 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1388 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1390 trace_output_32 (sd
, tmp
);
1395 OP_AA_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1398 trace_input ("jlo", OP_REGP
, OP_VOID
, OP_VOID
);
1399 if (((PSR_Z
) == 0) & ((PSR_L
) == 0))
1401 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1402 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1404 trace_output_32 (sd
, tmp
);
1409 OP_AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1412 trace_input ("jhs", OP_REGP
, OP_VOID
, OP_VOID
);
1413 if (((PSR_Z
) == 1) | ((PSR_L
) == 1))
1415 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1416 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1418 trace_output_32 (sd
, tmp
);
1423 OP_AC_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1426 trace_input ("jlt", OP_REGP
, OP_VOID
, OP_VOID
);
1427 if (((PSR_Z
) == 0) & ((PSR_N
) == 0))
1429 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1430 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1432 trace_output_32 (sd
, tmp
);
1437 OP_AD_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1440 trace_input ("jge", OP_REGP
, OP_VOID
, OP_VOID
);
1441 if (((PSR_Z
) == 1) | ((PSR_N
) == 1))
1443 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1444 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1446 trace_output_32 (sd
, tmp
);
1451 OP_AE_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1454 trace_input ("jump", OP_REGP
, OP_VOID
, OP_VOID
);
1455 tmp
= GPR32 (OP
[0]) /*& 0x3fffff*/; /* Use only 0 - 22 bits */
1456 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1457 trace_output_32 (sd
, tmp
);
1462 OP_AF_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1465 trace_input ("jusr", OP_REGP
, OP_VOID
, OP_VOID
);
1466 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1467 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1469 trace_output_32 (sd
, tmp
);
1474 OP_80_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1476 trace_input ("seq", OP_REG
, OP_VOID
, OP_VOID
);
1481 trace_output_void (sd
);
1485 OP_81_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1487 trace_input ("sne", OP_REG
, OP_VOID
, OP_VOID
);
1492 trace_output_void (sd
);
1497 OP_82_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1499 trace_input ("scs", OP_REG
, OP_VOID
, OP_VOID
);
1504 trace_output_void (sd
);
1509 OP_83_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1511 trace_input ("scc", OP_REG
, OP_VOID
, OP_VOID
);
1516 trace_output_void (sd
);
1521 OP_84_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1523 trace_input ("shi", OP_REG
, OP_VOID
, OP_VOID
);
1528 trace_output_void (sd
);
1533 OP_85_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1535 trace_input ("sls", OP_REG
, OP_VOID
, OP_VOID
);
1540 trace_output_void (sd
);
1545 OP_86_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1547 trace_input ("sgt", OP_REG
, OP_VOID
, OP_VOID
);
1552 trace_output_void (sd
);
1557 OP_87_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1559 trace_input ("sle", OP_REG
, OP_VOID
, OP_VOID
);
1564 trace_output_void (sd
);
1569 OP_88_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1571 trace_input ("sfs", OP_REG
, OP_VOID
, OP_VOID
);
1576 trace_output_void (sd
);
1581 OP_89_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1583 trace_input ("sfc", OP_REG
, OP_VOID
, OP_VOID
);
1588 trace_output_void (sd
);
1594 OP_8A_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1596 trace_input ("slo", OP_REG
, OP_VOID
, OP_VOID
);
1597 if (((PSR_Z
) == 0) & ((PSR_L
) == 0))
1601 trace_output_void (sd
);
1606 OP_8B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1608 trace_input ("shs", OP_REG
, OP_VOID
, OP_VOID
);
1609 if ( ((PSR_Z
) == 1) | ((PSR_L
) == 1))
1613 trace_output_void (sd
);
1618 OP_8C_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1620 trace_input ("slt", OP_REG
, OP_VOID
, OP_VOID
);
1621 if (((PSR_Z
) == 0) & ((PSR_N
) == 0))
1625 trace_output_void (sd
);
1630 OP_8D_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1632 trace_input ("sge", OP_REG
, OP_VOID
, OP_VOID
);
1633 if (((PSR_Z
) == 1) | ((PSR_N
) == 1))
1637 trace_output_void (sd
);
1642 OP_D7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1644 uint8_t a
= OP
[0] & 0xff;
1645 uint32_t addr
= OP
[1], tmp
;
1646 trace_input ("cbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1648 SET_PSR_F (tmp
& (1 << a
));
1649 tmp
= tmp
& ~(1 << a
);
1651 trace_output_32 (sd
, tmp
);
1656 OP_107_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1658 uint8_t a
= OP
[0] & 0xff;
1659 uint32_t addr
= OP
[1], tmp
;
1660 trace_input ("cbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1662 SET_PSR_F (tmp
& (1 << a
));
1663 tmp
= tmp
& ~(1 << a
);
1665 trace_output_32 (sd
, tmp
);
1670 OP_68_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1672 uint8_t a
= (OP
[0]) & 0xff;
1673 uint32_t addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1674 trace_input ("cbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
1676 SET_PSR_F (tmp
& (1 << a
));
1677 tmp
= tmp
& ~(1 << a
);
1679 trace_output_32 (sd
, addr
);
1684 OP_1AA_A (SIM_DESC sd
, SIM_CPU
*cpu
)
1686 uint8_t a
= (OP
[0]) & 0xff;
1687 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1688 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1690 SET_PSR_F (tmp
& (1 << a
));
1691 tmp
= tmp
& ~(1 << a
);
1693 trace_output_32 (sd
, addr
);
1698 OP_104_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1700 uint8_t a
= (OP
[0]) & 0xff;
1701 uint32_t addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1702 trace_input ("cbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1704 SET_PSR_F (tmp
& (1 << a
));
1705 tmp
= tmp
& ~(1 << a
);
1707 trace_output_32 (sd
, addr
);
1712 OP_D4_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1714 uint8_t a
= (OP
[0]) & 0xff;
1715 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1716 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1718 SET_PSR_F (tmp
& (1 << a
));
1719 tmp
= tmp
& ~(1 << a
);
1721 trace_output_32 (sd
, addr
);
1726 OP_D6_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1728 uint8_t a
= (OP
[0]) & 0xff;
1729 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1730 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1732 SET_PSR_F (tmp
& (1 << a
));
1733 tmp
= tmp
& ~(1 << a
);
1735 trace_output_32 (sd
, addr
);
1741 OP_105_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1743 uint8_t a
= (OP
[0]) & 0xff;
1744 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1745 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
1747 SET_PSR_F (tmp
& (1 << a
));
1748 tmp
= tmp
& ~(1 << a
);
1750 trace_output_32 (sd
, addr
);
1755 OP_106_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1757 uint8_t a
= (OP
[0]) & 0xff;
1758 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1759 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
1761 SET_PSR_F (tmp
& (1 << a
));
1762 tmp
= tmp
& ~(1 << a
);
1764 trace_output_32 (sd
, addr
);
1770 OP_6F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1773 uint32_t addr
= OP
[1], tmp
;
1774 trace_input ("cbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1776 SET_PSR_F (tmp
& (1 << a
));
1777 tmp
= tmp
& ~(1 << a
);
1779 trace_output_32 (sd
, tmp
);
1784 OP_117_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1787 uint32_t addr
= OP
[1], tmp
;
1788 trace_input ("cbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1790 SET_PSR_F (tmp
& (1 << a
));
1791 tmp
= tmp
& ~(1 << a
);
1793 trace_output_32 (sd
, tmp
);
1798 OP_36_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
1801 uint16_t a
= (OP
[0]), tmp
;
1802 trace_input ("cbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
1805 addr
= (GPR32 (12)) + OP
[2];
1807 addr
= (GPR32 (13)) + OP
[2];
1810 SET_PSR_F (tmp
& (1 << a
));
1811 tmp
= tmp
& ~(1 << a
);
1813 trace_output_32 (sd
, addr
);
1819 OP_1AB_A (SIM_DESC sd
, SIM_CPU
*cpu
)
1821 uint16_t a
= (OP
[0]);
1822 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1823 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1825 SET_PSR_F (tmp
& (1 << a
));
1826 tmp
= tmp
& ~(1 << a
);
1828 trace_output_32 (sd
, addr
);
1833 OP_114_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1835 uint16_t a
= (OP
[0]);
1836 uint32_t addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1837 trace_input ("cbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1839 SET_PSR_F (tmp
& (1 << a
));
1840 tmp
= tmp
& ~(1 << a
);
1842 trace_output_32 (sd
, addr
);
1848 OP_6E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1850 uint16_t a
= (OP
[0]);
1851 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1852 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1854 SET_PSR_F (tmp
& (1 << a
));
1855 tmp
= tmp
& ~(1 << a
);
1857 trace_output_32 (sd
, addr
);
1862 OP_69_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1864 uint16_t a
= (OP
[0]);
1865 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1866 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1868 SET_PSR_F (tmp
& (1 << a
));
1869 tmp
= tmp
& ~(1 << a
);
1871 trace_output_32 (sd
, addr
);
1877 OP_115_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1879 uint16_t a
= (OP
[0]);
1880 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1881 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
1883 SET_PSR_F (tmp
& (1 << a
));
1884 tmp
= tmp
& ~(1 << a
);
1886 trace_output_32 (sd
, addr
);
1891 OP_116_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1893 uint16_t a
= (OP
[0]);
1894 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1895 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
1897 SET_PSR_F (tmp
& (1 << a
));
1898 tmp
= tmp
& ~(1 << a
);
1900 trace_output_32 (sd
, addr
);
1905 OP_E7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1907 uint8_t a
= OP
[0] & 0xff;
1908 uint32_t addr
= OP
[1], tmp
;
1909 trace_input ("sbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1911 SET_PSR_F (tmp
& (1 << a
));
1912 tmp
= tmp
| (1 << a
);
1914 trace_output_32 (sd
, tmp
);
1919 OP_10B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1921 uint8_t a
= OP
[0] & 0xff;
1922 uint32_t addr
= OP
[1], tmp
;
1923 trace_input ("sbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1925 SET_PSR_F (tmp
& (1 << a
));
1926 tmp
= tmp
| (1 << a
);
1928 trace_output_32 (sd
, tmp
);
1933 OP_70_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1935 uint8_t a
= OP
[0] & 0xff;
1936 uint32_t addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1937 trace_input ("sbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
1939 SET_PSR_F (tmp
& (1 << a
));
1940 tmp
= tmp
| (1 << a
);
1942 trace_output_32 (sd
, tmp
);
1947 OP_1CA_A (SIM_DESC sd
, SIM_CPU
*cpu
)
1949 uint8_t a
= OP
[0] & 0xff;
1950 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1951 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1953 SET_PSR_F (tmp
& (1 << a
));
1954 tmp
= tmp
| (1 << a
);
1956 trace_output_32 (sd
, tmp
);
1961 OP_108_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1963 uint8_t a
= OP
[0] & 0xff;
1964 uint32_t addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1965 trace_input ("sbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1967 SET_PSR_F (tmp
& (1 << a
));
1968 tmp
= tmp
| (1 << a
);
1970 trace_output_32 (sd
, tmp
);
1976 OP_E4_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1978 uint8_t a
= OP
[0] & 0xff;
1979 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1980 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1982 SET_PSR_F (tmp
& (1 << a
));
1983 tmp
= tmp
| (1 << a
);
1985 trace_output_32 (sd
, tmp
);
1990 OP_E6_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1992 uint8_t a
= OP
[0] & 0xff;
1993 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1994 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1996 SET_PSR_F (tmp
& (1 << a
));
1997 tmp
= tmp
| (1 << a
);
1999 trace_output_32 (sd
, tmp
);
2005 OP_109_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2007 uint8_t a
= OP
[0] & 0xff;
2008 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2009 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2011 SET_PSR_F (tmp
& (1 << a
));
2012 tmp
= tmp
| (1 << a
);
2014 trace_output_32 (sd
, tmp
);
2020 OP_10A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2022 uint8_t a
= OP
[0] & 0xff;
2023 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2024 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2026 SET_PSR_F (tmp
& (1 << a
));
2027 tmp
= tmp
| (1 << a
);
2029 trace_output_32 (sd
, tmp
);
2035 OP_77_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2038 uint32_t addr
= OP
[1], tmp
;
2039 trace_input ("sbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2041 SET_PSR_F (tmp
& (1 << a
));
2042 tmp
= tmp
| (1 << a
);
2044 trace_output_32 (sd
, tmp
);
2049 OP_11B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2052 uint32_t addr
= OP
[1], tmp
;
2053 trace_input ("sbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2055 SET_PSR_F (tmp
& (1 << a
));
2056 tmp
= tmp
| (1 << a
);
2058 trace_output_32 (sd
, tmp
);
2063 OP_3A_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
2066 uint16_t a
= (OP
[0]), tmp
;
2067 trace_input ("sbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
2070 addr
= (GPR32 (12)) + OP
[2];
2072 addr
= (GPR32 (13)) + OP
[2];
2075 SET_PSR_F (tmp
& (1 << a
));
2076 tmp
= tmp
| (1 << a
);
2078 trace_output_32 (sd
, addr
);
2083 OP_1CB_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2085 uint16_t a
= (OP
[0]);
2086 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2087 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2089 SET_PSR_F (tmp
& (1 << a
));
2090 tmp
= tmp
| (1 << a
);
2092 trace_output_32 (sd
, addr
);
2097 OP_118_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2099 uint16_t a
= (OP
[0]);
2100 uint32_t addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2101 trace_input ("sbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2103 SET_PSR_F (tmp
& (1 << a
));
2104 tmp
= tmp
| (1 << a
);
2106 trace_output_32 (sd
, addr
);
2111 OP_76_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2113 uint16_t a
= (OP
[0]);
2114 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2115 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2117 SET_PSR_F (tmp
& (1 << a
));
2118 tmp
= tmp
| (1 << a
);
2120 trace_output_32 (sd
, addr
);
2125 OP_71_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2127 uint16_t a
= (OP
[0]);
2128 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2129 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2131 SET_PSR_F (tmp
& (1 << a
));
2132 tmp
= tmp
| (1 << a
);
2134 trace_output_32 (sd
, addr
);
2139 OP_119_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2141 uint16_t a
= (OP
[0]);
2142 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2143 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2145 SET_PSR_F (tmp
& (1 << a
));
2146 tmp
= tmp
| (1 << a
);
2148 trace_output_32 (sd
, addr
);
2153 OP_11A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2155 uint16_t a
= (OP
[0]);
2156 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2157 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2159 SET_PSR_F (tmp
& (1 << a
));
2160 tmp
= tmp
| (1 << a
);
2162 trace_output_32 (sd
, addr
);
2168 OP_F7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
2170 uint8_t a
= OP
[0] & 0xff;
2171 uint32_t addr
= OP
[1], tmp
;
2172 trace_input ("tbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2174 SET_PSR_F (tmp
& (1 << a
));
2175 trace_output_32 (sd
, tmp
);
2180 OP_10F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2182 uint8_t a
= OP
[0] & 0xff;
2183 uint32_t addr
= OP
[1], tmp
;
2184 trace_input ("tbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2186 SET_PSR_F (tmp
& (1 << a
));
2187 trace_output_32 (sd
, tmp
);
2192 OP_78_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2194 uint8_t a
= (OP
[0]) & 0xff;
2195 uint32_t addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2196 trace_input ("tbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
2198 SET_PSR_F (tmp
& (1 << a
));
2199 trace_output_32 (sd
, addr
);
2204 OP_1EA_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2206 uint8_t a
= (OP
[0]) & 0xff;
2207 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2208 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2210 SET_PSR_F (tmp
& (1 << a
));
2211 trace_output_32 (sd
, addr
);
2216 OP_10C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2218 uint8_t a
= (OP
[0]) & 0xff;
2219 uint32_t addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2220 trace_input ("tbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2222 SET_PSR_F (tmp
& (1 << a
));
2223 trace_output_32 (sd
, addr
);
2228 OP_F4_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
2230 uint8_t a
= (OP
[0]) & 0xff;
2231 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2232 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2234 SET_PSR_F (tmp
& (1 << a
));
2235 trace_output_32 (sd
, addr
);
2240 OP_F6_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
2242 uint8_t a
= (OP
[0]) & 0xff;
2243 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2244 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2246 SET_PSR_F (tmp
& (1 << a
));
2247 trace_output_32 (sd
, addr
);
2252 OP_10D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2254 uint8_t a
= (OP
[0]) & 0xff;
2255 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2256 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2258 SET_PSR_F (tmp
& (1 << a
));
2259 trace_output_32 (sd
, addr
);
2264 OP_10E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2266 uint8_t a
= (OP
[0]) & 0xff;
2267 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2268 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2270 SET_PSR_F (tmp
& (1 << a
));
2271 trace_output_32 (sd
, addr
);
2277 OP_7F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2280 uint32_t addr
= OP
[1], tmp
;
2281 trace_input ("tbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2283 SET_PSR_F (tmp
& (1 << a
));
2284 trace_output_32 (sd
, tmp
);
2289 OP_11F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2292 uint32_t addr
= OP
[1], tmp
;
2293 trace_input ("tbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2295 SET_PSR_F (tmp
& (1 << a
));
2296 trace_output_32 (sd
, tmp
);
2302 OP_3E_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
2305 uint16_t a
= (OP
[0]), tmp
;
2306 trace_input ("tbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
2309 addr
= (GPR32 (12)) + OP
[2];
2311 addr
= (GPR32 (13)) + OP
[2];
2314 SET_PSR_F (tmp
& (1 << a
));
2315 trace_output_32 (sd
, addr
);
2320 OP_1EB_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2322 uint16_t a
= (OP
[0]);
2323 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2324 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2326 SET_PSR_F (tmp
& (1 << a
));
2327 trace_output_32 (sd
, addr
);
2332 OP_11C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2334 uint16_t a
= (OP
[0]);
2335 uint32_t addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2336 trace_input ("tbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2338 SET_PSR_F (tmp
& (1 << a
));
2339 trace_output_32 (sd
, addr
);
2344 OP_7E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2346 uint16_t a
= (OP
[0]);
2347 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2348 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2350 SET_PSR_F (tmp
& (1 << a
));
2351 trace_output_32 (sd
, addr
);
2356 OP_79_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2358 uint16_t a
= (OP
[0]);
2359 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2360 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2362 SET_PSR_F (tmp
& (1 << a
));
2363 trace_output_32 (sd
, addr
);
2368 OP_11D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2370 uint16_t a
= (OP
[0]);
2371 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2372 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2374 SET_PSR_F (tmp
& (1 << a
));
2375 trace_output_32 (sd
, addr
);
2381 OP_11E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2383 uint16_t a
= (OP
[0]);
2384 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2385 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2387 SET_PSR_F (tmp
& (1 << a
));
2388 trace_output_32 (sd
, addr
);
2394 OP_6_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2397 uint16_t b
= (GPR (OP
[1]));
2398 trace_input ("tbit", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2399 SET_PSR_F (b
& (1 << a
));
2400 trace_output_16 (sd
, b
);
2405 OP_7_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2407 uint16_t a
= GPR (OP
[0]);
2408 uint16_t b
= (GPR (OP
[1]));
2409 trace_input ("tbit", OP_REG
, OP_REG
, OP_VOID
);
2410 SET_PSR_F (b
& (1 << a
));
2411 trace_output_16 (sd
, b
);
2417 OP_50_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2419 uint8_t a
= (OP
[0]) & 0xFF;
2420 uint8_t b
= (GPR (OP
[1])) & 0xFF;
2421 trace_input ("cmpb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2423 SET_PSR_N ((int8_t)a
> (int8_t)b
);
2425 trace_output_flag (sd
);
2430 OP_50B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2432 uint8_t a
= (OP
[0]) & 0xFF;
2433 uint8_t b
= (GPR (OP
[1])) & 0xFF;
2434 trace_input ("cmpb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2436 SET_PSR_N ((int8_t)a
> (int8_t)b
);
2438 trace_output_flag (sd
);
2443 OP_51_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2445 uint8_t a
= (GPR (OP
[0])) & 0xFF;
2446 uint8_t b
= (GPR (OP
[1])) & 0xFF;
2447 trace_input ("cmpb", OP_REG
, OP_REG
, OP_VOID
);
2449 SET_PSR_N ((int8_t)a
> (int8_t)b
);
2451 trace_output_flag (sd
);
2456 OP_52_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2458 uint16_t a
= (OP
[0]);
2459 uint16_t b
= GPR (OP
[1]);
2460 trace_input ("cmpw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2462 SET_PSR_N ((int16_t)a
> (int16_t)b
);
2464 trace_output_flag (sd
);
2469 OP_52B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2471 uint16_t a
= (OP
[0]);
2472 uint16_t b
= GPR (OP
[1]);
2473 trace_input ("cmpw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2475 SET_PSR_N ((int16_t)a
> (int16_t)b
);
2477 trace_output_flag (sd
);
2482 OP_53_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2484 uint16_t a
= GPR (OP
[0]) ;
2485 uint16_t b
= GPR (OP
[1]) ;
2486 trace_input ("cmpw", OP_REG
, OP_REG
, OP_VOID
);
2488 SET_PSR_N ((int16_t)a
> (int16_t)b
);
2490 trace_output_flag (sd
);
2495 OP_56_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2497 uint32_t a
= (OP
[0]);
2498 uint32_t b
= GPR32 (OP
[1]);
2499 trace_input ("cmpd", OP_CONSTANT4
, OP_REGP
, OP_VOID
);
2501 SET_PSR_N ((int32_t)a
> (int32_t)b
);
2503 trace_output_flag (sd
);
2508 OP_56B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2510 uint32_t a
= (SEXT16(OP
[0]));
2511 uint32_t b
= GPR32 (OP
[1]);
2512 trace_input ("cmpd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
2514 SET_PSR_N ((int32_t)a
> (int32_t)b
);
2516 trace_output_flag (sd
);
2521 OP_57_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2523 uint32_t a
= GPR32 (OP
[0]) ;
2524 uint32_t b
= GPR32 (OP
[1]) ;
2525 trace_input ("cmpd", OP_REGP
, OP_REGP
, OP_VOID
);
2527 SET_PSR_N ((int32_t)a
> (int32_t)b
);
2529 trace_output_flag (sd
);
2534 OP_9_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2536 uint32_t a
= (OP
[0]);
2537 uint32_t b
= GPR32 (OP
[1]);
2538 trace_input ("cmpd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
2540 SET_PSR_N ((int32_t)a
> (int32_t)b
);
2542 trace_output_flag (sd
);
2548 OP_58_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2550 uint8_t tmp
= OP
[0] & 0xFF;
2551 uint16_t a
= (GPR (OP
[1])) & 0xFF00;
2552 trace_input ("movb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2553 SET_GPR (OP
[1], (a
| tmp
));
2554 trace_output_16 (sd
, tmp
);
2559 OP_58B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2561 uint8_t tmp
= OP
[0] & 0xFF;
2562 uint16_t a
= (GPR (OP
[1])) & 0xFF00;
2563 trace_input ("movb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2564 SET_GPR (OP
[1], (a
| tmp
));
2565 trace_output_16 (sd
, tmp
);
2570 OP_59_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2572 uint8_t tmp
= (GPR (OP
[0])) & 0xFF;
2573 uint16_t a
= (GPR (OP
[1])) & 0xFF00;
2574 trace_input ("movb", OP_REG
, OP_REG
, OP_VOID
);
2575 SET_GPR (OP
[1], (a
| tmp
));
2576 trace_output_16 (sd
, tmp
);
2581 OP_5A_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2583 uint16_t tmp
= OP
[0];
2584 trace_input ("movw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
2585 SET_GPR (OP
[1], (tmp
& 0xffff));
2586 trace_output_16 (sd
, tmp
);
2591 OP_5AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2593 int16_t tmp
= OP
[0];
2594 trace_input ("movw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2595 SET_GPR (OP
[1], (tmp
& 0xffff));
2596 trace_output_16 (sd
, tmp
);
2601 OP_5B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2603 uint16_t tmp
= GPR (OP
[0]);
2604 uint32_t a
= GPR32 (OP
[1]);
2605 trace_input ("movw", OP_REG
, OP_REGP
, OP_VOID
);
2606 a
= (a
& 0xffff0000) | tmp
;
2607 SET_GPR32 (OP
[1], a
);
2608 trace_output_16 (sd
, tmp
);
2613 OP_5C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2615 uint8_t tmp
= (GPR (OP
[0])) & 0xFF;
2616 trace_input ("movxb", OP_REG
, OP_REG
, OP_VOID
);
2617 SET_GPR (OP
[1], ((SEXT8(tmp
)) & 0xffff));
2618 trace_output_16 (sd
, tmp
);
2623 OP_5D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2625 uint8_t tmp
= (GPR (OP
[0])) & 0xFF;
2626 trace_input ("movzb", OP_REG
, OP_REG
, OP_VOID
);
2627 SET_GPR (OP
[1], tmp
);
2628 trace_output_16 (sd
, tmp
);
2633 OP_5E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2635 uint16_t tmp
= GPR (OP
[0]);
2636 trace_input ("movxw", OP_REG
, OP_REGP
, OP_VOID
);
2637 SET_GPR32 (OP
[1], SEXT16(tmp
));
2638 trace_output_16 (sd
, tmp
);
2643 OP_5F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2645 uint16_t tmp
= GPR (OP
[0]);
2646 trace_input ("movzw", OP_REG
, OP_REGP
, OP_VOID
);
2647 SET_GPR32 (OP
[1], (tmp
& 0x0000FFFF));
2648 trace_output_16 (sd
, tmp
);
2653 OP_54_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2655 int32_t tmp
= OP
[0];
2656 trace_input ("movd", OP_CONSTANT4
, OP_REGP
, OP_VOID
);
2657 SET_GPR32 (OP
[1], tmp
);
2658 trace_output_32 (sd
, tmp
);
2663 OP_54B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2665 int32_t tmp
= SEXT16(OP
[0]);
2666 trace_input ("movd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
2667 SET_GPR32 (OP
[1], tmp
);
2668 trace_output_32 (sd
, tmp
);
2673 OP_55_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2675 uint32_t tmp
= GPR32 (OP
[0]);
2676 trace_input ("movd", OP_REGP
, OP_REGP
, OP_VOID
);
2677 SET_GPR32 (OP
[1], tmp
);
2678 trace_output_32 (sd
, tmp
);
2683 OP_5_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2685 uint32_t tmp
= OP
[0];
2686 trace_input ("movd", OP_CONSTANT20
, OP_REGP
, OP_VOID
);
2687 SET_GPR32 (OP
[1], tmp
);
2688 trace_output_32 (sd
, tmp
);
2693 OP_7_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2695 int32_t tmp
= OP
[0];
2696 trace_input ("movd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
2697 SET_GPR32 (OP
[1], tmp
);
2698 trace_output_32 (sd
, tmp
);
2703 OP_14_D (SIM_DESC sd
, SIM_CPU
*cpu
)
2705 uint32_t addr
= GPR (0);
2706 uint16_t count
= OP
[0], reg
= 2, tmp
;
2707 trace_input ("loadm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
2710 trace_output_void (sd
);
2711 EXCEPTION (SIM_SIGBUS
);
2721 if (reg
== 6) reg
= 8;
2725 trace_output_void (sd
);
2731 OP_15_D (SIM_DESC sd
, SIM_CPU
*cpu
)
2733 uint32_t addr
= GPR32 (0);
2734 uint16_t count
= OP
[0], reg
= 2, tmp
;
2735 trace_input ("loadm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
2738 trace_output_void (sd
);
2739 EXCEPTION (SIM_SIGBUS
);
2749 if (reg
== 6) reg
= 8;
2752 SET_GPR32 (0, addr
);
2753 trace_output_void (sd
);
2759 OP_88_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2762 * ADDR = zext24(abs20) | remap (ie 0xF00000)
2765 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
2766 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
2767 * by the core to 16M-64k to 16M. */
2769 uint16_t tmp
, a
= (GPR (OP
[1])) & 0xFF00;
2770 uint32_t addr
= OP
[0];
2771 trace_input ("loadb", OP_ABS20
, OP_REG
, OP_VOID
);
2772 if (addr
> 0xEFFFF) addr
|= 0xF00000;
2774 SET_GPR (OP
[1], (a
| tmp
));
2775 trace_output_16 (sd
, tmp
);
2780 OP_127_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2786 uint16_t tmp
, a
= (GPR (OP
[1])) & 0xFF00;
2787 uint32_t addr
= OP
[0];
2788 trace_input ("loadb", OP_ABS24
, OP_REG
, OP_VOID
);
2790 SET_GPR (OP
[1], (a
| tmp
));
2791 trace_output_16 (sd
, tmp
);
2796 OP_45_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
2798 /* loadb [Rindex]ABS20 REG
2799 * ADDR = Rindex + zext24(disp20)
2803 uint16_t tmp
, a
= (GPR (OP
[2])) & 0xFF00;
2804 trace_input ("loadb", OP_R_INDEX8_ABS20
, OP_REG
, OP_VOID
);
2807 addr
= (GPR32 (12)) + OP
[1];
2809 addr
= (GPR32 (13)) + OP
[1];
2812 SET_GPR (OP
[2], (a
| tmp
));
2813 trace_output_16 (sd
, tmp
);
2819 OP_B_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
2821 /* loadb DIPS4(REGP) REG
2822 * ADDR = RPBASE + zext24(DISP4)
2824 uint16_t tmp
, a
= (GPR (OP
[2])) & 0xFF00;
2825 uint32_t addr
= (GPR32 (OP
[1])) + OP
[0];
2826 trace_input ("loadb", OP_RP_BASE_DISP4
, OP_REG
, OP_VOID
);
2828 SET_GPR (OP
[2], (a
| tmp
));
2829 trace_output_16 (sd
, tmp
);
2834 OP_BE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2836 /* loadb [Rindex]disp0(RPbasex) REG
2837 * ADDR = Rpbasex + Rindex
2841 uint16_t tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2842 trace_input ("loadb", OP_RP_INDEX_DISP0
, OP_REG
, OP_VOID
);
2844 addr
= (GPR32 (OP
[2])) + OP
[1];
2847 addr
= (GPR32 (12)) + addr
;
2849 addr
= (GPR32 (13)) + addr
;
2852 SET_GPR (OP
[3], (a
| tmp
));
2853 trace_output_16 (sd
, tmp
);
2858 OP_219_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2860 /* loadb [Rindex]disp14(RPbasex) REG
2861 * ADDR = Rpbasex + Rindex + zext24(disp14)
2865 uint16_t tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2867 addr
= (GPR32 (OP
[2])) + OP
[1];
2870 addr
= (GPR32 (12)) + addr
;
2872 addr
= (GPR32 (13)) + addr
;
2874 trace_input ("loadb", OP_RP_INDEX_DISP14
, OP_REG
, OP_VOID
);
2876 SET_GPR (OP
[3], (a
| tmp
));
2877 trace_output_16 (sd
, tmp
);
2883 OP_184_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2885 /* loadb DISPE20(REG) REG
2886 * zext24(Rbase) + zext24(dispe20)
2889 uint16_t tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2890 uint32_t addr
= OP
[0] + (GPR (OP
[1]));
2891 trace_input ("loadb", OP_R_BASE_DISPE20
, OP_REG
, OP_VOID
);
2893 SET_GPR (OP
[2], (a
| tmp
));
2894 trace_output_16 (sd
, tmp
);
2899 OP_124_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2901 /* loadb DISP20(REG) REG
2902 * ADDR = zext24(Rbase) + zext24(disp20)
2905 uint16_t tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2906 uint32_t addr
= OP
[0] + (GPR (OP
[1]));
2907 trace_input ("loadb", OP_R_BASE_DISP20
, OP_REG
, OP_VOID
);
2909 SET_GPR (OP
[2], (a
| tmp
));
2910 trace_output_16 (sd
, tmp
);
2915 OP_BF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2917 /* loadb disp16(REGP) REG
2918 * ADDR = RPbase + zext24(disp16)
2921 uint16_t tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2922 uint32_t addr
= (GPR32 (OP
[1])) + OP
[0];
2923 trace_input ("loadb", OP_RP_BASE_DISP16
, OP_REG
, OP_VOID
);
2925 SET_GPR (OP
[2], (a
| tmp
));
2926 trace_output_16 (sd
, tmp
);
2931 OP_125_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2933 /* loadb disp20(REGP) REG
2934 * ADDR = RPbase + zext24(disp20)
2936 uint16_t tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2937 uint32_t addr
= (GPR32 (OP
[1])) + OP
[0];
2938 trace_input ("loadb", OP_RP_BASE_DISP20
, OP_REG
, OP_VOID
);
2940 SET_GPR (OP
[2], (a
| tmp
));
2941 trace_output_16 (sd
, tmp
);
2947 OP_185_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2949 /* loadb -disp20(REGP) REG
2950 * ADDR = RPbase + zext24(-disp20)
2952 uint16_t tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2953 uint32_t addr
= (GPR32 (OP
[1])) + OP
[1];
2954 trace_input ("loadb", OP_RP_BASE_DISPE20
, OP_REG
, OP_VOID
);
2956 SET_GPR (OP
[2], (a
| tmp
));
2957 trace_output_16 (sd
, tmp
);
2962 OP_126_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2964 /* loadb [Rindex]disp20(RPbasexb) REG
2965 * ADDR = RPbasex + Rindex + zext24(disp20)
2969 uint16_t tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2970 trace_input ("loadb", OP_RP_INDEX_DISP20
, OP_REG
, OP_VOID
);
2972 addr
= (GPR32 (OP
[2])) + OP
[1];
2975 addr
= (GPR32 (12)) + addr
;
2977 addr
= (GPR32 (13)) + addr
;
2980 SET_GPR (OP
[3], (a
| tmp
));
2981 trace_output_16 (sd
, tmp
);
2987 OP_89_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2990 * ADDR = zext24(abs20) | remap
2993 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
2994 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
2995 * by the core to 16M-64k to 16M. */
2998 uint32_t addr
= OP
[0];
2999 trace_input ("loadw", OP_ABS20
, OP_REG
, OP_VOID
);
3000 if (addr
> 0xEFFFF) addr
|= 0xF00000;
3002 SET_GPR (OP
[1], tmp
);
3003 trace_output_16 (sd
, tmp
);
3009 OP_12F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3015 uint32_t addr
= OP
[0];
3016 trace_input ("loadw", OP_ABS24
, OP_REG
, OP_VOID
);
3018 SET_GPR (OP
[1], tmp
);
3019 trace_output_16 (sd
, tmp
);
3024 OP_47_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3026 /* loadw [Rindex]ABS20 REG
3027 * ADDR = Rindex + zext24(disp20)
3032 trace_input ("loadw", OP_R_INDEX8_ABS20
, OP_REG
, OP_VOID
);
3035 addr
= (GPR32 (12)) + OP
[1];
3037 addr
= (GPR32 (13)) + OP
[1];
3040 SET_GPR (OP
[2], tmp
);
3041 trace_output_16 (sd
, tmp
);
3047 OP_9_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3049 /* loadw DIPS4(REGP) REGP
3050 * ADDR = RPBASE + zext24(DISP4)
3054 trace_input ("loadw", OP_RP_BASE_DISP4
, OP_REG
, OP_VOID
);
3055 addr
= (GPR32 (OP
[1])) + OP
[0];
3059 a
= (GPR32 (OP
[2])) & 0xffff0000;
3060 SET_GPR32 (OP
[2], (a
| tmp
));
3063 SET_GPR (OP
[2], tmp
);
3065 trace_output_16 (sd
, tmp
);
3071 OP_9E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3073 /* loadw [Rindex]disp0(RPbasex) REG
3074 * ADDR = Rpbasex + Rindex
3079 trace_input ("loadw", OP_RP_INDEX_DISP0
, OP_REG
, OP_VOID
);
3081 addr
= (GPR32 (OP
[2])) + OP
[1];
3084 addr
= (GPR32 (12)) + addr
;
3086 addr
= (GPR32 (13)) + addr
;
3089 SET_GPR (OP
[3], tmp
);
3090 trace_output_16 (sd
, tmp
);
3096 OP_21B_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3098 /* loadw [Rindex]disp14(RPbasex) REG
3099 * ADDR = Rpbasex + Rindex + zext24(disp14)
3104 trace_input ("loadw", OP_RP_INDEX_DISP14
, OP_REG
, OP_VOID
);
3105 addr
= (GPR32 (OP
[2])) + OP
[1];
3108 addr
= (GPR32 (12)) + addr
;
3110 addr
= (GPR32 (13)) + addr
;
3113 SET_GPR (OP
[3], tmp
);
3114 trace_output_16 (sd
, tmp
);
3119 OP_18C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3121 /* loadw dispe20(REG) REGP
3122 * REGP = [DISPE20+[REG]] */
3126 trace_input ("loadw", OP_R_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3127 addr
= OP
[0] + (GPR (OP
[1]));
3131 a
= (GPR32 (OP
[2])) & 0xffff0000;
3132 SET_GPR32 (OP
[2], (a
| tmp
));
3135 SET_GPR (OP
[2], tmp
);
3137 trace_output_16 (sd
, tmp
);
3143 OP_12C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3145 /* loadw DISP20(REG) REGP
3146 * ADDR = zext24(Rbase) + zext24(disp20)
3151 trace_input ("loadw", OP_R_BASE_DISP20
, OP_REGP
, OP_VOID
);
3152 addr
= OP
[0] + (GPR (OP
[1]));
3156 a
= (GPR32 (OP
[2])) & 0xffff0000;
3157 SET_GPR32 (OP
[2], (a
| tmp
));
3160 SET_GPR (OP
[2], tmp
);
3162 trace_output_16 (sd
, tmp
);
3167 OP_9F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3169 /* loadw disp16(REGP) REGP
3170 * ADDR = RPbase + zext24(disp16)
3174 trace_input ("loadw", OP_RP_BASE_DISP16
, OP_REGP
, OP_VOID
);
3175 addr
= (GPR32 (OP
[1])) + OP
[0];
3179 a
= (GPR32 (OP
[2])) & 0xffff0000;
3180 SET_GPR32 (OP
[2], (a
| tmp
));
3183 SET_GPR (OP
[2], tmp
);
3185 trace_output_16 (sd
, tmp
);
3190 OP_12D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3192 /* loadw disp20(REGP) REGP
3193 * ADDR = RPbase + zext24(disp20)
3197 trace_input ("loadw", OP_RP_BASE_DISP20
, OP_REG
, OP_VOID
);
3198 addr
= (GPR32 (OP
[1])) + OP
[0];
3202 a
= (GPR32 (OP
[2])) & 0xffff0000;
3203 SET_GPR32 (OP
[2], (a
| tmp
));
3206 SET_GPR (OP
[2], tmp
);
3208 trace_output_16 (sd
, tmp
);
3213 OP_18D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3215 /* loadw -disp20(REGP) REG
3216 * ADDR = RPbase + zext24(-disp20)
3221 trace_input ("loadw", OP_RP_BASE_DISPE20
, OP_REG
, OP_VOID
);
3222 addr
= (GPR32 (OP
[1])) + OP
[0];
3226 a
= (GPR32 (OP
[2])) & 0xffff0000;
3227 SET_GPR32 (OP
[2], (a
| tmp
));
3230 SET_GPR (OP
[2], tmp
);
3232 trace_output_16 (sd
, tmp
);
3238 OP_12E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3240 /* loadw [Rindex]disp20(RPbasexb) REG
3241 * ADDR = RPbasex + Rindex + zext24(disp20)
3246 trace_input ("loadw", OP_RP_INDEX_DISP20
, OP_REG
, OP_VOID
);
3249 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3251 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3254 SET_GPR (OP
[3], tmp
);
3255 trace_output_16 (sd
, tmp
);
3261 OP_87_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3263 /* loadd ABS20, REGP
3264 * ADDR = zext24(abs20) | remap
3267 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
3268 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
3269 * by the core to 16M-64k to 16M. */
3273 trace_input ("loadd", OP_ABS20
, OP_REGP
, OP_VOID
);
3274 if (addr
> 0xEFFFF) addr
|= 0xF00000;
3276 tmp
= ((tmp
<< 16) & 0xffff)| ((tmp
>> 16) & 0xffff);
3277 SET_GPR32 (OP
[1], tmp
);
3278 trace_output_32 (sd
, tmp
);
3283 OP_12B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3285 /* loadd ABS24, REGP
3289 uint32_t addr
= OP
[0];
3291 trace_input ("loadd", OP_ABS24
, OP_REGP
, OP_VOID
);
3293 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3294 SET_GPR32 (OP
[1],tmp
);
3295 trace_output_32 (sd
, tmp
);
3301 OP_46_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3303 /* loadd [Rindex]ABS20 REGP
3304 * ADDR = Rindex + zext24(disp20)
3308 trace_input ("loadd", OP_R_INDEX8_ABS20
, OP_REGP
, OP_VOID
);
3311 addr
= (GPR32 (12)) + OP
[1];
3313 addr
= (GPR32 (13)) + OP
[1];
3316 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3317 SET_GPR32 (OP
[2], tmp
);
3318 trace_output_32 (sd
, tmp
);
3324 OP_A_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3326 /* loadd dips4(regp) REGP
3327 * ADDR = Rpbase + zext24(disp4)
3330 uint32_t tmp
, addr
= (GPR32 (OP
[1])) + OP
[0];
3331 trace_input ("loadd", OP_RP_BASE_DISP4
, OP_REGP
, OP_VOID
);
3333 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3334 SET_GPR32 (OP
[2], tmp
);
3335 trace_output_32 (sd
, tmp
);
3341 OP_AE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3343 /* loadd [Rindex]disp0(RPbasex) REGP
3344 * ADDR = Rpbasex + Rindex
3348 trace_input ("loadd", OP_RP_INDEX_DISP0
, OP_REGP
, OP_VOID
);
3351 addr
= (GPR32 (12)) + (GPR32 (OP
[2])) + OP
[1];
3353 addr
= (GPR32 (13)) + (GPR32 (OP
[2])) + OP
[1];
3356 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3357 SET_GPR32 (OP
[3], tmp
);
3358 trace_output_32 (sd
, tmp
);
3364 OP_21A_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3366 /* loadd [Rindex]disp14(RPbasex) REGP
3367 * ADDR = Rpbasex + Rindex + zext24(disp14)
3371 trace_input ("loadd", OP_RP_INDEX_DISP14
, OP_REGP
, OP_VOID
);
3374 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3376 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3379 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3380 SET_GPR (OP
[3],tmp
);
3381 trace_output_32 (sd
, tmp
);
3387 OP_188_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3389 /* loadd dispe20(REG) REG
3390 * zext24(Rbase) + zext24(dispe20)
3393 uint32_t tmp
, addr
= OP
[0] + (GPR (OP
[1]));
3394 trace_input ("loadd", OP_R_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3396 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3397 SET_GPR32 (OP
[2], tmp
);
3398 trace_output_32 (sd
, tmp
);
3404 OP_128_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3406 /* loadd DISP20(REG) REG
3407 * ADDR = zext24(Rbase) + zext24(disp20)
3410 uint32_t tmp
, addr
= OP
[0] + (GPR (OP
[1]));
3411 trace_input ("loadd", OP_R_BASE_DISP20
, OP_REGP
, OP_VOID
);
3413 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3414 SET_GPR32 (OP
[2], tmp
);
3415 trace_output_32 (sd
, tmp
);
3420 OP_AF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3422 /* loadd disp16(REGP) REGP
3423 * ADDR = RPbase + zext24(disp16)
3425 uint32_t tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3426 trace_input ("loadd", OP_RP_BASE_DISP16
, OP_REGP
, OP_VOID
);
3428 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3429 SET_GPR32 (OP
[2], tmp
);
3430 trace_output_32 (sd
, tmp
);
3436 OP_129_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3438 /* loadd disp20(REGP) REGP
3439 * ADDR = RPbase + zext24(disp20)
3441 uint32_t tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3442 trace_input ("loadd", OP_RP_BASE_DISP20
, OP_REGP
, OP_VOID
);
3444 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3445 SET_GPR32 (OP
[2], tmp
);
3446 trace_output_32 (sd
, tmp
);
3451 OP_189_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3453 /* loadd -disp20(REGP) REGP
3454 * ADDR = RPbase + zext24(-disp20)
3457 uint32_t tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3458 trace_input ("loadd", OP_RP_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3460 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3461 SET_GPR32 (OP
[2], tmp
);
3462 trace_output_32 (sd
, tmp
);
3467 OP_12A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3469 /* loadd [Rindex]disp20(RPbasexb) REGP
3470 * ADDR = RPbasex + Rindex + zext24(disp20)
3474 trace_input ("loadd", OP_RP_INDEX_DISP20
, OP_REGP
, OP_VOID
);
3477 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3479 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3482 tmp
= ((tmp
<< 16) & 0xffff)| ((tmp
>> 16) & 0xffff);
3483 SET_GPR32 (OP
[3], tmp
);
3484 trace_output_32 (sd
, tmp
);
3490 OP_C8_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3493 * ADDR = zext24(abs20) | remap
3496 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
3497 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
3498 * by the core to 16M-64k to 16M. */
3500 uint8_t a
= ((GPR (OP
[0])) & 0xff);
3501 uint32_t addr
= OP
[1];
3502 trace_input ("storb", OP_REG
, OP_ABS20_OUTPUT
, OP_VOID
);
3504 trace_output_32 (sd
, addr
);
3509 OP_137_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3515 uint8_t a
= ((GPR (OP
[0])) & 0xff);
3516 uint32_t addr
= OP
[1];
3517 trace_input ("storb", OP_REG
, OP_ABS24_OUTPUT
, OP_VOID
);
3519 trace_output_32 (sd
, addr
);
3524 OP_65_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3526 /* storb REG, [Rindex]ABS20
3527 * ADDR = Rindex + zext24(disp20)
3531 uint8_t a
= ((GPR (OP
[0])) & 0xff);
3532 trace_input ("storb", OP_REG
, OP_R_INDEX8_ABS20
, OP_VOID
);
3535 addr
= (GPR32 (12)) + OP
[2];
3537 addr
= (GPR32 (13)) + OP
[2];
3540 trace_output_32 (sd
, addr
);
3545 OP_F_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3547 /* storb REG, DIPS4(REGP)
3548 * ADDR = RPBASE + zext24(DISP4)
3551 uint16_t a
= ((GPR (OP
[0])) & 0xff);
3552 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3553 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPE4
, OP_VOID
);
3555 trace_output_32 (sd
, addr
);
3560 OP_FE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3562 /* storb [Rindex]disp0(RPbasex) REG
3563 * ADDR = Rpbasex + Rindex
3567 uint8_t a
= ((GPR (OP
[0])) & 0xff);
3568 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISP0
, OP_VOID
);
3571 addr
= (GPR32 (12)) + (GPR32 (OP
[3])) + OP
[2];
3573 addr
= (GPR32 (13)) + (GPR32 (OP
[3])) + OP
[2];
3576 trace_output_32 (sd
, addr
);
3581 OP_319_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3583 /* storb REG, [Rindex]disp14(RPbasex)
3584 * ADDR = Rpbasex + Rindex + zext24(disp14)
3587 uint8_t a
= ((GPR (OP
[0])) & 0xff);
3588 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3589 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISP14
, OP_VOID
);
3591 trace_output_32 (sd
, addr
);
3596 OP_194_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3598 /* storb REG, DISPE20(REG)
3599 * zext24(Rbase) + zext24(dispe20)
3602 uint8_t a
= ((GPR (OP
[0])) & 0xff);
3603 uint32_t addr
= OP
[1] + (GPR (OP
[2]));
3604 trace_input ("storb", OP_REG
, OP_R_BASE_DISPE20
, OP_VOID
);
3606 trace_output_32 (sd
, addr
);
3611 OP_134_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3613 /* storb REG, DISP20(REG)
3614 * ADDR = zext24(Rbase) + zext24(disp20)
3617 uint8_t a
= (GPR (OP
[0]) & 0xff);
3618 uint32_t addr
= OP
[1] + (GPR (OP
[2]));
3619 trace_input ("storb", OP_REG
, OP_R_BASE_DISPS20
, OP_VOID
);
3621 trace_output_32 (sd
, addr
);
3626 OP_FF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3628 /* storb REG, disp16(REGP)
3629 * ADDR = RPbase + zext24(disp16)
3632 uint8_t a
= ((GPR (OP
[0])) & 0xff);
3633 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3634 trace_input ("storb", OP_REG
, OP_RP_BASE_DISP16
, OP_VOID
);
3636 trace_output_32 (sd
, addr
);
3641 OP_135_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3643 /* storb REG, disp20(REGP)
3644 * ADDR = RPbase + zext24(disp20)
3647 uint8_t a
= ((GPR (OP
[0])) & 0xff);
3648 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3649 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPS20
, OP_VOID
);
3651 trace_output_32 (sd
, addr
);
3656 OP_195_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3658 /* storb REG, -disp20(REGP)
3659 * ADDR = RPbase + zext24(-disp20)
3662 uint8_t a
= (GPR (OP
[0]) & 0xff);
3663 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3664 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPE20
, OP_VOID
);
3666 trace_output_32 (sd
, addr
);
3671 OP_136_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3673 /* storb REG, [Rindex]disp20(RPbase)
3674 * ADDR = RPbasex + Rindex + zext24(disp20)
3677 uint8_t a
= (GPR (OP
[0])) & 0xff;
3678 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3679 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3681 trace_output_32 (sd
, addr
);
3684 /* STR_IMM instructions. */
3687 OP_81_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3689 uint8_t a
= (OP
[0]) & 0xff;
3690 uint32_t addr
= OP
[1];
3691 trace_input ("storb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
3693 trace_output_32 (sd
, addr
);
3698 OP_123_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3700 uint8_t a
= (OP
[0]) & 0xff;
3701 uint32_t addr
= OP
[1];
3702 trace_input ("storb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
3704 trace_output_32 (sd
, addr
);
3709 OP_42_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3712 uint8_t a
= (OP
[0]) & 0xff;
3713 trace_input ("storb", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
3716 addr
= (GPR32 (12)) + OP
[2];
3718 addr
= (GPR32 (13)) + OP
[2];
3721 trace_output_32 (sd
, addr
);
3726 OP_218_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3728 uint8_t a
= (OP
[0]) & 0xff;
3729 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3730 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISP14
, OP_VOID
);
3732 trace_output_32 (sd
, addr
);
3737 OP_82_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3739 uint8_t a
= (OP
[0]) & 0xff;
3740 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3741 trace_input ("storb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
3743 trace_output_32 (sd
, addr
);
3748 OP_120_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3750 uint8_t a
= (OP
[0]) & 0xff;
3751 uint32_t addr
= (GPR (OP
[2])) + OP
[1];
3752 trace_input ("storb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
3754 trace_output_32 (sd
, addr
);
3759 OP_83_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3761 uint8_t a
= (OP
[0]) & 0xff;
3762 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3763 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
3765 trace_output_32 (sd
, addr
);
3770 OP_121_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3772 uint8_t a
= (OP
[0]) & 0xff;
3773 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3774 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
3776 trace_output_32 (sd
, addr
);
3781 OP_122_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3783 uint8_t a
= (OP
[0]) & 0xff;
3784 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3785 trace_input ("storb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3787 trace_output_32 (sd
, addr
);
3789 /* endif for STR_IMM. */
3793 OP_C9_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3795 uint16_t a
= GPR (OP
[0]);
3796 uint32_t addr
= OP
[1];
3797 trace_input ("storw", OP_REG
, OP_ABS20_OUTPUT
, OP_VOID
);
3799 trace_output_32 (sd
, addr
);
3804 OP_13F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3806 uint16_t a
= GPR (OP
[0]);
3807 uint32_t addr
= OP
[1];
3808 trace_input ("storw", OP_REG
, OP_ABS24_OUTPUT
, OP_VOID
);
3810 trace_output_32 (sd
, addr
);
3815 OP_67_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3818 uint16_t a
= GPR (OP
[0]);
3819 trace_input ("storw", OP_REG
, OP_R_INDEX8_ABS20
, OP_VOID
);
3822 addr
= (GPR32 (12)) + OP
[2];
3824 addr
= (GPR32 (13)) + OP
[2];
3827 trace_output_32 (sd
, addr
);
3833 OP_D_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3835 uint16_t a
= (GPR (OP
[0]));
3836 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3837 trace_input ("storw", OP_REGP
, OP_RP_BASE_DISPE4
, OP_VOID
);
3839 trace_output_32 (sd
, addr
);
3844 OP_DE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3846 uint16_t a
= GPR (OP
[0]);
3847 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3848 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISP0
, OP_VOID
);
3850 trace_output_32 (sd
, addr
);
3855 OP_31B_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3857 uint16_t a
= GPR (OP
[0]);
3858 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3859 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISP14
, OP_VOID
);
3861 trace_output_32 (sd
, addr
);
3866 OP_19C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3868 uint16_t a
= (GPR (OP
[0]));
3869 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3870 trace_input ("storw", OP_REGP
, OP_RP_BASE_DISPE20
, OP_VOID
);
3872 trace_output_32 (sd
, addr
);
3877 OP_13C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3879 uint16_t a
= (GPR (OP
[0]));
3880 uint32_t addr
= (GPR (OP
[2])) + OP
[1];
3881 trace_input ("storw", OP_REG
, OP_R_BASE_DISPS20
, OP_VOID
);
3883 trace_output_32 (sd
, addr
);
3888 OP_DF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3890 uint16_t a
= (GPR (OP
[0]));
3891 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3892 trace_input ("storw", OP_REG
, OP_RP_BASE_DISP16
, OP_VOID
);
3894 trace_output_32 (sd
, addr
);
3899 OP_13D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3901 uint16_t a
= (GPR (OP
[0]));
3902 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3903 trace_input ("storw", OP_REG
, OP_RP_BASE_DISPS20
, OP_VOID
);
3905 trace_output_32 (sd
, addr
);
3910 OP_19D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3912 uint16_t a
= (GPR (OP
[0]));
3913 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3914 trace_input ("storw", OP_REG
, OP_RP_BASE_DISPE20
, OP_VOID
);
3916 trace_output_32 (sd
, addr
);
3921 OP_13E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3923 uint16_t a
= (GPR (OP
[0]));
3924 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3925 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3927 trace_output_32 (sd
, addr
);
3930 /* STORE-w IMM instruction *****/
3933 OP_C1_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3936 uint32_t addr
= OP
[1];
3937 trace_input ("storw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
3939 trace_output_32 (sd
, addr
);
3944 OP_133_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3947 uint32_t addr
= OP
[1];
3948 trace_input ("storw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
3950 trace_output_32 (sd
, addr
);
3955 OP_62_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3959 trace_input ("storw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
3962 addr
= (GPR32 (12)) + OP
[2];
3964 addr
= (GPR32 (13)) + OP
[2];
3967 trace_output_32 (sd
, addr
);
3972 OP_318_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3975 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3976 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISP14
, OP_VOID
);
3978 trace_output_32 (sd
, addr
);
3983 OP_C2_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3986 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3987 trace_input ("storw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
3989 trace_output_32 (sd
, addr
);
3994 OP_130_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3997 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
3998 trace_input ("storw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
4000 trace_output_32 (sd
, addr
);
4005 OP_C3_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4008 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4009 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
4011 trace_output_32 (sd
, addr
);
4017 OP_131_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4020 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4021 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
4023 trace_output_32 (sd
, addr
);
4028 OP_132_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4031 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4032 trace_input ("storw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
4034 trace_output_32 (sd
, addr
);
4040 OP_C7_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4042 uint32_t a
= GPR32 (OP
[0]);
4043 uint32_t addr
= OP
[1];
4044 trace_input ("stord", OP_REGP
, OP_ABS20_OUTPUT
, OP_VOID
);
4046 trace_output_32 (sd
, addr
);
4051 OP_13B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4053 uint32_t a
= GPR32 (OP
[0]);
4054 uint32_t addr
= OP
[1];
4055 trace_input ("stord", OP_REGP
, OP_ABS24_OUTPUT
, OP_VOID
);
4057 trace_output_32 (sd
, addr
);
4062 OP_66_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4064 uint32_t addr
, a
= GPR32 (OP
[0]);
4065 trace_input ("stord", OP_REGP
, OP_R_INDEX8_ABS20
, OP_VOID
);
4068 addr
= (GPR32 (12)) + OP
[2];
4070 addr
= (GPR32 (13)) + OP
[2];
4073 trace_output_32 (sd
, addr
);
4078 OP_E_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
4080 uint32_t a
= GPR32 (OP
[0]);
4081 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4082 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPE4
, OP_VOID
);
4084 trace_output_32 (sd
, addr
);
4089 OP_EE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4091 uint32_t a
= GPR32 (OP
[0]);
4092 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4093 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISP0
, OP_VOID
);
4095 trace_output_32 (sd
, addr
);
4100 OP_31A_A (SIM_DESC sd
, SIM_CPU
*cpu
)
4102 uint32_t a
= GPR32 (OP
[0]);
4103 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4104 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISP14
, OP_VOID
);
4106 trace_output_32 (sd
, addr
);
4111 OP_198_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4113 uint32_t a
= GPR32 (OP
[0]);
4114 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4115 trace_input ("stord", OP_REGP
, OP_R_BASE_DISPE20
, OP_VOID
);
4117 trace_output_32 (sd
, addr
);
4122 OP_138_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4124 uint32_t a
= GPR32 (OP
[0]);
4125 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4126 trace_input ("stord", OP_REGP
, OP_R_BASE_DISPS20
, OP_VOID
);
4128 trace_output_32 (sd
, addr
);
4133 OP_EF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4135 uint32_t a
= GPR32 (OP
[0]);
4136 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4137 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISP16
, OP_VOID
);
4139 trace_output_32 (sd
, addr
);
4144 OP_139_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4146 uint32_t a
= GPR32 (OP
[0]);
4147 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4148 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPS20
, OP_VOID
);
4150 trace_output_32 (sd
, addr
);
4155 OP_199_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4157 uint32_t a
= GPR32 (OP
[0]);
4158 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4159 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPE20
, OP_VOID
);
4161 trace_output_32 (sd
, addr
);
4166 OP_13A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4168 uint32_t a
= GPR32 (OP
[0]);
4169 uint32_t addr
= (GPR32 (OP
[2])) + OP
[1];
4170 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISPS20
, OP_VOID
);
4172 trace_output_32 (sd
, addr
);
4177 OP_14D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4181 trace_input ("macuw", OP_REG
, OP_REG
, OP_REGP
);
4185 /*REVISIT FOR SATURATION and Q FORMAT. */
4186 SET_GPR32 (OP
[2], tmp
);
4187 trace_output_32 (sd
, tmp
);
4192 OP_14E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4195 uint16_t src1
, src2
;
4196 trace_input ("macuw", OP_REG
, OP_REG
, OP_REGP
);
4200 /*REVISIT FOR SATURATION. */
4201 SET_GPR32 (OP
[2], tmp
);
4202 trace_output_32 (sd
, tmp
);
4207 OP_14F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4211 trace_input ("macsw", OP_REG
, OP_REG
, OP_REGP
);
4215 /*REVISIT FOR SATURATION. */
4216 SET_GPR32 (OP
[2], tmp
);
4217 trace_output_32 (sd
, tmp
);
4223 OP_64_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4226 int8_t a
= (OP
[0]) & 0xff;
4227 int8_t b
= (GPR (OP
[1])) & 0xff;
4228 trace_input ("mulb", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
4229 tmp
= (a
* b
) & 0xff;
4230 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4231 trace_output_16 (sd
, tmp
);
4236 OP_64B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4239 int8_t a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4240 trace_input ("mulb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4241 tmp
= (a
* b
) & 0xff;
4242 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4243 trace_output_16 (sd
, tmp
);
4249 OP_65_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4252 int8_t a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4253 trace_input ("mulb", OP_REG
, OP_REG
, OP_VOID
);
4254 tmp
= (a
* b
) & 0xff;
4255 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4256 trace_output_16 (sd
, tmp
);
4262 OP_66_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4266 int16_t b
= (GPR (OP
[1]));
4267 trace_input ("mulw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
4268 tmp
= (a
* b
) & 0xffff;
4269 SET_GPR (OP
[1], tmp
);
4270 trace_output_32 (sd
, tmp
);
4275 OP_66B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4278 int16_t a
= OP
[0], b
= (GPR (OP
[1]));
4279 trace_input ("mulw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4280 tmp
= (a
* b
) & 0xffff;
4281 SET_GPR (OP
[1], tmp
);
4282 trace_output_32 (sd
, tmp
);
4288 OP_67_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4291 int16_t a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4292 trace_input ("mulw", OP_REG
, OP_REG
, OP_VOID
);
4293 tmp
= (a
* b
) & 0xffff;
4294 SET_GPR (OP
[1], tmp
);
4295 trace_output_32 (sd
, tmp
);
4301 OP_B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4304 int8_t a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4305 trace_input ("mulsb", OP_REG
, OP_REG
, OP_VOID
);
4307 SET_GPR (OP
[1], tmp
);
4308 trace_output_32 (sd
, tmp
);
4313 OP_62_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4316 int16_t a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4317 trace_input ("mulsw", OP_REG
, OP_REGP
, OP_VOID
);
4319 SET_GPR32 (OP
[1], tmp
);
4320 trace_output_32 (sd
, tmp
);
4325 OP_63_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4328 uint16_t a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4329 trace_input ("muluw", OP_REG
, OP_REGP
, OP_VOID
);
4331 SET_GPR32 (OP
[1], tmp
);
4332 trace_output_32 (sd
, tmp
);
4338 OP_2C00_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
4340 trace_input ("nop", OP_VOID
, OP_VOID
, OP_VOID
);
4343 ins_type_counters
[ (int)State
.ins_type
]--; /* don't count nops as normal instructions */
4344 switch (State
.ins_type
)
4347 ins_type_counters
[ (int)INS_UNKNOWN
]++;
4351 EXCEPTION (SIM_SIGTRAP
);
4353 trace_output_void (sd
);
4359 OP_24_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4361 uint8_t tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4362 trace_input ("orb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4364 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4365 trace_output_16 (sd
, tmp
);
4370 OP_24B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4372 uint8_t tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4373 trace_input ("orb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4375 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4376 trace_output_16 (sd
, tmp
);
4381 OP_25_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4383 uint8_t tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4384 trace_input ("orb", OP_REG
, OP_REG
, OP_VOID
);
4386 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4387 trace_output_16 (sd
, tmp
);
4392 OP_26_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4394 uint16_t tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
4395 trace_input ("orw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4397 SET_GPR (OP
[1], tmp
);
4398 trace_output_16 (sd
, tmp
);
4404 OP_26B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4406 uint16_t tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
4407 trace_input ("orw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4409 SET_GPR (OP
[1], tmp
);
4410 trace_output_16 (sd
, tmp
);
4415 OP_27_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4417 uint16_t tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4418 trace_input ("orw", OP_REG
, OP_REG
, OP_VOID
);
4420 SET_GPR (OP
[1], tmp
);
4421 trace_output_16 (sd
, tmp
);
4427 OP_13_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
4430 uint16_t tmp
, b
= (GPR (OP
[1])) & 0xFF;
4431 trace_input ("lshb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4432 /* A positive count specifies a shift to the left;
4433 * A negative count specifies a shift to the right. */
4439 sign_flag
= 0; /* Reset sign_flag. */
4441 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4442 trace_output_16 (sd
, tmp
);
4447 OP_44_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4449 uint16_t a
= (GPR (OP
[0])) & 0xff;
4450 uint16_t tmp
, b
= (GPR (OP
[1])) & 0xFF;
4451 trace_input ("lshb", OP_REG
, OP_REG
, OP_VOID
);
4452 if (a
& ((long)1 << 3))
4457 a
= (unsigned int) (a
& 0x7);
4459 /* A positive count specifies a shift to the left;
4460 * A negative count specifies a shift to the right. */
4466 sign_flag
= 0; /* Reset sign_flag. */
4467 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4468 trace_output_16 (sd
, tmp
);
4473 OP_46_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4475 uint16_t tmp
, b
= GPR (OP
[1]);
4476 int16_t a
= GPR (OP
[0]);
4477 trace_input ("lshw", OP_REG
, OP_REG
, OP_VOID
);
4478 if (a
& ((long)1 << 4))
4483 a
= (unsigned int) (a
& 0xf);
4485 /* A positive count specifies a shift to the left;
4486 * A negative count specifies a shift to the right. */
4492 sign_flag
= 0; /* Reset sign_flag. */
4493 SET_GPR (OP
[1], (tmp
& 0xffff));
4494 trace_output_16 (sd
, tmp
);
4499 OP_49_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4501 uint16_t tmp
, b
= GPR (OP
[1]);
4503 trace_input ("lshw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4504 /* A positive count specifies a shift to the left;
4505 * A negative count specifies a shift to the right. */
4511 sign_flag
= 0; /* Reset sign_flag. */
4512 SET_GPR (OP
[1], (tmp
& 0xffff));
4513 trace_output_16 (sd
, tmp
);
4518 OP_25_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4520 uint32_t tmp
, b
= GPR32 (OP
[1]);
4522 trace_input ("lshd", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4523 /* A positive count specifies a shift to the left;
4524 * A negative count specifies a shift to the right. */
4530 sign_flag
= 0; /* Reset sign flag. */
4532 SET_GPR32 (OP
[1], tmp
);
4533 trace_output_32 (sd
, tmp
);
4538 OP_47_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4540 uint32_t tmp
, b
= GPR32 (OP
[1]);
4541 uint16_t a
= GPR (OP
[0]);
4542 trace_input ("lshd", OP_REG
, OP_REGP
, OP_VOID
);
4543 if (a
& ((long)1 << 5))
4548 a
= (unsigned int) (a
& 0x1f);
4549 /* A positive count specifies a shift to the left;
4550 * A negative count specifies a shift to the right. */
4556 sign_flag
= 0; /* Reset sign flag. */
4558 SET_GPR32 (OP
[1], tmp
);
4559 trace_output_32 (sd
, tmp
);
4564 OP_80_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
4567 int8_t tmp
, b
= (GPR (OP
[1])) & 0xFF;
4568 trace_input ("ashub", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4569 /* A positive count specifies a shift to the left;
4570 * A negative count specifies a shift to the right. */
4576 sign_flag
= 0; /* Reset sign flag. */
4578 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xff00)));
4579 trace_output_16 (sd
, tmp
);
4584 OP_81_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
4587 int8_t tmp
, b
= (GPR (OP
[1])) & 0xFF;
4588 trace_input ("ashub", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4589 /* A positive count specifies a shift to the left;
4590 * A negative count specifies a shift to the right. */
4596 sign_flag
= 0; /* Reset sign flag. */
4598 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4599 trace_output_16 (sd
, tmp
);
4605 OP_41_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4607 int16_t a
= (GPR (OP
[0]));
4608 int8_t tmp
, b
= (GPR (OP
[1])) & 0xFF;
4609 trace_input ("ashub", OP_REG
, OP_REG
, OP_VOID
);
4611 if (a
& ((long)1 << 3))
4616 a
= (unsigned int) (a
& 0x7);
4618 /* A positive count specifies a shift to the left;
4619 * A negative count specifies a shift to the right. */
4625 sign_flag
= 0; /* Reset sign flag. */
4627 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4628 trace_output_16 (sd
, tmp
);
4634 OP_42_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4636 int16_t tmp
, b
= GPR (OP
[1]);
4638 trace_input ("ashuw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4639 /* A positive count specifies a shift to the left;
4640 * A negative count specifies a shift to the right. */
4646 sign_flag
= 0; /* Reset sign flag. */
4648 SET_GPR (OP
[1], (tmp
& 0xffff));
4649 trace_output_16 (sd
, tmp
);
4654 OP_43_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4656 int16_t tmp
, b
= GPR (OP
[1]);
4658 trace_input ("ashuw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4659 /* A positive count specifies a shift to the left;
4660 * A negative count specifies a shift to the right. */
4666 sign_flag
= 0; /* Reset sign flag. */
4667 SET_GPR (OP
[1], (tmp
& 0xffff));
4668 trace_output_16 (sd
, tmp
);
4673 OP_45_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4676 int16_t a
= GPR (OP
[0]), b
= GPR (OP
[1]);
4677 trace_input ("ashuw", OP_REG
, OP_REG
, OP_VOID
);
4679 if (a
& ((long)1 << 4))
4684 a
= (unsigned int) (a
& 0xf);
4685 /* A positive count specifies a shift to the left;
4686 * A negative count specifies a shift to the right. */
4693 sign_flag
= 0; /* Reset sign flag. */
4694 SET_GPR (OP
[1], (tmp
& 0xffff));
4695 trace_output_16 (sd
, tmp
);
4700 OP_26_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4702 int32_t tmp
,b
= GPR32 (OP
[1]);
4704 trace_input ("ashud", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4705 /* A positive count specifies a shift to the left;
4706 * A negative count specifies a shift to the right. */
4712 sign_flag
= 0; /* Reset sign flag. */
4713 SET_GPR32 (OP
[1], tmp
);
4714 trace_output_32 (sd
, tmp
);
4719 OP_27_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4722 int32_t a
= OP
[0], b
= GPR32 (OP
[1]);
4723 trace_input ("ashud", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4724 /* A positive count specifies a shift to the left;
4725 * A negative count specifies a shift to the right. */
4731 sign_flag
= 0; /* Reset sign flag. */
4732 SET_GPR32 (OP
[1], tmp
);
4733 trace_output_32 (sd
, tmp
);
4738 OP_48_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4741 int32_t a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
4742 trace_input ("ashud", OP_REGP
, OP_REGP
, OP_VOID
);
4744 if (a
& ((long)1 << 5))
4749 a
= (unsigned int) (a
& 0x1f);
4750 /* A positive count specifies a shift to the left;
4751 * A negative count specifies a shift to the right. */
4757 sign_flag
= 0; /* Reset sign flag. */
4758 SET_GPR32 (OP
[1], tmp
);
4759 trace_output_32 (sd
, tmp
);
4765 OP_16_D (SIM_DESC sd
, SIM_CPU
*cpu
)
4767 uint32_t addr
= GPR (1);
4768 uint16_t count
= OP
[0], reg
= 2;
4769 trace_input ("storm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
4772 trace_output_void (sd
);
4773 EXCEPTION (SIM_SIGBUS
);
4778 SW (addr
, (GPR (reg
)));
4782 if (reg
== 6) reg
= 8;
4787 trace_output_void (sd
);
4793 OP_17_D (SIM_DESC sd
, SIM_CPU
*cpu
)
4795 uint32_t addr
= GPR32 (6);
4796 uint16_t count
= OP
[0], reg
= 2;
4797 trace_input ("stormp", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
4800 trace_output_void (sd
);
4801 EXCEPTION (SIM_SIGBUS
);
4806 SW (addr
, (GPR (reg
)));
4810 if (reg
== 6) reg
= 8;
4813 SET_GPR32 (6, addr
);
4814 trace_output_void (sd
);
4819 OP_38_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4822 uint8_t b
= (GPR (OP
[1])) & 0xff;
4823 uint16_t tmp
= (~a
+ 1 + b
) & 0xff;
4824 trace_input ("subb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4825 /* see ../common/sim-alu.h for a more extensive discussion on how to
4826 compute the carry/overflow bits. */
4827 SET_PSR_C (tmp
> 0xff);
4828 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4829 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4830 trace_output_16 (sd
, tmp
);
4835 OP_38B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4837 uint8_t a
= OP
[0] & 0xFF;
4838 uint8_t b
= (GPR (OP
[1])) & 0xFF;
4839 uint16_t tmp
= (~a
+ 1 + b
) & 0xFF;
4840 trace_input ("subb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4841 /* see ../common/sim-alu.h for a more extensive discussion on how to
4842 compute the carry/overflow bits. */
4843 SET_PSR_C (tmp
> 0xff);
4844 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4845 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4846 trace_output_16 (sd
, tmp
);
4851 OP_39_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4853 uint8_t a
= (GPR (OP
[0])) & 0xFF;
4854 uint8_t b
= (GPR (OP
[1])) & 0xFF;
4855 uint16_t tmp
= (~a
+ 1 + b
) & 0xff;
4856 trace_input ("subb", OP_REG
, OP_REG
, OP_VOID
);
4857 /* see ../common/sim-alu.h for a more extensive discussion on how to
4858 compute the carry/overflow bits. */
4859 SET_PSR_C (tmp
> 0xff);
4860 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4861 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4862 trace_output_16 (sd
, tmp
);
4867 OP_3A_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4870 uint16_t b
= GPR (OP
[1]);
4871 uint16_t tmp
= (~a
+ 1 + b
);
4872 trace_input ("subw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4873 /* see ../common/sim-alu.h for a more extensive discussion on how to
4874 compute the carry/overflow bits. */
4875 SET_PSR_C (tmp
> 0xffff);
4876 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4877 SET_GPR (OP
[1], tmp
);
4878 trace_output_16 (sd
, tmp
);
4883 OP_3AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4886 uint16_t b
= GPR (OP
[1]);
4887 uint32_t tmp
= (~a
+ 1 + b
);
4888 trace_input ("subw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4889 /* see ../common/sim-alu.h for a more extensive discussion on how to
4890 compute the carry/overflow bits. */
4891 SET_PSR_C (tmp
> 0xffff);
4892 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4893 SET_GPR (OP
[1], tmp
& 0xffff);
4894 trace_output_16 (sd
, tmp
);
4899 OP_3B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4901 uint16_t a
= GPR (OP
[0]);
4902 uint16_t b
= GPR (OP
[1]);
4903 uint32_t tmp
= (~a
+ 1 + b
);
4904 trace_input ("subw", OP_REG
, OP_REG
, OP_VOID
);
4905 /* see ../common/sim-alu.h for a more extensive discussion on how to
4906 compute the carry/overflow bits. */
4907 SET_PSR_C (tmp
> 0xffff);
4908 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4909 SET_GPR (OP
[1], tmp
& 0xffff);
4910 trace_output_16 (sd
, tmp
);
4915 OP_3C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4918 uint8_t b
= (GPR (OP
[1])) & 0xff;
4919 //uint16_t tmp1 = a + 1;
4920 uint16_t tmp1
= a
+ (PSR_C
);
4921 uint16_t tmp
= (~tmp1
+ 1 + b
);
4922 trace_input ("subcb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4923 /* see ../common/sim-alu.h for a more extensive discussion on how to
4924 compute the carry/overflow bits. */
4925 SET_PSR_C (tmp
> 0xff);
4926 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4927 SET_GPR (OP
[1], tmp
);
4928 trace_output_16 (sd
, tmp
);
4933 OP_3CB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4936 uint16_t b
= (GPR (OP
[1])) & 0xff;
4937 //uint16_t tmp1 = a + 1;
4938 uint16_t tmp1
= a
+ (PSR_C
);
4939 uint16_t tmp
= (~tmp1
+ 1 + b
);
4940 trace_input ("subcb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4941 /* see ../common/sim-alu.h for a more extensive discussion on how to
4942 compute the carry/overflow bits. */
4943 SET_PSR_C (tmp
> 0xff);
4944 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4945 SET_GPR (OP
[1], tmp
);
4946 trace_output_16 (sd
, tmp
);
4951 OP_3D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4953 uint16_t a
= (GPR (OP
[0])) & 0xff;
4954 uint16_t b
= (GPR (OP
[1])) & 0xff;
4955 uint16_t tmp1
= a
+ (PSR_C
);
4956 uint16_t tmp
= (~tmp1
+ 1 + b
);
4957 trace_input ("subcb", OP_REG
, OP_REG
, OP_VOID
);
4958 /* see ../common/sim-alu.h for a more extensive discussion on how to
4959 compute the carry/overflow bits. */
4960 SET_PSR_C (tmp
> 0xff);
4961 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4962 SET_GPR (OP
[1], tmp
);
4963 trace_output_16 (sd
, tmp
);
4968 OP_3E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4970 uint16_t a
= OP
[0], b
= (GPR (OP
[1]));
4971 uint16_t tmp1
= a
+ (PSR_C
);
4972 uint16_t tmp
= (~tmp1
+ 1 + b
);
4973 trace_input ("subcw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4974 /* see ../common/sim-alu.h for a more extensive discussion on how to
4975 compute the carry/overflow bits. */
4976 SET_PSR_C (tmp
> 0xffff);
4977 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4978 SET_GPR (OP
[1], tmp
);
4979 trace_output_16 (sd
, tmp
);
4984 OP_3EB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4987 uint16_t b
= GPR (OP
[1]);
4988 uint16_t tmp1
= a
+ (PSR_C
);
4989 uint16_t tmp
= (~tmp1
+ 1 + b
);
4990 trace_input ("subcw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4991 /* see ../common/sim-alu.h for a more extensive discussion on how to
4992 compute the carry/overflow bits. */
4993 SET_PSR_C (tmp
> 0xffff);
4994 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4995 SET_GPR (OP
[1], tmp
);
4996 trace_output_16 (sd
, tmp
);
5001 OP_3F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5003 uint16_t a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
5004 uint16_t tmp1
= a
+ (PSR_C
);
5005 uint16_t tmp
= (~tmp1
+ 1 + b
);
5006 trace_input ("subcw", OP_REG
, OP_REG
, OP_VOID
);
5007 /* see ../common/sim-alu.h for a more extensive discussion on how to
5008 compute the carry/overflow bits. */
5009 SET_PSR_C (tmp
> 0xffff);
5010 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
5011 SET_GPR (OP
[1], tmp
);
5012 trace_output_16 (sd
, tmp
);
5017 OP_3_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5020 uint32_t b
= GPR32 (OP
[1]);
5021 uint32_t tmp
= (~a
+ 1 + b
);
5022 trace_input ("subd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
5023 /* see ../common/sim-alu.h for a more extensive discussion on how to
5024 compute the carry/overflow bits. */
5025 SET_PSR_C (tmp
> 0xffffffff);
5026 SET_PSR_F (((a
& 0x80000000) != (b
& 0x80000000)) &&
5027 ((b
& 0x80000000) != (tmp
& 0x80000000)));
5028 SET_GPR32 (OP
[1], tmp
);
5029 trace_output_32 (sd
, tmp
);
5034 OP_14C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5036 uint32_t a
= GPR32 (OP
[0]);
5037 uint32_t b
= GPR32 (OP
[1]);
5038 uint32_t tmp
= (~a
+ 1 + b
);
5039 trace_input ("subd", OP_REGP
, OP_REGP
, OP_VOID
);
5040 /* see ../common/sim-alu.h for a more extensive discussion on how to
5041 compute the carry/overflow bits. */
5042 SET_PSR_C (tmp
> 0xffffffff);
5043 SET_PSR_F (((a
& 0x80000000) != (b
& 0x80000000)) &&
5044 ((b
& 0x80000000) != (tmp
& 0x80000000)));
5045 SET_GPR32 (OP
[1], tmp
);
5046 trace_output_32 (sd
, tmp
);
5051 OP_C_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5053 host_callback
*cb
= STATE_CALLBACK (sd
);
5056 trace_input ("excp", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
5060 #if (DEBUG & DEBUG_TRAP) == 0
5063 uint16_t vec
= OP
[0] + TRAP_VECTOR_START
;
5066 SET_PSR (PSR
& PSR_SM_BIT
);
5071 #else /* if debugging use trap to print registers */
5074 static int first_time
= 1;
5079 sim_io_printf (sd
, "Trap # PC ");
5080 for (i
= 0; i
< 16; i
++)
5081 sim_io_printf (sd
, " %sr%d", (i
> 9) ? "" : " ", i
);
5082 sim_io_printf (sd
, " a0 a1 f0 f1 c\n");
5085 sim_io_printf (sd
, "Trap %2d 0x%.4x:", (int)OP
[0], (int)PC
);
5087 for (i
= 0; i
< 16; i
++)
5088 sim_io_printf (sd
, " %.4x", (int) GPR (i
));
5090 for (i
= 0; i
< 2; i
++)
5091 sim_io_printf (sd
, " %.2x%.8lx",
5092 ((int)(ACC (i
) >> 32) & 0xff),
5093 ((unsigned long) ACC (i
)) & 0xffffffff);
5095 sim_io_printf (sd
, " %d %d %d\n",
5096 PSR_F
!= 0, PSR_F
!= 0, PSR_C
!= 0);
5097 sim_io_flush_stdout (sd
);
5101 case 8: /* new system call trap */
5102 /* Trap 8 is used for simulating low-level I/O */
5104 uint32_t result
= 0;
5107 /* Registers passed to trap 0. */
5109 #define FUNC GPR (0) /* function number. */
5110 #define PARM1 GPR (2) /* optional parm 1. */
5111 #define PARM2 GPR (3) /* optional parm 2. */
5112 #define PARM3 GPR (4) /* optional parm 3. */
5113 #define PARM4 GPR (5) /* optional parm 4. */
5115 /* Registers set by trap 0 */
5117 #define RETVAL(X) do { result = (0xffff & (X));SET_GPR (0, result);} while (0)
5118 #define RETVAL32(X) do { result = (X); SET_GPR32 (0, result);} while (0)
5119 #define RETERR(X) SET_GPR (4, (X)) /* return error code. */
5121 /* Turn a pointer in a register into a pointer into real memory. */
5123 #define MEMPTR(x) sim_core_trans_addr (sd, cpu, read_map, x)
5127 #if !defined(__GO32__) && !defined(_WIN32)
5128 case TARGET_NEWLIB_CR16_SYS_fork
:
5129 trace_input ("<fork>", OP_VOID
, OP_VOID
, OP_VOID
);
5131 trace_output_16 (sd
, result
);
5135 case TARGET_NEWLIB_CR16_SYS_getpid
:
5136 trace_input ("<getpid>", OP_VOID
, OP_VOID
, OP_VOID
);
5138 trace_output_16 (sd
, result
);
5141 case TARGET_NEWLIB_CR16_SYS_kill
:
5142 trace_input ("<kill>", OP_REG
, OP_REG
, OP_VOID
);
5143 if (PARM1
== getpid ())
5145 trace_output_void (sd
);
5154 case 1: os_sig
= SIGHUP
; break;
5157 case 2: os_sig
= SIGINT
; break;
5160 case 3: os_sig
= SIGQUIT
; break;
5163 case 4: os_sig
= SIGILL
; break;
5166 case 5: os_sig
= SIGTRAP
; break;
5169 case 6: os_sig
= SIGABRT
; break;
5170 #elif defined(SIGIOT)
5171 case 6: os_sig
= SIGIOT
; break;
5174 case 7: os_sig
= SIGEMT
; break;
5177 case 8: os_sig
= SIGFPE
; break;
5180 case 9: os_sig
= SIGKILL
; break;
5183 case 10: os_sig
= SIGBUS
; break;
5186 case 11: os_sig
= SIGSEGV
; break;
5189 case 12: os_sig
= SIGSYS
; break;
5192 case 13: os_sig
= SIGPIPE
; break;
5195 case 14: os_sig
= SIGALRM
; break;
5198 case 15: os_sig
= SIGTERM
; break;
5201 case 16: os_sig
= SIGURG
; break;
5204 case 17: os_sig
= SIGSTOP
; break;
5207 case 18: os_sig
= SIGTSTP
; break;
5210 case 19: os_sig
= SIGCONT
; break;
5213 case 20: os_sig
= SIGCHLD
; break;
5214 #elif defined(SIGCLD)
5215 case 20: os_sig
= SIGCLD
; break;
5218 case 21: os_sig
= SIGTTIN
; break;
5221 case 22: os_sig
= SIGTTOU
; break;
5224 case 23: os_sig
= SIGIO
; break;
5225 #elif defined (SIGPOLL)
5226 case 23: os_sig
= SIGPOLL
; break;
5229 case 24: os_sig
= SIGXCPU
; break;
5232 case 25: os_sig
= SIGXFSZ
; break;
5235 case 26: os_sig
= SIGVTALRM
; break;
5238 case 27: os_sig
= SIGPROF
; break;
5241 case 28: os_sig
= SIGWINCH
; break;
5244 case 29: os_sig
= SIGLOST
; break;
5247 case 30: os_sig
= SIGUSR1
; break;
5250 case 31: os_sig
= SIGUSR2
; break;
5256 trace_output_void (sd
);
5257 sim_io_printf (sd
, "Unknown signal %d\n", PARM2
);
5258 sim_io_flush_stdout (sd
);
5259 EXCEPTION (SIM_SIGILL
);
5263 RETVAL (kill (PARM1
, PARM2
));
5264 trace_output_16 (sd
, result
);
5269 case TARGET_NEWLIB_CR16_SYS_execve
:
5270 trace_input ("<execve>", OP_VOID
, OP_VOID
, OP_VOID
);
5271 RETVAL (execve (MEMPTR (PARM1
), (char **) MEMPTR (PARM2
<<16|PARM3
),
5272 (char **)MEMPTR (PARM4
)));
5273 trace_output_16 (sd
, result
);
5276 case TARGET_NEWLIB_CR16_SYS_execv
:
5277 trace_input ("<execv>", OP_VOID
, OP_VOID
, OP_VOID
);
5278 RETVAL (execve (MEMPTR (PARM1
), (char **) MEMPTR (PARM2
), NULL
));
5279 trace_output_16 (sd
, result
);
5282 case TARGET_NEWLIB_CR16_SYS_pipe
:
5287 trace_input ("<pipe>", OP_VOID
, OP_VOID
, OP_VOID
);
5289 RETVAL (pipe (host_fd
));
5290 SW (buf
, host_fd
[0]);
5291 buf
+= sizeof(uint16_t);
5292 SW (buf
, host_fd
[1]);
5293 trace_output_16 (sd
, result
);
5297 case TARGET_NEWLIB_CR16_SYS_wait
:
5300 trace_input ("<wait>", OP_REG
, OP_VOID
, OP_VOID
);
5301 RETVAL (wait (&status
));
5304 trace_output_16 (sd
, result
);
5308 case TARGET_NEWLIB_CR16_SYS_getpid
:
5309 trace_input ("<getpid>", OP_VOID
, OP_VOID
, OP_VOID
);
5311 trace_output_16 (sd
, result
);
5314 case TARGET_NEWLIB_CR16_SYS_kill
:
5315 trace_input ("<kill>", OP_REG
, OP_REG
, OP_VOID
);
5316 trace_output_void (sd
);
5321 case TARGET_NEWLIB_CR16_SYS_read
:
5322 trace_input ("<read>", OP_REG
, OP_MEMREF
, OP_REG
);
5323 RETVAL (cb
->read (cb
, PARM1
,
5324 MEMPTR (((unsigned long)PARM3
<< 16)
5325 | ((unsigned long)PARM2
)), PARM4
));
5326 trace_output_16 (sd
, result
);
5329 case TARGET_NEWLIB_CR16_SYS_write
:
5330 trace_input ("<write>", OP_REG
, OP_MEMREF
, OP_REG
);
5331 RETVAL ((int)cb
->write (cb
, PARM1
,
5332 MEMPTR (((unsigned long)PARM3
<< 16)
5334 trace_output_16 (sd
, result
);
5337 case TARGET_NEWLIB_CR16_SYS_lseek
:
5338 trace_input ("<lseek>", OP_REG
, OP_REGP
, OP_REG
);
5339 RETVAL32 (cb
->lseek (cb
, PARM1
, ((((long) PARM3
) << 16) | PARM2
),
5341 trace_output_32 (sd
, result
);
5344 case TARGET_NEWLIB_CR16_SYS_close
:
5345 trace_input ("<close>", OP_REG
, OP_VOID
, OP_VOID
);
5346 RETVAL (cb
->close (cb
, PARM1
));
5347 trace_output_16 (sd
, result
);
5350 case TARGET_NEWLIB_CR16_SYS_open
:
5351 trace_input ("<open>", OP_MEMREF
, OP_REG
, OP_VOID
);
5352 RETVAL32 (cb
->open (cb
, MEMPTR ((((unsigned long)PARM2
) << 16)
5354 trace_output_32 (sd
, result
);
5357 case TARGET_NEWLIB_CR16_SYS_rename
:
5358 trace_input ("<rename>", OP_MEMREF
, OP_MEMREF
, OP_VOID
);
5359 RETVAL (cb
->rename (cb
, MEMPTR ((((unsigned long)PARM2
) << 16) | PARM1
),
5360 MEMPTR ((((unsigned long)PARM4
) << 16) | PARM3
)));
5361 trace_output_16 (sd
, result
);
5364 case 0x408: /* REVISIT: Added a dummy getenv call. */
5365 trace_input ("<getenv>", OP_MEMREF
, OP_MEMREF
, OP_VOID
);
5367 trace_output_32 (sd
, result
);
5370 case TARGET_NEWLIB_CR16_SYS_exit
:
5371 trace_input ("<exit>", OP_VOID
, OP_VOID
, OP_VOID
);
5372 trace_output_void (sd
);
5373 sim_engine_halt (sd
, cpu
, NULL
, PC
, sim_exited
, GPR (2));
5376 case TARGET_NEWLIB_CR16_SYS_unlink
:
5377 trace_input ("<unlink>", OP_MEMREF
, OP_VOID
, OP_VOID
);
5378 RETVAL (cb
->unlink (cb
, MEMPTR (((unsigned long)PARM2
<< 16) | PARM1
)));
5379 trace_output_16 (sd
, result
);
5382 case TARGET_NEWLIB_CR16_SYS_stat
:
5383 trace_input ("<stat>", OP_VOID
, OP_VOID
, OP_VOID
);
5384 /* stat system call. */
5386 struct stat host_stat
;
5389 RETVAL (stat (MEMPTR ((((unsigned long)PARM2
) << 16)|PARM1
), &host_stat
));
5393 /* The hard-coded offsets and sizes were determined by using
5394 * the CR16 compiler on a test program that used struct stat.
5396 SW (buf
, host_stat
.st_dev
);
5397 SW (buf
+2, host_stat
.st_ino
);
5398 SW (buf
+4, host_stat
.st_mode
);
5399 SW (buf
+6, host_stat
.st_nlink
);
5400 SW (buf
+8, host_stat
.st_uid
);
5401 SW (buf
+10, host_stat
.st_gid
);
5402 SW (buf
+12, host_stat
.st_rdev
);
5403 SLW (buf
+16, host_stat
.st_size
);
5404 SLW (buf
+20, host_stat
.st_atime
);
5405 SLW (buf
+28, host_stat
.st_mtime
);
5406 SLW (buf
+36, host_stat
.st_ctime
);
5408 trace_output_16 (sd
, result
);
5411 case TARGET_NEWLIB_CR16_SYS_chown
:
5412 trace_input ("<chown>", OP_VOID
, OP_VOID
, OP_VOID
);
5413 RETVAL (chown (MEMPTR (PARM1
), PARM2
, PARM3
));
5414 trace_output_16 (sd
, result
);
5417 case TARGET_NEWLIB_CR16_SYS_chmod
:
5418 trace_input ("<chmod>", OP_VOID
, OP_VOID
, OP_VOID
);
5419 RETVAL (chmod (MEMPTR (PARM1
), PARM2
));
5420 trace_output_16 (sd
, result
);
5423 case TARGET_NEWLIB_CR16_SYS_utime
:
5424 trace_input ("<utime>", OP_REG
, OP_REG
, OP_REG
);
5425 /* Cast the second argument to void *, to avoid type mismatch
5426 if a prototype is present. */
5427 RETVAL (utime (MEMPTR (PARM1
), (void *) MEMPTR (PARM2
)));
5428 trace_output_16 (sd
, result
);
5431 case TARGET_NEWLIB_CR16_SYS_time
:
5432 trace_input ("<time>", OP_VOID
, OP_VOID
, OP_REG
);
5433 RETVAL32 (time (NULL
));
5434 trace_output_32 (sd
, result
);
5441 case TRAP_BREAKPOINT
:
5444 trace_output_void (sd
);
5445 EXCEPTION (SIM_SIGTRAP
);
5447 case SIGTRAP
: /* supervisor call ? */
5448 trace_output_void (sd
);
5449 sim_engine_halt (sd
, cpu
, NULL
, PC
, sim_exited
, GPR (2));
5452 cb
->error (cb
, "Unknown syscall %d", FUNC
);
5456 if ((uint16_t) result
== (uint16_t) -1)
5457 RETERR (cb
->get_errno (cb
));
5468 OP_3_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
5470 uint16_t a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5471 uint32_t tmp
, sp_addr
= (GPR32 (15)) - (a
* 2) - 4, is_regp
= 0;
5472 trace_input ("push", OP_CONSTANT3
, OP_REG
, OP_REG
);
5478 SW (sp_addr
, (GPR (b
+i
)));
5484 tmp
= (GPR32 (b
+i
));
5486 tmp
= (GPR32 (b
+i
-1));
5505 /* Store RA address. */
5509 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5510 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5512 trace_output_void (sd
);
5517 OP_1_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5519 uint32_t sp_addr
, tmp
, is_regp
= 0;
5520 uint16_t a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5521 trace_input ("push", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5524 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5526 sp_addr
= (GPR32 (15)) - (a
* 2);
5532 SW (sp_addr
, (GPR (b
+i
)));
5538 tmp
= (GPR32 (b
+i
));
5540 tmp
= (GPR32 (b
+i
-1));
5559 /* Store RA address. */
5562 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5565 sp_addr
= (GPR32 (15)) - (a
* 2);
5567 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5569 trace_output_void (sd
);
5575 OP_11E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5577 uint32_t sp_addr
= (GPR32 (15)), tmp
;
5578 trace_input ("push", OP_VOID
, OP_VOID
, OP_VOID
);
5580 SLW(sp_addr
-4,tmp
); /* Store RA address. */
5581 SET_GPR32 (15, (sp_addr
- 4)); /* Update SP address. */
5582 trace_output_void (sd
);
5588 OP_5_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
5590 uint16_t a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5591 uint32_t tmp
, sp_addr
= (GPR32 (15)), is_regp
= 0;;
5592 trace_input ("pop", OP_CONSTANT3
, OP_REG
, OP_REG
);
5598 SET_GPR ((b
+i
), RW(sp_addr
));
5614 tmp
= (tmp
<< 16) | (GPR32 (b
+i
));
5616 tmp
= (tmp
<< 16) | (GPR32 (b
+i
-1));
5620 SET_GPR32 ((b
+i
), (((tmp
& 0xffff) << 16)
5621 | ((tmp
>> 16) & 0xffff)));
5623 SET_GPR32 ((b
+i
-1), (((tmp
& 0xffff) << 16)
5624 | ((tmp
>> 16) & 0xffff)));
5631 tmp
= RLW(sp_addr
); /* store RA also. */
5632 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5634 SET_GPR32 (15, (sp_addr
+ 4)); /* Update SP address. */
5636 trace_output_void (sd
);
5641 OP_2_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5643 uint16_t a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5644 uint32_t tmp
, sp_addr
= (GPR32 (15)), is_regp
= 0;
5645 trace_input ("pop", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5651 SET_GPR ((b
+i
), RW(sp_addr
));
5667 tmp
= ((tmp
<< 16) & 0xffffffff) | (GPR32 (b
+i
));
5669 tmp
= ((tmp
<< 16) & 0xffffffff) | (GPR32 (b
+i
-1));
5673 SET_GPR32 ((b
+i
), (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5675 SET_GPR32 ((b
+i
-1), (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5683 tmp
= RLW(sp_addr
); /* Store RA Reg. */
5684 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5688 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5690 trace_output_void (sd
);
5695 OP_21E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5697 uint32_t sp_addr
= GPR32 (15);
5699 trace_input ("pop", OP_VOID
, OP_VOID
, OP_VOID
);
5702 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5703 SET_GPR32 (15, (sp_addr
+4)); /* Update SP address. */
5705 trace_output_void (sd
);
5710 OP_7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
5712 uint16_t a
= OP
[0], b
= OP
[1];
5713 trace_input ("popret", OP_CONSTANT3
, OP_REG
, OP_REG
);
5715 JMP(((GPR32(14)) << 1) & 0xffffff);
5717 trace_output_void (sd
);
5722 OP_3_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5724 uint16_t a
= OP
[0], b
= OP
[1];
5725 trace_input ("popret", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5727 JMP(((GPR32(14)) << 1) & 0xffffff);
5729 trace_output_void (sd
);
5734 OP_31E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5737 trace_input ("popret", OP_VOID
, OP_VOID
, OP_VOID
);
5738 OP_21E_10 (sd
, cpu
);
5739 tmp
= (((GPR32(14)) << 1) & 0xffffff);
5740 /* If the resulting PC value is less than 0x00_0000 or greater
5741 than 0xFF_FFFF, this instruction causes an IAD trap.*/
5743 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
5745 trace_output_void (sd
);
5746 EXCEPTION (SIM_SIGBUS
);
5751 trace_output_32 (sd
, tmp
);
5757 OP_A_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5759 trace_input ("cinv[i]", OP_VOID
, OP_VOID
, OP_VOID
);
5761 trace_output_void (sd
);
5766 OP_B_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5768 trace_input ("cinv[i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5770 trace_output_void (sd
);
5775 OP_C_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5777 trace_input ("cinv[d]", OP_VOID
, OP_VOID
, OP_VOID
);
5779 trace_output_void (sd
);
5784 OP_D_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5786 trace_input ("cinv[i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5788 trace_output_void (sd
);
5793 OP_E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5795 trace_input ("cinv[d,i]", OP_VOID
, OP_VOID
, OP_VOID
);
5797 trace_output_void (sd
);
5802 OP_F_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5804 trace_input ("cinv[d,i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5806 trace_output_void (sd
);
5811 OP_3_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5813 trace_input ("retx", OP_VOID
, OP_VOID
, OP_VOID
);
5815 trace_output_void (sd
);
5820 OP_4_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5822 trace_input ("di", OP_VOID
, OP_VOID
, OP_VOID
);
5824 trace_output_void (sd
);
5829 OP_5_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5831 trace_input ("ei", OP_VOID
, OP_VOID
, OP_VOID
);
5833 trace_output_void (sd
);
5838 OP_6_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5840 trace_input ("wait", OP_VOID
, OP_VOID
, OP_VOID
);
5841 trace_output_void (sd
);
5842 EXCEPTION (SIM_SIGTRAP
);
5847 OP_7_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5849 trace_input ("ewait", OP_VOID
, OP_VOID
, OP_VOID
);
5851 trace_output_void (sd
);
5856 OP_28_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5858 uint8_t tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5859 trace_input ("xorb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
5861 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5862 trace_output_16 (sd
, tmp
);
5867 OP_28B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5869 uint8_t tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5870 trace_input ("xorb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
5872 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5873 trace_output_16 (sd
, tmp
);
5878 OP_29_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5880 uint8_t tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5881 trace_input ("xorb", OP_REG
, OP_REG
, OP_VOID
);
5883 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5884 trace_output_16 (sd
, tmp
);
5889 OP_2A_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5891 uint16_t tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
5892 trace_input ("xorw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
5894 SET_GPR (OP
[1], tmp
);
5895 trace_output_16 (sd
, tmp
);
5900 OP_2AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5902 uint16_t tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
5903 trace_input ("xorw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
5905 SET_GPR (OP
[1], tmp
);
5906 trace_output_16 (sd
, tmp
);
5911 OP_2B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5913 uint16_t tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
5914 trace_input ("xorw", OP_REG
, OP_REG
, OP_VOID
);
5916 SET_GPR (OP
[1], tmp
);
5917 trace_output_16 (sd
, tmp
);
5920 /*REVISIT FOR LPR/SPR . */
5924 OP_140_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5926 uint16_t a
= GPR (OP
[0]);
5927 trace_input ("lpr", OP_REG
, OP_REG
, OP_VOID
);
5928 SET_CREG (OP
[1], a
);
5929 trace_output_16 (sd
, a
);
5934 OP_141_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5936 uint32_t a
= GPR32 (OP
[0]);
5937 trace_input ("lprd", OP_REGP
, OP_REG
, OP_VOID
);
5938 SET_CREG (OP
[1], a
);
5939 trace_output_flag (sd
);
5944 OP_142_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5946 uint16_t a
= CREG (OP
[0]);
5947 trace_input ("spr", OP_REG
, OP_REG
, OP_VOID
);
5949 trace_output_16 (sd
, a
);
5954 OP_143_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5956 uint32_t a
= CREG (OP
[0]);
5957 trace_input ("sprd", OP_REGP
, OP_REGP
, OP_VOID
);
5958 SET_GPR32 (OP
[1], a
);
5959 trace_output_32 (sd
, a
);
5964 OP_0_20 (SIM_DESC sd
, SIM_CPU
*cpu
)
5966 trace_input ("null", OP_VOID
, OP_VOID
, OP_VOID
);
5967 sim_engine_halt (sd
, cpu
, NULL
, PC
, sim_exited
, 0);