diff --git a/dram/.cproject b/dram/.cproject index 49a1ca7b..79dda475 100644 --- a/dram/.cproject +++ b/dram/.cproject @@ -19,7 +19,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -91,6 +91,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dram/.settings/language.settings.xml b/dram/.settings/language.settings.xml index 127cd8ac..d60268a9 100644 --- a/dram/.settings/language.settings.xml +++ b/dram/.settings/language.settings.xml @@ -10,4 +10,14 @@ + + + + + + + + + + diff --git a/dram/resources/configs/memconfigs/memconfig.xml b/dram/resources/configs/memconfigs/memconfig.xml index c1dc5677..e21c26b4 100644 --- a/dram/resources/configs/memconfigs/memconfig.xml +++ b/dram/resources/configs/memconfigs/memconfig.xml @@ -1,10 +1,10 @@ - + - + diff --git a/dram/src/common/DebugManager.cpp b/dram/src/common/DebugManager.cpp index 819c9195..f0f4b3b7 100644 --- a/dram/src/common/DebugManager.cpp +++ b/dram/src/common/DebugManager.cpp @@ -9,14 +9,9 @@ using namespace std; -DebugManager& DebugManager::getInstance() -{ - static DebugManager manager; - return manager; -} - void DebugManager::printDebugMessage(string sender, string message) { +#ifndef NDEBUG if (whiteList.count(sender)) { if (writeToConsole) @@ -25,6 +20,7 @@ void DebugManager::printDebugMessage(string sender, string message) if (writeToFile) debugFile << " at " << sc_time_stamp() << " in " << sender << "\t: " << message << "\n"; } +#endif } void DebugManager::addToWhiteList(string sender) diff --git a/dram/src/common/DebugManager.h b/dram/src/common/DebugManager.h index 0e82c1e8..e1d6f9cd 100644 --- a/dram/src/common/DebugManager.h +++ b/dram/src/common/DebugManager.h @@ -16,7 +16,11 @@ class DebugManager { public: ~DebugManager(); - static DebugManager& getInstance(); + static inline DebugManager& getInstance() + { + static DebugManager manager; + return manager; + } bool writeToConsole; bool writeToFile; diff --git a/dram/src/common/Utils.cpp b/dram/src/common/Utils.cpp index c6e6a757..5c459204 100644 --- a/dram/src/common/Utils.cpp +++ b/dram/src/common/Utils.cpp @@ -29,9 +29,9 @@ unsigned int queryUIntParameter(XMLElement* node, string name) { if (element->Attribute("id") == name) { - assert(!strcmp(element->Attribute("type"), "uint")); + sc_assert(!strcmp(element->Attribute("type"), "uint")); XMLError error = element->QueryIntAttribute("value", &result); - assert(!error); + sc_assert(!error); return result; } } @@ -63,9 +63,9 @@ double queryDoubleParameter(XMLElement* node, string name) { if (element->Attribute("id") == name) { - assert(!strcmp(element->Attribute("type"), "double")); + sc_assert(!strcmp(element->Attribute("type"), "double")); XMLError error = element->QueryDoubleAttribute("value", &result); - assert(!error); + sc_assert(!error); return result; } } @@ -83,9 +83,9 @@ bool queryBoolParameter(XMLElement* node, string name) { if (element->Attribute("id") == name) { - assert(!strcmp(element->Attribute("type"), "bool")); + sc_assert(!strcmp(element->Attribute("type"), "bool")); XMLError error = element->QueryBoolAttribute("value", &result); - assert(!error); + sc_assert(!error); return result; } } diff --git a/dram/src/common/dramExtension.cpp b/dram/src/common/dramExtension.cpp index 46c59eee..0259c5ab 100644 --- a/dram/src/common/dramExtension.cpp +++ b/dram/src/common/dramExtension.cpp @@ -1,5 +1,4 @@ #include "dramExtension.h" -#include #include "../core/configuration/Configuration.h" #include "map" @@ -12,10 +11,8 @@ DramExtension& DramExtension::getExtension(const tlm_generic_payload *payload) { DramExtension *result = NULL; payload->get_extension(result); - if(result == NULL) - { - SC_REPORT_FATAL("DRAM Extension","Extension is null."); - } + sc_assert(result!=NULL); + return *result; } @@ -55,7 +52,7 @@ BankGroup Bank::getBankGroup() if (bankgroups.size() == 0) { core::Configuration& config = core::Configuration::getInstance(); - SC_ASSERT_(config.NumberOfBanks % config.NumberOfBankGroups == 0, "Number of banks must be a multiple of number of bankgroups"); + sc_assert(config.NumberOfBanks % config.NumberOfBankGroups == 0); for (unsigned int bank = 0; bank < config.NumberOfBanks; bank++) { diff --git a/dram/src/common/third_party/tinyxml2.h b/dram/src/common/third_party/tinyxml2.h index 0c764e9a..c8a69e47 100644 --- a/dram/src/common/third_party/tinyxml2.h +++ b/dram/src/common/third_party/tinyxml2.h @@ -81,7 +81,7 @@ distribution. # define TIXMLASSERT( x ) if ( !(x)) { __debugbreak(); } //if ( !(x)) WinDebugBreak() # elif defined (ANDROID_NDK) # include -# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } +# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "assert in '%s' at %d.", __FILE__, __LINE__ ); } # else # include # define TIXMLASSERT assert diff --git a/dram/src/common/xmlAddressdecoder.cpp b/dram/src/common/xmlAddressdecoder.cpp index 7271b39c..1964a4a8 100644 --- a/dram/src/common/xmlAddressdecoder.cpp +++ b/dram/src/common/xmlAddressdecoder.cpp @@ -69,7 +69,7 @@ xmlAddressDecoder::xmlAddressDecoder(string addressConfigURI) } else { - SC_REPORT_ERROR("xmlAddressDecoder can not find ", addressConfigURI.c_str()); + SC_REPORT_FATAL("xmlAddressDecoder can not find ", addressConfigURI.c_str()); } } diff --git a/dram/src/core/ControllerCore.cpp b/dram/src/core/ControllerCore.cpp index 86abdbd9..1892159f 100644 --- a/dram/src/core/ControllerCore.cpp +++ b/dram/src/core/ControllerCore.cpp @@ -13,6 +13,7 @@ #include "scheduling/checker/ReadChecker.h" #include "scheduling/checker/WriteChecker.h" #include "scheduling/checker/RefreshChecker.h" +#include "scheduling/checker/PowerDownChecker.h" #include "refresh/RefreshManagerBankwise.h" #include "refresh/RefreshManager.h" #include "../common/dramExtension.h" @@ -39,6 +40,12 @@ ControllerCore::ControllerCore(IWrapperConnector& wrapperConnector, std::mapact delay diff --git a/dram/src/core/powerdown/PowerDownManager.cpp b/dram/src/core/powerdown/PowerDownManager.cpp index 431e8501..0b480dd8 100644 --- a/dram/src/core/powerdown/PowerDownManager.cpp +++ b/dram/src/core/powerdown/PowerDownManager.cpp @@ -59,11 +59,11 @@ void PowerDownManager::sleep(Bank bank, sc_time time) } } - ScheduledCommand pdn(IPowerDownManager::getSleepCommand(state), time, - getExecutionTime(IPowerDownManager::getSleepCommand(state), powerDownPayloads[bank]), + Command cmd = IPowerDownManager::getSleepCommand(state); + ScheduledCommand pdn(cmd, time, getExecutionTime(cmd, powerDownPayloads[bank]), DramExtension::getExtension(powerDownPayloads[bank])); - controller.state.bus.moveCommandToNextFreeSlot(pdn); + controller.getCommandChecker(cmd).delayToSatisfyConstraints(pdn); if (state != PowerDownState::PDNSelfRefresh && controller.refreshManager->hasCollision(pdn)) { @@ -71,7 +71,7 @@ void PowerDownManager::sleep(Bank bank, sc_time time) } else { - setState(state); + setPowerDownState(state); sendPowerDownPayloads(pdn); } } @@ -80,33 +80,19 @@ void PowerDownManager::wakeUp(Bank bank, sc_time time) { if (isAwakeForRefresh()) //Request enters system during Refresh { - setState(PowerDownState::Awake); + setPowerDownState(PowerDownState::Awake); } else if (isInPowerDown()) //Request wakes up power down { - sc_time startOfExitCommand(SC_ZERO_TIME); - switch (powerDownState) - { - case PowerDownState::PDNActive: - startOfExitCommand = max(time, controller.state.getLastCommand(Command::PDNA).getEnd()); - break; - case PowerDownState::PDNPrecharge: - startOfExitCommand = max(time, controller.state.getLastCommand(Command::PDNP).getEnd()); - break; - case PowerDownState::PDNSelfRefresh: - startOfExitCommand = max(time, controller.state.getLastCommand(Command::SREF).getEnd()); - controller.refreshManager->reInitialize(bank, - startOfExitCommand + getExecutionTime(Command::SREFX, powerDownPayloads[bank])); - break; - default: - break; - } - Command cmd = IPowerDownManager::getWakeUpCommand(powerDownState); - ScheduledCommand pdn(cmd, startOfExitCommand, getExecutionTime(cmd, powerDownPayloads[bank]), + ScheduledCommand pdn(cmd, time, getExecutionTime(cmd, powerDownPayloads[bank]), DramExtension::getExtension(powerDownPayloads[bank])); + controller.getCommandChecker(cmd).delayToSatisfyConstraints(pdn); - setState(PowerDownState::Awake); + if (cmd == Command::SREFX) + controller.refreshManager->reInitialize(bank, pdn.getEnd()); + + setPowerDownState(PowerDownState::Awake); sendPowerDownPayloads(pdn); } } @@ -119,7 +105,7 @@ void PowerDownManager::wakeUpForRefresh(Bank bank, sc_time time) ScheduledCommand pdn(cmd, time, getExecutionTime(cmd, powerDownPayloads[bank]), DramExtension::getExtension(powerDownPayloads[bank])); - setState(PowerDownState::AwakeForRefresh); + setPowerDownState(PowerDownState::AwakeForRefresh); sendPowerDownPayloads(pdn); } } @@ -137,7 +123,7 @@ void PowerDownManager::sendPowerDownPayloads(ScheduledCommand& cmd) } } -void PowerDownManager::setState(PowerDownState state) +void PowerDownManager::setPowerDownState(PowerDownState state) { powerDownState = state; DebugManager::getInstance().printDebugMessage(PowerDownManagerBankwise::senderName, diff --git a/dram/src/core/powerdown/PowerDownManager.h b/dram/src/core/powerdown/PowerDownManager.h index d7a25b5f..82a969c6 100644 --- a/dram/src/core/powerdown/PowerDownManager.h +++ b/dram/src/core/powerdown/PowerDownManager.h @@ -31,7 +31,7 @@ private: bool isInPowerDown(); - void setState(PowerDownState state); + void setPowerDownState(PowerDownState state); bool canSleep(); bool isAwakeForRefresh(); std::map powerDownPayloads; diff --git a/dram/src/core/powerdown/PowerDownManagerBankwise.cpp b/dram/src/core/powerdown/PowerDownManagerBankwise.cpp index 0b7ea60a..c1480df3 100644 --- a/dram/src/core/powerdown/PowerDownManagerBankwise.cpp +++ b/dram/src/core/powerdown/PowerDownManagerBankwise.cpp @@ -53,8 +53,9 @@ void PowerDownManagerBankwise::sleep(Bank bank, sc_time time) } } - ScheduledCommand pdn(IPowerDownManager::getSleepCommand(state), time, minTime, DramExtension::getExtension(payload)); - controller.state.bus.moveCommandToNextFreeSlot(pdn); + Command cmd = IPowerDownManager::getSleepCommand(state); + ScheduledCommand pdn(cmd, time, minTime, DramExtension::getExtension(payload)); + controller.getCommandChecker(cmd).delayToSatisfyConstraints(pdn); if (state != PowerDownState::PDNSelfRefresh && controller.refreshManager->hasCollision(pdn)) { @@ -76,27 +77,13 @@ void PowerDownManagerBankwise::wakeUp(Bank bank, sc_time time) else if (isInPowerDown(bank)) { //Request wakes up power down - sc_time startOfExitCommand(SC_ZERO_TIME); - switch (powerDownStates[bank]) - { - case PowerDownState::PDNActive: - startOfExitCommand = max(time, controller.state.getLastCommand(Command::PDNA).getEnd()); - break; - case PowerDownState::PDNPrecharge: - startOfExitCommand = max(time, controller.state.getLastCommand(Command::PDNP).getEnd()); - break; - case PowerDownState::PDNSelfRefresh: - startOfExitCommand = max(time, controller.state.getLastCommand(Command::SREF).getEnd()); - controller.refreshManager->reInitialize(bank, - startOfExitCommand + getExecutionTime(Command::SREFX, powerDownPayloads[bank])); - break; - default: - break; - } - Command cmd = IPowerDownManager::getWakeUpCommand(powerDownStates[bank]); - ScheduledCommand pdn(cmd, startOfExitCommand, getExecutionTime(cmd, powerDownPayloads[bank]), + ScheduledCommand pdn(cmd, time, getExecutionTime(cmd, powerDownPayloads[bank]), DramExtension::getExtension(powerDownPayloads[bank])); + controller.getCommandChecker(cmd).delayToSatisfyConstraints(pdn); + + if (cmd == Command::SREFX) + controller.refreshManager->reInitialize(bank, pdn.getEnd()); setState(PowerDownState::Awake, bank); sendPowerDownPayload(pdn); @@ -108,7 +95,8 @@ void PowerDownManagerBankwise::wakeUpForRefresh(Bank bank, sc_time time) if (isInPowerDown(bank)) { Command cmd = IPowerDownManager::getWakeUpCommand(powerDownStates[bank]); - ScheduledCommand pdn(cmd, time, getExecutionTime(cmd, powerDownPayloads[bank]), DramExtension::getExtension(powerDownPayloads[bank])); + ScheduledCommand pdn(cmd, time, getExecutionTime(cmd, powerDownPayloads[bank]), + DramExtension::getExtension(powerDownPayloads[bank])); setState(PowerDownState::AwakeForRefresh, bank); sendPowerDownPayload(pdn); diff --git a/dram/src/core/scheduling/checker/ActivateChecker.cpp b/dram/src/core/scheduling/checker/ActivateChecker.cpp index 3ad821df..f949bf2e 100644 --- a/dram/src/core/scheduling/checker/ActivateChecker.cpp +++ b/dram/src/core/scheduling/checker/ActivateChecker.cpp @@ -19,8 +19,8 @@ namespace core { void ActivateChecker::delayToSatisfyConstraints(ScheduledCommand& command) const { sc_assert(command.getCommand() == Command::Activate); - ScheduledCommand lastCommandOnBank = state.getLastScheduledCommand(command.getBank()); + ScheduledCommand lastCommandOnBank = state.getLastScheduledCommand(command.getBank()); if (lastCommandOnBank.isValidCommand()) { if (isIn(lastCommandOnBank.getCommand(), { Command::Precharge, Command::AutoRefresh, diff --git a/dram/src/core/scheduling/checker/PowerDownChecker.cpp b/dram/src/core/scheduling/checker/PowerDownChecker.cpp new file mode 100644 index 00000000..0acec216 --- /dev/null +++ b/dram/src/core/scheduling/checker/PowerDownChecker.cpp @@ -0,0 +1,44 @@ +/* + * PowerDownChecker.cpp + * + * Created on: Apr 11, 2014 + * Author: jonny + */ + +#include "PowerDownChecker.h" + +namespace core { +void PowerDownChecker::delayToSatisfyConstraints(ScheduledCommand& command) const +{ + sc_assert( + command.commandIsIn( + { Command::SREF, Command::PDNA, Command::PDNP, Command::PDNAX, Command::PDNPX, Command::SREFX })); + + if (command.commandIsIn( { Command::SREF, Command::PDNA, Command::PDNP })) + { + ScheduledCommand lastCommandOnBank = state.getLastScheduledCommand(command.getBank()); + + if (lastCommandOnBank.isValidCommand() + && lastCommandOnBank.commandIsIn( { Command::Read, Command::ReadA, Command::WriteA })) + { + command.delayToMeetConstraint(lastCommandOnBank.getEnd(), config.Timings.clk); + } + } + else if (command.getCommand() == Command::PDNAX) + { + command.delayToMeetConstraint(state.getLastCommand(Command::PDNA).getStart(), config.Timings.tCKE); + } + else if (command.getCommand() == Command::PDNPX) + { + command.delayToMeetConstraint(state.getLastCommand(Command::PDNP).getStart(), config.Timings.tCKE); + } + else if (command.getCommand() == Command::SREFX) + { + command.delayToMeetConstraint(state.getLastCommand(Command::SREF).getStart(), config.Timings.tCKESR); + } + + state.bus.moveCommandToNextFreeSlot(command); +} + +} /* namespace core */ + diff --git a/dram/src/core/scheduling/checker/PowerDownChecker.h b/dram/src/core/scheduling/checker/PowerDownChecker.h new file mode 100644 index 00000000..24784d13 --- /dev/null +++ b/dram/src/core/scheduling/checker/PowerDownChecker.h @@ -0,0 +1,38 @@ +/* + * PowerDownChecker.h + * + * Created on: Apr 11, 2014 + * Author: jonny + */ + +#ifndef POWERDOWNCHECKER_H_ +#define POWERDOWNCHECKER_H_ + +#include "../../ControllerState.h" +#include "../../configuration/Configuration.h" +#include "ICommandChecker.h" +#include + +namespace core { + +class PowerDownChecker : public ICommandChecker +{ +public: + PowerDownChecker(const Configuration& config, ControllerState& state) : + config(config), state(state) + { + } + virtual ~PowerDownChecker() + { + } + + virtual void delayToSatisfyConstraints(ScheduledCommand& command) const override; + +private: + const Configuration& config; + ControllerState& state; +}; + +} /* namespace core */ + +#endif /* POWERDOWNCHECKER_H_ */ diff --git a/dram/src/core/scheduling/checker/PrechargeAllChecker.cpp b/dram/src/core/scheduling/checker/PrechargeAllChecker.cpp index 780462a6..2a0d93d4 100644 --- a/dram/src/core/scheduling/checker/PrechargeAllChecker.cpp +++ b/dram/src/core/scheduling/checker/PrechargeAllChecker.cpp @@ -43,7 +43,6 @@ void PrechargeAllChecker::delayToSatisfyConstraints(ScheduledCommand& command) c } else if (lastCommand.commandIsIn( { Command::ReadA, Command::AutoRefresh })) { - command.delayToMeetConstraint(lastCommand.getEnd(), SC_ZERO_TIME); } else diff --git a/dram/src/core/scheduling/checker/PrechargeChecker.cpp b/dram/src/core/scheduling/checker/PrechargeChecker.cpp index a365f7d0..b3bff928 100644 --- a/dram/src/core/scheduling/checker/PrechargeChecker.cpp +++ b/dram/src/core/scheduling/checker/PrechargeChecker.cpp @@ -12,9 +12,7 @@ namespace core { void PrechargeChecker::delayToSatisfyConstraints(ScheduledCommand& command) const { - sc_assert( - command.getCommand() == Command::Precharge - || command.getCommand() == Command::PrechargeAll); + sc_assert(command.getCommand() == Command::Precharge); ScheduledCommand lastCommand = state.getLastScheduledCommand(command.getBank()); @@ -23,7 +21,7 @@ void PrechargeChecker::delayToSatisfyConstraints(ScheduledCommand& command) cons if (lastCommand.getCommand() == Command::Read) { command.delayToMeetConstraint(lastCommand.getStart(), - max(config.Timings.tRTP , lastCommand.getIntervalOnDataStrobe().getLength())); + max(config.Timings.tRTP, lastCommand.getIntervalOnDataStrobe().getLength())); } else if (lastCommand.getCommand() == Command::Write) { @@ -31,11 +29,10 @@ void PrechargeChecker::delayToSatisfyConstraints(ScheduledCommand& command) cons } else if (lastCommand.getCommand() == Command::PDNAX) { - command.delayToMeetConstraint(lastCommand.getEnd(), config.Timings.tXP);//TODO right? + command.delayToMeetConstraint(lastCommand.getEnd(), config.Timings.tXP); } else - reportFatal("Precharge Checker", - "Precharge can not follow " + commandToString(lastCommand.getCommand())); + reportFatal("Precharge Checker", "Precharge can not follow " + commandToString(lastCommand.getCommand())); } state.bus.moveCommandToNextFreeSlot(command); diff --git a/dram/src/core/scheduling/checker/ReadChecker.cpp b/dram/src/core/scheduling/checker/ReadChecker.cpp index 6536904a..52d5879b 100644 --- a/dram/src/core/scheduling/checker/ReadChecker.cpp +++ b/dram/src/core/scheduling/checker/ReadChecker.cpp @@ -13,7 +13,9 @@ namespace core { void ReadChecker::delayToSatisfyConstraints(ScheduledCommand& command) const { - assert(command.getCommand() == Command::Read || command.getCommand() == Command::ReadA); + sc_assert(command.getCommand() == Command::Read || command.getCommand() == Command::ReadA); + + delayToSatisfyDLL(command); ScheduledCommand lastCommand = state.getLastScheduledCommand(command.getBank()); @@ -27,9 +29,9 @@ void ReadChecker::delayToSatisfyConstraints(ScheduledCommand& command) const || lastCommand.getCommand() == Command::Write) { } - else if (lastCommand.getCommand() == Command::PDNAX) + else if (lastCommand.getCommand() == Command::PDNAX || lastCommand.getCommand() == Command::PDNPX) { - command.delayToMeetConstraint(lastCommand.getStart(), config.Timings.tXP);//TODO DLL also for PDNP and SREF .. not onyl last command + command.delayToMeetConstraint(lastCommand.getStart(), config.Timings.tXP);//TODO DLL ?? } else reportFatal("Read Checker", @@ -42,6 +44,7 @@ void ReadChecker::delayToSatisfyConstraints(ScheduledCommand& command) const } } + bool ReadChecker::collidesOnDataStrobe(ScheduledCommand& read) const { for (ScheduledCommand& strobeCommand : state.lastDataStrobeCommands) @@ -97,4 +100,12 @@ bool ReadChecker::collidesWithStrobeCommand(ScheduledCommand& read, } } +void ReadChecker::delayToSatisfyDLL(ScheduledCommand& read) const +{ + ScheduledCommand lastSREFX = state.getLastCommand(Command::SREFX, read.getBank()); + if(lastSREFX.isValidCommand()) + read.delayToMeetConstraint(lastSREFX.getStart(), config.Timings.tXSRDLL); +} + } /* namespace controller */ + diff --git a/dram/src/core/scheduling/checker/ReadChecker.h b/dram/src/core/scheduling/checker/ReadChecker.h index 58af651e..78508a79 100644 --- a/dram/src/core/scheduling/checker/ReadChecker.h +++ b/dram/src/core/scheduling/checker/ReadChecker.h @@ -25,6 +25,8 @@ public: private: const Configuration& config; ControllerState& state; + + void delayToSatisfyDLL(ScheduledCommand& read) const; bool collidesOnDataStrobe(ScheduledCommand& read) const; bool collidesWithStrobeCommand(ScheduledCommand& read, ScheduledCommand& strobeCommand) const; }; diff --git a/dram/src/core/scheduling/checker/WriteChecker.cpp b/dram/src/core/scheduling/checker/WriteChecker.cpp index ad8f86ac..36b946c1 100644 --- a/dram/src/core/scheduling/checker/WriteChecker.cpp +++ b/dram/src/core/scheduling/checker/WriteChecker.cpp @@ -13,7 +13,7 @@ namespace core { void WriteChecker::delayToSatisfyConstraints(ScheduledCommand& command) const { - assert(command.getCommand() == Command::Write || command.getCommand() == Command::WriteA); + sc_assert(command.getCommand() == Command::Write || command.getCommand() == Command::WriteA); ScheduledCommand lastCommand = state.getLastScheduledCommand(command.getBank()); @@ -23,8 +23,7 @@ void WriteChecker::delayToSatisfyConstraints(ScheduledCommand& command) const { command.delayToMeetConstraint(lastCommand.getEnd(), SC_ZERO_TIME); } - else if (lastCommand.getCommand() == Command::Read - || lastCommand.getCommand() == Command::Write) + else if (lastCommand.getCommand() == Command::Read || lastCommand.getCommand() == Command::Write) { } @@ -33,8 +32,7 @@ void WriteChecker::delayToSatisfyConstraints(ScheduledCommand& command) const command.delayToMeetConstraint(lastCommand.getStart(), config.Timings.tXP); } else - reportFatal("Write Checker", - "Write can not follow " + commandToString(lastCommand.getCommand())); + reportFatal("Write Checker", "Write can not follow " + commandToString(lastCommand.getCommand())); } while (!state.bus.isFree(command.getStart()) || collidesOnDataStrobe(command)) @@ -54,12 +52,10 @@ bool WriteChecker::collidesOnDataStrobe(ScheduledCommand& write) const return false; } -bool WriteChecker::collidesWithStrobeCommand(ScheduledCommand& write, - ScheduledCommand& strobeCommand) const +bool WriteChecker::collidesWithStrobeCommand(ScheduledCommand& write, ScheduledCommand& strobeCommand) const { //write to write - if (strobeCommand.getCommand() == Command::Write - || strobeCommand.getCommand() == Command::WriteA) + if (strobeCommand.getCommand() == Command::Write || strobeCommand.getCommand() == Command::WriteA) { bool collision = write.collidesOnDataStrobe(strobeCommand); @@ -70,8 +66,7 @@ bool WriteChecker::collidesWithStrobeCommand(ScheduledCommand& write, return collision || casToCas; } - else if (strobeCommand.getCommand() == Command::Read - || strobeCommand.getCommand() == Command::ReadA) + else if (strobeCommand.getCommand() == Command::Read || strobeCommand.getCommand() == Command::ReadA) { //write to read if (strobeCommand.getStart() >= write.getStart()) @@ -80,8 +75,7 @@ bool WriteChecker::collidesWithStrobeCommand(ScheduledCommand& write, (write.getBank().getBankGroup() == strobeCommand.getBank().getBankGroup()) ? config.Timings.tWTR_L : config.Timings.tWTR_S; - return strobeCommand.getStart() - < clkAlign(write.getIntervalOnDataStrobe().end, Alignment::DOWN) + tWTR; + return strobeCommand.getStart() < clkAlign(write.getIntervalOnDataStrobe().end, Alignment::DOWN) + tWTR; } //read to write else @@ -92,8 +86,7 @@ bool WriteChecker::collidesWithStrobeCommand(ScheduledCommand& write, else { reportFatal("Write Checker", - "Invalid strobeCommand in data strobe commands " - + commandToString(strobeCommand.getCommand())); + "Invalid strobeCommand in data strobe commands " + commandToString(strobeCommand.getCommand())); return true; } } diff --git a/dram/src/scheduler/Fr_Fcfs.cpp b/dram/src/scheduler/Fr_Fcfs.cpp index e59bef5a..3ca88d90 100644 --- a/dram/src/scheduler/Fr_Fcfs.cpp +++ b/dram/src/scheduler/Fr_Fcfs.cpp @@ -85,7 +85,7 @@ gp* FR_FCFS::getTransactionForBank(Bank bank) gp* FR_FCFS::popOldest(Bank bank) { - assert(hasTransactionForBank(bank)); + sc_assert(hasTransactionForBank(bank)); gp* result = buffer[bank].front(); buffer[bank].pop_front(); diff --git a/dram/src/scheduler/PARBS.cpp b/dram/src/scheduler/PARBS.cpp index 7e357870..ba7c88cc 100644 --- a/dram/src/scheduler/PARBS.cpp +++ b/dram/src/scheduler/PARBS.cpp @@ -49,7 +49,7 @@ void PAR_BS::schedule(gp* payload) gp* PAR_BS::getTransactionForBank(Bank bank) { - assert(hasTransactionForBank(bank)); + sc_assert(hasTransactionForBank(bank)); if (batch->isEmpty()) { diff --git a/dram/src/simulation/Controller.h b/dram/src/simulation/Controller.h index 58aee120..d6bb0c02 100644 --- a/dram/src/simulation/Controller.h +++ b/dram/src/simulation/Controller.h @@ -89,7 +89,7 @@ public: virtual void send(const ScheduledCommand& command, tlm_generic_payload& payload) override { - assert(command.getStart() >= sc_time_stamp()); + sc_assert(command.getStart() >= sc_time_stamp()); TimeInterval dataStrobe; @@ -193,7 +193,7 @@ public: virtual void send(Trigger trigger, sc_time time, tlm_generic_payload& payload) override { - assert(time >= sc_time_stamp()); + sc_assert(time >= sc_time_stamp()); sc_time delay = time - sc_time_stamp(); if (trigger == Trigger::RefreshTrigger) @@ -250,6 +250,7 @@ private: printDebugMessage("Triggering schedule next payload on bank " + to_string(bank.ID())); if (scheduler->hasTransactionForBank(bank)) { + controller->powerDownManager->wakeUp(bank, sc_time_stamp()); if (controller->isBusy(sc_time_stamp(), bank)) { @@ -257,7 +258,6 @@ private: return; } - controller->powerDownManager->wakeUp(bank, sc_time_stamp()); tlm_generic_payload* nextTransaction = scheduler->getTransactionForBank(bank); if (controller->scheduleRequest(sc_time_stamp(), *nextTransaction)) diff --git a/dram/src/simulation/main.cpp b/dram/src/simulation/main.cpp index 8c67fa28..292f89c9 100644 --- a/dram/src/simulation/main.cpp +++ b/dram/src/simulation/main.cpp @@ -82,7 +82,7 @@ int sc_main(int argc, char **argv) DramSetup setup; setup.memconfig = "memconfig.xml"; setup.memspec = "MatzesWideIO.xml"; - //setup.memspec = "MICRON_4Gb_DDR4-1866_8bit_A.xml"; + setup.memspec = "MICRON_4Gb_DDR4-1866_8bit_A.xml"; DramSetup setup2; setup2.memconfig = "memconfig.xml"; @@ -95,10 +95,13 @@ int sc_main(int argc, char **argv) //batchTraces(setup, tracePairs); //batchSetups(tracePairs[0], {setup}); - string traceName("tpr.tdb"); + string traceName("tpr5.tdb"); string trace2 = "empty.stl"; string trace1 = "chstone-jpeg_32.stl"; + trace1 = "mediabench-adpcmencode_32.stl"; + //trace1 = "mediabench-h263encode_32.stl"; + //trace1 = "trace.stl";