~ubuntu-branches/ubuntu/jaunty/spim/jaunty

« back to all changes in this revision

Viewing changes to reg.h

  • Committer: Bazaar Package Importer
  • Author(s): Fernando Sanchez
  • Date: 2001-01-24 14:05:34 UTC
  • Revision ID: james.westby@ubuntu.com-20010124140534-3le9wmofforjjcd8
Tags: upstream-6.3
ImportĀ upstreamĀ versionĀ 6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* SPIM S20 MIPS simulator.
 
2
   Declarations of registers and code for accessing them.
 
3
 
 
4
   Copyright (C) 1990-2000 by James Larus (larus@cs.wisc.edu).
 
5
   ALL RIGHTS RESERVED.
 
6
 
 
7
   SPIM is distributed under the following conditions:
 
8
 
 
9
     You may make copies of SPIM for your own use and modify those copies.
 
10
 
 
11
     All copies of SPIM must retain my name and copyright notice.
 
12
 
 
13
     You may not sell SPIM or distributed SPIM in conjunction with a
 
14
     commerical product or service without the expressed written consent of
 
15
     James Larus.
 
16
 
 
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
 
20
   PURPOSE. */
 
21
 
 
22
 
 
23
/* $Header: /Software/SPIM/src/reg.h 4     12/24/00 1:37p Larus $
 
24
*/
 
25
 
 
26
 
 
27
typedef int32 reg_word;
 
28
typedef uint32 u_reg_word;
 
29
 
 
30
 
 
31
/* General purpose registers: */
 
32
 
 
33
extern reg_word R[32];
 
34
 
 
35
extern reg_word HI, LO;
 
36
 
 
37
extern mem_addr PC, nPC;
 
38
 
 
39
 
 
40
/* Argument passing registers */
 
41
 
 
42
#define REG_V0 2
 
43
#define REG_A0 4
 
44
#define REG_A1 5
 
45
#define REG_A2 6
 
46
#define REG_A3 7
 
47
#define REG_FA0 12
 
48
#define REG_SP 29
 
49
 
 
50
 
 
51
/* Result registers */
 
52
 
 
53
#define REG_RES 2
 
54
#define REG_FRES 0
 
55
 
 
56
 
 
57
/* $gp registers */
 
58
 
 
59
#define REG_GP 28
 
60
 
 
61
 
 
62
 
 
63
/* Floating Point Coprocessor (1) registers :*/
 
64
 
 
65
extern double *FPR;             /* Dynamically allocate so overlay */
 
66
extern float *FGR;              /* is possible */
 
67
extern int *FWR;                /* is possible */
 
68
 
 
69
 
 
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 */
 
73
 
 
74
 
 
75
#define FPR_S(REGNO) (FGR[REGNO])
 
76
 
 
77
#define FPR_D(REGNO) (double) (((REGNO) & 0x1) \
 
78
                               ? (run_error ("Bit 0 in FP double reg\n") ? 0.0 : 0.0)\
 
79
                               : FPR[(REGNO) >> 1])
 
80
 
 
81
#define FPR_W(REGNO) (FWR[REGNO])
 
82
 
 
83
 
 
84
#define SET_FPR_S(REGNO, VALUE) {FGR[REGNO] = (float) (VALUE);}
 
85
 
 
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);}
 
89
 
 
90
#define SET_FPR_W(REGNO, VALUE) {FWR[REGNO] = (int) (VALUE);}
 
91
 
 
92
 
 
93
/* Floating point control and condition registers: */
 
94
 
 
95
#define FCR             CPR[1]
 
96
#define FPId            (CPR[1][0])
 
97
#define FpCond          (CPR[1][31])
 
98
 
 
99
 
 
100
 
 
101
/* Other Coprocessor Registers.  The floating point registers
 
102
   (coprocessor 1) are above.  */
 
103
 
 
104
extern reg_word CpCond[4], CCR[4][32], CPR[4][32];
 
105
 
 
106
 
 
107
/* Exeception Handling Registers (actually registers in Coprocoessor
 
108
   0's register file) */
 
109
 
 
110
extern int exception_occurred;
 
111
 
 
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])
 
122
 
 
123
 
 
124
#define USER_MODE (Status_Reg & 0x2)
 
125
#define INTERRUPTS_ON (Status_Reg & 0x1)