From ed4b406954614858a962430f71888c545f560921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Tue, 21 Apr 2015 14:41:14 +0200 Subject: [PATCH 1/9] Readme file improved but not yet finished. Added *.swp (vim swap files extension) to gititnore. --- .gitignore | 1 + README.md | 42 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 897984aa..fe3e5e06 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ dram/build-*/ ._.DS_Store .DS_Store +*.swp diff --git a/README.md b/README.md index 59e654e9..3607b6fb 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,46 @@ de.uni-kl.ems.dram.vp.system ============================ -Generic DRAM controller +Generic DRAM controller simulator and debug tools related to it. -#Setup with QTCreator +# Basic Setup -needs update! +In a terminal window execute the commands that follow (the '$' symbolizes the +terminal prompt). - +Go to your home directory. +$ cd + +Create a directory for your projects. +$ mkdir projects + +Clone the repository (in case of doubts about which repository you should +clone ask your supervisor). +$ git clone https://@git.rhrk.uni-kl.de//dram.vp.system.git + +Go to the projetct directory +$ cd dram.vp.system + +Execute the script that follows. +$ install_prerequisites.sh + +## With QTCreator +Execute the *qtcreator*. +$ qtcreator & + +Use the menu bar and open the DRAMSys project. +**File -> Open Project -> dram.vp.sys/dram/dramSys/dramSys.pro** + +When you open the project for the first time a configuration window pops-up. +Then click in **Configure Project** and after that **Build** the project. + + +## Without QTCreator + +$ cd dram +$ mkdir build +$ cd build +$ qmake ../dramSys/dramSys.pro +$ make From ffb8f38a9afa09c3c39730bc2dd408c725f57912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Tue, 21 Apr 2015 15:51:07 +0200 Subject: [PATCH 2/9] Added more information about configuration files. --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/README.md b/README.md index 3607b6fb..37e41f12 100644 --- a/README.md +++ b/README.md @@ -9,38 +9,80 @@ In a terminal window execute the commands that follow (the '$' symbolizes the terminal prompt). Go to your home directory. + +``` $ cd +``` Create a directory for your projects. + +``` $ mkdir projects +``` Clone the repository (in case of doubts about which repository you should clone ask your supervisor). + +``` $ git clone https://@git.rhrk.uni-kl.de//dram.vp.system.git +``` Go to the projetct directory + +``` $ cd dram.vp.system +``` Execute the script that follows. + +``` $ install_prerequisites.sh +``` + ## With QTCreator Execute the *qtcreator*. + +``` $ qtcreator & +``` Use the menu bar and open the DRAMSys project. + **File -> Open Project -> dram.vp.sys/dram/dramSys/dramSys.pro** When you open the project for the first time a configuration window pops-up. Then click in **Configure Project** and after that **Build** the project. +Repeat this procedure and build the trace analyser project. + +**File -> Open Project -> dram.vp.sys/analyser/analyser/traceAnalizer.pro** + ## Without QTCreator +``` $ cd dram $ mkdir build $ cd build $ qmake ../dramSys/dramSys.pro $ make +``` + + +# DRAMSys Resources + +The simulator's config is done via several files. One can find such configuration files in the directory below. + +``` +$ cd /projects/dram.vp.system/dram/resources +``` + +* resources + * configs - XML files used for configurate specific details of the simulation. + * scripts - useful tools (debuging, configuration, etc.). + * simulations - global configs for simulations (debug mode, power analysis and database recording, etc.) + * traces - trace files for simulations. They contain accesses to memory in certain known scenarios. + From 1cb13725e2b9901dec2cfae81497fcee2a6c1564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Tue, 21 Apr 2015 15:58:28 +0200 Subject: [PATCH 3/9] Text enhanced. --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 37e41f12..bd96e8d1 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ clone ask your supervisor). $ git clone https://@git.rhrk.uni-kl.de//dram.vp.system.git ``` -Go to the projetct directory +Go to the projetct directory. ``` $ cd dram.vp.system @@ -54,7 +54,7 @@ Use the menu bar and open the DRAMSys project. When you open the project for the first time a configuration window pops-up. Then click in **Configure Project** and after that **Build** the project. -Repeat this procedure and build the trace analyser project. +Repeat the procedure above and build the trace analyser project. **File -> Open Project -> dram.vp.sys/analyser/analyser/traceAnalizer.pro** @@ -72,12 +72,14 @@ $ make # DRAMSys Resources -The simulator's config is done via several files. One can find such configuration files in the directory below. +The simulator's configuration is done via some files. You can find such configuration files in the directory below and its sub-directories. ``` $ cd /projects/dram.vp.system/dram/resources ``` +A short description of the content each directory follows. + * resources * configs - XML files used for configurate specific details of the simulation. * scripts - useful tools (debuging, configuration, etc.). From 378544be26a167fa9839d318bb50b90cc50e11de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Tue, 21 Apr 2015 16:03:40 +0200 Subject: [PATCH 4/9] Minor changes in text --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bd96e8d1..27329026 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Go to the projetct directory. $ cd dram.vp.system ``` -Execute the script that follows. +Execute the script below. ``` $ install_prerequisites.sh @@ -82,8 +82,8 @@ A short description of the content each directory follows. * resources * configs - XML files used for configurate specific details of the simulation. - * scripts - useful tools (debuging, configuration, etc.). - * simulations - global configs for simulations (debug mode, power analysis and database recording, etc.) + * scripts - useful tools. + * simulations - global configs for simulations: debug mode, power analysis and database recording. Also includes specific configuration files. * traces - trace files for simulations. They contain accesses to memory in certain known scenarios. From 5898be7c6704caa1247611497c51afaf5980d74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Tue, 21 Apr 2015 16:08:22 +0200 Subject: [PATCH 5/9] Text enhanced --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 27329026..8b3f783e 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,6 @@ A short description of the content each directory follows. * resources * configs - XML files used for configurate specific details of the simulation. * scripts - useful tools. - * simulations - global configs for simulations: debug mode, power analysis and database recording. Also includes specific configuration files. + * simulations - global configs for simulations: debug mode, power analysis and database recording. Some specific configuration files are referenced in the global configuration file. * traces - trace files for simulations. They contain accesses to memory in certain known scenarios. - - From ce7f85c3e11c4d68c2fa66aefffc4e8e4d9ef5c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Tue, 21 Apr 2015 16:54:07 +0200 Subject: [PATCH 6/9] Some fixes after review. --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8b3f783e..49080653 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,14 @@ Create a directory for your projects. $ mkdir projects ``` -Clone the repository (in case of doubts about which repository you should -clone ask your supervisor). +Clone the repository. + +It is possible that you will work with a **fork** of the official codebase. A +fork is a copy of a repository. In that case, after pushing changes into your +copy you should create a **pull request** in order to your supervisor check +and possibly bring your changes to the official codebase. + +In case of doubts about which repository you should clone ask your supervisor. ``` $ git clone https://@git.rhrk.uni-kl.de//dram.vp.system.git @@ -36,12 +42,12 @@ $ cd dram.vp.system Execute the script below. ``` -$ install_prerequisites.sh +$ ./install_prerequisites.sh ``` ## With QTCreator -Execute the *qtcreator*. +Execute the *QTCreator*. ``` $ qtcreator & @@ -61,6 +67,9 @@ Repeat the procedure above and build the trace analyser project. ## Without QTCreator +In case you prefer a command line interface to the QTCreator GUI you can also +use **qmake** to generate a Makefile and then compile the project. + ``` $ cd dram $ mkdir build From 6cf6c6be95598bc91fb1268aa3949f41f9b21e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Fri, 24 Apr 2015 09:11:25 +0200 Subject: [PATCH 7/9] Warnings eliminated. Variable surrounded by IFPOW() macro since it is only needed for power simulations. Unused variable removed. Warning suppressed with __attribute__((__unused__)). The variable was not removed because of its type: sc_module_name. It may be useful. Other changes: cscope* added to gitignore. --- .gitignore | 1 + dram/src/simulation/Dram.h | 2 +- dram/src/simulation/Simulation.cpp | 6 +++--- dram/src/simulation/Simulation.h | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index fe3e5e06..7c5afac7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ dram/build-*/ ._.DS_Store .DS_Store *.swp +cscope* diff --git a/dram/src/simulation/Dram.h b/dram/src/simulation/Dram.h index fd0cfc83..79e1aa5d 100644 --- a/dram/src/simulation/Dram.h +++ b/dram/src/simulation/Dram.h @@ -93,7 +93,7 @@ struct Dram: sc_module TlmRecorder::getInstance().recordPhase(payload, phase, sc_time_stamp() + delay); // This is only needed for power simulation: - unsigned long long cycle = sc_time_stamp().value()/Configuration::getInstance().memSpec.clk.value(); + IFPOW(unsigned long long cycle = sc_time_stamp().value()/Configuration::getInstance().memSpec.clk.value()); unsigned int bank = DramExtension::getExtension(payload).getBank().ID(); if (phase == BEGIN_PRE) diff --git a/dram/src/simulation/Simulation.cpp b/dram/src/simulation/Simulation.cpp index b2688f86..7cbf8851 100644 --- a/dram/src/simulation/Simulation.cpp +++ b/dram/src/simulation/Simulation.cpp @@ -21,7 +21,7 @@ using namespace std; -Simulation::Simulation(sc_module_name /*name*/, string pathToResources, string traceName, DramSetup setup, +Simulation::Simulation(sc_module_name __attribute__((__unused__)) name, string pathToResources, string traceName, DramSetup setup, std::vector devices) : traceName(traceName), dramSetup(setup) @@ -35,7 +35,7 @@ Simulation::Simulation(sc_module_name /*name*/, string pathToResources, string t ConfigurationLoader::loadMemSpec(Configuration::getInstance(), setup.memspec);//pathToResources + string("configs/memspecs/") + setup.memspec); ConfigurationLoader::loadSimConfig(Configuration::getInstance(), setup.simconfig); - setupTlmRecorder(traceName, pathToResources, setup, devices); + setupTlmRecorder(traceName, pathToResources, devices); instantiateModules(pathToResources, devices); bindSockets(); setupDebugManager(traceName); @@ -51,7 +51,7 @@ void Simulation::setupDebugManager(const string& traceName) dbg.openDebugFile(traceName + ".txt"); } -void Simulation::setupTlmRecorder(const string &traceName, const string &pathToResources, const DramSetup &setup, const std::vector &devices) +void Simulation::setupTlmRecorder(const string &traceName, const string &pathToResources, const std::vector &devices) { if(Configuration::getInstance().DatabaseRecording) { diff --git a/dram/src/simulation/Simulation.h b/dram/src/simulation/Simulation.h index 060803c4..f398b2f9 100644 --- a/dram/src/simulation/Simulation.h +++ b/dram/src/simulation/Simulation.h @@ -46,6 +46,7 @@ class Simulation: public sc_module, public TracePlayerListener { public: SC_HAS_PROCESS(Simulation); + //Simulation(sc_module_name name, string pathToResources, string traceName, std::vector devices); Simulation(sc_module_name name, string pathToResources, string traceName, DramSetup setup, std::vector devices); ~Simulation(); @@ -75,7 +76,7 @@ private: clock_t simulationStartTime; void report(std::string message); void setupDebugManager(const string& traceName); - void setupTlmRecorder(const string &traceName, const string &pathToResources, const DramSetup &setup, const std::vector &devices); + void setupTlmRecorder(const string &traceName, const string &pathToResources, const std::vector &devices); void instantiateModules(const string &pathToResources, const std::vector &devices); void bindSockets(); }; From 18025343cd6e4baca9c16e839af8f70abbee00ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Fri, 24 Apr 2015 11:20:44 +0200 Subject: [PATCH 8/9] Warnings eliminated. Variables initialized. Variables removed with small changes in the code accordingly. Some warnings suppressed with __attribute__((unused)). --- dram/src/common/Utils.cpp | 17 +++++++---------- .../controller/core/refresh/RefreshManager.cpp | 4 ++-- .../core/scheduling/checker/WriteChecker.cpp | 2 +- dram/src/simulation/Simulation.cpp | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/dram/src/common/Utils.cpp b/dram/src/common/Utils.cpp index 82a96635..8b9af361 100644 --- a/dram/src/common/Utils.cpp +++ b/dram/src/common/Utils.cpp @@ -41,7 +41,7 @@ std::string phaseNameToString(tlm::tlm_phase phase) unsigned int queryUIntParameter(XMLElement* node, string name) { - int result; + int result = 0; XMLElement* element; for (element = node->FirstChildElement("parameter"); element != NULL; element = element->NextSiblingElement("parameter")) @@ -49,8 +49,7 @@ unsigned int queryUIntParameter(XMLElement* node, string name) if (element->Attribute("id") == name) { sc_assert(!strcmp(element->Attribute("type"), "uint")); - XMLError error = element->QueryIntAttribute("value", &result); - sc_assert(!error); + sc_assert(element->QueryIntAttribute("value", &result) == XML_NO_ERROR); return result; } } @@ -75,7 +74,7 @@ bool parameterExists(tinyxml2::XMLElement* node, std::string name) double queryDoubleParameter(XMLElement* node, string name) { - double result; + double result = 0; XMLElement* element; for (element = node->FirstChildElement("parameter"); element != NULL; element = element->NextSiblingElement("parameter")) @@ -83,8 +82,7 @@ double queryDoubleParameter(XMLElement* node, string name) if (element->Attribute("id") == name) { sc_assert(!strcmp(element->Attribute("type"), "double")); - XMLError error = element->QueryDoubleAttribute("value", &result); - sc_assert(!error); + sc_assert(element->QueryDoubleAttribute("value", &result) == XML_NO_ERROR); return result; } } @@ -95,7 +93,7 @@ double queryDoubleParameter(XMLElement* node, string name) bool queryBoolParameter(XMLElement* node, string name) { - bool result; + bool result = false; XMLElement* element;// = node->FirstChildElement("parameter"); for (element = node->FirstChildElement("parameter"); element != NULL; element = element->NextSiblingElement("parameter")) @@ -103,8 +101,7 @@ bool queryBoolParameter(XMLElement* node, string name) if (element->Attribute("id") == name) { sc_assert(!strcmp(element->Attribute("type"), "bool")); - XMLError error = element->QueryBoolAttribute("value", &result); - sc_assert(!error); + sc_assert(element->QueryBoolAttribute("value", &result) == XML_NO_ERROR); return result; } } @@ -151,7 +148,7 @@ string errorToString(XMLError error) case XML_ERROR_PARSING: return "ERROR_PARSING"; case XML_CAN_NOT_CONVERT_TEXT: return "CAN_NOT_CONVERT_TEXT"; case XML_NO_TEXT_NODE: return "NO_TEXT_NODE"; - default: ""; + default: return ""; } } diff --git a/dram/src/controller/core/refresh/RefreshManager.cpp b/dram/src/controller/core/refresh/RefreshManager.cpp index 2953e766..2b7ed16c 100644 --- a/dram/src/controller/core/refresh/RefreshManager.cpp +++ b/dram/src/controller/core/refresh/RefreshManager.cpp @@ -32,7 +32,7 @@ bool RefreshManager::hasCollision(const ScheduledCommand& command) return command.getStart() < controllerCore.state.getLastCommand(Command::AutoRefresh).getEnd() || command.getEnd() > nextPlannedRefresh; } -void RefreshManager::scheduleRefresh(tlm::tlm_generic_payload& payload, sc_time time) +void RefreshManager::scheduleRefresh(tlm::tlm_generic_payload& payload __attribute((unused)), sc_time time) { sc_assert(!isInvalidated(payload, time)); @@ -78,7 +78,7 @@ void RefreshManager::reInitialize(Bank /*bank*/, sc_time time) planNextRefresh(); } -bool RefreshManager::isInvalidated(tlm::tlm_generic_payload& payload, sc_time time) +bool RefreshManager::isInvalidated(tlm::tlm_generic_payload& payload __attribute((unused)), sc_time time) { return nextPlannedRefresh > time; } diff --git a/dram/src/controller/core/scheduling/checker/WriteChecker.cpp b/dram/src/controller/core/scheduling/checker/WriteChecker.cpp index 1d5321af..04de71ea 100644 --- a/dram/src/controller/core/scheduling/checker/WriteChecker.cpp +++ b/dram/src/controller/core/scheduling/checker/WriteChecker.cpp @@ -87,7 +87,7 @@ sc_time WriteChecker::writeToWrite(ScheduledCommand& firstWrite, ScheduledComman return max(tCCD, getWriteAccessTime()); } -sc_time WriteChecker::readToWrite(ScheduledCommand& read, ScheduledCommand& write) +sc_time WriteChecker::readToWrite(ScheduledCommand& read __attribute__((unused)), ScheduledCommand& write __attribute__((unused))) { sc_assert(read.getCommand() == Command::Read || read.getCommand() == Command::ReadA); sc_assert(write.getCommand() == Command::Write || write.getCommand() == Command::WriteA); diff --git a/dram/src/simulation/Simulation.cpp b/dram/src/simulation/Simulation.cpp index 7cbf8851..6cf56175 100644 --- a/dram/src/simulation/Simulation.cpp +++ b/dram/src/simulation/Simulation.cpp @@ -21,7 +21,7 @@ using namespace std; -Simulation::Simulation(sc_module_name __attribute__((__unused__)) name, string pathToResources, string traceName, DramSetup setup, +Simulation::Simulation(sc_module_name __attribute__((unused)) name, string pathToResources, string traceName, DramSetup setup, std::vector devices) : traceName(traceName), dramSetup(setup) From 41993d87b5a17e0e67574e39d950e8d575b31407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Mon, 27 Apr 2015 14:36:09 +0200 Subject: [PATCH 9/9] Segfalut caused by misuse of sc_assert() fixed. --- dram/src/common/Utils.cpp | 9 ++++++--- dram/src/controller/core/refresh/RefreshManager.cpp | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dram/src/common/Utils.cpp b/dram/src/common/Utils.cpp index 8b9af361..a8693c68 100644 --- a/dram/src/common/Utils.cpp +++ b/dram/src/common/Utils.cpp @@ -49,7 +49,8 @@ unsigned int queryUIntParameter(XMLElement* node, string name) if (element->Attribute("id") == name) { sc_assert(!strcmp(element->Attribute("type"), "uint")); - sc_assert(element->QueryIntAttribute("value", &result) == XML_NO_ERROR); + XMLError __attribute__((unused)) error = element->QueryIntAttribute("value", &result); + sc_assert(!error); return result; } } @@ -82,7 +83,8 @@ double queryDoubleParameter(XMLElement* node, string name) if (element->Attribute("id") == name) { sc_assert(!strcmp(element->Attribute("type"), "double")); - sc_assert(element->QueryDoubleAttribute("value", &result) == XML_NO_ERROR); + XMLError __attribute__((unused)) error = element->QueryDoubleAttribute("value", &result); + sc_assert(!error); return result; } } @@ -101,7 +103,8 @@ bool queryBoolParameter(XMLElement* node, string name) if (element->Attribute("id") == name) { sc_assert(!strcmp(element->Attribute("type"), "bool")); - sc_assert(element->QueryBoolAttribute("value", &result) == XML_NO_ERROR); + XMLError __attribute__((unused)) error = element->QueryBoolAttribute("value", &result); + sc_assert(!error); return result; } } diff --git a/dram/src/controller/core/refresh/RefreshManager.cpp b/dram/src/controller/core/refresh/RefreshManager.cpp index 2b7ed16c..9a635adb 100644 --- a/dram/src/controller/core/refresh/RefreshManager.cpp +++ b/dram/src/controller/core/refresh/RefreshManager.cpp @@ -32,7 +32,7 @@ bool RefreshManager::hasCollision(const ScheduledCommand& command) return command.getStart() < controllerCore.state.getLastCommand(Command::AutoRefresh).getEnd() || command.getEnd() > nextPlannedRefresh; } -void RefreshManager::scheduleRefresh(tlm::tlm_generic_payload& payload __attribute((unused)), sc_time time) +void RefreshManager::scheduleRefresh(tlm::tlm_generic_payload& payload __attribute__((unused)), sc_time time) { sc_assert(!isInvalidated(payload, time)); @@ -78,7 +78,7 @@ void RefreshManager::reInitialize(Bank /*bank*/, sc_time time) planNextRefresh(); } -bool RefreshManager::isInvalidated(tlm::tlm_generic_payload& payload __attribute((unused)), sc_time time) +bool RefreshManager::isInvalidated(tlm::tlm_generic_payload& payload __attribute__((unused)), sc_time time) { return nextPlannedRefresh > time; }