1 /*****************************************************************************
3 * SOFTWARE LICENSE AGREEMENT
4 * Copyright (c) 2010-2013 Advanced Micro Devices, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met: redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer;
11 * redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution;
14 * neither the name of the copyright holders nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * Authors: Joel Hestness
33 ***************************************************************************/
41 #include "basic_components.h"
42 #include "cacti_interface.h"
43 #include "component.h"
45 #include "parameter.h"
47 class CacheArray
: public McPATComponent
{
49 static double area_efficiency_threshold
;
51 // These are used for the CACTI interface.
54 static int cycle_time_wt
;
56 static int dynamic_power_wt
;
57 static int leakage_power_wt
;
59 static int cycle_time_dev
;
61 static int dynamic_power_dev
;
62 static int leakage_power_dev
;
63 static int cycle_time_dev_threshold
;
66 enum Device_ty device_ty
;
68 enum Core_type core_ty
;
70 uca_org_t local_result
;
72 // These are only used for static bank tag (SBT) directory type.
73 double sbt_dir_overhead
;
74 // Set this to contain SBT peak power stats
75 statsDef sbt_tdp_stats
;
76 // Set this to contain SBT runtime power stats
77 statsDef sbt_rtp_stats
;
79 CacheArray(XMLNode
* _xml_data
, const InputParameter
*configure_interface
,
80 string _name
, enum Device_ty device_ty_
, double _clockRate
= 0.0f
,
81 bool opt_local_
= true,
82 enum Core_type core_ty_
= Inorder
, bool _is_default
= true);
85 void compute_base_power();
86 void setSBTDirOverhead(double overhead
) { sbt_dir_overhead
= overhead
; }
90 double computeSBTDynEnergy(statsDef
*sbt_stats_ptr
);
94 double CacheArray::computeSBTDynEnergy(statsDef
*sbt_stats_p
) {
95 if (sbt_dir_overhead
== 0) {
99 // Write miss on dynamic home node will generate a replacement write on
102 sbt_stats_p
->readAc
.hit
*
103 (local_result
.data_array2
->power
.readOp
.dynamic
* sbt_dir_overhead
+
104 local_result
.tag_array2
->power
.readOp
.dynamic
) +
105 sbt_stats_p
->readAc
.miss
*
106 local_result
.tag_array2
->power
.readOp
.dynamic
+
107 sbt_stats_p
->writeAc
.miss
*
108 local_result
.tag_array2
->power
.readOp
.dynamic
+
109 sbt_stats_p
->writeAc
.hit
*
110 (local_result
.data_array2
->power
.writeOp
.dynamic
* sbt_dir_overhead
+
111 local_result
.tag_array2
->power
.readOp
.dynamic
+
112 sbt_stats_p
->writeAc
.miss
*
113 local_result
.power
.writeOp
.dynamic
);
117 #endif /* CACHEARRAY_H_ */