1 /* Simulation code for the CR16 processor.
2 Copyright (C) 2008-2021 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 #include "targ-vals.h"
38 #ifdef TARGET_SYS_utime
41 #ifdef TARGET_SYS_wait
45 #define EXCEPTION(sig) sim_engine_halt (sd, cpu, NULL, PC, sim_stopped, sig)
106 PSR_MASK
= (PSR_I_BIT
116 /* The following bits in the PSR _can't_ be set by instructions such
118 PSR_HW_MASK
= (PSR_MASK
)
121 /* cond Code Condition True State
122 * EQ Equal Z flag is 1
123 * NE Not Equal Z flag is 0
124 * CS Carry Set C flag is 1
125 * CC Carry Clear C flag is 0
126 * HI Higher L flag is 1
127 * LS Lower or Same L flag is 0
128 * GT Greater Than N flag is 1
129 * LE Less Than or Equal To N flag is 0
130 * FS Flag Set F flag is 1
131 * FC Flag Clear F flag is 0
132 * LO Lower Z and L flags are 0
133 * HS Higher or Same Z or L flag is 1
134 * LT Less Than Z and N flags are 0
135 * GE Greater Than or Equal To Z or N flag is 1. */
137 static int cond_stat(int cc
)
141 case 0: return PSR_Z
; break;
142 case 1: return !PSR_Z
; break;
143 case 2: return PSR_C
; break;
144 case 3: return !PSR_C
; break;
145 case 4: return PSR_L
; break;
146 case 5: return !PSR_L
; break;
147 case 6: return PSR_N
; break;
148 case 7: return !PSR_N
; break;
149 case 8: return PSR_F
; break;
150 case 9: return !PSR_F
; break;
151 case 10: return !PSR_Z
&& !PSR_L
; break;
152 case 11: return PSR_Z
|| PSR_L
; break;
153 case 12: return !PSR_Z
&& !PSR_N
; break;
154 case 13: return PSR_Z
|| PSR_N
; break;
155 case 14: return 1; break; /*ALWAYS. */
157 // case NEVER: return false; break;
159 //panic("Shouldn't have NO_COND_CODE in an actual instruction!");
167 move_to_cr (SIM_DESC sd
, SIM_CPU
*cpu
, int cr
, creg_t mask
, creg_t val
, int psw_hw_p
)
169 /* A MASK bit is set when the corresponding bit in the CR should
171 /* This assumes that (VAL & MASK) == 0. */
182 "ERROR at PC 0x%x: ST can only be set when FX is set.\n", PC
);
183 EXCEPTION (SIM_SIGILL
);
185 /* keep an up-to-date psw around for tracing. */
186 State
.trace
.psw
= (State
.trace
.psw
& mask
) | val
;
191 /* only issue an update if the register is being changed. */
192 if ((State
.cregs
[cr
] & ~mask
) != val
)
193 SLOT_PEND_MASK (State
.cregs
[cr
], mask
, val
);
199 static void trace_input_func (SIM_DESC sd
,
205 #define trace_input(name, in1, in2, in3) do { if (cr16_debug) trace_input_func (sd, name, in1, in2, in3); } while (0)
207 #ifndef SIZE_INSTRUCTION
208 #define SIZE_INSTRUCTION 8
211 #ifndef SIZE_OPERANDS
212 #define SIZE_OPERANDS 18
216 #define SIZE_VALUES 13
219 #ifndef SIZE_LOCATION
220 #define SIZE_LOCATION 20
227 #ifndef SIZE_LINE_NUMBER
228 #define SIZE_LINE_NUMBER 2
232 trace_input_func (SIM_DESC sd
, const char *name
, enum op_types in1
, enum op_types in2
, enum op_types in3
)
241 const char *filename
;
242 const char *functionname
;
243 unsigned int linenumber
;
246 if ((cr16_debug
& DEBUG_TRACE
) == 0)
249 switch (State
.ins_type
)
252 case INS_UNKNOWN
: type
= " ?"; break;
255 if ((cr16_debug
& DEBUG_LINE_NUMBER
) == 0)
258 SIZE_PC
, (unsigned)PC
,
260 SIZE_INSTRUCTION
, name
);
266 if (STATE_TEXT_SECTION (sd
)
267 && byte_pc
>= STATE_TEXT_START (sd
)
268 && byte_pc
< STATE_TEXT_END (sd
))
270 filename
= (const char *)0;
271 functionname
= (const char *)0;
273 if (bfd_find_nearest_line (STATE_PROG_BFD (sd
),
274 STATE_TEXT_SECTION (sd
),
275 (struct bfd_symbol
**)0,
276 byte_pc
- STATE_TEXT_START (sd
),
277 &filename
, &functionname
, &linenumber
))
282 sprintf (p
, "#%-*d ", SIZE_LINE_NUMBER
, linenumber
);
287 sprintf (p
, "%-*s ", SIZE_LINE_NUMBER
+1, "---");
288 p
+= SIZE_LINE_NUMBER
+2;
293 sprintf (p
, "%s ", functionname
);
298 char *q
= strrchr (filename
, '/');
299 sprintf (p
, "%s ", (q
) ? q
+1 : filename
);
309 "0x%.*x %s: %-*.*s %-*s ",
310 SIZE_PC
, (unsigned)PC
,
312 SIZE_LOCATION
, SIZE_LOCATION
, buf
,
313 SIZE_INSTRUCTION
, name
);
321 for (i
= 0; i
< 3; i
++)
330 sprintf (p
, "%sr%d", comma
, OP
[i
]);
336 sprintf (p
, "%scr%d", comma
, OP
[i
]);
342 sprintf (p
, "%s%d", comma
, OP
[i
]);
348 sprintf (p
, "%s%d", comma
, SEXT4(OP
[i
]));
354 sprintf (p
, "%s%d", comma
, SEXT3(OP
[i
]));
360 sprintf (p
, "%s@r%d", comma
, OP
[i
]);
366 sprintf (p
, "%s@(%d,r%d)", comma
, (int16
)OP
[i
], OP
[i
+1]);
372 sprintf (p
, "%s@%d", comma
, OP
[i
]);
379 if ((cr16_debug
& DEBUG_VALUES
) == 0)
383 sim_io_printf (sd
, "%s", buf
);
388 sim_io_printf (sd
, "%-*s", SIZE_OPERANDS
, buf
);
391 for (i
= 0; i
< 3; i
++)
397 sim_io_printf (sd
, "%*s", SIZE_VALUES
, "");
401 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
402 (uint16
) GPR (OP
[i
]));
406 tmp
= (long)((((uint32
) GPR (OP
[i
])) << 16) | ((uint32
) GPR (OP
[i
] + 1)));
407 sim_io_printf (sd
, "%*s0x%.8lx", SIZE_VALUES
-10, "", tmp
);
411 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
412 (uint16
) CREG (OP
[i
]));
416 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
421 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
422 (uint16
)SEXT4(OP
[i
]));
426 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
427 (uint16
)SEXT3(OP
[i
]));
431 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
433 sim_io_printf (sd
, "%*s0x%.4x", SIZE_VALUES
-6, "",
434 (uint16
)GPR (OP
[i
+ 1]));
441 sim_io_flush_stdout (sd
);
445 do_trace_output_flush (SIM_DESC sd
)
447 sim_io_flush_stdout (sd
);
451 do_trace_output_finish (SIM_DESC sd
)
454 " F0=%d F1=%d C=%d\n",
455 (State
.trace
.psw
& PSR_F_BIT
) != 0,
456 (State
.trace
.psw
& PSR_F_BIT
) != 0,
457 (State
.trace
.psw
& PSR_C_BIT
) != 0);
458 sim_io_flush_stdout (sd
);
463 trace_output_40 (SIM_DESC sd
, uint64 val
)
465 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
468 " :: %*s0x%.2x%.8lx",
471 ((int)(val
>> 32) & 0xff),
472 ((unsigned long) val
) & 0xffffffff);
473 do_trace_output_finish ();
479 trace_output_32 (SIM_DESC sd
, uint32 val
)
481 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
488 do_trace_output_finish (sd
);
493 trace_output_16 (SIM_DESC sd
, uint16 val
)
495 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
502 do_trace_output_finish (sd
);
507 trace_output_void (SIM_DESC sd
)
509 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
511 sim_io_printf (sd
, "\n");
512 do_trace_output_flush (sd
);
517 trace_output_flag (SIM_DESC sd
)
519 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
525 do_trace_output_finish (sd
);
533 #define trace_input(NAME, IN1, IN2, IN3)
534 #define trace_output(RESULT)
539 OP_2C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
542 uint8 a
= OP
[0] & 0xff;
543 uint16 b
= (GPR (OP
[1])) & 0xff;
544 trace_input ("addub", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
545 tmp
= (a
+ b
) & 0xff;
546 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
547 trace_output_16 (sd
, tmp
);
552 OP_2CB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
555 uint8 a
= ((OP
[0]) & 0xff), b
= (GPR (OP
[1])) & 0xff;
556 trace_input ("addub", OP_CONSTANT16
, OP_REG
, OP_VOID
);
557 tmp
= (a
+ b
) & 0xff;
558 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
559 trace_output_16 (sd
, tmp
);
564 OP_2D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
566 uint8 a
= (GPR (OP
[0])) & 0xff;
567 uint8 b
= (GPR (OP
[1])) & 0xff;
568 uint16 tmp
= (a
+ b
) & 0xff;
569 trace_input ("addub", OP_REG
, OP_REG
, OP_VOID
);
570 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
571 trace_output_16 (sd
, tmp
);
576 OP_2E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
579 uint16 b
= GPR (OP
[1]);
580 uint16 tmp
= (a
+ b
);
581 trace_input ("adduw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
582 SET_GPR (OP
[1], tmp
);
583 trace_output_16 (sd
, tmp
);
588 OP_2EB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
591 uint16 b
= GPR (OP
[1]);
592 uint16 tmp
= (a
+ b
);
593 trace_input ("adduw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
594 SET_GPR (OP
[1], tmp
);
595 trace_output_16 (sd
, tmp
);
600 OP_2F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
602 uint16 a
= GPR (OP
[0]);
603 uint16 b
= GPR (OP
[1]);
604 uint16 tmp
= (a
+ b
);
605 trace_input ("adduw", OP_REG
, OP_REG
, OP_VOID
);
606 SET_GPR (OP
[1], tmp
);
607 trace_output_16 (sd
, tmp
);
612 OP_30_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
615 uint8 b
= (GPR (OP
[1]) & 0xff);
616 uint16 tmp
= (a
+ b
) & 0xff;
617 trace_input ("addb", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
618 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
619 SET_PSR_C (tmp
> 0xFF);
620 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
621 trace_output_16 (sd
, tmp
);
626 OP_30B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
628 uint8 a
= (OP
[0]) & 0xff;
629 uint8 b
= (GPR (OP
[1]) & 0xff);
630 uint16 tmp
= (a
+ b
) & 0xff;
631 trace_input ("addb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
632 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
633 SET_PSR_C (tmp
> 0xFF);
634 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
635 trace_output_16 (sd
, tmp
);
640 OP_31_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
642 uint8 a
= (GPR (OP
[0]) & 0xff);
643 uint8 b
= (GPR (OP
[1]) & 0xff);
644 uint16 tmp
= (a
+ b
) & 0xff;
645 trace_input ("addb", OP_REG
, OP_REG
, OP_VOID
);
646 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
647 SET_PSR_C (tmp
> 0xFF);
648 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
649 trace_output_16 (sd
, tmp
);
654 OP_32_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
657 uint16 tmp
, b
= GPR (OP
[1]);
659 trace_input ("addw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
660 SET_GPR (OP
[1], tmp
);
661 SET_PSR_C (tmp
> 0xFFFF);
662 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
663 trace_output_16 (sd
, tmp
);
668 OP_32B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
671 uint16 tmp
, b
= GPR (OP
[1]);
673 trace_input ("addw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
674 SET_GPR (OP
[1], tmp
);
675 SET_PSR_C (tmp
> 0xFFFF);
676 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
677 trace_output_16 (sd
, tmp
);
682 OP_33_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
684 uint16 tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
685 trace_input ("addw", OP_REG
, OP_REG
, OP_VOID
);
687 SET_GPR (OP
[1], tmp
);
688 SET_PSR_C (tmp
> 0xFFFF);
689 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
690 trace_output_16 (sd
, tmp
);
695 OP_34_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
697 uint8 tmp
, a
= OP
[0] & 0xff, b
= (GPR (OP
[1])) & 0xff;
698 trace_input ("addcb", OP_CONSTANT4_1
, OP_REG
, OP_REG
);
699 tmp
= (a
+ b
+ PSR_C
) & 0xff;
700 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
701 SET_PSR_C (tmp
> 0xFF);
702 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
703 trace_output_16 (sd
, tmp
);
708 OP_34B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
710 int8 a
= OP
[0] & 0xff;
711 uint8 b
= (GPR (OP
[1])) & 0xff;
712 uint8 tmp
= (a
+ b
+ PSR_C
) & 0xff;
713 trace_input ("addcb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
714 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
715 SET_PSR_C (tmp
> 0xFF);
716 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
717 trace_output_16 (sd
, tmp
);
722 OP_35_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
724 uint8 a
= (GPR (OP
[0])) & 0xff;
725 uint8 b
= (GPR (OP
[1])) & 0xff;
726 uint8 tmp
= (a
+ b
+ PSR_C
) & 0xff;
727 trace_input ("addcb", OP_REG
, OP_REG
, OP_VOID
);
728 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
729 SET_PSR_C (tmp
> 0xFF);
730 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
731 trace_output_16 (sd
, tmp
);
736 OP_36_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
739 uint16 b
= GPR (OP
[1]);
740 uint16 tmp
= (a
+ b
+ PSR_C
);
741 trace_input ("addcw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
742 SET_GPR (OP
[1], tmp
);
743 SET_PSR_C (tmp
> 0xFFFF);
744 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
745 trace_output_16 (sd
, tmp
);
750 OP_36B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
753 uint16 b
= GPR (OP
[1]);
754 uint16 tmp
= (a
+ b
+ PSR_C
);
755 trace_input ("addcw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
756 SET_GPR (OP
[1], tmp
);
757 SET_PSR_C (tmp
> 0xFFFF);
758 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
759 trace_output_16 (sd
, tmp
);
764 OP_37_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
766 uint16 a
= GPR (OP
[1]);
767 uint16 b
= GPR (OP
[1]);
768 uint16 tmp
= (a
+ b
+ PSR_C
);
769 trace_input ("addcw", OP_REG
, OP_REG
, OP_VOID
);
770 SET_GPR (OP
[1], tmp
);
771 SET_PSR_C (tmp
> 0xFFFF);
772 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
773 trace_output_16 (sd
, tmp
);
778 OP_60_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
781 uint32 b
= GPR32 (OP
[1]);
782 uint32 tmp
= (a
+ b
);
783 trace_input ("addd", OP_CONSTANT4_1
, OP_REGP
, OP_VOID
);
784 SET_GPR32 (OP
[1], tmp
);
785 SET_PSR_C (tmp
> 0xFFFFFFFF);
786 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
787 trace_output_32 (sd
, tmp
);
792 OP_60B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
794 int32 a
= (SEXT16(OP
[0]));
795 uint32 b
= GPR32 (OP
[1]);
796 uint32 tmp
= (a
+ b
);
797 trace_input ("addd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
798 SET_GPR32 (OP
[1], tmp
);
799 SET_PSR_C (tmp
> 0xFFFFFFFF);
800 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
801 trace_output_32 (sd
, tmp
);
806 OP_61_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
808 uint32 a
= GPR32 (OP
[0]);
809 uint32 b
= GPR32 (OP
[1]);
810 uint32 tmp
= (a
+ b
);
811 trace_input ("addd", OP_REGP
, OP_REGP
, OP_VOID
);
812 SET_GPR32 (OP
[1], tmp
);
813 trace_output_32 (sd
, tmp
);
814 SET_PSR_C (tmp
> 0xFFFFFFFF);
815 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
820 OP_4_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
823 uint32 b
= GPR32 (OP
[1]);
825 trace_input ("addd", OP_CONSTANT20
, OP_REGP
, OP_VOID
);
827 SET_GPR32 (OP
[1], tmp
);
828 SET_PSR_C (tmp
> 0xFFFFFFFF);
829 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
830 trace_output_32 (sd
, tmp
);
835 OP_2_C (SIM_DESC sd
, SIM_CPU
*cpu
)
838 uint32 b
= GPR32 (OP
[1]);
840 trace_input ("addd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
842 SET_GPR32 (OP
[1], tmp
);
843 SET_PSR_C (tmp
> 0xFFFFFFFF);
844 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
845 trace_output_32 (sd
, tmp
);
850 OP_20_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
852 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
853 trace_input ("andb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
855 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
856 trace_output_16 (sd
, tmp
);
861 OP_20B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
863 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
864 trace_input ("andb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
866 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
867 trace_output_16 (sd
, tmp
);
872 OP_21_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
874 uint8 tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
875 trace_input ("andb", OP_REG
, OP_REG
, OP_VOID
);
877 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
878 trace_output_16 (sd
, tmp
);
883 OP_22_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
885 uint16 tmp
, a
= OP
[0], b
= GPR (OP
[1]);
886 trace_input ("andw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
888 SET_GPR (OP
[1], tmp
);
889 trace_output_16 (sd
, tmp
);
894 OP_22B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
896 uint16 tmp
, a
= OP
[0], b
= GPR (OP
[1]);
897 trace_input ("andw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
899 SET_GPR (OP
[1], tmp
);
900 trace_output_16 (sd
, tmp
);
905 OP_23_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
907 uint16 tmp
, a
= GPR (OP
[0]), b
= GPR (OP
[1]);
908 trace_input ("andw", OP_REG
, OP_REG
, OP_VOID
);
910 SET_GPR (OP
[1], tmp
);
911 trace_output_16 (sd
, tmp
);
916 OP_4_C (SIM_DESC sd
, SIM_CPU
*cpu
)
918 uint32 tmp
, a
= OP
[0], b
= GPR32 (OP
[1]);
919 trace_input ("andd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
921 SET_GPR32 (OP
[1], tmp
);
922 trace_output_32 (sd
, tmp
);
927 OP_14B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
929 uint32 tmp
, a
= (GPR32 (OP
[0])), b
= (GPR32 (OP
[1]));
930 trace_input ("andd", OP_REGP
, OP_REGP
, OP_VOID
);
932 SET_GPR32 (OP
[1], tmp
);
933 trace_output_32 (sd
, tmp
);
938 OP_5_C (SIM_DESC sd
, SIM_CPU
*cpu
)
940 uint32 tmp
, a
= (OP
[0]), b
= GPR32 (OP
[1]);
941 trace_input ("ord", OP_CONSTANT32
, OP_REG
, OP_VOID
);
943 SET_GPR32 (OP
[1], tmp
);
944 trace_output_32 (sd
, tmp
);
949 OP_149_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
951 uint32 tmp
, a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
952 trace_input ("ord", OP_REGP
, OP_REGP
, OP_VOID
);
954 SET_GPR32 (OP
[1], tmp
);
955 trace_output_32 (sd
, tmp
);
960 OP_6_C (SIM_DESC sd
, SIM_CPU
*cpu
)
962 uint32 tmp
, a
= (OP
[0]), b
= GPR32 (OP
[1]);
963 trace_input ("xord", OP_CONSTANT32
, OP_REG
, OP_VOID
);
965 SET_GPR32 (OP
[1], tmp
);
966 trace_output_32 (sd
, tmp
);
971 OP_14A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
973 uint32 tmp
, a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
974 trace_input ("xord", OP_REGP
, OP_REGP
, OP_VOID
);
976 SET_GPR32 (OP
[1], tmp
);
977 trace_output_32 (sd
, tmp
);
983 OP_1_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
985 uint32 tmp
= 0, cc
= cond_stat (OP
[0]);
986 trace_input ("b", OP_CONSTANT4
, OP_DISPE9
, OP_VOID
);
990 tmp
= (PC
- (OP
[1]));
992 tmp
= (PC
+ (OP
[1]));
993 /* If the resulting PC value is less than 0x00_0000 or greater
994 than 0xFF_FFFF, this instruction causes an IAD trap.*/
996 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
998 trace_output_void (sd
);
999 EXCEPTION (SIM_SIGBUS
);
1004 sign_flag
= 0; /* Reset sign_flag. */
1005 trace_output_32 (sd
, tmp
);
1010 OP_18_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1012 uint32 tmp
= 0, cc
= cond_stat (OP
[0]);
1013 trace_input ("b", OP_CONSTANT4
, OP_DISP17
, OP_VOID
);
1020 /* If the resulting PC value is less than 0x00_0000 or greater
1021 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1023 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1025 trace_output_void (sd
);
1026 EXCEPTION (SIM_SIGBUS
);
1031 sign_flag
= 0; /* Reset sign_flag. */
1032 trace_output_32 (sd
, tmp
);
1037 OP_10_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
1039 uint32 tmp
= 0, cc
= cond_stat (OP
[0]);
1040 trace_input ("b", OP_CONSTANT4
, OP_DISP25
, OP_VOID
);
1044 tmp
= (PC
- (OP
[1]));
1046 tmp
= (PC
+ (OP
[1]));
1047 /* If the resulting PC value is less than 0x00_0000 or greater
1048 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1050 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1052 trace_output_void (sd
);
1053 EXCEPTION (SIM_SIGBUS
);
1058 sign_flag
= 0; /* Reset sign_flag. */
1059 trace_output_32 (sd
, tmp
);
1064 OP_C0_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1067 trace_input ("bal", OP_REG
, OP_DISP17
, OP_VOID
);
1068 tmp
= ((PC
+ 4) >> 1); /* Store PC in RA register. */
1069 SET_GPR32 (14, tmp
);
1071 tmp
= (PC
- (OP
[1]));
1073 tmp
= (PC
+ (OP
[1]));
1075 /* If the resulting PC value is less than 0x00_0000 or greater
1076 than 0xFF_FFFF, this instruction causes an IAD trap. */
1078 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1080 trace_output_void (sd
);
1081 EXCEPTION (SIM_SIGBUS
);
1085 sign_flag
= 0; /* Reset sign_flag. */
1086 trace_output_32 (sd
, tmp
);
1092 OP_102_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1095 trace_input ("bal", OP_REGP
, OP_DISP25
, OP_VOID
);
1096 tmp
= (((PC
) + 4) >> 1); /* Store PC in reg pair. */
1097 SET_GPR32 (OP
[0], tmp
);
1099 tmp
= ((PC
) - (OP
[1]));
1101 tmp
= ((PC
) + (OP
[1]));
1102 /* If the resulting PC value is less than 0x00_0000 or greater
1103 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1105 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1107 trace_output_void (sd
);
1108 EXCEPTION (SIM_SIGBUS
);
1112 sign_flag
= 0; /* Reset sign_flag. */
1113 trace_output_32 (sd
, tmp
);
1118 OP_148_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1121 trace_input ("jal", OP_REGP
, OP_REGP
, OP_VOID
);
1122 SET_GPR32 (OP
[0], (((PC
) + 4) >> 1)); /* Store next PC in RA */
1123 tmp
= GPR32 (OP
[1]);
1124 tmp
= SEXT24(tmp
<< 1);
1125 /* If the resulting PC value is less than 0x00_0000 or greater
1126 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1128 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
1130 trace_output_void (sd
);
1131 EXCEPTION (SIM_SIGBUS
);
1136 trace_output_32 (sd
, tmp
);
1142 OP_D_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1145 trace_input ("jal", OP_REGP
, OP_VOID
, OP_VOID
);
1146 SET_GPR32 (14, (((PC
) + 2) >> 1)); /* Store next PC in RA */
1147 tmp
= GPR32 (OP
[0]);
1148 tmp
= SEXT24(tmp
<< 1);
1149 /* If the resulting PC value is less than 0x00_0000 or greater
1150 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1152 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
1154 trace_output_void (sd
);
1155 EXCEPTION (SIM_SIGBUS
);
1160 trace_output_32 (sd
, tmp
);
1166 OP_C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1169 uint8 a
= (GPR (OP
[0]) & 0xFF);
1170 trace_input ("beq0b", OP_REG
, OP_DISP5
, OP_VOID
);
1175 addr
= (PC
- OP
[1]);
1177 addr
= (PC
+ OP
[1]);
1181 sign_flag
= 0; /* Reset sign_flag. */
1182 trace_output_void (sd
);
1187 OP_D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1190 uint8 a
= (GPR (OP
[0]) & 0xFF);
1191 trace_input ("bne0b", OP_REG
, OP_DISP5
, OP_VOID
);
1196 addr
= (PC
- OP
[1]);
1198 addr
= (PC
+ OP
[1]);
1202 sign_flag
= 0; /* Reset sign_flag. */
1203 trace_output_void (sd
);
1208 OP_E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1211 uint16 a
= GPR (OP
[0]);
1212 trace_input ("beq0w", OP_REG
, OP_DISP5
, OP_VOID
);
1217 addr
= (PC
- OP
[1]);
1219 addr
= (PC
+ OP
[1]);
1223 sign_flag
= 0; /* Reset sign_flag. */
1224 trace_output_void (sd
);
1229 OP_F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1232 uint16 a
= GPR (OP
[0]);
1233 trace_input ("bne0w", OP_REG
, OP_DISP5
, OP_VOID
);
1238 addr
= (PC
- OP
[1]);
1240 addr
= (PC
+ OP
[1]);
1244 sign_flag
= 0; /* Reset sign_flag. */
1245 trace_output_void (sd
);
1251 OP_A0_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1254 trace_input ("jeq", OP_REGP
, OP_VOID
, OP_VOID
);
1257 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits. */
1258 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit. */
1260 trace_output_32 (sd
, tmp
);
1265 OP_A1_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1268 trace_input ("jne", OP_REGP
, OP_VOID
, OP_VOID
);
1271 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits. */
1272 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit. */
1274 trace_output_32 (sd
, tmp
);
1279 OP_A2_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1282 trace_input ("jcs", OP_REGP
, OP_VOID
, OP_VOID
);
1285 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1286 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1288 trace_output_32 (sd
, tmp
);
1293 OP_A3_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1296 trace_input ("jcc", OP_REGP
, OP_VOID
, OP_VOID
);
1299 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1300 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1302 trace_output_32 (sd
, tmp
);
1307 OP_A4_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1310 trace_input ("jhi", OP_REGP
, OP_VOID
, OP_VOID
);
1313 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1314 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1316 trace_output_32 (sd
, tmp
);
1321 OP_A5_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1324 trace_input ("jls", OP_REGP
, OP_VOID
, OP_VOID
);
1327 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1328 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1330 trace_output_32 (sd
, tmp
);
1335 OP_A6_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1338 trace_input ("jgt", OP_REGP
, OP_VOID
, OP_VOID
);
1341 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1342 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1344 trace_output_32 (sd
, tmp
);
1349 OP_A7_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1352 trace_input ("jle", OP_REGP
, OP_VOID
, OP_VOID
);
1355 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1356 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1358 trace_output_32 (sd
, tmp
);
1364 OP_A8_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1367 trace_input ("jfs", OP_REGP
, OP_VOID
, OP_VOID
);
1370 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1371 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1373 trace_output_32 (sd
, tmp
);
1378 OP_A9_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1381 trace_input ("jfc", OP_REGP
, OP_VOID
, OP_VOID
);
1384 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1385 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1387 trace_output_32 (sd
, tmp
);
1392 OP_AA_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1395 trace_input ("jlo", OP_REGP
, OP_VOID
, OP_VOID
);
1396 if (((PSR_Z
) == 0) & ((PSR_L
) == 0))
1398 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1399 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1401 trace_output_32 (sd
, tmp
);
1406 OP_AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1409 trace_input ("jhs", OP_REGP
, OP_VOID
, OP_VOID
);
1410 if (((PSR_Z
) == 1) | ((PSR_L
) == 1))
1412 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1413 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1415 trace_output_32 (sd
, tmp
);
1420 OP_AC_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1423 trace_input ("jlt", OP_REGP
, OP_VOID
, OP_VOID
);
1424 if (((PSR_Z
) == 0) & ((PSR_N
) == 0))
1426 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1427 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1429 trace_output_32 (sd
, tmp
);
1434 OP_AD_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1437 trace_input ("jge", OP_REGP
, OP_VOID
, OP_VOID
);
1438 if (((PSR_Z
) == 1) | ((PSR_N
) == 1))
1440 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1441 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1443 trace_output_32 (sd
, tmp
);
1448 OP_AE_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1451 trace_input ("jump", OP_REGP
, OP_VOID
, OP_VOID
);
1452 tmp
= GPR32 (OP
[0]) /*& 0x3fffff*/; /* Use only 0 - 22 bits */
1453 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1454 trace_output_32 (sd
, tmp
);
1459 OP_AF_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1462 trace_input ("jusr", OP_REGP
, OP_VOID
, OP_VOID
);
1463 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1464 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1466 trace_output_32 (sd
, tmp
);
1471 OP_80_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1473 trace_input ("seq", OP_REG
, OP_VOID
, OP_VOID
);
1478 trace_output_void (sd
);
1482 OP_81_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1484 trace_input ("sne", OP_REG
, OP_VOID
, OP_VOID
);
1489 trace_output_void (sd
);
1494 OP_82_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1496 trace_input ("scs", OP_REG
, OP_VOID
, OP_VOID
);
1501 trace_output_void (sd
);
1506 OP_83_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1508 trace_input ("scc", OP_REG
, OP_VOID
, OP_VOID
);
1513 trace_output_void (sd
);
1518 OP_84_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1520 trace_input ("shi", OP_REG
, OP_VOID
, OP_VOID
);
1525 trace_output_void (sd
);
1530 OP_85_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1532 trace_input ("sls", OP_REG
, OP_VOID
, OP_VOID
);
1537 trace_output_void (sd
);
1542 OP_86_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1544 trace_input ("sgt", OP_REG
, OP_VOID
, OP_VOID
);
1549 trace_output_void (sd
);
1554 OP_87_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1556 trace_input ("sle", OP_REG
, OP_VOID
, OP_VOID
);
1561 trace_output_void (sd
);
1566 OP_88_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1568 trace_input ("sfs", OP_REG
, OP_VOID
, OP_VOID
);
1573 trace_output_void (sd
);
1578 OP_89_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1580 trace_input ("sfc", OP_REG
, OP_VOID
, OP_VOID
);
1585 trace_output_void (sd
);
1591 OP_8A_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1593 trace_input ("slo", OP_REG
, OP_VOID
, OP_VOID
);
1594 if (((PSR_Z
) == 0) & ((PSR_L
) == 0))
1598 trace_output_void (sd
);
1603 OP_8B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1605 trace_input ("shs", OP_REG
, OP_VOID
, OP_VOID
);
1606 if ( ((PSR_Z
) == 1) | ((PSR_L
) == 1))
1610 trace_output_void (sd
);
1615 OP_8C_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1617 trace_input ("slt", OP_REG
, OP_VOID
, OP_VOID
);
1618 if (((PSR_Z
) == 0) & ((PSR_N
) == 0))
1622 trace_output_void (sd
);
1627 OP_8D_C (SIM_DESC sd
, SIM_CPU
*cpu
)
1629 trace_input ("sge", OP_REG
, OP_VOID
, OP_VOID
);
1630 if (((PSR_Z
) == 1) | ((PSR_N
) == 1))
1634 trace_output_void (sd
);
1639 OP_D7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1641 uint8 a
= OP
[0] & 0xff;
1642 uint32 addr
= OP
[1], tmp
;
1643 trace_input ("cbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1645 SET_PSR_F (tmp
& (1 << a
));
1646 tmp
= tmp
& ~(1 << a
);
1648 trace_output_32 (sd
, tmp
);
1653 OP_107_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1655 uint8 a
= OP
[0] & 0xff;
1656 uint32 addr
= OP
[1], tmp
;
1657 trace_input ("cbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1659 SET_PSR_F (tmp
& (1 << a
));
1660 tmp
= tmp
& ~(1 << a
);
1662 trace_output_32 (sd
, tmp
);
1667 OP_68_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1669 uint8 a
= (OP
[0]) & 0xff;
1670 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1671 trace_input ("cbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
1673 SET_PSR_F (tmp
& (1 << a
));
1674 tmp
= tmp
& ~(1 << a
);
1676 trace_output_32 (sd
, addr
);
1681 OP_1AA_A (SIM_DESC sd
, SIM_CPU
*cpu
)
1683 uint8 a
= (OP
[0]) & 0xff;
1684 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1685 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1687 SET_PSR_F (tmp
& (1 << a
));
1688 tmp
= tmp
& ~(1 << a
);
1690 trace_output_32 (sd
, addr
);
1695 OP_104_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1697 uint8 a
= (OP
[0]) & 0xff;
1698 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1699 trace_input ("cbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1701 SET_PSR_F (tmp
& (1 << a
));
1702 tmp
= tmp
& ~(1 << a
);
1704 trace_output_32 (sd
, addr
);
1709 OP_D4_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1711 uint8 a
= (OP
[0]) & 0xff;
1712 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1713 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1715 SET_PSR_F (tmp
& (1 << a
));
1716 tmp
= tmp
& ~(1 << a
);
1718 trace_output_32 (sd
, addr
);
1723 OP_D6_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1725 uint8 a
= (OP
[0]) & 0xff;
1726 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1727 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1729 SET_PSR_F (tmp
& (1 << a
));
1730 tmp
= tmp
& ~(1 << a
);
1732 trace_output_32 (sd
, addr
);
1738 OP_105_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1740 uint8 a
= (OP
[0]) & 0xff;
1741 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1742 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
1744 SET_PSR_F (tmp
& (1 << a
));
1745 tmp
= tmp
& ~(1 << a
);
1747 trace_output_32 (sd
, addr
);
1752 OP_106_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1754 uint8 a
= (OP
[0]) & 0xff;
1755 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1756 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
1758 SET_PSR_F (tmp
& (1 << a
));
1759 tmp
= tmp
& ~(1 << a
);
1761 trace_output_32 (sd
, addr
);
1767 OP_6F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1770 uint32 addr
= OP
[1], tmp
;
1771 trace_input ("cbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1773 SET_PSR_F (tmp
& (1 << a
));
1774 tmp
= tmp
& ~(1 << a
);
1776 trace_output_32 (sd
, tmp
);
1781 OP_117_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1784 uint32 addr
= OP
[1], tmp
;
1785 trace_input ("cbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1787 SET_PSR_F (tmp
& (1 << a
));
1788 tmp
= tmp
& ~(1 << a
);
1790 trace_output_32 (sd
, tmp
);
1795 OP_36_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
1798 uint16 a
= (OP
[0]), tmp
;
1799 trace_input ("cbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
1802 addr
= (GPR32 (12)) + OP
[2];
1804 addr
= (GPR32 (13)) + OP
[2];
1807 SET_PSR_F (tmp
& (1 << a
));
1808 tmp
= tmp
& ~(1 << a
);
1810 trace_output_32 (sd
, addr
);
1816 OP_1AB_A (SIM_DESC sd
, SIM_CPU
*cpu
)
1819 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1820 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1822 SET_PSR_F (tmp
& (1 << a
));
1823 tmp
= tmp
& ~(1 << a
);
1825 trace_output_32 (sd
, addr
);
1830 OP_114_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1833 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1834 trace_input ("cbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1836 SET_PSR_F (tmp
& (1 << a
));
1837 tmp
= tmp
& ~(1 << a
);
1839 trace_output_32 (sd
, addr
);
1845 OP_6E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1848 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1849 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1851 SET_PSR_F (tmp
& (1 << a
));
1852 tmp
= tmp
& ~(1 << a
);
1854 trace_output_32 (sd
, addr
);
1859 OP_69_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1862 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1863 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1865 SET_PSR_F (tmp
& (1 << a
));
1866 tmp
= tmp
& ~(1 << a
);
1868 trace_output_32 (sd
, addr
);
1874 OP_115_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1877 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1878 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
1880 SET_PSR_F (tmp
& (1 << a
));
1881 tmp
= tmp
& ~(1 << a
);
1883 trace_output_32 (sd
, addr
);
1888 OP_116_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1891 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1892 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
1894 SET_PSR_F (tmp
& (1 << a
));
1895 tmp
= tmp
& ~(1 << a
);
1897 trace_output_32 (sd
, addr
);
1902 OP_E7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1904 uint8 a
= OP
[0] & 0xff;
1905 uint32 addr
= OP
[1], tmp
;
1906 trace_input ("sbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1908 SET_PSR_F (tmp
& (1 << a
));
1909 tmp
= tmp
| (1 << a
);
1911 trace_output_32 (sd
, tmp
);
1916 OP_10B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1918 uint8 a
= OP
[0] & 0xff;
1919 uint32 addr
= OP
[1], tmp
;
1920 trace_input ("sbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1922 SET_PSR_F (tmp
& (1 << a
));
1923 tmp
= tmp
| (1 << a
);
1925 trace_output_32 (sd
, tmp
);
1930 OP_70_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
1932 uint8 a
= OP
[0] & 0xff;
1933 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1934 trace_input ("sbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
1936 SET_PSR_F (tmp
& (1 << a
));
1937 tmp
= tmp
| (1 << a
);
1939 trace_output_32 (sd
, tmp
);
1944 OP_1CA_A (SIM_DESC sd
, SIM_CPU
*cpu
)
1946 uint8 a
= OP
[0] & 0xff;
1947 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1948 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1950 SET_PSR_F (tmp
& (1 << a
));
1951 tmp
= tmp
| (1 << a
);
1953 trace_output_32 (sd
, tmp
);
1958 OP_108_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
1960 uint8 a
= OP
[0] & 0xff;
1961 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1962 trace_input ("sbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1964 SET_PSR_F (tmp
& (1 << a
));
1965 tmp
= tmp
| (1 << a
);
1967 trace_output_32 (sd
, tmp
);
1973 OP_E4_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1975 uint8 a
= OP
[0] & 0xff;
1976 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1977 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1979 SET_PSR_F (tmp
& (1 << a
));
1980 tmp
= tmp
| (1 << a
);
1982 trace_output_32 (sd
, tmp
);
1987 OP_E6_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
1989 uint8 a
= OP
[0] & 0xff;
1990 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1991 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1993 SET_PSR_F (tmp
& (1 << a
));
1994 tmp
= tmp
| (1 << a
);
1996 trace_output_32 (sd
, tmp
);
2002 OP_109_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2004 uint8 a
= OP
[0] & 0xff;
2005 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2006 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2008 SET_PSR_F (tmp
& (1 << a
));
2009 tmp
= tmp
| (1 << a
);
2011 trace_output_32 (sd
, tmp
);
2017 OP_10A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2019 uint8 a
= OP
[0] & 0xff;
2020 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2021 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2023 SET_PSR_F (tmp
& (1 << a
));
2024 tmp
= tmp
| (1 << a
);
2026 trace_output_32 (sd
, tmp
);
2032 OP_77_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2035 uint32 addr
= OP
[1], tmp
;
2036 trace_input ("sbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2038 SET_PSR_F (tmp
& (1 << a
));
2039 tmp
= tmp
| (1 << a
);
2041 trace_output_32 (sd
, tmp
);
2046 OP_11B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2049 uint32 addr
= OP
[1], tmp
;
2050 trace_input ("sbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2052 SET_PSR_F (tmp
& (1 << a
));
2053 tmp
= tmp
| (1 << a
);
2055 trace_output_32 (sd
, tmp
);
2060 OP_3A_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
2063 uint16 a
= (OP
[0]), tmp
;
2064 trace_input ("sbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
2067 addr
= (GPR32 (12)) + OP
[2];
2069 addr
= (GPR32 (13)) + OP
[2];
2072 SET_PSR_F (tmp
& (1 << a
));
2073 tmp
= tmp
| (1 << a
);
2075 trace_output_32 (sd
, addr
);
2080 OP_1CB_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2083 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2084 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2086 SET_PSR_F (tmp
& (1 << a
));
2087 tmp
= tmp
| (1 << a
);
2089 trace_output_32 (sd
, addr
);
2094 OP_118_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2097 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2098 trace_input ("sbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2100 SET_PSR_F (tmp
& (1 << a
));
2101 tmp
= tmp
| (1 << a
);
2103 trace_output_32 (sd
, addr
);
2108 OP_76_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2111 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2112 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2114 SET_PSR_F (tmp
& (1 << a
));
2115 tmp
= tmp
| (1 << a
);
2117 trace_output_32 (sd
, addr
);
2122 OP_71_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2125 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2126 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2128 SET_PSR_F (tmp
& (1 << a
));
2129 tmp
= tmp
| (1 << a
);
2131 trace_output_32 (sd
, addr
);
2136 OP_119_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2139 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2140 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2142 SET_PSR_F (tmp
& (1 << a
));
2143 tmp
= tmp
| (1 << a
);
2145 trace_output_32 (sd
, addr
);
2150 OP_11A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2153 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2154 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2156 SET_PSR_F (tmp
& (1 << a
));
2157 tmp
= tmp
| (1 << a
);
2159 trace_output_32 (sd
, addr
);
2165 OP_F7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
2167 uint8 a
= OP
[0] & 0xff;
2168 uint32 addr
= OP
[1], tmp
;
2169 trace_input ("tbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2171 SET_PSR_F (tmp
& (1 << a
));
2172 trace_output_32 (sd
, tmp
);
2177 OP_10F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2179 uint8 a
= OP
[0] & 0xff;
2180 uint32 addr
= OP
[1], tmp
;
2181 trace_input ("tbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2183 SET_PSR_F (tmp
& (1 << a
));
2184 trace_output_32 (sd
, tmp
);
2189 OP_78_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2191 uint8 a
= (OP
[0]) & 0xff;
2192 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2193 trace_input ("tbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
2195 SET_PSR_F (tmp
& (1 << a
));
2196 trace_output_32 (sd
, addr
);
2201 OP_1EA_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2203 uint8 a
= (OP
[0]) & 0xff;
2204 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2205 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2207 SET_PSR_F (tmp
& (1 << a
));
2208 trace_output_32 (sd
, addr
);
2213 OP_10C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2215 uint8 a
= (OP
[0]) & 0xff;
2216 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2217 trace_input ("tbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2219 SET_PSR_F (tmp
& (1 << a
));
2220 trace_output_32 (sd
, addr
);
2225 OP_F4_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
2227 uint8 a
= (OP
[0]) & 0xff;
2228 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2229 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2231 SET_PSR_F (tmp
& (1 << a
));
2232 trace_output_32 (sd
, addr
);
2237 OP_F6_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
2239 uint8 a
= (OP
[0]) & 0xff;
2240 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2241 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2243 SET_PSR_F (tmp
& (1 << a
));
2244 trace_output_32 (sd
, addr
);
2249 OP_10D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2251 uint8 a
= (OP
[0]) & 0xff;
2252 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2253 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2255 SET_PSR_F (tmp
& (1 << a
));
2256 trace_output_32 (sd
, addr
);
2261 OP_10E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2263 uint8 a
= (OP
[0]) & 0xff;
2264 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2265 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2267 SET_PSR_F (tmp
& (1 << a
));
2268 trace_output_32 (sd
, addr
);
2274 OP_7F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2277 uint32 addr
= OP
[1], tmp
;
2278 trace_input ("tbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2280 SET_PSR_F (tmp
& (1 << a
));
2281 trace_output_32 (sd
, tmp
);
2286 OP_11F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2289 uint32 addr
= OP
[1], tmp
;
2290 trace_input ("tbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2292 SET_PSR_F (tmp
& (1 << a
));
2293 trace_output_32 (sd
, tmp
);
2299 OP_3E_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
2302 uint16 a
= (OP
[0]), tmp
;
2303 trace_input ("tbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
2306 addr
= (GPR32 (12)) + OP
[2];
2308 addr
= (GPR32 (13)) + OP
[2];
2311 SET_PSR_F (tmp
& (1 << a
));
2312 trace_output_32 (sd
, addr
);
2317 OP_1EB_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2320 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2321 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2323 SET_PSR_F (tmp
& (1 << a
));
2324 trace_output_32 (sd
, addr
);
2329 OP_11C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2332 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2333 trace_input ("tbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2335 SET_PSR_F (tmp
& (1 << a
));
2336 trace_output_32 (sd
, addr
);
2341 OP_7E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2344 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2345 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2347 SET_PSR_F (tmp
& (1 << a
));
2348 trace_output_32 (sd
, addr
);
2353 OP_79_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2356 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2357 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2359 SET_PSR_F (tmp
& (1 << a
));
2360 trace_output_32 (sd
, addr
);
2365 OP_11D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2368 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2369 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2371 SET_PSR_F (tmp
& (1 << a
));
2372 trace_output_32 (sd
, addr
);
2378 OP_11E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2381 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2382 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2384 SET_PSR_F (tmp
& (1 << a
));
2385 trace_output_32 (sd
, addr
);
2391 OP_6_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2394 uint16 b
= (GPR (OP
[1]));
2395 trace_input ("tbit", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2396 SET_PSR_F (b
& (1 << a
));
2397 trace_output_16 (sd
, b
);
2402 OP_7_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2404 uint16 a
= GPR (OP
[0]);
2405 uint16 b
= (GPR (OP
[1]));
2406 trace_input ("tbit", OP_REG
, OP_REG
, OP_VOID
);
2407 SET_PSR_F (b
& (1 << a
));
2408 trace_output_16 (sd
, b
);
2414 OP_50_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2416 uint8 a
= (OP
[0]) & 0xFF;
2417 uint8 b
= (GPR (OP
[1])) & 0xFF;
2418 trace_input ("cmpb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2420 SET_PSR_N ((int8
)a
> (int8
)b
);
2422 trace_output_flag (sd
);
2427 OP_50B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2429 uint8 a
= (OP
[0]) & 0xFF;
2430 uint8 b
= (GPR (OP
[1])) & 0xFF;
2431 trace_input ("cmpb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2433 SET_PSR_N ((int8
)a
> (int8
)b
);
2435 trace_output_flag (sd
);
2440 OP_51_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2442 uint8 a
= (GPR (OP
[0])) & 0xFF;
2443 uint8 b
= (GPR (OP
[1])) & 0xFF;
2444 trace_input ("cmpb", OP_REG
, OP_REG
, OP_VOID
);
2446 SET_PSR_N ((int8
)a
> (int8
)b
);
2448 trace_output_flag (sd
);
2453 OP_52_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2456 uint16 b
= GPR (OP
[1]);
2457 trace_input ("cmpw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2459 SET_PSR_N ((int16
)a
> (int16
)b
);
2461 trace_output_flag (sd
);
2466 OP_52B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2469 uint16 b
= GPR (OP
[1]);
2470 trace_input ("cmpw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2472 SET_PSR_N ((int16
)a
> (int16
)b
);
2474 trace_output_flag (sd
);
2479 OP_53_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2481 uint16 a
= GPR (OP
[0]) ;
2482 uint16 b
= GPR (OP
[1]) ;
2483 trace_input ("cmpw", OP_REG
, OP_REG
, OP_VOID
);
2485 SET_PSR_N ((int16
)a
> (int16
)b
);
2487 trace_output_flag (sd
);
2492 OP_56_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2495 uint32 b
= GPR32 (OP
[1]);
2496 trace_input ("cmpd", OP_CONSTANT4
, OP_REGP
, OP_VOID
);
2498 SET_PSR_N ((int32
)a
> (int32
)b
);
2500 trace_output_flag (sd
);
2505 OP_56B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2507 uint32 a
= (SEXT16(OP
[0]));
2508 uint32 b
= GPR32 (OP
[1]);
2509 trace_input ("cmpd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
2511 SET_PSR_N ((int32
)a
> (int32
)b
);
2513 trace_output_flag (sd
);
2518 OP_57_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2520 uint32 a
= GPR32 (OP
[0]) ;
2521 uint32 b
= GPR32 (OP
[1]) ;
2522 trace_input ("cmpd", OP_REGP
, OP_REGP
, OP_VOID
);
2524 SET_PSR_N ((int32
)a
> (int32
)b
);
2526 trace_output_flag (sd
);
2531 OP_9_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2534 uint32 b
= GPR32 (OP
[1]);
2535 trace_input ("cmpd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
2537 SET_PSR_N ((int32
)a
> (int32
)b
);
2539 trace_output_flag (sd
);
2545 OP_58_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2547 uint8 tmp
= OP
[0] & 0xFF;
2548 uint16 a
= (GPR (OP
[1])) & 0xFF00;
2549 trace_input ("movb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2550 SET_GPR (OP
[1], (a
| tmp
));
2551 trace_output_16 (sd
, tmp
);
2556 OP_58B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2558 uint8 tmp
= OP
[0] & 0xFF;
2559 uint16 a
= (GPR (OP
[1])) & 0xFF00;
2560 trace_input ("movb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2561 SET_GPR (OP
[1], (a
| tmp
));
2562 trace_output_16 (sd
, tmp
);
2567 OP_59_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2569 uint8 tmp
= (GPR (OP
[0])) & 0xFF;
2570 uint16 a
= (GPR (OP
[1])) & 0xFF00;
2571 trace_input ("movb", OP_REG
, OP_REG
, OP_VOID
);
2572 SET_GPR (OP
[1], (a
| tmp
));
2573 trace_output_16 (sd
, tmp
);
2578 OP_5A_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2581 trace_input ("movw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
2582 SET_GPR (OP
[1], (tmp
& 0xffff));
2583 trace_output_16 (sd
, tmp
);
2588 OP_5AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2591 trace_input ("movw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2592 SET_GPR (OP
[1], (tmp
& 0xffff));
2593 trace_output_16 (sd
, tmp
);
2598 OP_5B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2600 uint16 tmp
= GPR (OP
[0]);
2601 uint32 a
= GPR32 (OP
[1]);
2602 trace_input ("movw", OP_REG
, OP_REGP
, OP_VOID
);
2603 a
= (a
& 0xffff0000) | tmp
;
2604 SET_GPR32 (OP
[1], a
);
2605 trace_output_16 (sd
, tmp
);
2610 OP_5C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2612 uint8 tmp
= (GPR (OP
[0])) & 0xFF;
2613 trace_input ("movxb", OP_REG
, OP_REG
, OP_VOID
);
2614 SET_GPR (OP
[1], ((SEXT8(tmp
)) & 0xffff));
2615 trace_output_16 (sd
, tmp
);
2620 OP_5D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2622 uint8 tmp
= (GPR (OP
[0])) & 0xFF;
2623 trace_input ("movzb", OP_REG
, OP_REG
, OP_VOID
);
2624 SET_GPR (OP
[1], tmp
);
2625 trace_output_16 (sd
, tmp
);
2630 OP_5E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2632 uint16 tmp
= GPR (OP
[0]);
2633 trace_input ("movxw", OP_REG
, OP_REGP
, OP_VOID
);
2634 SET_GPR32 (OP
[1], SEXT16(tmp
));
2635 trace_output_16 (sd
, tmp
);
2640 OP_5F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2642 uint16 tmp
= GPR (OP
[0]);
2643 trace_input ("movzw", OP_REG
, OP_REGP
, OP_VOID
);
2644 SET_GPR32 (OP
[1], (tmp
& 0x0000FFFF));
2645 trace_output_16 (sd
, tmp
);
2650 OP_54_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2653 trace_input ("movd", OP_CONSTANT4
, OP_REGP
, OP_VOID
);
2654 SET_GPR32 (OP
[1], tmp
);
2655 trace_output_32 (sd
, tmp
);
2660 OP_54B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2662 int32 tmp
= SEXT16(OP
[0]);
2663 trace_input ("movd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
2664 SET_GPR32 (OP
[1], tmp
);
2665 trace_output_32 (sd
, tmp
);
2670 OP_55_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2672 uint32 tmp
= GPR32 (OP
[0]);
2673 trace_input ("movd", OP_REGP
, OP_REGP
, OP_VOID
);
2674 SET_GPR32 (OP
[1], tmp
);
2675 trace_output_32 (sd
, tmp
);
2680 OP_5_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2683 trace_input ("movd", OP_CONSTANT20
, OP_REGP
, OP_VOID
);
2684 SET_GPR32 (OP
[1], tmp
);
2685 trace_output_32 (sd
, tmp
);
2690 OP_7_C (SIM_DESC sd
, SIM_CPU
*cpu
)
2693 trace_input ("movd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
2694 SET_GPR32 (OP
[1], tmp
);
2695 trace_output_32 (sd
, tmp
);
2700 OP_14_D (SIM_DESC sd
, SIM_CPU
*cpu
)
2702 uint32 addr
= GPR (0);
2703 uint16 count
= OP
[0], reg
= 2, tmp
;
2704 trace_input ("loadm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
2707 trace_output_void (sd
);
2708 EXCEPTION (SIM_SIGBUS
);
2718 if (reg
== 6) reg
= 8;
2722 trace_output_void (sd
);
2728 OP_15_D (SIM_DESC sd
, SIM_CPU
*cpu
)
2730 uint32 addr
= GPR32 (0);
2731 uint16 count
= OP
[0], reg
= 2, tmp
;
2732 trace_input ("loadm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
2735 trace_output_void (sd
);
2736 EXCEPTION (SIM_SIGBUS
);
2746 if (reg
== 6) reg
= 8;
2749 SET_GPR32 (0, addr
);
2750 trace_output_void (sd
);
2756 OP_88_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2759 * ADDR = zext24(abs20) | remap (ie 0xF00000)
2762 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
2763 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
2764 * by the core to 16M-64k to 16M. */
2766 uint16 tmp
, a
= (GPR (OP
[1])) & 0xFF00;
2767 uint32 addr
= OP
[0];
2768 trace_input ("loadb", OP_ABS20
, OP_REG
, OP_VOID
);
2769 if (addr
> 0xEFFFF) addr
|= 0xF00000;
2771 SET_GPR (OP
[1], (a
| tmp
));
2772 trace_output_16 (sd
, tmp
);
2777 OP_127_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2783 uint16 tmp
, a
= (GPR (OP
[1])) & 0xFF00;
2784 uint32 addr
= OP
[0];
2785 trace_input ("loadb", OP_ABS24
, OP_REG
, OP_VOID
);
2787 SET_GPR (OP
[1], (a
| tmp
));
2788 trace_output_16 (sd
, tmp
);
2793 OP_45_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
2795 /* loadb [Rindex]ABS20 REG
2796 * ADDR = Rindex + zext24(disp20)
2800 uint16 tmp
, a
= (GPR (OP
[2])) & 0xFF00;
2801 trace_input ("loadb", OP_R_INDEX8_ABS20
, OP_REG
, OP_VOID
);
2804 addr
= (GPR32 (12)) + OP
[1];
2806 addr
= (GPR32 (13)) + OP
[1];
2809 SET_GPR (OP
[2], (a
| tmp
));
2810 trace_output_16 (sd
, tmp
);
2816 OP_B_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
2818 /* loadb DIPS4(REGP) REG
2819 * ADDR = RPBASE + zext24(DISP4)
2821 uint16 tmp
, a
= (GPR (OP
[2])) & 0xFF00;
2822 uint32 addr
= (GPR32 (OP
[1])) + OP
[0];
2823 trace_input ("loadb", OP_RP_BASE_DISP4
, OP_REG
, OP_VOID
);
2825 SET_GPR (OP
[2], (a
| tmp
));
2826 trace_output_16 (sd
, tmp
);
2831 OP_BE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2833 /* loadb [Rindex]disp0(RPbasex) REG
2834 * ADDR = Rpbasex + Rindex
2838 uint16 tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2839 trace_input ("loadb", OP_RP_INDEX_DISP0
, OP_REG
, OP_VOID
);
2841 addr
= (GPR32 (OP
[2])) + OP
[1];
2844 addr
= (GPR32 (12)) + addr
;
2846 addr
= (GPR32 (13)) + addr
;
2849 SET_GPR (OP
[3], (a
| tmp
));
2850 trace_output_16 (sd
, tmp
);
2855 OP_219_A (SIM_DESC sd
, SIM_CPU
*cpu
)
2857 /* loadb [Rindex]disp14(RPbasex) REG
2858 * ADDR = Rpbasex + Rindex + zext24(disp14)
2862 uint16 tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2864 addr
= (GPR32 (OP
[2])) + OP
[1];
2867 addr
= (GPR32 (12)) + addr
;
2869 addr
= (GPR32 (13)) + addr
;
2871 trace_input ("loadb", OP_RP_INDEX_DISP14
, OP_REG
, OP_VOID
);
2873 SET_GPR (OP
[3], (a
| tmp
));
2874 trace_output_16 (sd
, tmp
);
2880 OP_184_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2882 /* loadb DISPE20(REG) REG
2883 * zext24(Rbase) + zext24(dispe20)
2886 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2887 uint32 addr
= OP
[0] + (GPR (OP
[1]));
2888 trace_input ("loadb", OP_R_BASE_DISPE20
, OP_REG
, OP_VOID
);
2890 SET_GPR (OP
[2], (a
| tmp
));
2891 trace_output_16 (sd
, tmp
);
2896 OP_124_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2898 /* loadb DISP20(REG) REG
2899 * ADDR = zext24(Rbase) + zext24(disp20)
2902 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2903 uint32 addr
= OP
[0] + (GPR (OP
[1]));
2904 trace_input ("loadb", OP_R_BASE_DISP20
, OP_REG
, OP_VOID
);
2906 SET_GPR (OP
[2], (a
| tmp
));
2907 trace_output_16 (sd
, tmp
);
2912 OP_BF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2914 /* loadb disp16(REGP) REG
2915 * ADDR = RPbase + zext24(disp16)
2918 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2919 uint32 addr
= (GPR32 (OP
[1])) + OP
[0];
2920 trace_input ("loadb", OP_RP_BASE_DISP16
, OP_REG
, OP_VOID
);
2922 SET_GPR (OP
[2], (a
| tmp
));
2923 trace_output_16 (sd
, tmp
);
2928 OP_125_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2930 /* loadb disp20(REGP) REG
2931 * ADDR = RPbase + zext24(disp20)
2933 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2934 uint32 addr
= (GPR32 (OP
[1])) + OP
[0];
2935 trace_input ("loadb", OP_RP_BASE_DISP20
, OP_REG
, OP_VOID
);
2937 SET_GPR (OP
[2], (a
| tmp
));
2938 trace_output_16 (sd
, tmp
);
2944 OP_185_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2946 /* loadb -disp20(REGP) REG
2947 * ADDR = RPbase + zext24(-disp20)
2949 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2950 uint32 addr
= (GPR32 (OP
[1])) + OP
[1];
2951 trace_input ("loadb", OP_RP_BASE_DISPE20
, OP_REG
, OP_VOID
);
2953 SET_GPR (OP
[2], (a
| tmp
));
2954 trace_output_16 (sd
, tmp
);
2959 OP_126_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
2961 /* loadb [Rindex]disp20(RPbasexb) REG
2962 * ADDR = RPbasex + Rindex + zext24(disp20)
2966 uint16 tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2967 trace_input ("loadb", OP_RP_INDEX_DISP20
, OP_REG
, OP_VOID
);
2969 addr
= (GPR32 (OP
[2])) + OP
[1];
2972 addr
= (GPR32 (12)) + addr
;
2974 addr
= (GPR32 (13)) + addr
;
2977 SET_GPR (OP
[3], (a
| tmp
));
2978 trace_output_16 (sd
, tmp
);
2984 OP_89_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
2987 * ADDR = zext24(abs20) | remap
2990 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
2991 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
2992 * by the core to 16M-64k to 16M. */
2995 uint32 addr
= OP
[0];
2996 trace_input ("loadw", OP_ABS20
, OP_REG
, OP_VOID
);
2997 if (addr
> 0xEFFFF) addr
|= 0xF00000;
2999 SET_GPR (OP
[1], tmp
);
3000 trace_output_16 (sd
, tmp
);
3006 OP_12F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3012 uint32 addr
= OP
[0];
3013 trace_input ("loadw", OP_ABS24
, OP_REG
, OP_VOID
);
3015 SET_GPR (OP
[1], tmp
);
3016 trace_output_16 (sd
, tmp
);
3021 OP_47_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3023 /* loadw [Rindex]ABS20 REG
3024 * ADDR = Rindex + zext24(disp20)
3029 trace_input ("loadw", OP_R_INDEX8_ABS20
, OP_REG
, OP_VOID
);
3032 addr
= (GPR32 (12)) + OP
[1];
3034 addr
= (GPR32 (13)) + OP
[1];
3037 SET_GPR (OP
[2], tmp
);
3038 trace_output_16 (sd
, tmp
);
3044 OP_9_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3046 /* loadw DIPS4(REGP) REGP
3047 * ADDR = RPBASE + zext24(DISP4)
3051 trace_input ("loadw", OP_RP_BASE_DISP4
, OP_REG
, OP_VOID
);
3052 addr
= (GPR32 (OP
[1])) + OP
[0];
3056 a
= (GPR32 (OP
[2])) & 0xffff0000;
3057 SET_GPR32 (OP
[2], (a
| tmp
));
3060 SET_GPR (OP
[2], tmp
);
3062 trace_output_16 (sd
, tmp
);
3068 OP_9E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3070 /* loadw [Rindex]disp0(RPbasex) REG
3071 * ADDR = Rpbasex + Rindex
3076 trace_input ("loadw", OP_RP_INDEX_DISP0
, OP_REG
, OP_VOID
);
3078 addr
= (GPR32 (OP
[2])) + OP
[1];
3081 addr
= (GPR32 (12)) + addr
;
3083 addr
= (GPR32 (13)) + addr
;
3086 SET_GPR (OP
[3], tmp
);
3087 trace_output_16 (sd
, tmp
);
3093 OP_21B_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3095 /* loadw [Rindex]disp14(RPbasex) REG
3096 * ADDR = Rpbasex + Rindex + zext24(disp14)
3101 trace_input ("loadw", OP_RP_INDEX_DISP14
, OP_REG
, OP_VOID
);
3102 addr
= (GPR32 (OP
[2])) + OP
[1];
3105 addr
= (GPR32 (12)) + addr
;
3107 addr
= (GPR32 (13)) + addr
;
3110 SET_GPR (OP
[3], tmp
);
3111 trace_output_16 (sd
, tmp
);
3116 OP_18C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3118 /* loadw dispe20(REG) REGP
3119 * REGP = [DISPE20+[REG]] */
3123 trace_input ("loadw", OP_R_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3124 addr
= OP
[0] + (GPR (OP
[1]));
3128 a
= (GPR32 (OP
[2])) & 0xffff0000;
3129 SET_GPR32 (OP
[2], (a
| tmp
));
3132 SET_GPR (OP
[2], tmp
);
3134 trace_output_16 (sd
, tmp
);
3140 OP_12C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3142 /* loadw DISP20(REG) REGP
3143 * ADDR = zext24(Rbase) + zext24(disp20)
3148 trace_input ("loadw", OP_R_BASE_DISP20
, OP_REGP
, OP_VOID
);
3149 addr
= OP
[0] + (GPR (OP
[1]));
3153 a
= (GPR32 (OP
[2])) & 0xffff0000;
3154 SET_GPR32 (OP
[2], (a
| tmp
));
3157 SET_GPR (OP
[2], tmp
);
3159 trace_output_16 (sd
, tmp
);
3164 OP_9F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3166 /* loadw disp16(REGP) REGP
3167 * ADDR = RPbase + zext24(disp16)
3171 trace_input ("loadw", OP_RP_BASE_DISP16
, OP_REGP
, OP_VOID
);
3172 addr
= (GPR32 (OP
[1])) + OP
[0];
3176 a
= (GPR32 (OP
[2])) & 0xffff0000;
3177 SET_GPR32 (OP
[2], (a
| tmp
));
3180 SET_GPR (OP
[2], tmp
);
3182 trace_output_16 (sd
, tmp
);
3187 OP_12D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3189 /* loadw disp20(REGP) REGP
3190 * ADDR = RPbase + zext24(disp20)
3194 trace_input ("loadw", OP_RP_BASE_DISP20
, OP_REG
, OP_VOID
);
3195 addr
= (GPR32 (OP
[1])) + OP
[0];
3199 a
= (GPR32 (OP
[2])) & 0xffff0000;
3200 SET_GPR32 (OP
[2], (a
| tmp
));
3203 SET_GPR (OP
[2], tmp
);
3205 trace_output_16 (sd
, tmp
);
3210 OP_18D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3212 /* loadw -disp20(REGP) REG
3213 * ADDR = RPbase + zext24(-disp20)
3218 trace_input ("loadw", OP_RP_BASE_DISPE20
, OP_REG
, OP_VOID
);
3219 addr
= (GPR32 (OP
[1])) + OP
[0];
3223 a
= (GPR32 (OP
[2])) & 0xffff0000;
3224 SET_GPR32 (OP
[2], (a
| tmp
));
3227 SET_GPR (OP
[2], tmp
);
3229 trace_output_16 (sd
, tmp
);
3235 OP_12E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3237 /* loadw [Rindex]disp20(RPbasexb) REG
3238 * ADDR = RPbasex + Rindex + zext24(disp20)
3243 trace_input ("loadw", OP_RP_INDEX_DISP20
, OP_REG
, OP_VOID
);
3246 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3248 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3251 SET_GPR (OP
[3], tmp
);
3252 trace_output_16 (sd
, tmp
);
3258 OP_87_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3260 /* loadd ABS20, REGP
3261 * ADDR = zext24(abs20) | remap
3264 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
3265 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
3266 * by the core to 16M-64k to 16M. */
3270 trace_input ("loadd", OP_ABS20
, OP_REGP
, OP_VOID
);
3271 if (addr
> 0xEFFFF) addr
|= 0xF00000;
3273 tmp
= ((tmp
<< 16) & 0xffff)| ((tmp
>> 16) & 0xffff);
3274 SET_GPR32 (OP
[1], tmp
);
3275 trace_output_32 (sd
, tmp
);
3280 OP_12B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3282 /* loadd ABS24, REGP
3286 uint32 addr
= OP
[0];
3288 trace_input ("loadd", OP_ABS24
, OP_REGP
, OP_VOID
);
3290 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3291 SET_GPR32 (OP
[1],tmp
);
3292 trace_output_32 (sd
, tmp
);
3298 OP_46_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3300 /* loadd [Rindex]ABS20 REGP
3301 * ADDR = Rindex + zext24(disp20)
3305 trace_input ("loadd", OP_R_INDEX8_ABS20
, OP_REGP
, OP_VOID
);
3308 addr
= (GPR32 (12)) + OP
[1];
3310 addr
= (GPR32 (13)) + OP
[1];
3313 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3314 SET_GPR32 (OP
[2], tmp
);
3315 trace_output_32 (sd
, tmp
);
3321 OP_A_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3323 /* loadd dips4(regp) REGP
3324 * ADDR = Rpbase + zext24(disp4)
3327 uint32 tmp
, addr
= (GPR32 (OP
[1])) + OP
[0];
3328 trace_input ("loadd", OP_RP_BASE_DISP4
, OP_REGP
, OP_VOID
);
3330 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3331 SET_GPR32 (OP
[2], tmp
);
3332 trace_output_32 (sd
, tmp
);
3338 OP_AE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3340 /* loadd [Rindex]disp0(RPbasex) REGP
3341 * ADDR = Rpbasex + Rindex
3345 trace_input ("loadd", OP_RP_INDEX_DISP0
, OP_REGP
, OP_VOID
);
3348 addr
= (GPR32 (12)) + (GPR32 (OP
[2])) + OP
[1];
3350 addr
= (GPR32 (13)) + (GPR32 (OP
[2])) + OP
[1];
3353 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3354 SET_GPR32 (OP
[3], tmp
);
3355 trace_output_32 (sd
, tmp
);
3361 OP_21A_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3363 /* loadd [Rindex]disp14(RPbasex) REGP
3364 * ADDR = Rpbasex + Rindex + zext24(disp14)
3368 trace_input ("loadd", OP_RP_INDEX_DISP14
, OP_REGP
, OP_VOID
);
3371 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3373 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3376 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3377 SET_GPR (OP
[3],tmp
);
3378 trace_output_32 (sd
, tmp
);
3384 OP_188_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3386 /* loadd dispe20(REG) REG
3387 * zext24(Rbase) + zext24(dispe20)
3390 uint32 tmp
, addr
= OP
[0] + (GPR (OP
[1]));
3391 trace_input ("loadd", OP_R_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3393 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3394 SET_GPR32 (OP
[2], tmp
);
3395 trace_output_32 (sd
, tmp
);
3401 OP_128_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3403 /* loadd DISP20(REG) REG
3404 * ADDR = zext24(Rbase) + zext24(disp20)
3407 uint32 tmp
, addr
= OP
[0] + (GPR (OP
[1]));
3408 trace_input ("loadd", OP_R_BASE_DISP20
, OP_REGP
, OP_VOID
);
3410 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3411 SET_GPR32 (OP
[2], tmp
);
3412 trace_output_32 (sd
, tmp
);
3417 OP_AF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3419 /* loadd disp16(REGP) REGP
3420 * ADDR = RPbase + zext24(disp16)
3422 uint32 tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3423 trace_input ("loadd", OP_RP_BASE_DISP16
, OP_REGP
, OP_VOID
);
3425 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3426 SET_GPR32 (OP
[2], tmp
);
3427 trace_output_32 (sd
, tmp
);
3433 OP_129_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3435 /* loadd disp20(REGP) REGP
3436 * ADDR = RPbase + zext24(disp20)
3438 uint32 tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3439 trace_input ("loadd", OP_RP_BASE_DISP20
, OP_REGP
, OP_VOID
);
3441 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3442 SET_GPR32 (OP
[2], tmp
);
3443 trace_output_32 (sd
, tmp
);
3448 OP_189_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3450 /* loadd -disp20(REGP) REGP
3451 * ADDR = RPbase + zext24(-disp20)
3454 uint32 tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3455 trace_input ("loadd", OP_RP_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3457 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3458 SET_GPR32 (OP
[2], tmp
);
3459 trace_output_32 (sd
, tmp
);
3464 OP_12A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3466 /* loadd [Rindex]disp20(RPbasexb) REGP
3467 * ADDR = RPbasex + Rindex + zext24(disp20)
3471 trace_input ("loadd", OP_RP_INDEX_DISP20
, OP_REGP
, OP_VOID
);
3474 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3476 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3479 tmp
= ((tmp
<< 16) & 0xffff)| ((tmp
>> 16) & 0xffff);
3480 SET_GPR32 (OP
[3], tmp
);
3481 trace_output_32 (sd
, tmp
);
3487 OP_C8_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3490 * ADDR = zext24(abs20) | remap
3493 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
3494 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
3495 * by the core to 16M-64k to 16M. */
3497 uint8 a
= ((GPR (OP
[0])) & 0xff);
3498 uint32 addr
= OP
[1];
3499 trace_input ("storb", OP_REG
, OP_ABS20_OUTPUT
, OP_VOID
);
3501 trace_output_32 (sd
, addr
);
3506 OP_137_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3512 uint8 a
= ((GPR (OP
[0])) & 0xff);
3513 uint32 addr
= OP
[1];
3514 trace_input ("storb", OP_REG
, OP_ABS24_OUTPUT
, OP_VOID
);
3516 trace_output_32 (sd
, addr
);
3521 OP_65_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3523 /* storb REG, [Rindex]ABS20
3524 * ADDR = Rindex + zext24(disp20)
3528 uint8 a
= ((GPR (OP
[0])) & 0xff);
3529 trace_input ("storb", OP_REG
, OP_R_INDEX8_ABS20
, OP_VOID
);
3532 addr
= (GPR32 (12)) + OP
[2];
3534 addr
= (GPR32 (13)) + OP
[2];
3537 trace_output_32 (sd
, addr
);
3542 OP_F_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3544 /* storb REG, DIPS4(REGP)
3545 * ADDR = RPBASE + zext24(DISP4)
3548 uint16 a
= ((GPR (OP
[0])) & 0xff);
3549 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3550 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPE4
, OP_VOID
);
3552 trace_output_32 (sd
, addr
);
3557 OP_FE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3559 /* storb [Rindex]disp0(RPbasex) REG
3560 * ADDR = Rpbasex + Rindex
3564 uint8 a
= ((GPR (OP
[0])) & 0xff);
3565 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISP0
, OP_VOID
);
3568 addr
= (GPR32 (12)) + (GPR32 (OP
[3])) + OP
[2];
3570 addr
= (GPR32 (13)) + (GPR32 (OP
[3])) + OP
[2];
3573 trace_output_32 (sd
, addr
);
3578 OP_319_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3580 /* storb REG, [Rindex]disp14(RPbasex)
3581 * ADDR = Rpbasex + Rindex + zext24(disp14)
3584 uint8 a
= ((GPR (OP
[0])) & 0xff);
3585 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3586 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISP14
, OP_VOID
);
3588 trace_output_32 (sd
, addr
);
3593 OP_194_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3595 /* storb REG, DISPE20(REG)
3596 * zext24(Rbase) + zext24(dispe20)
3599 uint8 a
= ((GPR (OP
[0])) & 0xff);
3600 uint32 addr
= OP
[1] + (GPR (OP
[2]));
3601 trace_input ("storb", OP_REG
, OP_R_BASE_DISPE20
, OP_VOID
);
3603 trace_output_32 (sd
, addr
);
3608 OP_134_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3610 /* storb REG, DISP20(REG)
3611 * ADDR = zext24(Rbase) + zext24(disp20)
3614 uint8 a
= (GPR (OP
[0]) & 0xff);
3615 uint32 addr
= OP
[1] + (GPR (OP
[2]));
3616 trace_input ("storb", OP_REG
, OP_R_BASE_DISPS20
, OP_VOID
);
3618 trace_output_32 (sd
, addr
);
3623 OP_FF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3625 /* storb REG, disp16(REGP)
3626 * ADDR = RPbase + zext24(disp16)
3629 uint8 a
= ((GPR (OP
[0])) & 0xff);
3630 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3631 trace_input ("storb", OP_REG
, OP_RP_BASE_DISP16
, OP_VOID
);
3633 trace_output_32 (sd
, addr
);
3638 OP_135_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3640 /* storb REG, disp20(REGP)
3641 * ADDR = RPbase + zext24(disp20)
3644 uint8 a
= ((GPR (OP
[0])) & 0xff);
3645 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3646 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPS20
, OP_VOID
);
3648 trace_output_32 (sd
, addr
);
3653 OP_195_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3655 /* storb REG, -disp20(REGP)
3656 * ADDR = RPbase + zext24(-disp20)
3659 uint8 a
= (GPR (OP
[0]) & 0xff);
3660 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3661 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPE20
, OP_VOID
);
3663 trace_output_32 (sd
, addr
);
3668 OP_136_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3670 /* storb REG, [Rindex]disp20(RPbase)
3671 * ADDR = RPbasex + Rindex + zext24(disp20)
3674 uint8 a
= (GPR (OP
[0])) & 0xff;
3675 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3676 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3678 trace_output_32 (sd
, addr
);
3681 /* STR_IMM instructions. */
3684 OP_81_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3686 uint8 a
= (OP
[0]) & 0xff;
3687 uint32 addr
= OP
[1];
3688 trace_input ("storb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
3690 trace_output_32 (sd
, addr
);
3695 OP_123_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3697 uint8 a
= (OP
[0]) & 0xff;
3698 uint32 addr
= OP
[1];
3699 trace_input ("storb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
3701 trace_output_32 (sd
, addr
);
3706 OP_42_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3709 uint8 a
= (OP
[0]) & 0xff;
3710 trace_input ("storb", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
3713 addr
= (GPR32 (12)) + OP
[2];
3715 addr
= (GPR32 (13)) + OP
[2];
3718 trace_output_32 (sd
, addr
);
3723 OP_218_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3725 uint8 a
= (OP
[0]) & 0xff;
3726 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3727 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISP14
, OP_VOID
);
3729 trace_output_32 (sd
, addr
);
3734 OP_82_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3736 uint8 a
= (OP
[0]) & 0xff;
3737 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3738 trace_input ("storb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
3740 trace_output_32 (sd
, addr
);
3745 OP_120_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3747 uint8 a
= (OP
[0]) & 0xff;
3748 uint32 addr
= (GPR (OP
[2])) + OP
[1];
3749 trace_input ("storb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
3751 trace_output_32 (sd
, addr
);
3756 OP_83_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3758 uint8 a
= (OP
[0]) & 0xff;
3759 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3760 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
3762 trace_output_32 (sd
, addr
);
3767 OP_121_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3769 uint8 a
= (OP
[0]) & 0xff;
3770 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3771 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
3773 trace_output_32 (sd
, addr
);
3778 OP_122_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3780 uint8 a
= (OP
[0]) & 0xff;
3781 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3782 trace_input ("storb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3784 trace_output_32 (sd
, addr
);
3786 /* endif for STR_IMM. */
3790 OP_C9_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3792 uint16 a
= GPR (OP
[0]);
3793 uint32 addr
= OP
[1];
3794 trace_input ("storw", OP_REG
, OP_ABS20_OUTPUT
, OP_VOID
);
3796 trace_output_32 (sd
, addr
);
3801 OP_13F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3803 uint16 a
= GPR (OP
[0]);
3804 uint32 addr
= OP
[1];
3805 trace_input ("storw", OP_REG
, OP_ABS24_OUTPUT
, OP_VOID
);
3807 trace_output_32 (sd
, addr
);
3812 OP_67_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3815 uint16 a
= GPR (OP
[0]);
3816 trace_input ("storw", OP_REG
, OP_R_INDEX8_ABS20
, OP_VOID
);
3819 addr
= (GPR32 (12)) + OP
[2];
3821 addr
= (GPR32 (13)) + OP
[2];
3824 trace_output_32 (sd
, addr
);
3830 OP_D_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
3832 uint16 a
= (GPR (OP
[0]));
3833 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3834 trace_input ("storw", OP_REGP
, OP_RP_BASE_DISPE4
, OP_VOID
);
3836 trace_output_32 (sd
, addr
);
3841 OP_DE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3843 uint16 a
= GPR (OP
[0]);
3844 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3845 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISP0
, OP_VOID
);
3847 trace_output_32 (sd
, addr
);
3852 OP_31B_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3854 uint16 a
= GPR (OP
[0]);
3855 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3856 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISP14
, OP_VOID
);
3858 trace_output_32 (sd
, addr
);
3863 OP_19C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3865 uint16 a
= (GPR (OP
[0]));
3866 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3867 trace_input ("storw", OP_REGP
, OP_RP_BASE_DISPE20
, OP_VOID
);
3869 trace_output_32 (sd
, addr
);
3874 OP_13C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3876 uint16 a
= (GPR (OP
[0]));
3877 uint32 addr
= (GPR (OP
[2])) + OP
[1];
3878 trace_input ("storw", OP_REG
, OP_R_BASE_DISPS20
, OP_VOID
);
3880 trace_output_32 (sd
, addr
);
3885 OP_DF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3887 uint16 a
= (GPR (OP
[0]));
3888 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3889 trace_input ("storw", OP_REG
, OP_RP_BASE_DISP16
, OP_VOID
);
3891 trace_output_32 (sd
, addr
);
3896 OP_13D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3898 uint16 a
= (GPR (OP
[0]));
3899 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3900 trace_input ("storw", OP_REG
, OP_RP_BASE_DISPS20
, OP_VOID
);
3902 trace_output_32 (sd
, addr
);
3907 OP_19D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3909 uint16 a
= (GPR (OP
[0]));
3910 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3911 trace_input ("storw", OP_REG
, OP_RP_BASE_DISPE20
, OP_VOID
);
3913 trace_output_32 (sd
, addr
);
3918 OP_13E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3920 uint16 a
= (GPR (OP
[0]));
3921 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3922 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3924 trace_output_32 (sd
, addr
);
3927 /* STORE-w IMM instruction *****/
3930 OP_C1_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3933 uint32 addr
= OP
[1];
3934 trace_input ("storw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
3936 trace_output_32 (sd
, addr
);
3941 OP_133_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3944 uint32 addr
= OP
[1];
3945 trace_input ("storw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
3947 trace_output_32 (sd
, addr
);
3952 OP_62_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
3956 trace_input ("storw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
3959 addr
= (GPR32 (12)) + OP
[2];
3961 addr
= (GPR32 (13)) + OP
[2];
3964 trace_output_32 (sd
, addr
);
3969 OP_318_A (SIM_DESC sd
, SIM_CPU
*cpu
)
3972 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3973 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISP14
, OP_VOID
);
3975 trace_output_32 (sd
, addr
);
3980 OP_C2_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
3983 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3984 trace_input ("storw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
3986 trace_output_32 (sd
, addr
);
3991 OP_130_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
3994 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3995 trace_input ("storw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
3997 trace_output_32 (sd
, addr
);
4002 OP_C3_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4005 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4006 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
4008 trace_output_32 (sd
, addr
);
4014 OP_131_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4017 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4018 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
4020 trace_output_32 (sd
, addr
);
4025 OP_132_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4028 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4029 trace_input ("storw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
4031 trace_output_32 (sd
, addr
);
4037 OP_C7_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4039 uint32 a
= GPR32 (OP
[0]);
4040 uint32 addr
= OP
[1];
4041 trace_input ("stord", OP_REGP
, OP_ABS20_OUTPUT
, OP_VOID
);
4043 trace_output_32 (sd
, addr
);
4048 OP_13B_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4050 uint32 a
= GPR32 (OP
[0]);
4051 uint32 addr
= OP
[1];
4052 trace_input ("stord", OP_REGP
, OP_ABS24_OUTPUT
, OP_VOID
);
4054 trace_output_32 (sd
, addr
);
4059 OP_66_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4061 uint32 addr
, a
= GPR32 (OP
[0]);
4062 trace_input ("stord", OP_REGP
, OP_R_INDEX8_ABS20
, OP_VOID
);
4065 addr
= (GPR32 (12)) + OP
[2];
4067 addr
= (GPR32 (13)) + OP
[2];
4070 trace_output_32 (sd
, addr
);
4075 OP_E_4 (SIM_DESC sd
, SIM_CPU
*cpu
)
4077 uint32 a
= GPR32 (OP
[0]);
4078 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4079 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPE4
, OP_VOID
);
4081 trace_output_32 (sd
, addr
);
4086 OP_EE_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4088 uint32 a
= GPR32 (OP
[0]);
4089 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4090 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISP0
, OP_VOID
);
4092 trace_output_32 (sd
, addr
);
4097 OP_31A_A (SIM_DESC sd
, SIM_CPU
*cpu
)
4099 uint32 a
= GPR32 (OP
[0]);
4100 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4101 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISP14
, OP_VOID
);
4103 trace_output_32 (sd
, addr
);
4108 OP_198_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4110 uint32 a
= GPR32 (OP
[0]);
4111 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4112 trace_input ("stord", OP_REGP
, OP_R_BASE_DISPE20
, OP_VOID
);
4114 trace_output_32 (sd
, addr
);
4119 OP_138_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4121 uint32 a
= GPR32 (OP
[0]);
4122 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4123 trace_input ("stord", OP_REGP
, OP_R_BASE_DISPS20
, OP_VOID
);
4125 trace_output_32 (sd
, addr
);
4130 OP_EF_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4132 uint32 a
= GPR32 (OP
[0]);
4133 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4134 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISP16
, OP_VOID
);
4136 trace_output_32 (sd
, addr
);
4141 OP_139_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4143 uint32 a
= GPR32 (OP
[0]);
4144 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4145 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPS20
, OP_VOID
);
4147 trace_output_32 (sd
, addr
);
4152 OP_199_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4154 uint32 a
= GPR32 (OP
[0]);
4155 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4156 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPE20
, OP_VOID
);
4158 trace_output_32 (sd
, addr
);
4163 OP_13A_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4165 uint32 a
= GPR32 (OP
[0]);
4166 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4167 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISPS20
, OP_VOID
);
4169 trace_output_32 (sd
, addr
);
4174 OP_14D_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4178 trace_input ("macuw", OP_REG
, OP_REG
, OP_REGP
);
4182 /*REVISIT FOR SATURATION and Q FORMAT. */
4183 SET_GPR32 (OP
[2], tmp
);
4184 trace_output_32 (sd
, tmp
);
4189 OP_14E_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4193 trace_input ("macuw", OP_REG
, OP_REG
, OP_REGP
);
4197 /*REVISIT FOR SATURATION. */
4198 SET_GPR32 (OP
[2], tmp
);
4199 trace_output_32 (sd
, tmp
);
4204 OP_14F_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
4208 trace_input ("macsw", OP_REG
, OP_REG
, OP_REGP
);
4212 /*REVISIT FOR SATURATION. */
4213 SET_GPR32 (OP
[2], tmp
);
4214 trace_output_32 (sd
, tmp
);
4220 OP_64_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4223 int8 a
= (OP
[0]) & 0xff;
4224 int8 b
= (GPR (OP
[1])) & 0xff;
4225 trace_input ("mulb", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
4226 tmp
= (a
* b
) & 0xff;
4227 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4228 trace_output_16 (sd
, tmp
);
4233 OP_64B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4236 int8 a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4237 trace_input ("mulb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4238 tmp
= (a
* b
) & 0xff;
4239 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4240 trace_output_16 (sd
, tmp
);
4246 OP_65_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4249 int8 a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4250 trace_input ("mulb", OP_REG
, OP_REG
, OP_VOID
);
4251 tmp
= (a
* b
) & 0xff;
4252 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4253 trace_output_16 (sd
, tmp
);
4259 OP_66_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4263 int16 b
= (GPR (OP
[1]));
4264 trace_input ("mulw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
4265 tmp
= (a
* b
) & 0xffff;
4266 SET_GPR (OP
[1], tmp
);
4267 trace_output_32 (sd
, tmp
);
4272 OP_66B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4275 int16 a
= OP
[0], b
= (GPR (OP
[1]));
4276 trace_input ("mulw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4277 tmp
= (a
* b
) & 0xffff;
4278 SET_GPR (OP
[1], tmp
);
4279 trace_output_32 (sd
, tmp
);
4285 OP_67_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4288 int16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4289 trace_input ("mulw", OP_REG
, OP_REG
, OP_VOID
);
4290 tmp
= (a
* b
) & 0xffff;
4291 SET_GPR (OP
[1], tmp
);
4292 trace_output_32 (sd
, tmp
);
4298 OP_B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4301 int8 a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4302 trace_input ("mulsb", OP_REG
, OP_REG
, OP_VOID
);
4304 SET_GPR (OP
[1], tmp
);
4305 trace_output_32 (sd
, tmp
);
4310 OP_62_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4313 int16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4314 trace_input ("mulsw", OP_REG
, OP_REGP
, OP_VOID
);
4316 SET_GPR32 (OP
[1], tmp
);
4317 trace_output_32 (sd
, tmp
);
4322 OP_63_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4325 uint16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4326 trace_input ("muluw", OP_REG
, OP_REGP
, OP_VOID
);
4328 SET_GPR32 (OP
[1], tmp
);
4329 trace_output_32 (sd
, tmp
);
4335 OP_2C00_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
4337 trace_input ("nop", OP_VOID
, OP_VOID
, OP_VOID
);
4340 ins_type_counters
[ (int)State
.ins_type
]--; /* don't count nops as normal instructions */
4341 switch (State
.ins_type
)
4344 ins_type_counters
[ (int)INS_UNKNOWN
]++;
4348 EXCEPTION (SIM_SIGTRAP
);
4350 trace_output_void (sd
);
4356 OP_24_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4358 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4359 trace_input ("orb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4361 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4362 trace_output_16 (sd
, tmp
);
4367 OP_24B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4369 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4370 trace_input ("orb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4372 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4373 trace_output_16 (sd
, tmp
);
4378 OP_25_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4380 uint8 tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4381 trace_input ("orb", OP_REG
, OP_REG
, OP_VOID
);
4383 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4384 trace_output_16 (sd
, tmp
);
4389 OP_26_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4391 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
4392 trace_input ("orw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4394 SET_GPR (OP
[1], tmp
);
4395 trace_output_16 (sd
, tmp
);
4401 OP_26B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4403 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
4404 trace_input ("orw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4406 SET_GPR (OP
[1], tmp
);
4407 trace_output_16 (sd
, tmp
);
4412 OP_27_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4414 uint16 tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4415 trace_input ("orw", OP_REG
, OP_REG
, OP_VOID
);
4417 SET_GPR (OP
[1], tmp
);
4418 trace_output_16 (sd
, tmp
);
4424 OP_13_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
4427 uint16 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4428 trace_input ("lshb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4429 /* A positive count specifies a shift to the left;
4430 * A negative count specifies a shift to the right. */
4436 sign_flag
= 0; /* Reset sign_flag. */
4438 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4439 trace_output_16 (sd
, tmp
);
4444 OP_44_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4446 uint16 a
= (GPR (OP
[0])) & 0xff;
4447 uint16 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4448 trace_input ("lshb", OP_REG
, OP_REG
, OP_VOID
);
4449 if (a
& ((long)1 << 3))
4454 a
= (unsigned int) (a
& 0x7);
4456 /* A positive count specifies a shift to the left;
4457 * A negative count specifies a shift to the right. */
4463 sign_flag
= 0; /* Reset sign_flag. */
4464 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4465 trace_output_16 (sd
, tmp
);
4470 OP_46_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4472 uint16 tmp
, b
= GPR (OP
[1]);
4473 int16 a
= GPR (OP
[0]);
4474 trace_input ("lshw", OP_REG
, OP_REG
, OP_VOID
);
4475 if (a
& ((long)1 << 4))
4480 a
= (unsigned int) (a
& 0xf);
4482 /* A positive count specifies a shift to the left;
4483 * A negative count specifies a shift to the right. */
4489 sign_flag
= 0; /* Reset sign_flag. */
4490 SET_GPR (OP
[1], (tmp
& 0xffff));
4491 trace_output_16 (sd
, tmp
);
4496 OP_49_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4498 uint16 tmp
, b
= GPR (OP
[1]);
4500 trace_input ("lshw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4501 /* A positive count specifies a shift to the left;
4502 * A negative count specifies a shift to the right. */
4508 sign_flag
= 0; /* Reset sign_flag. */
4509 SET_GPR (OP
[1], (tmp
& 0xffff));
4510 trace_output_16 (sd
, tmp
);
4515 OP_25_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4517 uint32 tmp
, b
= GPR32 (OP
[1]);
4519 trace_input ("lshd", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4520 /* A positive count specifies a shift to the left;
4521 * A negative count specifies a shift to the right. */
4527 sign_flag
= 0; /* Reset sign flag. */
4529 SET_GPR32 (OP
[1], tmp
);
4530 trace_output_32 (sd
, tmp
);
4535 OP_47_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4537 uint32 tmp
, b
= GPR32 (OP
[1]);
4538 uint16 a
= GPR (OP
[0]);
4539 trace_input ("lshd", OP_REG
, OP_REGP
, OP_VOID
);
4540 if (a
& ((long)1 << 5))
4545 a
= (unsigned int) (a
& 0x1f);
4546 /* A positive count specifies a shift to the left;
4547 * A negative count specifies a shift to the right. */
4553 sign_flag
= 0; /* Reset sign flag. */
4555 SET_GPR32 (OP
[1], tmp
);
4556 trace_output_32 (sd
, tmp
);
4561 OP_80_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
4564 int8 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4565 trace_input ("ashub", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4566 /* A positive count specifies a shift to the left;
4567 * A negative count specifies a shift to the right. */
4573 sign_flag
= 0; /* Reset sign flag. */
4575 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xff00)));
4576 trace_output_16 (sd
, tmp
);
4581 OP_81_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
4584 int8 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4585 trace_input ("ashub", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4586 /* A positive count specifies a shift to the left;
4587 * A negative count specifies a shift to the right. */
4593 sign_flag
= 0; /* Reset sign flag. */
4595 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4596 trace_output_16 (sd
, tmp
);
4602 OP_41_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4604 int16 a
= (GPR (OP
[0]));
4605 int8 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4606 trace_input ("ashub", OP_REG
, OP_REG
, OP_VOID
);
4608 if (a
& ((long)1 << 3))
4613 a
= (unsigned int) (a
& 0x7);
4615 /* A positive count specifies a shift to the left;
4616 * A negative count specifies a shift to the right. */
4622 sign_flag
= 0; /* Reset sign flag. */
4624 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4625 trace_output_16 (sd
, tmp
);
4631 OP_42_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4633 int16 tmp
, b
= GPR (OP
[1]);
4635 trace_input ("ashuw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4636 /* A positive count specifies a shift to the left;
4637 * A negative count specifies a shift to the right. */
4643 sign_flag
= 0; /* Reset sign flag. */
4645 SET_GPR (OP
[1], (tmp
& 0xffff));
4646 trace_output_16 (sd
, tmp
);
4651 OP_43_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4653 int16 tmp
, b
= GPR (OP
[1]);
4655 trace_input ("ashuw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4656 /* A positive count specifies a shift to the left;
4657 * A negative count specifies a shift to the right. */
4663 sign_flag
= 0; /* Reset sign flag. */
4664 SET_GPR (OP
[1], (tmp
& 0xffff));
4665 trace_output_16 (sd
, tmp
);
4670 OP_45_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4673 int16 a
= GPR (OP
[0]), b
= GPR (OP
[1]);
4674 trace_input ("ashuw", OP_REG
, OP_REG
, OP_VOID
);
4676 if (a
& ((long)1 << 4))
4681 a
= (unsigned int) (a
& 0xf);
4682 /* A positive count specifies a shift to the left;
4683 * A negative count specifies a shift to the right. */
4690 sign_flag
= 0; /* Reset sign flag. */
4691 SET_GPR (OP
[1], (tmp
& 0xffff));
4692 trace_output_16 (sd
, tmp
);
4697 OP_26_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4699 int32 tmp
,b
= GPR32 (OP
[1]);
4701 trace_input ("ashud", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4702 /* A positive count specifies a shift to the left;
4703 * A negative count specifies a shift to the right. */
4709 sign_flag
= 0; /* Reset sign flag. */
4710 SET_GPR32 (OP
[1], tmp
);
4711 trace_output_32 (sd
, tmp
);
4716 OP_27_7 (SIM_DESC sd
, SIM_CPU
*cpu
)
4719 int32 a
= OP
[0], b
= GPR32 (OP
[1]);
4720 trace_input ("ashud", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4721 /* A positive count specifies a shift to the left;
4722 * A negative count specifies a shift to the right. */
4728 sign_flag
= 0; /* Reset sign flag. */
4729 SET_GPR32 (OP
[1], tmp
);
4730 trace_output_32 (sd
, tmp
);
4735 OP_48_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4738 int32 a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
4739 trace_input ("ashud", OP_REGP
, OP_REGP
, OP_VOID
);
4741 if (a
& ((long)1 << 5))
4746 a
= (unsigned int) (a
& 0x1f);
4747 /* A positive count specifies a shift to the left;
4748 * A negative count specifies a shift to the right. */
4754 sign_flag
= 0; /* Reset sign flag. */
4755 SET_GPR32 (OP
[1], tmp
);
4756 trace_output_32 (sd
, tmp
);
4762 OP_16_D (SIM_DESC sd
, SIM_CPU
*cpu
)
4764 uint32 addr
= GPR (1);
4765 uint16 count
= OP
[0], reg
= 2;
4766 trace_input ("storm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
4769 trace_output_void (sd
);
4770 EXCEPTION (SIM_SIGBUS
);
4775 SW (addr
, (GPR (reg
)));
4779 if (reg
== 6) reg
= 8;
4784 trace_output_void (sd
);
4790 OP_17_D (SIM_DESC sd
, SIM_CPU
*cpu
)
4792 uint32 addr
= GPR32 (6);
4793 uint16 count
= OP
[0], reg
= 2;
4794 trace_input ("stormp", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
4797 trace_output_void (sd
);
4798 EXCEPTION (SIM_SIGBUS
);
4803 SW (addr
, (GPR (reg
)));
4807 if (reg
== 6) reg
= 8;
4810 SET_GPR32 (6, addr
);
4811 trace_output_void (sd
);
4816 OP_38_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4819 uint8 b
= (GPR (OP
[1])) & 0xff;
4820 uint16 tmp
= (~a
+ 1 + b
) & 0xff;
4821 trace_input ("subb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4822 /* see ../common/sim-alu.h for a more extensive discussion on how to
4823 compute the carry/overflow bits. */
4824 SET_PSR_C (tmp
> 0xff);
4825 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4826 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4827 trace_output_16 (sd
, tmp
);
4832 OP_38B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4834 uint8 a
= OP
[0] & 0xFF;
4835 uint8 b
= (GPR (OP
[1])) & 0xFF;
4836 uint16 tmp
= (~a
+ 1 + b
) & 0xFF;
4837 trace_input ("subb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4838 /* see ../common/sim-alu.h for a more extensive discussion on how to
4839 compute the carry/overflow bits. */
4840 SET_PSR_C (tmp
> 0xff);
4841 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4842 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4843 trace_output_16 (sd
, tmp
);
4848 OP_39_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4850 uint8 a
= (GPR (OP
[0])) & 0xFF;
4851 uint8 b
= (GPR (OP
[1])) & 0xFF;
4852 uint16 tmp
= (~a
+ 1 + b
) & 0xff;
4853 trace_input ("subb", OP_REG
, OP_REG
, OP_VOID
);
4854 /* see ../common/sim-alu.h for a more extensive discussion on how to
4855 compute the carry/overflow bits. */
4856 SET_PSR_C (tmp
> 0xff);
4857 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4858 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4859 trace_output_16 (sd
, tmp
);
4864 OP_3A_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4867 uint16 b
= GPR (OP
[1]);
4868 uint16 tmp
= (~a
+ 1 + b
);
4869 trace_input ("subw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4870 /* see ../common/sim-alu.h for a more extensive discussion on how to
4871 compute the carry/overflow bits. */
4872 SET_PSR_C (tmp
> 0xffff);
4873 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4874 SET_GPR (OP
[1], tmp
);
4875 trace_output_16 (sd
, tmp
);
4880 OP_3AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4883 uint16 b
= GPR (OP
[1]);
4884 uint32 tmp
= (~a
+ 1 + b
);
4885 trace_input ("subw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4886 /* see ../common/sim-alu.h for a more extensive discussion on how to
4887 compute the carry/overflow bits. */
4888 SET_PSR_C (tmp
> 0xffff);
4889 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4890 SET_GPR (OP
[1], tmp
& 0xffff);
4891 trace_output_16 (sd
, tmp
);
4896 OP_3B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4898 uint16 a
= GPR (OP
[0]);
4899 uint16 b
= GPR (OP
[1]);
4900 uint32 tmp
= (~a
+ 1 + b
);
4901 trace_input ("subw", OP_REG
, OP_REG
, OP_VOID
);
4902 /* see ../common/sim-alu.h for a more extensive discussion on how to
4903 compute the carry/overflow bits. */
4904 SET_PSR_C (tmp
> 0xffff);
4905 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4906 SET_GPR (OP
[1], tmp
& 0xffff);
4907 trace_output_16 (sd
, tmp
);
4912 OP_3C_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4915 uint8 b
= (GPR (OP
[1])) & 0xff;
4916 //uint16 tmp1 = a + 1;
4917 uint16 tmp1
= a
+ (PSR_C
);
4918 uint16 tmp
= (~tmp1
+ 1 + b
);
4919 trace_input ("subcb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4920 /* see ../common/sim-alu.h for a more extensive discussion on how to
4921 compute the carry/overflow bits. */
4922 SET_PSR_C (tmp
> 0xff);
4923 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4924 SET_GPR (OP
[1], tmp
);
4925 trace_output_16 (sd
, tmp
);
4930 OP_3CB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4933 uint16 b
= (GPR (OP
[1])) & 0xff;
4934 //uint16 tmp1 = a + 1;
4935 uint16 tmp1
= a
+ (PSR_C
);
4936 uint16 tmp
= (~tmp1
+ 1 + b
);
4937 trace_input ("subcb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4938 /* see ../common/sim-alu.h for a more extensive discussion on how to
4939 compute the carry/overflow bits. */
4940 SET_PSR_C (tmp
> 0xff);
4941 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4942 SET_GPR (OP
[1], tmp
);
4943 trace_output_16 (sd
, tmp
);
4948 OP_3D_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4950 uint16 a
= (GPR (OP
[0])) & 0xff;
4951 uint16 b
= (GPR (OP
[1])) & 0xff;
4952 uint16 tmp1
= a
+ (PSR_C
);
4953 uint16 tmp
= (~tmp1
+ 1 + b
);
4954 trace_input ("subcb", OP_REG
, OP_REG
, OP_VOID
);
4955 /* see ../common/sim-alu.h for a more extensive discussion on how to
4956 compute the carry/overflow bits. */
4957 SET_PSR_C (tmp
> 0xff);
4958 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4959 SET_GPR (OP
[1], tmp
);
4960 trace_output_16 (sd
, tmp
);
4965 OP_3E_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
4967 uint16 a
= OP
[0], b
= (GPR (OP
[1]));
4968 uint16 tmp1
= a
+ (PSR_C
);
4969 uint16 tmp
= (~tmp1
+ 1 + b
);
4970 trace_input ("subcw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4971 /* see ../common/sim-alu.h for a more extensive discussion on how to
4972 compute the carry/overflow bits. */
4973 SET_PSR_C (tmp
> 0xffff);
4974 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4975 SET_GPR (OP
[1], tmp
);
4976 trace_output_16 (sd
, tmp
);
4981 OP_3EB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
4984 uint16 b
= GPR (OP
[1]);
4985 uint16 tmp1
= a
+ (PSR_C
);
4986 uint16 tmp
= (~tmp1
+ 1 + b
);
4987 trace_input ("subcw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4988 /* see ../common/sim-alu.h for a more extensive discussion on how to
4989 compute the carry/overflow bits. */
4990 SET_PSR_C (tmp
> 0xffff);
4991 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4992 SET_GPR (OP
[1], tmp
);
4993 trace_output_16 (sd
, tmp
);
4998 OP_3F_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5000 uint16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
5001 uint16 tmp1
= a
+ (PSR_C
);
5002 uint16 tmp
= (~tmp1
+ 1 + b
);
5003 trace_input ("subcw", OP_REG
, OP_REG
, OP_VOID
);
5004 /* see ../common/sim-alu.h for a more extensive discussion on how to
5005 compute the carry/overflow bits. */
5006 SET_PSR_C (tmp
> 0xffff);
5007 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
5008 SET_GPR (OP
[1], tmp
);
5009 trace_output_16 (sd
, tmp
);
5014 OP_3_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5017 uint32 b
= GPR32 (OP
[1]);
5018 uint32 tmp
= (~a
+ 1 + b
);
5019 trace_input ("subd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
5020 /* see ../common/sim-alu.h for a more extensive discussion on how to
5021 compute the carry/overflow bits. */
5022 SET_PSR_C (tmp
> 0xffffffff);
5023 SET_PSR_F (((a
& 0x80000000) != (b
& 0x80000000)) &&
5024 ((b
& 0x80000000) != (tmp
& 0x80000000)));
5025 SET_GPR32 (OP
[1], tmp
);
5026 trace_output_32 (sd
, tmp
);
5031 OP_14C_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5033 uint32 a
= GPR32 (OP
[0]);
5034 uint32 b
= GPR32 (OP
[1]);
5035 uint32 tmp
= (~a
+ 1 + b
);
5036 trace_input ("subd", OP_REGP
, OP_REGP
, OP_VOID
);
5037 /* see ../common/sim-alu.h for a more extensive discussion on how to
5038 compute the carry/overflow bits. */
5039 SET_PSR_C (tmp
> 0xffffffff);
5040 SET_PSR_F (((a
& 0x80000000) != (b
& 0x80000000)) &&
5041 ((b
& 0x80000000) != (tmp
& 0x80000000)));
5042 SET_GPR32 (OP
[1], tmp
);
5043 trace_output_32 (sd
, tmp
);
5048 OP_C_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5050 host_callback
*cb
= STATE_CALLBACK (sd
);
5053 trace_input ("excp", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
5057 #if (DEBUG & DEBUG_TRAP) == 0
5060 uint16 vec
= OP
[0] + TRAP_VECTOR_START
;
5063 SET_PSR (PSR
& PSR_SM_BIT
);
5068 #else /* if debugging use trap to print registers */
5071 static int first_time
= 1;
5076 sim_io_printf (sd
, "Trap # PC ");
5077 for (i
= 0; i
< 16; i
++)
5078 sim_io_printf (sd
, " %sr%d", (i
> 9) ? "" : " ", i
);
5079 sim_io_printf (sd
, " a0 a1 f0 f1 c\n");
5082 sim_io_printf (sd
, "Trap %2d 0x%.4x:", (int)OP
[0], (int)PC
);
5084 for (i
= 0; i
< 16; i
++)
5085 sim_io_printf (sd
, " %.4x", (int) GPR (i
));
5087 for (i
= 0; i
< 2; i
++)
5088 sim_io_printf (sd
, " %.2x%.8lx",
5089 ((int)(ACC (i
) >> 32) & 0xff),
5090 ((unsigned long) ACC (i
)) & 0xffffffff);
5092 sim_io_printf (sd
, " %d %d %d\n",
5093 PSR_F
!= 0, PSR_F
!= 0, PSR_C
!= 0);
5094 sim_io_flush_stdout (sd
);
5098 case 8: /* new system call trap */
5099 /* Trap 8 is used for simulating low-level I/O */
5101 unsigned32 result
= 0;
5104 /* Registers passed to trap 0. */
5106 #define FUNC GPR (0) /* function number. */
5107 #define PARM1 GPR (2) /* optional parm 1. */
5108 #define PARM2 GPR (3) /* optional parm 2. */
5109 #define PARM3 GPR (4) /* optional parm 3. */
5110 #define PARM4 GPR (5) /* optional parm 4. */
5112 /* Registers set by trap 0 */
5114 #define RETVAL(X) do { result = (0xffff & (X));SET_GPR (0, result);} while (0)
5115 #define RETVAL32(X) do { result = (X); SET_GPR32 (0, result);} while (0)
5116 #define RETERR(X) SET_GPR (4, (X)) /* return error code. */
5118 /* Turn a pointer in a register into a pointer into real memory. */
5120 #define MEMPTR(x) sim_core_trans_addr (sd, cpu, read_map, x)
5124 #if !defined(__GO32__) && !defined(_WIN32)
5125 #ifdef TARGET_SYS_fork
5126 case TARGET_SYS_fork
:
5127 trace_input ("<fork>", OP_VOID
, OP_VOID
, OP_VOID
);
5129 trace_output_16 (sd
, result
);
5134 case TARGET_SYS_getpid
:
5135 trace_input ("<getpid>", OP_VOID
, OP_VOID
, OP_VOID
);
5137 trace_output_16 (sd
, result
);
5140 case TARGET_SYS_kill
:
5141 trace_input ("<kill>", OP_REG
, OP_REG
, OP_VOID
);
5142 if (PARM1
== getpid ())
5144 trace_output_void (sd
);
5153 case 1: os_sig
= SIGHUP
; break;
5156 case 2: os_sig
= SIGINT
; break;
5159 case 3: os_sig
= SIGQUIT
; break;
5162 case 4: os_sig
= SIGILL
; break;
5165 case 5: os_sig
= SIGTRAP
; break;
5168 case 6: os_sig
= SIGABRT
; break;
5169 #elif defined(SIGIOT)
5170 case 6: os_sig
= SIGIOT
; break;
5173 case 7: os_sig
= SIGEMT
; break;
5176 case 8: os_sig
= SIGFPE
; break;
5179 case 9: os_sig
= SIGKILL
; break;
5182 case 10: os_sig
= SIGBUS
; break;
5185 case 11: os_sig
= SIGSEGV
; break;
5188 case 12: os_sig
= SIGSYS
; break;
5191 case 13: os_sig
= SIGPIPE
; break;
5194 case 14: os_sig
= SIGALRM
; break;
5197 case 15: os_sig
= SIGTERM
; break;
5200 case 16: os_sig
= SIGURG
; break;
5203 case 17: os_sig
= SIGSTOP
; break;
5206 case 18: os_sig
= SIGTSTP
; break;
5209 case 19: os_sig
= SIGCONT
; break;
5212 case 20: os_sig
= SIGCHLD
; break;
5213 #elif defined(SIGCLD)
5214 case 20: os_sig
= SIGCLD
; break;
5217 case 21: os_sig
= SIGTTIN
; break;
5220 case 22: os_sig
= SIGTTOU
; break;
5223 case 23: os_sig
= SIGIO
; break;
5224 #elif defined (SIGPOLL)
5225 case 23: os_sig
= SIGPOLL
; break;
5228 case 24: os_sig
= SIGXCPU
; break;
5231 case 25: os_sig
= SIGXFSZ
; break;
5234 case 26: os_sig
= SIGVTALRM
; break;
5237 case 27: os_sig
= SIGPROF
; break;
5240 case 28: os_sig
= SIGWINCH
; break;
5243 case 29: os_sig
= SIGLOST
; break;
5246 case 30: os_sig
= SIGUSR1
; break;
5249 case 31: os_sig
= SIGUSR2
; break;
5255 trace_output_void (sd
);
5256 sim_io_printf (sd
, "Unknown signal %d\n", PARM2
);
5257 sim_io_flush_stdout (sd
);
5258 EXCEPTION (SIM_SIGILL
);
5262 RETVAL (kill (PARM1
, PARM2
));
5263 trace_output_16 (sd
, result
);
5268 #ifdef TARGET_SYS_execve
5269 case TARGET_SYS_execve
:
5270 trace_input ("<execve>", OP_VOID
, OP_VOID
, OP_VOID
);
5271 RETVAL (execve (MEMPTR (PARM1
), (char **) MEMPTR (PARM2
<<16|PARM3
),
5272 (char **)MEMPTR (PARM4
)));
5273 trace_output_16 (sd
, result
);
5277 #ifdef TARGET_SYS_execv
5278 case TARGET_SYS_execv
:
5279 trace_input ("<execv>", OP_VOID
, OP_VOID
, OP_VOID
);
5280 RETVAL (execve (MEMPTR (PARM1
), (char **) MEMPTR (PARM2
), NULL
));
5281 trace_output_16 (sd
, result
);
5285 #ifdef TARGET_SYS_pipe
5286 case TARGET_SYS_pipe
:
5291 trace_input ("<pipe>", OP_VOID
, OP_VOID
, OP_VOID
);
5293 RETVAL (pipe (host_fd
));
5294 SW (buf
, host_fd
[0]);
5295 buf
+= sizeof(uint16
);
5296 SW (buf
, host_fd
[1]);
5297 trace_output_16 (sd
, result
);
5302 #ifdef TARGET_SYS_wait
5303 case TARGET_SYS_wait
:
5306 trace_input ("<wait>", OP_REG
, OP_VOID
, OP_VOID
);
5307 RETVAL (wait (&status
));
5310 trace_output_16 (sd
, result
);
5315 case TARGET_SYS_getpid
:
5316 trace_input ("<getpid>", OP_VOID
, OP_VOID
, OP_VOID
);
5318 trace_output_16 (sd
, result
);
5321 case TARGET_SYS_kill
:
5322 trace_input ("<kill>", OP_REG
, OP_REG
, OP_VOID
);
5323 trace_output_void (sd
);
5328 case TARGET_SYS_read
:
5329 trace_input ("<read>", OP_REG
, OP_MEMREF
, OP_REG
);
5330 RETVAL (cb
->read (cb
, PARM1
,
5331 MEMPTR (((unsigned long)PARM3
<< 16)
5332 | ((unsigned long)PARM2
)), PARM4
));
5333 trace_output_16 (sd
, result
);
5336 case TARGET_SYS_write
:
5337 trace_input ("<write>", OP_REG
, OP_MEMREF
, OP_REG
);
5338 RETVAL ((int)cb
->write (cb
, PARM1
,
5339 MEMPTR (((unsigned long)PARM3
<< 16)
5341 trace_output_16 (sd
, result
);
5344 case TARGET_SYS_lseek
:
5345 trace_input ("<lseek>", OP_REG
, OP_REGP
, OP_REG
);
5346 RETVAL32 (cb
->lseek (cb
, PARM1
, ((((long) PARM3
) << 16) | PARM2
),
5348 trace_output_32 (sd
, result
);
5351 case TARGET_SYS_close
:
5352 trace_input ("<close>", OP_REG
, OP_VOID
, OP_VOID
);
5353 RETVAL (cb
->close (cb
, PARM1
));
5354 trace_output_16 (sd
, result
);
5357 case TARGET_SYS_open
:
5358 trace_input ("<open>", OP_MEMREF
, OP_REG
, OP_VOID
);
5359 RETVAL32 (cb
->open (cb
, MEMPTR ((((unsigned long)PARM2
) << 16)
5361 trace_output_32 (sd
, result
);
5364 #ifdef TARGET_SYS_rename
5365 case TARGET_SYS_rename
:
5366 trace_input ("<rename>", OP_MEMREF
, OP_MEMREF
, OP_VOID
);
5367 RETVAL (cb
->rename (cb
, MEMPTR ((((unsigned long)PARM2
) << 16) | PARM1
),
5368 MEMPTR ((((unsigned long)PARM4
) << 16) | PARM3
)));
5369 trace_output_16 (sd
, result
);
5373 case 0x408: /* REVISIT: Added a dummy getenv call. */
5374 trace_input ("<getenv>", OP_MEMREF
, OP_MEMREF
, OP_VOID
);
5376 trace_output_32 (sd
, result
);
5379 case TARGET_SYS_exit
:
5380 trace_input ("<exit>", OP_VOID
, OP_VOID
, OP_VOID
);
5381 trace_output_void (sd
);
5382 sim_engine_halt (sd
, cpu
, NULL
, PC
, sim_exited
, GPR (2));
5385 case TARGET_SYS_unlink
:
5386 trace_input ("<unlink>", OP_MEMREF
, OP_VOID
, OP_VOID
);
5387 RETVAL (cb
->unlink (cb
, MEMPTR (((unsigned long)PARM2
<< 16) | PARM1
)));
5388 trace_output_16 (sd
, result
);
5392 #ifdef TARGET_SYS_stat
5393 case TARGET_SYS_stat
:
5394 trace_input ("<stat>", OP_VOID
, OP_VOID
, OP_VOID
);
5395 /* stat system call. */
5397 struct stat host_stat
;
5400 RETVAL (stat (MEMPTR ((((unsigned long)PARM2
) << 16)|PARM1
), &host_stat
));
5404 /* The hard-coded offsets and sizes were determined by using
5405 * the CR16 compiler on a test program that used struct stat.
5407 SW (buf
, host_stat
.st_dev
);
5408 SW (buf
+2, host_stat
.st_ino
);
5409 SW (buf
+4, host_stat
.st_mode
);
5410 SW (buf
+6, host_stat
.st_nlink
);
5411 SW (buf
+8, host_stat
.st_uid
);
5412 SW (buf
+10, host_stat
.st_gid
);
5413 SW (buf
+12, host_stat
.st_rdev
);
5414 SLW (buf
+16, host_stat
.st_size
);
5415 SLW (buf
+20, host_stat
.st_atime
);
5416 SLW (buf
+28, host_stat
.st_mtime
);
5417 SLW (buf
+36, host_stat
.st_ctime
);
5419 trace_output_16 (sd
, result
);
5423 #ifdef TARGET_SYS_chown
5424 case TARGET_SYS_chown
:
5425 trace_input ("<chown>", OP_VOID
, OP_VOID
, OP_VOID
);
5426 RETVAL (chown (MEMPTR (PARM1
), PARM2
, PARM3
));
5427 trace_output_16 (sd
, result
);
5431 case TARGET_SYS_chmod
:
5432 trace_input ("<chmod>", OP_VOID
, OP_VOID
, OP_VOID
);
5433 RETVAL (chmod (MEMPTR (PARM1
), PARM2
));
5434 trace_output_16 (sd
, result
);
5437 #ifdef TARGET_SYS_utime
5438 case TARGET_SYS_utime
:
5439 trace_input ("<utime>", OP_REG
, OP_REG
, OP_REG
);
5440 /* Cast the second argument to void *, to avoid type mismatch
5441 if a prototype is present. */
5442 RETVAL (utime (MEMPTR (PARM1
), (void *) MEMPTR (PARM2
)));
5443 trace_output_16 (sd
, result
);
5447 #ifdef TARGET_SYS_time
5448 case TARGET_SYS_time
:
5449 trace_input ("<time>", OP_VOID
, OP_VOID
, OP_REG
);
5450 RETVAL32 (time (NULL
));
5451 trace_output_32 (sd
, result
);
5459 case TRAP_BREAKPOINT
:
5462 trace_output_void (sd
);
5463 EXCEPTION (SIM_SIGTRAP
);
5465 case SIGTRAP
: /* supervisor call ? */
5466 trace_output_void (sd
);
5467 sim_engine_halt (sd
, cpu
, NULL
, PC
, sim_exited
, GPR (2));
5470 cb
->error (cb
, "Unknown syscall %d", FUNC
);
5474 if ((uint16
) result
== (uint16
) -1)
5475 RETERR (cb
->get_errno (cb
));
5486 OP_3_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
5488 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5489 uint32 tmp
, sp_addr
= (GPR32 (15)) - (a
* 2) - 4, is_regp
= 0;
5490 trace_input ("push", OP_CONSTANT3
, OP_REG
, OP_REG
);
5496 SW (sp_addr
, (GPR (b
+i
)));
5502 tmp
= (GPR32 (b
+i
));
5504 tmp
= (GPR32 (b
+i
-1));
5523 /* Store RA address. */
5527 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5528 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5530 trace_output_void (sd
);
5535 OP_1_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5537 uint32 sp_addr
, tmp
, is_regp
= 0;
5538 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5539 trace_input ("push", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5542 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5544 sp_addr
= (GPR32 (15)) - (a
* 2);
5550 SW (sp_addr
, (GPR (b
+i
)));
5556 tmp
= (GPR32 (b
+i
));
5558 tmp
= (GPR32 (b
+i
-1));
5577 /* Store RA address. */
5580 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5583 sp_addr
= (GPR32 (15)) - (a
* 2);
5585 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5587 trace_output_void (sd
);
5593 OP_11E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5595 uint32 sp_addr
= (GPR32 (15)), tmp
;
5596 trace_input ("push", OP_VOID
, OP_VOID
, OP_VOID
);
5598 SLW(sp_addr
-4,tmp
); /* Store RA address. */
5599 SET_GPR32 (15, (sp_addr
- 4)); /* Update SP address. */
5600 trace_output_void (sd
);
5606 OP_5_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
5608 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5609 uint32 tmp
, sp_addr
= (GPR32 (15)), is_regp
= 0;;
5610 trace_input ("pop", OP_CONSTANT3
, OP_REG
, OP_REG
);
5616 SET_GPR ((b
+i
), RW(sp_addr
));
5632 tmp
= (tmp
<< 16) | (GPR32 (b
+i
));
5634 tmp
= (tmp
<< 16) | (GPR32 (b
+i
-1));
5638 SET_GPR32 ((b
+i
), (((tmp
& 0xffff) << 16)
5639 | ((tmp
>> 16) & 0xffff)));
5641 SET_GPR32 ((b
+i
-1), (((tmp
& 0xffff) << 16)
5642 | ((tmp
>> 16) & 0xffff)));
5649 tmp
= RLW(sp_addr
); /* store RA also. */
5650 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5652 SET_GPR32 (15, (sp_addr
+ 4)); /* Update SP address. */
5654 trace_output_void (sd
);
5659 OP_2_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5661 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5662 uint32 tmp
, sp_addr
= (GPR32 (15)), is_regp
= 0;
5663 trace_input ("pop", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5669 SET_GPR ((b
+i
), RW(sp_addr
));
5685 tmp
= ((tmp
<< 16) & 0xffffffff) | (GPR32 (b
+i
));
5687 tmp
= ((tmp
<< 16) & 0xffffffff) | (GPR32 (b
+i
-1));
5691 SET_GPR32 ((b
+i
), (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5693 SET_GPR32 ((b
+i
-1), (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5701 tmp
= RLW(sp_addr
); /* Store RA Reg. */
5702 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5706 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5708 trace_output_void (sd
);
5713 OP_21E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5715 uint32 sp_addr
= GPR32 (15);
5717 trace_input ("pop", OP_VOID
, OP_VOID
, OP_VOID
);
5720 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5721 SET_GPR32 (15, (sp_addr
+4)); /* Update SP address. */
5723 trace_output_void (sd
);
5728 OP_7_9 (SIM_DESC sd
, SIM_CPU
*cpu
)
5730 uint16 a
= OP
[0], b
= OP
[1];
5731 trace_input ("popret", OP_CONSTANT3
, OP_REG
, OP_REG
);
5733 JMP(((GPR32(14)) << 1) & 0xffffff);
5735 trace_output_void (sd
);
5740 OP_3_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5742 uint16 a
= OP
[0], b
= OP
[1];
5743 trace_input ("popret", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5745 JMP(((GPR32(14)) << 1) & 0xffffff);
5747 trace_output_void (sd
);
5752 OP_31E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5755 trace_input ("popret", OP_VOID
, OP_VOID
, OP_VOID
);
5756 OP_21E_10 (sd
, cpu
);
5757 tmp
= (((GPR32(14)) << 1) & 0xffffff);
5758 /* If the resulting PC value is less than 0x00_0000 or greater
5759 than 0xFF_FFFF, this instruction causes an IAD trap.*/
5761 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
5763 trace_output_void (sd
);
5764 EXCEPTION (SIM_SIGBUS
);
5769 trace_output_32 (sd
, tmp
);
5775 OP_A_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5777 trace_input ("cinv[i]", OP_VOID
, OP_VOID
, OP_VOID
);
5779 trace_output_void (sd
);
5784 OP_B_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5786 trace_input ("cinv[i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5788 trace_output_void (sd
);
5793 OP_C_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5795 trace_input ("cinv[d]", OP_VOID
, OP_VOID
, OP_VOID
);
5797 trace_output_void (sd
);
5802 OP_D_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5804 trace_input ("cinv[i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5806 trace_output_void (sd
);
5811 OP_E_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5813 trace_input ("cinv[d,i]", OP_VOID
, OP_VOID
, OP_VOID
);
5815 trace_output_void (sd
);
5820 OP_F_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5822 trace_input ("cinv[d,i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5824 trace_output_void (sd
);
5829 OP_3_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5831 trace_input ("retx", OP_VOID
, OP_VOID
, OP_VOID
);
5833 trace_output_void (sd
);
5838 OP_4_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5840 trace_input ("di", OP_VOID
, OP_VOID
, OP_VOID
);
5842 trace_output_void (sd
);
5847 OP_5_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5849 trace_input ("ei", OP_VOID
, OP_VOID
, OP_VOID
);
5851 trace_output_void (sd
);
5856 OP_6_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5858 trace_input ("wait", OP_VOID
, OP_VOID
, OP_VOID
);
5859 trace_output_void (sd
);
5860 EXCEPTION (SIM_SIGTRAP
);
5865 OP_7_10 (SIM_DESC sd
, SIM_CPU
*cpu
)
5867 trace_input ("ewait", OP_VOID
, OP_VOID
, OP_VOID
);
5869 trace_output_void (sd
);
5874 OP_28_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5876 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5877 trace_input ("xorb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
5879 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5880 trace_output_16 (sd
, tmp
);
5885 OP_28B_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5887 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5888 trace_input ("xorb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
5890 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5891 trace_output_16 (sd
, tmp
);
5896 OP_29_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5898 uint8 tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5899 trace_input ("xorb", OP_REG
, OP_REG
, OP_VOID
);
5901 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5902 trace_output_16 (sd
, tmp
);
5907 OP_2A_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5909 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
5910 trace_input ("xorw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
5912 SET_GPR (OP
[1], tmp
);
5913 trace_output_16 (sd
, tmp
);
5918 OP_2AB_C (SIM_DESC sd
, SIM_CPU
*cpu
)
5920 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
5921 trace_input ("xorw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
5923 SET_GPR (OP
[1], tmp
);
5924 trace_output_16 (sd
, tmp
);
5929 OP_2B_8 (SIM_DESC sd
, SIM_CPU
*cpu
)
5931 uint16 tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
5932 trace_input ("xorw", OP_REG
, OP_REG
, OP_VOID
);
5934 SET_GPR (OP
[1], tmp
);
5935 trace_output_16 (sd
, tmp
);
5938 /*REVISIT FOR LPR/SPR . */
5942 OP_140_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5944 uint16 a
= GPR (OP
[0]);
5945 trace_input ("lpr", OP_REG
, OP_REG
, OP_VOID
);
5946 SET_CREG (OP
[1], a
);
5947 trace_output_16 (sd
, a
);
5952 OP_141_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5954 uint32 a
= GPR32 (OP
[0]);
5955 trace_input ("lprd", OP_REGP
, OP_REG
, OP_VOID
);
5956 SET_CREG (OP
[1], a
);
5957 trace_output_flag (sd
);
5962 OP_142_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5964 uint16 a
= CREG (OP
[0]);
5965 trace_input ("spr", OP_REG
, OP_REG
, OP_VOID
);
5967 trace_output_16 (sd
, a
);
5972 OP_143_14 (SIM_DESC sd
, SIM_CPU
*cpu
)
5974 uint32 a
= CREG (OP
[0]);
5975 trace_input ("sprd", OP_REGP
, OP_REGP
, OP_VOID
);
5976 SET_GPR32 (OP
[1], a
);
5977 trace_output_32 (sd
, a
);
5982 OP_0_20 (SIM_DESC sd
, SIM_CPU
*cpu
)
5984 trace_input ("null", OP_VOID
, OP_VOID
, OP_VOID
);
5985 sim_engine_halt (sd
, cpu
, NULL
, PC
, sim_exited
, 0);