logic.h (10152:52c552138ba1) | logic.h (10234:5cb711fa6176) |
---|---|
1/***************************************************************************** 2 * McPAT 3 * SOFTWARE LICENSE AGREEMENT 4 * Copyright 2012 Hewlett-Packard Development Company, L.P. | 1/***************************************************************************** 2 * McPAT 3 * SOFTWARE LICENSE AGREEMENT 4 * Copyright 2012 Hewlett-Packard Development Company, L.P. |
5 * Copyright (c) 2010-2013 Advanced Micro Devices, Inc. |
|
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 --- 7 unchanged lines hidden (view full) --- 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 | 6 * All Rights Reserved 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are 10 * met: redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer; 12 * redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the --- 7 unchanged lines hidden (view full) --- 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (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 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 * 30 ***************************************************************************/ 31#ifndef LOGIC_H_ 32#define LOGIC_H_ 33 | 30 * 31 ***************************************************************************/ 32#ifndef LOGIC_H_ 33#define LOGIC_H_ 34 |
34#include <cassert> | |
35#include <cmath> 36#include <cstring> 37#include <iostream> 38 | 35#include <cmath> 36#include <cstring> 37#include <iostream> 38 |
39#include "XML_Parse.h" | |
40#include "arch_const.h" 41#include "basic_circuit.h" 42#include "basic_components.h" 43#include "cacti_interface.h" 44#include "component.h" 45#include "const.h" 46#include "decoder.h" 47#include "parameter.h" 48#include "xmlParser.h" 49 50using namespace std; 51 | 39#include "arch_const.h" 40#include "basic_circuit.h" 41#include "basic_components.h" 42#include "cacti_interface.h" 43#include "component.h" 44#include "const.h" 45#include "decoder.h" 46#include "parameter.h" 47#include "xmlParser.h" 48 49using namespace std; 50 |
52class selection_logic : public Component{ | 51class selection_logic : public McPATComponent { |
53public: | 52public: |
54 selection_logic(bool _is_default, int win_entries_, 55 int issue_width_, const InputParameter *configure_interface, 56 enum Device_ty device_ty_=Core_device, 57 enum Core_type core_ty_=Inorder);//, const ParseXML *_XML_interface); 58 bool is_default; 59 InputParameter l_ip; 60 uca_org_t local_result; 61 const ParseXML *XML_interface; 62 int win_entries; 63 int issue_width; 64 int num_threads; 65 enum Device_ty device_ty; 66 enum Core_type core_ty; | 53 bool is_default; 54 InputParameter l_ip; 55 uca_org_t local_result; 56 int win_entries; 57 int issue_width; 58 double accesses; 59 int num_threads; 60 enum Device_ty device_ty; 61 enum Core_type core_ty; |
67 | 62 |
68 void selection_power(); | 63 selection_logic(XMLNode* _xml_data, bool _is_default, int _win_entries, 64 int issue_width_, const InputParameter* configure_interface, 65 string _name, double _accesses, 66 double clockRate_ = 0.0f, 67 enum Device_ty device_ty_ = Core_device, 68 enum Core_type core_ty_ = Inorder); 69 void computeArea(); 70 void computeEnergy(); |
69 void leakage_feedback(double temperature); // TODO | 71 void leakage_feedback(double temperature); // TODO |
72 // TODO: Add a deconstructor |
|
70}; 71 | 73}; 74 |
72class dep_resource_conflict_check : public Component{ | 75class dep_resource_conflict_check : public McPATComponent { |
73public: | 76public: |
74 dep_resource_conflict_check(const InputParameter *configure_interface, const CoreDynParam & dyn_p_, int compare_bits_, bool _is_default=true); 75 InputParameter l_ip; 76 uca_org_t local_result; 77 double WNORn, WNORp, Wevalinvp, Wevalinvn, Wcompn, Wcompp, Wcomppreequ; 78 CoreDynParam coredynp; 79 int compare_bits; 80 bool is_default; 81 statsDef tdp_stats; 82 statsDef rtp_stats; 83 statsDef stats_t; 84 powerDef power_t; | 77 InputParameter l_ip; 78 uca_org_t local_result; 79 double WNORn, WNORp, Wevalinvp, Wevalinvn, Wcompn, Wcompp, Wcomppreequ; 80 CoreParameters coredynp; 81 int compare_bits; 82 bool is_default; 83 statsDef stats_t; |
85 | 84 |
86 void conflict_check_power(); 87 double compare_cap(); 88 ~dep_resource_conflict_check(){ 89 local_result.cleanup(); 90 } | 85 dep_resource_conflict_check(XMLNode* _xml_data, const string _name, 86 const InputParameter *configure_interface, 87 const CoreParameters & dyn_p_, int compare_bits_, 88 double clockRate_ = 0.0f, 89 bool _is_default = true); 90 void conflict_check_power(); 91 double compare_cap(); 92 void computeEnergy() {}; 93 ~dep_resource_conflict_check() { 94 local_result.cleanup(); 95 } |
91 92 void leakage_feedback(double temperature); 93}; 94 | 96 97 void leakage_feedback(double temperature); 98}; 99 |
95class inst_decoder: public Component{ | 100class InstructionDecoder: public McPATComponent { |
96public: | 101public: |
97 inst_decoder(bool _is_default, const InputParameter *configure_interface, 98 int opcode_length_, 99 int num_decoders_, 100 bool x86_, 101 enum Device_ty device_ty_=Core_device, 102 enum Core_type core_ty_=Inorder); 103 inst_decoder(); 104 bool is_default; 105 int opcode_length; 106 int num_decoders; 107 bool x86; 108 int num_decoder_segments; 109 int num_decoded_signals; 110 InputParameter l_ip; 111 uca_org_t local_result; 112 enum Device_ty device_ty; 113 enum Core_type core_ty; | 102 Decoder* final_dec; 103 Predec* pre_dec; |
114 | 104 |
115 Decoder * final_dec; 116 Predec * pre_dec; | 105 bool is_default; 106 int opcode_length; 107 int num_decoders; 108 bool x86; 109 int num_decoder_segments; 110 int num_decoded_signals; 111 InputParameter l_ip; 112 uca_org_t local_result; 113 enum Device_ty device_ty; 114 enum Core_type core_ty; 115 statsDef stats_t; |
117 | 116 |
118 statsDef tdp_stats; 119 statsDef rtp_stats; 120 statsDef stats_t; 121 powerDef power_t; 122 void inst_decoder_delay_power(); 123 ~inst_decoder(); | 117 InstructionDecoder(XMLNode* _xml_data, const string _name, bool _is_default, 118 const InputParameter *configure_interface, 119 int opcode_length_, int num_decoders_, bool x86_, 120 double clockRate_ = 0.0f, 121 enum Device_ty device_ty_ = Core_device, 122 enum Core_type core_ty_ = Inorder); 123 InstructionDecoder(); 124 void computeEnergy() {}; 125 void inst_decoder_delay_power(); 126 ~InstructionDecoder(); |
124 void leakage_feedback(double temperature); 125}; 126 | 127 void leakage_feedback(double temperature); 128}; 129 |
130// TODO: This should be defined elsewhere? This isn't a true McPATComponent |
|
127class DFFCell : public Component { 128public: | 131class DFFCell : public Component { 132public: |
129 DFFCell(bool _is_dram, double _WdecNANDn, double _WdecNANDp,double _cell_load, 130 const InputParameter *configure_interface); 131 InputParameter l_ip; 132 bool is_dram; 133 double cell_load; 134 double WdecNANDn; 135 double WdecNANDp; 136 double clock_cap; 137 int model; 138 int n_switch; 139 int n_keep_1; 140 int n_keep_0; 141 int n_clock; 142 powerDef e_switch; 143 powerDef e_keep_1; 144 powerDef e_keep_0; 145 powerDef e_clock; | 133 InputParameter l_ip; 134 bool is_dram; 135 double cell_load; 136 double WdecNANDn; 137 double WdecNANDp; 138 double clock_cap; 139 int model; 140 int n_switch; 141 int n_keep_1; 142 int n_keep_0; 143 int n_clock; 144 powerDef e_switch; 145 powerDef e_keep_1; 146 powerDef e_keep_0; 147 powerDef e_clock; |
146 | 148 |
147 double fpfp_node_cap(unsigned int fan_in, unsigned int fan_out); 148 void compute_DFF_cell(void); 149 }; | 149 DFFCell(bool _is_dram, double _WdecNANDn, double _WdecNANDp, double _cell_load, 150 const InputParameter *configure_interface); 151 double fpfp_node_cap(unsigned int fan_in, unsigned int fan_out); 152 void compute_DFF_cell(void); 153 ~DFFCell() {}; 154}; |
150 | 155 |
151class Pipeline : public Component{ | 156// TODO: This is a very ambiguous component. Try to refactor it. 157class Pipeline : public McPATComponent { |
152public: | 158public: |
153 Pipeline(const InputParameter *configure_interface, const CoreDynParam & dyn_p_, enum Device_ty device_ty_=Core_device, bool _is_core_pipeline=true, bool _is_default=true); 154 InputParameter l_ip; 155 uca_org_t local_result; 156 CoreDynParam coredynp; 157 enum Device_ty device_ty; 158 bool is_core_pipeline, is_default; 159 double num_piperegs; 160// int pipeline_stages; 161// int tot_stage_vector, per_stage_vector; 162 bool process_ind; 163 double WNANDn ; 164 double WNANDp; 165 double load_per_pipeline_stage; 166// int Hthread, num_thread, fetchWidth, decodeWidth, issueWidth, commitWidth, instruction_length; 167// int PC_width, opcode_length, num_arch_reg_tag, data_width,num_phsical_reg_tag, address_width; 168// bool thread_clock_gated; 169// bool in_order, multithreaded; 170 void compute_stage_vector(); 171 void compute(); 172 ~Pipeline(){ 173 local_result.cleanup(); 174 }; | 159 InputParameter l_ip; 160 uca_org_t local_result; 161 CoreParameters coredynp; 162 enum Device_ty device_ty; 163 bool is_core_pipeline, is_default; 164 double num_piperegs; 165 bool process_ind; 166 double WNANDn; 167 double WNANDp; 168 double load_per_pipeline_stage; |
175 | 169 |
170 Pipeline(XMLNode* _xml_data, const InputParameter *configure_interface, 171 const CoreParameters & dyn_p_, 172 enum Device_ty device_ty_ = Core_device, 173 bool _is_core_pipeline = true, bool _is_default = true); 174 void compute_stage_vector(); 175 /** 176 * TODO: compute() completes work that should be completed in computeArea() 177 * and computeEnergy() recursively. Consider shifting these calculations 178 * around to be consistent with rest of hierarchy 179 */ 180 void compute(); 181 void computeArea() {}; 182 // TODO: Move energy computation to this function to unify hierarchy 183 void computeEnergy() {}; 184 ~Pipeline() { 185 local_result.cleanup(); 186 }; 187 |
|
176}; 177 | 188}; 189 |
178//class core_pipeline :public pipeline{ 179//public: 180// int Hthread, num_thread, fetchWidth, decodeWidth, issueWidth, commitWidth, instruction_length; 181// int PC_width, opcode_length, num_arch_reg_tag, data_width,num_phsical_reg_tag, address_width; 182// bool thread_clock_gated; 183// bool in_order, multithreaded; 184// core_pipeline(bool _is_default, const InputParameter *configure_interface); 185// virtual void compute_stage_vector(); 186// 187//}; 188 189class FunctionalUnit :public Component{ | 190class FunctionalUnit : public McPATComponent { |
190public: | 191public: |
191 ParseXML *XML; 192 int ithCore; 193 InputParameter interface_ip; 194 CoreDynParam coredynp; 195 double FU_height; 196 double clockRate,executionTime; 197 double num_fu; 198 double energy, base_energy,per_access_energy, leakage, gate_leakage; 199 bool is_default; 200 enum FU_type fu_type; 201 statsDef tdp_stats; 202 statsDef rtp_stats; 203 statsDef stats_t; 204 powerDef power_t; | 192 InputParameter interface_ip; 193 CoreParameters core_params; 194 CoreStatistics core_stats; 195 double FU_height; 196 double num_fu; 197 double energy; 198 double base_energy; 199 double per_access_energy; 200 bool is_default; 201 enum FU_type fu_type; 202 statsDef stats_t; |
205 | 203 |
206 FunctionalUnit(ParseXML *XML_interface, int ithCore_, InputParameter* interface_ip_,const CoreDynParam & dyn_p_, enum FU_type fu_type); 207 void computeEnergy(bool is_tdp=true); 208 void displayEnergy(uint32_t indent = 0,int plevel = 100, bool is_tdp=true); | 204 FunctionalUnit(XMLNode* _xml_data, InputParameter* interface_ip_, 205 const CoreParameters & _core_params, 206 const CoreStatistics & _core_stats, enum FU_type fu_type); 207 void computeEnergy(); |
209 void leakage_feedback(double temperature); | 208 void leakage_feedback(double temperature); |
210 | 209 ~FunctionalUnit() {}; |
211}; 212 | 210}; 211 |
213class UndiffCore :public Component{ | 212// TODO: This is a very ambiguous component. Try to refactor it. 213class UndiffCore : public McPATComponent { |
214public: | 214public: |
215 UndiffCore(ParseXML* XML_interface, int ithCore_, InputParameter* interface_ip_, const CoreDynParam & dyn_p_, bool exist_=true, bool embedded_=false); 216 ParseXML *XML; 217 int ithCore; 218 InputParameter interface_ip; 219 CoreDynParam coredynp; 220 double clockRate,executionTime; 221 double scktRatio, chip_PR_overhead, macro_PR_overhead; 222 enum Core_type core_ty; 223 bool opt_performance, embedded; 224 double pipeline_stage,num_hthreads,issue_width; 225 bool is_default; | 215 InputParameter interface_ip; 216 CoreParameters coredynp; 217 double scktRatio; 218 double chip_PR_overhead; 219 double macro_PR_overhead; 220 enum Core_type core_ty; 221 bool opt_performance; 222 bool embedded; 223 double pipeline_stage; 224 double num_hthreads; 225 double issue_width; 226 bool is_default; 227 bool exist; |
226 | 228 |
227 void displayEnergy(uint32_t indent = 0,int plevel = 100, bool is_tdp=true); 228 ~UndiffCore(){}; 229 bool exist; 230 231 | 229 UndiffCore(XMLNode* _xml_data, InputParameter* interface_ip_, 230 const CoreParameters & dyn_p_, 231 bool exist_ = true); 232 void computeArea() {}; 233 // TODO: Move energy computation to this function to unify hierarchy 234 void computeEnergy() {}; 235 ~UndiffCore() {}; |
232}; 233#endif /* LOGIC_H_ */ | 236}; 237#endif /* LOGIC_H_ */ |