/***************************************************************************** * McPAT * SOFTWARE LICENSE AGREEMENT * Copyright 2012 Hewlett-Packard Development Company, L.P. * All Rights Reserved * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer; * redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution; * neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.” * ***************************************************************************/ #define GLOBALVAR #include "area.h" #include "decoder.h" #include "parameter.h" #include "array.h" #include #include #include #include "globalvar.h" using namespace std; ArrayST::ArrayST(const InputParameter *configure_interface, string _name, enum Device_ty device_ty_, bool opt_local_, enum Core_type core_ty_, bool _is_default) :l_ip(*configure_interface), name(_name), device_ty(device_ty_), opt_local(opt_local_), core_ty(core_ty_), is_default(_is_default) { if (l_ip.cache_sz<64) l_ip.cache_sz=64; if (l_ip.power_gating && (l_ip.assoc==0)) {l_ip.power_gating = false;} l_ip.error_checking();//not only do the error checking but also fill some missing parameters optimize_array(); } void ArrayST::compute_base_power() { //l_ip.out_w =l_ip.line_sz*8; local_result=cacti_interface(&l_ip); assert(local_result.cycle_time>0); assert(local_result.access_time>0); // if (name == "Int FrontRAT") // { // cout< (candidate_iter)->power.readOp.dynamic) { min_dynamic_energy = (candidate_iter)->power.readOp.dynamic; min_dynamic_energy_iter = candidate_iter; local_result = *(min_dynamic_energy_iter); //TODO: since results are reordered results and l_ip may miss match. Therefore, the final output spread sheets may show the miss match. } else { candidate_iter->cleanup() ; } } } candidate_solutions.clear(); } double long_channel_device_reduction = longer_channel_device_reduction(device_ty,core_ty); double pg_reduction = power_gating_leakage_reduction(false);//array structure all retain state; double macro_layout_overhead = g_tp.macro_layout_overhead; double chip_PR_overhead = g_tp.chip_layout_overhead; double total_overhead = macro_layout_overhead*chip_PR_overhead; local_result.area *= total_overhead; //maintain constant power density double pppm_t[4] = {total_overhead,1,1,total_overhead}; double sckRation = g_tp.sckt_co_eff; local_result.power.readOp.dynamic *= sckRation; local_result.power.writeOp.dynamic *= sckRation; local_result.power.searchOp.dynamic *= sckRation; local_result.power.readOp.leakage *= l_ip.nbanks; local_result.power.readOp.longer_channel_leakage = local_result.power.readOp.leakage*long_channel_device_reduction; if (l_ip.assoc==0)//only use this function for CAM/FA since other array types compute pg leakage automatically { local_result.power.readOp.power_gated_leakage = local_result.power.readOp.leakage*pg_reduction; } else { local_result.power.readOp.power_gated_leakage *= l_ip.nbanks;//normal array types } local_result.power.readOp.power_gated_with_long_channel_leakage = local_result.power.readOp.power_gated_leakage * long_channel_device_reduction;//power-gating atop long channel local_result.power = local_result.power* pppm_t; local_result.data_array2->power.readOp.dynamic *= sckRation; local_result.data_array2->power.writeOp.dynamic *= sckRation; local_result.data_array2->power.searchOp.dynamic *= sckRation; local_result.data_array2->power.readOp.leakage *= l_ip.nbanks; local_result.data_array2->power.readOp.longer_channel_leakage = local_result.data_array2->power.readOp.leakage*long_channel_device_reduction; if (l_ip.assoc==0)//only use this function for CAM/FA since other array types compute pg leakage automatically { local_result.data_array2->power.readOp.power_gated_leakage = local_result.data_array2->power.readOp.leakage*pg_reduction; } else { local_result.data_array2->power.readOp.power_gated_leakage *= l_ip.nbanks;//normal array types } local_result.data_array2->power.readOp.power_gated_with_long_channel_leakage = local_result.data_array2->power.readOp.power_gated_leakage * long_channel_device_reduction; local_result.data_array2->power = local_result.data_array2->power* pppm_t; if (!(l_ip.pure_cam || l_ip.pure_ram || l_ip.fully_assoc) && l_ip.is_cache) { local_result.tag_array2->power.readOp.dynamic *= sckRation; local_result.tag_array2->power.writeOp.dynamic *= sckRation; local_result.tag_array2->power.searchOp.dynamic *= sckRation; local_result.tag_array2->power.readOp.leakage *= l_ip.nbanks; local_result.tag_array2->power.readOp.power_gated_leakage *= l_ip.nbanks; local_result.tag_array2->power.readOp.longer_channel_leakage = local_result.tag_array2->power.readOp.leakage*long_channel_device_reduction; local_result.tag_array2->power.readOp.power_gated_with_long_channel_leakage = local_result.tag_array2->power.readOp.power_gated_leakage*long_channel_device_reduction; local_result.tag_array2->power = local_result.tag_array2->power* pppm_t; } } void ArrayST::leakage_feedback(double temperature)//TODO: add the code to process power-gating leakage { // Update the temperature. l_ip is already set and error-checked in the creator function. l_ip.temp = (unsigned int)round(temperature/10.0)*10; // This corresponds to cacti_interface() in the initialization process. Leakage power is updated here. reconfigure(&l_ip,&local_result); // Scale the power values. This is part of ArrayST::optimize_array(). double long_channel_device_reduction = longer_channel_device_reduction(device_ty,core_ty); double macro_layout_overhead = g_tp.macro_layout_overhead; double chip_PR_overhead = g_tp.chip_layout_overhead; double total_overhead = macro_layout_overhead*chip_PR_overhead; double pppm_t[4] = {total_overhead,1,1,total_overhead}; double sckRation = g_tp.sckt_co_eff; local_result.power.readOp.dynamic *= sckRation; local_result.power.writeOp.dynamic *= sckRation; local_result.power.searchOp.dynamic *= sckRation; local_result.power.readOp.leakage *= l_ip.nbanks; local_result.power.readOp.longer_channel_leakage = local_result.power.readOp.leakage*long_channel_device_reduction; local_result.power = local_result.power* pppm_t; local_result.data_array2->power.readOp.dynamic *= sckRation; local_result.data_array2->power.writeOp.dynamic *= sckRation; local_result.data_array2->power.searchOp.dynamic *= sckRation; local_result.data_array2->power.readOp.leakage *= l_ip.nbanks; local_result.data_array2->power.readOp.longer_channel_leakage = local_result.data_array2->power.readOp.leakage*long_channel_device_reduction; local_result.data_array2->power = local_result.data_array2->power* pppm_t; if (!(l_ip.pure_cam || l_ip.pure_ram || l_ip.fully_assoc) && l_ip.is_cache) { local_result.tag_array2->power.readOp.dynamic *= sckRation; local_result.tag_array2->power.writeOp.dynamic *= sckRation; local_result.tag_array2->power.searchOp.dynamic *= sckRation; local_result.tag_array2->power.readOp.leakage *= l_ip.nbanks; local_result.tag_array2->power.readOp.longer_channel_leakage = local_result.tag_array2->power.readOp.leakage*long_channel_device_reduction; local_result.tag_array2->power = local_result.tag_array2->power* pppm_t; } } ArrayST:: ~ArrayST() { local_result.cleanup(); }