2 * Copyright (c) 2012-2014, TU Delft
3 * Copyright (c) 2012-2014, TU Eindhoven
4 * Copyright (c) 2012-2014, TU Kaiserslautern
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
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.
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.
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.
34 * Authors: Karthik Chandrasekar, Matthias Jung, Omar Naji
38 #ifndef MEMORY_POWER_MODEL_H
39 #define MEMORY_POWER_MODEL_H
41 #include "MemorySpecification.h"
42 #include "CommandAnalysis.h"
45 class MemoryPowerModel
{
47 // Calculate energy and average power consumption for the given memory
49 void power_calc(MemorySpecification memSpec
,
50 const CommandAnalysis
& counters
,
53 // Used to calculate self-refresh active energy
54 static double engy_sref(double 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
,
68 // Total energy of all activates
71 // Total energy of all precharges
74 // Total energy of all reads
77 // Total energy of all writes
80 // Total energy of all refreshes
83 // Total background energy of all active standby cycles
84 double act_stdby_energy
;
86 // Total background energy of all precharge standby cycles
87 double pre_stdby_energy
;
89 // Total energy of idle cycles in the active mode
90 double idle_energy_act
;
92 // Total energy of idle cycles in the precharge mode
93 double idle_energy_pre
;
95 // Total trace/pattern energy
101 // Energy consumed in active/precharged fast/slow-exit modes
102 double f_act_pd_energy
;
103 double f_pre_pd_energy
;
104 double s_act_pd_energy
;
105 double s_pre_pd_energy
;
107 // Energy consumed in self-refresh mode
110 // Energy consumed in auto-refresh during self-refresh mode
111 double sref_ref_energy
;
112 double sref_ref_act_energy
;
113 double sref_ref_pre_energy
;
115 // Energy consumed in powering-up from self-refresh mode
118 // Energy consumed in auto-refresh during self-refresh power-up
119 double spup_ref_energy
;
120 double spup_ref_act_energy
;
121 double spup_ref_pre_energy
;
123 // Energy consumed in powering-up from active/precharged power-down modes
124 double pup_act_energy
;
125 double pup_pre_energy
;
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
;
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)
144 double average_power
;
147 // Print the power and energy
148 void power_print(MemorySpecification memSpec
,
150 const CommandAnalysis
& counters
) const;
152 // To derive IO and Termination Power measures using DRAM specification
153 void io_term_power(MemorySpecification memSpec
);
159 double calcIoTermEnergy(int64_t cycles
, double period
, double power
, int64_t numBits
) const;
164 EnergyDomain(double voltage
, double clkPeriod
) :
169 double calcTivEnergy(int64_t cycles
, double current
) const;
171 const double voltage
;
172 const double clkPeriod
;
176 #endif // ifndef MEMORY_POWER_MODEL_H