Adapting current DRAM to new structure.

This commit is contained in:
Lukas Steiner
2019-06-23 20:53:08 +02:00
parent cb7b5b585a
commit f8baef57c6
6 changed files with 63 additions and 15 deletions

View File

@@ -56,6 +56,7 @@
#include "../error/ecchamming.h"
#include "DramRecordable.h"
#include "DramDDR3.h"
#include "DramDDR4.h"
#include "RecordableDram.h"
using namespace std;
@@ -263,7 +264,7 @@ void DRAMSys::instantiateModules(const string &traceName,
Dram *dram;
if (recordingEnabled)
//dram = new RecordableDram(str.c_str(), tlmRecorders[i]);
dram = new DramRecordable<Dram>(str.c_str(), tlmRecorders[i]);
dram = new DramRecordable<DramDDR4>(str.c_str(), tlmRecorders[i]);
else
dram = new Dram(str.c_str());
drams.push_back(dram);

View File

@@ -40,3 +40,5 @@ DramDDR3::DramDDR3(sc_module_name name) : Dram(name)
{
}
//DramDDR3::~DramDDR3() {}

View File

@@ -37,6 +37,8 @@
#define DRAMDDR3_H
#include "Dram.h"
#include <systemc>
#include <tlm>
class DramDDR3 : public Dram
{
@@ -44,7 +46,7 @@ public:
DramDDR3(sc_module_name);
SC_HAS_PROCESS(DramDDR3);
~DramDDR3();
//~DramDDR3();
};
#endif // DRAMDDR3_H

View File

@@ -40,3 +40,5 @@ DramDDR4::DramDDR4(sc_module_name name) : Dram(name)
{
}
//DramDDR4::~DramDDR4() {}

View File

@@ -1,9 +1,44 @@
/*
* Copyright (c) 2019, University of Kaiserslautern
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors:
* Lukas Steiner
*/
#ifndef DRAMDDR4_H
#define DRAMDDR4_H
#include "Dram.h"
#include "systemc"
#include "tlm"
#include <systemc>
#include <tlm>
using namespace tlm;
@@ -13,7 +48,7 @@ public:
DramDDR4(sc_module_name);
SC_HAS_PROCESS(DramDDR4);
~DramDDR4();
//~DramDDR4();
};
#endif // DRAMDDR4_H

View File

@@ -34,7 +34,12 @@
*/
#include "DramRecordable.h"
#include "Dram.h"
#include <systemc>
#include <tlm>
#include "../common/TlmRecorder.h"
#include "DramDDR3.h"
#include "DramDDR4.h"
#include "../common/utils.h"
using namespace tlm;
@@ -79,7 +84,7 @@ tlm_sync_enum DramRecordable<BaseDram>::nb_transport_fw(tlm_generic_payload &pay
unsigned int col = DramExtension::getExtension(payload).getColumn().ID();
// TODO: printDebugMessage not inherited
printDebugMessage("Recording " + phaseNameToString(phase) + " thread " +
BaseDram::printDebugMessage("Recording " + phaseNameToString(phase) + " thread " +
to_string(thr) + " channel " + to_string(ch) + " bank group " + to_string(
bg) + " bank " + to_string(bank) + " row " + to_string(row) + " column " +
to_string(col) + " at " + recTime.to_string());
@@ -103,20 +108,20 @@ void DramRecordable<BaseDram>::powerWindow()
clkCycles = sc_time_stamp().value() /
Configuration::getInstance().memSpec->clk.value();
DRAMPower->calcWindowEnergy(clkCycles);
BaseDram::DRAMPower->calcWindowEnergy(clkCycles);
// During operation the energy should never be zero since the device is always consuming
assert(!isEqual(DRAMPower->getEnergy().window_energy, 0.0));
assert(!isEqual(BaseDram::DRAMPower->getEnergy().window_energy, 0.0));
// Store the time (in seconds) and the current average power (in mW) into the database
recordPower();
// Here considering that DRAMPower provides the energy in pJ and the power in mW
printDebugMessage(string("\tWindow Energy: \t") + to_string(
DRAMPower->getEnergy().window_energy *
BaseDram::printDebugMessage(string("\tWindow Energy: \t") + to_string(
BaseDram::DRAMPower->getEnergy().window_energy *
Configuration::getInstance().NumberOfDevicesOnDIMM) + string("\t[pJ]"));
printDebugMessage(string("\tWindow Average Power: \t") + to_string(
DRAMPower->getPower().window_average_power *
BaseDram::printDebugMessage(string("\tWindow Average Power: \t") + to_string(
BaseDram::DRAMPower->getPower().window_average_power *
Configuration::getInstance().NumberOfDevicesOnDIMM) + string("\t[mW]"));
} while (true);
@@ -126,10 +131,11 @@ template<class BaseDram>
void DramRecordable<BaseDram>::recordPower()
{
tlmRecorder->recordPower(sc_time_stamp().to_seconds(),
DRAMPower->getPower().window_average_power
BaseDram::DRAMPower->getPower().window_average_power
* Configuration::getInstance().NumberOfDevicesOnDIMM);
}
template class DramRecordable<Dram>;
template class DramRecordable<DramDDR3>;
template class DramRecordable<DramDDR4>;