diff --git a/dram/resources/configs/memconfigs/grouper.xml b/dram/resources/configs/memconfigs/grouper.xml
new file mode 100644
index 00000000..73116e13
--- /dev/null
+++ b/dram/resources/configs/memconfigs/grouper.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dram/src/common/third_party/DRAMPower b/dram/src/common/third_party/DRAMPower
new file mode 160000
index 00000000..7723662d
--- /dev/null
+++ b/dram/src/common/third_party/DRAMPower
@@ -0,0 +1 @@
+Subproject commit 7723662db4edd6b8ccd7424edd17073fbfbff601
diff --git a/dram/src/simulation/Simulation.cpp b/dram/src/simulation/Simulation.cpp
index 21823831..6f233309 100644
--- a/dram/src/simulation/Simulation.cpp
+++ b/dram/src/simulation/Simulation.cpp
@@ -105,10 +105,10 @@ void Simulation::bindSockets()
void Simulation::calculateNumberOfTransaction(std::vector devices, string pathToResources)
{
- totalTransactions = getNumberOfLines(pathToResources + string("traces/") + devices[0].trace);
- totalTransactions += getNumberOfLines(pathToResources + string("traces/") + devices[1].trace);
- totalTransactions += getNumberOfLines(pathToResources + string("traces/") + devices[2].trace);
- totalTransactions += getNumberOfLines(pathToResources + string("traces/") + devices[3].trace);
+ totalTransactions = getNumberOfTransactions(pathToResources + string("traces/") + devices[0].trace);
+ totalTransactions += getNumberOfTransactions(pathToResources + string("traces/") + devices[1].trace);
+ totalTransactions += getNumberOfTransactions(pathToResources + string("traces/") + devices[2].trace);
+ totalTransactions += getNumberOfTransactions(pathToResources + string("traces/") + devices[3].trace);
remainingTransactions = totalTransactions;
}
@@ -169,12 +169,18 @@ void Simulation::report(string message)
cout << message << endl;
}
-unsigned int Simulation::getNumberOfLines(string uri)
+unsigned int Simulation::getNumberOfTransactions(string uri)
{
std::ifstream file(uri);
- // count the newlines
- file.unsetf(std::ios_base::skipws);
- unsigned lineCount = std::count(std::istream_iterator(file), std::istream_iterator(), '\n');
+ unsigned int lineCount = 0;
+ string line;
+
+ while (std::getline(file, line))
+ {
+ if(!line.empty())
+ lineCount++;
+ }
+
return lineCount;
}
diff --git a/dram/src/simulation/Simulation.h b/dram/src/simulation/Simulation.h
index 8b4d5dc0..9218321d 100644
--- a/dram/src/simulation/Simulation.h
+++ b/dram/src/simulation/Simulation.h
@@ -72,7 +72,7 @@ private:
unsigned int totalTransactions;
unsigned int remainingTransactions;
clock_t simulationStartTime;
- unsigned int getNumberOfLines(string uri);
+ unsigned int getNumberOfTransactions(string uri);
void report(std::string message);
void setupDebugManager(const string& traceName);
diff --git a/dram/src/simulation/TracePlayer.h b/dram/src/simulation/TracePlayer.h
index 9c32810f..2fc5edbd 100644
--- a/dram/src/simulation/TracePlayer.h
+++ b/dram/src/simulation/TracePlayer.h
@@ -85,17 +85,17 @@ void TracePlayer::start()
template
void TracePlayer::generateNextPayload()
{
-
- if(file)
- {
string line;
if (std::getline(file, line))
{
+ if(line.empty())
+ {
+ generateNextPayload();
+ return;
+ }
std::istringstream iss(line);
string time, command, address;
iss >> time >> command >> address;
- if (time.empty() || command.empty() || address.empty() )
- return;
long parsedAdress = std::stoi(address.c_str(), 0, 16);
gp* payload = memoryManager.allocate();
@@ -157,76 +157,9 @@ void TracePlayer::generateNextPayload()
payloadEventQueue.notify(*payload, BEGIN_REQ, sendingTime - sc_time_stamp());
}
numberOfPendingTransactions++;
-
- }
- }
+ }
}
- // if (file)
- // {
- // string time, command, address, data;
- // file >> time >> command >> address;
- // //if there is a newline at the end of the .stl
- // if (time.empty() || command.empty() || address.empty() )
- // return;
-
- // long parsedAdress = std::stoi(address.c_str(), 0, 16);
-
- // gp* payload = memoryManager.allocate();
- // payload->set_address(parsedAdress);
-
- // // Set data pointer
- // unsigned char * dataElement = new unsigned char[16]; // TODO: column / burst breite
- // payload->set_data_length(16); // TODO: column / burst breite
- // payload->set_data_ptr(dataElement);
- // for(int i = 0; i < 16; i++) // TODO: column / burst breite
- // dataElement[i] = 0;
-
- // if (command == "read")
- // {
- // payload->set_command(TLM_READ_COMMAND);
- // }
- // else if (command == "write")
- // {
- // payload->set_command(TLM_WRITE_COMMAND);
-
- // // Parse and set data
- //// file >> data;
- //// unsigned int counter = 0;
- //// for(int i = 0; i < 16*2-2; i=i+2) // TODO column / burst breite
- //// {
- //// std::string byteString = "0x";
- //// byteString.append(data.substr(i+2, 2));
- //// //cout << byteString << " " << std::stoi(byteString.c_str(), 0, 16) << endl;
- //// dataElement[counter++] = std::stoi(byteString.c_str(), 0, 16);
- //// }
- // }
- // else
- // {
- // SC_REPORT_FATAL(0,
- // (string("Corrupted tracefile, command ") + command + string(" unknown")).c_str());
- // }
-
- // payload->set_response_status(TLM_INCOMPLETE_RESPONSE);
- // payload->set_dmi_allowed(false);
- // payload->set_byte_enable_length(0);
- // payload->set_streaming_width(burstlenght);
-
- // sc_time sendingTime = std::stoi(time.c_str())*clk;
- // GenerationExtension* genExtension = new GenerationExtension(sendingTime);
- // payload->set_auto_extension(genExtension);
-
- // if (sendingTime <= sc_time_stamp())
- // {
- // payloadEventQueue.notify(*payload, BEGIN_REQ, SC_ZERO_TIME);
- // }
- // else
- // {
- // payloadEventQueue.notify(*payload, BEGIN_REQ, sendingTime - sc_time_stamp());
- // }
- // numberOfPendingTransactions++;
- // }
-//}
template
tlm_sync_enum TracePlayer::nb_transport_bw(tlm_generic_payload &payload, tlm_phase &phase, sc_time &bwDelay)
diff --git a/install_prerequisites.sh b/install_prerequisites.sh
index bd046c64..f6859bcf 100755
--- a/install_prerequisites.sh
+++ b/install_prerequisites.sh
@@ -1,5 +1,6 @@
#!/bin/bash
cd dram/src/common/third_party/
+rm -rf DRAMPower
git clone https://github.com/ravenrd/DRAMPower.git
cd DRAMPower
make parserlib