basic_components.cc revision 10152
1/***************************************************************************** 2 * McPAT 3 * SOFTWARE LICENSE AGREEMENT 4 * Copyright 2012 Hewlett-Packard Development Company, L.P. 5 * All Rights Reserved 6 * 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. 17 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.” 29 * 30 ***************************************************************************/ 31 32#include <cassert> 33#include <cmath> 34#include <iostream> 35 36#include "basic_components.h" 37 38double longer_channel_device_reduction( 39 enum Device_ty device_ty, 40 enum Core_type core_ty) 41{ 42 43 double longer_channel_device_percentage_core; 44 double longer_channel_device_percentage_uncore; 45 double longer_channel_device_percentage_llc; 46 47 double long_channel_device_reduction; 48 49 longer_channel_device_percentage_llc = 1.0; 50 longer_channel_device_percentage_uncore = 0.82; 51 if (core_ty==OOO) 52 { 53 longer_channel_device_percentage_core = 0.56;//0.54 Xeon Tulsa //0.58 Nehelam 54 //longer_channel_device_percentage_uncore = 0.76;//0.85 Nehelam 55 56 } 57 else 58 { 59 longer_channel_device_percentage_core = 0.8;//0.8;//Niagara 60 //longer_channel_device_percentage_uncore = 0.9;//Niagara 61 } 62 63 if (device_ty==Core_device) 64 { 65 long_channel_device_reduction = (1- longer_channel_device_percentage_core) 66 + longer_channel_device_percentage_core * g_tp.peri_global.long_channel_leakage_reduction; 67 } 68 else if (device_ty==Uncore_device) 69 { 70 long_channel_device_reduction = (1- longer_channel_device_percentage_uncore) 71 + longer_channel_device_percentage_uncore * g_tp.peri_global.long_channel_leakage_reduction; 72 } 73 else if (device_ty==LLC_device) 74 { 75 long_channel_device_reduction = (1- longer_channel_device_percentage_llc) 76 + longer_channel_device_percentage_llc * g_tp.peri_global.long_channel_leakage_reduction; 77 } 78 else 79 { 80 cout<<"unknown device category"<<endl; 81 exit(0); 82 } 83 84 return long_channel_device_reduction; 85} 86 87statsComponents operator+(const statsComponents & x, const statsComponents & y) 88{ 89 statsComponents z; 90 91 z.access = x.access + y.access; 92 z.hit = x.hit + y.hit; 93 z.miss = x.miss + y.miss; 94 95 return z; 96} 97 98statsComponents operator*(const statsComponents & x, double const * const y) 99{ 100 statsComponents z; 101 102 z.access = x.access*y[0]; 103 z.hit = x.hit*y[1]; 104 z.miss = x.miss*y[2]; 105 106 return z; 107} 108 109statsDef operator+(const statsDef & x, const statsDef & y) 110{ 111 statsDef z; 112 113 z.readAc = x.readAc + y.readAc; 114 z.writeAc = x.writeAc + y.writeAc; 115 z.searchAc = x.searchAc + y.searchAc; 116 return z; 117} 118 119statsDef operator*(const statsDef & x, double const * const y) 120{ 121 statsDef z; 122 123 z.readAc = x.readAc*y; 124 z.writeAc = x.writeAc*y; 125 z.searchAc = x.searchAc*y; 126 return z; 127} 128