Code formatting and refactoring
This commit is contained in:
@@ -83,7 +83,7 @@ public:
|
|||||||
void serialize(std::ostream& stream) const override;
|
void serialize(std::ostream& stream) const override;
|
||||||
void deserialize(std::istream& stream) override;
|
void deserialize(std::istream& stream) override;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
void end_of_simulation() override;
|
void end_of_simulation() override;
|
||||||
|
|
||||||
virtual tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload& trans,
|
virtual tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload& trans,
|
||||||
|
|||||||
@@ -119,10 +119,11 @@ DRAMSys::DRAMSys(const sc_core::sc_module_name& name, const Config::Configuratio
|
|||||||
("dram" + std::to_string(i)).c_str(), simConfig, *memSpec, &tlmRecorders[i]));
|
("dram" + std::to_string(i)).c_str(), simConfig, *memSpec, &tlmRecorders[i]));
|
||||||
|
|
||||||
if (simConfig.checkTLM2Protocol)
|
if (simConfig.checkTLM2Protocol)
|
||||||
|
{
|
||||||
controllersTlmCheckers.emplace_back(
|
controllersTlmCheckers.emplace_back(
|
||||||
std::make_unique<tlm_utils::tlm2_base_protocol_checker<>>(
|
std::make_unique<tlm_utils::tlm2_base_protocol_checker<>>(
|
||||||
("TLMCheckerController" + std::to_string(i)).c_str()));
|
("TLMCheckerController" + std::to_string(i)).c_str()));
|
||||||
|
}
|
||||||
// Not recording bandwidth between Arbiter - Controller
|
// Not recording bandwidth between Arbiter - Controller
|
||||||
tlmATRecorders.emplace_back(
|
tlmATRecorders.emplace_back(
|
||||||
std::make_unique<TlmATRecorder>(("TlmATRecorder" + std::to_string(i)).c_str(),
|
std::make_unique<TlmATRecorder>(("TlmATRecorder" + std::to_string(i)).c_str(),
|
||||||
@@ -157,7 +158,7 @@ DRAMSys::DRAMSys(const sc_core::sc_module_name& name, const Config::Configuratio
|
|||||||
|
|
||||||
if (simConfig.checkTLM2Protocol)
|
if (simConfig.checkTLM2Protocol)
|
||||||
{
|
{
|
||||||
controllersTlmCheckers.push_back(
|
controllersTlmCheckers.emplace_back(
|
||||||
std::make_unique<tlm_utils::tlm2_base_protocol_checker<>>(
|
std::make_unique<tlm_utils::tlm2_base_protocol_checker<>>(
|
||||||
("TlmCheckerController" + std::to_string(i)).c_str()));
|
("TlmCheckerController" + std::to_string(i)).c_str()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,8 +110,12 @@ Dram::Dram(const sc_module_name& name,
|
|||||||
if (DRAMPower && storeMode == Config::StoreModeType::NoStorage) {
|
if (DRAMPower && storeMode == Config::StoreModeType::NoStorage) {
|
||||||
if (simConfig.togglingRate) {
|
if (simConfig.togglingRate) {
|
||||||
DRAMPower->setToggleRate(0, simConfig.togglingRate);
|
DRAMPower->setToggleRate(0, simConfig.togglingRate);
|
||||||
} else {
|
}
|
||||||
SC_REPORT_FATAL("DRAM", "Toggling rates for power estimation must be provided for storeMode NoStorage");
|
else
|
||||||
|
{
|
||||||
|
SC_REPORT_FATAL(
|
||||||
|
"DRAM",
|
||||||
|
"Toggling rates for power estimation must be provided for storeMode NoStorage");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,18 +140,15 @@ void Dram::reportPower()
|
|||||||
|
|
||||||
// Print the final total energy and the average power for
|
// Print the final total energy and the average power for
|
||||||
// the simulation:
|
// the simulation:
|
||||||
std::cout << name() << std::string(" Total Energy: ") << std::defaultfloat << std::setprecision(3)
|
std::cout << name() << std::string(" Total Energy: ") << std::defaultfloat
|
||||||
<< energy << std::string(" J")
|
<< std::setprecision(3) << energy << std::string(" J") << std::endl;
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
std::cout << name() << std::string(" Average Power: ") << std::defaultfloat << std::setprecision(3)
|
std::cout << name() << std::string(" Average Power: ") << std::defaultfloat
|
||||||
<< energy / time << std::string(" W")
|
<< std::setprecision(3) << energy / time << std::string(" W") << std::endl;
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
if (tlmRecorder != nullptr)
|
if (tlmRecorder != nullptr)
|
||||||
{
|
{
|
||||||
tlmRecorder->recordPower(sc_time_stamp().to_seconds(),
|
tlmRecorder->recordPower(sc_time_stamp().to_seconds(), energy / time);
|
||||||
energy / time);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,10 +158,15 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload& trans, tlm_phase& phase
|
|||||||
|
|
||||||
if (DRAMPower)
|
if (DRAMPower)
|
||||||
{
|
{
|
||||||
std::size_t rank = static_cast<std::size_t>(ControllerExtension::getRank(trans)); // relaitve to the channel
|
std::size_t channel = static_cast<std::size_t>(ArbiterExtension::getChannel(trans));
|
||||||
std::size_t bank_group_abs = static_cast<std::size_t>(ControllerExtension::getBankGroup(trans)); // relative to the channel
|
std::size_t rank = static_cast<std::size_t>(
|
||||||
std::size_t bank_group = bank_group_abs - rank * memSpec.groupsPerRank; // relative to the rank
|
ControllerExtension::getRank(trans)); // relaitve to the channel
|
||||||
std::size_t bank = static_cast<std::size_t>(ControllerExtension::getBank(trans)) - bank_group_abs * memSpec.banksPerGroup; // relative to the bank_group
|
std::size_t bank_group_abs = static_cast<std::size_t>(
|
||||||
|
ControllerExtension::getBankGroup(trans)); // relative to the channel
|
||||||
|
std::size_t bank_group =
|
||||||
|
bank_group_abs - rank * memSpec.groupsPerRank; // relative to the rank
|
||||||
|
std::size_t bank = static_cast<std::size_t>(ControllerExtension::getBank(trans)) -
|
||||||
|
bank_group_abs * memSpec.banksPerGroup; // relative to the bank_group
|
||||||
std::size_t row = static_cast<std::size_t>(ControllerExtension::getRow(trans));
|
std::size_t row = static_cast<std::size_t>(ControllerExtension::getRow(trans));
|
||||||
std::size_t column = static_cast<std::size_t>(ControllerExtension::getColumn(trans));
|
std::size_t column = static_cast<std::size_t>(ControllerExtension::getColumn(trans));
|
||||||
uint64_t cycle = std::lround((sc_time_stamp() + delay) / memSpec.tCK);
|
uint64_t cycle = std::lround((sc_time_stamp() + delay) / memSpec.tCK);
|
||||||
@@ -330,8 +336,7 @@ void Dram::powerWindow()
|
|||||||
|
|
||||||
// Here considering that DRAMPower provides the energy in J and the power in W
|
// Here considering that DRAMPower provides the energy in J and the power in W
|
||||||
PRINTDEBUGMESSAGE(this->name(),
|
PRINTDEBUGMESSAGE(this->name(),
|
||||||
std::string("\tWindow Energy: \t") +
|
std::string("\tWindow Energy: \t") + std::to_string(windowEnergy) +
|
||||||
std::to_string(windowEnergy) +
|
|
||||||
std::string("\t[J]"));
|
std::string("\t[J]"));
|
||||||
PRINTDEBUGMESSAGE(this->name(),
|
PRINTDEBUGMESSAGE(this->name(),
|
||||||
std::string("\tWindow Average Power: \t") +
|
std::string("\tWindow Average Power: \t") +
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace DRAMSys
|
|||||||
|
|
||||||
class Dram : public sc_core::sc_module, public Serialize, public Deserialize
|
class Dram : public sc_core::sc_module, public Serialize, public Deserialize
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
const MemSpec& memSpec;
|
const MemSpec& memSpec;
|
||||||
|
|
||||||
// Data Storage:
|
// Data Storage:
|
||||||
|
|||||||
Reference in New Issue
Block a user