-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMemorySystem.h
More file actions
executable file
·110 lines (91 loc) · 3.05 KB
/
MemorySystem.h
File metadata and controls
executable file
·110 lines (91 loc) · 3.05 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
/****************************************************************************
* 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 MEMORYSYSTEM_H
#define MEMORYSYSTEM_H
//MemorySystem.h
//
//Header file for JEDEC memory system wrapper
//
#include "SimulatorObject.h"
#include "SystemConfiguration.h"
#include "MemoryController.h"
#include "Rank.h"
#include "Transaction.h"
#include "Callback.h"
#include <deque>
namespace DRAMSim
{
typedef CallbackBase_4Param<void,uint,uint64_t,uint64_t, uint64_t> Callback_t;
#if (USE_SCIC_MEMSYS_QUERY == 1)
typedef CallbackBase_3Param<void, uint,uint,uint> CB_HIST;
#endif
class MemorySystem : public SimulatorObject
{
public:
//functions
MemorySystem(uint id, string dev, string sys, string pwd, string trc, unsigned megsOfMemory);
virtual ~MemorySystem();
void update();
bool addTransaction(Transaction &trans);
bool addTransaction(bool isWrite, uint64_t addr, uint64_t txID);
void printStats();
void printStats(bool unused);
bool WillAcceptTransaction();
string SetOutputFileName(string tracefilename);
void RegisterCallbacks(
Callback_t *readDone,
Callback_t *writeDone,
void (*reportPower)(double bgpower, double burstpower, double refreshpower, double actprepower));
#if (USE_SCIC_MEMSYS_QUERY == 1)
void RegisterCallbacks( Callback_t* readCB, Callback_t* writeCB, CB_HIST* histgramCB,
void (*reportPower)(double bgpower, double burstpower,
double refreshpower, double actprepower));
#endif
// mostly for other simulators
void overrideSystemParam(string key, string value);
void overrideSystemParam(string kvpair);
//fields
// unfortunately, this is the easiest to keep C++ from initializing my members by default
MemoryController *memoryController;
vector<Rank> *ranks;
deque<Transaction> pendingTransactions;
//output file
std::ofstream visDataOut;
//function pointers
Callback_t* ReturnReadData;
Callback_t* WriteDataDone;
#if (USE_SCIC_MEMSYS_QUERY == 1)
CB_HIST * _callbackforHistogram;
#endif
//TODO: make this a functor as well?
static powerCallBack_t ReportPower;
uint systemID;
private:
static void mkdirIfNotExist(string path);
string deviceIniFilename;
string systemIniFilename;
string traceFilename;
string pwd;
};
}
#endif