From 16cbd15f4728260e5e9558ad27a82710b5162273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Wed, 6 May 2015 10:51:07 +0200 Subject: [PATCH 1/9] Readme file updated with information about dramSys configuration --- README.md | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 136 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 49080653..bac9ac77 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ Generic DRAM controller simulator and debug tools related to it. # Basic Setup -In a terminal window execute the commands that follow (the '$' symbolizes the -terminal prompt). +In a terminal window execute the commands that follow. Go to your home directory. @@ -33,7 +32,7 @@ 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. +Go to the project directory. ``` $ cd dram.vp.system @@ -78,10 +77,130 @@ $ qmake ../dramSys/dramSys.pro $ make ``` - -# DRAMSys Resources +### DRAMSys Configuration -The simulator's configuration is done via some files. You can find such configuration files in the directory below and its sub-directories. +The **dramSys** executable supports one argument which is a XML file that +contains configurable aspects of the desired simulation. If no argument is +passed through the command line a default configuration file will be loaded. + +The XML code below shows a typical simulation configuration: + +``` + + + + + + + + + + + + + + + + + + + voco2.stl + + + +``` + +Some configuration fields reference other XML files which contain more +specialized chunks of the configuration, e.g. memory specification and address +mapping. + +The XML configuration files are parsed by the program and the configuration +details extracted are assigned to the correspondent attributes of the internal +configuration structure. + + +#### Configuration File Sections + +The main configuration file is divided into self-contained sections, each of +these sections is a set of logically related configuration aspects for the +simulation. + +The list below, which is not intended to be exhaustive, present the +configuration sections and possible configuration fields. + +- Simulator configuration + - Database recording + - Power analysis + - Debug mode + +- Memory specification + - Memory ID: JEDEC_256Mb_WIDEIO_SDR-200_128bit, + MICRON_4Gb_DDR4-2400_8bit_A, ... + - Memory type: WIDEIO_SD, DDR4, ... + +- Memory Architecture Specification + - Width + - Number of Banks + - Number of Ranks + - Number of Columns + - Number of Rows + - Data Rate + - Burst Length + +- Memory Timing Specification (memory dependent) + - Clock in MHz + - RC + - RCD + - RL + - RP + - RFC + - RAS + - WL + - AL + - DQSCK + - RTP + - WR + - XP + - XPDLL + - XS + - XSDLL + - REFI + - CL + - TAW + - RRD + - CCD + - WTR + - CKE + - CKESR + +- Memory Power Specification + +- Address Mapping + - Length: address length in bits + - Row: bits used for the row + - Bank: bits used for the bank + - Column: bits used for the column + +- Memory Configuration + - Bankwise Logic + - Open Page Policy + - Maximum Number of Transactions + - Scheduler + - Capacitor size + - Powerdown Mode + - Powerdown Timeout + - Chip seed + - CSV file + - Storage Mode value + + +Some attributes are self-explanatory while others require some previous +knowhow of memory technologies or some knowledge of the simulator source code. + +## DRAMSys Resources + +Some resources of the simulator are available in the **resources** directory +its sub-directories. ``` $ cd /projects/dram.vp.system/dram/resources @@ -89,9 +208,15 @@ $ 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. - * 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. +- **resources** + - **configs**: XML files used for configure specific details of the simulation. + - am_configs: address mapping configuration + - memconfigs: memory configuration + - memspecs: configuration related to the memory technology + - simconfigs: simulator configuration + - **scripts**: useful tools like address scrambler, trace analyser, database + creator, etc. + - **simulations**: global configuration + - **traces**: trace files for simulations. They contain accesses to memory + in certain known scenarios. From fd371795c7ab0658b206462fa0956a77dedf903a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Wed, 6 May 2015 11:33:58 +0200 Subject: [PATCH 2/9] Using relative paths instead of absolute paths in configuration files --- dram/resources/configs/memconfigs/fifo.xml | 3 ++- dram/resources/configs/memconfigs/fifoStrict.xml | 2 +- dram/resources/configs/memconfigs/fr_fcfs.xml | 2 +- dram/resources/simulations/sim-batch.xml | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dram/resources/configs/memconfigs/fifo.xml b/dram/resources/configs/memconfigs/fifo.xml index 094a261e..c37033bb 100644 --- a/dram/resources/configs/memconfigs/fifo.xml +++ b/dram/resources/configs/memconfigs/fifo.xml @@ -8,6 +8,7 @@ - + + diff --git a/dram/resources/configs/memconfigs/fifoStrict.xml b/dram/resources/configs/memconfigs/fifoStrict.xml index 64424430..36f48e64 100644 --- a/dram/resources/configs/memconfigs/fifoStrict.xml +++ b/dram/resources/configs/memconfigs/fifoStrict.xml @@ -8,6 +8,6 @@ - + diff --git a/dram/resources/configs/memconfigs/fr_fcfs.xml b/dram/resources/configs/memconfigs/fr_fcfs.xml index 546b3223..b5022068 100644 --- a/dram/resources/configs/memconfigs/fr_fcfs.xml +++ b/dram/resources/configs/memconfigs/fr_fcfs.xml @@ -8,7 +8,7 @@ - + + diff --git a/dram/resources/configs/memconfigs/fifoStrict.xml b/dram/resources/configs/memconfigs/fifoStrict.xml index 36f48e64..2bb773c9 100644 --- a/dram/resources/configs/memconfigs/fifoStrict.xml +++ b/dram/resources/configs/memconfigs/fifoStrict.xml @@ -9,5 +9,5 @@ - + diff --git a/dram/resources/configs/memconfigs/fr_fcfs.xml b/dram/resources/configs/memconfigs/fr_fcfs.xml index b5022068..de65253a 100644 --- a/dram/resources/configs/memconfigs/fr_fcfs.xml +++ b/dram/resources/configs/memconfigs/fr_fcfs.xml @@ -9,7 +9,7 @@ - + PowerAnalysis) --- dram/src/controller/core/configuration/Configuration.cpp | 4 ++-- dram/src/controller/core/configuration/Configuration.h | 2 +- dram/src/simulation/Dram.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dram/src/controller/core/configuration/Configuration.cpp b/dram/src/controller/core/configuration/Configuration.cpp index 43fa04fa..5d8449ff 100644 --- a/dram/src/controller/core/configuration/Configuration.cpp +++ b/dram/src/controller/core/configuration/Configuration.cpp @@ -103,8 +103,8 @@ void Configuration::setParameter(std::string name, std::string value) //SimConfig------------------------------------------------ else if(name == "DatabaseRecording") DatabaseRecording = string2bool(value); - else if(name == "PowerAnalysys") - PowerAnalysys = string2bool(value); + else if(name == "PowerAnalysis") + PowerAnalysis = string2bool(value); else if(name == "Debug") Debug = string2bool(value); //Specification for Chipseed, csvfile path and StorageMode diff --git a/dram/src/controller/core/configuration/Configuration.h b/dram/src/controller/core/configuration/Configuration.h index b50cd749..552c212b 100644 --- a/dram/src/controller/core/configuration/Configuration.h +++ b/dram/src/controller/core/configuration/Configuration.h @@ -42,7 +42,7 @@ struct Configuration //SimConfig bool DatabaseRecording = true; - bool PowerAnalysys = false; + bool PowerAnalysis = false; bool Debug = false; //MemSpec(from DRAM-Power XML) diff --git a/dram/src/simulation/Dram.h b/dram/src/simulation/Dram.h index 85f7f07c..d7497472 100644 --- a/dram/src/simulation/Dram.h +++ b/dram/src/simulation/Dram.h @@ -32,7 +32,7 @@ using namespace Data; //#define POWER //not better to define in simulation xml? also flag for storage simulation -//configuration->PowerAnalysys +//configuration->PowerAnalysis //configuration->ModelStorage //configuration->ModelErrotInjection From b3c5bf12b0ec3f909db54dc87fcfc089ec501e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Fri, 8 May 2015 14:18:50 +0200 Subject: [PATCH 5/9] Directory dram-power-original removed from repository. Its content was a duplicate of "dram.vp.system/dram/src/common/third_party/DRAMPower/memspecs". --- .../JEDEC_256Mb_WIDEIO_SDR-200_128bit.xml | 67 ------------------- .../JEDEC_256Mb_WIDEIO_SDR-266_128bit.xml | 67 ------------------- .../memspecs/MICRON_1Gb_DDR2-1066_16bit_H.xml | 55 --------------- .../memspecs/MICRON_1Gb_DDR2-800_16bit_H.xml | 55 --------------- .../memspecs/MICRON_1Gb_DDR3-1066_16bit_G.xml | 55 --------------- .../MICRON_1Gb_DDR3-1066_16bit_G_2s.xml | 55 --------------- .../MICRON_1Gb_DDR3-1066_16bit_G_3s.xml | 55 --------------- .../MICRON_1Gb_DDR3-1066_16bit_G_mu.xml | 55 --------------- .../memspecs/MICRON_1Gb_DDR3-1066_8bit_G.xml | 55 --------------- .../MICRON_1Gb_DDR3-1066_8bit_G_2s.xml | 55 --------------- .../MICRON_1Gb_DDR3-1066_8bit_G_3s.xml | 55 --------------- .../MICRON_1Gb_DDR3-1066_8bit_G_mu.xml | 55 --------------- .../memspecs/MICRON_1Gb_DDR3-1600_8bit_G.xml | 55 --------------- .../MICRON_1Gb_DDR3-1600_8bit_G_2s.xml | 55 --------------- .../MICRON_1Gb_DDR3-1600_8bit_G_3s.xml | 55 --------------- .../MICRON_1Gb_DDR3-1600_8bit_G_mu.xml | 55 --------------- .../MICRON_2GB_DDR3-1066_64bit_D_SODIMM.xml | 55 --------------- .../MICRON_2GB_DDR3-1066_64bit_G_UDIMM.xml | 55 --------------- .../MICRON_2GB_DDR3-1333_64bit_D_SODIMM.xml | 55 --------------- .../MICRON_2GB_DDR3-1600_64bit_G_UDIMM.xml | 55 --------------- .../memspecs/MICRON_2Gb_DDR3-1066_8bit_D.xml | 55 --------------- .../MICRON_2Gb_DDR3-1066_8bit_D_2s.xml | 55 --------------- .../MICRON_2Gb_DDR3-1066_8bit_D_3s.xml | 55 --------------- .../MICRON_2Gb_DDR3-1066_8bit_D_mu.xml | 55 --------------- .../memspecs/MICRON_2Gb_DDR3-1600_16bit_D.xml | 55 --------------- .../MICRON_2Gb_DDR3-1600_16bit_D_2s.xml | 55 --------------- .../MICRON_2Gb_DDR3-1600_16bit_D_3s.xml | 55 --------------- .../MICRON_2Gb_DDR3-1600_16bit_D_mu.xml | 55 --------------- .../memspecs/MICRON_2Gb_LPDDR-266_16bit_A.xml | 54 --------------- .../memspecs/MICRON_2Gb_LPDDR-333_16bit_A.xml | 54 --------------- .../MICRON_2Gb_LPDDR2-1066-S4_16bit_A.xml | 67 ------------------- .../MICRON_2Gb_LPDDR2-800-S4_16bit_A.xml | 67 ------------------- .../memspecs/MICRON_4Gb_DDR4-1866_8bit_A.xml | 62 ----------------- .../memspecs/MICRON_4Gb_DDR4-2400_8bit_A.xml | 62 ----------------- .../MICRON_4Gb_LPDDR3-1333_32bit_A.xml | 67 ------------------- .../MICRON_4Gb_LPDDR3-1600_32bit_A.xml | 67 ------------------- .../dram-power-original/memspecs/memspec.dtd | 13 ---- 37 files changed, 2077 deletions(-) delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/JEDEC_256Mb_WIDEIO_SDR-200_128bit.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/JEDEC_256Mb_WIDEIO_SDR-266_128bit.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR2-1066_16bit_H.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR2-800_16bit_H.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_2s.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_3s.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_mu.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_2s.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_3s.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_mu.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_2s.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_3s.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_mu.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1066_64bit_D_SODIMM.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1066_64bit_G_UDIMM.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1333_64bit_D_SODIMM.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1600_64bit_G_UDIMM.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_2s.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_3s.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_mu.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_2s.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_3s.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_mu.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR-266_16bit_A.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR-333_16bit_A.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR2-1066-S4_16bit_A.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR2-800-S4_16bit_A.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_DDR4-1866_8bit_A.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_DDR4-2400_8bit_A.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_LPDDR3-1333_32bit_A.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_LPDDR3-1600_32bit_A.xml delete mode 100644 dram/resources/configs/memspecs/dram-power-original/memspecs/memspec.dtd diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/JEDEC_256Mb_WIDEIO_SDR-200_128bit.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/JEDEC_256Mb_WIDEIO_SDR-200_128bit.xml deleted file mode 100644 index 0832dc3e..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/JEDEC_256Mb_WIDEIO_SDR-200_128bit.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/JEDEC_256Mb_WIDEIO_SDR-266_128bit.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/JEDEC_256Mb_WIDEIO_SDR-266_128bit.xml deleted file mode 100644 index 5c416e0d..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/JEDEC_256Mb_WIDEIO_SDR-266_128bit.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR2-1066_16bit_H.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR2-1066_16bit_H.xml deleted file mode 100644 index 1a58dbd7..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR2-1066_16bit_H.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR2-800_16bit_H.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR2-800_16bit_H.xml deleted file mode 100644 index a5ba9cc3..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR2-800_16bit_H.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G.xml deleted file mode 100644 index bbf85fda..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_2s.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_2s.xml deleted file mode 100644 index 0fd307ee..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_2s.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_3s.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_3s.xml deleted file mode 100644 index 5d6f85c4..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_3s.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_mu.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_mu.xml deleted file mode 100644 index 18db3b33..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_16bit_G_mu.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G.xml deleted file mode 100644 index 8e1ce348..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_2s.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_2s.xml deleted file mode 100644 index ce6d7de0..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_2s.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_3s.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_3s.xml deleted file mode 100644 index 616da5b5..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_3s.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_mu.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_mu.xml deleted file mode 100644 index 018b75b5..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1066_8bit_G_mu.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G.xml deleted file mode 100644 index 052f6773..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_2s.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_2s.xml deleted file mode 100644 index be3627c2..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_2s.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_3s.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_3s.xml deleted file mode 100644 index 2f7e3fc9..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_3s.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_mu.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_mu.xml deleted file mode 100644 index 14ec62e6..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_1Gb_DDR3-1600_8bit_G_mu.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1066_64bit_D_SODIMM.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1066_64bit_D_SODIMM.xml deleted file mode 100644 index 2545f2c1..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1066_64bit_D_SODIMM.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1066_64bit_G_UDIMM.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1066_64bit_G_UDIMM.xml deleted file mode 100644 index be78c1cb..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1066_64bit_G_UDIMM.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1333_64bit_D_SODIMM.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1333_64bit_D_SODIMM.xml deleted file mode 100644 index 0ed1dd8e..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1333_64bit_D_SODIMM.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1600_64bit_G_UDIMM.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1600_64bit_G_UDIMM.xml deleted file mode 100644 index 3ac0adaa..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2GB_DDR3-1600_64bit_G_UDIMM.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D.xml deleted file mode 100644 index 1fde2941..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_2s.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_2s.xml deleted file mode 100644 index 4cf932d9..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_2s.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_3s.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_3s.xml deleted file mode 100644 index d5821b24..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_3s.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_mu.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_mu.xml deleted file mode 100644 index 8f60dd9d..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1066_8bit_D_mu.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D.xml deleted file mode 100644 index ce8f92cf..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_2s.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_2s.xml deleted file mode 100644 index 70093b4b..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_2s.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_3s.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_3s.xml deleted file mode 100644 index a866e7c9..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_3s.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_mu.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_mu.xml deleted file mode 100644 index 9cda2f25..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_DDR3-1600_16bit_D_mu.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR-266_16bit_A.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR-266_16bit_A.xml deleted file mode 100644 index 657cf37c..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR-266_16bit_A.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR-333_16bit_A.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR-333_16bit_A.xml deleted file mode 100644 index 5a7d5c7e..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR-333_16bit_A.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR2-1066-S4_16bit_A.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR2-1066-S4_16bit_A.xml deleted file mode 100644 index 7a4fb08b..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR2-1066-S4_16bit_A.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR2-800-S4_16bit_A.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR2-800-S4_16bit_A.xml deleted file mode 100644 index fc5a9da1..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_2Gb_LPDDR2-800-S4_16bit_A.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_DDR4-1866_8bit_A.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_DDR4-1866_8bit_A.xml deleted file mode 100644 index 857a5113..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_DDR4-1866_8bit_A.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_DDR4-2400_8bit_A.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_DDR4-2400_8bit_A.xml deleted file mode 100644 index 1eabf24f..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_DDR4-2400_8bit_A.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_LPDDR3-1333_32bit_A.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_LPDDR3-1333_32bit_A.xml deleted file mode 100644 index 19780c3a..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_LPDDR3-1333_32bit_A.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_LPDDR3-1600_32bit_A.xml b/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_LPDDR3-1600_32bit_A.xml deleted file mode 100644 index e71930e1..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/MICRON_4Gb_LPDDR3-1600_32bit_A.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/dram-power-original/memspecs/memspec.dtd b/dram/resources/configs/memspecs/dram-power-original/memspecs/memspec.dtd deleted file mode 100644 index f94ed9e9..00000000 --- a/dram/resources/configs/memspecs/dram-power-original/memspecs/memspec.dtd +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - From 6ee652bdcafdada93e32c1573be54730d4dc3ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Fri, 8 May 2015 15:55:27 +0200 Subject: [PATCH 6/9] Typo fixed (PowerAnalysys --> PowerAnalysis) --- dram/resources/configs/simconfigs/simple.xml | 4 ++-- dram/resources/simulations/sim-batch.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dram/resources/configs/simconfigs/simple.xml b/dram/resources/configs/simconfigs/simple.xml index 2afec97e..4b3322c8 100644 --- a/dram/resources/configs/simconfigs/simple.xml +++ b/dram/resources/configs/simconfigs/simple.xml @@ -1,5 +1,5 @@ - + - \ No newline at end of file + diff --git a/dram/resources/simulations/sim-batch.xml b/dram/resources/simulations/sim-batch.xml index bf579499..f28d961a 100644 --- a/dram/resources/simulations/sim-batch.xml +++ b/dram/resources/simulations/sim-batch.xml @@ -2,7 +2,7 @@ - + @@ -28,7 +28,7 @@ - + From 48154a356db500dac3c3213a877c7e91ded48376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Fri, 8 May 2015 16:00:50 +0200 Subject: [PATCH 7/9] Added macro that creates enums with string conversion function automatically. --- dram/src/common/Utils.h | 41 ++++++++++++++++++- .../core/configuration/Configuration.h | 3 +- dram/src/simulation/Dram.h | 2 +- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/dram/src/common/Utils.h b/dram/src/common/Utils.h index acb5b93b..af637782 100644 --- a/dram/src/common/Utils.h +++ b/dram/src/common/Utils.h @@ -13,9 +13,10 @@ #include #include #include +#include +#include #include "dramExtension.h" #include "third_party/tinyxml2.h" -#include //TODO : move to timing specific header sc_time getDistance(sc_time a, sc_time b); @@ -87,5 +88,43 @@ double queryDoubleParameter(tinyxml2::XMLElement* node, std::string name); void setUpDummy(tlm::tlm_generic_payload& payload, Bank& bank); +// +// BOOST_PP_STRINGIZE(text) +// text will be converted to a string literal. +// +// BOOST_PP_SEQ_ENUM(enumerators) +// This macro expands to a comma-separated list of the elements in +// enumerators. +// +// BOOST_PP_SEQ_FOR_EACH(macro, data, seq) +// This macro is a repetition construct. If seq is (a)(b)(c), it expands to +// the sequence: macro(r, data, a) macro(r, data, b) macro(r, data, c) +// +// Note: this implementation requires that the enumerators map to unique +// values. +// +// See also: +// http://www.boost.org/doc/libs/1_38_0/libs/preprocessor/doc/ +// http://stackoverflow.com/questions/5093460/how-to-convert-an-enum-type-variable-to-a-string +// +#define X_DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS_TOSTRING_CASE(r, data, elem) \ + case data::elem : return BOOST_PP_STRINGIZE(elem); + +#define DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS(enumName, enumerators) \ + enum class enumName { \ + BOOST_PP_SEQ_ENUM(enumerators) \ + }; \ + \ + inline const char* ToString(enumName v) \ + { \ + switch (v) { \ + BOOST_PP_SEQ_FOR_EACH( \ + X_DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS_TOSTRING_CASE, \ + enumName, \ + enumerators \ + ) \ + default: return "[Unknown " BOOST_PP_STRINGIZE(name) "]"; \ + } \ + } #endif /* UTILS_COMMON_H_ */ diff --git a/dram/src/controller/core/configuration/Configuration.h b/dram/src/controller/core/configuration/Configuration.h index 552c212b..3cab2900 100644 --- a/dram/src/controller/core/configuration/Configuration.h +++ b/dram/src/controller/core/configuration/Configuration.h @@ -11,9 +11,10 @@ #include #include #include "MemSpec.h" +#include "../../../common/Utils.h" enum class EPowerDownMode{NoPowerDown, Staggered, TimeoutPDN, TimeoutSREF}; -enum class StorageMode{NoStorage, Store, ErrorModel}; +DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS(StorageMode, (NoStorage) (Store) (ErrorModel)); struct Configuration { diff --git a/dram/src/simulation/Dram.h b/dram/src/simulation/Dram.h index d7497472..c1fdfe45 100644 --- a/dram/src/simulation/Dram.h +++ b/dram/src/simulation/Dram.h @@ -61,7 +61,7 @@ struct Dram: sc_module IFPOW( MemorySpecification memSpec(MemSpecParser::getMemSpecFromXML(Configuration::getInstance().memspecUri)) ); IFPOW( DRAMPower = new libDRAMPower( memSpec, 0 ) ); - //cout << "StorageMode = " << StorMode << endl; + cout << "StorageMode = " << ToString(StorMode) << endl; if(StorMode == StorageMode::ErrorModel) { From 0fc640ad0ddaa7c4d269d78993827f9b38f69876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Mon, 11 May 2015 12:46:21 +0200 Subject: [PATCH 8/9] Enum class <-> string macro improved. The macro generates code for two functions: EnumToString() and StringToEnum(). Notes: 1. this macro creates a scoped enumeration (enum class) which favors code readability; 2. this implementation does not support assignment of values to enumerators and also does not support multiple enumerators with the same value. The first enumerator value is 0, the next is 1, and so on. Nevertheless, it is still useful for many cases; 3. if an invalid string is passed to StringToEnum() the program will be aborted and an error message describing the error will be displayed in the standard output. --- dram/src/common/Utils.h | 72 ++++++++++--------- .../core/configuration/Configuration.cpp | 17 +---- .../core/configuration/Configuration.h | 2 +- dram/src/simulation/Dram.h | 2 +- 4 files changed, 40 insertions(+), 53 deletions(-) diff --git a/dram/src/common/Utils.h b/dram/src/common/Utils.h index af637782..f3e8394e 100644 --- a/dram/src/common/Utils.h +++ b/dram/src/common/Utils.h @@ -88,43 +88,45 @@ double queryDoubleParameter(tinyxml2::XMLElement* node, std::string name); void setUpDummy(tlm::tlm_generic_payload& payload, Bank& bank); -// -// BOOST_PP_STRINGIZE(text) -// text will be converted to a string literal. -// -// BOOST_PP_SEQ_ENUM(enumerators) -// This macro expands to a comma-separated list of the elements in -// enumerators. -// -// BOOST_PP_SEQ_FOR_EACH(macro, data, seq) -// This macro is a repetition construct. If seq is (a)(b)(c), it expands to -// the sequence: macro(r, data, a) macro(r, data, b) macro(r, data, c) -// -// Note: this implementation requires that the enumerators map to unique -// values. -// -// See also: -// http://www.boost.org/doc/libs/1_38_0/libs/preprocessor/doc/ -// http://stackoverflow.com/questions/5093460/how-to-convert-an-enum-type-variable-to-a-string -// -#define X_DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS_TOSTRING_CASE(r, data, elem) \ +#define DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS_TOSTRING_CASE(r, data, elem) \ case data::elem : return BOOST_PP_STRINGIZE(elem); -#define DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS(enumName, enumerators) \ - enum class enumName { \ - BOOST_PP_SEQ_ENUM(enumerators) \ - }; \ - \ - inline const char* ToString(enumName v) \ - { \ - switch (v) { \ - BOOST_PP_SEQ_FOR_EACH( \ - X_DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS_TOSTRING_CASE, \ - enumName, \ - enumerators \ - ) \ - default: return "[Unknown " BOOST_PP_STRINGIZE(name) "]"; \ - } \ +#define DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS_TOENUM_IF(r, data, elem) \ + if (BOOST_PP_SEQ_TAIL(data) == BOOST_PP_STRINGIZE(elem)) \ + return BOOST_PP_SEQ_HEAD(data)::elem; else + +#define DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS(enumName, enumerators) \ + enum class enumName { \ + BOOST_PP_SEQ_ENUM(enumerators) \ + }; \ + \ + inline const char *EnumToString(enumName v) \ + { \ + switch (v) { \ + BOOST_PP_SEQ_FOR_EACH( \ + DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS_TOSTRING_CASE, \ + enumName, \ + enumerators \ + ) \ + default: return "[Unknown " BOOST_PP_STRINGIZE(name) "]"; \ + } \ + } \ + \ + inline enumName StringToEnum(std::string s) \ + { \ + BOOST_PP_SEQ_FOR_EACH( \ + DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS_TOENUM_IF, \ + (enumName)(s), \ + enumerators \ + ) \ + { \ + SC_REPORT_FATAL("Configuration", \ + ("Invalid string \"" + s + "\" for conversion into enum \"" \ + + BOOST_PP_STRINGIZE(enumName) + "\"").c_str() \ + ); \ + throw; \ + } \ } #endif /* UTILS_COMMON_H_ */ + diff --git a/dram/src/controller/core/configuration/Configuration.cpp b/dram/src/controller/core/configuration/Configuration.cpp index 5d8449ff..1314c61f 100644 --- a/dram/src/controller/core/configuration/Configuration.cpp +++ b/dram/src/controller/core/configuration/Configuration.cpp @@ -57,21 +57,6 @@ EPowerDownMode string2PDNMode(string s) } } -StorageMode string2StorageMode(string s) -{ - if (s == "NoStorage") - return StorageMode::NoStorage; - else if (s == "Store") - return StorageMode::Store; - else if (s == "ErrorModel") - return StorageMode::ErrorModel; - else - { - SC_REPORT_FATAL("Configuration", ("Unknown StorageMode: " + s).c_str()); - throw; - } -} - void Configuration::setParameter(std::string name, std::string value) { if(name == "BankwiseLogic") @@ -113,7 +98,7 @@ void Configuration::setParameter(std::string name, std::string value) else if(name == "csvfile") csvfile = value; else if(name == "StorMo") - StorMode = string2StorageMode(value); + StorMode = StringToEnum(value); else { SC_REPORT_FATAL("Configuration", ("Parameter " + name + " not defined in Configuration").c_str()); diff --git a/dram/src/controller/core/configuration/Configuration.h b/dram/src/controller/core/configuration/Configuration.h index 3cab2900..85a257d8 100644 --- a/dram/src/controller/core/configuration/Configuration.h +++ b/dram/src/controller/core/configuration/Configuration.h @@ -14,7 +14,7 @@ #include "../../../common/Utils.h" enum class EPowerDownMode{NoPowerDown, Staggered, TimeoutPDN, TimeoutSREF}; -DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS(StorageMode, (NoStorage) (Store) (ErrorModel)); +DEFINE_ENUM_CLASS_WITH_STRING_CONVERSIONS(StorageMode, (NoStorage)(Store)(ErrorModel)); struct Configuration { diff --git a/dram/src/simulation/Dram.h b/dram/src/simulation/Dram.h index c1fdfe45..a5315a4f 100644 --- a/dram/src/simulation/Dram.h +++ b/dram/src/simulation/Dram.h @@ -61,7 +61,7 @@ struct Dram: sc_module IFPOW( MemorySpecification memSpec(MemSpecParser::getMemSpecFromXML(Configuration::getInstance().memspecUri)) ); IFPOW( DRAMPower = new libDRAMPower( memSpec, 0 ) ); - cout << "StorageMode = " << ToString(StorMode) << endl; + cout << "StorageMode: " << EnumToString(StorMode) << endl; if(StorMode == StorageMode::ErrorModel) { From 9846a56da4812f20fb50a0d1cd3ef4075182a2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Ferreira=20Zulian?= Date: Mon, 11 May 2015 14:08:39 +0200 Subject: [PATCH 9/9] Some names slightly changed to better describe their purpose. ChipSeed --> ErrorChipSeed csvfile --> ErrorCSVFile StorMo --> ErrorStoreMode StorMode --> ErrorStoreMode StorageMode --> ErrorStorageMode (Changes after code review) --- dram/resources/configs/memconfigs/fifo.xml | 7 ++--- .../configs/memconfigs/fifoStrict.xml | 6 ++-- dram/resources/configs/memconfigs/fr_fcfs.xml | 6 ++-- .../core/configuration/Configuration.cpp | 14 +++++----- .../core/configuration/Configuration.h | 10 +++---- dram/src/error/flip_memory.cpp | 4 +-- dram/src/simulation/Dram.h | 28 +++++++++---------- 7 files changed, 37 insertions(+), 38 deletions(-) diff --git a/dram/resources/configs/memconfigs/fifo.xml b/dram/resources/configs/memconfigs/fifo.xml index 97064ad2..6d1fd110 100644 --- a/dram/resources/configs/memconfigs/fifo.xml +++ b/dram/resources/configs/memconfigs/fifo.xml @@ -7,8 +7,7 @@ - - - - + + + diff --git a/dram/resources/configs/memconfigs/fifoStrict.xml b/dram/resources/configs/memconfigs/fifoStrict.xml index 2bb773c9..ac3522ef 100644 --- a/dram/resources/configs/memconfigs/fifoStrict.xml +++ b/dram/resources/configs/memconfigs/fifoStrict.xml @@ -7,7 +7,7 @@ - - - + + + diff --git a/dram/resources/configs/memconfigs/fr_fcfs.xml b/dram/resources/configs/memconfigs/fr_fcfs.xml index de65253a..4285a3cb 100644 --- a/dram/resources/configs/memconfigs/fr_fcfs.xml +++ b/dram/resources/configs/memconfigs/fr_fcfs.xml @@ -7,9 +7,9 @@ - - - + + +