home *** CD-ROM | disk | FTP | other *** search
- /* SPIM S20 MIPS simulator.
- Declarations of registers and code for accessing them.
- Copyright (C) 1990 by James Larus (larus@cs.wisc.edu).
-
- SPIM is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 1, or (at your option) any
- later version.
-
- SPIM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU CC; see the file COPYING. If not, write to James R.
- Larus, Computer Sciences Department, University of Wisconsin--Madison,
- 1210 West Dayton Street, Madison, WI 53706, USA or to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
- /* $Header: /var/home/cs354/.spim/RCS/reg.h,v 1.1 1992/10/06 17:34:50 cs354 Exp $
- */
-
- #ifdef REG_MAIN
- #define EXTERN
- #else
- #define EXTERN extern
- #endif
-
- typedef int reg_word;
-
-
- /* General purpose registers: */
-
- EXTERN reg_word R[32];
-
- EXTERN reg_word HI, LO;
-
- EXTERN mem_addr PC;
-
-
-
- /* Floating Point Coprocessor (1) registers :*/
-
- EXTERN double *FPR; /* Dynamically allocate so overlay */
- EXTERN float *FGR; /* is possible */
- EXTERN int *FWR; /* is possible */
-
- #define FPR_S(REGNO) (((REGNO) & 0x1) \
- ? (run_error ("Bit 0 in FP reg spec\n") ? 0.0 : 0.0)\
- : FGR[REGNO])
-
- #define FPR_D(REGNO) (double) (((REGNO) & 0x1) \
- ? (run_error ("Bit 0 in FP reg spec\n") ? 0.0 : 0.0)\
- : FPR[(REGNO) >> 1])
-
- #define FPR_W(REGNO) (((REGNO) & 0x1) \
- ? (run_error ("Bit 0 in FP reg spec\n") ? 0 : 0)\
- : FWR[REGNO])
-
-
- #define SET_FPR_S(REGNO, VALUE) {if ((REGNO) & 0x1) \
- run_error ("Bit 0 in FP reg spec\n");\
- else FGR[REGNO] = (double) (VALUE);}
-
- #define SET_FPR_D(REGNO, VALUE) {if ((REGNO) & 0x1) \
- run_error ("Bit 0 in FP reg spec\n");\
- else FPR[(REGNO) >> 1] = (double) (VALUE);}
-
- #define SET_FPR_W(REGNO, VALUE) {if ((REGNO) & 0x1) \
- run_error ("Bit 0 in FP reg spec\n");\
- else FWR[REGNO] = (int) (VALUE);}
-
- /* Other Coprocessor Registers The floating point registers
- (coprocessor 1) are allocated elsewhere. */
-
- EXTERN reg_word CpCond[4], CCR[4][32], CPR[4][32];
-
-
- /* Exeception Handling Registers (actually registers in Coprocoessor
- 0's register file) */
-
- EXTERN int exception_occurred;
-
- #define Context (CPR[0][4])
- #define BadVAddr (CPR[0][8])
- #define Status_Reg (CPR[0][12])
- #define Cause (CPR[0][13])
- #define EPC (CPR[0][14])
- #define PRId (CPR[0][15])
-
-
- /* Floating point control and condition registers: */
-
- #define FCR CPR[1]
- #define FPId (CPR[1][0])
- #define FpCond (CPR[1][31])
-
- #undef EXTERN
-