delta.h
5.06 KB
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
/*
* Copyright (C) 1998 by the Board of Trustees
* of Leland Stanford Junior University.
* Copyright (C) 1998 Digital Equipment Corporation
*
* This file is part of the SimOS distribution.
* See LICENSE file for terms of the license.
*
*/
#ifndef DELTA_H
#define DELTA_H
#define REGISTER(_x) (_x)
/* ***************************************************
* REGISTER MAP:
*
*
* 0 REG_V0=0,
* 1 REG_T0, :: DELTAREG_CONSTANTS
* 2 REG_T1, :: DELTAREG_IQC
* 3 REG_T2, :: DELTAREG_DQC
* 4 REG_T3, :: DELTAREG_CALLOUT_PC
* 5 REG_T4, :: DELTAREG_CALLOUT_CCD (countdown)
* 6 REG_T5,
* 7 REG_T6
* 8 REG_T7, :: translator.c temp
* 9 REG_S0, :: DELTAREG_BASE
* 10 REG_S1, :: DELTAREG_PC
* 11 REG_S2, :: DELTAREG_COUNTDOWN
* 12 REG_S3, :: shadow
* 13 REG_S4, :: shadow
* 14 REG_S5, :: shadow
* 15 REG_S6, :: shadow
* 16 REG_A0, :: Arguments(!)
* 17 REG_A1, :: Arguments(!)
* 18 REG_A2, :: qcLookup temp
* 19 REG_A3, :: qcLookup temp
* 20 REG_A4, :: qcLookup temp
* 21 REG_A5, :: qcLookup temp
* 22 REG_T8, :: translator.c temp
* 23 REG_T9, :: translator.c temp
* 24 REG_T10, :: translator.c temp
* 25 REG_T11, :: translator.c temp
* 26 REG_RA, :: return address
* 27 REG_PV, :: pointer value
* 28 REG_AT, :: qcLookup temp
* 29 REG_GP :: set on callouts as a function of t12
* 30 REG_SP :: set on EnterTC (Continuation)
* 31 REG_ZERO
*
* Comments: we could limit the translator temp register if we
* outline the LL/SC stuff. Other than these instructions
* 3/4 temp registers should suffice.
* ***************************************************/
#define DELTAREG_BASE REGISTER(REG_S0)
#define DELTAREG_PC REGISTER(REG_S1)
#define DELTAREG_COUNTDOWN REGISTER(REG_S2)
#define DELTAREG_PREV_PC REGISTER(REG_A1)
#define DELTAREG_CONSTANTS REGISTER(REG_T0)
#define DELTAREG_CURIQC REGISTER(REG_T1)
#define DELTAREG_CURDQC REGISTER(REG_T2)
#define DELTAREG_CALLOUT_PC REGISTER(REG_T3)
#define DELTAREG_CALLOUT_CCD REGISTER(REG_T4)
#define NUM_SHADOW_REGS 5 /* # of non-REG_ZERO registers + 1 */
#define DELTA_SHADOW_REGS {REG_ZERO,REG_S3,REG_S4, REG_S5, REG_S6, REG_ZERO}
#define MAX_CONSTANTS (32*1024 / 8)
#define MAX_CALLOUTS 32
#define CALLOUT_CALLPAL 0 /* machine-specific */
#define CALLOUT_ITB 1
#define CALLOUT_DTB_LOAD 2
#define CALLOUT_DTB_STORE 3
#define CALLOUT_MISC 4
#define CALLOUT_FEN 5
#define CALLOUT_CTXT 10 /* simualtor-specific */
#define CALLOUT_CHAIN 11
#define CALLOUT_CHAIN_SPEC 12
#define CALLOUT_CHAIN_CTXT 13
#define CALLOUT_NEVER 14
#define CALLOUT_POSTPC_ANN 15
#define CALLOUT_PREPC_ANN 16
#define CALLOUT_INITSP 20 /* emmitted assembly stuff */
#define CALLOUT_ENTERTC 21
#define CALLOUT_QCLOOKUP_READ 22
#define CALLOUT_QCLOOKUP_WRITE 23
typedef enum DeltaFlushCause {
DELTAFLUSH_INIT,
DELTAFLUSH_COHERENCE,
DELTAFLUSH_TC,
DELTAFLUSH_CONSTANTS,
DELTAFLUSH_DMAINVAL,
DELTAFLUSH_PUTMEM,
NUM_DELTAFLUSH_CAUSES} DeltaFlushCause;
extern void CalloutCallPal(union alpha_instruction instr);
extern void CalloutITB();
extern MA CalloutDTBLoad(VA vAddr);
extern MA CalloutDTBStore(VA vAddr);
extern void CalloutCTXT(void);
extern TCA CalloutChain(TCA, VA );
extern void CalloutPostPCAnn(void);
extern void CalloutPrePCAnn(void);
extern void DeltaInitConstants(void);
extern int DeltaAllocateConstant(void *);
extern int DeltaRemainingConstants(void);
extern void DeltaClearTranslationCache(int cache, DeltaFlushCause cause);
void DeltaFPInit();
extern void DeltaRun(void); /* main loop */
extern void DeltaAsmEnterTC(AlphaState *P, TCA entryPoint, void *sp, void *constants );
extern void **constantsPtr;
extern void **emittedFunctions;
extern struct DeltaState {
int timeQuantum;
int sideEffectMem;
int sideEffectPC;
void *stackPtr; /* to set while running in TC */
/* Assembly functions */
void (*EnterTC)();
MA (*QCLookupRead)();
MA (*QCLookupWrite)();
/*
* options and run-time checks
*/
int useIQC;
int useDQC;
int chainKnownBranches;
int chainBranches;
int chainSpec;
int inlineIQC;
int inlineDQC;
int registerAllocate;
int mergeBranches;
int saveRegOpt;
int bypassICheck;
SimTime debugCycle;
uint64 *smashAddr;
struct DeltaStats {
int coherenceFlushes;
} stats;
} delta;
extern union alpha_instruction illegalInstr;
#endif