-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSystemConfiguration.h
executable file
·207 lines (173 loc) · 4.39 KB
/
SystemConfiguration.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
/****************************************************************************
* DRAMSim2: A Cycle Accurate DRAM simulator
*
* Copyright (C) 2010 Elliott Cooper-Balis
* Paul Rosenfeld
* Bruce Jacob
* University of Maryland
*
* This program 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 3 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
*****************************************************************************/
#ifndef SYSCONFIG_H
#define SYSCONFIG_H
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cstdlib>
#include <stdint.h>
#include "PrintMacros.h"
//SystemConfiguration.h
//
//Configuration values for the current system
//number of latencies per bucket in the latency histogram
//TODO: move to system ini file
#define HISTOGRAM_BIN_SIZE 10
extern std::ofstream cmd_verify_out; //used by BusPacket.cpp if VERIFICATION_OUTPUT is enabled
//extern std::ofstream visDataOut;
//TODO: namespace these to DRAMSim::
extern bool VERIFICATION_OUTPUT; // output suitable to feed to modelsim
extern bool DEBUG_TRANS_Q;
extern bool DEBUG_CMD_Q;
extern bool DEBUG_ADDR_MAP;
extern bool DEBUG_BANKSTATE;
extern bool DEBUG_BUS;
extern bool DEBUG_BANKS;
extern bool DEBUG_POWER;
extern bool USE_LOW_POWER;
extern bool VIS_FILE_OUTPUT;
extern uint64_t TOTAL_STORAGE;
extern uint NUM_BANKS;
extern uint NUM_RANKS;
extern uint NUM_CHANS;
extern uint NUM_ROWS;
extern uint NUM_COLS;
extern uint DEVICE_WIDTH;
//in nanoseconds
extern uint REFRESH_PERIOD;
extern float tCK;
extern uint CL;
extern uint AL;
#define RL (CL+AL)
#define WL (RL-1)
extern uint BL;
extern uint tRAS;
extern uint tRCD;
extern uint tRRD;
extern uint tRC;
extern uint tRP;
extern uint tCCD;
extern uint tRTP;
extern uint tWTR;
extern uint tWR;
extern uint tRTRS;
extern uint tRFC;
extern uint tFAW;
extern uint tCKE;
extern uint tXP;
extern uint tCMD;
extern uint IDD0;
extern uint IDD1;
extern uint IDD2P;
extern uint IDD2Q;
extern uint IDD2N;
extern uint IDD3Pf;
extern uint IDD3Ps;
extern uint IDD3N;
extern uint IDD4W;
extern uint IDD4R;
extern uint IDD5;
extern uint IDD6;
extern uint IDD6L;
extern uint IDD7;
extern float Vdd;
extern unsigned NUM_DEVICES;
//same bank
#define READ_TO_PRE_DELAY (AL+BL/2+max(((int)tRTP),2)-2)
#define WRITE_TO_PRE_DELAY (WL+BL/2+tWR)
#define READ_TO_WRITE_DELAY (RL+BL/2+tRTRS-WL)
#define READ_AUTOPRE_DELAY (AL+tRTP+tRP)
#define WRITE_AUTOPRE_DELAY (WL+BL/2+tWR+tRP)
#define WRITE_TO_READ_DELAY_B (WL+BL/2+tWTR) //interbank
#define WRITE_TO_READ_DELAY_R (WL+BL/2+tRTRS-RL) //interrank
extern uint JEDEC_DATA_BUS_BITS;
//Memory Controller related parameters
extern uint TRANS_QUEUE_DEPTH;
extern uint CMD_QUEUE_DEPTH;
extern uint EPOCH_LENGTH;
extern uint TOTAL_ROW_ACCESSES;
extern std::string ROW_BUFFER_POLICY;
extern std::string SCHEDULING_POLICY;
extern std::string ADDRESS_MAPPING_SCHEME;
extern std::string QUEUING_STRUCTURE;
enum TraceType
{
k6,
mase,
misc
};
enum AddressMappingScheme
{
Scheme1,
Scheme2,
Scheme3,
Scheme4,
Scheme5,
Scheme6
};
// used in MemoryController and CommandQueue
enum RowBufferPolicy
{
OpenPage,
ClosePage
};
// Only used in CommandQueue
enum QueuingStructure
{
PerRank,
PerRankPerBank
};
enum SchedulingPolicy
{
RankThenBankRoundRobin,
BankThenRankRoundRobin
};
// set by IniReader.cpp
namespace DRAMSim
{
typedef void (*returnCallBack_t)(uint id, uint64_t addr, uint64_t clockcycle);
typedef void (*powerCallBack_t)(double bgpower, double burstpower, double refreshpower, double actprepower);
extern RowBufferPolicy rowBufferPolicy;
extern SchedulingPolicy schedulingPolicy;
extern AddressMappingScheme addressMappingScheme;
extern QueuingStructure queuingStructure;
//
//FUNCTIONS
//
uint inline dramsim_log2(unsigned value)
{
uint logbase2 = 0;
unsigned orig = value;
value>>=1;
while (value>0)
{
value >>= 1;
logbase2++;
}
if ((uint)1<<logbase2<orig)logbase2++;
return logbase2;
}
};
#endif