1 /* Simulation code for the CR16 processor.
2 Copyright (C) 2008-2015 Free Software Foundation, Inc.
3 Contributed by M Ranga Swami Reddy <MR.Swami.Reddy@nsc.com>
5 This file is part of GDB, the GNU debugger.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 #include <sys/types.h>
36 #ifdef HAVE_SYS_TIME_H
42 #include "targ-vals.h"
44 #ifdef TARGET_SYS_utime
47 #ifdef TARGET_SYS_wait
110 PSR_MASK
= (PSR_I_BIT
120 /* The following bits in the PSR _can't_ be set by instructions such
122 PSR_HW_MASK
= (PSR_MASK
)
125 /* cond Code Condition True State
126 * EQ Equal Z flag is 1
127 * NE Not Equal Z flag is 0
128 * CS Carry Set C flag is 1
129 * CC Carry Clear C flag is 0
130 * HI Higher L flag is 1
131 * LS Lower or Same L flag is 0
132 * GT Greater Than N flag is 1
133 * LE Less Than or Equal To N flag is 0
134 * FS Flag Set F flag is 1
135 * FC Flag Clear F flag is 0
136 * LO Lower Z and L flags are 0
137 * HS Higher or Same Z or L flag is 1
138 * LT Less Than Z and N flags are 0
139 * GE Greater Than or Equal To Z or N flag is 1. */
141 static int cond_stat(int cc
)
145 case 0: return PSR_Z
; break;
146 case 1: return !PSR_Z
; break;
147 case 2: return PSR_C
; break;
148 case 3: return !PSR_C
; break;
149 case 4: return PSR_L
; break;
150 case 5: return !PSR_L
; break;
151 case 6: return PSR_N
; break;
152 case 7: return !PSR_N
; break;
153 case 8: return PSR_F
; break;
154 case 9: return !PSR_F
; break;
155 case 10: return !PSR_Z
&& !PSR_L
; break;
156 case 11: return PSR_Z
|| PSR_L
; break;
157 case 12: return !PSR_Z
&& !PSR_N
; break;
158 case 13: return PSR_Z
|| PSR_N
; break;
159 case 14: return 1; break; /*ALWAYS. */
161 // case NEVER: return false; break;
163 //panic("Shouldn't have NO_COND_CODE in an actual instruction!");
171 move_to_cr (int cr
, creg_t mask
, creg_t val
, int psw_hw_p
)
173 /* A MASK bit is set when the corresponding bit in the CR should
175 /* This assumes that (VAL & MASK) == 0. */
184 (*cr16_callback
->printf_filtered
)
186 "ERROR at PC 0x%x: ST can only be set when FX is set.\n", PC
);
187 State
.exception
= SIGILL
;
189 /* keep an up-to-date psw around for tracing. */
190 State
.trace
.psw
= (State
.trace
.psw
& mask
) | val
;
195 /* only issue an update if the register is being changed. */
196 if ((State
.cregs
[cr
] & ~mask
) != val
)
197 SLOT_PEND_MASK (State
.cregs
[cr
], mask
, val
);
203 static void trace_input_func (const char *name
,
208 #define trace_input(name, in1, in2, in3) do { if (cr16_debug) trace_input_func (name, in1, in2, in3); } while (0)
210 #ifndef SIZE_INSTRUCTION
211 #define SIZE_INSTRUCTION 8
214 #ifndef SIZE_OPERANDS
215 #define SIZE_OPERANDS 18
219 #define SIZE_VALUES 13
222 #ifndef SIZE_LOCATION
223 #define SIZE_LOCATION 20
230 #ifndef SIZE_LINE_NUMBER
231 #define SIZE_LINE_NUMBER 2
235 trace_input_func (const char *name
, enum op_types in1
, enum op_types in2
, enum op_types in3
)
244 const char *filename
;
245 const char *functionname
;
246 unsigned int linenumber
;
249 if ((cr16_debug
& DEBUG_TRACE
) == 0)
252 switch (State
.ins_type
)
255 case INS_UNKNOWN
: type
= " ?"; break;
258 if ((cr16_debug
& DEBUG_LINE_NUMBER
) == 0)
259 (*cr16_callback
->printf_filtered
) (cr16_callback
,
261 SIZE_PC
, (unsigned)PC
,
263 SIZE_INSTRUCTION
, name
);
268 byte_pc
= decode_pc ();
269 if (text
&& byte_pc
>= text_start
&& byte_pc
< text_end
)
271 filename
= (const char *)0;
272 functionname
= (const char *)0;
274 if (bfd_find_nearest_line (prog_bfd
, text
, (struct bfd_symbol
**)0, byte_pc
- text_start
,
275 &filename
, &functionname
, &linenumber
))
280 sprintf (p
, "#%-*d ", SIZE_LINE_NUMBER
, linenumber
);
285 sprintf (p
, "%-*s ", SIZE_LINE_NUMBER
+1, "---");
286 p
+= SIZE_LINE_NUMBER
+2;
291 sprintf (p
, "%s ", functionname
);
296 char *q
= strrchr (filename
, '/');
297 sprintf (p
, "%s ", (q
) ? q
+1 : filename
);
306 (*cr16_callback
->printf_filtered
) (cr16_callback
,
307 "0x%.*x %s: %-*.*s %-*s ",
308 SIZE_PC
, (unsigned)PC
,
310 SIZE_LOCATION
, SIZE_LOCATION
, buf
,
311 SIZE_INSTRUCTION
, name
);
319 for (i
= 0; i
< 3; i
++)
328 sprintf (p
, "%sr%d", comma
, OP
[i
]);
334 sprintf (p
, "%scr%d", comma
, OP
[i
]);
340 sprintf (p
, "%s%d", comma
, OP
[i
]);
346 sprintf (p
, "%s%d", comma
, SEXT4(OP
[i
]));
352 sprintf (p
, "%s%d", comma
, SEXT3(OP
[i
]));
358 sprintf (p
, "%s@r%d", comma
, OP
[i
]);
364 sprintf (p
, "%s@(%d,r%d)", comma
, (int16
)OP
[i
], OP
[i
+1]);
370 sprintf (p
, "%s@%d", comma
, OP
[i
]);
377 if ((cr16_debug
& DEBUG_VALUES
) == 0)
381 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%s", buf
);
386 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%-*s", SIZE_OPERANDS
, buf
);
389 for (i
= 0; i
< 3; i
++)
395 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%*s", SIZE_VALUES
, "");
399 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%*s0x%.4x", SIZE_VALUES
-6, "",
400 (uint16
) GPR (OP
[i
]));
404 tmp
= (long)((((uint32
) GPR (OP
[i
])) << 16) | ((uint32
) GPR (OP
[i
] + 1)));
405 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%*s0x%.8lx", SIZE_VALUES
-10, "", tmp
);
409 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%*s0x%.4x", SIZE_VALUES
-6, "",
410 (uint16
) CREG (OP
[i
]));
414 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%*s0x%.4x", SIZE_VALUES
-6, "",
419 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%*s0x%.4x", SIZE_VALUES
-6, "",
420 (uint16
)SEXT4(OP
[i
]));
424 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%*s0x%.4x", SIZE_VALUES
-6, "",
425 (uint16
)SEXT3(OP
[i
]));
429 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%*s0x%.4x", SIZE_VALUES
-6, "",
431 (*cr16_callback
->printf_filtered
) (cr16_callback
, "%*s0x%.4x", SIZE_VALUES
-6, "",
432 (uint16
)GPR (OP
[i
+ 1]));
439 (*cr16_callback
->flush_stdout
) (cr16_callback
);
443 do_trace_output_flush (void)
445 (*cr16_callback
->flush_stdout
) (cr16_callback
);
449 do_trace_output_finish (void)
451 (*cr16_callback
->printf_filtered
) (cr16_callback
,
452 " F0=%d F1=%d C=%d\n",
453 (State
.trace
.psw
& PSR_F_BIT
) != 0,
454 (State
.trace
.psw
& PSR_F_BIT
) != 0,
455 (State
.trace
.psw
& PSR_C_BIT
) != 0);
456 (*cr16_callback
->flush_stdout
) (cr16_callback
);
461 trace_output_40 (uint64 val
)
463 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
465 (*cr16_callback
->printf_filtered
) (cr16_callback
,
466 " :: %*s0x%.2x%.8lx",
469 ((int)(val
>> 32) & 0xff),
470 ((unsigned long) val
) & 0xffffffff);
471 do_trace_output_finish ();
477 trace_output_32 (uint32 val
)
479 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
481 (*cr16_callback
->printf_filtered
) (cr16_callback
,
486 do_trace_output_finish ();
491 trace_output_16 (uint16 val
)
493 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
495 (*cr16_callback
->printf_filtered
) (cr16_callback
,
500 do_trace_output_finish ();
505 trace_output_void (void)
507 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
509 (*cr16_callback
->printf_filtered
) (cr16_callback
, "\n");
510 do_trace_output_flush ();
515 trace_output_flag (void)
517 if ((cr16_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
519 (*cr16_callback
->printf_filtered
) (cr16_callback
,
523 do_trace_output_finish ();
531 #define trace_input(NAME, IN1, IN2, IN3)
532 #define trace_output(RESULT)
540 uint8 a
= OP
[0] & 0xff;
541 uint16 b
= (GPR (OP
[1])) & 0xff;
542 trace_input ("addub", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
543 tmp
= (a
+ b
) & 0xff;
544 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
545 trace_output_16 (tmp
);
553 uint8 a
= ((OP
[0]) & 0xff), b
= (GPR (OP
[1])) & 0xff;
554 trace_input ("addub", OP_CONSTANT16
, OP_REG
, OP_VOID
);
555 tmp
= (a
+ b
) & 0xff;
556 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
557 trace_output_16 (tmp
);
564 uint8 a
= (GPR (OP
[0])) & 0xff;
565 uint8 b
= (GPR (OP
[1])) & 0xff;
566 uint16 tmp
= (a
+ b
) & 0xff;
567 trace_input ("addub", OP_REG
, OP_REG
, OP_VOID
);
568 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
569 trace_output_16 (tmp
);
577 uint16 b
= GPR (OP
[1]);
578 uint16 tmp
= (a
+ b
);
579 trace_input ("adduw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
580 SET_GPR (OP
[1], tmp
);
581 trace_output_16 (tmp
);
589 uint16 b
= GPR (OP
[1]);
590 uint16 tmp
= (a
+ b
);
591 trace_input ("adduw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
592 SET_GPR (OP
[1], tmp
);
593 trace_output_16 (tmp
);
600 uint16 a
= GPR (OP
[0]);
601 uint16 b
= GPR (OP
[1]);
602 uint16 tmp
= (a
+ b
);
603 trace_input ("adduw", OP_REG
, OP_REG
, OP_VOID
);
604 SET_GPR (OP
[1], tmp
);
605 trace_output_16 (tmp
);
613 uint8 b
= (GPR (OP
[1]) & 0xff);
614 uint16 tmp
= (a
+ b
) & 0xff;
615 trace_input ("addb", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
616 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
617 SET_PSR_C (tmp
> 0xFF);
618 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
619 trace_output_16 (tmp
);
626 uint8 a
= (OP
[0]) & 0xff;
627 uint8 b
= (GPR (OP
[1]) & 0xff);
628 uint16 tmp
= (a
+ b
) & 0xff;
629 trace_input ("addb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
630 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
631 SET_PSR_C (tmp
> 0xFF);
632 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
633 trace_output_16 (tmp
);
640 uint8 a
= (GPR (OP
[0]) & 0xff);
641 uint8 b
= (GPR (OP
[1]) & 0xff);
642 uint16 tmp
= (a
+ b
) & 0xff;
643 trace_input ("addb", OP_REG
, OP_REG
, OP_VOID
);
644 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
645 SET_PSR_C (tmp
> 0xFF);
646 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
647 trace_output_16 (tmp
);
655 uint16 tmp
, b
= GPR (OP
[1]);
657 trace_input ("addw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
658 SET_GPR (OP
[1], tmp
);
659 SET_PSR_C (tmp
> 0xFFFF);
660 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
661 trace_output_16 (tmp
);
669 uint16 tmp
, b
= GPR (OP
[1]);
671 trace_input ("addw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
672 SET_GPR (OP
[1], tmp
);
673 SET_PSR_C (tmp
> 0xFFFF);
674 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
675 trace_output_16 (tmp
);
682 uint16 tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
683 trace_input ("addw", OP_REG
, OP_REG
, OP_VOID
);
685 SET_GPR (OP
[1], tmp
);
686 SET_PSR_C (tmp
> 0xFFFF);
687 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
688 trace_output_16 (tmp
);
695 uint8 tmp
, a
= OP
[0] & 0xff, b
= (GPR (OP
[1])) & 0xff;
696 trace_input ("addcb", OP_CONSTANT4_1
, OP_REG
, OP_REG
);
697 tmp
= (a
+ b
+ PSR_C
) & 0xff;
698 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
699 SET_PSR_C (tmp
> 0xFF);
700 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
701 trace_output_16 (tmp
);
708 int8 a
= OP
[0] & 0xff;
709 uint8 b
= (GPR (OP
[1])) & 0xff;
710 uint8 tmp
= (a
+ b
+ PSR_C
) & 0xff;
711 trace_input ("addcb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
712 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
713 SET_PSR_C (tmp
> 0xFF);
714 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
715 trace_output_16 (tmp
);
722 uint8 a
= (GPR (OP
[0])) & 0xff;
723 uint8 b
= (GPR (OP
[1])) & 0xff;
724 uint8 tmp
= (a
+ b
+ PSR_C
) & 0xff;
725 trace_input ("addcb", OP_REG
, OP_REG
, OP_VOID
);
726 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
727 SET_PSR_C (tmp
> 0xFF);
728 SET_PSR_F (((a
& 0x80) == (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
729 trace_output_16 (tmp
);
737 uint16 b
= GPR (OP
[1]);
738 uint16 tmp
= (a
+ b
+ PSR_C
);
739 trace_input ("addcw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
740 SET_GPR (OP
[1], tmp
);
741 SET_PSR_C (tmp
> 0xFFFF);
742 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
743 trace_output_16 (tmp
);
751 uint16 b
= GPR (OP
[1]);
752 uint16 tmp
= (a
+ b
+ PSR_C
);
753 trace_input ("addcw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
754 SET_GPR (OP
[1], tmp
);
755 SET_PSR_C (tmp
> 0xFFFF);
756 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
757 trace_output_16 (tmp
);
764 uint16 a
= GPR (OP
[1]);
765 uint16 b
= GPR (OP
[1]);
766 uint16 tmp
= (a
+ b
+ PSR_C
);
767 trace_input ("addcw", OP_REG
, OP_REG
, OP_VOID
);
768 SET_GPR (OP
[1], tmp
);
769 SET_PSR_C (tmp
> 0xFFFF);
770 SET_PSR_F (((a
& 0x8000) == (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
771 trace_output_16 (tmp
);
779 uint32 b
= GPR32 (OP
[1]);
780 uint32 tmp
= (a
+ b
);
781 trace_input ("addd", OP_CONSTANT4_1
, OP_REGP
, OP_VOID
);
782 SET_GPR32 (OP
[1], tmp
);
783 SET_PSR_C (tmp
> 0xFFFFFFFF);
784 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
785 trace_output_32 (tmp
);
792 int32 a
= (SEXT16(OP
[0]));
793 uint32 b
= GPR32 (OP
[1]);
794 uint32 tmp
= (a
+ b
);
795 trace_input ("addd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
796 SET_GPR32 (OP
[1], tmp
);
797 SET_PSR_C (tmp
> 0xFFFFFFFF);
798 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
799 trace_output_32 (tmp
);
806 uint32 a
= GPR32 (OP
[0]);
807 uint32 b
= GPR32 (OP
[1]);
808 uint32 tmp
= (a
+ b
);
809 trace_input ("addd", OP_REGP
, OP_REGP
, OP_VOID
);
810 SET_GPR32 (OP
[1], tmp
);
811 trace_output_32 (tmp
);
812 SET_PSR_C (tmp
> 0xFFFFFFFF);
813 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
821 uint32 b
= GPR32 (OP
[1]);
823 trace_input ("addd", OP_CONSTANT20
, OP_REGP
, OP_VOID
);
825 SET_GPR32 (OP
[1], tmp
);
826 SET_PSR_C (tmp
> 0xFFFFFFFF);
827 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
828 trace_output_32 (tmp
);
836 uint32 b
= GPR32 (OP
[1]);
838 trace_input ("addd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
840 SET_GPR32 (OP
[1], tmp
);
841 SET_PSR_C (tmp
> 0xFFFFFFFF);
842 SET_PSR_F (((a
& 0x80000000) == (b
& 0x80000000)) && ((b
& 0x80000000) != (tmp
& 0x80000000)));
843 trace_output_32 (tmp
);
850 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
851 trace_input ("andb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
853 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
854 trace_output_16 (tmp
);
861 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
862 trace_input ("andb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
864 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
865 trace_output_16 (tmp
);
872 uint8 tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
873 trace_input ("andb", OP_REG
, OP_REG
, OP_VOID
);
875 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
876 trace_output_16 (tmp
);
883 uint16 tmp
, a
= OP
[0], b
= GPR (OP
[1]);
884 trace_input ("andw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
886 SET_GPR (OP
[1], tmp
);
887 trace_output_16 (tmp
);
894 uint16 tmp
, a
= OP
[0], b
= GPR (OP
[1]);
895 trace_input ("andw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
897 SET_GPR (OP
[1], tmp
);
898 trace_output_16 (tmp
);
905 uint16 tmp
, a
= GPR (OP
[0]), b
= GPR (OP
[1]);
906 trace_input ("andw", OP_REG
, OP_REG
, OP_VOID
);
908 SET_GPR (OP
[1], tmp
);
909 trace_output_16 (tmp
);
916 uint32 tmp
, a
= OP
[0], b
= GPR32 (OP
[1]);
917 trace_input ("andd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
919 SET_GPR32 (OP
[1], tmp
);
920 trace_output_32 (tmp
);
927 uint32 tmp
, a
= (GPR32 (OP
[0])), b
= (GPR32 (OP
[1]));
928 trace_input ("andd", OP_REGP
, OP_REGP
, OP_VOID
);
930 SET_GPR32 (OP
[1], tmp
);
931 trace_output_32 (tmp
);
938 uint32 tmp
, a
= (OP
[0]), b
= GPR32 (OP
[1]);
939 trace_input ("ord", OP_CONSTANT32
, OP_REG
, OP_VOID
);
941 SET_GPR32 (OP
[1], tmp
);
942 trace_output_32 (tmp
);
949 uint32 tmp
, a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
950 trace_input ("ord", OP_REGP
, OP_REGP
, OP_VOID
);
952 SET_GPR32 (OP
[1], tmp
);
953 trace_output_32 (tmp
);
960 uint32 tmp
, a
= (OP
[0]), b
= GPR32 (OP
[1]);
961 trace_input ("xord", OP_CONSTANT32
, OP_REG
, OP_VOID
);
963 SET_GPR32 (OP
[1], tmp
);
964 trace_output_32 (tmp
);
971 uint32 tmp
, a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
972 trace_input ("xord", OP_REGP
, OP_REGP
, OP_VOID
);
974 SET_GPR32 (OP
[1], tmp
);
975 trace_output_32 (tmp
);
983 uint32 tmp
= 0, cc
= cond_stat (OP
[0]);
984 trace_input ("b", OP_CONSTANT4
, OP_DISPE9
, OP_VOID
);
988 tmp
= (PC
- (OP
[1]));
990 tmp
= (PC
+ (OP
[1]));
991 /* If the resulting PC value is less than 0x00_0000 or greater
992 than 0xFF_FFFF, this instruction causes an IAD trap.*/
994 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
996 State
.exception
= SIG_CR16_BUS
;
997 State
.pc_changed
= 1; /* Don't increment the PC. */
998 trace_output_void ();
1004 sign_flag
= 0; /* Reset sign_flag. */
1005 trace_output_32 (tmp
);
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 State
.exception
= SIG_CR16_BUS
;
1026 State
.pc_changed
= 1; /* Don't increment the PC. */
1027 trace_output_void ();
1033 sign_flag
= 0; /* Reset sign_flag. */
1034 trace_output_32 (tmp
);
1041 uint32 tmp
= 0, cc
= cond_stat (OP
[0]);
1042 trace_input ("b", OP_CONSTANT4
, OP_DISP25
, OP_VOID
);
1046 tmp
= (PC
- (OP
[1]));
1048 tmp
= (PC
+ (OP
[1]));
1049 /* If the resulting PC value is less than 0x00_0000 or greater
1050 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1052 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1054 State
.exception
= SIG_CR16_BUS
;
1055 State
.pc_changed
= 1; /* Don't increment the PC. */
1056 trace_output_void ();
1062 sign_flag
= 0; /* Reset sign_flag. */
1063 trace_output_32 (tmp
);
1071 trace_input ("bal", OP_REG
, OP_DISP17
, OP_VOID
);
1072 tmp
= ((PC
+ 4) >> 1); /* Store PC in RA register. */
1073 SET_GPR32 (14, tmp
);
1075 tmp
= (PC
- (OP
[1]));
1077 tmp
= (PC
+ (OP
[1]));
1079 /* If the resulting PC value is less than 0x00_0000 or greater
1080 than 0xFF_FFFF, this instruction causes an IAD trap. */
1082 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1084 State
.exception
= SIG_CR16_BUS
;
1085 State
.pc_changed
= 1; /* Don't increment the PC. */
1086 trace_output_void ();
1091 sign_flag
= 0; /* Reset sign_flag. */
1092 trace_output_32 (tmp
);
1101 trace_input ("bal", OP_REGP
, OP_DISP25
, OP_VOID
);
1102 tmp
= (((PC
) + 4) >> 1); /* Store PC in reg pair. */
1103 SET_GPR32 (OP
[0], tmp
);
1105 tmp
= ((PC
) - (OP
[1]));
1107 tmp
= ((PC
) + (OP
[1]));
1108 /* If the resulting PC value is less than 0x00_0000 or greater
1109 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1111 if ((tmp
< 0x000000) || (tmp
> 0xFFFFFF))
1113 State
.exception
= SIG_CR16_BUS
;
1114 State
.pc_changed
= 1; /* Don't increment the PC. */
1115 trace_output_void ();
1120 sign_flag
= 0; /* Reset sign_flag. */
1121 trace_output_32 (tmp
);
1129 trace_input ("jal", OP_REGP
, OP_REGP
, OP_VOID
);
1130 SET_GPR32 (OP
[0], (((PC
) + 4) >> 1)); /* Store next PC in RA */
1131 tmp
= GPR32 (OP
[1]);
1132 tmp
= SEXT24(tmp
<< 1);
1133 /* If the resulting PC value is less than 0x00_0000 or greater
1134 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1136 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
1138 State
.exception
= SIG_CR16_BUS
;
1139 State
.pc_changed
= 1; /* Don't increment the PC. */
1140 trace_output_void ();
1146 trace_output_32 (tmp
);
1155 trace_input ("jal", OP_REGP
, OP_VOID
, OP_VOID
);
1156 SET_GPR32 (14, (((PC
) + 2) >> 1)); /* Store next PC in RA */
1157 tmp
= GPR32 (OP
[0]);
1158 tmp
= SEXT24(tmp
<< 1);
1159 /* If the resulting PC value is less than 0x00_0000 or greater
1160 than 0xFF_FFFF, this instruction causes an IAD trap.*/
1162 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
1164 State
.exception
= SIG_CR16_BUS
;
1165 State
.pc_changed
= 1; /* Don't increment the PC. */
1166 trace_output_void ();
1172 trace_output_32 (tmp
);
1181 uint8 a
= (GPR (OP
[0]) & 0xFF);
1182 trace_input ("beq0b", OP_REG
, OP_DISP5
, OP_VOID
);
1187 addr
= (PC
- OP
[1]);
1189 addr
= (PC
+ OP
[1]);
1193 sign_flag
= 0; /* Reset sign_flag. */
1194 trace_output_void ();
1202 uint8 a
= (GPR (OP
[0]) & 0xFF);
1203 trace_input ("bne0b", OP_REG
, OP_DISP5
, OP_VOID
);
1208 addr
= (PC
- OP
[1]);
1210 addr
= (PC
+ OP
[1]);
1214 sign_flag
= 0; /* Reset sign_flag. */
1215 trace_output_void ();
1223 uint16 a
= GPR (OP
[0]);
1224 trace_input ("beq0w", OP_REG
, OP_DISP5
, OP_VOID
);
1229 addr
= (PC
- OP
[1]);
1231 addr
= (PC
+ OP
[1]);
1235 sign_flag
= 0; /* Reset sign_flag. */
1236 trace_output_void ();
1244 uint16 a
= GPR (OP
[0]);
1245 trace_input ("bne0w", OP_REG
, OP_DISP5
, OP_VOID
);
1250 addr
= (PC
- OP
[1]);
1252 addr
= (PC
+ OP
[1]);
1256 sign_flag
= 0; /* Reset sign_flag. */
1257 trace_output_void ();
1266 trace_input ("jeq", OP_REGP
, OP_VOID
, OP_VOID
);
1269 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits. */
1270 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit. */
1272 trace_output_32 (tmp
);
1280 trace_input ("jne", OP_REGP
, OP_VOID
, OP_VOID
);
1283 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits. */
1284 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit. */
1286 trace_output_32 (tmp
);
1294 trace_input ("jcs", OP_REGP
, OP_VOID
, OP_VOID
);
1297 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1298 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1300 trace_output_32 (tmp
);
1308 trace_input ("jcc", OP_REGP
, OP_VOID
, OP_VOID
);
1311 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1312 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1314 trace_output_32 (tmp
);
1322 trace_input ("jhi", OP_REGP
, OP_VOID
, OP_VOID
);
1325 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1326 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1328 trace_output_32 (tmp
);
1336 trace_input ("jls", OP_REGP
, OP_VOID
, OP_VOID
);
1339 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1340 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1342 trace_output_32 (tmp
);
1350 trace_input ("jgt", OP_REGP
, OP_VOID
, OP_VOID
);
1353 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1354 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1356 trace_output_32 (tmp
);
1364 trace_input ("jle", OP_REGP
, OP_VOID
, OP_VOID
);
1367 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1368 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1370 trace_output_32 (tmp
);
1379 trace_input ("jfs", OP_REGP
, OP_VOID
, OP_VOID
);
1382 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1383 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1385 trace_output_32 (tmp
);
1393 trace_input ("jfc", OP_REGP
, OP_VOID
, OP_VOID
);
1396 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1397 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1399 trace_output_32 (tmp
);
1407 trace_input ("jlo", OP_REGP
, OP_VOID
, OP_VOID
);
1408 if (((PSR_Z
) == 0) & ((PSR_L
) == 0))
1410 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1411 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1413 trace_output_32 (tmp
);
1421 trace_input ("jhs", OP_REGP
, OP_VOID
, OP_VOID
);
1422 if (((PSR_Z
) == 1) | ((PSR_L
) == 1))
1424 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1425 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1427 trace_output_32 (tmp
);
1435 trace_input ("jlt", OP_REGP
, OP_VOID
, OP_VOID
);
1436 if (((PSR_Z
) == 0) & ((PSR_N
) == 0))
1438 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1439 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1441 trace_output_32 (tmp
);
1449 trace_input ("jge", OP_REGP
, OP_VOID
, OP_VOID
);
1450 if (((PSR_Z
) == 1) | ((PSR_N
) == 1))
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*/
1455 trace_output_32 (tmp
);
1463 trace_input ("jump", OP_REGP
, OP_VOID
, OP_VOID
);
1464 tmp
= GPR32 (OP
[0]) /*& 0x3fffff*/; /* Use only 0 - 22 bits */
1465 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1466 trace_output_32 (tmp
);
1474 trace_input ("jusr", OP_REGP
, OP_VOID
, OP_VOID
);
1475 tmp
= (GPR32 (OP
[0])) & 0x3fffff; /* Use only 0 - 22 bits */
1476 JMP (tmp
<< 1); /* Set PC's 1 - 23 bits and clear 0th bit*/
1478 trace_output_32 (tmp
);
1485 trace_input ("seq", OP_REG
, OP_VOID
, OP_VOID
);
1490 trace_output_void ();
1496 trace_input ("sne", OP_REG
, OP_VOID
, OP_VOID
);
1501 trace_output_void ();
1508 trace_input ("scs", OP_REG
, OP_VOID
, OP_VOID
);
1513 trace_output_void ();
1520 trace_input ("scc", OP_REG
, OP_VOID
, OP_VOID
);
1525 trace_output_void ();
1532 trace_input ("shi", OP_REG
, OP_VOID
, OP_VOID
);
1537 trace_output_void ();
1544 trace_input ("sls", OP_REG
, OP_VOID
, OP_VOID
);
1549 trace_output_void ();
1556 trace_input ("sgt", OP_REG
, OP_VOID
, OP_VOID
);
1561 trace_output_void ();
1568 trace_input ("sle", OP_REG
, OP_VOID
, OP_VOID
);
1573 trace_output_void ();
1580 trace_input ("sfs", OP_REG
, OP_VOID
, OP_VOID
);
1585 trace_output_void ();
1592 trace_input ("sfc", OP_REG
, OP_VOID
, OP_VOID
);
1597 trace_output_void ();
1605 trace_input ("slo", OP_REG
, OP_VOID
, OP_VOID
);
1606 if (((PSR_Z
) == 0) & ((PSR_L
) == 0))
1610 trace_output_void ();
1617 trace_input ("shs", OP_REG
, OP_VOID
, OP_VOID
);
1618 if ( ((PSR_Z
) == 1) | ((PSR_L
) == 1))
1622 trace_output_void ();
1629 trace_input ("slt", OP_REG
, OP_VOID
, OP_VOID
);
1630 if (((PSR_Z
) == 0) & ((PSR_N
) == 0))
1634 trace_output_void ();
1641 trace_input ("sge", OP_REG
, OP_VOID
, OP_VOID
);
1642 if (((PSR_Z
) == 1) | ((PSR_N
) == 1))
1646 trace_output_void ();
1653 uint8 a
= OP
[0] & 0xff;
1654 uint32 addr
= OP
[1], tmp
;
1655 trace_input ("cbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1657 SET_PSR_F (tmp
& (1 << a
));
1658 tmp
= tmp
& ~(1 << a
);
1660 trace_output_32 (tmp
);
1667 uint8 a
= OP
[0] & 0xff;
1668 uint32 addr
= OP
[1], tmp
;
1669 trace_input ("cbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1671 SET_PSR_F (tmp
& (1 << a
));
1672 tmp
= tmp
& ~(1 << a
);
1674 trace_output_32 (tmp
);
1681 uint8 a
= (OP
[0]) & 0xff;
1682 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1683 trace_input ("cbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
1685 SET_PSR_F (tmp
& (1 << a
));
1686 tmp
= tmp
& ~(1 << a
);
1688 trace_output_32 (addr
);
1695 uint8 a
= (OP
[0]) & 0xff;
1696 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1697 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1699 SET_PSR_F (tmp
& (1 << a
));
1700 tmp
= tmp
& ~(1 << a
);
1702 trace_output_32 (addr
);
1709 uint8 a
= (OP
[0]) & 0xff;
1710 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1711 trace_input ("cbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1713 SET_PSR_F (tmp
& (1 << a
));
1714 tmp
= tmp
& ~(1 << a
);
1716 trace_output_32 (addr
);
1723 uint8 a
= (OP
[0]) & 0xff;
1724 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1725 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1727 SET_PSR_F (tmp
& (1 << a
));
1728 tmp
= tmp
& ~(1 << a
);
1730 trace_output_32 (addr
);
1737 uint8 a
= (OP
[0]) & 0xff;
1738 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1739 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1741 SET_PSR_F (tmp
& (1 << a
));
1742 tmp
= tmp
& ~(1 << a
);
1744 trace_output_32 (addr
);
1752 uint8 a
= (OP
[0]) & 0xff;
1753 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1754 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
1756 SET_PSR_F (tmp
& (1 << a
));
1757 tmp
= tmp
& ~(1 << a
);
1759 trace_output_32 (addr
);
1766 uint8 a
= (OP
[0]) & 0xff;
1767 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1768 trace_input ("cbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
1770 SET_PSR_F (tmp
& (1 << a
));
1771 tmp
= tmp
& ~(1 << a
);
1773 trace_output_32 (addr
);
1782 uint32 addr
= OP
[1], tmp
;
1783 trace_input ("cbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1785 SET_PSR_F (tmp
& (1 << a
));
1786 tmp
= tmp
& ~(1 << a
);
1788 trace_output_32 (tmp
);
1796 uint32 addr
= OP
[1], tmp
;
1797 trace_input ("cbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1799 SET_PSR_F (tmp
& (1 << a
));
1800 tmp
= tmp
& ~(1 << a
);
1802 trace_output_32 (tmp
);
1810 uint16 a
= (OP
[0]), tmp
;
1811 trace_input ("cbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
1814 addr
= (GPR32 (12)) + OP
[2];
1816 addr
= (GPR32 (13)) + OP
[2];
1819 SET_PSR_F (tmp
& (1 << a
));
1820 tmp
= tmp
& ~(1 << a
);
1822 trace_output_32 (addr
);
1831 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1832 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1834 SET_PSR_F (tmp
& (1 << a
));
1835 tmp
= tmp
& ~(1 << a
);
1837 trace_output_32 (addr
);
1845 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1846 trace_input ("cbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1848 SET_PSR_F (tmp
& (1 << a
));
1849 tmp
= tmp
& ~(1 << a
);
1851 trace_output_32 (addr
);
1860 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1861 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1863 SET_PSR_F (tmp
& (1 << a
));
1864 tmp
= tmp
& ~(1 << a
);
1866 trace_output_32 (addr
);
1874 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1875 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
1877 SET_PSR_F (tmp
& (1 << a
));
1878 tmp
= tmp
& ~(1 << a
);
1880 trace_output_32 (addr
);
1889 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1890 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
1892 SET_PSR_F (tmp
& (1 << a
));
1893 tmp
= tmp
& ~(1 << a
);
1895 trace_output_32 (addr
);
1903 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1904 trace_input ("cbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
1906 SET_PSR_F (tmp
& (1 << a
));
1907 tmp
= tmp
& ~(1 << a
);
1909 trace_output_32 (addr
);
1916 uint8 a
= OP
[0] & 0xff;
1917 uint32 addr
= OP
[1], tmp
;
1918 trace_input ("sbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
1920 SET_PSR_F (tmp
& (1 << a
));
1921 tmp
= tmp
| (1 << a
);
1923 trace_output_32 (tmp
);
1930 uint8 a
= OP
[0] & 0xff;
1931 uint32 addr
= OP
[1], tmp
;
1932 trace_input ("sbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
1934 SET_PSR_F (tmp
& (1 << a
));
1935 tmp
= tmp
| (1 << a
);
1937 trace_output_32 (tmp
);
1944 uint8 a
= OP
[0] & 0xff;
1945 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1946 trace_input ("sbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
1948 SET_PSR_F (tmp
& (1 << a
));
1949 tmp
= tmp
| (1 << a
);
1951 trace_output_32 (tmp
);
1958 uint8 a
= OP
[0] & 0xff;
1959 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1960 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
1962 SET_PSR_F (tmp
& (1 << a
));
1963 tmp
= tmp
| (1 << a
);
1965 trace_output_32 (tmp
);
1972 uint8 a
= OP
[0] & 0xff;
1973 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
1974 trace_input ("sbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
1976 SET_PSR_F (tmp
& (1 << a
));
1977 tmp
= tmp
| (1 << a
);
1979 trace_output_32 (tmp
);
1987 uint8 a
= OP
[0] & 0xff;
1988 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
1989 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
1991 SET_PSR_F (tmp
& (1 << a
));
1992 tmp
= tmp
| (1 << a
);
1994 trace_output_32 (tmp
);
2001 uint8 a
= OP
[0] & 0xff;
2002 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2003 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2005 SET_PSR_F (tmp
& (1 << a
));
2006 tmp
= tmp
| (1 << a
);
2008 trace_output_32 (tmp
);
2016 uint8 a
= OP
[0] & 0xff;
2017 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2018 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2020 SET_PSR_F (tmp
& (1 << a
));
2021 tmp
= tmp
| (1 << a
);
2023 trace_output_32 (tmp
);
2031 uint8 a
= OP
[0] & 0xff;
2032 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2033 trace_input ("sbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2035 SET_PSR_F (tmp
& (1 << a
));
2036 tmp
= tmp
| (1 << a
);
2038 trace_output_32 (tmp
);
2047 uint32 addr
= OP
[1], tmp
;
2048 trace_input ("sbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2050 SET_PSR_F (tmp
& (1 << a
));
2051 tmp
= tmp
| (1 << a
);
2053 trace_output_32 (tmp
);
2061 uint32 addr
= OP
[1], tmp
;
2062 trace_input ("sbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2064 SET_PSR_F (tmp
& (1 << a
));
2065 tmp
= tmp
| (1 << a
);
2067 trace_output_32 (tmp
);
2075 uint16 a
= (OP
[0]), tmp
;
2076 trace_input ("sbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
2079 addr
= (GPR32 (12)) + OP
[2];
2081 addr
= (GPR32 (13)) + OP
[2];
2084 SET_PSR_F (tmp
& (1 << a
));
2085 tmp
= tmp
| (1 << a
);
2087 trace_output_32 (addr
);
2095 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2096 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2098 SET_PSR_F (tmp
& (1 << a
));
2099 tmp
= tmp
| (1 << a
);
2101 trace_output_32 (addr
);
2109 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2110 trace_input ("sbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2112 SET_PSR_F (tmp
& (1 << a
));
2113 tmp
= tmp
| (1 << a
);
2115 trace_output_32 (addr
);
2123 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2124 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2126 SET_PSR_F (tmp
& (1 << a
));
2127 tmp
= tmp
| (1 << a
);
2129 trace_output_32 (addr
);
2137 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2138 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2140 SET_PSR_F (tmp
& (1 << a
));
2141 tmp
= tmp
| (1 << a
);
2143 trace_output_32 (addr
);
2151 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2152 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2154 SET_PSR_F (tmp
& (1 << a
));
2155 tmp
= tmp
| (1 << a
);
2157 trace_output_32 (addr
);
2165 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2166 trace_input ("sbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2168 SET_PSR_F (tmp
& (1 << a
));
2169 tmp
= tmp
| (1 << a
);
2171 trace_output_32 (addr
);
2179 uint8 a
= OP
[0] & 0xff;
2180 uint32 addr
= OP
[1], tmp
;
2181 trace_input ("tbitb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2183 SET_PSR_F (tmp
& (1 << a
));
2184 trace_output_32 (tmp
);
2191 uint8 a
= OP
[0] & 0xff;
2192 uint32 addr
= OP
[1], tmp
;
2193 trace_input ("tbitb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2195 SET_PSR_F (tmp
& (1 << a
));
2196 trace_output_32 (tmp
);
2203 uint8 a
= (OP
[0]) & 0xff;
2204 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2205 trace_input ("tbitb", OP_CONSTANT4
, OP_R_INDEX7_ABS20
, OP_VOID
);
2207 SET_PSR_F (tmp
& (1 << a
));
2208 trace_output_32 (addr
);
2215 uint8 a
= (OP
[0]) & 0xff;
2216 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2217 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2219 SET_PSR_F (tmp
& (1 << a
));
2220 trace_output_32 (addr
);
2227 uint8 a
= (OP
[0]) & 0xff;
2228 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2229 trace_input ("tbitb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2231 SET_PSR_F (tmp
& (1 << a
));
2232 trace_output_32 (addr
);
2239 uint8 a
= (OP
[0]) & 0xff;
2240 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2241 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2243 SET_PSR_F (tmp
& (1 << a
));
2244 trace_output_32 (addr
);
2251 uint8 a
= (OP
[0]) & 0xff;
2252 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2253 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2255 SET_PSR_F (tmp
& (1 << a
));
2256 trace_output_32 (addr
);
2263 uint8 a
= (OP
[0]) & 0xff;
2264 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2265 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2267 SET_PSR_F (tmp
& (1 << a
));
2268 trace_output_32 (addr
);
2275 uint8 a
= (OP
[0]) & 0xff;
2276 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2277 trace_input ("tbitb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2279 SET_PSR_F (tmp
& (1 << a
));
2280 trace_output_32 (addr
);
2289 uint32 addr
= OP
[1], tmp
;
2290 trace_input ("tbitw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
2292 SET_PSR_F (tmp
& (1 << a
));
2293 trace_output_32 (tmp
);
2301 uint32 addr
= OP
[1], tmp
;
2302 trace_input ("tbitw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
2304 SET_PSR_F (tmp
& (1 << a
));
2305 trace_output_32 (tmp
);
2314 uint16 a
= (OP
[0]), tmp
;
2315 trace_input ("tbitw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
2318 addr
= (GPR32 (12)) + OP
[2];
2320 addr
= (GPR32 (13)) + OP
[2];
2323 SET_PSR_F (tmp
& (1 << a
));
2324 trace_output_32 (addr
);
2332 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2333 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP14
, OP_VOID
);
2335 SET_PSR_F (tmp
& (1 << a
));
2336 trace_output_32 (addr
);
2344 uint32 addr
= (GPR (OP
[2])) + OP
[1], tmp
;
2345 trace_input ("tbitw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
2347 SET_PSR_F (tmp
& (1 << a
));
2348 trace_output_32 (addr
);
2356 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2357 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
2359 SET_PSR_F (tmp
& (1 << a
));
2360 trace_output_32 (addr
);
2368 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2369 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
2371 SET_PSR_F (tmp
& (1 << a
));
2372 trace_output_32 (addr
);
2380 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2381 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
2383 SET_PSR_F (tmp
& (1 << a
));
2384 trace_output_32 (addr
);
2393 uint32 addr
= (GPR32 (OP
[2])) + OP
[1], tmp
;
2394 trace_input ("tbitw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
2396 SET_PSR_F (tmp
& (1 << a
));
2397 trace_output_32 (addr
);
2406 uint16 b
= (GPR (OP
[1]));
2407 trace_input ("tbit", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2408 SET_PSR_F (b
& (1 << a
));
2409 trace_output_16 (b
);
2416 uint16 a
= GPR (OP
[0]);
2417 uint16 b
= (GPR (OP
[1]));
2418 trace_input ("tbit", OP_REG
, OP_REG
, OP_VOID
);
2419 SET_PSR_F (b
& (1 << a
));
2420 trace_output_16 (b
);
2428 uint8 a
= (OP
[0]) & 0xFF;
2429 uint8 b
= (GPR (OP
[1])) & 0xFF;
2430 trace_input ("cmpb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2432 SET_PSR_N ((int8
)a
> (int8
)b
);
2434 trace_output_flag ();
2441 uint8 a
= (OP
[0]) & 0xFF;
2442 uint8 b
= (GPR (OP
[1])) & 0xFF;
2443 trace_input ("cmpb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2445 SET_PSR_N ((int8
)a
> (int8
)b
);
2447 trace_output_flag ();
2454 uint8 a
= (GPR (OP
[0])) & 0xFF;
2455 uint8 b
= (GPR (OP
[1])) & 0xFF;
2456 trace_input ("cmpb", OP_REG
, OP_REG
, OP_VOID
);
2458 SET_PSR_N ((int8
)a
> (int8
)b
);
2460 trace_output_flag ();
2468 uint16 b
= GPR (OP
[1]);
2469 trace_input ("cmpw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2471 SET_PSR_N ((int16
)a
> (int16
)b
);
2473 trace_output_flag ();
2481 uint16 b
= GPR (OP
[1]);
2482 trace_input ("cmpw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2484 SET_PSR_N ((int16
)a
> (int16
)b
);
2486 trace_output_flag ();
2493 uint16 a
= GPR (OP
[0]) ;
2494 uint16 b
= GPR (OP
[1]) ;
2495 trace_input ("cmpw", OP_REG
, OP_REG
, OP_VOID
);
2497 SET_PSR_N ((int16
)a
> (int16
)b
);
2499 trace_output_flag ();
2507 uint32 b
= GPR32 (OP
[1]);
2508 trace_input ("cmpd", OP_CONSTANT4
, OP_REGP
, OP_VOID
);
2510 SET_PSR_N ((int32
)a
> (int32
)b
);
2512 trace_output_flag ();
2519 uint32 a
= (SEXT16(OP
[0]));
2520 uint32 b
= GPR32 (OP
[1]);
2521 trace_input ("cmpd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
2523 SET_PSR_N ((int32
)a
> (int32
)b
);
2525 trace_output_flag ();
2532 uint32 a
= GPR32 (OP
[0]) ;
2533 uint32 b
= GPR32 (OP
[1]) ;
2534 trace_input ("cmpd", OP_REGP
, OP_REGP
, OP_VOID
);
2536 SET_PSR_N ((int32
)a
> (int32
)b
);
2538 trace_output_flag ();
2546 uint32 b
= GPR32 (OP
[1]);
2547 trace_input ("cmpd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
2549 SET_PSR_N ((int32
)a
> (int32
)b
);
2551 trace_output_flag ();
2559 uint8 tmp
= OP
[0] & 0xFF;
2560 uint16 a
= (GPR (OP
[1])) & 0xFF00;
2561 trace_input ("movb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
2562 SET_GPR (OP
[1], (a
| tmp
));
2563 trace_output_16 (tmp
);
2570 uint8 tmp
= OP
[0] & 0xFF;
2571 uint16 a
= (GPR (OP
[1])) & 0xFF00;
2572 trace_input ("movb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2573 SET_GPR (OP
[1], (a
| tmp
));
2574 trace_output_16 (tmp
);
2581 uint8 tmp
= (GPR (OP
[0])) & 0xFF;
2582 uint16 a
= (GPR (OP
[1])) & 0xFF00;
2583 trace_input ("movb", OP_REG
, OP_REG
, OP_VOID
);
2584 SET_GPR (OP
[1], (a
| tmp
));
2585 trace_output_16 (tmp
);
2593 trace_input ("movw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
2594 SET_GPR (OP
[1], (tmp
& 0xffff));
2595 trace_output_16 (tmp
);
2603 trace_input ("movw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
2604 SET_GPR (OP
[1], (tmp
& 0xffff));
2605 trace_output_16 (tmp
);
2612 uint16 tmp
= GPR (OP
[0]);
2613 uint32 a
= GPR32 (OP
[1]);
2614 trace_input ("movw", OP_REG
, OP_REGP
, OP_VOID
);
2615 a
= (a
& 0xffff0000) | tmp
;
2616 SET_GPR32 (OP
[1], a
);
2617 trace_output_16 (tmp
);
2624 uint8 tmp
= (GPR (OP
[0])) & 0xFF;
2625 trace_input ("movxb", OP_REG
, OP_REG
, OP_VOID
);
2626 SET_GPR (OP
[1], ((SEXT8(tmp
)) & 0xffff));
2627 trace_output_16 (tmp
);
2634 uint8 tmp
= (GPR (OP
[0])) & 0xFF;
2635 trace_input ("movzb", OP_REG
, OP_REG
, OP_VOID
);
2636 SET_GPR (OP
[1], tmp
);
2637 trace_output_16 (tmp
);
2644 uint16 tmp
= GPR (OP
[0]);
2645 trace_input ("movxw", OP_REG
, OP_REGP
, OP_VOID
);
2646 SET_GPR32 (OP
[1], SEXT16(tmp
));
2647 trace_output_16 (tmp
);
2654 uint16 tmp
= GPR (OP
[0]);
2655 trace_input ("movzw", OP_REG
, OP_REGP
, OP_VOID
);
2656 SET_GPR32 (OP
[1], (tmp
& 0x0000FFFF));
2657 trace_output_16 (tmp
);
2665 trace_input ("movd", OP_CONSTANT4
, OP_REGP
, OP_VOID
);
2666 SET_GPR32 (OP
[1], tmp
);
2667 trace_output_32 (tmp
);
2674 int32 tmp
= SEXT16(OP
[0]);
2675 trace_input ("movd", OP_CONSTANT16
, OP_REGP
, OP_VOID
);
2676 SET_GPR32 (OP
[1], tmp
);
2677 trace_output_32 (tmp
);
2684 uint32 tmp
= GPR32 (OP
[0]);
2685 trace_input ("movd", OP_REGP
, OP_REGP
, OP_VOID
);
2686 SET_GPR32 (OP
[1], tmp
);
2687 trace_output_32 (tmp
);
2695 trace_input ("movd", OP_CONSTANT20
, OP_REGP
, OP_VOID
);
2696 SET_GPR32 (OP
[1], tmp
);
2697 trace_output_32 (tmp
);
2705 trace_input ("movd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
2706 SET_GPR32 (OP
[1], tmp
);
2707 trace_output_32 (tmp
);
2714 uint32 addr
= GPR (0);
2715 uint16 count
= OP
[0], reg
= 2, tmp
;
2716 trace_input ("loadm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
2719 State
.exception
= SIG_CR16_BUS
;
2720 State
.pc_changed
= 1; /* Don't increment the PC. */
2721 trace_output_void ();
2732 if (reg
== 6) reg
= 8;
2736 trace_output_void ();
2744 uint32 addr
= GPR32 (0);
2745 uint16 count
= OP
[0], reg
= 2, tmp
;
2746 trace_input ("loadm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
2749 State
.exception
= SIG_CR16_BUS
;
2750 State
.pc_changed
= 1; /* Don't increment the PC. */
2751 trace_output_void ();
2762 if (reg
== 6) reg
= 8;
2765 SET_GPR32 (0, addr
);
2766 trace_output_void ();
2775 * ADDR = zext24(abs20) | remap (ie 0xF00000)
2778 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
2779 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
2780 * by the core to 16M-64k to 16M. */
2782 uint16 tmp
, a
= (GPR (OP
[1])) & 0xFF00;
2783 uint32 addr
= OP
[0];
2784 trace_input ("loadb", OP_ABS20
, OP_REG
, OP_VOID
);
2785 if (addr
> 0xEFFFF) addr
|= 0xF00000;
2787 SET_GPR (OP
[1], (a
| tmp
));
2788 trace_output_16 (tmp
);
2799 uint16 tmp
, a
= (GPR (OP
[1])) & 0xFF00;
2800 uint32 addr
= OP
[0];
2801 trace_input ("loadb", OP_ABS24
, OP_REG
, OP_VOID
);
2803 SET_GPR (OP
[1], (a
| tmp
));
2804 trace_output_16 (tmp
);
2811 /* loadb [Rindex]ABS20 REG
2812 * ADDR = Rindex + zext24(disp20)
2816 uint16 tmp
, a
= (GPR (OP
[2])) & 0xFF00;
2817 trace_input ("loadb", OP_R_INDEX8_ABS20
, OP_REG
, OP_VOID
);
2820 addr
= (GPR32 (12)) + OP
[1];
2822 addr
= (GPR32 (13)) + OP
[1];
2825 SET_GPR (OP
[2], (a
| tmp
));
2826 trace_output_16 (tmp
);
2834 /* loadb DIPS4(REGP) REG
2835 * ADDR = RPBASE + zext24(DISP4)
2837 uint16 tmp
, a
= (GPR (OP
[2])) & 0xFF00;
2838 uint32 addr
= (GPR32 (OP
[1])) + OP
[0];
2839 trace_input ("loadb", OP_RP_BASE_DISP4
, OP_REG
, OP_VOID
);
2841 SET_GPR (OP
[2], (a
| tmp
));
2842 trace_output_16 (tmp
);
2849 /* loadb [Rindex]disp0(RPbasex) REG
2850 * ADDR = Rpbasex + Rindex
2854 uint16 tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2855 trace_input ("loadb", OP_RP_INDEX_DISP0
, OP_REG
, OP_VOID
);
2857 addr
= (GPR32 (OP
[2])) + OP
[1];
2860 addr
= (GPR32 (12)) + addr
;
2862 addr
= (GPR32 (13)) + addr
;
2865 SET_GPR (OP
[3], (a
| tmp
));
2866 trace_output_16 (tmp
);
2873 /* loadb [Rindex]disp14(RPbasex) REG
2874 * ADDR = Rpbasex + Rindex + zext24(disp14)
2878 uint16 tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2880 addr
= (GPR32 (OP
[2])) + OP
[1];
2883 addr
= (GPR32 (12)) + addr
;
2885 addr
= (GPR32 (13)) + addr
;
2887 trace_input ("loadb", OP_RP_INDEX_DISP14
, OP_REG
, OP_VOID
);
2889 SET_GPR (OP
[3], (a
| tmp
));
2890 trace_output_16 (tmp
);
2898 /* loadb DISPE20(REG) REG
2899 * zext24(Rbase) + zext24(dispe20)
2902 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2903 uint32 addr
= OP
[0] + (GPR (OP
[1]));
2904 trace_input ("loadb", OP_R_BASE_DISPE20
, OP_REG
, OP_VOID
);
2906 SET_GPR (OP
[2], (a
| tmp
));
2907 trace_output_16 (tmp
);
2914 /* loadb DISP20(REG) REG
2915 * ADDR = zext24(Rbase) + zext24(disp20)
2918 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2919 uint32 addr
= OP
[0] + (GPR (OP
[1]));
2920 trace_input ("loadb", OP_R_BASE_DISP20
, OP_REG
, OP_VOID
);
2922 SET_GPR (OP
[2], (a
| tmp
));
2923 trace_output_16 (tmp
);
2930 /* loadb disp16(REGP) REG
2931 * ADDR = RPbase + zext24(disp16)
2934 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2935 uint32 addr
= (GPR32 (OP
[1])) + OP
[0];
2936 trace_input ("loadb", OP_RP_BASE_DISP16
, OP_REG
, OP_VOID
);
2938 SET_GPR (OP
[2], (a
| tmp
));
2939 trace_output_16 (tmp
);
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
[0];
2951 trace_input ("loadb", OP_RP_BASE_DISP20
, OP_REG
, OP_VOID
);
2953 SET_GPR (OP
[2], (a
| tmp
));
2954 trace_output_16 (tmp
);
2962 /* loadb -disp20(REGP) REG
2963 * ADDR = RPbase + zext24(-disp20)
2965 uint16 tmp
,a
= (GPR (OP
[2])) & 0xFF00;
2966 uint32 addr
= (GPR32 (OP
[1])) + OP
[1];
2967 trace_input ("loadb", OP_RP_BASE_DISPE20
, OP_REG
, OP_VOID
);
2969 SET_GPR (OP
[2], (a
| tmp
));
2970 trace_output_16 (tmp
);
2977 /* loadb [Rindex]disp20(RPbasexb) REG
2978 * ADDR = RPbasex + Rindex + zext24(disp20)
2982 uint16 tmp
, a
= (GPR (OP
[3])) & 0xFF00;
2983 trace_input ("loadb", OP_RP_INDEX_DISP20
, OP_REG
, OP_VOID
);
2985 addr
= (GPR32 (OP
[2])) + OP
[1];
2988 addr
= (GPR32 (12)) + addr
;
2990 addr
= (GPR32 (13)) + addr
;
2993 SET_GPR (OP
[3], (a
| tmp
));
2994 trace_output_16 (tmp
);
3003 * ADDR = zext24(abs20) | remap
3006 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
3007 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
3008 * by the core to 16M-64k to 16M. */
3011 uint32 addr
= OP
[0];
3012 trace_input ("loadw", OP_ABS20
, OP_REG
, OP_VOID
);
3013 if (addr
> 0xEFFFF) addr
|= 0xF00000;
3015 SET_GPR (OP
[1], tmp
);
3016 trace_output_16 (tmp
);
3028 uint32 addr
= OP
[0];
3029 trace_input ("loadw", OP_ABS24
, OP_REG
, OP_VOID
);
3031 SET_GPR (OP
[1], tmp
);
3032 trace_output_16 (tmp
);
3039 /* loadw [Rindex]ABS20 REG
3040 * ADDR = Rindex + zext24(disp20)
3045 trace_input ("loadw", OP_R_INDEX8_ABS20
, OP_REG
, OP_VOID
);
3048 addr
= (GPR32 (12)) + OP
[1];
3050 addr
= (GPR32 (13)) + OP
[1];
3053 SET_GPR (OP
[2], tmp
);
3054 trace_output_16 (tmp
);
3062 /* loadw DIPS4(REGP) REGP
3063 * ADDR = RPBASE + zext24(DISP4)
3067 trace_input ("loadw", OP_RP_BASE_DISP4
, OP_REG
, OP_VOID
);
3068 addr
= (GPR32 (OP
[1])) + OP
[0];
3072 a
= (GPR32 (OP
[2])) & 0xffff0000;
3073 SET_GPR32 (OP
[2], (a
| tmp
));
3076 SET_GPR (OP
[2], tmp
);
3078 trace_output_16 (tmp
);
3086 /* loadw [Rindex]disp0(RPbasex) REG
3087 * ADDR = Rpbasex + Rindex
3092 trace_input ("loadw", OP_RP_INDEX_DISP0
, OP_REG
, OP_VOID
);
3094 addr
= (GPR32 (OP
[2])) + OP
[1];
3097 addr
= (GPR32 (12)) + addr
;
3099 addr
= (GPR32 (13)) + addr
;
3102 SET_GPR (OP
[3], tmp
);
3103 trace_output_16 (tmp
);
3111 /* loadw [Rindex]disp14(RPbasex) REG
3112 * ADDR = Rpbasex + Rindex + zext24(disp14)
3117 trace_input ("loadw", OP_RP_INDEX_DISP14
, OP_REG
, OP_VOID
);
3118 addr
= (GPR32 (OP
[2])) + OP
[1];
3121 addr
= (GPR32 (12)) + addr
;
3123 addr
= (GPR32 (13)) + addr
;
3126 SET_GPR (OP
[3], tmp
);
3127 trace_output_16 (tmp
);
3134 /* loadw dispe20(REG) REGP
3135 * REGP = [DISPE20+[REG]] */
3139 trace_input ("loadw", OP_R_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3140 addr
= OP
[0] + (GPR (OP
[1]));
3144 a
= (GPR32 (OP
[2])) & 0xffff0000;
3145 SET_GPR32 (OP
[2], (a
| tmp
));
3148 SET_GPR (OP
[2], tmp
);
3150 trace_output_16 (tmp
);
3158 /* loadw DISP20(REG) REGP
3159 * ADDR = zext24(Rbase) + zext24(disp20)
3164 trace_input ("loadw", OP_R_BASE_DISP20
, OP_REGP
, OP_VOID
);
3165 addr
= OP
[0] + (GPR (OP
[1]));
3169 a
= (GPR32 (OP
[2])) & 0xffff0000;
3170 SET_GPR32 (OP
[2], (a
| tmp
));
3173 SET_GPR (OP
[2], tmp
);
3175 trace_output_16 (tmp
);
3182 /* loadw disp16(REGP) REGP
3183 * ADDR = RPbase + zext24(disp16)
3187 trace_input ("loadw", OP_RP_BASE_DISP16
, OP_REGP
, OP_VOID
);
3188 addr
= (GPR32 (OP
[1])) + OP
[0];
3192 a
= (GPR32 (OP
[2])) & 0xffff0000;
3193 SET_GPR32 (OP
[2], (a
| tmp
));
3196 SET_GPR (OP
[2], tmp
);
3198 trace_output_16 (tmp
);
3205 /* loadw disp20(REGP) REGP
3206 * ADDR = RPbase + zext24(disp20)
3210 trace_input ("loadw", OP_RP_BASE_DISP20
, OP_REG
, OP_VOID
);
3211 addr
= (GPR32 (OP
[1])) + OP
[0];
3215 a
= (GPR32 (OP
[2])) & 0xffff0000;
3216 SET_GPR32 (OP
[2], (a
| tmp
));
3219 SET_GPR (OP
[2], tmp
);
3221 trace_output_16 (tmp
);
3228 /* loadw -disp20(REGP) REG
3229 * ADDR = RPbase + zext24(-disp20)
3234 trace_input ("loadw", OP_RP_BASE_DISPE20
, OP_REG
, OP_VOID
);
3235 addr
= (GPR32 (OP
[1])) + OP
[0];
3239 a
= (GPR32 (OP
[2])) & 0xffff0000;
3240 SET_GPR32 (OP
[2], (a
| tmp
));
3243 SET_GPR (OP
[2], tmp
);
3245 trace_output_16 (tmp
);
3253 /* loadw [Rindex]disp20(RPbasexb) REG
3254 * ADDR = RPbasex + Rindex + zext24(disp20)
3259 trace_input ("loadw", OP_RP_INDEX_DISP20
, OP_REG
, OP_VOID
);
3262 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3264 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3267 SET_GPR (OP
[3], tmp
);
3268 trace_output_16 (tmp
);
3276 /* loadd ABS20, REGP
3277 * ADDR = zext24(abs20) | remap
3280 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
3281 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
3282 * by the core to 16M-64k to 16M. */
3286 trace_input ("loadd", OP_ABS20
, OP_REGP
, OP_VOID
);
3287 if (addr
> 0xEFFFF) addr
|= 0xF00000;
3289 tmp
= ((tmp
<< 16) & 0xffff)| ((tmp
>> 16) & 0xffff);
3290 SET_GPR32 (OP
[1], tmp
);
3291 trace_output_32 (tmp
);
3298 /* loadd ABS24, REGP
3302 uint32 addr
= OP
[0];
3304 trace_input ("loadd", OP_ABS24
, OP_REGP
, OP_VOID
);
3306 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3307 SET_GPR32 (OP
[1],tmp
);
3308 trace_output_32 (tmp
);
3316 /* loadd [Rindex]ABS20 REGP
3317 * ADDR = Rindex + zext24(disp20)
3321 trace_input ("loadd", OP_R_INDEX8_ABS20
, OP_REGP
, OP_VOID
);
3324 addr
= (GPR32 (12)) + OP
[1];
3326 addr
= (GPR32 (13)) + OP
[1];
3329 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3330 SET_GPR32 (OP
[2], tmp
);
3331 trace_output_32 (tmp
);
3339 /* loadd dips4(regp) REGP
3340 * ADDR = Rpbase + zext24(disp4)
3343 uint32 tmp
, addr
= (GPR32 (OP
[1])) + OP
[0];
3344 trace_input ("loadd", OP_RP_BASE_DISP4
, OP_REGP
, OP_VOID
);
3346 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3347 SET_GPR32 (OP
[2], tmp
);
3348 trace_output_32 (tmp
);
3356 /* loadd [Rindex]disp0(RPbasex) REGP
3357 * ADDR = Rpbasex + Rindex
3361 trace_input ("loadd", OP_RP_INDEX_DISP0
, OP_REGP
, OP_VOID
);
3364 addr
= (GPR32 (12)) + (GPR32 (OP
[2])) + OP
[1];
3366 addr
= (GPR32 (13)) + (GPR32 (OP
[2])) + OP
[1];
3369 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3370 SET_GPR32 (OP
[3], tmp
);
3371 trace_output_32 (tmp
);
3379 /* loadd [Rindex]disp14(RPbasex) REGP
3380 * ADDR = Rpbasex + Rindex + zext24(disp14)
3384 trace_input ("loadd", OP_RP_INDEX_DISP14
, OP_REGP
, OP_VOID
);
3387 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3389 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3392 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3393 SET_GPR (OP
[3],tmp
);
3394 trace_output_32 (tmp
);
3402 /* loadd dispe20(REG) REG
3403 * zext24(Rbase) + zext24(dispe20)
3406 uint32 tmp
, addr
= OP
[0] + (GPR (OP
[1]));
3407 trace_input ("loadd", OP_R_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3409 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3410 SET_GPR32 (OP
[2], tmp
);
3411 trace_output_32 (tmp
);
3419 /* loadd DISP20(REG) REG
3420 * ADDR = zext24(Rbase) + zext24(disp20)
3423 uint32 tmp
, addr
= OP
[0] + (GPR (OP
[1]));
3424 trace_input ("loadd", OP_R_BASE_DISP20
, OP_REGP
, OP_VOID
);
3426 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3427 SET_GPR32 (OP
[2], tmp
);
3428 trace_output_32 (tmp
);
3435 /* loadd disp16(REGP) REGP
3436 * ADDR = RPbase + zext24(disp16)
3438 uint32 tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3439 trace_input ("loadd", OP_RP_BASE_DISP16
, OP_REGP
, OP_VOID
);
3441 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3442 SET_GPR32 (OP
[2], tmp
);
3443 trace_output_32 (tmp
);
3451 /* loadd disp20(REGP) REGP
3452 * ADDR = RPbase + zext24(disp20)
3454 uint32 tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3455 trace_input ("loadd", OP_RP_BASE_DISP20
, OP_REGP
, OP_VOID
);
3457 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3458 SET_GPR32 (OP
[2], tmp
);
3459 trace_output_32 (tmp
);
3466 /* loadd -disp20(REGP) REGP
3467 * ADDR = RPbase + zext24(-disp20)
3470 uint32 tmp
, addr
= OP
[0] + (GPR32 (OP
[1]));
3471 trace_input ("loadd", OP_RP_BASE_DISPE20
, OP_REGP
, OP_VOID
);
3473 tmp
= ((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff);
3474 SET_GPR32 (OP
[2], tmp
);
3475 trace_output_32 (tmp
);
3482 /* loadd [Rindex]disp20(RPbasexb) REGP
3483 * ADDR = RPbasex + Rindex + zext24(disp20)
3487 trace_input ("loadd", OP_RP_INDEX_DISP20
, OP_REGP
, OP_VOID
);
3490 addr
= (GPR32 (12)) + OP
[1] + (GPR32 (OP
[2]));
3492 addr
= (GPR32 (13)) + OP
[1] + (GPR32 (OP
[2]));
3495 tmp
= ((tmp
<< 16) & 0xffff)| ((tmp
>> 16) & 0xffff);
3496 SET_GPR32 (OP
[3], tmp
);
3497 trace_output_32 (tmp
);
3506 * ADDR = zext24(abs20) | remap
3509 * If (abs20 > 0xEFFFF) the resulting address is logically ORed
3510 * with 0xF00000 i.e. addresses from 1M-64k to 1M are re-mapped
3511 * by the core to 16M-64k to 16M. */
3513 uint8 a
= ((GPR (OP
[0])) & 0xff);
3514 uint32 addr
= OP
[1];
3515 trace_input ("storb", OP_REG
, OP_ABS20_OUTPUT
, OP_VOID
);
3517 trace_output_32 (addr
);
3528 uint8 a
= ((GPR (OP
[0])) & 0xff);
3529 uint32 addr
= OP
[1];
3530 trace_input ("storb", OP_REG
, OP_ABS24_OUTPUT
, OP_VOID
);
3532 trace_output_32 (addr
);
3539 /* storb REG, [Rindex]ABS20
3540 * ADDR = Rindex + zext24(disp20)
3544 uint8 a
= ((GPR (OP
[0])) & 0xff);
3545 trace_input ("storb", OP_REG
, OP_R_INDEX8_ABS20
, OP_VOID
);
3548 addr
= (GPR32 (12)) + OP
[2];
3550 addr
= (GPR32 (13)) + OP
[2];
3553 trace_output_32 (addr
);
3560 /* storb REG, DIPS4(REGP)
3561 * ADDR = RPBASE + zext24(DISP4)
3564 uint16 a
= ((GPR (OP
[0])) & 0xff);
3565 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3566 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPE4
, OP_VOID
);
3568 trace_output_32 (addr
);
3575 /* storb [Rindex]disp0(RPbasex) REG
3576 * ADDR = Rpbasex + Rindex
3580 uint8 a
= ((GPR (OP
[0])) & 0xff);
3581 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISP0
, OP_VOID
);
3584 addr
= (GPR32 (12)) + (GPR32 (OP
[3])) + OP
[2];
3586 addr
= (GPR32 (13)) + (GPR32 (OP
[3])) + OP
[2];
3589 trace_output_32 (addr
);
3596 /* storb REG, [Rindex]disp14(RPbasex)
3597 * ADDR = Rpbasex + Rindex + zext24(disp14)
3600 uint8 a
= ((GPR (OP
[0])) & 0xff);
3601 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3602 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISP14
, OP_VOID
);
3604 trace_output_32 (addr
);
3611 /* storb REG, DISPE20(REG)
3612 * zext24(Rbase) + zext24(dispe20)
3615 uint8 a
= ((GPR (OP
[0])) & 0xff);
3616 uint32 addr
= OP
[1] + (GPR (OP
[2]));
3617 trace_input ("storb", OP_REG
, OP_R_BASE_DISPE20
, OP_VOID
);
3619 trace_output_32 (addr
);
3626 /* storb REG, DISP20(REG)
3627 * ADDR = zext24(Rbase) + zext24(disp20)
3630 uint8 a
= (GPR (OP
[0]) & 0xff);
3631 uint32 addr
= OP
[1] + (GPR (OP
[2]));
3632 trace_input ("storb", OP_REG
, OP_R_BASE_DISPS20
, OP_VOID
);
3634 trace_output_32 (addr
);
3641 /* storb REG, disp16(REGP)
3642 * ADDR = RPbase + zext24(disp16)
3645 uint8 a
= ((GPR (OP
[0])) & 0xff);
3646 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3647 trace_input ("storb", OP_REG
, OP_RP_BASE_DISP16
, OP_VOID
);
3649 trace_output_32 (addr
);
3656 /* storb REG, disp20(REGP)
3657 * ADDR = RPbase + zext24(disp20)
3660 uint8 a
= ((GPR (OP
[0])) & 0xff);
3661 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3662 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPS20
, OP_VOID
);
3664 trace_output_32 (addr
);
3671 /* storb REG, -disp20(REGP)
3672 * ADDR = RPbase + zext24(-disp20)
3675 uint8 a
= (GPR (OP
[0]) & 0xff);
3676 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3677 trace_input ("storb", OP_REG
, OP_RP_BASE_DISPE20
, OP_VOID
);
3679 trace_output_32 (addr
);
3686 /* storb REG, [Rindex]disp20(RPbase)
3687 * ADDR = RPbasex + Rindex + zext24(disp20)
3690 uint8 a
= (GPR (OP
[0])) & 0xff;
3691 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3692 trace_input ("storb", OP_REG
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3694 trace_output_32 (addr
);
3697 /* STR_IMM instructions. */
3702 uint8 a
= (OP
[0]) & 0xff;
3703 uint32 addr
= OP
[1];
3704 trace_input ("storb", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
3706 trace_output_32 (addr
);
3713 uint8 a
= (OP
[0]) & 0xff;
3714 uint32 addr
= OP
[1];
3715 trace_input ("storb", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
3717 trace_output_32 (addr
);
3725 uint8 a
= (OP
[0]) & 0xff;
3726 trace_input ("storb", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
3729 addr
= (GPR32 (12)) + OP
[2];
3731 addr
= (GPR32 (13)) + OP
[2];
3734 trace_output_32 (addr
);
3741 uint8 a
= (OP
[0]) & 0xff;
3742 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3743 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISP14
, OP_VOID
);
3745 trace_output_32 (addr
);
3752 uint8 a
= (OP
[0]) & 0xff;
3753 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3754 trace_input ("storb", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
3756 trace_output_32 (addr
);
3763 uint8 a
= (OP
[0]) & 0xff;
3764 uint32 addr
= (GPR (OP
[2])) + OP
[1];
3765 trace_input ("storb", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
3767 trace_output_32 (addr
);
3774 uint8 a
= (OP
[0]) & 0xff;
3775 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3776 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
3778 trace_output_32 (addr
);
3785 uint8 a
= (OP
[0]) & 0xff;
3786 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3787 trace_input ("storb", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
3789 trace_output_32 (addr
);
3796 uint8 a
= (OP
[0]) & 0xff;
3797 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3798 trace_input ("storb", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3800 trace_output_32 (addr
);
3802 /* endif for STR_IMM. */
3808 uint16 a
= GPR (OP
[0]);
3809 uint32 addr
= OP
[1];
3810 trace_input ("storw", OP_REG
, OP_ABS20_OUTPUT
, OP_VOID
);
3812 trace_output_32 (addr
);
3819 uint16 a
= GPR (OP
[0]);
3820 uint32 addr
= OP
[1];
3821 trace_input ("storw", OP_REG
, OP_ABS24_OUTPUT
, OP_VOID
);
3823 trace_output_32 (addr
);
3831 uint16 a
= GPR (OP
[0]);
3832 trace_input ("storw", OP_REG
, OP_R_INDEX8_ABS20
, OP_VOID
);
3835 addr
= (GPR32 (12)) + OP
[2];
3837 addr
= (GPR32 (13)) + OP
[2];
3840 trace_output_32 (addr
);
3848 uint16 a
= (GPR (OP
[0]));
3849 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3850 trace_input ("storw", OP_REGP
, OP_RP_BASE_DISPE4
, OP_VOID
);
3852 trace_output_32 (addr
);
3859 uint16 a
= GPR (OP
[0]);
3860 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3861 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISP0
, OP_VOID
);
3863 trace_output_32 (addr
);
3870 uint16 a
= GPR (OP
[0]);
3871 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3872 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISP14
, OP_VOID
);
3874 trace_output_32 (addr
);
3881 uint16 a
= (GPR (OP
[0]));
3882 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3883 trace_input ("storw", OP_REGP
, OP_RP_BASE_DISPE20
, OP_VOID
);
3885 trace_output_32 (addr
);
3892 uint16 a
= (GPR (OP
[0]));
3893 uint32 addr
= (GPR (OP
[2])) + OP
[1];
3894 trace_input ("storw", OP_REG
, OP_R_BASE_DISPS20
, OP_VOID
);
3896 trace_output_32 (addr
);
3903 uint16 a
= (GPR (OP
[0]));
3904 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3905 trace_input ("storw", OP_REG
, OP_RP_BASE_DISP16
, OP_VOID
);
3907 trace_output_32 (addr
);
3914 uint16 a
= (GPR (OP
[0]));
3915 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3916 trace_input ("storw", OP_REG
, OP_RP_BASE_DISPS20
, OP_VOID
);
3918 trace_output_32 (addr
);
3925 uint16 a
= (GPR (OP
[0]));
3926 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3927 trace_input ("storw", OP_REG
, OP_RP_BASE_DISPE20
, OP_VOID
);
3929 trace_output_32 (addr
);
3936 uint16 a
= (GPR (OP
[0]));
3937 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3938 trace_input ("storw", OP_REG
, OP_RP_INDEX_DISPS20
, OP_VOID
);
3940 trace_output_32 (addr
);
3943 /* STORE-w IMM instruction *****/
3949 uint32 addr
= OP
[1];
3950 trace_input ("storw", OP_CONSTANT4
, OP_ABS20_OUTPUT
, OP_VOID
);
3952 trace_output_32 (addr
);
3960 uint32 addr
= OP
[1];
3961 trace_input ("storw", OP_CONSTANT4
, OP_ABS24_OUTPUT
, OP_VOID
);
3963 trace_output_32 (addr
);
3972 trace_input ("storw", OP_CONSTANT4
, OP_R_INDEX8_ABS20
, OP_VOID
);
3975 addr
= (GPR32 (12)) + OP
[2];
3977 addr
= (GPR32 (13)) + OP
[2];
3980 trace_output_32 (addr
);
3988 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
3989 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISP14
, OP_VOID
);
3991 trace_output_32 (addr
);
3999 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4000 trace_input ("storw", OP_CONSTANT4
, OP_RP_INDEX_DISP0
, OP_VOID
);
4002 trace_output_32 (addr
);
4010 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4011 trace_input ("storw", OP_CONSTANT4
, OP_R_BASE_DISPS20
, OP_VOID
);
4013 trace_output_32 (addr
);
4021 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4022 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISP16
, OP_VOID
);
4024 trace_output_32 (addr
);
4033 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4034 trace_input ("storw", OP_CONSTANT4
, OP_RP_BASE_DISPS20
, OP_VOID
);
4036 trace_output_32 (addr
);
4044 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4045 trace_input ("storw", OP_CONSTANT4
, OP_RP_INDEX_DISPS20
, OP_VOID
);
4047 trace_output_32 (addr
);
4055 uint32 a
= GPR32 (OP
[0]);
4056 uint32 addr
= OP
[1];
4057 trace_input ("stord", OP_REGP
, OP_ABS20_OUTPUT
, OP_VOID
);
4059 trace_output_32 (addr
);
4066 uint32 a
= GPR32 (OP
[0]);
4067 uint32 addr
= OP
[1];
4068 trace_input ("stord", OP_REGP
, OP_ABS24_OUTPUT
, OP_VOID
);
4070 trace_output_32 (addr
);
4077 uint32 addr
, a
= GPR32 (OP
[0]);
4078 trace_input ("stord", OP_REGP
, OP_R_INDEX8_ABS20
, OP_VOID
);
4081 addr
= (GPR32 (12)) + OP
[2];
4083 addr
= (GPR32 (13)) + OP
[2];
4086 trace_output_32 (addr
);
4093 uint32 a
= GPR32 (OP
[0]);
4094 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4095 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPE4
, OP_VOID
);
4097 trace_output_32 (addr
);
4104 uint32 a
= GPR32 (OP
[0]);
4105 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4106 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISP0
, OP_VOID
);
4108 trace_output_32 (addr
);
4115 uint32 a
= GPR32 (OP
[0]);
4116 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4117 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISP14
, OP_VOID
);
4119 trace_output_32 (addr
);
4126 uint32 a
= GPR32 (OP
[0]);
4127 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4128 trace_input ("stord", OP_REGP
, OP_R_BASE_DISPE20
, OP_VOID
);
4130 trace_output_32 (addr
);
4137 uint32 a
= GPR32 (OP
[0]);
4138 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4139 trace_input ("stord", OP_REGP
, OP_R_BASE_DISPS20
, OP_VOID
);
4141 trace_output_32 (addr
);
4148 uint32 a
= GPR32 (OP
[0]);
4149 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4150 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISP16
, OP_VOID
);
4152 trace_output_32 (addr
);
4159 uint32 a
= GPR32 (OP
[0]);
4160 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4161 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPS20
, OP_VOID
);
4163 trace_output_32 (addr
);
4170 uint32 a
= GPR32 (OP
[0]);
4171 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4172 trace_input ("stord", OP_REGP
, OP_RP_BASE_DISPE20
, OP_VOID
);
4174 trace_output_32 (addr
);
4181 uint32 a
= GPR32 (OP
[0]);
4182 uint32 addr
= (GPR32 (OP
[2])) + OP
[1];
4183 trace_input ("stord", OP_REGP
, OP_RP_INDEX_DISPS20
, OP_VOID
);
4185 trace_output_32 (addr
);
4194 trace_input ("macuw", OP_REG
, OP_REG
, OP_REGP
);
4198 /*REVISIT FOR SATURATION and Q FORMAT. */
4199 SET_GPR32 (OP
[2], tmp
);
4200 trace_output_32 (tmp
);
4209 trace_input ("macuw", OP_REG
, OP_REG
, OP_REGP
);
4213 /*REVISIT FOR SATURATION. */
4214 SET_GPR32 (OP
[2], tmp
);
4215 trace_output_32 (tmp
);
4224 trace_input ("macsw", OP_REG
, OP_REG
, OP_REGP
);
4228 /*REVISIT FOR SATURATION. */
4229 SET_GPR32 (OP
[2], tmp
);
4230 trace_output_32 (tmp
);
4239 int8 a
= (OP
[0]) & 0xff;
4240 int8 b
= (GPR (OP
[1])) & 0xff;
4241 trace_input ("mulb", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
4242 tmp
= (a
* b
) & 0xff;
4243 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4244 trace_output_16 (tmp
);
4252 int8 a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4253 trace_input ("mulb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4254 tmp
= (a
* b
) & 0xff;
4255 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4256 trace_output_16 (tmp
);
4265 int8 a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4266 trace_input ("mulb", OP_REG
, OP_REG
, OP_VOID
);
4267 tmp
= (a
* b
) & 0xff;
4268 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4269 trace_output_16 (tmp
);
4279 int16 b
= (GPR (OP
[1]));
4280 trace_input ("mulw", OP_CONSTANT4_1
, OP_REG
, OP_VOID
);
4281 tmp
= (a
* b
) & 0xffff;
4282 SET_GPR (OP
[1], tmp
);
4283 trace_output_32 (tmp
);
4291 int16 a
= OP
[0], b
= (GPR (OP
[1]));
4292 trace_input ("mulw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4293 tmp
= (a
* b
) & 0xffff;
4294 SET_GPR (OP
[1], tmp
);
4295 trace_output_32 (tmp
);
4304 int16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4305 trace_input ("mulw", OP_REG
, OP_REG
, OP_VOID
);
4306 tmp
= (a
* b
) & 0xffff;
4307 SET_GPR (OP
[1], tmp
);
4308 trace_output_32 (tmp
);
4317 int8 a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4318 trace_input ("mulsb", OP_REG
, OP_REG
, OP_VOID
);
4320 SET_GPR (OP
[1], tmp
);
4321 trace_output_32 (tmp
);
4329 int16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4330 trace_input ("mulsw", OP_REG
, OP_REGP
, OP_VOID
);
4332 SET_GPR32 (OP
[1], tmp
);
4333 trace_output_32 (tmp
);
4341 uint16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4342 trace_input ("muluw", OP_REG
, OP_REGP
, OP_VOID
);
4344 SET_GPR32 (OP
[1], tmp
);
4345 trace_output_32 (tmp
);
4353 trace_input ("nop", OP_VOID
, OP_VOID
, OP_VOID
);
4356 State
.exception
= SIGTRAP
;
4357 ins_type_counters
[ (int)State
.ins_type
]--; /* don't count nops as normal instructions */
4358 switch (State
.ins_type
)
4361 ins_type_counters
[ (int)INS_UNKNOWN
]++;
4367 trace_output_void ();
4375 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4376 trace_input ("orb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4378 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4379 trace_output_16 (tmp
);
4386 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4387 trace_input ("orb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4389 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4390 trace_output_16 (tmp
);
4397 uint8 tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
4398 trace_input ("orb", OP_REG
, OP_REG
, OP_VOID
);
4400 SET_GPR (OP
[1], ((GPR (OP
[1]) | tmp
)));
4401 trace_output_16 (tmp
);
4408 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
4409 trace_input ("orw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4411 SET_GPR (OP
[1], tmp
);
4412 trace_output_16 (tmp
);
4420 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
4421 trace_input ("orw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4423 SET_GPR (OP
[1], tmp
);
4424 trace_output_16 (tmp
);
4431 uint16 tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
4432 trace_input ("orw", OP_REG
, OP_REG
, OP_VOID
);
4434 SET_GPR (OP
[1], tmp
);
4435 trace_output_16 (tmp
);
4444 uint16 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4445 trace_input ("lshb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4446 /* A positive count specifies a shift to the left;
4447 * A negative count specifies a shift to the right. */
4453 sign_flag
= 0; /* Reset sign_flag. */
4455 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4456 trace_output_16 (tmp
);
4463 uint16 a
= (GPR (OP
[0])) & 0xff;
4464 uint16 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4465 trace_input ("lshb", OP_REG
, OP_REG
, OP_VOID
);
4466 if (a
& ((long)1 << 3))
4471 a
= (unsigned int) (a
& 0x7);
4473 /* A positive count specifies a shift to the left;
4474 * A negative count specifies a shift to the right. */
4480 sign_flag
= 0; /* Reset sign_flag. */
4481 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4482 trace_output_16 (tmp
);
4489 uint16 tmp
, b
= GPR (OP
[1]);
4490 int16 a
= GPR (OP
[0]);
4491 trace_input ("lshw", OP_REG
, OP_REG
, OP_VOID
);
4492 if (a
& ((long)1 << 4))
4497 a
= (unsigned int) (a
& 0xf);
4499 /* A positive count specifies a shift to the left;
4500 * A negative count specifies a shift to the right. */
4506 sign_flag
= 0; /* Reset sign_flag. */
4507 SET_GPR (OP
[1], (tmp
& 0xffff));
4508 trace_output_16 (tmp
);
4515 uint16 tmp
, b
= GPR (OP
[1]);
4517 trace_input ("lshw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4518 /* A positive count specifies a shift to the left;
4519 * A negative count specifies a shift to the right. */
4525 sign_flag
= 0; /* Reset sign_flag. */
4526 SET_GPR (OP
[1], (tmp
& 0xffff));
4527 trace_output_16 (tmp
);
4534 uint32 tmp
, b
= GPR32 (OP
[1]);
4536 trace_input ("lshd", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4537 /* A positive count specifies a shift to the left;
4538 * A negative count specifies a shift to the right. */
4544 sign_flag
= 0; /* Reset sign flag. */
4546 SET_GPR32 (OP
[1], tmp
);
4547 trace_output_32 (tmp
);
4554 uint32 tmp
, b
= GPR32 (OP
[1]);
4555 uint16 a
= GPR (OP
[0]);
4556 trace_input ("lshd", OP_REG
, OP_REGP
, OP_VOID
);
4557 if (a
& ((long)1 << 5))
4562 a
= (unsigned int) (a
& 0x1f);
4563 /* A positive count specifies a shift to the left;
4564 * A negative count specifies a shift to the right. */
4570 sign_flag
= 0; /* Reset sign flag. */
4572 SET_GPR32 (OP
[1], tmp
);
4573 trace_output_32 (tmp
);
4581 int8 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4582 trace_input ("ashub", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4583 /* A positive count specifies a shift to the left;
4584 * A negative count specifies a shift to the right. */
4590 sign_flag
= 0; /* Reset sign flag. */
4592 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xff00)));
4593 trace_output_16 (tmp
);
4601 int8 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4602 trace_input ("ashub", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4603 /* A positive count specifies a shift to the left;
4604 * A negative count specifies a shift to the right. */
4610 sign_flag
= 0; /* Reset sign flag. */
4612 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4613 trace_output_16 (tmp
);
4621 int16 a
= (GPR (OP
[0]));
4622 int8 tmp
, b
= (GPR (OP
[1])) & 0xFF;
4623 trace_input ("ashub", OP_REG
, OP_REG
, OP_VOID
);
4625 if (a
& ((long)1 << 3))
4630 a
= (unsigned int) (a
& 0x7);
4632 /* A positive count specifies a shift to the left;
4633 * A negative count specifies a shift to the right. */
4639 sign_flag
= 0; /* Reset sign flag. */
4641 SET_GPR (OP
[1], ((tmp
& 0xFF) | ((GPR (OP
[1])) & 0xFF00)));
4642 trace_output_16 (tmp
);
4650 int16 tmp
, b
= GPR (OP
[1]);
4652 trace_input ("ashuw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4653 /* A positive count specifies a shift to the left;
4654 * A negative count specifies a shift to the right. */
4660 sign_flag
= 0; /* Reset sign flag. */
4662 SET_GPR (OP
[1], (tmp
& 0xffff));
4663 trace_output_16 (tmp
);
4670 int16 tmp
, b
= GPR (OP
[1]);
4672 trace_input ("ashuw", OP_CONSTANT5
, OP_REG
, OP_VOID
);
4673 /* A positive count specifies a shift to the left;
4674 * A negative count specifies a shift to the right. */
4680 sign_flag
= 0; /* Reset sign flag. */
4681 SET_GPR (OP
[1], (tmp
& 0xffff));
4682 trace_output_16 (tmp
);
4690 int16 a
= GPR (OP
[0]), b
= GPR (OP
[1]);
4691 trace_input ("ashuw", OP_REG
, OP_REG
, OP_VOID
);
4693 if (a
& ((long)1 << 4))
4698 a
= (unsigned int) (a
& 0xf);
4699 /* A positive count specifies a shift to the left;
4700 * A negative count specifies a shift to the right. */
4707 sign_flag
= 0; /* Reset sign flag. */
4708 SET_GPR (OP
[1], (tmp
& 0xffff));
4709 trace_output_16 (tmp
);
4716 int32 tmp
,b
= GPR32 (OP
[1]);
4718 trace_input ("ashud", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4719 /* A positive count specifies a shift to the left;
4720 * A negative count specifies a shift to the right. */
4726 sign_flag
= 0; /* Reset sign flag. */
4727 SET_GPR32 (OP
[1], tmp
);
4728 trace_output_32 (tmp
);
4736 int32 a
= OP
[0], b
= GPR32 (OP
[1]);
4737 trace_input ("ashud", OP_CONSTANT6
, OP_REGP
, OP_VOID
);
4738 /* A positive count specifies a shift to the left;
4739 * A negative count specifies a shift to the right. */
4745 sign_flag
= 0; /* Reset sign flag. */
4746 SET_GPR32 (OP
[1], tmp
);
4747 trace_output_32 (tmp
);
4755 int32 a
= GPR32 (OP
[0]), b
= GPR32 (OP
[1]);
4756 trace_input ("ashud", OP_REGP
, OP_REGP
, OP_VOID
);
4758 if (a
& ((long)1 << 5))
4763 a
= (unsigned int) (a
& 0x1f);
4764 /* A positive count specifies a shift to the left;
4765 * A negative count specifies a shift to the right. */
4771 sign_flag
= 0; /* Reset sign flag. */
4772 SET_GPR32 (OP
[1], tmp
);
4773 trace_output_32 (tmp
);
4781 uint32 addr
= GPR (1);
4782 uint16 count
= OP
[0], reg
= 2;
4783 trace_input ("storm", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
4786 State
.exception
= SIG_CR16_BUS
;
4787 State
.pc_changed
= 1; /* Don't increment the PC. */
4788 trace_output_void ();
4794 SW (addr
, (GPR (reg
)));
4798 if (reg
== 6) reg
= 8;
4803 trace_output_void ();
4811 uint32 addr
= GPR32 (6);
4812 uint16 count
= OP
[0], reg
= 2;
4813 trace_input ("stormp", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
4816 State
.exception
= SIG_CR16_BUS
;
4817 State
.pc_changed
= 1; /* Don't increment the PC. */
4818 trace_output_void ();
4824 SW (addr
, (GPR (reg
)));
4828 if (reg
== 6) reg
= 8;
4831 SET_GPR32 (6, addr
);
4832 trace_output_void ();
4840 uint8 b
= (GPR (OP
[1])) & 0xff;
4841 uint16 tmp
= (~a
+ 1 + b
) & 0xff;
4842 trace_input ("subb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4843 /* see ../common/sim-alu.h for a more extensive discussion on how to
4844 compute the carry/overflow bits. */
4845 SET_PSR_C (tmp
> 0xff);
4846 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4847 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4848 trace_output_16 (tmp
);
4855 uint8 a
= OP
[0] & 0xFF;
4856 uint8 b
= (GPR (OP
[1])) & 0xFF;
4857 uint16 tmp
= (~a
+ 1 + b
) & 0xFF;
4858 trace_input ("subb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4859 /* see ../common/sim-alu.h for a more extensive discussion on how to
4860 compute the carry/overflow bits. */
4861 SET_PSR_C (tmp
> 0xff);
4862 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4863 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4864 trace_output_16 (tmp
);
4871 uint8 a
= (GPR (OP
[0])) & 0xFF;
4872 uint8 b
= (GPR (OP
[1])) & 0xFF;
4873 uint16 tmp
= (~a
+ 1 + b
) & 0xff;
4874 trace_input ("subb", OP_REG
, OP_REG
, OP_VOID
);
4875 /* see ../common/sim-alu.h for a more extensive discussion on how to
4876 compute the carry/overflow bits. */
4877 SET_PSR_C (tmp
> 0xff);
4878 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4879 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
4880 trace_output_16 (tmp
);
4888 uint16 b
= GPR (OP
[1]);
4889 uint16 tmp
= (~a
+ 1 + b
);
4890 trace_input ("subw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4891 /* see ../common/sim-alu.h for a more extensive discussion on how to
4892 compute the carry/overflow bits. */
4893 SET_PSR_C (tmp
> 0xffff);
4894 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4895 SET_GPR (OP
[1], tmp
);
4896 trace_output_16 (tmp
);
4904 uint16 b
= GPR (OP
[1]);
4905 uint32 tmp
= (~a
+ 1 + b
);
4906 trace_input ("subw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4907 /* see ../common/sim-alu.h for a more extensive discussion on how to
4908 compute the carry/overflow bits. */
4909 SET_PSR_C (tmp
> 0xffff);
4910 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4911 SET_GPR (OP
[1], tmp
& 0xffff);
4912 trace_output_16 (tmp
);
4919 uint16 a
= GPR (OP
[0]);
4920 uint16 b
= GPR (OP
[1]);
4921 uint32 tmp
= (~a
+ 1 + b
);
4922 trace_input ("subw", OP_REG
, OP_REG
, OP_VOID
);
4923 /* see ../common/sim-alu.h for a more extensive discussion on how to
4924 compute the carry/overflow bits. */
4925 SET_PSR_C (tmp
> 0xffff);
4926 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4927 SET_GPR (OP
[1], tmp
& 0xffff);
4928 trace_output_16 (tmp
);
4936 uint8 b
= (GPR (OP
[1])) & 0xff;
4937 //uint16 tmp1 = a + 1;
4938 uint16 tmp1
= a
+ (PSR_C
);
4939 uint16 tmp
= (~tmp1
+ 1 + b
);
4940 trace_input ("subcb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4941 /* see ../common/sim-alu.h for a more extensive discussion on how to
4942 compute the carry/overflow bits. */
4943 SET_PSR_C (tmp
> 0xff);
4944 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4945 SET_GPR (OP
[1], tmp
);
4946 trace_output_16 (tmp
);
4954 uint16 b
= (GPR (OP
[1])) & 0xff;
4955 //uint16 tmp1 = a + 1;
4956 uint16 tmp1
= a
+ (PSR_C
);
4957 uint16 tmp
= (~tmp1
+ 1 + b
);
4958 trace_input ("subcb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
4959 /* see ../common/sim-alu.h for a more extensive discussion on how to
4960 compute the carry/overflow bits. */
4961 SET_PSR_C (tmp
> 0xff);
4962 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4963 SET_GPR (OP
[1], tmp
);
4964 trace_output_16 (tmp
);
4971 uint16 a
= (GPR (OP
[0])) & 0xff;
4972 uint16 b
= (GPR (OP
[1])) & 0xff;
4973 uint16 tmp1
= a
+ (PSR_C
);
4974 uint16 tmp
= (~tmp1
+ 1 + b
);
4975 trace_input ("subcb", OP_REG
, OP_REG
, OP_VOID
);
4976 /* see ../common/sim-alu.h for a more extensive discussion on how to
4977 compute the carry/overflow bits. */
4978 SET_PSR_C (tmp
> 0xff);
4979 SET_PSR_F (((a
& 0x80) != (b
& 0x80)) && ((b
& 0x80) != (tmp
& 0x80)));
4980 SET_GPR (OP
[1], tmp
);
4981 trace_output_16 (tmp
);
4988 uint16 a
= OP
[0], b
= (GPR (OP
[1]));
4989 uint16 tmp1
= a
+ (PSR_C
);
4990 uint16 tmp
= (~tmp1
+ 1 + b
);
4991 trace_input ("subcw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
4992 /* see ../common/sim-alu.h for a more extensive discussion on how to
4993 compute the carry/overflow bits. */
4994 SET_PSR_C (tmp
> 0xffff);
4995 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
4996 SET_GPR (OP
[1], tmp
);
4997 trace_output_16 (tmp
);
5005 uint16 b
= GPR (OP
[1]);
5006 uint16 tmp1
= a
+ (PSR_C
);
5007 uint16 tmp
= (~tmp1
+ 1 + b
);
5008 trace_input ("subcw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
5009 /* see ../common/sim-alu.h for a more extensive discussion on how to
5010 compute the carry/overflow bits. */
5011 SET_PSR_C (tmp
> 0xffff);
5012 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
5013 SET_GPR (OP
[1], tmp
);
5014 trace_output_16 (tmp
);
5021 uint16 a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
5022 uint16 tmp1
= a
+ (PSR_C
);
5023 uint16 tmp
= (~tmp1
+ 1 + b
);
5024 trace_input ("subcw", OP_REG
, OP_REG
, OP_VOID
);
5025 /* see ../common/sim-alu.h for a more extensive discussion on how to
5026 compute the carry/overflow bits. */
5027 SET_PSR_C (tmp
> 0xffff);
5028 SET_PSR_F (((a
& 0x8000) != (b
& 0x8000)) && ((b
& 0x8000) != (tmp
& 0x8000)));
5029 SET_GPR (OP
[1], tmp
);
5030 trace_output_16 (tmp
);
5038 uint32 b
= GPR32 (OP
[1]);
5039 uint32 tmp
= (~a
+ 1 + b
);
5040 trace_input ("subd", OP_CONSTANT32
, OP_REGP
, OP_VOID
);
5041 /* see ../common/sim-alu.h for a more extensive discussion on how to
5042 compute the carry/overflow bits. */
5043 SET_PSR_C (tmp
> 0xffffffff);
5044 SET_PSR_F (((a
& 0x80000000) != (b
& 0x80000000)) &&
5045 ((b
& 0x80000000) != (tmp
& 0x80000000)));
5046 SET_GPR32 (OP
[1], tmp
);
5047 trace_output_32 (tmp
);
5054 uint32 a
= GPR32 (OP
[0]);
5055 uint32 b
= GPR32 (OP
[1]);
5056 uint32 tmp
= (~a
+ 1 + b
);
5057 trace_input ("subd", OP_REGP
, OP_REGP
, OP_VOID
);
5058 /* see ../common/sim-alu.h for a more extensive discussion on how to
5059 compute the carry/overflow bits. */
5060 SET_PSR_C (tmp
> 0xffffffff);
5061 SET_PSR_F (((a
& 0x80000000) != (b
& 0x80000000)) &&
5062 ((b
& 0x80000000) != (tmp
& 0x80000000)));
5063 SET_GPR32 (OP
[1], tmp
);
5064 trace_output_32 (tmp
);
5073 trace_input ("excp", OP_CONSTANT4
, OP_VOID
, OP_VOID
);
5077 #if (DEBUG & DEBUG_TRAP) == 0
5080 uint16 vec
= OP
[0] + TRAP_VECTOR_START
;
5083 SET_PSR (PSR
& PSR_SM_BIT
);
5088 #else /* if debugging use trap to print registers */
5091 static int first_time
= 1;
5096 (*cr16_callback
->printf_filtered
) (cr16_callback
, "Trap # PC ");
5097 for (i
= 0; i
< 16; i
++)
5098 (*cr16_callback
->printf_filtered
) (cr16_callback
, " %sr%d", (i
> 9) ? "" : " ", i
);
5099 (*cr16_callback
->printf_filtered
) (cr16_callback
, " a0 a1 f0 f1 c\n");
5102 (*cr16_callback
->printf_filtered
) (cr16_callback
, "Trap %2d 0x%.4x:", (int)OP
[0], (int)PC
);
5104 for (i
= 0; i
< 16; i
++)
5105 (*cr16_callback
->printf_filtered
) (cr16_callback
, " %.4x", (int) GPR (i
));
5107 for (i
= 0; i
< 2; i
++)
5108 (*cr16_callback
->printf_filtered
) (cr16_callback
, " %.2x%.8lx",
5109 ((int)(ACC (i
) >> 32) & 0xff),
5110 ((unsigned long) ACC (i
)) & 0xffffffff);
5112 (*cr16_callback
->printf_filtered
) (cr16_callback
, " %d %d %d\n",
5113 PSR_F
!= 0, PSR_F
!= 0, PSR_C
!= 0);
5114 (*cr16_callback
->flush_stdout
) (cr16_callback
);
5118 case 8: /* new system call trap */
5119 /* Trap 8 is used for simulating low-level I/O */
5121 unsigned32 result
= 0;
5124 /* Registers passed to trap 0. */
5126 #define FUNC GPR (0) /* function number. */
5127 #define PARM1 GPR (2) /* optional parm 1. */
5128 #define PARM2 GPR (3) /* optional parm 2. */
5129 #define PARM3 GPR (4) /* optional parm 3. */
5130 #define PARM4 GPR (5) /* optional parm 4. */
5132 /* Registers set by trap 0 */
5134 #define RETVAL(X) do { result = (0xffff & (X));SET_GPR (0, result);} while (0)
5135 #define RETVAL32(X) do { result = (X); SET_GPR32 (0, result);} while (0)
5136 #define RETERR(X) SET_GPR (4, (X)) /* return error code. */
5138 /* Turn a pointer in a register into a pointer into real memory. */
5140 #define MEMPTR(x) ((char *)(dmem_addr(x)))
5144 #if !defined(__GO32__) && !defined(_WIN32)
5145 #ifdef TARGET_SYS_fork
5146 case TARGET_SYS_fork
:
5147 trace_input ("<fork>", OP_VOID
, OP_VOID
, OP_VOID
);
5149 trace_output_16 (result
);
5154 case TARGET_SYS_getpid
:
5155 trace_input ("<getpid>", OP_VOID
, OP_VOID
, OP_VOID
);
5157 trace_output_16 (result
);
5160 case TARGET_SYS_kill
:
5161 trace_input ("<kill>", OP_REG
, OP_REG
, OP_VOID
);
5162 if (PARM1
== getpid ())
5164 trace_output_void ();
5165 State
.exception
= PARM2
;
5173 case 1: os_sig
= SIGHUP
; break;
5176 case 2: os_sig
= SIGINT
; break;
5179 case 3: os_sig
= SIGQUIT
; break;
5182 case 4: os_sig
= SIGILL
; break;
5185 case 5: os_sig
= SIGTRAP
; break;
5188 case 6: os_sig
= SIGABRT
; break;
5189 #elif defined(SIGIOT)
5190 case 6: os_sig
= SIGIOT
; break;
5193 case 7: os_sig
= SIGEMT
; break;
5196 case 8: os_sig
= SIGFPE
; break;
5199 case 9: os_sig
= SIGKILL
; break;
5202 case 10: os_sig
= SIGBUS
; break;
5205 case 11: os_sig
= SIGSEGV
; break;
5208 case 12: os_sig
= SIGSYS
; break;
5211 case 13: os_sig
= SIGPIPE
; break;
5214 case 14: os_sig
= SIGALRM
; break;
5217 case 15: os_sig
= SIGTERM
; break;
5220 case 16: os_sig
= SIGURG
; break;
5223 case 17: os_sig
= SIGSTOP
; break;
5226 case 18: os_sig
= SIGTSTP
; break;
5229 case 19: os_sig
= SIGCONT
; break;
5232 case 20: os_sig
= SIGCHLD
; break;
5233 #elif defined(SIGCLD)
5234 case 20: os_sig
= SIGCLD
; break;
5237 case 21: os_sig
= SIGTTIN
; break;
5240 case 22: os_sig
= SIGTTOU
; break;
5243 case 23: os_sig
= SIGIO
; break;
5244 #elif defined (SIGPOLL)
5245 case 23: os_sig
= SIGPOLL
; break;
5248 case 24: os_sig
= SIGXCPU
; break;
5251 case 25: os_sig
= SIGXFSZ
; break;
5254 case 26: os_sig
= SIGVTALRM
; break;
5257 case 27: os_sig
= SIGPROF
; break;
5260 case 28: os_sig
= SIGWINCH
; break;
5263 case 29: os_sig
= SIGLOST
; break;
5266 case 30: os_sig
= SIGUSR1
; break;
5269 case 31: os_sig
= SIGUSR2
; break;
5275 trace_output_void ();
5276 (*cr16_callback
->printf_filtered
) (cr16_callback
, "Unknown signal %d\n", PARM2
);
5277 (*cr16_callback
->flush_stdout
) (cr16_callback
);
5278 State
.exception
= SIGILL
;
5282 RETVAL (kill (PARM1
, PARM2
));
5283 trace_output_16 (result
);
5288 #ifdef TARGET_SYS_execve
5289 case TARGET_SYS_execve
:
5290 trace_input ("<execve>", OP_VOID
, OP_VOID
, OP_VOID
);
5291 RETVAL (execve (MEMPTR (PARM1
), (char **) MEMPTR (PARM2
<<16|PARM3
),
5292 (char **)MEMPTR (PARM4
)));
5293 trace_output_16 (result
);
5297 #ifdef TARGET_SYS_execv
5298 case TARGET_SYS_execv
:
5299 trace_input ("<execv>", OP_VOID
, OP_VOID
, OP_VOID
);
5300 RETVAL (execve (MEMPTR (PARM1
), (char **) MEMPTR (PARM2
), NULL
));
5301 trace_output_16 (result
);
5305 #ifdef TARGET_SYS_pipe
5306 case TARGET_SYS_pipe
:
5311 trace_input ("<pipe>", OP_VOID
, OP_VOID
, OP_VOID
);
5313 RETVAL (pipe (host_fd
));
5314 SW (buf
, host_fd
[0]);
5315 buf
+= sizeof(uint16
);
5316 SW (buf
, host_fd
[1]);
5317 trace_output_16 (result
);
5322 #ifdef TARGET_SYS_wait
5323 case TARGET_SYS_wait
:
5326 trace_input ("<wait>", OP_REG
, OP_VOID
, OP_VOID
);
5327 RETVAL (wait (&status
));
5330 trace_output_16 (result
);
5335 case TARGET_SYS_getpid
:
5336 trace_input ("<getpid>", OP_VOID
, OP_VOID
, OP_VOID
);
5338 trace_output_16 (result
);
5341 case TARGET_SYS_kill
:
5342 trace_input ("<kill>", OP_REG
, OP_REG
, OP_VOID
);
5343 trace_output_void ();
5344 State
.exception
= PARM2
;
5348 case TARGET_SYS_read
:
5349 trace_input ("<read>", OP_REG
, OP_MEMREF
, OP_REG
);
5350 RETVAL (cr16_callback
->read (cr16_callback
, PARM1
,
5351 MEMPTR (((unsigned long)PARM3
<< 16)
5352 |((unsigned long)PARM2
)), PARM4
));
5353 trace_output_16 (result
);
5356 case TARGET_SYS_write
:
5357 trace_input ("<write>", OP_REG
, OP_MEMREF
, OP_REG
);
5358 RETVAL ((int)cr16_callback
->write (cr16_callback
, PARM1
,
5359 MEMPTR (((unsigned long)PARM3
<< 16) | PARM2
), PARM4
));
5360 trace_output_16 (result
);
5363 case TARGET_SYS_lseek
:
5364 trace_input ("<lseek>", OP_REG
, OP_REGP
, OP_REG
);
5365 RETVAL32 (cr16_callback
->lseek (cr16_callback
, PARM1
,
5366 ((((long) PARM3
) << 16) | PARM2
),
5368 trace_output_32 (result
);
5371 case TARGET_SYS_close
:
5372 trace_input ("<close>", OP_REG
, OP_VOID
, OP_VOID
);
5373 RETVAL (cr16_callback
->close (cr16_callback
, PARM1
));
5374 trace_output_16 (result
);
5377 case TARGET_SYS_open
:
5378 trace_input ("<open>", OP_MEMREF
, OP_REG
, OP_VOID
);
5379 RETVAL32 (cr16_callback
->open (cr16_callback
,
5380 MEMPTR ((((unsigned long)PARM2
)<<16)|PARM1
),
5382 trace_output_32 (result
);
5385 #ifdef TARGET_SYS_rename
5386 case TARGET_SYS_rename
:
5387 trace_input ("<rename>", OP_MEMREF
, OP_MEMREF
, OP_VOID
);
5388 RETVAL (cr16_callback
->rename (cr16_callback
,
5389 MEMPTR ((((unsigned long)PARM2
)<<16) |PARM1
),
5390 MEMPTR ((((unsigned long)PARM4
)<<16) |PARM3
)));
5391 trace_output_16 (result
);
5395 case 0x408: /* REVISIT: Added a dummy getenv call. */
5396 trace_input ("<getenv>", OP_MEMREF
, OP_MEMREF
, OP_VOID
);
5398 trace_output_32 (result
);
5401 case TARGET_SYS_exit
:
5402 trace_input ("<exit>", OP_VOID
, OP_VOID
, OP_VOID
);
5403 State
.exception
= SIG_CR16_EXIT
;
5404 trace_output_void ();
5407 case TARGET_SYS_unlink
:
5408 trace_input ("<unlink>", OP_MEMREF
, OP_VOID
, OP_VOID
);
5409 RETVAL (cr16_callback
->unlink (cr16_callback
,
5410 MEMPTR (((unsigned long)PARM2
<<16)|PARM1
)));
5411 trace_output_16 (result
);
5415 #ifdef TARGET_SYS_stat
5416 case TARGET_SYS_stat
:
5417 trace_input ("<stat>", OP_VOID
, OP_VOID
, OP_VOID
);
5418 /* stat system call. */
5420 struct stat host_stat
;
5423 RETVAL (stat (MEMPTR ((((unsigned long)PARM2
) << 16)|PARM1
), &host_stat
));
5427 /* The hard-coded offsets and sizes were determined by using
5428 * the CR16 compiler on a test program that used struct stat.
5430 SW (buf
, host_stat
.st_dev
);
5431 SW (buf
+2, host_stat
.st_ino
);
5432 SW (buf
+4, host_stat
.st_mode
);
5433 SW (buf
+6, host_stat
.st_nlink
);
5434 SW (buf
+8, host_stat
.st_uid
);
5435 SW (buf
+10, host_stat
.st_gid
);
5436 SW (buf
+12, host_stat
.st_rdev
);
5437 SLW (buf
+16, host_stat
.st_size
);
5438 SLW (buf
+20, host_stat
.st_atime
);
5439 SLW (buf
+28, host_stat
.st_mtime
);
5440 SLW (buf
+36, host_stat
.st_ctime
);
5442 trace_output_16 (result
);
5446 #ifdef TARGET_SYS_chown
5447 case TARGET_SYS_chown
:
5448 trace_input ("<chown>", OP_VOID
, OP_VOID
, OP_VOID
);
5449 RETVAL (chown (MEMPTR (PARM1
), PARM2
, PARM3
));
5450 trace_output_16 (result
);
5454 case TARGET_SYS_chmod
:
5455 trace_input ("<chmod>", OP_VOID
, OP_VOID
, OP_VOID
);
5456 RETVAL (chmod (MEMPTR (PARM1
), PARM2
));
5457 trace_output_16 (result
);
5460 #ifdef TARGET_SYS_utime
5461 case TARGET_SYS_utime
:
5462 trace_input ("<utime>", OP_REG
, OP_REG
, OP_REG
);
5463 /* Cast the second argument to void *, to avoid type mismatch
5464 if a prototype is present. */
5465 RETVAL (utime (MEMPTR (PARM1
), (void *) MEMPTR (PARM2
)));
5466 trace_output_16 (result
);
5470 #ifdef TARGET_SYS_time
5471 case TARGET_SYS_time
:
5472 trace_input ("<time>", OP_VOID
, OP_VOID
, OP_REG
);
5473 RETVAL32 (time (NULL
));
5474 trace_output_32 (result
);
5482 case TRAP_BREAKPOINT
:
5483 State
.exception
= SIGTRAP
;
5486 trace_output_void ();
5488 case SIGTRAP
: /* supervisor call ? */
5489 State
.exception
= SIG_CR16_EXIT
;
5490 trace_output_void ();
5493 cr16_callback
->error (cr16_callback
, "Unknown syscall %d", FUNC
);
5497 if ((uint16
) result
== (uint16
) -1)
5498 RETERR (cr16_callback
->get_errno(cr16_callback
));
5511 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5512 uint32 tmp
, sp_addr
= (GPR32 (15)) - (a
* 2) - 4, is_regp
= 0;
5513 trace_input ("push", OP_CONSTANT3
, OP_REG
, OP_REG
);
5519 SW (sp_addr
, (GPR (b
+i
)));
5525 tmp
= (GPR32 (b
+i
));
5527 tmp
= (GPR32 (b
+i
-1));
5546 /* Store RA address. */
5550 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5551 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5553 trace_output_void ();
5560 uint32 sp_addr
, tmp
, is_regp
= 0;
5561 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5562 trace_input ("push", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5565 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5567 sp_addr
= (GPR32 (15)) - (a
* 2);
5573 SW (sp_addr
, (GPR (b
+i
)));
5579 tmp
= (GPR32 (b
+i
));
5581 tmp
= (GPR32 (b
+i
-1));
5600 /* Store RA address. */
5603 sp_addr
= (GPR32 (15)) - (a
* 2) - 4;
5606 sp_addr
= (GPR32 (15)) - (a
* 2);
5608 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5610 trace_output_void ();
5618 uint32 sp_addr
= (GPR32 (15)), tmp
;
5619 trace_input ("push", OP_VOID
, OP_VOID
, OP_VOID
);
5621 SLW(sp_addr
-4,tmp
); /* Store RA address. */
5622 SET_GPR32 (15, (sp_addr
- 4)); /* Update SP address. */
5623 trace_output_void ();
5631 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5632 uint32 tmp
, sp_addr
= (GPR32 (15)), is_regp
= 0;;
5633 trace_input ("pop", OP_CONSTANT3
, OP_REG
, OP_REG
);
5639 SET_GPR ((b
+i
), RW(sp_addr
));
5655 tmp
= (tmp
<< 16) | (GPR32 (b
+i
));
5657 tmp
= (tmp
<< 16) | (GPR32 (b
+i
-1));
5661 SET_GPR32 ((b
+i
), (((tmp
& 0xffff) << 16)
5662 | ((tmp
>> 16) & 0xffff)));
5664 SET_GPR32 ((b
+i
-1), (((tmp
& 0xffff) << 16)
5665 | ((tmp
>> 16) & 0xffff)));
5672 tmp
= RLW(sp_addr
); /* store RA also. */
5673 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5675 SET_GPR32 (15, (sp_addr
+ 4)); /* Update SP address. */
5677 trace_output_void ();
5684 uint16 a
= OP
[0] + 1, b
= OP
[1], c
= OP
[2], i
= 0;
5685 uint32 tmp
, sp_addr
= (GPR32 (15)), is_regp
= 0;
5686 trace_input ("pop", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5692 SET_GPR ((b
+i
), RW(sp_addr
));
5708 tmp
= ((tmp
<< 16) & 0xffffffff) | (GPR32 (b
+i
));
5710 tmp
= ((tmp
<< 16) & 0xffffffff) | (GPR32 (b
+i
-1));
5714 SET_GPR32 ((b
+i
), (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5716 SET_GPR32 ((b
+i
-1), (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5724 tmp
= RLW(sp_addr
); /* Store RA Reg. */
5725 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5729 SET_GPR32 (15, sp_addr
); /* Update SP address. */
5731 trace_output_void ();
5738 uint32 sp_addr
= GPR32 (15);
5740 trace_input ("pop", OP_VOID
, OP_VOID
, OP_VOID
);
5743 SET_GPR32 (14, (((tmp
& 0xffff) << 16)| ((tmp
>> 16) & 0xffff)));
5744 SET_GPR32 (15, (sp_addr
+4)); /* Update SP address. */
5746 trace_output_void ();
5753 uint16 a
= OP
[0], b
= OP
[1];
5754 trace_input ("popret", OP_CONSTANT3
, OP_REG
, OP_REG
);
5756 JMP(((GPR32(14)) << 1) & 0xffffff);
5758 trace_output_void ();
5765 uint16 a
= OP
[0], b
= OP
[1];
5766 trace_input ("popret", OP_CONSTANT3
, OP_REG
, OP_VOID
);
5768 JMP(((GPR32(14)) << 1) & 0xffffff);
5770 trace_output_void ();
5778 trace_input ("popret", OP_VOID
, OP_VOID
, OP_VOID
);
5780 tmp
= (((GPR32(14)) << 1) & 0xffffff);
5781 /* If the resulting PC value is less than 0x00_0000 or greater
5782 than 0xFF_FFFF, this instruction causes an IAD trap.*/
5784 if ((tmp
< 0x0) || (tmp
> 0xFFFFFF))
5786 State
.exception
= SIG_CR16_BUS
;
5787 State
.pc_changed
= 1; /* Don't increment the PC. */
5788 trace_output_void ();
5794 trace_output_32 (tmp
);
5802 trace_input ("cinv[i]", OP_VOID
, OP_VOID
, OP_VOID
);
5804 trace_output_void ();
5811 trace_input ("cinv[i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5813 trace_output_void ();
5820 trace_input ("cinv[d]", OP_VOID
, OP_VOID
, OP_VOID
);
5822 trace_output_void ();
5829 trace_input ("cinv[i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5831 trace_output_void ();
5838 trace_input ("cinv[d,i]", OP_VOID
, OP_VOID
, OP_VOID
);
5840 trace_output_void ();
5847 trace_input ("cinv[d,i,u]", OP_VOID
, OP_VOID
, OP_VOID
);
5849 trace_output_void ();
5856 trace_input ("retx", OP_VOID
, OP_VOID
, OP_VOID
);
5858 trace_output_void ();
5865 trace_input ("di", OP_VOID
, OP_VOID
, OP_VOID
);
5867 trace_output_void ();
5874 trace_input ("ei", OP_VOID
, OP_VOID
, OP_VOID
);
5876 trace_output_void ();
5883 trace_input ("wait", OP_VOID
, OP_VOID
, OP_VOID
);
5884 State
.exception
= SIGTRAP
;
5885 trace_output_void ();
5892 trace_input ("ewait", OP_VOID
, OP_VOID
, OP_VOID
);
5894 trace_output_void ();
5901 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5902 trace_input ("xorb", OP_CONSTANT4
, OP_REG
, OP_VOID
);
5904 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5905 trace_output_16 (tmp
);
5912 uint8 tmp
, a
= (OP
[0]) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5913 trace_input ("xorb", OP_CONSTANT16
, OP_REG
, OP_VOID
);
5915 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5916 trace_output_16 (tmp
);
5923 uint8 tmp
, a
= (GPR (OP
[0])) & 0xff, b
= (GPR (OP
[1])) & 0xff;
5924 trace_input ("xorb", OP_REG
, OP_REG
, OP_VOID
);
5926 SET_GPR (OP
[1], (tmp
| ((GPR (OP
[1])) & 0xff00)));
5927 trace_output_16 (tmp
);
5934 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
5935 trace_input ("xorw", OP_CONSTANT4
, OP_REG
, OP_VOID
);
5937 SET_GPR (OP
[1], tmp
);
5938 trace_output_16 (tmp
);
5945 uint16 tmp
, a
= (OP
[0]), b
= (GPR (OP
[1]));
5946 trace_input ("xorw", OP_CONSTANT16
, OP_REG
, OP_VOID
);
5948 SET_GPR (OP
[1], tmp
);
5949 trace_output_16 (tmp
);
5956 uint16 tmp
, a
= (GPR (OP
[0])), b
= (GPR (OP
[1]));
5957 trace_input ("xorw", OP_REG
, OP_REG
, OP_VOID
);
5959 SET_GPR (OP
[1], tmp
);
5960 trace_output_16 (tmp
);
5963 /*REVISIT FOR LPR/SPR . */
5969 uint16 a
= GPR (OP
[0]);
5970 trace_input ("lpr", OP_REG
, OP_REG
, OP_VOID
);
5971 SET_CREG (OP
[1], a
);
5972 trace_output_16 (a
);
5979 uint32 a
= GPR32 (OP
[0]);
5980 trace_input ("lprd", OP_REGP
, OP_REG
, OP_VOID
);
5981 SET_CREG (OP
[1], a
);
5982 trace_output_flag ();
5989 uint16 a
= CREG (OP
[0]);
5990 trace_input ("spr", OP_REG
, OP_REG
, OP_VOID
);
5992 trace_output_16 (a
);
5999 uint32 a
= CREG (OP
[0]);
6000 trace_input ("sprd", OP_REGP
, OP_REGP
, OP_VOID
);
6001 SET_GPR32 (OP
[1], a
);
6002 trace_output_32 (a
);
6009 trace_input ("null", OP_VOID
, OP_VOID
, OP_VOID
);
6010 State
.exception
= SIG_CR16_STOP
;
This page took 0.186018 seconds and 5 git commands to generate.