1 /* Simulation code for the CR16 processor.
2 Copyright (C) 2008-2018 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/>. */
25 #include <sys/types.h>
36 #ifdef HAVE_SYS_TIME_H
42 #include "targ-vals.h"
44 #ifdef TARGET_SYS_utime
47 #ifdef TARGET_SYS_wait
51 #define EXCEPTION(sig) sim_engine_halt (sd, cpu, NULL, PC, sim_stopped, sig)
112 PSR_MASK
= (PSR_I_BIT
122 /* The following bits in the PSR _can't_ be set by instructions such
124 PSR_HW_MASK
= (PSR_MASK
)
127 /* cond Code Condition True State
128 * EQ Equal Z flag is 1
129 * NE Not Equal Z flag is 0
130 * CS Carry Set C flag is 1
131 * CC Carry Clear C flag is 0
132 * HI Higher L flag is 1
133 * LS Lower or Same L flag is 0
134 * GT Greater Than N flag is 1
135 * LE Less Than or Equal To N flag is 0
136 * FS Flag Set F flag is 1
137 * FC Flag Clear F flag is 0
138 * LO Lower Z and L flags are 0
139 * HS Higher or Same Z or L flag is 1
140 * LT Less Than Z and N flags are 0
141 * GE Greater Than or Equal To Z or N flag is 1. */
143 static int cond_stat(int cc
)
147 case 0: return PSR_Z
; break;
148 case 1: return !PSR_Z
; break;
149 case 2: return PSR_C
; break;
150 case 3: return !PSR_C
; break;
151 case 4: return PSR_L
; break;
152 case 5: return !PSR_L
; break;
153 case 6: return PSR_N
; break;
154 case 7: return !PSR_N
; break;
155 case 8: return PSR_F
; break;
156 case 9: return !PSR_F
; break;
157 case 10: return !PSR_Z
&& !PSR_L
; break;
158 case 11: return PSR_Z
|| PSR_L
; break;
159 case 12: return !PSR_Z
&& !PSR_N
; break;
160 case 13: return PSR_Z
|| PSR_N
; break;
161 case 14: return 1; break; /*ALWAYS. */
163 // case NEVER: return false; break;
165 //panic("Shouldn't have NO_COND_CODE in an actual instruction!");
173 move_to_cr (SIM_DESC sd
, SIM_CPU
*cpu
, int cr
, creg_t mask
, creg_t val
, int psw_hw_p
)
175 /* A MASK bit is set when the corresponding bit in the CR should
177 /* This assumes that (VAL & MASK) == 0. */
188 "ERROR at PC 0x%x: ST can only be set when FX is set.\n", PC
);
189 EXCEPTION (SIM_SIGILL
);
191 /* keep an up-to-date psw around for tracing. */
192 State
.trace
.psw
= (State
.trace
.psw
& mask
) | val
;
197 /* only issue an update if the register is being changed. */
198 if ((State
.cregs
[cr
] & ~mask
) != val
)
199 SLOT_PEND_MASK (State
.cregs
[cr
], mask
, val
);
205 static void trace_input_func (SIM_DESC sd
,
211 #define trace_input(name, in1, in2, in3) do { if (cr16_debug) trace_input_func (sd, name, in1, in2, in3); } while (0)
213 #ifndef SIZE_INSTRUCTION
214 #define SIZE_INSTRUCTION 8
217 #ifndef SIZE_OPERANDS
218 #define SIZE_OPERANDS 18
222 #define SIZE_VALUES 13
225 #ifndef SIZE_LOCATION
226 #define SIZE_LOCATION 20
233 #ifndef SIZE_LINE_NUMBER
234 #define SIZE_LINE_NUMBER 2
238 trace_input_func (SIM_DESC sd
, const char *name
, enum op_types in1
, enum op_types in2
, enum op_types in3
)
247 const char *filename
;
248 const char *functionname
;
249 unsigned int linenumber
;
252 if ((cr16_debug
& DEBUG_TRACE
) == 0)
255 switch (State
.ins_type
)
258 case INS_UNKNOWN
: type
= " ?"; break;
261 if ((cr16_debug
& DEBUG_LINE_NUMBER
) == 0)
264 SIZE_PC
, (unsigned)PC
,
266 SIZE_INSTRUCTION
, name
);
272 if (STATE_TEXT_SECTION (sd
)
273 && byte_pc
>= STATE_TEXT_START (sd
)
274 && byte_pc
< STATE_TEXT_END (sd
))
276 filename
= (const char *)0;
277 functionname
= (const char *)0;
279 if (bfd_find_nearest_line (STATE_PROG_BFD (sd
),
280 STATE_TEXT_SECTION (sd
),
281 (struct bfd_symbol
**)0,
282 byte_pc
- STATE_TEXT_START (sd
),
283 &filename
, &functionname
, &linenumber
))
288 sprintf (p
, "#%-*d ", SIZE_LINE_NUMBER
, linenumber
);
293 sprintf (p
, "%-*s ", SIZE_LINE_NUMBER
+1, "---");
294 p
+= SIZE_LINE_NUMBER
+2;
299 sprintf (p
, "%s ", functionname
);
304 char *q
= strrchr (filename
, '/');
305 sprintf (p
, "%s ", (q
) ? q
+1 : filename
);
315 "0x%.*x %s: %-*.*s %-*s ",
316 SIZE_PC
, (unsigned)PC
,
318 SIZE_LOCATION
, SIZE_LOCATION
, buf
,
319 SIZE_INSTRUCTION
, name
);
327 for (i
= 0; i
< 3; i
++)
336 sprintf (p
, "%sr%d", comma
, OP
[i
]);
342 sprintf (p
, "%scr%d", comma
, OP
[i
]);
348 sprintf (p
, "%s%d", comma
, OP
[i
]);
354 sprintf (p
, "%s%d", comma
, SEXT4(OP
[i
]));
360 sprintf (p
, "%s%d", comma
, SEXT3(OP
[i
]));
366 sprintf (p
, "%s@r%d", comma
, OP
[i
]);
372 sprintf (p
, "%s@(%d,r%d)", comma
, (int16
)OP
[i
], OP
[i
+1]);
378 sprintf (p
, "%s@%d", comma
, OP
[i
]);
385 if ((cr16_debug
& DEBUG_VALUES
) == 0)
389 sim_io_printf (sd
, "%s", buf
);
394 sim_io_printf (sd
, "%-*s", SIZE_OPERANDS
, buf
);
397 for (i
= 0; i
< 3; i
++)
403 sim_io_printf (sd
, "%*s", SIZE_VALUES
, "");
407 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
408 (uint16
) GPR (OP
[i
]));
412 tmp
= (long)((((uint32
) GPR (OP
[i
])) << 16) | ((uint32
) GPR (OP
[i
] + 1)));
413 sim_io_printf (sd
, "%*s0x%.8lx", SIZE_VALUES
-10, "", tmp
);
417 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
418 (uint16
) CREG (OP
[i
]));
422 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
427 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
428 (uint16
)SEXT4(OP
[i
]));
432 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
433 (uint16
)SEXT3(OP
[i
]));
437 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
439 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
440 (uint16
)GPR (OP
[i
+ 1]));
447 sim_io_flush_stdout (sd
);
451 do_trace_output_flush (SIM_DESC sd
)
453 sim_io_flush_stdout (sd
);
457 do_trace_output_finish (SIM_DESC sd
)
460 " F0=%d F1=%d C=%d\n",
461 (State
.trace
.psw
& PSR_F_BIT
) != 0,
462 (State
.trace
.psw
& PSR_F_BIT
) != 0,
463 (State
.trace
.psw
& PSR_C_BIT
) != 0);
464 sim_io_flush_stdout (sd
);
469 trace_output_40 (SIM_DESC sd
, uint64 val
)
471 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
474 " :: %*s0x%.2x%.8lx",
477 ((int)(val
>> 32) & 0xff),
478 ((unsigned long) val
) & 0xffffffff);
479 do_trace_output_finish ();
485 trace_output_32 (SIM_DESC sd
, uint32 val
)
487 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
494 do_trace_output_finish (sd
);
499 trace_output_16 (SIM_DESC sd
, uint16 val
)
501 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
508 do_trace_output_finish (sd
);
513 trace_output_void (SIM_DESC sd
)
515 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
517 sim_io_printf (sd
, "\n");
518 do_trace_output_flush (sd
);
523 trace_output_flag (SIM_DESC sd
)
525 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
531 do_trace_output_finish (sd
);
539 #define trace_input(NAME, IN1, IN2, IN3)
540 #define trace_output(RESULT)
545 OP_2C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
548 uint8 a
= OP
[0] & 0xff;
549 uint16 b
= (GPR (OP
[1])) & 0xff;
550 trace_input ("addub", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
551 tmp
= (a
+ b
) & 0xff;
552 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
553 trace_output_16 (sd
, tmp
);
558 OP_2CB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
561 uint8 a
= ((OP
[0]) & 0xff), b
= (GPR (OP
[1])) & 0xff;
562 trace_input ("addub", OP_CONSTANT16
, OP_REG
, OP_VOID
);
563 tmp
= (a
+ b
) & 0xff;
564 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
565 trace_output_16 (sd
, tmp
);
570 OP_2D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
572 uint8 a
= (GPR (OP
[0])) & 0xff;
573 uint8 b
= (GPR (OP
[1])) & 0xff;
574 uint16 tmp
= (a
+ b
) & 0xff;
575 trace_input ("addub", OP_REG
, OP_REG
, OP_VOID
);
576 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
577 trace_output_16 (sd
, tmp
);
582 OP_2E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
585 uint16 b
= GPR (OP
[1]);
586 uint16 tmp
= (a
+ b
);
587 trace_input ("adduw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
588 SET_GPR (OP
[1], tmp
);
589 trace_output_16 (sd
, tmp
);
594 OP_2EB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
597 uint16 b
= GPR (OP
[1]);
598 uint16 tmp
= (a
+ b
);
599 trace_input ("adduw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
600 SET_GPR (OP
[1], tmp
);
601 trace_output_16 (sd
, tmp
);
606 OP_2F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
608 uint16 a
= GPR (OP
[0]);
609 uint16 b
= GPR (OP
[1]);
610 uint16 tmp
= (a
+ b
);
611 trace_input ("adduw", OP_REG
, OP_REG
, OP_VOID
);
612 SET_GPR (OP
[1], tmp
);
613 trace_output_16 (sd
, tmp
);
618 OP_30_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
621 uint8 b
= (GPR (OP
[1]) & 0xff);
622 uint16 tmp
= (a
+ b
) & 0xff;
623 trace_input ("addb", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
624 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
625 SET_PSR_C (tmp
> 0xFF);
626 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
627 trace_output_16 (sd
, tmp
);
632 OP_30B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
634 uint8 a
= (OP
[0]) & 0xff;
635 uint8 b
= (GPR (OP
[1]) & 0xff);
636 uint16 tmp
= (a
+ b
) & 0xff;
637 trace_input ("addb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
638 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
639 SET_PSR_C (tmp
> 0xFF);
640 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
641 trace_output_16 (sd
, tmp
);
646 OP_31_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
648 uint8 a
= (GPR (OP
[0]) & 0xff);
649 uint8 b
= (GPR (OP
[1]) & 0xff);
650 uint16 tmp
= (a
+ b
) & 0xff;
651 trace_input ("addb", OP_REG
, OP_REG
, OP_VOID
);
652 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
653 SET_PSR_C (tmp
> 0xFF);
654 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
655 trace_output_16 (sd
, tmp
);
660 OP_32_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
663 uint16 tmp
, b
= GPR (OP
[1]);
665 trace_input ("addw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
666 SET_GPR (OP
[1], tmp
);
667 SET_PSR_C (tmp
> 0xFFFF);
668 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
669 trace_output_16 (sd
, tmp
);
674 OP_32B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
677 uint16 tmp
, b
= GPR (OP
[1]);
679 trace_input ("addw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
680 SET_GPR (OP
[1], tmp
);
681 SET_PSR_C (tmp
> 0xFFFF);
682 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
683 trace_output_16 (sd
, tmp
);
688 OP_33_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
690 uint16 tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
691 trace_input ("addw", OP_REG
, OP_REG
, OP_VOID
);
693 SET_GPR (OP
[1], tmp
);
694 SET_PSR_C (tmp
> 0xFFFF);
695 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
696 trace_output_16 (sd
, tmp
);
701 OP_34_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
703 uint8 tmp
, a
= OP
[0] & 0xff, b
= (GPR (OP
[1])) & 0xff;
704 trace_input ("addcb", OP_CONSTANT4_1
, OP_REG
, OP_REG
);
705 tmp
= (a
+ b
+ PSR_C
) & 0xff;
706 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
707 SET_PSR_C (tmp
> 0xFF);
708 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
709 trace_output_16 (sd
, tmp
);
714 OP_34B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
716 int8 a
= OP
[0] & 0xff;
717 uint8 b
= (GPR (OP
[1])) & 0xff;
718 uint8 tmp
= (a
+ b
+ PSR_C
) & 0xff;
719 trace_input ("addcb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
720 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
721 SET_PSR_C (tmp
> 0xFF);
722 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
723 trace_output_16 (sd
, tmp
);
728 OP_35_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
730 uint8 a
= (GPR (OP
[0])) & 0xff;
731 uint8 b
= (GPR (OP
[1])) & 0xff;
732 uint8 tmp
= (a
+ b
+ PSR_C
) & 0xff;
733 trace_input ("addcb", OP_REG
, OP_REG
, OP_VOID
);
734 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
735 SET_PSR_C (tmp
> 0xFF);
736 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
737 trace_output_16 (sd
, tmp
);
742 OP_36_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
745 uint16 b
= GPR (OP
[1]);
746 uint16 tmp
= (a
+ b
+ PSR_C
);
747 trace_input ("addcw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
748 SET_GPR (OP
[1], tmp
);
749 SET_PSR_C (tmp
> 0xFFFF);
750 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
751 trace_output_16 (sd
, tmp
);
756 OP_36B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
759 uint16 b
= GPR (OP
[1]);
760 uint16 tmp
= (a
+ b
+ PSR_C
);
761 trace_input ("addcw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
762 SET_GPR (OP
[1], tmp
);
763 SET_PSR_C (tmp
> 0xFFFF);
764 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
765 trace_output_16 (sd
, tmp
);
770 OP_37_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
772 uint16 a
= GPR (OP
[1]);
773 uint16 b
= GPR (OP
[1]);
774 uint16 tmp
= (a
+ b
+ PSR_C
);
775 trace_input ("addcw", OP_REG
, OP_REG
, OP_VOID
);
776 SET_GPR (OP
[1], tmp
);
777 SET_PSR_C (tmp
> 0xFFFF);
778 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
779 trace_output_16 (sd
, tmp
);
784 OP_60_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
787 uint32 b
= GPR32 (OP
[1]);
788 uint32 tmp
= (a
+ b
);
789 trace_input ("addd", OP_CONSTANT4_1
, OP_REGP
, OP_VOID
);
790 SET_GPR32 (OP
[1], tmp
);
791 SET_PSR_C (tmp
> 0xFFFFFFFF);
792 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
793 trace_output_32 (sd
, tmp
);
798 OP_60B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
800 int32 a
= (SEXT16(OP
[0]));
801 uint32 b
= GPR32 (OP
[1]);
802 uint32 tmp
= (a
+ b
);
803 trace_input ("addd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
804 SET_GPR32 (OP
[1], tmp
);
805 SET_PSR_C (tmp
> 0xFFFFFFFF);
806 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
807 trace_output_32 (sd
, tmp
);
812 OP_61_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
814 uint32 a
= GPR32 (OP
[0]);
815 uint32 b
= GPR32 (OP
[1]);
816 uint32 tmp
= (a
+ b
);
817 trace_input ("addd", OP_REGP
, OP_REGP
, OP_VOID
);
818 SET_GPR32 (OP
[1], tmp
);
819 trace_output_32 (sd
, tmp
);
820 SET_PSR_C (tmp
> 0xFFFFFFFF);
821 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
826 OP_4_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
829 uint32 b
= GPR32 (OP
[1]);
831 trace_input ("addd", OP_CONSTANT20
, OP_REGP
, OP_VOID
);
833 SET_GPR32 (OP
[1], tmp
);
834 SET_PSR_C (tmp
> 0xFFFFFFFF);
835 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
836 trace_output_32 (sd
, tmp
);
841 OP_2_C (SIM_DESC sd
, SIM_CPU
*cpu
)
844 uint32 b
= GPR32 (OP
[1]);
846 trace_input ("addd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
848 SET_GPR32 (OP
[1], tmp
);
849 SET_PSR_C (tmp
> 0xFFFFFFFF);
850 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
851 trace_output_32 (sd
, tmp
);
856 OP_20_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
858 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
859 trace_input ("andb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
861 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
862 trace_output_16 (sd
, tmp
);
867 OP_20B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
869 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
870 trace_input ("andb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
872 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
873 trace_output_16 (sd
, tmp
);
878 OP_21_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
880 uint8 tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
881 trace_input ("andb", OP_REG
, OP_REG
, OP_VOID
);
883 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
884 trace_output_16 (sd
, tmp
);
889 OP_22_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
891 uint16 tmp
, a
= OP
[0], b
= GPR (OP
[1]);
892 trace_input ("andw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
894 SET_GPR (OP
[1], tmp
);
895 trace_output_16 (sd
, tmp
);
900 OP_22B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
902 uint16 tmp
, a
= OP
[0], b
= GPR (OP
[1]);
903 trace_input ("andw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
905 SET_GPR (OP
[1], tmp
);
906 trace_output_16 (sd
, tmp
);
911 OP_23_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
913 uint16 tmp
, a
= GPR (OP
[0]), b
= GPR (OP
[1]);
914 trace_input ("andw", OP_REG
, OP_REG
, OP_VOID
);
916 SET_GPR (OP
[1], tmp
);
917 trace_output_16 (sd
, tmp
);
922 OP_4_C (SIM_DESC sd
, SIM_CPU
*cpu
)
924 uint32 tmp
, a
= OP
[0], b
= GPR32 (OP
[1]);
925 trace_input ("andd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
927 SET_GPR32 (OP
[1], tmp
);
928 trace_output_32 (sd
, tmp
);
933 OP_14B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
935 uint32 tmp
, a
= (GPR32 (OP
[0])), b
= (GPR32 (OP
[1]));
936 trace_input ("andd", OP_REGP
, OP_REGP
, OP_VOID
);
938 SET_GPR32 (OP
[1], tmp
);
939 trace_output_32 (sd
, tmp
);
944 OP_5_C (SIM_DESC sd
, SIM_CPU
*cpu
)
946 uint32 tmp
, a
= (OP
[0]), b
= GPR32 (OP
[1]);
947 trace_input ("ord", OP_CONSTANT32
, OP_REG
, OP_VOID
);
949 SET_GPR32 (OP
[1], tmp
);
950 trace_output_32 (sd
, tmp
);
955 OP_149_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
957 uint32 tmp
, a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
958 trace_input ("ord", OP_REGP
, OP_REGP
, OP_VOID
);
960 SET_GPR32 (OP
[1], tmp
);
961 trace_output_32 (sd
, tmp
);
966 OP_6_C (SIM_DESC sd
, SIM_CPU
*cpu
)
968 uint32 tmp
, a
= (OP
[0]), b
= GPR32 (OP
[1]);
969 trace_input ("xord", OP_CONSTANT32
, OP_REG
, OP_VOID
);
971 SET_GPR32 (OP
[1], tmp
);
972 trace_output_32 (sd
, tmp
);
977 OP_14A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
979 uint32 tmp
, a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
980 trace_input ("xord", OP_REGP
, OP_REGP
, OP_VOID
);
982 SET_GPR32 (OP
[1], tmp
);
983 trace_output_32 (sd
, tmp
);
989 OP_1_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
991 uint32 tmp
= 0, cc
= cond_stat (OP
[0]);
992 trace_input ("b", OP_CONSTANT4
, OP_DISPE9
, OP_VOID
);
996 tmp
= (PC
- (OP
[1]));
998 tmp
= (PC
+ (OP
[1]));
999 /* If the resulting PC value is less than 0x00_0000 or greater
1000 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1002 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1004 trace_output_void (sd
);
1005 EXCEPTION (SIM_SIGBUS
);
1010 sign_flag
= 0; /* Reset sign_flag. */
1011 trace_output_32 (sd
, tmp
);
1016 OP_18_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1018 uint32 tmp
= 0, cc
= cond_stat (OP
[0]);
1019 trace_input ("b", OP_CONSTANT4
, OP_DISP17
, OP_VOID
);
1026 /* If the resulting PC value is less than 0x00_0000 or greater
1027 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1029 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1031 trace_output_void (sd
);
1032 EXCEPTION (SIM_SIGBUS
);
1037 sign_flag
= 0; /* Reset sign_flag. */
1038 trace_output_32 (sd
, tmp
);
1043 OP_10_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
1045 uint32 tmp
= 0, cc
= cond_stat (OP
[0]);
1046 trace_input ("b", OP_CONSTANT4
, OP_DISP25
, OP_VOID
);
1050 tmp
= (PC
- (OP
[1]));
1052 tmp
= (PC
+ (OP
[1]));
1053 /* If the resulting PC value is less than 0x00_0000 or greater
1054 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1056 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1058 trace_output_void (sd
);
1059 EXCEPTION (SIM_SIGBUS
);
1064 sign_flag
= 0; /* Reset sign_flag. */
1065 trace_output_32 (sd
, tmp
);
1070 OP_C0_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1073 trace_input ("bal", OP_REG
, OP_DISP17
, OP_VOID
);
1074 tmp
= ((PC
+ 4) >> 1); /* Store PC in RA register. */
1075 SET_GPR32 (14, tmp
);
1077 tmp
= (PC
- (OP
[1]));
1079 tmp
= (PC
+ (OP
[1]));
1081 /* If the resulting PC value is less than 0x00_0000 or greater
1082 than 0xFF_FFFF, this instruction causes an IAD trap. */
1084 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1086 trace_output_void (sd
);
1087 EXCEPTION (SIM_SIGBUS
);
1091 sign_flag
= 0; /* Reset sign_flag. */
1092 trace_output_32 (sd
, tmp
);
1098 OP_102_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1101 trace_input ("bal", OP_REGP
, OP_DISP25
, OP_VOID
);
1102 tmp
= (((PC
) + 4) >> 1); /* Store PC in reg pair. */
1103 SET_GPR32 (OP
[0], tmp
);
1105 tmp
= ((PC
) - (OP
[1]));
1107 tmp
= ((PC
) + (OP
[1]));
1108 /* If the resulting PC value is less than 0x00_0000 or greater
1109 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1111 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1113 trace_output_void (sd
);
1114 EXCEPTION (SIM_SIGBUS
);
1118 sign_flag
= 0; /* Reset sign_flag. */
1119 trace_output_32 (sd
, tmp
);
1124 OP_148_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1127 trace_input ("jal", OP_REGP
, OP_REGP
, OP_VOID
);
1128 SET_GPR32 (OP
[0], (((PC
) + 4) >> 1)); /* Store next PC in RA */
1129 tmp
= GPR32 (OP
[1]);
1130 tmp
= SEXT24(tmp
<< 1);
1131 /* If the resulting PC value is less than 0x00_0000 or greater
1132 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1134 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
1136 trace_output_void (sd
);
1137 EXCEPTION (SIM_SIGBUS
);
1142 trace_output_32 (sd
, tmp
);
1148 OP_D_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1151 trace_input ("jal", OP_REGP
, OP_VOID
, OP_VOID
);
1152 SET_GPR32 (14, (((PC
) + 2) >> 1)); /* Store next PC in RA */
1153 tmp
= GPR32 (OP
[0]);
1154 tmp
= SEXT24(tmp
<< 1);
1155 /* If the resulting PC value is less than 0x00_0000 or greater
1156 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1158 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
1160 trace_output_void (sd
);
1161 EXCEPTION (SIM_SIGBUS
);
1166 trace_output_32 (sd
, tmp
);
1172 OP_C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1175 uint8 a
= (GPR (OP
[0]) & 0xFF);
1176 trace_input ("beq0b", OP_REG
, OP_DISP5
, OP_VOID
);
1181 addr
= (PC
- OP
[1]);
1183 addr
= (PC
+ OP
[1]);
1187 sign_flag
= 0; /* Reset sign_flag. */
1188 trace_output_void (sd
);
1193 OP_D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1196 uint8 a
= (GPR (OP
[0]) & 0xFF);
1197 trace_input ("bne0b", OP_REG
, OP_DISP5
, OP_VOID
);
1202 addr
= (PC
- OP
[1]);
1204 addr
= (PC
+ OP
[1]);
1208 sign_flag
= 0; /* Reset sign_flag. */
1209 trace_output_void (sd
);
1214 OP_E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1217 uint16 a
= GPR (OP
[0]);
1218 trace_input ("beq0w", OP_REG
, OP_DISP5
, OP_VOID
);
1223 addr
= (PC
- OP
[1]);
1225 addr
= (PC
+ OP
[1]);
1229 sign_flag
= 0; /* Reset sign_flag. */
1230 trace_output_void (sd
);
1235 OP_F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1238 uint16 a
= GPR (OP
[0]);
1239 trace_input ("bne0w", OP_REG
, OP_DISP5
, OP_VOID
);
1244 addr
= (PC
- OP
[1]);
1246 addr
= (PC
+ OP
[1]);
1250 sign_flag
= 0; /* Reset sign_flag. */
1251 trace_output_void (sd
);
1257 OP_A0_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1260 trace_input ("jeq", OP_REGP
, OP_VOID
, OP_VOID
);
1263 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits. */
1264 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit. */
1266 trace_output_32 (sd
, tmp
);
1271 OP_A1_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1274 trace_input ("jne", OP_REGP
, OP_VOID
, OP_VOID
);
1277 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits. */
1278 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit. */
1280 trace_output_32 (sd
, tmp
);
1285 OP_A2_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1288 trace_input ("jcs", OP_REGP
, OP_VOID
, OP_VOID
);
1291 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1292 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1294 trace_output_32 (sd
, tmp
);
1299 OP_A3_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1302 trace_input ("jcc", OP_REGP
, OP_VOID
, OP_VOID
);
1305 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1306 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1308 trace_output_32 (sd
, tmp
);
1313 OP_A4_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1316 trace_input ("jhi", OP_REGP
, OP_VOID
, OP_VOID
);
1319 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1320 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1322 trace_output_32 (sd
, tmp
);
1327 OP_A5_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1330 trace_input ("jls", OP_REGP
, OP_VOID
, OP_VOID
);
1333 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1334 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1336 trace_output_32 (sd
, tmp
);
1341 OP_A6_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1344 trace_input ("jgt", OP_REGP
, OP_VOID
, OP_VOID
);
1347 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1348 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1350 trace_output_32 (sd
, tmp
);
1355 OP_A7_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1358 trace_input ("jle", OP_REGP
, OP_VOID
, OP_VOID
);
1361 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1362 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1364 trace_output_32 (sd
, tmp
);
1370 OP_A8_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1373 trace_input ("jfs", OP_REGP
, OP_VOID
, OP_VOID
);
1376 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1377 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1379 trace_output_32 (sd
, tmp
);
1384 OP_A9_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1387 trace_input ("jfc", OP_REGP
, OP_VOID
, OP_VOID
);
1390 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1391 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1393 trace_output_32 (sd
, tmp
);
1398 OP_AA_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1401 trace_input ("jlo", OP_REGP
, OP_VOID
, OP_VOID
);
1402 if (((PSR_Z
) == 0) & ((PSR_L
) == 0))
1404 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1405 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1407 trace_output_32 (sd
, tmp
);
1412 OP_AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1415 trace_input ("jhs", OP_REGP
, OP_VOID
, OP_VOID
);
1416 if (((PSR_Z
) == 1) | ((PSR_L
) == 1))
1418 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1419 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1421 trace_output_32 (sd
, tmp
);
1426 OP_AC_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1429 trace_input ("jlt", OP_REGP
, OP_VOID
, OP_VOID
);
1430 if (((PSR_Z
) == 0) & ((PSR_N
) == 0))
1432 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1433 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1435 trace_output_32 (sd
, tmp
);
1440 OP_AD_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1443 trace_input ("jge", OP_REGP
, OP_VOID
, OP_VOID
);
1444 if (((PSR_Z
) == 1) | ((PSR_N
) == 1))
1446 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1447 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1449 trace_output_32 (sd
, tmp
);
1454 OP_AE_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1457 trace_input ("jump", OP_REGP
, OP_VOID
, OP_VOID
);
1458 tmp
= GPR32 (OP
[0]) /*& 0x3fffff*/; /* Use only 0 - 22 bits */
1459 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1460 trace_output_32 (sd
, tmp
);
1465 OP_AF_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1468 trace_input ("jusr", OP_REGP
, OP_VOID
, OP_VOID
);
1469 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1470 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1472 trace_output_32 (sd
, tmp
);
1477 OP_80_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1479 trace_input ("seq", OP_REG
, OP_VOID
, OP_VOID
);
1484 trace_output_void (sd
);
1488 OP_81_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1490 trace_input ("sne", OP_REG
, OP_VOID
, OP_VOID
);
1495 trace_output_void (sd
);
1500 OP_82_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1502 trace_input ("scs", OP_REG
, OP_VOID
, OP_VOID
);
1507 trace_output_void (sd
);
1512 OP_83_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1514 trace_input ("scc", OP_REG
, OP_VOID
, OP_VOID
);
1519 trace_output_void (sd
);
1524 OP_84_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1526 trace_input ("shi", OP_REG
, OP_VOID
, OP_VOID
);
1531 trace_output_void (sd
);
1536 OP_85_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1538 trace_input ("sls", OP_REG
, OP_VOID
, OP_VOID
);
1543 trace_output_void (sd
);
1548 OP_86_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1550 trace_input ("sgt", OP_REG
, OP_VOID
, OP_VOID
);
1555 trace_output_void (sd
);
1560 OP_87_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1562 trace_input ("sle", OP_REG
, OP_VOID
, OP_VOID
);
1567 trace_output_void (sd
);
1572 OP_88_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1574 trace_input ("sfs", OP_REG
, OP_VOID
, OP_VOID
);
1579 trace_output_void (sd
);
1584 OP_89_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1586 trace_input ("sfc", OP_REG
, OP_VOID
, OP_VOID
);
1591 trace_output_void (sd
);
1597 OP_8A_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1599 trace_input ("slo", OP_REG
, OP_VOID
, OP_VOID
);
1600 if (((PSR_Z
) == 0) & ((PSR_L
) == 0))
1604 trace_output_void (sd
);
1609 OP_8B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1611 trace_input ("shs", OP_REG
, OP_VOID
, OP_VOID
);
1612 if ( ((PSR_Z
) == 1) | ((PSR_L
) == 1))
1616 trace_output_void (sd
);
1621 OP_8C_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1623 trace_input ("slt", OP_REG
, OP_VOID
, OP_VOID
);
1624 if (((PSR_Z
) == 0) & ((PSR_N
) == 0))
1628 trace_output_void (sd
);
1633 OP_8D_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1635 trace_input ("sge", OP_REG
, OP_VOID
, OP_VOID
);
1636 if (((PSR_Z
) == 1) | ((PSR_N
) == 1))
1640 trace_output_void (sd
);
1645 OP_D7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1647 uint8 a
= OP
[0] & 0xff;
1648 uint32 addr
= OP
[1], tmp
;
1649 trace_input ("cbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1651 SET_PSR_F (tmp
& (1 << a
));
1652 tmp
= tmp
& ~(1 << a
);
1654 trace_output_32 (sd
, tmp
);
1659 OP_107_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1661 uint8 a
= OP
[0] & 0xff;
1662 uint32 addr
= OP
[1], tmp
;
1663 trace_input ("cbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1665 SET_PSR_F (tmp
& (1 << a
));
1666 tmp
= tmp
& ~(1 << a
);
1668 trace_output_32 (sd
, tmp
);
1673 OP_68_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1675 uint8 a
= (OP
[0]) & 0xff;
1676 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1677 trace_input ("cbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
1679 SET_PSR_F (tmp
& (1 << a
));
1680 tmp
= tmp
& ~(1 << a
);
1682 trace_output_32 (sd
, addr
);
1687 OP_1AA_A (SIM_DESC sd
, SIM_CPU
*cpu
)
1689 uint8 a
= (OP
[0]) & 0xff;
1690 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1691 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1693 SET_PSR_F (tmp
& (1 << a
));
1694 tmp
= tmp
& ~(1 << a
);
1696 trace_output_32 (sd
, addr
);
1701 OP_104_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1703 uint8 a
= (OP
[0]) & 0xff;
1704 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1705 trace_input ("cbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1707 SET_PSR_F (tmp
& (1 << a
));
1708 tmp
= tmp
& ~(1 << a
);
1710 trace_output_32 (sd
, addr
);
1715 OP_D4_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1717 uint8 a
= (OP
[0]) & 0xff;
1718 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1719 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1721 SET_PSR_F (tmp
& (1 << a
));
1722 tmp
= tmp
& ~(1 << a
);
1724 trace_output_32 (sd
, addr
);
1729 OP_D6_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1731 uint8 a
= (OP
[0]) & 0xff;
1732 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1733 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1735 SET_PSR_F (tmp
& (1 << a
));
1736 tmp
= tmp
& ~(1 << a
);
1738 trace_output_32 (sd
, addr
);
1744 OP_105_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1746 uint8 a
= (OP
[0]) & 0xff;
1747 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1748 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
1750 SET_PSR_F (tmp
& (1 << a
));
1751 tmp
= tmp
& ~(1 << a
);
1753 trace_output_32 (sd
, addr
);
1758 OP_106_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1760 uint8 a
= (OP
[0]) & 0xff;
1761 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1762 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
1764 SET_PSR_F (tmp
& (1 << a
));
1765 tmp
= tmp
& ~(1 << a
);
1767 trace_output_32 (sd
, addr
);
1773 OP_6F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1776 uint32 addr
= OP
[1], tmp
;
1777 trace_input ("cbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1779 SET_PSR_F (tmp
& (1 << a
));
1780 tmp
= tmp
& ~(1 << a
);
1782 trace_output_32 (sd
, tmp
);
1787 OP_117_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1790 uint32 addr
= OP
[1], tmp
;
1791 trace_input ("cbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1793 SET_PSR_F (tmp
& (1 << a
));
1794 tmp
= tmp
& ~(1 << a
);
1796 trace_output_32 (sd
, tmp
);
1801 OP_36_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
1804 uint16 a
= (OP
[0]), tmp
;
1805 trace_input ("cbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
1808 addr
= (GPR32 (12)) + OP
[2];
1810 addr
= (GPR32 (13)) + OP
[2];
1813 SET_PSR_F (tmp
& (1 << a
));
1814 tmp
= tmp
& ~(1 << a
);
1816 trace_output_32 (sd
, addr
);
1822 OP_1AB_A (SIM_DESC sd
, SIM_CPU
*cpu
)
1825 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1826 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1828 SET_PSR_F (tmp
& (1 << a
));
1829 tmp
= tmp
& ~(1 << a
);
1831 trace_output_32 (sd
, addr
);
1836 OP_114_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1839 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1840 trace_input ("cbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1842 SET_PSR_F (tmp
& (1 << a
));
1843 tmp
= tmp
& ~(1 << a
);
1845 trace_output_32 (sd
, addr
);
1851 OP_6E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1854 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1855 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1857 SET_PSR_F (tmp
& (1 << a
));
1858 tmp
= tmp
& ~(1 << a
);
1860 trace_output_32 (sd
, addr
);
1865 OP_69_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1868 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1869 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1871 SET_PSR_F (tmp
& (1 << a
));
1872 tmp
= tmp
& ~(1 << a
);
1874 trace_output_32 (sd
, addr
);
1880 OP_115_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1883 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1884 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
1886 SET_PSR_F (tmp
& (1 << a
));
1887 tmp
= tmp
& ~(1 << a
);
1889 trace_output_32 (sd
, addr
);
1894 OP_116_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1897 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1898 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
1900 SET_PSR_F (tmp
& (1 << a
));
1901 tmp
= tmp
& ~(1 << a
);
1903 trace_output_32 (sd
, addr
);
1908 OP_E7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1910 uint8 a
= OP
[0] & 0xff;
1911 uint32 addr
= OP
[1], tmp
;
1912 trace_input ("sbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1914 SET_PSR_F (tmp
& (1 << a
));
1915 tmp
= tmp
| (1 << a
);
1917 trace_output_32 (sd
, tmp
);
1922 OP_10B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1924 uint8 a
= OP
[0] & 0xff;
1925 uint32 addr
= OP
[1], tmp
;
1926 trace_input ("sbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1928 SET_PSR_F (tmp
& (1 << a
));
1929 tmp
= tmp
| (1 << a
);
1931 trace_output_32 (sd
, tmp
);
1936 OP_70_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1938 uint8 a
= OP
[0] & 0xff;
1939 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1940 trace_input ("sbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
1942 SET_PSR_F (tmp
& (1 << a
));
1943 tmp
= tmp
| (1 << a
);
1945 trace_output_32 (sd
, tmp
);
1950 OP_1CA_A (SIM_DESC sd
, SIM_CPU
*cpu
)
1952 uint8 a
= OP
[0] & 0xff;
1953 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1954 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1956 SET_PSR_F (tmp
& (1 << a
));
1957 tmp
= tmp
| (1 << a
);
1959 trace_output_32 (sd
, tmp
);
1964 OP_108_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1966 uint8 a
= OP
[0] & 0xff;
1967 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1968 trace_input ("sbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1970 SET_PSR_F (tmp
& (1 << a
));
1971 tmp
= tmp
| (1 << a
);
1973 trace_output_32 (sd
, tmp
);
1979 OP_E4_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1981 uint8 a
= OP
[0] & 0xff;
1982 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1983 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1985 SET_PSR_F (tmp
& (1 << a
));
1986 tmp
= tmp
| (1 << a
);
1988 trace_output_32 (sd
, tmp
);
1993 OP_E6_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1995 uint8 a
= OP
[0] & 0xff;
1996 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1997 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1999 SET_PSR_F (tmp
& (1 << a
));
2000 tmp
= tmp
| (1 << a
);
2002 trace_output_32 (sd
, tmp
);
2008 OP_109_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2010 uint8 a
= OP
[0] & 0xff;
2011 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2012 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2014 SET_PSR_F (tmp
& (1 << a
));
2015 tmp
= tmp
| (1 << a
);
2017 trace_output_32 (sd
, tmp
);
2023 OP_10A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2025 uint8 a
= OP
[0] & 0xff;
2026 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2027 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2029 SET_PSR_F (tmp
& (1 << a
));
2030 tmp
= tmp
| (1 << a
);
2032 trace_output_32 (sd
, tmp
);
2038 OP_77_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2041 uint32 addr
= OP
[1], tmp
;
2042 trace_input ("sbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2044 SET_PSR_F (tmp
& (1 << a
));
2045 tmp
= tmp
| (1 << a
);
2047 trace_output_32 (sd
, tmp
);
2052 OP_11B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2055 uint32 addr
= OP
[1], tmp
;
2056 trace_input ("sbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2058 SET_PSR_F (tmp
& (1 << a
));
2059 tmp
= tmp
| (1 << a
);
2061 trace_output_32 (sd
, tmp
);
2066 OP_3A_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
2069 uint16 a
= (OP
[0]), tmp
;
2070 trace_input ("sbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
2073 addr
= (GPR32 (12)) + OP
[2];
2075 addr
= (GPR32 (13)) + OP
[2];
2078 SET_PSR_F (tmp
& (1 << a
));
2079 tmp
= tmp
| (1 << a
);
2081 trace_output_32 (sd
, addr
);
2086 OP_1CB_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2089 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2090 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2092 SET_PSR_F (tmp
& (1 << a
));
2093 tmp
= tmp
| (1 << a
);
2095 trace_output_32 (sd
, addr
);
2100 OP_118_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2103 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2104 trace_input ("sbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2106 SET_PSR_F (tmp
& (1 << a
));
2107 tmp
= tmp
| (1 << a
);
2109 trace_output_32 (sd
, addr
);
2114 OP_76_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2117 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2118 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2120 SET_PSR_F (tmp
& (1 << a
));
2121 tmp
= tmp
| (1 << a
);
2123 trace_output_32 (sd
, addr
);
2128 OP_71_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2131 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2132 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2134 SET_PSR_F (tmp
& (1 << a
));
2135 tmp
= tmp
| (1 << a
);
2137 trace_output_32 (sd
, addr
);
2142 OP_119_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2145 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2146 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2148 SET_PSR_F (tmp
& (1 << a
));
2149 tmp
= tmp
| (1 << a
);
2151 trace_output_32 (sd
, addr
);
2156 OP_11A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2159 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2160 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2162 SET_PSR_F (tmp
& (1 << a
));
2163 tmp
= tmp
| (1 << a
);
2165 trace_output_32 (sd
, addr
);
2171 OP_F7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
2173 uint8 a
= OP
[0] & 0xff;
2174 uint32 addr
= OP
[1], tmp
;
2175 trace_input ("tbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2177 SET_PSR_F (tmp
& (1 << a
));
2178 trace_output_32 (sd
, tmp
);
2183 OP_10F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2185 uint8 a
= OP
[0] & 0xff;
2186 uint32 addr
= OP
[1], tmp
;
2187 trace_input ("tbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2189 SET_PSR_F (tmp
& (1 << a
));
2190 trace_output_32 (sd
, tmp
);
2195 OP_78_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2197 uint8 a
= (OP
[0]) & 0xff;
2198 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2199 trace_input ("tbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
2201 SET_PSR_F (tmp
& (1 << a
));
2202 trace_output_32 (sd
, addr
);
2207 OP_1EA_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2209 uint8 a
= (OP
[0]) & 0xff;
2210 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2211 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2213 SET_PSR_F (tmp
& (1 << a
));
2214 trace_output_32 (sd
, addr
);
2219 OP_10C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2221 uint8 a
= (OP
[0]) & 0xff;
2222 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2223 trace_input ("tbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2225 SET_PSR_F (tmp
& (1 << a
));
2226 trace_output_32 (sd
, addr
);
2231 OP_F4_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
2233 uint8 a
= (OP
[0]) & 0xff;
2234 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2235 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2237 SET_PSR_F (tmp
& (1 << a
));
2238 trace_output_32 (sd
, addr
);
2243 OP_F6_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
2245 uint8 a
= (OP
[0]) & 0xff;
2246 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2247 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2249 SET_PSR_F (tmp
& (1 << a
));
2250 trace_output_32 (sd
, addr
);
2255 OP_10D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2257 uint8 a
= (OP
[0]) & 0xff;
2258 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2259 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2261 SET_PSR_F (tmp
& (1 << a
));
2262 trace_output_32 (sd
, addr
);
2267 OP_10E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2269 uint8 a
= (OP
[0]) & 0xff;
2270 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2271 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2273 SET_PSR_F (tmp
& (1 << a
));
2274 trace_output_32 (sd
, addr
);
2280 OP_7F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2283 uint32 addr
= OP
[1], tmp
;
2284 trace_input ("tbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2286 SET_PSR_F (tmp
& (1 << a
));
2287 trace_output_32 (sd
, tmp
);
2292 OP_11F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2295 uint32 addr
= OP
[1], tmp
;
2296 trace_input ("tbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2298 SET_PSR_F (tmp
& (1 << a
));
2299 trace_output_32 (sd
, tmp
);
2305 OP_3E_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
2308 uint16 a
= (OP
[0]), tmp
;
2309 trace_input ("tbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
2312 addr
= (GPR32 (12)) + OP
[2];
2314 addr
= (GPR32 (13)) + OP
[2];
2317 SET_PSR_F (tmp
& (1 << a
));
2318 trace_output_32 (sd
, addr
);
2323 OP_1EB_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2326 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2327 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2329 SET_PSR_F (tmp
& (1 << a
));
2330 trace_output_32 (sd
, addr
);
2335 OP_11C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2338 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2339 trace_input ("tbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2341 SET_PSR_F (tmp
& (1 << a
));
2342 trace_output_32 (sd
, addr
);
2347 OP_7E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2350 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2351 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2353 SET_PSR_F (tmp
& (1 << a
));
2354 trace_output_32 (sd
, addr
);
2359 OP_79_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2362 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2363 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2365 SET_PSR_F (tmp
& (1 << a
));
2366 trace_output_32 (sd
, addr
);
2371 OP_11D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2374 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2375 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2377 SET_PSR_F (tmp
& (1 << a
));
2378 trace_output_32 (sd
, addr
);
2384 OP_11E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2387 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2388 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2390 SET_PSR_F (tmp
& (1 << a
));
2391 trace_output_32 (sd
, addr
);
2397 OP_6_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2400 uint16 b
= (GPR (OP
[1]));
2401 trace_input ("tbit", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2402 SET_PSR_F (b
& (1 << a
));
2403 trace_output_16 (sd
, b
);
2408 OP_7_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2410 uint16 a
= GPR (OP
[0]);
2411 uint16 b
= (GPR (OP
[1]));
2412 trace_input ("tbit", OP_REG
, OP_REG
, OP_VOID
);
2413 SET_PSR_F (b
& (1 << a
));
2414 trace_output_16 (sd
, b
);
2420 OP_50_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2422 uint8 a
= (OP
[0]) & 0xFF;
2423 uint8 b
= (GPR (OP
[1])) & 0xFF;
2424 trace_input ("cmpb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2426 SET_PSR_N ((int8
)a
> (int8
)b
);
2428 trace_output_flag (sd
);
2433 OP_50B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2435 uint8 a
= (OP
[0]) & 0xFF;
2436 uint8 b
= (GPR (OP
[1])) & 0xFF;
2437 trace_input ("cmpb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2439 SET_PSR_N ((int8
)a
> (int8
)b
);
2441 trace_output_flag (sd
);
2446 OP_51_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2448 uint8 a
= (GPR (OP
[0])) & 0xFF;
2449 uint8 b
= (GPR (OP
[1])) & 0xFF;
2450 trace_input ("cmpb", OP_REG
, OP_REG
, OP_VOID
);
2452 SET_PSR_N ((int8
)a
> (int8
)b
);
2454 trace_output_flag (sd
);
2459 OP_52_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2462 uint16 b
= GPR (OP
[1]);
2463 trace_input ("cmpw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2465 SET_PSR_N ((int16
)a
> (int16
)b
);
2467 trace_output_flag (sd
);
2472 OP_52B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2475 uint16 b
= GPR (OP
[1]);
2476 trace_input ("cmpw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2478 SET_PSR_N ((int16
)a
> (int16
)b
);
2480 trace_output_flag (sd
);
2485 OP_53_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2487 uint16 a
= GPR (OP
[0]) ;
2488 uint16 b
= GPR (OP
[1]) ;
2489 trace_input ("cmpw", OP_REG
, OP_REG
, OP_VOID
);
2491 SET_PSR_N ((int16
)a
> (int16
)b
);
2493 trace_output_flag (sd
);
2498 OP_56_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2501 uint32 b
= GPR32 (OP
[1]);
2502 trace_input ("cmpd", OP_CONSTANT4
, OP_REGP
, OP_VOID
);
2504 SET_PSR_N ((int32
)a
> (int32
)b
);
2506 trace_output_flag (sd
);
2511 OP_56B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2513 uint32 a
= (SEXT16(OP
[0]));
2514 uint32 b
= GPR32 (OP
[1]);
2515 trace_input ("cmpd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
2517 SET_PSR_N ((int32
)a
> (int32
)b
);
2519 trace_output_flag (sd
);
2524 OP_57_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2526 uint32 a
= GPR32 (OP
[0]) ;
2527 uint32 b
= GPR32 (OP
[1]) ;
2528 trace_input ("cmpd", OP_REGP
, OP_REGP
, OP_VOID
);
2530 SET_PSR_N ((int32
)a
> (int32
)b
);
2532 trace_output_flag (sd
);
2537 OP_9_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2540 uint32 b
= GPR32 (OP
[1]);
2541 trace_input ("cmpd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
2543 SET_PSR_N ((int32
)a
> (int32
)b
);
2545 trace_output_flag (sd
);
2551 OP_58_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2553 uint8 tmp
= OP
[0] & 0xFF;
2554 uint16 a
= (GPR (OP
[1])) & 0xFF00;
2555 trace_input ("movb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2556 SET_GPR (OP
[1], (a
| tmp
));
2557 trace_output_16 (sd
, tmp
);
2562 OP_58B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2564 uint8 tmp
= OP
[0] & 0xFF;
2565 uint16 a
= (GPR (OP
[1])) & 0xFF00;
2566 trace_input ("movb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2567 SET_GPR (OP
[1], (a
| tmp
));
2568 trace_output_16 (sd
, tmp
);
2573 OP_59_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2575 uint8 tmp
= (GPR (OP
[0])) & 0xFF;
2576 uint16 a
= (GPR (OP
[1])) & 0xFF00;
2577 trace_input ("movb", OP_REG
, OP_REG
, OP_VOID
);
2578 SET_GPR (OP
[1], (a
| tmp
));
2579 trace_output_16 (sd
, tmp
);
2584 OP_5A_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2587 trace_input ("movw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
2588 SET_GPR (OP
[1], (tmp
& 0xffff));
2589 trace_output_16 (sd
, tmp
);
2594 OP_5AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2597 trace_input ("movw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2598 SET_GPR (OP
[1], (tmp
& 0xffff));
2599 trace_output_16 (sd
, tmp
);
2604 OP_5B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2606 uint16 tmp
= GPR (OP
[0]);
2607 uint32 a
= GPR32 (OP
[1]);
2608 trace_input ("movw", OP_REG
, OP_REGP
, OP_VOID
);
2609 a
= (a
& 0xffff0000) | tmp
;
2610 SET_GPR32 (OP
[1], a
);
2611 trace_output_16 (sd
, tmp
);
2616 OP_5C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2618 uint8 tmp
= (GPR (OP
[0])) & 0xFF;
2619 trace_input ("movxb", OP_REG
, OP_REG
, OP_VOID
);
2620 SET_GPR (OP
[1], ((SEXT8(tmp
)) & 0xffff));
2621 trace_output_16 (sd
, tmp
);
2626 OP_5D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2628 uint8 tmp
= (GPR (OP
[0])) & 0xFF;
2629 trace_input ("movzb", OP_REG
, OP_REG
, OP_VOID
);
2630 SET_GPR (OP
[1], tmp
);
2631 trace_output_16 (sd
, tmp
);
2636 OP_5E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2638 uint16 tmp
= GPR (OP
[0]);
2639 trace_input ("movxw", OP_REG
, OP_REGP
, OP_VOID
);
2640 SET_GPR32 (OP
[1], SEXT16(tmp
));
2641 trace_output_16 (sd
, tmp
);
2646 OP_5F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2648 uint16 tmp
= GPR (OP
[0]);
2649 trace_input ("movzw", OP_REG
, OP_REGP
, OP_VOID
);
2650 SET_GPR32 (OP
[1], (tmp
& 0x0000FFFF));
2651 trace_output_16 (sd
, tmp
);
2656 OP_54_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2659 trace_input ("movd", OP_CONSTANT4
, OP_REGP
, OP_VOID
);
2660 SET_GPR32 (OP
[1], tmp
);
2661 trace_output_32 (sd
, tmp
);
2666 OP_54B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2668 int32 tmp
= SEXT16(OP
[0]);
2669 trace_input ("movd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
2670 SET_GPR32 (OP
[1], tmp
);
2671 trace_output_32 (sd
, tmp
);
2676 OP_55_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2678 uint32 tmp
= GPR32 (OP
[0]);
2679 trace_input ("movd", OP_REGP
, OP_REGP
, OP_VOID
);
2680 SET_GPR32 (OP
[1], tmp
);
2681 trace_output_32 (sd
, tmp
);
2686 OP_5_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2689 trace_input ("movd", OP_CONSTANT20
, OP_REGP
, OP_VOID
);
2690 SET_GPR32 (OP
[1], tmp
);
2691 trace_output_32 (sd
, tmp
);
2696 OP_7_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2699 trace_input ("movd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
2700 SET_GPR32 (OP
[1], tmp
);
2701 trace_output_32 (sd
, tmp
);
2706 OP_14_D (SIM_DESC sd
, SIM_CPU
*cpu
)
2708 uint32 addr
= GPR (0);
2709 uint16 count
= OP
[0], reg
= 2, tmp
;
2710 trace_input ("loadm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
2713 trace_output_void (sd
);
2714 EXCEPTION (SIM_SIGBUS
);
2724 if (reg
== 6) reg
= 8;
2728 trace_output_void (sd
);
2734 OP_15_D (SIM_DESC sd
, SIM_CPU
*cpu
)
2736 uint32 addr
= GPR32 (0);
2737 uint16 count
= OP
[0], reg
= 2, tmp
;
2738 trace_input ("loadm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
2741 trace_output_void (sd
);
2742 EXCEPTION (SIM_SIGBUS
);
2752 if (reg
== 6) reg
= 8;
2755 SET_GPR32 (0, addr
);
2756 trace_output_void (sd
);
2762 OP_88_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2765 * ADDR = zext24(abs20) | remap (ie 0xF00000)
2768 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
2769 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
2770 * by the core to 16M-64k to 16M. */
2772 uint16 tmp
, a
= (GPR (OP
[1])) & 0xFF00;
2773 uint32 addr
= OP
[0];
2774 trace_input ("loadb", OP_ABS20
, OP_REG
, OP_VOID
);
2775 if (addr
> 0xEFFFF) addr
|= 0xF00000;
2777 SET_GPR (OP
[1], (a
| tmp
));
2778 trace_output_16 (sd
, tmp
);
2783 OP_127_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2789 uint16 tmp
, a
= (GPR (OP
[1])) & 0xFF00;
2790 uint32 addr
= OP
[0];
2791 trace_input ("loadb", OP_ABS24
, OP_REG
, OP_VOID
);
2793 SET_GPR (OP
[1], (a
| tmp
));
2794 trace_output_16 (sd
, tmp
);
2799 OP_45_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
2801 /* loadb [Rindex]ABS20 REG
2802 * ADDR = Rindex + zext24(disp20)
2806 uint16 tmp
, a
= (GPR (OP
[2])) & 0xFF00;
2807 trace_input ("loadb", OP_R_INDEX8_ABS20
, OP_REG
, OP_VOID
);
2810 addr
= (GPR32 (12)) + OP
[1];
2812 addr
= (GPR32 (13)) + OP
[1];
2815 SET_GPR (OP
[2], (a
| tmp
));
2816 trace_output_16 (sd
, tmp
);
2822 OP_B_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
2824 /* loadb DIPS4(REGP) REG
2825 * ADDR = RPBASE + zext24(DISP4)
2827 uint16 tmp
, a
= (GPR (OP
[2])) & 0xFF00;
2828 uint32 addr
= (GPR32 (OP
[1])) + OP
[0];
2829 trace_input ("loadb", OP_RP_BASE_DISP4
, OP_REG
, OP_VOID
);
2831 SET_GPR (OP
[2], (a
| tmp
));
2832 trace_output_16 (sd
, tmp
);
2837 OP_BE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2839 /* loadb [Rindex]disp0(RPbasex) REG
2840 * ADDR = Rpbasex + Rindex
2844 uint16 tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2845 trace_input ("loadb", OP_RP_INDEX_DISP0
, OP_REG
, OP_VOID
);
2847 addr
= (GPR32 (OP
[2])) + OP
[1];
2850 addr
= (GPR32 (12)) + addr
;
2852 addr
= (GPR32 (13)) + addr
;
2855 SET_GPR (OP
[3], (a
| tmp
));
2856 trace_output_16 (sd
, tmp
);
2861 OP_219_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2863 /* loadb [Rindex]disp14(RPbasex) REG
2864 * ADDR = Rpbasex + Rindex + zext24(disp14)
2868 uint16 tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2870 addr
= (GPR32 (OP
[2])) + OP
[1];
2873 addr
= (GPR32 (12)) + addr
;
2875 addr
= (GPR32 (13)) + addr
;
2877 trace_input ("loadb", OP_RP_INDEX_DISP14
, OP_REG
, OP_VOID
);
2879 SET_GPR (OP
[3], (a
| tmp
));
2880 trace_output_16 (sd
, tmp
);
2886 OP_184_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2888 /* loadb DISPE20(REG) REG
2889 * zext24(Rbase) + zext24(dispe20)
2892 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2893 uint32 addr
= OP
[0] + (GPR (OP
[1]));
2894 trace_input ("loadb", OP_R_BASE_DISPE20
, OP_REG
, OP_VOID
);
2896 SET_GPR (OP
[2], (a
| tmp
));
2897 trace_output_16 (sd
, tmp
);
2902 OP_124_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2904 /* loadb DISP20(REG) REG
2905 * ADDR = zext24(Rbase) + zext24(disp20)
2908 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2909 uint32 addr
= OP
[0] + (GPR (OP
[1]));
2910 trace_input ("loadb", OP_R_BASE_DISP20
, OP_REG
, OP_VOID
);
2912 SET_GPR (OP
[2], (a
| tmp
));
2913 trace_output_16 (sd
, tmp
);
2918 OP_BF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2920 /* loadb disp16(REGP) REG
2921 * ADDR = RPbase + zext24(disp16)
2924 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2925 uint32 addr
= (GPR32 (OP
[1])) + OP
[0];
2926 trace_input ("loadb", OP_RP_BASE_DISP16
, OP_REG
, OP_VOID
);
2928 SET_GPR (OP
[2], (a
| tmp
));
2929 trace_output_16 (sd
, tmp
);
2934 OP_125_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2936 /* loadb disp20(REGP) REG
2937 * ADDR = RPbase + zext24(disp20)
2939 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2940 uint32 addr
= (GPR32 (OP
[1])) + OP
[0];
2941 trace_input ("loadb", OP_RP_BASE_DISP20
, OP_REG
, OP_VOID
);
2943 SET_GPR (OP
[2], (a
| tmp
));
2944 trace_output_16 (sd
, tmp
);
2950 OP_185_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2952 /* loadb -disp20(REGP) REG
2953 * ADDR = RPbase + zext24(-disp20)
2955 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2956 uint32 addr
= (GPR32 (OP
[1])) + OP
[1];
2957 trace_input ("loadb", OP_RP_BASE_DISPE20
, OP_REG
, OP_VOID
);
2959 SET_GPR (OP
[2], (a
| tmp
));
2960 trace_output_16 (sd
, tmp
);
2965 OP_126_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2967 /* loadb [Rindex]disp20(RPbasexb) REG
2968 * ADDR = RPbasex + Rindex + zext24(disp20)
2972 uint16 tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2973 trace_input ("loadb", OP_RP_INDEX_DISP20
, OP_REG
, OP_VOID
);
2975 addr
= (GPR32 (OP
[2])) + OP
[1];
2978 addr
= (GPR32 (12)) + addr
;
2980 addr
= (GPR32 (13)) + addr
;
2983 SET_GPR (OP
[3], (a
| tmp
));
2984 trace_output_16 (sd
, tmp
);
2990 OP_89_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2993 * ADDR = zext24(abs20) | remap
2996 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
2997 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
2998 * by the core to 16M-64k to 16M. */
3001 uint32 addr
= OP
[0];
3002 trace_input ("loadw", OP_ABS20
, OP_REG
, OP_VOID
);
3003 if (addr
> 0xEFFFF) addr
|= 0xF00000;
3005 SET_GPR (OP
[1], tmp
);
3006 trace_output_16 (sd
, tmp
);
3012 OP_12F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3018 uint32 addr
= OP
[0];
3019 trace_input ("loadw", OP_ABS24
, OP_REG
, OP_VOID
);
3021 SET_GPR (OP
[1], tmp
);
3022 trace_output_16 (sd
, tmp
);
3027 OP_47_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3029 /* loadw [Rindex]ABS20 REG
3030 * ADDR = Rindex + zext24(disp20)
3035 trace_input ("loadw", OP_R_INDEX8_ABS20
, OP_REG
, OP_VOID
);
3038 addr
= (GPR32 (12)) + OP
[1];
3040 addr
= (GPR32 (13)) + OP
[1];
3043 SET_GPR (OP
[2], tmp
);
3044 trace_output_16 (sd
, tmp
);
3050 OP_9_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3052 /* loadw DIPS4(REGP) REGP
3053 * ADDR = RPBASE + zext24(DISP4)
3057 trace_input ("loadw", OP_RP_BASE_DISP4
, OP_REG
, OP_VOID
);
3058 addr
= (GPR32 (OP
[1])) + OP
[0];
3062 a
= (GPR32 (OP
[2])) & 0xffff0000;
3063 SET_GPR32 (OP
[2], (a
| tmp
));
3066 SET_GPR (OP
[2], tmp
);
3068 trace_output_16 (sd
, tmp
);
3074 OP_9E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3076 /* loadw [Rindex]disp0(RPbasex) REG
3077 * ADDR = Rpbasex + Rindex
3082 trace_input ("loadw", OP_RP_INDEX_DISP0
, OP_REG
, OP_VOID
);
3084 addr
= (GPR32 (OP
[2])) + OP
[1];
3087 addr
= (GPR32 (12)) + addr
;
3089 addr
= (GPR32 (13)) + addr
;
3092 SET_GPR (OP
[3], tmp
);
3093 trace_output_16 (sd
, tmp
);
3099 OP_21B_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3101 /* loadw [Rindex]disp14(RPbasex) REG
3102 * ADDR = Rpbasex + Rindex + zext24(disp14)
3107 trace_input ("loadw", OP_RP_INDEX_DISP14
, OP_REG
, OP_VOID
);
3108 addr
= (GPR32 (OP
[2])) + OP
[1];
3111 addr
= (GPR32 (12)) + addr
;
3113 addr
= (GPR32 (13)) + addr
;
3116 SET_GPR (OP
[3], tmp
);
3117 trace_output_16 (sd
, tmp
);
3122 OP_18C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3124 /* loadw dispe20(REG) REGP
3125 * REGP = [DISPE20+[REG]] */
3129 trace_input ("loadw", OP_R_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3130 addr
= OP
[0] + (GPR (OP
[1]));
3134 a
= (GPR32 (OP
[2])) & 0xffff0000;
3135 SET_GPR32 (OP
[2], (a
| tmp
));
3138 SET_GPR (OP
[2], tmp
);
3140 trace_output_16 (sd
, tmp
);
3146 OP_12C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3148 /* loadw DISP20(REG) REGP
3149 * ADDR = zext24(Rbase) + zext24(disp20)
3154 trace_input ("loadw", OP_R_BASE_DISP20
, OP_REGP
, OP_VOID
);
3155 addr
= OP
[0] + (GPR (OP
[1]));
3159 a
= (GPR32 (OP
[2])) & 0xffff0000;
3160 SET_GPR32 (OP
[2], (a
| tmp
));
3163 SET_GPR (OP
[2], tmp
);
3165 trace_output_16 (sd
, tmp
);
3170 OP_9F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3172 /* loadw disp16(REGP) REGP
3173 * ADDR = RPbase + zext24(disp16)
3177 trace_input ("loadw", OP_RP_BASE_DISP16
, OP_REGP
, OP_VOID
);
3178 addr
= (GPR32 (OP
[1])) + OP
[0];
3182 a
= (GPR32 (OP
[2])) & 0xffff0000;
3183 SET_GPR32 (OP
[2], (a
| tmp
));
3186 SET_GPR (OP
[2], tmp
);
3188 trace_output_16 (sd
, tmp
);
3193 OP_12D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3195 /* loadw disp20(REGP) REGP
3196 * ADDR = RPbase + zext24(disp20)
3200 trace_input ("loadw", OP_RP_BASE_DISP20
, OP_REG
, OP_VOID
);
3201 addr
= (GPR32 (OP
[1])) + OP
[0];
3205 a
= (GPR32 (OP
[2])) & 0xffff0000;
3206 SET_GPR32 (OP
[2], (a
| tmp
));
3209 SET_GPR (OP
[2], tmp
);
3211 trace_output_16 (sd
, tmp
);
3216 OP_18D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3218 /* loadw -disp20(REGP) REG
3219 * ADDR = RPbase + zext24(-disp20)
3224 trace_input ("loadw", OP_RP_BASE_DISPE20
, OP_REG
, OP_VOID
);
3225 addr
= (GPR32 (OP
[1])) + OP
[0];
3229 a
= (GPR32 (OP
[2])) & 0xffff0000;
3230 SET_GPR32 (OP
[2], (a
| tmp
));
3233 SET_GPR (OP
[2], tmp
);
3235 trace_output_16 (sd
, tmp
);
3241 OP_12E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3243 /* loadw [Rindex]disp20(RPbasexb) REG
3244 * ADDR = RPbasex + Rindex + zext24(disp20)
3249 trace_input ("loadw", OP_RP_INDEX_DISP20
, OP_REG
, OP_VOID
);
3252 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3254 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3257 SET_GPR (OP
[3], tmp
);
3258 trace_output_16 (sd
, tmp
);
3264 OP_87_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3266 /* loadd ABS20, REGP
3267 * ADDR = zext24(abs20) | remap
3270 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
3271 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
3272 * by the core to 16M-64k to 16M. */
3276 trace_input ("loadd", OP_ABS20
, OP_REGP
, OP_VOID
);
3277 if (addr
> 0xEFFFF) addr
|= 0xF00000;
3279 tmp
= ((tmp
<< 16) & 0xffff)| ((tmp
>> 16) & 0xffff);
3280 SET_GPR32 (OP
[1], tmp
);
3281 trace_output_32 (sd
, tmp
);
3286 OP_12B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3288 /* loadd ABS24, REGP
3292 uint32 addr
= OP
[0];
3294 trace_input ("loadd", OP_ABS24
, OP_REGP
, OP_VOID
);
3296 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3297 SET_GPR32 (OP
[1],tmp
);
3298 trace_output_32 (sd
, tmp
);
3304 OP_46_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3306 /* loadd [Rindex]ABS20 REGP
3307 * ADDR = Rindex + zext24(disp20)
3311 trace_input ("loadd", OP_R_INDEX8_ABS20
, OP_REGP
, OP_VOID
);
3314 addr
= (GPR32 (12)) + OP
[1];
3316 addr
= (GPR32 (13)) + OP
[1];
3319 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3320 SET_GPR32 (OP
[2], tmp
);
3321 trace_output_32 (sd
, tmp
);
3327 OP_A_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3329 /* loadd dips4(regp) REGP
3330 * ADDR = Rpbase + zext24(disp4)
3333 uint32 tmp
, addr
= (GPR32 (OP
[1])) + OP
[0];
3334 trace_input ("loadd", OP_RP_BASE_DISP4
, OP_REGP
, OP_VOID
);
3336 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3337 SET_GPR32 (OP
[2], tmp
);
3338 trace_output_32 (sd
, tmp
);
3344 OP_AE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3346 /* loadd [Rindex]disp0(RPbasex) REGP
3347 * ADDR = Rpbasex + Rindex
3351 trace_input ("loadd", OP_RP_INDEX_DISP0
, OP_REGP
, OP_VOID
);
3354 addr
= (GPR32 (12)) + (GPR32 (OP
[2])) + OP
[1];
3356 addr
= (GPR32 (13)) + (GPR32 (OP
[2])) + OP
[1];
3359 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3360 SET_GPR32 (OP
[3], tmp
);
3361 trace_output_32 (sd
, tmp
);
3367 OP_21A_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3369 /* loadd [Rindex]disp14(RPbasex) REGP
3370 * ADDR = Rpbasex + Rindex + zext24(disp14)
3374 trace_input ("loadd", OP_RP_INDEX_DISP14
, OP_REGP
, OP_VOID
);
3377 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3379 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3382 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3383 SET_GPR (OP
[3],tmp
);
3384 trace_output_32 (sd
, tmp
);
3390 OP_188_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3392 /* loadd dispe20(REG) REG
3393 * zext24(Rbase) + zext24(dispe20)
3396 uint32 tmp
, addr
= OP
[0] + (GPR (OP
[1]));
3397 trace_input ("loadd", OP_R_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3399 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3400 SET_GPR32 (OP
[2], tmp
);
3401 trace_output_32 (sd
, tmp
);
3407 OP_128_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3409 /* loadd DISP20(REG) REG
3410 * ADDR = zext24(Rbase) + zext24(disp20)
3413 uint32 tmp
, addr
= OP
[0] + (GPR (OP
[1]));
3414 trace_input ("loadd", OP_R_BASE_DISP20
, OP_REGP
, OP_VOID
);
3416 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3417 SET_GPR32 (OP
[2], tmp
);
3418 trace_output_32 (sd
, tmp
);
3423 OP_AF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3425 /* loadd disp16(REGP) REGP
3426 * ADDR = RPbase + zext24(disp16)
3428 uint32 tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3429 trace_input ("loadd", OP_RP_BASE_DISP16
, OP_REGP
, OP_VOID
);
3431 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3432 SET_GPR32 (OP
[2], tmp
);
3433 trace_output_32 (sd
, tmp
);
3439 OP_129_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3441 /* loadd disp20(REGP) REGP
3442 * ADDR = RPbase + zext24(disp20)
3444 uint32 tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3445 trace_input ("loadd", OP_RP_BASE_DISP20
, OP_REGP
, OP_VOID
);
3447 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3448 SET_GPR32 (OP
[2], tmp
);
3449 trace_output_32 (sd
, tmp
);
3454 OP_189_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3456 /* loadd -disp20(REGP) REGP
3457 * ADDR = RPbase + zext24(-disp20)
3460 uint32 tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3461 trace_input ("loadd", OP_RP_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3463 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3464 SET_GPR32 (OP
[2], tmp
);
3465 trace_output_32 (sd
, tmp
);
3470 OP_12A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3472 /* loadd [Rindex]disp20(RPbasexb) REGP
3473 * ADDR = RPbasex + Rindex + zext24(disp20)
3477 trace_input ("loadd", OP_RP_INDEX_DISP20
, OP_REGP
, OP_VOID
);
3480 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3482 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3485 tmp
= ((tmp
<< 16) & 0xffff)| ((tmp
>> 16) & 0xffff);
3486 SET_GPR32 (OP
[3], tmp
);
3487 trace_output_32 (sd
, tmp
);
3493 OP_C8_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3496 * ADDR = zext24(abs20) | remap
3499 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
3500 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
3501 * by the core to 16M-64k to 16M. */
3503 uint8 a
= ((GPR (OP
[0])) & 0xff);
3504 uint32 addr
= OP
[1];
3505 trace_input ("storb", OP_REG
, OP_ABS20_OUTPUT
, OP_VOID
);
3507 trace_output_32 (sd
, addr
);
3512 OP_137_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3518 uint8 a
= ((GPR (OP
[0])) & 0xff);
3519 uint32 addr
= OP
[1];
3520 trace_input ("storb", OP_REG
, OP_ABS24_OUTPUT
, OP_VOID
);
3522 trace_output_32 (sd
, addr
);
3527 OP_65_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3529 /* storb REG, [Rindex]ABS20
3530 * ADDR = Rindex + zext24(disp20)
3534 uint8 a
= ((GPR (OP
[0])) & 0xff);
3535 trace_input ("storb", OP_REG
, OP_R_INDEX8_ABS20
, OP_VOID
);
3538 addr
= (GPR32 (12)) + OP
[2];
3540 addr
= (GPR32 (13)) + OP
[2];
3543 trace_output_32 (sd
, addr
);
3548 OP_F_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3550 /* storb REG, DIPS4(REGP)
3551 * ADDR = RPBASE + zext24(DISP4)
3554 uint16 a
= ((GPR (OP
[0])) & 0xff);
3555 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3556 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPE4
, OP_VOID
);
3558 trace_output_32 (sd
, addr
);
3563 OP_FE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3565 /* storb [Rindex]disp0(RPbasex) REG
3566 * ADDR = Rpbasex + Rindex
3570 uint8 a
= ((GPR (OP
[0])) & 0xff);
3571 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISP0
, OP_VOID
);
3574 addr
= (GPR32 (12)) + (GPR32 (OP
[3])) + OP
[2];
3576 addr
= (GPR32 (13)) + (GPR32 (OP
[3])) + OP
[2];
3579 trace_output_32 (sd
, addr
);
3584 OP_319_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3586 /* storb REG, [Rindex]disp14(RPbasex)
3587 * ADDR = Rpbasex + Rindex + zext24(disp14)
3590 uint8 a
= ((GPR (OP
[0])) & 0xff);
3591 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3592 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISP14
, OP_VOID
);
3594 trace_output_32 (sd
, addr
);
3599 OP_194_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3601 /* storb REG, DISPE20(REG)
3602 * zext24(Rbase) + zext24(dispe20)
3605 uint8 a
= ((GPR (OP
[0])) & 0xff);
3606 uint32 addr
= OP
[1] + (GPR (OP
[2]));
3607 trace_input ("storb", OP_REG
, OP_R_BASE_DISPE20
, OP_VOID
);
3609 trace_output_32 (sd
, addr
);
3614 OP_134_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3616 /* storb REG, DISP20(REG)
3617 * ADDR = zext24(Rbase) + zext24(disp20)
3620 uint8 a
= (GPR (OP
[0]) & 0xff);
3621 uint32 addr
= OP
[1] + (GPR (OP
[2]));
3622 trace_input ("storb", OP_REG
, OP_R_BASE_DISPS20
, OP_VOID
);
3624 trace_output_32 (sd
, addr
);
3629 OP_FF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3631 /* storb REG, disp16(REGP)
3632 * ADDR = RPbase + zext24(disp16)
3635 uint8 a
= ((GPR (OP
[0])) & 0xff);
3636 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3637 trace_input ("storb", OP_REG
, OP_RP_BASE_DISP16
, OP_VOID
);
3639 trace_output_32 (sd
, addr
);
3644 OP_135_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3646 /* storb REG, disp20(REGP)
3647 * ADDR = RPbase + zext24(disp20)
3650 uint8 a
= ((GPR (OP
[0])) & 0xff);
3651 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3652 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPS20
, OP_VOID
);
3654 trace_output_32 (sd
, addr
);
3659 OP_195_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3661 /* storb REG, -disp20(REGP)
3662 * ADDR = RPbase + zext24(-disp20)
3665 uint8 a
= (GPR (OP
[0]) & 0xff);
3666 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3667 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPE20
, OP_VOID
);
3669 trace_output_32 (sd
, addr
);
3674 OP_136_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3676 /* storb REG, [Rindex]disp20(RPbase)
3677 * ADDR = RPbasex + Rindex + zext24(disp20)
3680 uint8 a
= (GPR (OP
[0])) & 0xff;
3681 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3682 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3684 trace_output_32 (sd
, addr
);
3687 /* STR_IMM instructions. */
3690 OP_81_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3692 uint8 a
= (OP
[0]) & 0xff;
3693 uint32 addr
= OP
[1];
3694 trace_input ("storb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
3696 trace_output_32 (sd
, addr
);
3701 OP_123_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3703 uint8 a
= (OP
[0]) & 0xff;
3704 uint32 addr
= OP
[1];
3705 trace_input ("storb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
3707 trace_output_32 (sd
, addr
);
3712 OP_42_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3715 uint8 a
= (OP
[0]) & 0xff;
3716 trace_input ("storb", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
3719 addr
= (GPR32 (12)) + OP
[2];
3721 addr
= (GPR32 (13)) + OP
[2];
3724 trace_output_32 (sd
, addr
);
3729 OP_218_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3731 uint8 a
= (OP
[0]) & 0xff;
3732 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3733 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISP14
, OP_VOID
);
3735 trace_output_32 (sd
, addr
);
3740 OP_82_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3742 uint8 a
= (OP
[0]) & 0xff;
3743 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3744 trace_input ("storb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
3746 trace_output_32 (sd
, addr
);
3751 OP_120_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3753 uint8 a
= (OP
[0]) & 0xff;
3754 uint32 addr
= (GPR (OP
[2])) + OP
[1];
3755 trace_input ("storb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
3757 trace_output_32 (sd
, addr
);
3762 OP_83_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3764 uint8 a
= (OP
[0]) & 0xff;
3765 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3766 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
3768 trace_output_32 (sd
, addr
);
3773 OP_121_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3775 uint8 a
= (OP
[0]) & 0xff;
3776 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3777 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
3779 trace_output_32 (sd
, addr
);
3784 OP_122_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3786 uint8 a
= (OP
[0]) & 0xff;
3787 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3788 trace_input ("storb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3790 trace_output_32 (sd
, addr
);
3792 /* endif for STR_IMM. */
3796 OP_C9_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3798 uint16 a
= GPR (OP
[0]);
3799 uint32 addr
= OP
[1];
3800 trace_input ("storw", OP_REG
, OP_ABS20_OUTPUT
, OP_VOID
);
3802 trace_output_32 (sd
, addr
);
3807 OP_13F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3809 uint16 a
= GPR (OP
[0]);
3810 uint32 addr
= OP
[1];
3811 trace_input ("storw", OP_REG
, OP_ABS24_OUTPUT
, OP_VOID
);
3813 trace_output_32 (sd
, addr
);
3818 OP_67_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3821 uint16 a
= GPR (OP
[0]);
3822 trace_input ("storw", OP_REG
, OP_R_INDEX8_ABS20
, OP_VOID
);
3825 addr
= (GPR32 (12)) + OP
[2];
3827 addr
= (GPR32 (13)) + OP
[2];
3830 trace_output_32 (sd
, addr
);
3836 OP_D_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3838 uint16 a
= (GPR (OP
[0]));
3839 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3840 trace_input ("storw", OP_REGP
, OP_RP_BASE_DISPE4
, OP_VOID
);
3842 trace_output_32 (sd
, addr
);
3847 OP_DE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3849 uint16 a
= GPR (OP
[0]);
3850 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3851 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISP0
, OP_VOID
);
3853 trace_output_32 (sd
, addr
);
3858 OP_31B_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3860 uint16 a
= GPR (OP
[0]);
3861 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3862 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISP14
, OP_VOID
);
3864 trace_output_32 (sd
, addr
);
3869 OP_19C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3871 uint16 a
= (GPR (OP
[0]));
3872 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3873 trace_input ("storw", OP_REGP
, OP_RP_BASE_DISPE20
, OP_VOID
);
3875 trace_output_32 (sd
, addr
);
3880 OP_13C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3882 uint16 a
= (GPR (OP
[0]));
3883 uint32 addr
= (GPR (OP
[2])) + OP
[1];
3884 trace_input ("storw", OP_REG
, OP_R_BASE_DISPS20
, OP_VOID
);
3886 trace_output_32 (sd
, addr
);
3891 OP_DF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3893 uint16 a
= (GPR (OP
[0]));
3894 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3895 trace_input ("storw", OP_REG
, OP_RP_BASE_DISP16
, OP_VOID
);
3897 trace_output_32 (sd
, addr
);
3902 OP_13D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3904 uint16 a
= (GPR (OP
[0]));
3905 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3906 trace_input ("storw", OP_REG
, OP_RP_BASE_DISPS20
, OP_VOID
);
3908 trace_output_32 (sd
, addr
);
3913 OP_19D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3915 uint16 a
= (GPR (OP
[0]));
3916 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3917 trace_input ("storw", OP_REG
, OP_RP_BASE_DISPE20
, OP_VOID
);
3919 trace_output_32 (sd
, addr
);
3924 OP_13E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3926 uint16 a
= (GPR (OP
[0]));
3927 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3928 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3930 trace_output_32 (sd
, addr
);
3933 /* STORE-w IMM instruction *****/
3936 OP_C1_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3939 uint32 addr
= OP
[1];
3940 trace_input ("storw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
3942 trace_output_32 (sd
, addr
);
3947 OP_133_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3950 uint32 addr
= OP
[1];
3951 trace_input ("storw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
3953 trace_output_32 (sd
, addr
);
3958 OP_62_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3962 trace_input ("storw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
3965 addr
= (GPR32 (12)) + OP
[2];
3967 addr
= (GPR32 (13)) + OP
[2];
3970 trace_output_32 (sd
, addr
);
3975 OP_318_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3978 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3979 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISP14
, OP_VOID
);
3981 trace_output_32 (sd
, addr
);
3986 OP_C2_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3989 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3990 trace_input ("storw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
3992 trace_output_32 (sd
, addr
);
3997 OP_130_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4000 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4001 trace_input ("storw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
4003 trace_output_32 (sd
, addr
);
4008 OP_C3_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4011 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4012 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
4014 trace_output_32 (sd
, addr
);
4020 OP_131_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4023 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4024 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
4026 trace_output_32 (sd
, addr
);
4031 OP_132_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4034 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4035 trace_input ("storw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
4037 trace_output_32 (sd
, addr
);
4043 OP_C7_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4045 uint32 a
= GPR32 (OP
[0]);
4046 uint32 addr
= OP
[1];
4047 trace_input ("stord", OP_REGP
, OP_ABS20_OUTPUT
, OP_VOID
);
4049 trace_output_32 (sd
, addr
);
4054 OP_13B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4056 uint32 a
= GPR32 (OP
[0]);
4057 uint32 addr
= OP
[1];
4058 trace_input ("stord", OP_REGP
, OP_ABS24_OUTPUT
, OP_VOID
);
4060 trace_output_32 (sd
, addr
);
4065 OP_66_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4067 uint32 addr
, a
= GPR32 (OP
[0]);
4068 trace_input ("stord", OP_REGP
, OP_R_INDEX8_ABS20
, OP_VOID
);
4071 addr
= (GPR32 (12)) + OP
[2];
4073 addr
= (GPR32 (13)) + OP
[2];
4076 trace_output_32 (sd
, addr
);
4081 OP_E_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
4083 uint32 a
= GPR32 (OP
[0]);
4084 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4085 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPE4
, OP_VOID
);
4087 trace_output_32 (sd
, addr
);
4092 OP_EE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4094 uint32 a
= GPR32 (OP
[0]);
4095 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4096 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISP0
, OP_VOID
);
4098 trace_output_32 (sd
, addr
);
4103 OP_31A_A (SIM_DESC sd
, SIM_CPU
*cpu
)
4105 uint32 a
= GPR32 (OP
[0]);
4106 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4107 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISP14
, OP_VOID
);
4109 trace_output_32 (sd
, addr
);
4114 OP_198_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4116 uint32 a
= GPR32 (OP
[0]);
4117 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4118 trace_input ("stord", OP_REGP
, OP_R_BASE_DISPE20
, OP_VOID
);
4120 trace_output_32 (sd
, addr
);
4125 OP_138_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4127 uint32 a
= GPR32 (OP
[0]);
4128 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4129 trace_input ("stord", OP_REGP
, OP_R_BASE_DISPS20
, OP_VOID
);
4131 trace_output_32 (sd
, addr
);
4136 OP_EF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4138 uint32 a
= GPR32 (OP
[0]);
4139 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4140 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISP16
, OP_VOID
);
4142 trace_output_32 (sd
, addr
);
4147 OP_139_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4149 uint32 a
= GPR32 (OP
[0]);
4150 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4151 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPS20
, OP_VOID
);
4153 trace_output_32 (sd
, addr
);
4158 OP_199_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4160 uint32 a
= GPR32 (OP
[0]);
4161 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4162 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPE20
, OP_VOID
);
4164 trace_output_32 (sd
, addr
);
4169 OP_13A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4171 uint32 a
= GPR32 (OP
[0]);
4172 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4173 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISPS20
, OP_VOID
);
4175 trace_output_32 (sd
, addr
);
4180 OP_14D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4184 trace_input ("macuw", OP_REG
, OP_REG
, OP_REGP
);
4188 /*REVISIT FOR SATURATION and Q FORMAT. */
4189 SET_GPR32 (OP
[2], tmp
);
4190 trace_output_32 (sd
, tmp
);
4195 OP_14E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4199 trace_input ("macuw", OP_REG
, OP_REG
, OP_REGP
);
4203 /*REVISIT FOR SATURATION. */
4204 SET_GPR32 (OP
[2], tmp
);
4205 trace_output_32 (sd
, tmp
);
4210 OP_14F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4214 trace_input ("macsw", OP_REG
, OP_REG
, OP_REGP
);
4218 /*REVISIT FOR SATURATION. */
4219 SET_GPR32 (OP
[2], tmp
);
4220 trace_output_32 (sd
, tmp
);
4226 OP_64_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4229 int8 a
= (OP
[0]) & 0xff;
4230 int8 b
= (GPR (OP
[1])) & 0xff;
4231 trace_input ("mulb", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
4232 tmp
= (a
* b
) & 0xff;
4233 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4234 trace_output_16 (sd
, tmp
);
4239 OP_64B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4242 int8 a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4243 trace_input ("mulb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4244 tmp
= (a
* b
) & 0xff;
4245 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4246 trace_output_16 (sd
, tmp
);
4252 OP_65_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4255 int8 a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4256 trace_input ("mulb", OP_REG
, OP_REG
, OP_VOID
);
4257 tmp
= (a
* b
) & 0xff;
4258 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4259 trace_output_16 (sd
, tmp
);
4265 OP_66_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4269 int16 b
= (GPR (OP
[1]));
4270 trace_input ("mulw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
4271 tmp
= (a
* b
) & 0xffff;
4272 SET_GPR (OP
[1], tmp
);
4273 trace_output_32 (sd
, tmp
);
4278 OP_66B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4281 int16 a
= OP
[0], b
= (GPR (OP
[1]));
4282 trace_input ("mulw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4283 tmp
= (a
* b
) & 0xffff;
4284 SET_GPR (OP
[1], tmp
);
4285 trace_output_32 (sd
, tmp
);
4291 OP_67_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4294 int16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4295 trace_input ("mulw", OP_REG
, OP_REG
, OP_VOID
);
4296 tmp
= (a
* b
) & 0xffff;
4297 SET_GPR (OP
[1], tmp
);
4298 trace_output_32 (sd
, tmp
);
4304 OP_B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4307 int8 a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4308 trace_input ("mulsb", OP_REG
, OP_REG
, OP_VOID
);
4310 SET_GPR (OP
[1], tmp
);
4311 trace_output_32 (sd
, tmp
);
4316 OP_62_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4319 int16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4320 trace_input ("mulsw", OP_REG
, OP_REGP
, OP_VOID
);
4322 SET_GPR32 (OP
[1], tmp
);
4323 trace_output_32 (sd
, tmp
);
4328 OP_63_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4331 uint16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4332 trace_input ("muluw", OP_REG
, OP_REGP
, OP_VOID
);
4334 SET_GPR32 (OP
[1], tmp
);
4335 trace_output_32 (sd
, tmp
);
4341 OP_2C00_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
4343 trace_input ("nop", OP_VOID
, OP_VOID
, OP_VOID
);
4346 ins_type_counters
[ (int)State
.ins_type
]--; /* don't count nops as normal instructions */
4347 switch (State
.ins_type
)
4350 ins_type_counters
[ (int)INS_UNKNOWN
]++;
4354 EXCEPTION (SIM_SIGTRAP
);
4356 trace_output_void (sd
);
4362 OP_24_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4364 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4365 trace_input ("orb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4367 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4368 trace_output_16 (sd
, tmp
);
4373 OP_24B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4375 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4376 trace_input ("orb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4378 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4379 trace_output_16 (sd
, tmp
);
4384 OP_25_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4386 uint8 tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4387 trace_input ("orb", OP_REG
, OP_REG
, OP_VOID
);
4389 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4390 trace_output_16 (sd
, tmp
);
4395 OP_26_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4397 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
4398 trace_input ("orw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4400 SET_GPR (OP
[1], tmp
);
4401 trace_output_16 (sd
, tmp
);
4407 OP_26B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4409 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
4410 trace_input ("orw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4412 SET_GPR (OP
[1], tmp
);
4413 trace_output_16 (sd
, tmp
);
4418 OP_27_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4420 uint16 tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4421 trace_input ("orw", OP_REG
, OP_REG
, OP_VOID
);
4423 SET_GPR (OP
[1], tmp
);
4424 trace_output_16 (sd
, tmp
);
4430 OP_13_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
4433 uint16 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4434 trace_input ("lshb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4435 /* A positive count specifies a shift to the left;
4436 * A negative count specifies a shift to the right. */
4442 sign_flag
= 0; /* Reset sign_flag. */
4444 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4445 trace_output_16 (sd
, tmp
);
4450 OP_44_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4452 uint16 a
= (GPR (OP
[0])) & 0xff;
4453 uint16 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4454 trace_input ("lshb", OP_REG
, OP_REG
, OP_VOID
);
4455 if (a
& ((long)1 << 3))
4460 a
= (unsigned int) (a
& 0x7);
4462 /* A positive count specifies a shift to the left;
4463 * A negative count specifies a shift to the right. */
4469 sign_flag
= 0; /* Reset sign_flag. */
4470 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4471 trace_output_16 (sd
, tmp
);
4476 OP_46_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4478 uint16 tmp
, b
= GPR (OP
[1]);
4479 int16 a
= GPR (OP
[0]);
4480 trace_input ("lshw", OP_REG
, OP_REG
, OP_VOID
);
4481 if (a
& ((long)1 << 4))
4486 a
= (unsigned int) (a
& 0xf);
4488 /* A positive count specifies a shift to the left;
4489 * A negative count specifies a shift to the right. */
4495 sign_flag
= 0; /* Reset sign_flag. */
4496 SET_GPR (OP
[1], (tmp
& 0xffff));
4497 trace_output_16 (sd
, tmp
);
4502 OP_49_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4504 uint16 tmp
, b
= GPR (OP
[1]);
4506 trace_input ("lshw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4507 /* A positive count specifies a shift to the left;
4508 * A negative count specifies a shift to the right. */
4514 sign_flag
= 0; /* Reset sign_flag. */
4515 SET_GPR (OP
[1], (tmp
& 0xffff));
4516 trace_output_16 (sd
, tmp
);
4521 OP_25_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4523 uint32 tmp
, b
= GPR32 (OP
[1]);
4525 trace_input ("lshd", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4526 /* A positive count specifies a shift to the left;
4527 * A negative count specifies a shift to the right. */
4533 sign_flag
= 0; /* Reset sign flag. */
4535 SET_GPR32 (OP
[1], tmp
);
4536 trace_output_32 (sd
, tmp
);
4541 OP_47_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4543 uint32 tmp
, b
= GPR32 (OP
[1]);
4544 uint16 a
= GPR (OP
[0]);
4545 trace_input ("lshd", OP_REG
, OP_REGP
, OP_VOID
);
4546 if (a
& ((long)1 << 5))
4551 a
= (unsigned int) (a
& 0x1f);
4552 /* A positive count specifies a shift to the left;
4553 * A negative count specifies a shift to the right. */
4559 sign_flag
= 0; /* Reset sign flag. */
4561 SET_GPR32 (OP
[1], tmp
);
4562 trace_output_32 (sd
, tmp
);
4567 OP_80_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
4570 int8 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4571 trace_input ("ashub", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4572 /* A positive count specifies a shift to the left;
4573 * A negative count specifies a shift to the right. */
4579 sign_flag
= 0; /* Reset sign flag. */
4581 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xff00)));
4582 trace_output_16 (sd
, tmp
);
4587 OP_81_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
4590 int8 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4591 trace_input ("ashub", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4592 /* A positive count specifies a shift to the left;
4593 * A negative count specifies a shift to the right. */
4599 sign_flag
= 0; /* Reset sign flag. */
4601 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4602 trace_output_16 (sd
, tmp
);
4608 OP_41_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4610 int16 a
= (GPR (OP
[0]));
4611 int8 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4612 trace_input ("ashub", OP_REG
, OP_REG
, OP_VOID
);
4614 if (a
& ((long)1 << 3))
4619 a
= (unsigned int) (a
& 0x7);
4621 /* A positive count specifies a shift to the left;
4622 * A negative count specifies a shift to the right. */
4628 sign_flag
= 0; /* Reset sign flag. */
4630 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4631 trace_output_16 (sd
, tmp
);
4637 OP_42_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4639 int16 tmp
, b
= GPR (OP
[1]);
4641 trace_input ("ashuw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4642 /* A positive count specifies a shift to the left;
4643 * A negative count specifies a shift to the right. */
4649 sign_flag
= 0; /* Reset sign flag. */
4651 SET_GPR (OP
[1], (tmp
& 0xffff));
4652 trace_output_16 (sd
, tmp
);
4657 OP_43_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4659 int16 tmp
, b
= GPR (OP
[1]);
4661 trace_input ("ashuw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4662 /* A positive count specifies a shift to the left;
4663 * A negative count specifies a shift to the right. */
4669 sign_flag
= 0; /* Reset sign flag. */
4670 SET_GPR (OP
[1], (tmp
& 0xffff));
4671 trace_output_16 (sd
, tmp
);
4676 OP_45_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4679 int16 a
= GPR (OP
[0]), b
= GPR (OP
[1]);
4680 trace_input ("ashuw", OP_REG
, OP_REG
, OP_VOID
);
4682 if (a
& ((long)1 << 4))
4687 a
= (unsigned int) (a
& 0xf);
4688 /* A positive count specifies a shift to the left;
4689 * A negative count specifies a shift to the right. */
4696 sign_flag
= 0; /* Reset sign flag. */
4697 SET_GPR (OP
[1], (tmp
& 0xffff));
4698 trace_output_16 (sd
, tmp
);
4703 OP_26_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4705 int32 tmp
,b
= GPR32 (OP
[1]);
4707 trace_input ("ashud", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4708 /* A positive count specifies a shift to the left;
4709 * A negative count specifies a shift to the right. */
4715 sign_flag
= 0; /* Reset sign flag. */
4716 SET_GPR32 (OP
[1], tmp
);
4717 trace_output_32 (sd
, tmp
);
4722 OP_27_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4725 int32 a
= OP
[0], b
= GPR32 (OP
[1]);
4726 trace_input ("ashud", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4727 /* A positive count specifies a shift to the left;
4728 * A negative count specifies a shift to the right. */
4734 sign_flag
= 0; /* Reset sign flag. */
4735 SET_GPR32 (OP
[1], tmp
);
4736 trace_output_32 (sd
, tmp
);
4741 OP_48_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4744 int32 a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
4745 trace_input ("ashud", OP_REGP
, OP_REGP
, OP_VOID
);
4747 if (a
& ((long)1 << 5))
4752 a
= (unsigned int) (a
& 0x1f);
4753 /* A positive count specifies a shift to the left;
4754 * A negative count specifies a shift to the right. */
4760 sign_flag
= 0; /* Reset sign flag. */
4761 SET_GPR32 (OP
[1], tmp
);
4762 trace_output_32 (sd
, tmp
);
4768 OP_16_D (SIM_DESC sd
, SIM_CPU
*cpu
)
4770 uint32 addr
= GPR (1);
4771 uint16 count
= OP
[0], reg
= 2;
4772 trace_input ("storm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
4775 trace_output_void (sd
);
4776 EXCEPTION (SIM_SIGBUS
);
4781 SW (addr
, (GPR (reg
)));
4785 if (reg
== 6) reg
= 8;
4790 trace_output_void (sd
);
4796 OP_17_D (SIM_DESC sd
, SIM_CPU
*cpu
)
4798 uint32 addr
= GPR32 (6);
4799 uint16 count
= OP
[0], reg
= 2;
4800 trace_input ("stormp", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
4803 trace_output_void (sd
);
4804 EXCEPTION (SIM_SIGBUS
);
4809 SW (addr
, (GPR (reg
)));
4813 if (reg
== 6) reg
= 8;
4816 SET_GPR32 (6, addr
);
4817 trace_output_void (sd
);
4822 OP_38_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4825 uint8 b
= (GPR (OP
[1])) & 0xff;
4826 uint16 tmp
= (~a
+ 1 + b
) & 0xff;
4827 trace_input ("subb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4828 /* see ../common/sim-alu.h for a more extensive discussion on how to
4829 compute the carry/overflow bits. */
4830 SET_PSR_C (tmp
> 0xff);
4831 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4832 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4833 trace_output_16 (sd
, tmp
);
4838 OP_38B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4840 uint8 a
= OP
[0] & 0xFF;
4841 uint8 b
= (GPR (OP
[1])) & 0xFF;
4842 uint16 tmp
= (~a
+ 1 + b
) & 0xFF;
4843 trace_input ("subb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4844 /* see ../common/sim-alu.h for a more extensive discussion on how to
4845 compute the carry/overflow bits. */
4846 SET_PSR_C (tmp
> 0xff);
4847 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4848 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4849 trace_output_16 (sd
, tmp
);
4854 OP_39_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4856 uint8 a
= (GPR (OP
[0])) & 0xFF;
4857 uint8 b
= (GPR (OP
[1])) & 0xFF;
4858 uint16 tmp
= (~a
+ 1 + b
) & 0xff;
4859 trace_input ("subb", OP_REG
, OP_REG
, OP_VOID
);
4860 /* see ../common/sim-alu.h for a more extensive discussion on how to
4861 compute the carry/overflow bits. */
4862 SET_PSR_C (tmp
> 0xff);
4863 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4864 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4865 trace_output_16 (sd
, tmp
);
4870 OP_3A_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4873 uint16 b
= GPR (OP
[1]);
4874 uint16 tmp
= (~a
+ 1 + b
);
4875 trace_input ("subw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4876 /* see ../common/sim-alu.h for a more extensive discussion on how to
4877 compute the carry/overflow bits. */
4878 SET_PSR_C (tmp
> 0xffff);
4879 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4880 SET_GPR (OP
[1], tmp
);
4881 trace_output_16 (sd
, tmp
);
4886 OP_3AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4889 uint16 b
= GPR (OP
[1]);
4890 uint32 tmp
= (~a
+ 1 + b
);
4891 trace_input ("subw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4892 /* see ../common/sim-alu.h for a more extensive discussion on how to
4893 compute the carry/overflow bits. */
4894 SET_PSR_C (tmp
> 0xffff);
4895 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4896 SET_GPR (OP
[1], tmp
& 0xffff);
4897 trace_output_16 (sd
, tmp
);
4902 OP_3B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4904 uint16 a
= GPR (OP
[0]);
4905 uint16 b
= GPR (OP
[1]);
4906 uint32 tmp
= (~a
+ 1 + b
);
4907 trace_input ("subw", OP_REG
, OP_REG
, OP_VOID
);
4908 /* see ../common/sim-alu.h for a more extensive discussion on how to
4909 compute the carry/overflow bits. */
4910 SET_PSR_C (tmp
> 0xffff);
4911 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4912 SET_GPR (OP
[1], tmp
& 0xffff);
4913 trace_output_16 (sd
, tmp
);
4918 OP_3C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4921 uint8 b
= (GPR (OP
[1])) & 0xff;
4922 //uint16 tmp1 = a + 1;
4923 uint16 tmp1
= a
+ (PSR_C
);
4924 uint16 tmp
= (~tmp1
+ 1 + b
);
4925 trace_input ("subcb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4926 /* see ../common/sim-alu.h for a more extensive discussion on how to
4927 compute the carry/overflow bits. */
4928 SET_PSR_C (tmp
> 0xff);
4929 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4930 SET_GPR (OP
[1], tmp
);
4931 trace_output_16 (sd
, tmp
);
4936 OP_3CB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4939 uint16 b
= (GPR (OP
[1])) & 0xff;
4940 //uint16 tmp1 = a + 1;
4941 uint16 tmp1
= a
+ (PSR_C
);
4942 uint16 tmp
= (~tmp1
+ 1 + b
);
4943 trace_input ("subcb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4944 /* see ../common/sim-alu.h for a more extensive discussion on how to
4945 compute the carry/overflow bits. */
4946 SET_PSR_C (tmp
> 0xff);
4947 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4948 SET_GPR (OP
[1], tmp
);
4949 trace_output_16 (sd
, tmp
);
4954 OP_3D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4956 uint16 a
= (GPR (OP
[0])) & 0xff;
4957 uint16 b
= (GPR (OP
[1])) & 0xff;
4958 uint16 tmp1
= a
+ (PSR_C
);
4959 uint16 tmp
= (~tmp1
+ 1 + b
);
4960 trace_input ("subcb", OP_REG
, OP_REG
, OP_VOID
);
4961 /* see ../common/sim-alu.h for a more extensive discussion on how to
4962 compute the carry/overflow bits. */
4963 SET_PSR_C (tmp
> 0xff);
4964 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4965 SET_GPR (OP
[1], tmp
);
4966 trace_output_16 (sd
, tmp
);
4971 OP_3E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4973 uint16 a
= OP
[0], b
= (GPR (OP
[1]));
4974 uint16 tmp1
= a
+ (PSR_C
);
4975 uint16 tmp
= (~tmp1
+ 1 + b
);
4976 trace_input ("subcw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4977 /* see ../common/sim-alu.h for a more extensive discussion on how to
4978 compute the carry/overflow bits. */
4979 SET_PSR_C (tmp
> 0xffff);
4980 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4981 SET_GPR (OP
[1], tmp
);
4982 trace_output_16 (sd
, tmp
);
4987 OP_3EB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4990 uint16 b
= GPR (OP
[1]);
4991 uint16 tmp1
= a
+ (PSR_C
);
4992 uint16 tmp
= (~tmp1
+ 1 + b
);
4993 trace_input ("subcw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4994 /* see ../common/sim-alu.h for a more extensive discussion on how to
4995 compute the carry/overflow bits. */
4996 SET_PSR_C (tmp
> 0xffff);
4997 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4998 SET_GPR (OP
[1], tmp
);
4999 trace_output_16 (sd
, tmp
);
5004 OP_3F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5006 uint16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
5007 uint16 tmp1
= a
+ (PSR_C
);
5008 uint16 tmp
= (~tmp1
+ 1 + b
);
5009 trace_input ("subcw", OP_REG
, OP_REG
, OP_VOID
);
5010 /* see ../common/sim-alu.h for a more extensive discussion on how to
5011 compute the carry/overflow bits. */
5012 SET_PSR_C (tmp
> 0xffff);
5013 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
5014 SET_GPR (OP
[1], tmp
);
5015 trace_output_16 (sd
, tmp
);
5020 OP_3_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5023 uint32 b
= GPR32 (OP
[1]);
5024 uint32 tmp
= (~a
+ 1 + b
);
5025 trace_input ("subd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
5026 /* see ../common/sim-alu.h for a more extensive discussion on how to
5027 compute the carry/overflow bits. */
5028 SET_PSR_C (tmp
> 0xffffffff);
5029 SET_PSR_F (((a
& 0x80000000) != (b
& 0x80000000)) &&
5030 ((b
& 0x80000000) != (tmp
& 0x80000000)));
5031 SET_GPR32 (OP
[1], tmp
);
5032 trace_output_32 (sd
, tmp
);
5037 OP_14C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5039 uint32 a
= GPR32 (OP
[0]);
5040 uint32 b
= GPR32 (OP
[1]);
5041 uint32 tmp
= (~a
+ 1 + b
);
5042 trace_input ("subd", OP_REGP
, OP_REGP
, OP_VOID
);
5043 /* see ../common/sim-alu.h for a more extensive discussion on how to
5044 compute the carry/overflow bits. */
5045 SET_PSR_C (tmp
> 0xffffffff);
5046 SET_PSR_F (((a
& 0x80000000) != (b
& 0x80000000)) &&
5047 ((b
& 0x80000000) != (tmp
& 0x80000000)));
5048 SET_GPR32 (OP
[1], tmp
);
5049 trace_output_32 (sd
, tmp
);
5054 OP_C_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5056 host_callback
*cb
= STATE_CALLBACK (sd
);
5059 trace_input ("excp", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
5063 #if (DEBUG & DEBUG_TRAP) == 0
5066 uint16 vec
= OP
[0] + TRAP_VECTOR_START
;
5069 SET_PSR (PSR
& PSR_SM_BIT
);
5074 #else /* if debugging use trap to print registers */
5077 static int first_time
= 1;
5082 sim_io_printf (sd
, "Trap # PC ");
5083 for (i
= 0; i
< 16; i
++)
5084 sim_io_printf (sd
, " %sr%d", (i
> 9) ? "" : " ", i
);
5085 sim_io_printf (sd
, " a0 a1 f0 f1 c\n");
5088 sim_io_printf (sd
, "Trap %2d 0x%.4x:", (int)OP
[0], (int)PC
);
5090 for (i
= 0; i
< 16; i
++)
5091 sim_io_printf (sd
, " %.4x", (int) GPR (i
));
5093 for (i
= 0; i
< 2; i
++)
5094 sim_io_printf (sd
, " %.2x%.8lx",
5095 ((int)(ACC (i
) >> 32) & 0xff),
5096 ((unsigned long) ACC (i
)) & 0xffffffff);
5098 sim_io_printf (sd
, " %d %d %d\n",
5099 PSR_F
!= 0, PSR_F
!= 0, PSR_C
!= 0);
5100 sim_io_flush_stdout (sd
);
5104 case 8: /* new system call trap */
5105 /* Trap 8 is used for simulating low-level I/O */
5107 unsigned32 result
= 0;
5110 /* Registers passed to trap 0. */
5112 #define FUNC GPR (0) /* function number. */
5113 #define PARM1 GPR (2) /* optional parm 1. */
5114 #define PARM2 GPR (3) /* optional parm 2. */
5115 #define PARM3 GPR (4) /* optional parm 3. */
5116 #define PARM4 GPR (5) /* optional parm 4. */
5118 /* Registers set by trap 0 */
5120 #define RETVAL(X) do { result = (0xffff & (X));SET_GPR (0, result);} while (0)
5121 #define RETVAL32(X) do { result = (X); SET_GPR32 (0, result);} while (0)
5122 #define RETERR(X) SET_GPR (4, (X)) /* return error code. */
5124 /* Turn a pointer in a register into a pointer into real memory. */
5126 #define MEMPTR(x) sim_core_trans_addr (sd, cpu, read_map, x)
5130 #if !defined(__GO32__) && !defined(_WIN32)
5131 #ifdef TARGET_SYS_fork
5132 case TARGET_SYS_fork
:
5133 trace_input ("<fork>", OP_VOID
, OP_VOID
, OP_VOID
);
5135 trace_output_16 (sd
, result
);
5140 case TARGET_SYS_getpid
:
5141 trace_input ("<getpid>", OP_VOID
, OP_VOID
, OP_VOID
);
5143 trace_output_16 (sd
, result
);
5146 case TARGET_SYS_kill
:
5147 trace_input ("<kill>", OP_REG
, OP_REG
, OP_VOID
);
5148 if (PARM1
== getpid ())
5150 trace_output_void (sd
);
5159 case 1: os_sig
= SIGHUP
; break;
5162 case 2: os_sig
= SIGINT
; break;
5165 case 3: os_sig
= SIGQUIT
; break;
5168 case 4: os_sig
= SIGILL
; break;
5171 case 5: os_sig
= SIGTRAP
; break;
5174 case 6: os_sig
= SIGABRT
; break;
5175 #elif defined(SIGIOT)
5176 case 6: os_sig
= SIGIOT
; break;
5179 case 7: os_sig
= SIGEMT
; break;
5182 case 8: os_sig
= SIGFPE
; break;
5185 case 9: os_sig
= SIGKILL
; break;
5188 case 10: os_sig
= SIGBUS
; break;
5191 case 11: os_sig
= SIGSEGV
; break;
5194 case 12: os_sig
= SIGSYS
; break;
5197 case 13: os_sig
= SIGPIPE
; break;
5200 case 14: os_sig
= SIGALRM
; break;
5203 case 15: os_sig
= SIGTERM
; break;
5206 case 16: os_sig
= SIGURG
; break;
5209 case 17: os_sig
= SIGSTOP
; break;
5212 case 18: os_sig
= SIGTSTP
; break;
5215 case 19: os_sig
= SIGCONT
; break;
5218 case 20: os_sig
= SIGCHLD
; break;
5219 #elif defined(SIGCLD)
5220 case 20: os_sig
= SIGCLD
; break;
5223 case 21: os_sig
= SIGTTIN
; break;
5226 case 22: os_sig
= SIGTTOU
; break;
5229 case 23: os_sig
= SIGIO
; break;
5230 #elif defined (SIGPOLL)
5231 case 23: os_sig
= SIGPOLL
; break;
5234 case 24: os_sig
= SIGXCPU
; break;
5237 case 25: os_sig
= SIGXFSZ
; break;
5240 case 26: os_sig
= SIGVTALRM
; break;
5243 case 27: os_sig
= SIGPROF
; break;
5246 case 28: os_sig
= SIGWINCH
; break;
5249 case 29: os_sig
= SIGLOST
; break;
5252 case 30: os_sig
= SIGUSR1
; break;
5255 case 31: os_sig
= SIGUSR2
; break;
5261 trace_output_void (sd
);
5262 sim_io_printf (sd
, "Unknown signal %d\n", PARM2
);
5263 sim_io_flush_stdout (sd
);
5264 EXCEPTION (SIM_SIGILL
);
5268 RETVAL (kill (PARM1
, PARM2
));
5269 trace_output_16 (sd
, result
);
5274 #ifdef TARGET_SYS_execve
5275 case TARGET_SYS_execve
:
5276 trace_input ("<execve>", OP_VOID
, OP_VOID
, OP_VOID
);
5277 RETVAL (execve (MEMPTR (PARM1
), (char **) MEMPTR (PARM2
<<16|PARM3
),
5278 (char **)MEMPTR (PARM4
)));
5279 trace_output_16 (sd
, result
);
5283 #ifdef TARGET_SYS_execv
5284 case TARGET_SYS_execv
:
5285 trace_input ("<execv>", OP_VOID
, OP_VOID
, OP_VOID
);
5286 RETVAL (execve (MEMPTR (PARM1
), (char **) MEMPTR (PARM2
), NULL
));
5287 trace_output_16 (sd
, result
);
5291 #ifdef TARGET_SYS_pipe
5292 case TARGET_SYS_pipe
:
5297 trace_input ("<pipe>", OP_VOID
, OP_VOID
, OP_VOID
);
5299 RETVAL (pipe (host_fd
));
5300 SW (buf
, host_fd
[0]);
5301 buf
+= sizeof(uint16
);
5302 SW (buf
, host_fd
[1]);
5303 trace_output_16 (sd
, result
);
5308 #ifdef TARGET_SYS_wait
5309 case TARGET_SYS_wait
:
5312 trace_input ("<wait>", OP_REG
, OP_VOID
, OP_VOID
);
5313 RETVAL (wait (&status
));
5316 trace_output_16 (sd
, result
);
5321 case TARGET_SYS_getpid
:
5322 trace_input ("<getpid>", OP_VOID
, OP_VOID
, OP_VOID
);
5324 trace_output_16 (sd
, result
);
5327 case TARGET_SYS_kill
:
5328 trace_input ("<kill>", OP_REG
, OP_REG
, OP_VOID
);
5329 trace_output_void (sd
);
5334 case TARGET_SYS_read
:
5335 trace_input ("<read>", OP_REG
, OP_MEMREF
, OP_REG
);
5336 RETVAL (cb
->read (cb
, PARM1
,
5337 MEMPTR (((unsigned long)PARM3
<< 16)
5338 | ((unsigned long)PARM2
)), PARM4
));
5339 trace_output_16 (sd
, result
);
5342 case TARGET_SYS_write
:
5343 trace_input ("<write>", OP_REG
, OP_MEMREF
, OP_REG
);
5344 RETVAL ((int)cb
->write (cb
, PARM1
,
5345 MEMPTR (((unsigned long)PARM3
<< 16)
5347 trace_output_16 (sd
, result
);
5350 case TARGET_SYS_lseek
:
5351 trace_input ("<lseek>", OP_REG
, OP_REGP
, OP_REG
);
5352 RETVAL32 (cb
->lseek (cb
, PARM1
, ((((long) PARM3
) << 16) | PARM2
),
5354 trace_output_32 (sd
, result
);
5357 case TARGET_SYS_close
:
5358 trace_input ("<close>", OP_REG
, OP_VOID
, OP_VOID
);
5359 RETVAL (cb
->close (cb
, PARM1
));
5360 trace_output_16 (sd
, result
);
5363 case TARGET_SYS_open
:
5364 trace_input ("<open>", OP_MEMREF
, OP_REG
, OP_VOID
);
5365 RETVAL32 (cb
->open (cb
, MEMPTR ((((unsigned long)PARM2
) << 16)
5367 trace_output_32 (sd
, result
);
5370 #ifdef TARGET_SYS_rename
5371 case TARGET_SYS_rename
:
5372 trace_input ("<rename>", OP_MEMREF
, OP_MEMREF
, OP_VOID
);
5373 RETVAL (cb
->rename (cb
, MEMPTR ((((unsigned long)PARM2
) << 16) | PARM1
),
5374 MEMPTR ((((unsigned long)PARM4
) << 16) | PARM3
)));
5375 trace_output_16 (sd
, result
);
5379 case 0x408: /* REVISIT: Added a dummy getenv call. */
5380 trace_input ("<getenv>", OP_MEMREF
, OP_MEMREF
, OP_VOID
);
5382 trace_output_32 (sd
, result
);
5385 case TARGET_SYS_exit
:
5386 trace_input ("<exit>", OP_VOID
, OP_VOID
, OP_VOID
);
5387 trace_output_void (sd
);
5388 sim_engine_halt (sd
, cpu
, NULL
, PC
, sim_exited
, GPR (2));
5391 case TARGET_SYS_unlink
:
5392 trace_input ("<unlink>", OP_MEMREF
, OP_VOID
, OP_VOID
);
5393 RETVAL (cb
->unlink (cb
, MEMPTR (((unsigned long)PARM2
<< 16) | PARM1
)));
5394 trace_output_16 (sd
, result
);
5398 #ifdef TARGET_SYS_stat
5399 case TARGET_SYS_stat
:
5400 trace_input ("<stat>", OP_VOID
, OP_VOID
, OP_VOID
);
5401 /* stat system call. */
5403 struct stat host_stat
;
5406 RETVAL (stat (MEMPTR ((((unsigned long)PARM2
) << 16)|PARM1
), &host_stat
));
5410 /* The hard-coded offsets and sizes were determined by using
5411 * the CR16 compiler on a test program that used struct stat.
5413 SW (buf
, host_stat
.st_dev
);
5414 SW (buf
+2, host_stat
.st_ino
);
5415 SW (buf
+4, host_stat
.st_mode
);
5416 SW (buf
+6, host_stat
.st_nlink
);
5417 SW (buf
+8, host_stat
.st_uid
);
5418 SW (buf
+10, host_stat
.st_gid
);
5419 SW (buf
+12, host_stat
.st_rdev
);
5420 SLW (buf
+16, host_stat
.st_size
);
5421 SLW (buf
+20, host_stat
.st_atime
);
5422 SLW (buf
+28, host_stat
.st_mtime
);
5423 SLW (buf
+36, host_stat
.st_ctime
);
5425 trace_output_16 (sd
, result
);
5429 #ifdef TARGET_SYS_chown
5430 case TARGET_SYS_chown
:
5431 trace_input ("<chown>", OP_VOID
, OP_VOID
, OP_VOID
);
5432 RETVAL (chown (MEMPTR (PARM1
), PARM2
, PARM3
));
5433 trace_output_16 (sd
, result
);
5437 case TARGET_SYS_chmod
:
5438 trace_input ("<chmod>", OP_VOID
, OP_VOID
, OP_VOID
);
5439 RETVAL (chmod (MEMPTR (PARM1
), PARM2
));
5440 trace_output_16 (sd
, result
);
5443 #ifdef TARGET_SYS_utime
5444 case TARGET_SYS_utime
:
5445 trace_input ("<utime>", OP_REG
, OP_REG
, OP_REG
);
5446 /* Cast the second argument to void *, to avoid type mismatch
5447 if a prototype is present. */
5448 RETVAL (utime (MEMPTR (PARM1
), (void *) MEMPTR (PARM2
)));
5449 trace_output_16 (sd
, result
);
5453 #ifdef TARGET_SYS_time
5454 case TARGET_SYS_time
:
5455 trace_input ("<time>", OP_VOID
, OP_VOID
, OP_REG
);
5456 RETVAL32 (time (NULL
));
5457 trace_output_32 (sd
, result
);
5465 case TRAP_BREAKPOINT
:
5468 trace_output_void (sd
);
5469 EXCEPTION (SIM_SIGTRAP
);
5471 case SIGTRAP
: /* supervisor call ? */
5472 trace_output_void (sd
);
5473 sim_engine_halt (sd
, cpu
, NULL
, PC
, sim_exited
, GPR (2));
5476 cb
->error (cb
, "Unknown syscall %d", FUNC
);
5480 if ((uint16
) result
== (uint16
) -1)
5481 RETERR (cb
->get_errno (cb
));
5492 OP_3_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
5494 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5495 uint32 tmp
, sp_addr
= (GPR32 (15)) - (a
* 2) - 4, is_regp
= 0;
5496 trace_input ("push", OP_CONSTANT3
, OP_REG
, OP_REG
);
5502 SW (sp_addr
, (GPR (b
+i
)));
5508 tmp
= (GPR32 (b
+i
));
5510 tmp
= (GPR32 (b
+i
-1));
5529 /* Store RA address. */
5533 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5534 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5536 trace_output_void (sd
);
5541 OP_1_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5543 uint32 sp_addr
, tmp
, is_regp
= 0;
5544 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5545 trace_input ("push", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5548 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5550 sp_addr
= (GPR32 (15)) - (a
* 2);
5556 SW (sp_addr
, (GPR (b
+i
)));
5562 tmp
= (GPR32 (b
+i
));
5564 tmp
= (GPR32 (b
+i
-1));
5583 /* Store RA address. */
5586 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5589 sp_addr
= (GPR32 (15)) - (a
* 2);
5591 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5593 trace_output_void (sd
);
5599 OP_11E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5601 uint32 sp_addr
= (GPR32 (15)), tmp
;
5602 trace_input ("push", OP_VOID
, OP_VOID
, OP_VOID
);
5604 SLW(sp_addr
-4,tmp
); /* Store RA address. */
5605 SET_GPR32 (15, (sp_addr
- 4)); /* Update SP address. */
5606 trace_output_void (sd
);
5612 OP_5_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
5614 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5615 uint32 tmp
, sp_addr
= (GPR32 (15)), is_regp
= 0;;
5616 trace_input ("pop", OP_CONSTANT3
, OP_REG
, OP_REG
);
5622 SET_GPR ((b
+i
), RW(sp_addr
));
5638 tmp
= (tmp
<< 16) | (GPR32 (b
+i
));
5640 tmp
= (tmp
<< 16) | (GPR32 (b
+i
-1));
5644 SET_GPR32 ((b
+i
), (((tmp
& 0xffff) << 16)
5645 | ((tmp
>> 16) & 0xffff)));
5647 SET_GPR32 ((b
+i
-1), (((tmp
& 0xffff) << 16)
5648 | ((tmp
>> 16) & 0xffff)));
5655 tmp
= RLW(sp_addr
); /* store RA also. */
5656 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5658 SET_GPR32 (15, (sp_addr
+ 4)); /* Update SP address. */
5660 trace_output_void (sd
);
5665 OP_2_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5667 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5668 uint32 tmp
, sp_addr
= (GPR32 (15)), is_regp
= 0;
5669 trace_input ("pop", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5675 SET_GPR ((b
+i
), RW(sp_addr
));
5691 tmp
= ((tmp
<< 16) & 0xffffffff) | (GPR32 (b
+i
));
5693 tmp
= ((tmp
<< 16) & 0xffffffff) | (GPR32 (b
+i
-1));
5697 SET_GPR32 ((b
+i
), (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5699 SET_GPR32 ((b
+i
-1), (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5707 tmp
= RLW(sp_addr
); /* Store RA Reg. */
5708 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5712 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5714 trace_output_void (sd
);
5719 OP_21E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5721 uint32 sp_addr
= GPR32 (15);
5723 trace_input ("pop", OP_VOID
, OP_VOID
, OP_VOID
);
5726 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5727 SET_GPR32 (15, (sp_addr
+4)); /* Update SP address. */
5729 trace_output_void (sd
);
5734 OP_7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
5736 uint16 a
= OP
[0], b
= OP
[1];
5737 trace_input ("popret", OP_CONSTANT3
, OP_REG
, OP_REG
);
5739 JMP(((GPR32(14)) << 1) & 0xffffff);
5741 trace_output_void (sd
);
5746 OP_3_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5748 uint16 a
= OP
[0], b
= OP
[1];
5749 trace_input ("popret", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5751 JMP(((GPR32(14)) << 1) & 0xffffff);
5753 trace_output_void (sd
);
5758 OP_31E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5761 trace_input ("popret", OP_VOID
, OP_VOID
, OP_VOID
);
5762 OP_21E_10 (sd
, cpu
);
5763 tmp
= (((GPR32(14)) << 1) & 0xffffff);
5764 /* If the resulting PC value is less than 0x00_0000 or greater
5765 than 0xFF_FFFF, this instruction causes an IAD trap.*/
5767 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
5769 trace_output_void (sd
);
5770 EXCEPTION (SIM_SIGBUS
);
5775 trace_output_32 (sd
, tmp
);
5781 OP_A_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5783 trace_input ("cinv[i]", OP_VOID
, OP_VOID
, OP_VOID
);
5785 trace_output_void (sd
);
5790 OP_B_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5792 trace_input ("cinv[i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5794 trace_output_void (sd
);
5799 OP_C_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5801 trace_input ("cinv[d]", OP_VOID
, OP_VOID
, OP_VOID
);
5803 trace_output_void (sd
);
5808 OP_D_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5810 trace_input ("cinv[i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5812 trace_output_void (sd
);
5817 OP_E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5819 trace_input ("cinv[d,i]", OP_VOID
, OP_VOID
, OP_VOID
);
5821 trace_output_void (sd
);
5826 OP_F_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5828 trace_input ("cinv[d,i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5830 trace_output_void (sd
);
5835 OP_3_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5837 trace_input ("retx", OP_VOID
, OP_VOID
, OP_VOID
);
5839 trace_output_void (sd
);
5844 OP_4_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5846 trace_input ("di", OP_VOID
, OP_VOID
, OP_VOID
);
5848 trace_output_void (sd
);
5853 OP_5_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5855 trace_input ("ei", OP_VOID
, OP_VOID
, OP_VOID
);
5857 trace_output_void (sd
);
5862 OP_6_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5864 trace_input ("wait", OP_VOID
, OP_VOID
, OP_VOID
);
5865 trace_output_void (sd
);
5866 EXCEPTION (SIM_SIGTRAP
);
5871 OP_7_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5873 trace_input ("ewait", OP_VOID
, OP_VOID
, OP_VOID
);
5875 trace_output_void (sd
);
5880 OP_28_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5882 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5883 trace_input ("xorb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
5885 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5886 trace_output_16 (sd
, tmp
);
5891 OP_28B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5893 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5894 trace_input ("xorb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
5896 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5897 trace_output_16 (sd
, tmp
);
5902 OP_29_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5904 uint8 tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5905 trace_input ("xorb", OP_REG
, OP_REG
, OP_VOID
);
5907 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5908 trace_output_16 (sd
, tmp
);
5913 OP_2A_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5915 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
5916 trace_input ("xorw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
5918 SET_GPR (OP
[1], tmp
);
5919 trace_output_16 (sd
, tmp
);
5924 OP_2AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5926 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
5927 trace_input ("xorw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
5929 SET_GPR (OP
[1], tmp
);
5930 trace_output_16 (sd
, tmp
);
5935 OP_2B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5937 uint16 tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
5938 trace_input ("xorw", OP_REG
, OP_REG
, OP_VOID
);
5940 SET_GPR (OP
[1], tmp
);
5941 trace_output_16 (sd
, tmp
);
5944 /*REVISIT FOR LPR/SPR . */
5948 OP_140_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5950 uint16 a
= GPR (OP
[0]);
5951 trace_input ("lpr", OP_REG
, OP_REG
, OP_VOID
);
5952 SET_CREG (OP
[1], a
);
5953 trace_output_16 (sd
, a
);
5958 OP_141_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5960 uint32 a
= GPR32 (OP
[0]);
5961 trace_input ("lprd", OP_REGP
, OP_REG
, OP_VOID
);
5962 SET_CREG (OP
[1], a
);
5963 trace_output_flag (sd
);
5968 OP_142_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5970 uint16 a
= CREG (OP
[0]);
5971 trace_input ("spr", OP_REG
, OP_REG
, OP_VOID
);
5973 trace_output_16 (sd
, a
);
5978 OP_143_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5980 uint32 a
= CREG (OP
[0]);
5981 trace_input ("sprd", OP_REGP
, OP_REGP
, OP_VOID
);
5982 SET_GPR32 (OP
[1], a
);
5983 trace_output_32 (sd
, a
);
5988 OP_0_20 (SIM_DESC sd
, SIM_CPU
*cpu
)
5990 trace_input ("null", OP_VOID
, OP_VOID
, OP_VOID
);
5991 sim_engine_halt (sd
, cpu
, NULL
, PC
, sim_exited
, 0);