Merge branch 'DRAMSys4.0_ctrl' of https://git.eit.uni-kl.de/ems/astdm/dram.sys into DRAMSys4.0_ctrl

This commit is contained in:
Lukas Steiner
2019-08-25 23:14:19 +02:00
6 changed files with 34 additions and 23 deletions

View File

@@ -74,12 +74,13 @@ unix:!macx {
}
macx: {
CONFIG += c++11
QMAKE_CXXFLAGS += -std=c++0x -stdlib=libc++ -O0 -g
$$eval(coverage_check) {
QMAKE_CXXFLAGS += --coverage
QMAKE_LFLAGS += --coverage
}
CONFIG += c++11
QMAKE_CXXFLAGS += -std=c++0x -stdlib=libc++ -O0 -g
QMAKE_MACOSX_DEPLOYMENT_TARGET=10.14
$$eval(coverage_check) {
QMAKE_CXXFLAGS += --coverage
QMAKE_LFLAGS += --coverage
}
}
QMAKE_CXXFLAGS += -isystem $${systemc_home}/include

View File

@@ -140,6 +140,8 @@ void TlmRecorder::introduceTransactionSystem(tlm::tlm_generic_payload &trans)
{
unsigned int id = totalNumTransactions++;
currentTransactionsInSystem[&trans].id = id;
currentTransactionsInSystem[&trans].cmd = trans.get_command() ==
tlm::TLM_READ_COMMAND ? "R" : "W";
currentTransactionsInSystem[&trans].address = trans.get_address();
currentTransactionsInSystem[&trans].burstlength = trans.get_streaming_width();
currentTransactionsInSystem[&trans].dramExtension = DramExtension::getExtension(
@@ -370,8 +372,11 @@ void TlmRecorder::insertTransactionInDB(Transaction &recordingData)
recordingData.timeOnDataStrobe.end.value());
sqlite3_bind_int64(insertTransactionStatement, 13,
recordingData.timeOfGeneration.value());
sqlite3_bind_text(insertTransactionStatement, 14,
recordingData.cmd.c_str(), recordingData.cmd.length(), NULL);
executeSqlStatement(insertTransactionStatement);
}
void TlmRecorder::insertRangeInDB(unsigned int id, const sc_time &begin,

View File

@@ -94,6 +94,7 @@ private:
unsigned int id;
unsigned int address;
unsigned int burstlength;
std::string cmd;
DramExtension dramExtension;
sc_time timeOfGeneration;
TimeInterval timeOnDataStrobe;

View File

@@ -36,6 +36,7 @@
#include "MemoryManager.h"
#include "../common/DebugManager.h"
#include "../controller/core/configuration/Configuration.h"
#include <iostream>
using namespace std;
@@ -48,11 +49,12 @@ MemoryManager::MemoryManager(): numberOfAllocations(0), numberOfFrees(0)
MemoryManager::~MemoryManager()
{
for (gp *payload : freePayloads) {
delete[] payload->get_data_ptr();
delete payload;
numberOfFrees++;
}
//Comment in if you are suspecting a memory leak in the manager
// Comment in if you are suspecting a memory leak in the manager
//PRINTDEBUGMESSAGE("MemoryManager","Number of allocated payloads: " + to_string(numberOfAllocations));
//PRINTDEBUGMESSAGE("MemoryManager","Number of freed payloads: " + to_string(numberOfFrees));
}
@@ -61,7 +63,15 @@ gp *MemoryManager::allocate()
{
if (freePayloads.empty()) {
numberOfAllocations++;
return new gp(this);
gp *payload = new gp(this);
// Allocate a data buffer and initialize it with zeroes:
unsigned int dataLength = Configuration::getInstance().getBytesPerBurst();
unsigned char *data = new unsigned char[dataLength];
std::fill(data, data + dataLength, 0);
payload->set_data_ptr(data);
return payload;
} else {
gp *result = freePayloads.back();
freePayloads.pop_back();
@@ -71,9 +81,7 @@ gp *MemoryManager::allocate()
void MemoryManager::free(gp *payload)
{
unsigned char *dptr = payload->get_data_ptr();
delete[] dptr;
payload->reset(); //clears all extensions
payload->reset(); // clears all extensions
freePayloads.push_back(payload);
}

View File

@@ -89,12 +89,7 @@ public:
}
// Allocate a generic payload for this request.
gp *payload = this->allocatePayload();
// Allocate a data buffer and initialize it with zeroes. It may be
// overwritten with data from the trace file depending on the storage
// mode.
unsigned char *data = new unsigned char[dataLength];
std::fill(data, data + dataLength, 0);
unsigned char *data = payload->get_data_ptr();
// Trace files MUST provide timestamp, command and address for every
// transaction. The data information depends on the storage mode

View File

@@ -45,12 +45,13 @@ unix:!macx {
}
macx: {
CONFIG += c++11
QMAKE_CXXFLAGS += -std=c++0x -stdlib=libc++ -O0 -g
$$eval(coverage_check) {
QMAKE_CXXFLAGS += --coverage
QMAKE_LFLAGS += --coverage
}
CONFIG += c++11
QMAKE_CXXFLAGS += -std=c++0x -stdlib=libc++ -O0 -g
QMAKE_MACOSX_DEPLOYMENT_TARGET=10.14
$$eval(coverage_check) {
QMAKE_CXXFLAGS += --coverage
QMAKE_LFLAGS += --coverage
}
}
INCLUDEPATH += ../library/src/simulation/