1
/* SPIM S20 MIPS simulator.
2
Declarations of registers and code for accessing them.
4
Copyright (C) 1990-2000 by James Larus (larus@cs.wisc.edu).
7
SPIM is distributed under the following conditions:
9
You may make copies of SPIM for your own use and modify those copies.
11
All copies of SPIM must retain my name and copyright notice.
13
You may not sell SPIM or distributed SPIM in conjunction with a
14
commerical product or service without the expressed written consent of
17
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
18
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
/* $Header: /Software/SPIM/src/reg.h 4 12/24/00 1:37p Larus $
27
typedef int32 reg_word;
28
typedef uint32 u_reg_word;
31
/* General purpose registers: */
33
extern reg_word R[32];
35
extern reg_word HI, LO;
37
extern mem_addr PC, nPC;
40
/* Argument passing registers */
51
/* Result registers */
63
/* Floating Point Coprocessor (1) registers :*/
65
extern double *FPR; /* Dynamically allocate so overlay */
66
extern float *FGR; /* is possible */
67
extern int *FWR; /* is possible */
70
extern int FP_reg_present; /* Presence bits for FP registers */
71
extern int FP_reg_poison; /* Poison bits for FP registers */
72
extern int FP_spec_load; /* Is register waiting for a speculative load */
75
#define FPR_S(REGNO) (FGR[REGNO])
77
#define FPR_D(REGNO) (double) (((REGNO) & 0x1) \
78
? (run_error ("Bit 0 in FP double reg\n") ? 0.0 : 0.0)\
81
#define FPR_W(REGNO) (FWR[REGNO])
84
#define SET_FPR_S(REGNO, VALUE) {FGR[REGNO] = (float) (VALUE);}
86
#define SET_FPR_D(REGNO, VALUE) {if ((REGNO) & 0x1) \
87
run_error ("Bit 0 in FP double reg\n");\
88
else FPR[(REGNO) >> 1] = (double) (VALUE);}
90
#define SET_FPR_W(REGNO, VALUE) {FWR[REGNO] = (int) (VALUE);}
93
/* Floating point control and condition registers: */
96
#define FPId (CPR[1][0])
97
#define FpCond (CPR[1][31])
101
/* Other Coprocessor Registers. The floating point registers
102
(coprocessor 1) are above. */
104
extern reg_word CpCond[4], CCR[4][32], CPR[4][32];
107
/* Exeception Handling Registers (actually registers in Coprocoessor
108
0's register file) */
110
extern int exception_occurred;
112
#define EntryHI (CPR[0][0])
113
#define EntryLO (CPR[0][1])
114
#define Index (CPR[0][2])
115
#define Random (CPR[0][3])
116
#define Context (CPR[0][4])
117
#define BadVAddr (CPR[0][8])
118
#define Status_Reg (CPR[0][12])
119
#define Cause (CPR[0][13])
120
#define EPC (CPR[0][14])
121
#define PRId (CPR[0][15])
124
#define USER_MODE (Status_Reg & 0x2)
125
#define INTERRUPTS_ON (Status_Reg & 0x1)