xref: /netbsd-src/external/gpl3/gdb/dist/sim/lm32/sim-main.h (revision 71f621822dbfd5073a314948bec169b7bb05f7be)
1 /* Lattice Mico32 simulator support code
2    Contributed by Jon Beniston <jon@beniston.com>
3 
4    Copyright (C) 2009-2024 Free Software Foundation, Inc.
5 
6    This file is part of GDB.
7 
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.
12 
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.
17 
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/>.  */
20 
21 /* Main header for the LM32 simulator.  */
22 
23 #ifndef SIM_MAIN_H
24 #define SIM_MAIN_H
25 
26 #define WITH_SCACHE_PBB 1
27 
28 #include "sim-basics.h"
29 #include "opcodes/lm32-desc.h"
30 #include "opcodes/lm32-opc.h"
31 #include "arch.h"
32 #include "sim-base.h"
33 #include "cgen-sim.h"
34 #include "lm32-sim.h"
35 
36 struct lm32_sim_cpu
37 {
38   /* CPU specific parts go here.
39      Note that in files that don't need to access these pieces WANT_CPU_FOO
40      won't be defined and thus these parts won't appear.  This is ok in the
41      sense that things work.  It is a source of bugs though.
42      One has to of course be careful to not take the size of this
43      struct and no structure members accessed in non-cpu specific files can
44      go after here.  Oh for a better language.  */
45 #if defined (WANT_CPU_LM32BF)
46   LM32BF_CPU_DATA cpu_data;
47 #endif
48 };
49 #define LM32_SIM_CPU(cpu) ((struct lm32_sim_cpu *) CPU_ARCH_DATA (cpu))
50 
51 /* Misc.  */
52 
53 /* Catch address exceptions.  */
54 extern SIM_CORE_SIGNAL_FN lm32_core_signal ATTRIBUTE_NORETURN;
55 #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \
56 lm32_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \
57 		  (TRANSFER), (ERROR))
58 
59 /* From traps.c.  */
60 extern USI lm32bf_b_insn (SIM_CPU * current_cpu, USI r0, USI f_r0);
61 extern USI lm32bf_divu_insn (SIM_CPU * current_cpu, IADDR pc, USI r0, USI r1, USI r2);
62 extern USI lm32bf_modu_insn (SIM_CPU * current_cpu, IADDR pc, USI r0, USI r1, USI r2);
63 extern void lm32bf_wcsr_insn (SIM_CPU * current_cpu, USI f_csr, USI r1);
64 extern USI lm32bf_break_insn (SIM_CPU * current_cpu, IADDR pc);
65 extern USI lm32bf_scall_insn (SIM_CPU * current_cpu, IADDR pc);
66 
67 /* From user.c.  */
68 extern UINT lm32bf_user_insn (SIM_CPU * current_cpu, INT r0, INT r1, UINT imm);
69 
70 #endif /* SIM_MAIN_H */
71