Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ClockDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ namespace ClockDomain

Callback(const Callback<ConsumerT,ReturnT> &e) : object(e.object), member(e.member) {}

virtual ~Callback() {}

ReturnT operator()()
{
return (const_cast<ConsumerT*>(object)->*member)();
Expand Down
20 changes: 1 addition & 19 deletions DRAMSim.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,13 @@
* provide all necessary functionality to talk to an external simulator
*/
#include "Callback.h"
#include "MultiChannelMemorySystem.h"
#include <string>
using std::string;

namespace DRAMSim
{

class MultiChannelMemorySystem {
public:
bool addTransaction(bool isWrite, uint64_t addr);
void setCPUClockSpeed(uint64_t cpuClkFreqHz);
void update();
void printStats(bool finalStats);
bool willAcceptTransaction();
bool willAcceptTransaction(uint64_t addr);
std::ostream &getLogFile();

void RegisterCallbacks(
TransactionCompleteCB *readDone,
TransactionCompleteCB *writeDone,
void (*reportPower)(double bgpower, double burstpower, double refreshpower, double actprepower));
int getIniBool(const std::string &field, bool *val);
int getIniUint(const std::string &field, unsigned int *val);
int getIniUint64(const std::string &field, uint64_t *val);
int getIniFloat(const std::string &field, float *val);
};
MultiChannelMemorySystem *getMemorySystemInstance(const string &dev, const string &sys, const string &pwd, const string &trc, unsigned megsOfMemory, std::string *visfilename=NULL);
}

Expand Down
9 changes: 6 additions & 3 deletions MultiChannelMemorySystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ using namespace DRAMSim;
MultiChannelMemorySystem::MultiChannelMemorySystem(const string &deviceIniFilename_, const string &systemIniFilename_, const string &pwd_, const string &traceFilename_, unsigned megsOfMemory_, string *visFilename_, const IniReader::OverrideMap *paramOverrides)
:megsOfMemory(megsOfMemory_), deviceIniFilename(deviceIniFilename_),
systemIniFilename(systemIniFilename_), traceFilename(traceFilename_),
pwd(pwd_), visFilename(visFilename_),
clockDomainCrosser(new ClockDomain::Callback<MultiChannelMemorySystem, void>(this, &MultiChannelMemorySystem::actual_update)),
csvOut(new CSVWriter(visDataOut))
pwd(pwd_), visFilename(visFilename_),
clockDomainCB(new ClockDomain::Callback<MultiChannelMemorySystem, void>(this, &MultiChannelMemorySystem::actual_update)),
clockDomainCrosser(clockDomainCB), csvOut(new CSVWriter(visDataOut))
{
currentClockCycle=0;
if (visFilename)
Expand Down Expand Up @@ -350,6 +350,9 @@ void MultiChannelMemorySystem::mkdirIfNotExist(string path)

MultiChannelMemorySystem::~MultiChannelMemorySystem()
{
delete csvOut;
delete clockDomainCB;

for (size_t i=0; i<NUM_CHANS; i++)
{
delete channels[i];
Expand Down
1 change: 1 addition & 0 deletions MultiChannelMemorySystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class MultiChannelMemorySystem : public SimulatorObject
string traceFilename;
string pwd;
string *visFilename;
ClockDomain::Callback<MultiChannelMemorySystem, void> *clockDomainCB;
ClockDomain::ClockDomainCrosser clockDomainCrosser;
static void mkdirIfNotExist(string path);
static bool fileExists(string path);
Expand Down