]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/erc32/sis.h
This commit was manufactured by cvs2svn to create branch 'csl-
[thirdparty/binutils-gdb.git] / sim / erc32 / sis.h
CommitLineData
c906108c
SS
1/*
2 * This file is part of SIS.
3 *
4 * ERC32SIM, SPARC instruction simulator. Copyright (C) 1995 Jiri Gaisler,
5 * European Space Agency
6 *
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 675
19 * Mass Ave, Cambridge, MA 02139, USA.
20 *
21 */
22
23#include "ansidecl.h"
3c25f8c7
AC
24#include "gdb/callback.h"
25#include "gdb/remote-sim.h"
c906108c
SS
26
27#include "end.h"
28
29#define I_ACC_EXC 1
30
31/* Maximum events in event queue */
32#define EVENT_MAX 256
33
34/* Maximum # of floating point queue */
35#define FPUQN 1
36
37/* Maximum # of breakpoints */
38#define BPT_MAX 256
39
40struct histype {
41 unsigned addr;
42 unsigned time;
43};
44
45/* type definitions */
46
47typedef short int int16; /* 16-bit signed int */
48typedef unsigned short int uint16; /* 16-bit unsigned int */
49typedef int int32; /* 32-bit signed int */
50typedef unsigned int uint32; /* 32-bit unsigned int */
51typedef float float32; /* 32-bit float */
52typedef double float64; /* 64-bit float */
53
54/* FIXME: what about host compilers that don't support 64-bit ints? */
55typedef unsigned long long uint64; /* 64-bit unsigned int */
56typedef long long int64; /* 64-bit signed int */
57
58struct pstate {
59
60 float64 fd[16]; /* FPU registers */
61#ifdef HOST_LITTLE_ENDIAN_FLOAT
62 float32 fs[32];
63 float32 *fdp;
64#else
65 float32 *fs;
66#endif
67 int32 *fsi;
68 uint32 fsr;
69 int32 fpstate;
70 uint32 fpq[FPUQN * 2];
71 uint32 fpqn;
72 uint32 ftime;
73 uint32 flrd;
74 uint32 frd;
75 uint32 frs1;
76 uint32 frs2;
77 uint32 fpu_pres; /* FPU present (0 = No, 1 = Yes) */
78
79 uint32 psr; /* IU registers */
80 uint32 tbr;
81 uint32 wim;
82 uint32 g[8];
83 uint32 r[128];
84 uint32 y;
85 uint32 asr17; /* Single vector trapping */
86 uint32 pc, npc;
87
88
89 uint32 trap; /* Current trap type */
90 uint32 annul; /* Instruction annul */
91 uint32 data; /* Loaded data */
92 uint32 inst; /* Current instruction */
93 uint32 asi; /* Current ASI */
94 uint32 err_mode; /* IU error mode */
95 uint32 breakpoint;
96 uint32 bptnum;
97 uint32 bphit;
98 uint32 bpts[BPT_MAX]; /* Breakpoints */
99
100 uint32 ltime; /* Load interlock time */
101 uint32 hold; /* IU hold cycles in current inst */
102 uint32 fhold; /* FPU hold cycles in current inst */
103 uint32 icnt; /* Instruction cycles in curr inst */
104
105 uint32 histlen; /* Trace history management */
106 uint32 histind;
107 struct histype *histbuf;
108 float32 freq; /* Simulated processor frequency */
109
110
111 uint32 tottime;
112 uint32 ninst;
113 uint32 fholdt;
114 uint32 holdt;
115 uint32 icntt;
116 uint32 finst;
117 uint32 simstart;
118 uint32 starttime;
119 uint32 tlimit; /* Simulation time limit */
120 uint32 pwdtime; /* Cycles in power-down mode */
121 uint32 nstore; /* Number of load instructions */
122 uint32 nload; /* Number of store instructions */
123 uint32 nannul; /* Number of annuled instructions */
124 uint32 nbranch; /* Number of branch instructions */
125 uint32 ildreg; /* Destination of last load instruction */
126 uint32 ildtime; /* Last time point for load dependency */
127
128 int rett_err; /* IU in jmpl/restore error state (Rev.0) */
129 int jmpltime;
130};
131
132struct evcell {
133 void (*cfunc) ();
134 int32 arg;
135 uint32 time;
136 struct evcell *nxt;
137};
138
139struct estate {
140 struct evcell eq;
141 struct evcell *freeq;
142 uint32 simtime;
143};
144
145struct irqcell {
146 void (*callback) ();
147 int32 arg;
148};
149
150
151#define OK 0
152#define TIME_OUT 1
153#define BPT_HIT 2
154#define ERROR 3
155#define CTRL_C 4
156
157/* Prototypes */
158
159/* erc32.c */
160extern void init_sim PARAMS ((void));
161extern void reset PARAMS ((void));
162extern void error_mode PARAMS ((uint32 pc));
163extern void sim_halt PARAMS ((void));
164extern void exit_sim PARAMS ((void));
165extern void init_stdio PARAMS ((void));
166extern void restore_stdio PARAMS ((void));
167extern int memory_read PARAMS ((int32 asi, uint32 addr, uint32 *data,
168 int32 sz, int32 *ws));
169extern int memory_write PARAMS ((int32 asi, uint32 addr, uint32 *data,
170 int32 sz, int32 *ws));
171extern int sis_memory_write PARAMS ((uint32 addr, char *data,
172 uint32 length));
173extern int sis_memory_read PARAMS ((uint32 addr, char *data,
174 uint32 length));
175
176/* func.c */
177extern void set_regi PARAMS ((struct pstate *sregs, int32 reg,
178 uint32 rval));
179extern void get_regi PARAMS ((struct pstate *sregs, int32 reg, char *buf));
180extern int exec_cmd PARAMS ((struct pstate *sregs, char *cmd));
181extern void reset_stat PARAMS ((struct pstate *sregs));
182extern void show_stat PARAMS ((struct pstate *sregs));
183extern void init_bpt PARAMS ((struct pstate *sregs));
184extern void init_signals PARAMS ((void));
185
186struct disassemble_info;
187extern void dis_mem PARAMS ((uint32 addr, uint32 len,
188 struct disassemble_info *info));
189extern void event PARAMS ((void (*cfunc) (), int32 arg, uint32 delta));
190extern void set_int PARAMS ((int32 level, void (*callback) (), int32 arg));
191extern void advance_time PARAMS ((struct pstate *sregs));
192extern uint32 now PARAMS ((void));
193extern int wait_for_irq PARAMS ((void));
194extern int check_bpt PARAMS ((struct pstate *sregs));
195extern void reset_all PARAMS ((void));
196extern void sys_reset PARAMS ((void));
197extern void sys_halt PARAMS ((void));
198extern int bfd_load PARAMS ((char *fname));
199
200/* exec.c */
201extern int dispatch_instruction PARAMS ((struct pstate *sregs));
202extern int execute_trap PARAMS ((struct pstate *sregs));
203extern int check_interrupts PARAMS ((struct pstate *sregs));
204extern void init_regs PARAMS ((struct pstate *sregs));
205
206/* interf.c */
207extern int run_sim PARAMS ((struct pstate *sregs,
208 unsigned int icount, int dis));
209
210/* float.c */
211extern int get_accex PARAMS ((void));
212extern void clear_accex PARAMS ((void));
213extern void set_fsr PARAMS ((uint32 fsr));
214
215/* help.c */
216extern void usage PARAMS ((void));
217extern void gen_help PARAMS ((void));