-
Notifications
You must be signed in to change notification settings - Fork 139
/
memcad_parameters.h
251 lines (159 loc) · 4.38 KB
/
memcad_parameters.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#ifndef __MEMCAD_PARAMS_H__
#define __MEMCAD_PARAMS_H__
#include <vector>
#include <iostream>
#include "cacti_interface.h"
#include "const.h"
#include "parameter.h"
using namespace std;
///#define INF 1000000
#define EPS 0.0000001
#define MAX_DIMM_PER_CHANNEL 3
#define MAX_CAP_PER_DIMM 64
#define MAX_RANKS_PER_DIMM 4
#define MIN_BW_PER_CHANNEL 400
#define MAX_DDR3_CHANNEL_BW 800
#define MAX_DDR4_CHANNEL_BW 1600
#define MAX_NUM_CHANNELS_PER_BOB 2
#define MAX_NUM_BOBS 6
#define DIMM_PER_CHANNEL 3
/*
enum Mem_IO_type
{
DDR3,
DDR4,
LPDDR2,
WideIO,
Low_Swing_Diff,
Serial
};
enum Mem_DIMM
{
UDIMM,
RDIMM,
LRDIMM
};
*/
class MemCadParameters
{
public:
Mem_IO_type io_type; // DDR3 vs. DDR4
int capacity; // in GB
int num_bobs; // default=4me
///int bw_per_channel; // defaul=1600 MHz;
///bool with_bob;
int num_channels_per_bob; // 1 means no bob
bool capacity_wise; // true means the load on each channel is proportional to its capacity.
///int min_bandwith;
MemCad_metrics first_metric;
MemCad_metrics second_metric;
MemCad_metrics third_metric;
DIMM_Model dimm_model;
bool low_power_permitted; // Not yet implemented. It determines acceptable VDDs.
double load; // between 0 to 1
double row_buffer_hit_rate;
double rd_2_wr_ratio;
bool same_bw_in_bob; // true if all the channels in the bob have the same bandwidth.
bool mirror_in_bob;// true if all the channels in the bob have the same configs
bool total_power; // false means just considering I/O Power
bool verbose;
// Functions
MemCadParameters(InputParameter * g_ip);
void print_inputs();
bool sanity_check();
};
//////////////////////////////////////////////////////////////////////////////////
class MemoryParameters
{
public:
// Power Parameteres
static double VDD[2][2][4];
static double IDD0[2][4];
static double IDD1[2][4];
static double IDD2P0[2][4];
static double IDD2P1[2][4];
static double IDD2N[2][4];
static double IDD3P[2][4];
static double IDD3N[2][4];
static double IDD4R[2][4];
static double IDD4W[2][4];
static double IDD5[2][4];
static double io_energy_read[2][3][3][4];
static double io_energy_write[2][3][3][4];
// Timing Parameters
static double T_RAS[2];
static double T_RC[2];
static double T_RP[2];
static double T_RFC[2];
static double T_REFI[2];
// Bandwidth Parameters
static int bandwidth_load[2][4];
// Cost Parameters
static double cost[2][3][5];
// Functions
MemoryParameters();
int bw_index(Mem_IO_type type, int bandwidth);
};
///////////////////////////////////////////////////////////////////////////
int bw_index(Mem_IO_type type, int bandwidth);
///////////////////////////////////////////////////////////////////////////
class channel_conf
{
public:
MemCadParameters *memcad_params;
Mem_DIMM type;
int num_dimm_per_channel;
int histogram_capacity[5]; // 0->4GB, 1->8GB, 2->16GB, 3->32GB, 4->64GB
bool low_power;
int capacity;
int bandwidth;
double energy_per_read;
double energy_per_write;
double energy_per_access;
double cost;
double latency;
bool valid;
// Functions
channel_conf(MemCadParameters * memcad_params, const vector<int>& dimm_cap, int bandwidth, Mem_DIMM type, bool low_power);
void calc_power();
friend channel_conf* clone(channel_conf*);
friend ostream & operator<<(ostream &os, const channel_conf& ch_cnf);
};
///////////////////////////////////////////////////////////////////////////
class bob_conf
{
public:
MemCadParameters *memcad_params;
int num_channels;
channel_conf *channels[MAX_NUM_CHANNELS_PER_BOB];
int capacity;
int bandwidth;
double energy_per_read;
double energy_per_write;
double energy_per_access;
double cost;
double latency;
bool valid;
bob_conf(MemCadParameters * memcad_params, vector<channel_conf*> * channels);
friend bob_conf* clone(bob_conf*);
friend ostream & operator <<(ostream &os, const bob_conf& bob_cnf);
};
///////////////////////////////////////////////////////////////////////////
class memory_conf
{
public:
MemCadParameters *memcad_params;
int num_bobs;
bob_conf* bobs[MAX_NUM_BOBS];
int capacity;
int bandwidth;
double energy_per_read;
double energy_per_write;
double energy_per_access;
double cost;
double latency;
bool valid;
memory_conf(MemCadParameters * memcad_params, vector<bob_conf*> * bobs);
friend ostream & operator <<(ostream &os, const memory_conf& bob_cnf);
};
#endif