summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/i860/i860.h
blob: f9149a6d99eaf5de8a5f7a7aa1d4ae4a9e956b84 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/***************************************************************************

    i860.h

    Interface file for the Intel i860 emulator.

    Copyright (C) 1995-present Jason Eckhardt (jle@rice.edu)
    Released for general non-commercial use under the MAME license
    with the additional requirement that you are free to use and
    redistribute this code in modified or unmodified form, provided
    you list me in the credits.
    Visit http://mamedev.org for licensing and usage restrictions.

***************************************************************************/

#pragma once

#ifndef __I860_H__
#define __I860_H__


/***************************************************************************
    REGISTER ENUMERATION
***************************************************************************/

enum
{
	I860_PC = 1,

	I860_FIR,
	I860_PSR,
	I860_DIRBASE,
	I860_DB,
	I860_FSR,
	I860_EPSR,

	I860_R0,  I860_R1,  I860_R2,  I860_R3,  I860_R4,  I860_R5,  I860_R6,  I860_R7,	I860_R8,  I860_R9,
	I860_R10, I860_R11,	I860_R12, I860_R13, I860_R14, I860_R15, I860_R16, I860_R17,	I860_R18, I860_R19,
	I860_R20, I860_R21, I860_R22, I860_R23,	I860_R24, I860_R25,	I860_R26, I860_R27,	I860_R28, I860_R29,
	I860_R30, I860_R31,

	I860_F0,  I860_F1,  I860_F2,  I860_F3,  I860_F4,  I860_F5,  I860_F6,  I860_F7,	I860_F8,  I860_F9,
	I860_F10, I860_F11,	I860_F12, I860_F13, I860_F14, I860_F15, I860_F16, I860_F17,	I860_F18, I860_F19,
	I860_F20, I860_F21, I860_F22, I860_F23,	I860_F24, I860_F25,	I860_F26, I860_F27,	I860_F28, I860_F29,
	I860_F30, I860_F31,

};

/* Needed for MAME */
CPU_GET_INFO( i860 );
#define CPU_I860 CPU_GET_INFO_NAME( i860 )


/***************************************************************************
    STRUCTURES & TYPEDEFS
***************************************************************************/

/* i860 state.  */
typedef struct {
	/* Integer registers (32 x 32-bits).  */
	UINT32 iregs[32];

	/* Floating point registers (32 x 32-bits, 16 x 64 bits, or 8 x 128 bits).
       When referenced as pairs or quads, the higher numbered registers
       are the upper bits. E.g., double precision f0 is f1:f0.  */
	UINT8 frg[32 * 4];

	/* Control registers (6 x 32-bits).  */
	UINT32 cregs[6];

	/* Program counter (1 x 32-bits).  Reset starts at pc=0xffffff00.  */
	UINT32 pc;

	/* Special registers (4 x 64-bits).  */
	union
	{
		float s;
		double d;
	} KR, KI, T;
	UINT64 merge;

	/* The adder pipeline, always 3 stages.  */
	struct
	{
		/* The stage contents.  */
		union {
			float s;
			double d;
		} val;

		/* The stage status bits.  */
		struct {
			/* Adder result precision (1 = dbl, 0 = sgl).  */
			char arp;
		} stat;
	} A[3];

	/* The multiplier pipeline. 3 stages for single precision, 2 stages
       for double precision, and confusing for mixed precision.  */
	struct {
		/* The stage contents.  */
		union {
			float s;
			double d;
		} val;

		/* The stage status bits.  */
		struct {
			/* Multiplier result precision (1 = dbl, 0 = sgl).  */
			char mrp;
		} stat;
	} M[3];

	/* The load pipeline, always 3 stages.  */
	struct {
		/* The stage contents.  */
		union {
			float s;
			double d;
		} val;

		/* The stage status bits.  */
		struct {
			/* Load result precision (1 = dbl, 0 = sgl).  */
			char lrp;
		} stat;
	} L[3];

	/* The graphics/integer pipeline, always 1 stage.  */
	struct {
		/* The stage contents.  */
		union {
			float s;
			double d;
		} val;

		/* The stage status bits.  */
		struct {
			/* Integer/graphics result precision (1 = dbl, 0 = sgl).  */
			char irp;
		} stat;
	} G;

	/* Pins.  */
	int pin_bus_hold;
	int pin_reset;

	/*
     * Other emulator state.
     */
	int exiting_readmem;
	int exiting_ifetch;

	/* Indicate a control-flow instruction, so we know the PC is updated.  */
	int pc_updated;

	/* Indicate an instruction just generated a trap, so we know the PC
       needs to go to the trap address.  */
	int pending_trap;

	/* This is 1 if the next fir load gets the trap address, otherwise
       it is 0 to get the ld.c address.  This is set to 1 only when a
       non-reset trap occurs.  */
	int fir_gets_trap_addr;

	/* Single stepping flag for internal use.  */
	int single_stepping;

	/*
     * MAME-specific stuff.
     */
	running_device *device;
	const address_space *program;
	UINT32 ppc;
	int icount;

} i860_state_t;

INLINE i860_state_t *get_safe_token(running_device *device)
{
	assert(device != NULL);
	assert(device->type() == CPU);
	assert(cpu_get_type(device) == CPU_I860);
	return (i860_state_t *)downcast<cpu_device *>(device)->token();
}


/***************************************************************************
    PUBLIC FUNCTIONS
***************************************************************************/

/* This is the external interface for asserting an external interrupt
   to the i860.  */
extern void i860_gen_interrupt(i860_state_t*);

/* This is the external interface for asserting/deasserting a pin on
   the i860.  */
extern void i860_set_pin(running_device *, int, int);

/* Hard or soft reset.  */
extern void reset_i860(i860_state_t*);

/* i860 pins.  */
enum {
	DEC_PIN_BUS_HOLD,		/* Bus HOLD pin.      */
	DEC_PIN_RESET			/* System reset pin.  */
};


/*  TODO: THESE WILL BE REPLACED BY MAME FUNCTIONS
#define BYTE_REV32(t)   \
  do { \
    (t) = ((UINT32)(t) >> 16) | ((UINT32)(t) << 16); \
    (t) = (((UINT32)(t) >> 8) & 0x00ff00ff) | (((UINT32)(t) << 8) & 0xff00ff00); \
  } while (0);

#define BYTE_REV16(t)   \
  do { \
    (t) = (((UINT16)(t) >> 8) & 0x00ff) | (((UINT16)(t) << 8) & 0xff00); \
  } while (0);
#endif
*/

#endif /* __I860_H__ */