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#ifndef CACHEARRAY_H_ 3610234Syasuko.eckert@amd.com#define CACHEARRAY_H_ 3710234Syasuko.eckert@amd.com 3810234Syasuko.eckert@amd.com#include <iostream> 3910234Syasuko.eckert@amd.com#include <string> 4010234Syasuko.eckert@amd.com 4110234Syasuko.eckert@amd.com#include "basic_components.h" 4210234Syasuko.eckert@amd.com#include "cacti_interface.h" 4310234Syasuko.eckert@amd.com#include "component.h" 4410234Syasuko.eckert@amd.com#include "const.h" 4510234Syasuko.eckert@amd.com#include "parameter.h" 4610234Syasuko.eckert@amd.com 4710234Syasuko.eckert@amd.comclass CacheArray : public McPATComponent { 4810234Syasuko.eckert@amd.compublic: 4910234Syasuko.eckert@amd.com static double area_efficiency_threshold; 5010234Syasuko.eckert@amd.com 5110234Syasuko.eckert@amd.com // These are used for the CACTI interface. 5210234Syasuko.eckert@amd.com static int ed; 5310234Syasuko.eckert@amd.com static int delay_wt; 5410234Syasuko.eckert@amd.com static int cycle_time_wt; 5510234Syasuko.eckert@amd.com static int area_wt; 5610234Syasuko.eckert@amd.com static int dynamic_power_wt; 5710234Syasuko.eckert@amd.com static int leakage_power_wt; 5810234Syasuko.eckert@amd.com static int delay_dev; 5910234Syasuko.eckert@amd.com static int cycle_time_dev; 6010234Syasuko.eckert@amd.com static int area_dev; 6110234Syasuko.eckert@amd.com static int dynamic_power_dev; 6210234Syasuko.eckert@amd.com static int leakage_power_dev; 6310234Syasuko.eckert@amd.com static int cycle_time_dev_threshold; 6410234Syasuko.eckert@amd.com 6510234Syasuko.eckert@amd.com InputParameter l_ip; 6610234Syasuko.eckert@amd.com enum Device_ty device_ty; 6710234Syasuko.eckert@amd.com bool opt_local; 6810234Syasuko.eckert@amd.com enum Core_type core_ty; 6910234Syasuko.eckert@amd.com bool is_default; 7010234Syasuko.eckert@amd.com uca_org_t local_result; 7110234Syasuko.eckert@amd.com 7210234Syasuko.eckert@amd.com // These are only used for static bank tag (SBT) directory type. 7310234Syasuko.eckert@amd.com double sbt_dir_overhead; 7410234Syasuko.eckert@amd.com // Set this to contain SBT peak power stats 7510234Syasuko.eckert@amd.com statsDef sbt_tdp_stats; 7610234Syasuko.eckert@amd.com // Set this to contain SBT runtime power stats 7710234Syasuko.eckert@amd.com statsDef sbt_rtp_stats; 7810234Syasuko.eckert@amd.com 7910234Syasuko.eckert@amd.com CacheArray(XMLNode* _xml_data, const InputParameter *configure_interface, 8010234Syasuko.eckert@amd.com string _name, enum Device_ty device_ty_, double _clockRate = 0.0f, 8110234Syasuko.eckert@amd.com bool opt_local_ = true, 8210234Syasuko.eckert@amd.com enum Core_type core_ty_ = Inorder, bool _is_default = true); 8310234Syasuko.eckert@amd.com void computeArea(); 8410234Syasuko.eckert@amd.com void computeEnergy(); 8510234Syasuko.eckert@amd.com void compute_base_power(); 8610234Syasuko.eckert@amd.com void setSBTDirOverhead(double overhead) { sbt_dir_overhead = overhead; } 8710234Syasuko.eckert@amd.com ~CacheArray(); 8810234Syasuko.eckert@amd.com 8910234Syasuko.eckert@amd.com private: 9010234Syasuko.eckert@amd.com double computeSBTDynEnergy(statsDef *sbt_stats_ptr); 9110234Syasuko.eckert@amd.com}; 9210234Syasuko.eckert@amd.com 9310234Syasuko.eckert@amd.comextern inline 9410234Syasuko.eckert@amd.comdouble CacheArray::computeSBTDynEnergy(statsDef *sbt_stats_p) { 9510234Syasuko.eckert@amd.com if (sbt_dir_overhead == 0) { 9610234Syasuko.eckert@amd.com return 0; 9710234Syasuko.eckert@amd.com } 9810234Syasuko.eckert@amd.com 9910234Syasuko.eckert@amd.com // Write miss on dynamic home node will generate a replacement write on 10010234Syasuko.eckert@amd.com // whole cache block 10110234Syasuko.eckert@amd.com double dynamic = 10210234Syasuko.eckert@amd.com sbt_stats_p->readAc.hit * 10310234Syasuko.eckert@amd.com (local_result.data_array2->power.readOp.dynamic * sbt_dir_overhead + 10410234Syasuko.eckert@amd.com local_result.tag_array2->power.readOp.dynamic) + 10510234Syasuko.eckert@amd.com sbt_stats_p->readAc.miss * 10610234Syasuko.eckert@amd.com local_result.tag_array2->power.readOp.dynamic + 10710234Syasuko.eckert@amd.com sbt_stats_p->writeAc.miss * 10810234Syasuko.eckert@amd.com local_result.tag_array2->power.readOp.dynamic + 10910234Syasuko.eckert@amd.com sbt_stats_p->writeAc.hit * 11010234Syasuko.eckert@amd.com (local_result.data_array2->power.writeOp.dynamic * sbt_dir_overhead + 11110234Syasuko.eckert@amd.com local_result.tag_array2->power.readOp.dynamic+ 11210234Syasuko.eckert@amd.com sbt_stats_p->writeAc.miss * 11310234Syasuko.eckert@amd.com local_result.power.writeOp.dynamic); 11410234Syasuko.eckert@amd.com return dynamic; 11510234Syasuko.eckert@amd.com} 11610234Syasuko.eckert@amd.com 11710234Syasuko.eckert@amd.com#endif /* CACHEARRAY_H_ */ 118