110234Syasuko.eckert@amd.com/*****************************************************************************
210234Syasuko.eckert@amd.com *                                McPAT
310234Syasuko.eckert@amd.com *                      SOFTWARE LICENSE AGREEMENT
410234Syasuko.eckert@amd.com *            Copyright (c) 2010-2013 Advanced Micro Devices, Inc.
510234Syasuko.eckert@amd.com *                          All Rights Reserved
610234Syasuko.eckert@amd.com *
710234Syasuko.eckert@amd.com * Redistribution and use in source and binary forms, with or without
810234Syasuko.eckert@amd.com * modification, are permitted provided that the following conditions are
910234Syasuko.eckert@amd.com * met: redistributions of source code must retain the above copyright
1010234Syasuko.eckert@amd.com * notice, this list of conditions and the following disclaimer;
1110234Syasuko.eckert@amd.com * redistributions in binary form must reproduce the above copyright
1210234Syasuko.eckert@amd.com * notice, this list of conditions and the following disclaimer in the
1310234Syasuko.eckert@amd.com * documentation and/or other materials provided with the distribution;
1410234Syasuko.eckert@amd.com * neither the name of the copyright holders nor the names of its
1510234Syasuko.eckert@amd.com * contributors may be used to endorse or promote products derived from
1610234Syasuko.eckert@amd.com * this software without specific prior written permission.
1710234Syasuko.eckert@amd.com
1810234Syasuko.eckert@amd.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1910234Syasuko.eckert@amd.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2010234Syasuko.eckert@amd.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2110234Syasuko.eckert@amd.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2210234Syasuko.eckert@amd.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2310234Syasuko.eckert@amd.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2410234Syasuko.eckert@amd.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2510234Syasuko.eckert@amd.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2610234Syasuko.eckert@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2710234Syasuko.eckert@amd.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2810234Syasuko.eckert@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2910234Syasuko.eckert@amd.com *
3010234Syasuko.eckert@amd.com * Authors: Joel Hestness
3110234Syasuko.eckert@amd.com *          Yasuko Eckert
3210234Syasuko.eckert@amd.com *
3310234Syasuko.eckert@amd.com ***************************************************************************/
3410234Syasuko.eckert@amd.com
3510234Syasuko.eckert@amd.com#include <cmath>
3610234Syasuko.eckert@amd.com#include <iostream>
3710234Syasuko.eckert@amd.com
3810234Syasuko.eckert@amd.com#include "area.h"
3910234Syasuko.eckert@amd.com#include "cachearray.h"
4010234Syasuko.eckert@amd.com#include "common.h"
4110234Syasuko.eckert@amd.com#include "decoder.h"
4210234Syasuko.eckert@amd.com#include "parameter.h"
4310234Syasuko.eckert@amd.com
4410234Syasuko.eckert@amd.comusing namespace std;
4510234Syasuko.eckert@amd.com
4610234Syasuko.eckert@amd.comdouble CacheArray::area_efficiency_threshold = 20.0;
4710234Syasuko.eckert@amd.comint CacheArray::ed = 0;
4810234Syasuko.eckert@amd.com//Fixed number, make sure timing can be satisfied.
4910234Syasuko.eckert@amd.comint CacheArray::delay_wt = 100;
5010234Syasuko.eckert@amd.comint CacheArray::cycle_time_wt = 1000;
5110234Syasuko.eckert@amd.com//Fixed number, This is used to exhaustive search for individual components.
5210234Syasuko.eckert@amd.comint CacheArray::area_wt = 10;
5310234Syasuko.eckert@amd.com//Fixed number, This is used to exhaustive search for individual components.
5410234Syasuko.eckert@amd.comint CacheArray::dynamic_power_wt = 10;
5510234Syasuko.eckert@amd.comint CacheArray::leakage_power_wt = 10;
5610234Syasuko.eckert@amd.com//Fixed number, make sure timing can be satisfied.
5710234Syasuko.eckert@amd.comint CacheArray::delay_dev = 1000000;
5810234Syasuko.eckert@amd.comint CacheArray::cycle_time_dev = 100;
5910234Syasuko.eckert@amd.com//Fixed number, This is used to exhaustive search for individual components.
6010234Syasuko.eckert@amd.comint CacheArray::area_dev = 1000000;
6110234Syasuko.eckert@amd.com//Fixed number, This is used to exhaustive search for individual components.
6210234Syasuko.eckert@amd.comint CacheArray::dynamic_power_dev = 1000000;
6310234Syasuko.eckert@amd.comint CacheArray::leakage_power_dev = 1000000;
6410234Syasuko.eckert@amd.comint CacheArray::cycle_time_dev_threshold = 10;
6510234Syasuko.eckert@amd.com
6610234Syasuko.eckert@amd.comCacheArray::CacheArray(XMLNode* _xml_data,
6710234Syasuko.eckert@amd.com                 const InputParameter *configure_interface, string _name,
6810234Syasuko.eckert@amd.com                 enum Device_ty device_ty_, double _clockRate,
6910234Syasuko.eckert@amd.com                 bool opt_local_, enum Core_type core_ty_, bool _is_default)
7010234Syasuko.eckert@amd.com        : McPATComponent(_xml_data), l_ip(*configure_interface),
7110234Syasuko.eckert@amd.com        device_ty(device_ty_), opt_local(opt_local_), core_ty(core_ty_),
7210234Syasuko.eckert@amd.com        is_default(_is_default), sbt_dir_overhead(0) {
7310234Syasuko.eckert@amd.com    name = _name;
7410234Syasuko.eckert@amd.com    clockRate = _clockRate;
7510234Syasuko.eckert@amd.com    if (l_ip.cache_sz < MIN_BUFFER_SIZE) {
7610234Syasuko.eckert@amd.com        l_ip.cache_sz = MIN_BUFFER_SIZE;
7710234Syasuko.eckert@amd.com    }
7810234Syasuko.eckert@amd.com
7910234Syasuko.eckert@amd.com    if (!l_ip.error_checking(name)) {
8010234Syasuko.eckert@amd.com        exit(1);
8110234Syasuko.eckert@amd.com    }
8210234Syasuko.eckert@amd.com
8310234Syasuko.eckert@amd.com    sbt_tdp_stats.reset();
8410234Syasuko.eckert@amd.com    sbt_rtp_stats.reset();
8510234Syasuko.eckert@amd.com
8610234Syasuko.eckert@amd.com    // Compute initial search point
8710234Syasuko.eckert@amd.com    local_result.valid = false;
8810234Syasuko.eckert@amd.com    compute_base_power();
8910234Syasuko.eckert@amd.com
9010234Syasuko.eckert@amd.com    // Set up the cache by searching design space with cacti
9110234Syasuko.eckert@amd.com    list<uca_org_t > candidate_solutions(0);
9210234Syasuko.eckert@amd.com    list<uca_org_t >::iterator candidate_iter, min_dynamic_energy_iter;
9310234Syasuko.eckert@amd.com    uca_org_t* temp_res = NULL;
9410234Syasuko.eckert@amd.com    double throughput = l_ip.throughput;
9510234Syasuko.eckert@amd.com    double latency = l_ip.latency;
9610234Syasuko.eckert@amd.com    bool throughput_overflow = true;
9710234Syasuko.eckert@amd.com    bool latency_overflow = true;
9810234Syasuko.eckert@amd.com
9910234Syasuko.eckert@amd.com    if ((local_result.cycle_time - throughput) <= 1e-10 )
10010234Syasuko.eckert@amd.com        throughput_overflow = false;
10110234Syasuko.eckert@amd.com    if ((local_result.access_time - latency) <= 1e-10)
10210234Syasuko.eckert@amd.com        latency_overflow = false;
10310234Syasuko.eckert@amd.com
10410234Syasuko.eckert@amd.com    if (opt_for_clk && opt_local) {
10510234Syasuko.eckert@amd.com        if (throughput_overflow || latency_overflow) {
10610234Syasuko.eckert@amd.com            l_ip.ed = ed;
10710234Syasuko.eckert@amd.com
10810234Syasuko.eckert@amd.com            l_ip.delay_wt = delay_wt;
10910234Syasuko.eckert@amd.com            l_ip.cycle_time_wt = cycle_time_wt;
11010234Syasuko.eckert@amd.com
11110234Syasuko.eckert@amd.com            l_ip.area_wt = area_wt;
11210234Syasuko.eckert@amd.com            l_ip.dynamic_power_wt = dynamic_power_wt;
11310234Syasuko.eckert@amd.com            l_ip.leakage_power_wt = leakage_power_wt;
11410234Syasuko.eckert@amd.com
11510234Syasuko.eckert@amd.com            l_ip.delay_dev = delay_dev;
11610234Syasuko.eckert@amd.com            l_ip.cycle_time_dev = cycle_time_dev;
11710234Syasuko.eckert@amd.com
11810234Syasuko.eckert@amd.com            l_ip.area_dev = area_dev;
11910234Syasuko.eckert@amd.com            l_ip.dynamic_power_dev = dynamic_power_dev;
12010234Syasuko.eckert@amd.com            l_ip.leakage_power_dev = leakage_power_dev;
12110234Syasuko.eckert@amd.com
12210234Syasuko.eckert@amd.com            //Reset overflow flag before start optimization iterations
12310234Syasuko.eckert@amd.com            throughput_overflow = true;
12410234Syasuko.eckert@amd.com            latency_overflow = true;
12510234Syasuko.eckert@amd.com
12610234Syasuko.eckert@amd.com            //Clean up the result for optimized for ED^2P
12710234Syasuko.eckert@amd.com            temp_res = &local_result;
12810234Syasuko.eckert@amd.com            temp_res->cleanup();
12910234Syasuko.eckert@amd.com        }
13010234Syasuko.eckert@amd.com
13110234Syasuko.eckert@amd.com
13210234Syasuko.eckert@amd.com        while ((throughput_overflow || latency_overflow) &&
13310234Syasuko.eckert@amd.com               l_ip.cycle_time_dev > cycle_time_dev_threshold) {
13410234Syasuko.eckert@amd.com            compute_base_power();
13510234Syasuko.eckert@amd.com
13610234Syasuko.eckert@amd.com            //This is the time_dev to be used for next iteration
13710234Syasuko.eckert@amd.com            l_ip.cycle_time_dev -= cycle_time_dev_threshold;
13810234Syasuko.eckert@amd.com
13910234Syasuko.eckert@amd.com            //      from best area to worst area -->worst timing to best timing
14010234Syasuko.eckert@amd.com            if ((((local_result.cycle_time - throughput) <= 1e-10 ) &&
14110234Syasuko.eckert@amd.com                 (local_result.access_time - latency) <= 1e-10) ||
14210234Syasuko.eckert@amd.com                (local_result.data_array2->area_efficiency <
14310234Syasuko.eckert@amd.com                 area_efficiency_threshold && l_ip.assoc == 0)) {
14410234Syasuko.eckert@amd.com                //if no satisfiable solution is found,the most aggressive one
14510234Syasuko.eckert@amd.com                //is left
14610234Syasuko.eckert@amd.com                candidate_solutions.push_back(local_result);
14710234Syasuko.eckert@amd.com                if (((local_result.cycle_time - throughput) <= 1e-10) &&
14810234Syasuko.eckert@amd.com                    ((local_result.access_time - latency) <= 1e-10)) {
14910234Syasuko.eckert@amd.com                    //ensure stop opt not because of cam
15010234Syasuko.eckert@amd.com                    throughput_overflow = false;
15110234Syasuko.eckert@amd.com                    latency_overflow = false;
15210234Syasuko.eckert@amd.com                }
15310234Syasuko.eckert@amd.com
15410234Syasuko.eckert@amd.com            } else {
15510234Syasuko.eckert@amd.com                if ((local_result.cycle_time - throughput) <= 1e-10)
15610234Syasuko.eckert@amd.com                    throughput_overflow = false;
15710234Syasuko.eckert@amd.com                if ((local_result.access_time - latency) <= 1e-10)
15810234Syasuko.eckert@amd.com                    latency_overflow = false;
15910234Syasuko.eckert@amd.com
16010234Syasuko.eckert@amd.com                //if not >10 local_result is the last result, it cannot be
16110234Syasuko.eckert@amd.com                //cleaned up
16210234Syasuko.eckert@amd.com                if (l_ip.cycle_time_dev > cycle_time_dev_threshold) {
16310234Syasuko.eckert@amd.com                    //Only solutions not saved in the list need to be
16410234Syasuko.eckert@amd.com                    //cleaned up
16510234Syasuko.eckert@amd.com                    temp_res = &local_result;
16610234Syasuko.eckert@amd.com                    temp_res->cleanup();
16710234Syasuko.eckert@amd.com                }
16810234Syasuko.eckert@amd.com            }
16910234Syasuko.eckert@amd.com        }
17010234Syasuko.eckert@amd.com
17110234Syasuko.eckert@amd.com
17210234Syasuko.eckert@amd.com        if (l_ip.assoc > 0) {
17310234Syasuko.eckert@amd.com            //For array structures except CAM and FA, Give warning but still
17410234Syasuko.eckert@amd.com            //provide a result with best timing found
17510234Syasuko.eckert@amd.com            if (throughput_overflow == true)
17610234Syasuko.eckert@amd.com                cout << "Warning: " << name
17710234Syasuko.eckert@amd.com                     << " array structure cannot satisfy throughput constraint."
17810234Syasuko.eckert@amd.com                     << endl;
17910234Syasuko.eckert@amd.com            if (latency_overflow == true)
18010234Syasuko.eckert@amd.com                cout << "Warning: " << name
18110234Syasuko.eckert@amd.com                     << " array structure cannot satisfy latency constraint."
18210234Syasuko.eckert@amd.com                     << endl;
18310234Syasuko.eckert@amd.com        }
18410234Syasuko.eckert@amd.com
18510234Syasuko.eckert@amd.com        double min_dynamic_energy = BIGNUM;
18610234Syasuko.eckert@amd.com        if (candidate_solutions.empty() == false) {
18710234Syasuko.eckert@amd.com            local_result.valid = true;
18810234Syasuko.eckert@amd.com            for (candidate_iter = candidate_solutions.begin();
18910234Syasuko.eckert@amd.com                 candidate_iter != candidate_solutions.end();
19010234Syasuko.eckert@amd.com                 ++candidate_iter) {
19110234Syasuko.eckert@amd.com                if (min_dynamic_energy >
19210234Syasuko.eckert@amd.com                    (candidate_iter)->power.readOp.dynamic) {
19310234Syasuko.eckert@amd.com                    min_dynamic_energy =
19410234Syasuko.eckert@amd.com                        (candidate_iter)->power.readOp.dynamic;
19510234Syasuko.eckert@amd.com                    min_dynamic_energy_iter = candidate_iter;
19610234Syasuko.eckert@amd.com                    local_result = *(min_dynamic_energy_iter);
19710234Syasuko.eckert@amd.com
19810234Syasuko.eckert@amd.com                } else {
19910234Syasuko.eckert@amd.com                    candidate_iter->cleanup() ;
20010234Syasuko.eckert@amd.com                }
20110234Syasuko.eckert@amd.com
20210234Syasuko.eckert@amd.com            }
20310234Syasuko.eckert@amd.com
20410234Syasuko.eckert@amd.com
20510234Syasuko.eckert@amd.com        }
20610234Syasuko.eckert@amd.com        candidate_solutions.clear();
20710234Syasuko.eckert@amd.com    }
20810234Syasuko.eckert@amd.com
20910234Syasuko.eckert@amd.com    double long_channel_device_reduction =
21010234Syasuko.eckert@amd.com        longer_channel_device_reduction(device_ty, core_ty);
21110234Syasuko.eckert@amd.com
21210234Syasuko.eckert@amd.com    double macro_layout_overhead = g_tp.macro_layout_overhead;
21310234Syasuko.eckert@amd.com    double chip_PR_overhead = g_tp.chip_layout_overhead;
21410234Syasuko.eckert@amd.com    double total_overhead = macro_layout_overhead * chip_PR_overhead;
21510234Syasuko.eckert@amd.com    local_result.area *= total_overhead;
21610234Syasuko.eckert@amd.com
21710234Syasuko.eckert@amd.com    //maintain constant power density
21810234Syasuko.eckert@amd.com    double pppm_t[4]    = {total_overhead, 1, 1, total_overhead};
21910234Syasuko.eckert@amd.com
22010234Syasuko.eckert@amd.com    double sckRation = g_tp.sckt_co_eff;
22110234Syasuko.eckert@amd.com    local_result.power.readOp.dynamic *= sckRation;
22210234Syasuko.eckert@amd.com    local_result.power.writeOp.dynamic *= sckRation;
22310234Syasuko.eckert@amd.com    local_result.power.searchOp.dynamic *= sckRation;
22410234Syasuko.eckert@amd.com    local_result.power.readOp.leakage *= l_ip.nbanks;
22510234Syasuko.eckert@amd.com    local_result.power.readOp.longer_channel_leakage =
22610234Syasuko.eckert@amd.com        local_result.power.readOp.leakage * long_channel_device_reduction;
22710234Syasuko.eckert@amd.com    local_result.power = local_result.power * pppm_t;
22810234Syasuko.eckert@amd.com
22910234Syasuko.eckert@amd.com    local_result.data_array2->power.readOp.dynamic *= sckRation;
23010234Syasuko.eckert@amd.com    local_result.data_array2->power.writeOp.dynamic *= sckRation;
23110234Syasuko.eckert@amd.com    local_result.data_array2->power.searchOp.dynamic *= sckRation;
23210234Syasuko.eckert@amd.com    local_result.data_array2->power.readOp.leakage *= l_ip.nbanks;
23310234Syasuko.eckert@amd.com    local_result.data_array2->power.readOp.longer_channel_leakage =
23410234Syasuko.eckert@amd.com        local_result.data_array2->power.readOp.leakage *
23510234Syasuko.eckert@amd.com        long_channel_device_reduction;
23610234Syasuko.eckert@amd.com    local_result.data_array2->power = local_result.data_array2->power * pppm_t;
23710234Syasuko.eckert@amd.com
23810234Syasuko.eckert@amd.com
23910234Syasuko.eckert@amd.com    if (!(l_ip.pure_cam || l_ip.pure_ram || l_ip.fully_assoc) && l_ip.is_cache) {
24010234Syasuko.eckert@amd.com        local_result.tag_array2->power.readOp.dynamic *= sckRation;
24110234Syasuko.eckert@amd.com        local_result.tag_array2->power.writeOp.dynamic *= sckRation;
24210234Syasuko.eckert@amd.com        local_result.tag_array2->power.searchOp.dynamic *= sckRation;
24310234Syasuko.eckert@amd.com        local_result.tag_array2->power.readOp.leakage *= l_ip.nbanks;
24410234Syasuko.eckert@amd.com        local_result.tag_array2->power.readOp.longer_channel_leakage =
24510234Syasuko.eckert@amd.com            local_result.tag_array2->power.readOp.leakage *
24610234Syasuko.eckert@amd.com            long_channel_device_reduction;
24710234Syasuko.eckert@amd.com        local_result.tag_array2->power =
24810234Syasuko.eckert@amd.com            local_result.tag_array2->power * pppm_t;
24910234Syasuko.eckert@amd.com    }
25010234Syasuko.eckert@amd.com}
25110234Syasuko.eckert@amd.com
25210234Syasuko.eckert@amd.comvoid CacheArray::compute_base_power() {
25310234Syasuko.eckert@amd.com    local_result = cacti_interface(&l_ip);
25410234Syasuko.eckert@amd.com}
25510234Syasuko.eckert@amd.com
25610234Syasuko.eckert@amd.comvoid CacheArray::computeArea() {
25710234Syasuko.eckert@amd.com    area.set_area(local_result.area);
25810234Syasuko.eckert@amd.com    output_data.area = local_result.area / 1e6;
25910234Syasuko.eckert@amd.com}
26010234Syasuko.eckert@amd.com
26110234Syasuko.eckert@amd.comvoid CacheArray::computeEnergy() {
26210234Syasuko.eckert@amd.com    // Set the leakage power numbers
26310234Syasuko.eckert@amd.com    output_data.subthreshold_leakage_power = local_result.power.readOp.leakage;
26410234Syasuko.eckert@amd.com    output_data.gate_leakage_power = local_result.power.readOp.gate_leakage;
26510234Syasuko.eckert@amd.com
26610234Syasuko.eckert@amd.com    if (l_ip.assoc && l_ip.is_cache) {
26710234Syasuko.eckert@amd.com        // This is a standard cache array with data and tags
26810234Syasuko.eckert@amd.com        // Calculate peak dynamic power
26910234Syasuko.eckert@amd.com        output_data.peak_dynamic_power =
27010234Syasuko.eckert@amd.com            (local_result.tag_array2->power.readOp.dynamic +
27110234Syasuko.eckert@amd.com             local_result.data_array2->power.readOp.dynamic) *
27210234Syasuko.eckert@amd.com            tdp_stats.readAc.hit +
27310234Syasuko.eckert@amd.com            (local_result.tag_array2->power.readOp.dynamic) *
27410234Syasuko.eckert@amd.com            tdp_stats.readAc.miss +
27510234Syasuko.eckert@amd.com            (local_result.tag_array2->power.readOp.dynamic +
27610234Syasuko.eckert@amd.com             local_result.data_array2->power.writeOp.dynamic) *
27710234Syasuko.eckert@amd.com            tdp_stats.writeAc.hit +
27810234Syasuko.eckert@amd.com            (local_result.tag_array2->power.readOp.dynamic) *
27910234Syasuko.eckert@amd.com            tdp_stats.writeAc.miss;
28010234Syasuko.eckert@amd.com        output_data.peak_dynamic_power *= clockRate;
28110234Syasuko.eckert@amd.com
28210234Syasuko.eckert@amd.com        // Calculate the runtime dynamic power
28310234Syasuko.eckert@amd.com        output_data.runtime_dynamic_energy =
28410234Syasuko.eckert@amd.com            local_result.data_array2->power.readOp.dynamic *
28510234Syasuko.eckert@amd.com            rtp_stats.dataReadAc.access +
28610234Syasuko.eckert@amd.com            local_result.data_array2->power.writeOp.dynamic *
28710234Syasuko.eckert@amd.com            rtp_stats.dataWriteAc.access +
28810234Syasuko.eckert@amd.com            (local_result.tag_array2->power.readOp.dynamic *
28910234Syasuko.eckert@amd.com             rtp_stats.tagReadAc.access +
29010234Syasuko.eckert@amd.com             local_result.tag_array2->power.writeOp.dynamic *
29110234Syasuko.eckert@amd.com             rtp_stats.tagWriteAc.access) * l_ip.assoc;
29210234Syasuko.eckert@amd.com    } else {
29310234Syasuko.eckert@amd.com        // Calculate peak dynamic power
29410234Syasuko.eckert@amd.com        output_data.peak_dynamic_power =
29510234Syasuko.eckert@amd.com                local_result.power.readOp.dynamic * tdp_stats.readAc.access +
29610234Syasuko.eckert@amd.com                local_result.power.writeOp.dynamic * tdp_stats.writeAc.access +
29710234Syasuko.eckert@amd.com                local_result.power.searchOp.dynamic * tdp_stats.searchAc.access;
29810234Syasuko.eckert@amd.com        output_data.peak_dynamic_power *= clockRate;
29910234Syasuko.eckert@amd.com
30010234Syasuko.eckert@amd.com        // Calculate the runtime dynamic power
30110234Syasuko.eckert@amd.com        output_data.runtime_dynamic_energy =
30210234Syasuko.eckert@amd.com                local_result.power.readOp.dynamic * rtp_stats.readAc.access +
30310234Syasuko.eckert@amd.com                local_result.power.writeOp.dynamic * rtp_stats.writeAc.access +
30410234Syasuko.eckert@amd.com                local_result.power.searchOp.dynamic * rtp_stats.searchAc.access;
30510234Syasuko.eckert@amd.com    }
30610234Syasuko.eckert@amd.com
30710234Syasuko.eckert@amd.com    // An SBT directory has more dynamic power
30810234Syasuko.eckert@amd.com    if (sbt_dir_overhead > 0) {
30910234Syasuko.eckert@amd.com        // Calculate peak dynamic power
31010234Syasuko.eckert@amd.com        output_data.peak_dynamic_power +=
31110234Syasuko.eckert@amd.com            (computeSBTDynEnergy(&sbt_tdp_stats) * clockRate);
31210234Syasuko.eckert@amd.com
31310234Syasuko.eckert@amd.com        // Calculate the runtime dynamic power
31410234Syasuko.eckert@amd.com        output_data.runtime_dynamic_energy +=
31510234Syasuko.eckert@amd.com            computeSBTDynEnergy(&sbt_rtp_stats);
31610234Syasuko.eckert@amd.com    }
31710234Syasuko.eckert@amd.com}
31810234Syasuko.eckert@amd.com
31910234Syasuko.eckert@amd.comCacheArray::~CacheArray() {
32010234Syasuko.eckert@amd.com    local_result.cleanup();
32110234Syasuko.eckert@amd.com}
322