1/* 2 * Copyright (c) 2012-2014, TU Delft 3 * Copyright (c) 2012-2014, TU Eindhoven 4 * Copyright (c) 2012-2014, TU Kaiserslautern 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are 9 * met: 10 * 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * 3. Neither the name of the copyright holder nor the names of its 19 * contributors may be used to endorse or promote products derived from 20 * this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 23 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 *
| 1/* 2 * Copyright (c) 2012-2014, TU Delft 3 * Copyright (c) 2012-2014, TU Eindhoven 4 * Copyright (c) 2012-2014, TU Kaiserslautern 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are 9 * met: 10 * 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * 3. Neither the name of the copyright holder nor the names of its 19 * contributors may be used to endorse or promote products derived from 20 * this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 23 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 *
|
34 * Authors: Karthik Chandrasekar, Matthias Jung, Omar Naji
| 34 * Authors: Karthik Chandrasekar 35 * Matthias Jung 36 * Omar Naji 37 * Subash Kannoth 38 * Éder F. Zulian 39 * Felipe S. Prado
|
35 * 36 */ 37 38#ifndef MEMORY_POWER_MODEL_H 39#define MEMORY_POWER_MODEL_H 40
| 40 * 41 */ 42 43#ifndef MEMORY_POWER_MODEL_H 44#define MEMORY_POWER_MODEL_H 45
|
| 46#include <numeric>
|
41#include "MemorySpecification.h"
| 47#include "MemorySpecification.h"
|
| 48#include "MemBankWiseParams.h"
|
42#include "CommandAnalysis.h" 43 44namespace Data { 45class MemoryPowerModel { 46 public:
| 49#include "CommandAnalysis.h" 50 51namespace Data { 52class MemoryPowerModel { 53 public:
|
| 54 55 MemoryPowerModel(); 56
|
47 // Calculate energy and average power consumption for the given memory 48 // command trace 49 void power_calc(const MemorySpecification& memSpec, 50 const CommandAnalysis& c,
| 57 // Calculate energy and average power consumption for the given memory 58 // command trace 59 void power_calc(const MemorySpecification& memSpec, 60 const CommandAnalysis& c,
|
51 int term);
| 61 int term, 62 const MemBankWiseParams& bwPowerParams);
|
52 53 // Used to calculate self-refresh active energy 54 static double engy_sref(double idd6, 55 double idd3n, 56 double idd5, 57 double vdd,
| 63 64 // Used to calculate self-refresh active energy 65 static double engy_sref(double idd6, 66 double idd3n, 67 double idd5, 68 double vdd,
|
58 double sref_cycles,
| 69 double sref_cycles_idd6,
|
59 double sref_ref_act_cycles, 60 double sref_ref_pre_cycles, 61 double spup_ref_act_cycles, 62 double spup_ref_pre_cycles, 63 double clk);
| 70 double sref_ref_act_cycles, 71 double sref_ref_pre_cycles, 72 double spup_ref_act_cycles, 73 double spup_ref_pre_cycles, 74 double clk);
|
| 75 static double engy_sref_banks(double idd6, 76 double idd3n, 77 double idd5, 78 double vdd, 79 double sref_cycles, 80 double sref_ref_act_cycles, 81 double sref_ref_pre_cycles, 82 double spup_ref_act_cycles, 83 double spup_ref_pre_cycles, 84 double clk, 85 double esharedPASR, 86 const MemBankWiseParams& bwPowerParams, 87 unsigned bnkIdx, 88 int64_t nbrofBanks);
|
64 65 int64_t total_cycles; 66
| 89 90 int64_t total_cycles; 91
|
| 92 int64_t window_cycles; 93
|
67 struct Energy { 68 // Total energy of all activates 69 double act_energy;
| 94 struct Energy { 95 // Total energy of all activates 96 double act_energy;
|
| 97 std::vector<double> act_energy_banks;
|
70 71 // Total energy of all precharges 72 double pre_energy;
| 98 99 // Total energy of all precharges 100 double pre_energy;
|
| 101 std::vector<double> pre_energy_banks;
|
73 74 // Total energy of all reads 75 double read_energy;
| 102 103 // Total energy of all reads 104 double read_energy;
|
| 105 std::vector<double> read_energy_banks;
|
76 77 // Total energy of all writes 78 double write_energy;
| 106 107 // Total energy of all writes 108 double write_energy;
|
| 109 std::vector<double> write_energy_banks;
|
79 80 // Total energy of all refreshes 81 double ref_energy;
| 110 111 // Total energy of all refreshes 112 double ref_energy;
|
| 113 std::vector<double> ref_energy_banks;
|
82
| 114
|
| 115 // Bankwise refresh energy 116 std::vector<double> refb_energy_banks; 117
|
83 // Total background energy of all active standby cycles 84 double act_stdby_energy;
| 118 // Total background energy of all active standby cycles 119 double act_stdby_energy;
|
| 120 std::vector<double> act_stdby_energy_banks;
|
85 86 // Total background energy of all precharge standby cycles 87 double pre_stdby_energy;
| 121 122 // Total background energy of all precharge standby cycles 123 double pre_stdby_energy;
|
| 124 std::vector<double> pre_stdby_energy_banks;
|
88 89 // Total energy of idle cycles in the active mode 90 double idle_energy_act;
| 125 126 // Total energy of idle cycles in the active mode 127 double idle_energy_act;
|
| 128 std::vector<double> idle_energy_act_banks;
|
91 92 // Total energy of idle cycles in the precharge mode 93 double idle_energy_pre;
| 129 130 // Total energy of idle cycles in the precharge mode 131 double idle_energy_pre;
|
| 132 std::vector<double> idle_energy_pre_banks;
|
94 95 // Total trace/pattern energy 96 double total_energy;
| 133 134 // Total trace/pattern energy 135 double total_energy;
|
| 136 std::vector<double> total_energy_banks;
|
97
| 137
|
| 138 // Window energy 139 double window_energy; 140
|
98 // Average Power 99 double average_power; 100 101 // Energy consumed in active/precharged fast/slow-exit modes 102 double f_act_pd_energy;
| 141 // Average Power 142 double average_power; 143 144 // Energy consumed in active/precharged fast/slow-exit modes 145 double f_act_pd_energy;
|
| 146 std::vector<double> f_act_pd_energy_banks; 147
|
103 double f_pre_pd_energy;
| 148 double f_pre_pd_energy;
|
| 149 std::vector<double> f_pre_pd_energy_banks; 150
|
104 double s_act_pd_energy;
| 151 double s_act_pd_energy;
|
| 152 std::vector<double> s_act_pd_energy_banks; 153
|
105 double s_pre_pd_energy;
| 154 double s_pre_pd_energy;
|
| 155 std::vector<double> s_pre_pd_energy_banks;
|
106 107 // Energy consumed in self-refresh mode 108 double sref_energy;
| 156 157 // Energy consumed in self-refresh mode 158 double sref_energy;
|
| 159 std::vector<double> sref_energy_banks;
|
109 110 // Energy consumed in auto-refresh during self-refresh mode 111 double sref_ref_energy;
| 160 161 // Energy consumed in auto-refresh during self-refresh mode 162 double sref_ref_energy;
|
| 163 std::vector<double> sref_ref_energy_banks; 164
|
112 double sref_ref_act_energy;
| 165 double sref_ref_act_energy;
|
| 166 std::vector<double> sref_ref_act_energy_banks; 167
|
113 double sref_ref_pre_energy;
| 168 double sref_ref_pre_energy;
|
| 169 std::vector<double> sref_ref_pre_energy_banks;
|
114 115 // Energy consumed in powering-up from self-refresh mode 116 double spup_energy;
| 170 171 // Energy consumed in powering-up from self-refresh mode 172 double spup_energy;
|
| 173 std::vector<double> spup_energy_banks;
|
117 118 // Energy consumed in auto-refresh during self-refresh power-up 119 double spup_ref_energy;
| 174 175 // Energy consumed in auto-refresh during self-refresh power-up 176 double spup_ref_energy;
|
| 177 std::vector<double> spup_ref_energy_banks; 178
|
120 double spup_ref_act_energy;
| 179 double spup_ref_act_energy;
|
| 180 std::vector<double> spup_ref_act_energy_banks; 181
|
121 double spup_ref_pre_energy;
| 182 double spup_ref_pre_energy;
|
| 183 std::vector<double> spup_ref_pre_energy_banks;
|
122 123 // Energy consumed in powering-up from active/precharged power-down modes 124 double pup_act_energy;
| 184 185 // Energy consumed in powering-up from active/precharged power-down modes 186 double pup_act_energy;
|
| 187 std::vector<double> pup_act_energy_banks; 188
|
125 double pup_pre_energy;
| 189 double pup_pre_energy;
|
| 190 std::vector<double> pup_pre_energy_banks;
|
126 127 // Energy consumed by IO and Termination 128 double read_io_energy; // Read IO Energy 129 double write_term_energy; // Write Termination Energy 130 double read_oterm_energy; // Read Termination Energy from idle rank 131 double write_oterm_energy; // Write Termination Energy from idle rank 132 // Total IO and Termination Energy 133 double io_term_energy; 134 }; 135 136 struct Power { 137 // Power measures corresponding to IO and Termination 138 double IO_power; // Read IO Power 139 double WR_ODT_power; // Write ODT Power 140 double TermRD_power; // Read Termination in idle rank (in dual-rank systems) 141 double TermWR_power; // Write Termination in idle rank (in dual-rank systems) 142 143 // Average Power 144 double average_power;
| 191 192 // Energy consumed by IO and Termination 193 double read_io_energy; // Read IO Energy 194 double write_term_energy; // Write Termination Energy 195 double read_oterm_energy; // Read Termination Energy from idle rank 196 double write_oterm_energy; // Write Termination Energy from idle rank 197 // Total IO and Termination Energy 198 double io_term_energy; 199 }; 200 201 struct Power { 202 // Power measures corresponding to IO and Termination 203 double IO_power; // Read IO Power 204 double WR_ODT_power; // Write ODT Power 205 double TermRD_power; // Read Termination in idle rank (in dual-rank systems) 206 double TermWR_power; // Write Termination in idle rank (in dual-rank systems) 207 208 // Average Power 209 double average_power;
|
| 210 211 // Window Average Power 212 double window_average_power;
|
145 }; 146 147 // Print the power and energy 148 void power_print(const MemorySpecification& memSpec, 149 int term,
| 213 }; 214 215 // Print the power and energy 216 void power_print(const MemorySpecification& memSpec, 217 int term,
|
150 const CommandAnalysis& c) const;
| 218 const CommandAnalysis& c, 219 bool bankwiseMode) const;
|
151 152 // To derive IO and Termination Power measures using DRAM specification 153 void io_term_power(const MemorySpecification& memSpec); 154 155 Energy energy; 156 Power power; 157 158 private: 159 double calcIoTermEnergy(int64_t cycles, double period, double power, int64_t numBits) const;
| 220 221 // To derive IO and Termination Power measures using DRAM specification 222 void io_term_power(const MemorySpecification& memSpec); 223 224 Energy energy; 225 Power power; 226 227 private: 228 double calcIoTermEnergy(int64_t cycles, double period, double power, int64_t numBits) const;
|
| 229 // Sum quantities (e.g., operations, energy, cycles) that are stored in a per bank basis returning the total amount. 230 template <typename T> T sum(const std::vector<T> vec) const { return std::accumulate(vec.begin(), vec.end(), static_cast<T>(0)); }
|
160}; 161 162class EnergyDomain { 163 public: 164 EnergyDomain(double voltage, double clkPeriod) : 165 voltage(voltage), 166 clkPeriod(clkPeriod) 167 {} 168 169 double calcTivEnergy(int64_t cycles, double current) const;
| 231}; 232 233class EnergyDomain { 234 public: 235 EnergyDomain(double voltage, double clkPeriod) : 236 voltage(voltage), 237 clkPeriod(clkPeriod) 238 {} 239 240 double calcTivEnergy(int64_t cycles, double current) const;
|
| 241 double getVoltage() const{ return voltage; };
|
170 private: 171 const double voltage; 172 const double clkPeriod; 173}; 174 175} 176#endif // ifndef MEMORY_POWER_MODEL_H
| 242 private: 243 const double voltage; 244 const double clkPeriod; 245}; 246 247} 248#endif // ifndef MEMORY_POWER_MODEL_H
|