-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemoryFactory.cpp
More file actions
80 lines (65 loc) · 2.3 KB
/
Copy pathMemoryFactory.cpp
File metadata and controls
80 lines (65 loc) · 2.3 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
#include "MemoryFactory.h"
#include "LPDDR4.h"
#include "WideIO.h"
//#include "WideIO2.h"
#include "HBM.h"
#include "SALP.h"
using namespace ramulator;
namespace ramulator
{
template <>
void MemoryFactory<LPDDR4>::validate(int channels, int ranks, const Config& configs) {
assert(channels >= 2 && "LPDDR4 requires 2, 4, 8 ... channels");
}
template <>
void MemoryFactory<WideIO>::validate(int channels, int ranks, const Config& configs) {
assert(channels == 4 && "WideIO comes with 4 channels");
}
//template <>
//void MemoryFactory<WideIO2>::validate(int channels, int ranks, const Config& configs) {
// assert((channels == 4 || channels == 8) && "WideIO2 comes with 4 or 8 channels");
// assert((ranks == 1 || ranks == 2) && "WideIO2 comes with 1 or 2 ranks");
//}
template <>
void MemoryFactory<HBM>::validate(int channels, int ranks, const Config& configs) {
assert(channels == 8 && "HBM comes with 8 channels");
}
//template <>
//MemoryBase *MemoryFactory<WideIO2>::create(const Config& configs, int cacheline) {
// int channels = stoi(configs["channels"], NULL, 0);
// int ranks = stoi(configs["ranks"], NULL, 0);
// validate(channels, ranks, configs);
//
// const string& org_name = configs["org"];
// const string& speed_name = configs["speed"];
//
// WideIO2 *spec = new WideIO2(org_name, speed_name, channels);
//
// extend_channel_width(spec, cacheline);
//
// return (MemoryBase *)populate_memory(configs, spec, channels, ranks);
//}
template <>
MemoryBase *MemoryFactory<SALP>::create(const Config& configs, int cacheline) {
int channels = stoi(configs["channels"], NULL, 0);
int ranks = stoi(configs["ranks"], NULL, 0);
int subarrays = stoi(configs["subarrays"], NULL, 0);
validate(channels, ranks, configs);
const string& std_name = configs["standard"];
const string& org_name = configs["org"];
const string& speed_name = configs["speed"];
SALP *spec = new SALP(org_name, speed_name, std_name, subarrays);
extend_channel_width(spec, cacheline);
return (MemoryBase *)populate_memory(configs, spec, channels, ranks);
}
}
// This function can be used by autoconf AC_CHECK_LIB since
// apparently it can't detect C++ functions.
// Basically just an entry in the symbol table
extern "C"
{
void libramulator_is_present(void)
{
;
}
}