diff --git a/dram/clean b/dram/clean new file mode 100755 index 00000000..66fe384d --- /dev/null +++ b/dram/clean @@ -0,0 +1,7 @@ +echo "Cleaning Up:" +echo " -->remove *.txt" +rm *.txt +echo " -->remove *.tdb-journal" +rm *.tdb +echo " -->remove *.tdb-journal" +rm *.tdb-journal \ No newline at end of file diff --git a/dram/src/common/DebugManager.cpp b/dram/src/common/DebugManager.cpp index 6ec24ec0..e11e42c8 100644 --- a/dram/src/common/DebugManager.cpp +++ b/dram/src/common/DebugManager.cpp @@ -15,15 +15,15 @@ DebugManager& DebugManager::getInstance() return manager; } -void DebugManager::printDebugMessage(string sender,string message) +void DebugManager::printDebugMessage(string sender, string message) { if (whiteList.count(sender)) { - if (printTime) - std::cout << " at " << sc_time_stamp(); - if (printLocation) - std::cout << " in " << sender; - cout << "\t: " << message << endl; + if (writeToConsole) + cout << " at " << sc_time_stamp() << "\t in " << sender << "\t: " << message << endl; + + if (writeToFile) + debugFile << " at " << sc_time_stamp().to_default_time_units() << " in " << sender << "\t: " << message << "\n"; } } @@ -34,8 +34,24 @@ void DebugManager::addToWhiteList(string sender) void DebugManager::addToWhiteList(vector senders) { - for(string sender: senders) + for (string sender : senders) addToWhiteList(sender); } +DebugManager::DebugManager() : + writeToConsole(true), writeToFile(true) +{ + debugFile.open("debug.txt"); +} +void DebugManager::setDebugFile(std::string filename) +{ + if(debugFile) + debugFile.close(); + debugFile.open(filename); +} + +DebugManager::~DebugManager() +{ + debugFile.close(); +} diff --git a/dram/src/common/DebugManager.h b/dram/src/common/DebugManager.h index ac8a2bb3..0e82c1e8 100644 --- a/dram/src/common/DebugManager.h +++ b/dram/src/common/DebugManager.h @@ -15,19 +15,25 @@ class DebugManager { public: + ~DebugManager(); static DebugManager& getInstance(); - bool printTime; - bool printLocation; + bool writeToConsole; + bool writeToFile; void printDebugMessage(std::string message, std::string sender); void addToWhiteList(std::string sender); void addToWhiteList(std::vector senders); + void setDebugFile(std::string filename); + private: - DebugManager() : printTime(true), printLocation(true) {}; - DebugManager(const DebugManager&); + + ofstream debugFile; + + DebugManager(); + DebugManager(const DebugManager&){}; std::set whiteList; diff --git a/dram/src/core/scheduling/ScheduledCommand.cpp b/dram/src/core/scheduling/ScheduledCommand.cpp index 1fc7ec2d..f1510b9e 100644 --- a/dram/src/core/scheduling/ScheduledCommand.cpp +++ b/dram/src/core/scheduling/ScheduledCommand.cpp @@ -63,6 +63,11 @@ Bank ScheduledCommand::getBank() const return extension.getBank(); } +BankGroup ScheduledCommand::getBankGroup() const +{ + return extension.getBankGroup(); +} + Row ScheduledCommand::getRow() const { return extension.getRow(); @@ -112,4 +117,3 @@ bool ScheduledCommand::collidesOnDataStrobe(const ScheduledCommand& cmd) const } } - diff --git a/dram/src/core/scheduling/ScheduledCommand.h b/dram/src/core/scheduling/ScheduledCommand.h index 5a56dcfe..9141cbe4 100644 --- a/dram/src/core/scheduling/ScheduledCommand.h +++ b/dram/src/core/scheduling/ScheduledCommand.h @@ -46,6 +46,7 @@ public: const sc_time getExecutionTime() const; Bank getBank() const; + BankGroup getBankGroup() const; Row getRow() const; unsigned int getBurstLength() const; diff --git a/dram/src/core/scheduling/checker/ActivateChecker.cpp b/dram/src/core/scheduling/checker/ActivateChecker.cpp index 994f8738..56ea5846 100644 --- a/dram/src/core/scheduling/checker/ActivateChecker.cpp +++ b/dram/src/core/scheduling/checker/ActivateChecker.cpp @@ -76,7 +76,7 @@ bool ActivateChecker::satsfies_activateToActivate_differentBank(ScheduledCommand { sc_time time = act.first; sc_time tRRD = - (getBankGroup(command.getBank()) == getBankGroup(act.second)) ? + (command.getBankGroup() == getBankGroup(act.second)) ? config.Timings.tRRD_L : config.Timings.tRRD_S; if ((time < command.getStart() && command.getStart() - time < tRRD) diff --git a/dram/src/core/scheduling/checker/ReadChecker.cpp b/dram/src/core/scheduling/checker/ReadChecker.cpp index 13748dd6..7720783e 100644 --- a/dram/src/core/scheduling/checker/ReadChecker.cpp +++ b/dram/src/core/scheduling/checker/ReadChecker.cpp @@ -62,7 +62,8 @@ sc_time ReadChecker::getExecutionTime(const tlm::tlm_generic_payload& payload, } else { - return getBurstLengthOnDataStrobe(payload.get_streaming_width()) + max(config.Timings.tRP, config.Timings.tRL); + return getBurstLengthOnDataStrobe(payload.get_streaming_width()) + + max(config.Timings.tRP, config.Timings.tRL); } } @@ -75,7 +76,7 @@ bool ReadChecker::collidesWithStrobeCommand(ScheduledCommand& read, bool collision = read.collidesOnDataStrobe(strobeCommand); sc_time tCCD = - (getBankGroup(read.getBank()) == getBankGroup(strobeCommand.getBank())) ? + (read.getBankGroup() == strobeCommand.getBankGroup()) ? config.Timings.tCCD_L : config.Timings.tCCD_S; bool casToCas = (getDistance(read.getStart(), strobeCommand.getStart()) < tCCD) ? true : false; @@ -94,7 +95,7 @@ bool ReadChecker::collidesWithStrobeCommand(ScheduledCommand& read, else { sc_time tWTR = - (getBankGroup(read.getBank()) == getBankGroup(strobeCommand.getBank())) ? + (read.getBankGroup() == strobeCommand.getBankGroup()) ? config.Timings.tWTR_L : config.Timings.tWTR_S; return read.getStart() diff --git a/dram/src/simulation/SimulationManager.cpp b/dram/src/simulation/SimulationManager.cpp index a56a1ffc..00ac55c8 100644 --- a/dram/src/simulation/SimulationManager.cpp +++ b/dram/src/simulation/SimulationManager.cpp @@ -61,7 +61,10 @@ Simulation::Simulation(sc_module_name name, string pathToResources, string trace whiteList.push_back(ControllerCore::senderName); whiteList.push_back(PowerDownManager::senderName); } - DebugManager::getInstance().addToWhiteList(whiteList); + + auto& dbg = DebugManager::getInstance(); + dbg.addToWhiteList(whiteList); + dbg.setDebugFile(traceName + ".txt"); } Simulation::~Simulation()