forked from ChampSim/ChampSim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstruction.h
220 lines (177 loc) · 6.32 KB
/
instruction.h
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
#ifndef INSTRUCTION_H
#define INSTRUCTION_H
// instruction format
#define ROB_SIZE 256
#define LQ_SIZE 72
#define SQ_SIZE 56
#define NUM_INSTR_DESTINATIONS_SPARC 4
#define NUM_INSTR_DESTINATIONS 2
#define NUM_INSTR_SOURCES 4
#include "set.h"
class input_instr {
public:
// instruction pointer or PC (Program Counter)
uint64_t ip;
// branch info
uint8_t is_branch;
uint8_t branch_taken;
uint8_t destination_registers[NUM_INSTR_DESTINATIONS]; // output registers
uint8_t source_registers[NUM_INSTR_SOURCES]; // input registers
uint64_t destination_memory[NUM_INSTR_DESTINATIONS]; // output memory
uint64_t source_memory[NUM_INSTR_SOURCES]; // input memory
input_instr() {
ip = 0;
is_branch = 0;
branch_taken = 0;
for (uint32_t i=0; i<NUM_INSTR_SOURCES; i++) {
source_registers[i] = 0;
source_memory[i] = 0;
}
for (uint32_t i=0; i<NUM_INSTR_DESTINATIONS; i++) {
destination_registers[i] = 0;
destination_memory[i] = 0;
}
};
};
class cloudsuite_instr {
public:
// instruction pointer or PC (Program Counter)
uint64_t ip;
// branch info
uint8_t is_branch;
uint8_t branch_taken;
uint8_t destination_registers[NUM_INSTR_DESTINATIONS_SPARC]; // output registers
uint8_t source_registers[NUM_INSTR_SOURCES]; // input registers
uint64_t destination_memory[NUM_INSTR_DESTINATIONS_SPARC]; // output memory
uint64_t source_memory[NUM_INSTR_SOURCES]; // input memory
uint8_t asid[2];
cloudsuite_instr() {
ip = 0;
is_branch = 0;
branch_taken = 0;
for (uint32_t i=0; i<NUM_INSTR_SOURCES; i++) {
source_registers[i] = 0;
source_memory[i] = 0;
}
for (uint32_t i=0; i<NUM_INSTR_DESTINATIONS_SPARC; i++) {
destination_registers[i] = 0;
destination_memory[i] = 0;
}
asid[0] = UINT8_MAX;
asid[1] = UINT8_MAX;
};
};
class ooo_model_instr {
public:
uint64_t instr_id,
ip,
fetch_producer,
producer_id,
translated_cycle,
fetched_cycle,
execute_begin_cycle,
retired_cycle,
event_cycle;
uint8_t is_branch,
is_memory,
branch_taken,
branch_mispredicted,
translated,
data_translated,
source_added[NUM_INSTR_SOURCES],
destination_added[NUM_INSTR_DESTINATIONS_SPARC],
is_producer,
is_consumer,
reg_RAW_producer,
reg_ready,
mem_ready,
asid[2],
reg_RAW_checked[NUM_INSTR_SOURCES];
uint32_t fetched, scheduled;
int num_reg_ops, num_mem_ops, num_reg_dependent;
// executed bit is set after all dependencies are eliminated and this instr is chosen on a cycle, according to EXEC_WIDTH
int executed;
uint8_t destination_registers[NUM_INSTR_DESTINATIONS_SPARC]; // output registers
uint8_t source_registers[NUM_INSTR_SOURCES]; // input registers
// these are instruction ids of other instructions in the window
//int64_t registers_instrs_i_depend_on[NUM_INSTR_SOURCES];
// these are indices of instructions in the window that depend on me
//uint8_t registers_instrs_depend_on_me[ROB_SIZE], registers_index_depend_on_me[ROB_SIZE][NUM_INSTR_SOURCES];
myset
registers_instrs_depend_on_me, registers_index_depend_on_me[NUM_INSTR_SOURCES];
// memory addresses that may cause dependencies between instructions
uint64_t instruction_pa, data_pa, virtual_address, physical_address;
uint64_t destination_memory[NUM_INSTR_DESTINATIONS_SPARC]; // output memory
uint64_t source_memory[NUM_INSTR_SOURCES]; // input memory
//int source_memory_outstanding[NUM_INSTR_SOURCES]; // a value of 2 here means the load hasn't been issued yet, 1 means it has been issued, but not returned yet, and 0 means it has returned
// keep around a record of what the original virtual addresses were
uint64_t destination_virtual_address[NUM_INSTR_DESTINATIONS_SPARC];
uint64_t source_virtual_address[NUM_INSTR_SOURCES];
// these are instruction ids of other instructions in the window
//uint32_t memory_instrs_i_depend_on[NUM_INSTR_SOURCES];
// these are indices of instructions in the ROB that depend on me
//uint8_t memory_instrs_depend_on_me[ROB_SIZE];
myset memory_instrs_depend_on_me;
uint32_t lq_index[NUM_INSTR_SOURCES],
sq_index[NUM_INSTR_DESTINATIONS_SPARC],
forwarding_index[NUM_INSTR_DESTINATIONS_SPARC];
ooo_model_instr() {
instr_id = 0;
ip = 0;
fetch_producer = 0;
producer_id = 0;
translated_cycle = 0;
fetched_cycle = 0;
execute_begin_cycle = 0;
retired_cycle = 0;
event_cycle = 0;
is_branch = 0;
is_memory = 0;
branch_taken = 0;
branch_mispredicted = 0;
translated = 0;
data_translated = 0;
is_producer = 0;
is_consumer = 0;
reg_RAW_producer = 0;
fetched = 0;
scheduled = 0;
executed = 0;
reg_ready = 0;
mem_ready = 0;
asid[0] = UINT8_MAX;
asid[1] = UINT8_MAX;
instruction_pa = 0;
data_pa = 0;
virtual_address = 0;
physical_address = 0;
num_reg_ops = 0;
num_mem_ops = 0;
num_reg_dependent = 0;
for (uint32_t i=0; i<NUM_INSTR_SOURCES; i++) {
source_registers[i] = 0;
source_memory[i] = 0;
source_virtual_address[i] = 0;
source_added[i] = 0;
lq_index[i] = UINT32_MAX;
reg_RAW_checked[i] = 0;
}
for (uint32_t i=0; i<NUM_INSTR_DESTINATIONS_SPARC; i++) {
destination_memory[i] = 0;
destination_registers[i] = 0;
destination_virtual_address[i] = 0;
destination_added[i] = 0;
sq_index[i] = UINT32_MAX;
forwarding_index[i] = 0;
}
#if 0
for (uint32_t i=0; i<ROB_SIZE; i++) {
registers_instrs_depend_on_me[i] = 0;
memory_instrs_depend_on_me[i] = 0;
for (uint32_t j=0; j<NUM_INSTR_SOURCES; j++)
registers_index_depend_on_me[i][j] = 0;
}
#endif
};
};
#endif