- Timestamp:
- Mar 27, 2008, 11:04:49 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Types.h
r77 r78 4 4 #include "Common/include/Types.h" 5 5 #include "Common/include/ToString.h" 6 #include "Common/include/FromString.h" 7 #include "Common/include/ErrorMorpheo.h" 6 8 #include "Behavioural/include/Constants.h" 7 9 … … 14 16 15 17 // ***** general 16 typedef bool Tcontrol_t; 17 typedef uint32_t Toperation_t; 18 //typedef uint32_t Tdestination1_t; 19 //typedef uint32_t Tdestination2_t; 20 //typedef uint32_t Texec_flag_t; 21 //typedef bool Texec_excep_t; 22 //typedef uint32_t Tcondition_t; 23 //typedef uint32_t Tbranch_state_t; 24 25 typedef uint32_t Texception_t; 26 typedef uint32_t Tcontext_t; 27 typedef uint32_t Tpacket_t; 28 typedef uint32_t Ttype_t; 29 30 // ***** Register 31 typedef uint32_t Tgeneral_address_t; 32 typedef uint32_t Tgeneral_data_t; 33 typedef uint32_t Tspecial_address_t; 34 typedef uint32_t Tspecial_data_t; 18 typedef uint32_t Tinstruction_t; 19 typedef bool Tcontrol_t; 20 typedef uint8_t Toperation_t; 21 //typedef uint32_t Tdestination1_t; 22 //typedef uint32_t Tdestination2_t; 23 //typedef uint32_t Texec_flag_t; 24 //typedef bool Texec_excep_t; 25 26 typedef uint8_t Texception_t; 27 typedef uint8_t Tcontext_t; 28 typedef uint8_t Tpacket_t; 29 typedef uint8_t Ttype_t; 30 typedef uint8_t Tevent_state_t; 31 typedef uint8_t Tevent_type_t; 32 typedef uint8_t Tcounter_t; // universal counter 33 typedef uint8_t Tptr_t; // universal pointer 34 35 // ***** Register 36 typedef uint32_t Tgeneral_address_t; 37 typedef uint32_t Tgeneral_data_t; 38 typedef uint32_t Tspecial_address_t; 39 typedef uint32_t Tspecial_data_t; 35 40 36 41 // ***** component dependant 37 // ~~~~~ load store queue 38 typedef uint32_t Taccess_t; 39 typedef uint32_t Tlsq_ptr_t; 40 typedef uint32_t Tdcache_address_t; 41 typedef uint32_t Tdcache_data_t; 42 typedef bool Tdcache_error_t; 43 typedef uint32_t Tdcache_type_t; 42 // ~~~~~ load store queue 43 typedef uint8_t Taccess_t; 44 typedef uint8_t Tlsq_ptr_t; 45 typedef uint32_t Tdcache_address_t; 46 typedef uint32_t Tdcache_data_t; 47 typedef bool Tdcache_error_t; 48 typedef uint8_t Tdcache_type_t; 49 50 // ~~~~~ prediction_unit 51 typedef uint8_t Thistory_t; 52 typedef uint8_t Tprediction_ptr_t; 53 typedef uint8_t Tbranch_state_t; 54 typedef uint8_t Tbranch_condition_t; 55 typedef uint8_t Tdepth_t; 56 typedef Tgeneral_data_t Taddress_t; 57 58 59 // ~~~~~ ifetch 60 typedef uint8_t Tinst_ifetch_ptr_t; 61 typedef uint8_t Tifetch_queue_ptr_t; 62 typedef uint32_t Ticache_address_t; 63 typedef uint32_t Ticache_instruction_t; 64 typedef bool Ticache_error_t; 65 typedef uint8_t Ticache_type_t; 66 67 typedef enum 68 { 69 PRIORITY_STATIC, 70 PRIORITY_ROUND_ROBIN 71 } Tpriority_t; 72 73 typedef enum 74 { 75 LOAD_BALANCING_BALANCE, 76 LOAD_BALANCING_MAXIMUM_FOR_PRIORITY 77 } Tload_balancing_t; 78 79 typedef enum 80 { 81 VICTIM_RANDOM , // Random 82 VICTIM_ROUND_ROBIN, // Round Robin 83 VICTIM_NLU , // Not Last Used 84 VICTIM_PSEUDO_LRU , // Pseudo Least Recently Used 85 VICTIM_LRU , // Least Recently Used 86 VICTIM_FIFO // First IN First OUT 87 } Tvictim_t; 88 89 typedef enum 90 { 91 PREDICTOR_NEVER_TAKE , // Branch is never Take 92 PREDICTOR_ALWAYS_TAKE , // Branch is always Take 93 PREDICTOR_STATIC , // If the adress of destination is previous, then the branch is take 94 PREDICTOR_LAST_TAKE , // The direction is as the last time (if is the first time : static) 95 PREDICTOR_COUNTER , // Counter table 96 PREDICTOR_LOCAL , // Counter bank indexed with history bank 97 PREDICTOR_GLOBAL , // Counter bank indexed with history table 98 PREDICTOR_META , // A meta_predictor choose between 2 predictor : the local or the global 99 PREDICTOR_CUSTOM // Note predefined scheme 100 } Tpredictor_t; 44 101 45 102 //----------------------------------------------[ spr_mode_access ]----- … … 56 113 } 57 114 }; 58 59 inline Tcontext_t get_num_thread (Tcontext_t num_context_id , uint32_t size_context_id ,60 Tcontext_t num_front_end_id , uint32_t size_front_end_id ,61 Tcontext_t num_ooo_engine_id, uint32_t size_ooo_engine_id)62 {63 return ((num_ooo_engine_id << (size_context_id + size_front_end_id)) |64 (num_front_end_id << (size_context_id)) |65 (num_context_id));66 }67 68 inline uint32_t get_nb_thread (uint32_t nb_context ,69 uint32_t nb_front_end ,70 uint32_t nb_ooo_engine )71 {72 return (nb_ooo_engine *73 nb_front_end *74 nb_context) ;75 }76 115 77 116 }; // end namespace behavioural … … 96 135 }; 97 136 137 template<> inline std::string toString<morpheo::behavioural::Tpriority_t>(const morpheo::behavioural::Tpriority_t& x) 138 { 139 switch (x) 140 { 141 case morpheo::behavioural::PRIORITY_STATIC : return "priority_static"; break; 142 case morpheo::behavioural::PRIORITY_ROUND_ROBIN : return "priority_round_robin"; break; 143 default : return "" ; break; 144 } 145 }; 146 147 template<> inline morpheo::behavioural::Tpriority_t fromString<morpheo::behavioural::Tpriority_t>(const std::string& x) 148 { 149 if ( (x.compare("0") == 0) or 150 (x.compare("priority_static") == 0)) 151 return morpheo::behavioural::PRIORITY_STATIC; 152 if ( (x.compare("1") == 0) or 153 (x.compare("priority_round_robin") == 0)) 154 return morpheo::behavioural::PRIORITY_ROUND_ROBIN; 155 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 156 }; 157 158 template<> inline std::string toString<morpheo::behavioural::Tload_balancing_t>(const morpheo::behavioural::Tload_balancing_t& x) 159 { 160 switch (x) 161 { 162 case morpheo::behavioural::LOAD_BALANCING_BALANCE : return "load_balancing_balance"; break; 163 case morpheo::behavioural::LOAD_BALANCING_MAXIMUM_FOR_PRIORITY : return "load_balancing_maximum_for_priority"; break; 164 default : return "" ; break; 165 } 166 }; 167 168 template<> inline morpheo::behavioural::Tload_balancing_t fromString<morpheo::behavioural::Tload_balancing_t>(const std::string& x) 169 { 170 if ( (x.compare("0") == 0) or 171 (x.compare("load_balancing_balance") == 0)) 172 return morpheo::behavioural::LOAD_BALANCING_BALANCE; 173 if ( (x.compare("1") == 0) or 174 (x.compare("load_balancing_maximum_for_priority") == 0)) 175 return morpheo::behavioural::LOAD_BALANCING_MAXIMUM_FOR_PRIORITY; 176 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 177 }; 178 179 template<> inline std::string toString<morpheo::behavioural::Tvictim_t>(const morpheo::behavioural::Tvictim_t& x) 180 { 181 switch (x) 182 { 183 case morpheo::behavioural::VICTIM_RANDOM : return "victim_random" ; break; 184 case morpheo::behavioural::VICTIM_ROUND_ROBIN : return "victim_round_robin"; break; 185 case morpheo::behavioural::VICTIM_NLU : return "victim_nlu" ; break; 186 case morpheo::behavioural::VICTIM_PSEUDO_LRU : return "victim_pseudo_lru" ; break; 187 case morpheo::behavioural::VICTIM_LRU : return "victim_lru" ; break; 188 case morpheo::behavioural::VICTIM_FIFO : return "victim_fifo" ; break; 189 default : return "" ; break; 190 } 191 }; 192 193 template<> inline morpheo::behavioural::Tvictim_t fromString<morpheo::behavioural::Tvictim_t>(const std::string& x) 194 { 195 if ( (x.compare("0") == 0) or 196 (x.compare("victim_random") == 0)) 197 return morpheo::behavioural::VICTIM_RANDOM; 198 if ( (x.compare("1") == 0) or 199 (x.compare("victim_round_robin") == 0)) 200 return morpheo::behavioural::VICTIM_ROUND_ROBIN; 201 if ( (x.compare("2") == 0) or 202 (x.compare("victim_nlu") == 0)) 203 return morpheo::behavioural::VICTIM_NLU; 204 if ( (x.compare("3") == 0) or 205 (x.compare("victim_pseudo_lru") == 0)) 206 return morpheo::behavioural::VICTIM_PSEUDO_LRU; 207 if ( (x.compare("4") == 0) or 208 (x.compare("victim_lru") == 0)) 209 return morpheo::behavioural::VICTIM_LRU; 210 if ( (x.compare("5") == 0) or 211 (x.compare("victim_fifo") == 0)) 212 return morpheo::behavioural::VICTIM_FIFO; 213 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 214 }; 215 216 template<> inline std::string toString<morpheo::behavioural::Tpredictor_t>(const morpheo::behavioural::Tpredictor_t& x) 217 { 218 switch (x) 219 { 220 case morpheo::behavioural::PREDICTOR_NEVER_TAKE : return "predictor_never_take" ; break; 221 case morpheo::behavioural::PREDICTOR_ALWAYS_TAKE : return "predictor_always_take"; break; 222 case morpheo::behavioural::PREDICTOR_STATIC : return "predictor_static" ; break; 223 case morpheo::behavioural::PREDICTOR_LAST_TAKE : return "predictor_last_take" ; break; 224 case morpheo::behavioural::PREDICTOR_COUNTER : return "predictor_counter" ; break; 225 case morpheo::behavioural::PREDICTOR_LOCAL : return "predictor_local" ; break; 226 case morpheo::behavioural::PREDICTOR_GLOBAL : return "predictor_global" ; break; 227 case morpheo::behavioural::PREDICTOR_META : return "predictor_meta" ; break; 228 case morpheo::behavioural::PREDICTOR_CUSTOM : return "predictor_custom" ; break; 229 default : return "" ; break; 230 } 231 }; 232 233 template<> inline morpheo::behavioural::Tpredictor_t fromString<morpheo::behavioural::Tpredictor_t>(const std::string& x) 234 { 235 if ( (x.compare("0") == 0) or 236 (x.compare("predictor_never_take") == 0)) 237 return morpheo::behavioural::PREDICTOR_NEVER_TAKE; 238 if ( (x.compare("1") == 0) or 239 (x.compare("predictor_always_take") == 0)) 240 return morpheo::behavioural::PREDICTOR_ALWAYS_TAKE; 241 if ( (x.compare("2") == 0) or 242 (x.compare("predictor_static") == 0)) 243 return morpheo::behavioural::PREDICTOR_STATIC; 244 if ( (x.compare("3") == 0) or 245 (x.compare("predictor_last_take") == 0)) 246 return morpheo::behavioural::PREDICTOR_LAST_TAKE; 247 if ( (x.compare("4") == 0) or 248 (x.compare("predictor_counter") == 0)) 249 return morpheo::behavioural::PREDICTOR_COUNTER; 250 if ( (x.compare("5") == 0) or 251 (x.compare("predictor_local") == 0)) 252 return morpheo::behavioural::PREDICTOR_LOCAL; 253 if ( (x.compare("6") == 0) or 254 (x.compare("predictor_global") == 0)) 255 return morpheo::behavioural::PREDICTOR_GLOBAL; 256 if ( (x.compare("7") == 0) or 257 (x.compare("predictor_meta") == 0)) 258 return morpheo::behavioural::PREDICTOR_META; 259 if ( (x.compare("8") == 0) or 260 (x.compare("predictor_custom") == 0)) 261 return morpheo::behavioural::PREDICTOR_CUSTOM; 262 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 263 }; 264 98 265 }; // end namespace morpheo 99 100 266 #endif
Note: See TracChangeset
for help on using the changeset viewer.