Update copyright year range in all GDB files
[binutils-gdb.git] / sim / rl78 / cpu.h
blob4629e0b69b05829699e0031bbb881dca1e19a41f
1 /* cpu.h --- declarations for the RL78 core.
3 Copyright (C) 2005-2021 Free Software Foundation, Inc.
4 Contributed by Red Hat, Inc.
6 This file is part of the GNU simulators.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef SIM_RL78_CPU_H_
23 #define SIM_RL78_CPU_H_
25 #include <stdint.h>
26 #include <setjmp.h>
28 #include "opcode/rl78.h"
30 extern int verbose;
31 extern int trace;
33 typedef uint8_t QI;
34 typedef uint16_t HI;
35 typedef uint32_t SI;
37 extern int rl78_in_gdb;
39 SI get_reg (RL78_Register);
40 SI set_reg (RL78_Register, SI);
42 SI pc;
45 extern const char * const reg_names[];
47 void init_cpu (void);
48 void set_flags (int mask, int newbits);
49 void set_c (int);
50 int get_c (void);
52 const char *bits (int v, int b);
54 int condition_true (RL78_Condition cond_id, int val);
56 /* Instruction step return codes.
57 Suppose one of the decode_* functions below returns a value R:
58 - If RL78_STEPPED (R), then the single-step completed normally.
59 - If RL78_HIT_BREAK (R), then the program hit a breakpoint.
60 - If RL78_EXITED (R), then the program has done an 'exit' system
61 call, and the exit code is RL78_EXIT_STATUS (R).
62 - If RL78_STOPPED (R), then a signal (number RL78_STOP_SIG (R)) was
63 generated.
65 For building step return codes:
66 - RL78_MAKE_STEPPED is the return code for finishing a normal step.
67 - RL78_MAKE_HIT_BREAK is the return code for hitting a breakpoint.
68 - RL78_MAKE_EXITED (C) is the return code for exiting with status C.
69 - RL78_MAKE_STOPPED (S) is the return code for stopping on signal S. */
70 #define RL78_MAKE_STEPPED() (1)
71 #define RL78_MAKE_HIT_BREAK() (2)
72 #define RL78_MAKE_EXITED(c) (((int) (c) << 8) + 3)
73 #define RL78_MAKE_STOPPED(s) (((int) (s) << 8) + 4)
75 #define RL78_STEPPED(r) ((r) == RL78_MAKE_STEPPED ())
76 #define RL78_HIT_BREAK(r) ((r) == RL78_MAKE_HIT_BREAK ())
77 #define RL78_EXITED(r) (((r) & 0xff) == 3)
78 #define RL78_EXIT_STATUS(r) ((r) >> 8)
79 #define RL78_STOPPED(r) (((r) & 0xff) == 4)
80 #define RL78_STOP_SIG(r) ((r) >> 8)
82 /* The step result for the current step. Global to allow
83 communication between the stepping function and the system
84 calls. */
85 extern int step_result;
87 extern int decode_opcode (void);
89 extern int trace_register_words;
90 extern void trace_register_changes (void);
91 extern void generate_access_exception (void);
92 extern jmp_buf decode_jmp_buf;
94 extern long long total_clocks;
95 extern int pending_clocks;
96 extern int timer_enabled;
97 extern void dump_counts_per_insn (const char * filename);
98 extern unsigned int counts_per_insn[0x100000];
100 extern int rl78_g10_mode;
101 extern int g13_multiply;
102 extern int g14_multiply;
104 #endif