Changeset 138 for trunk/IPs/systemC/processor/Morpheo/Behavioural/include
- Timestamp:
- May 12, 2010, 7:34:01 PM (15 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Behavioural/include
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Signal.h
r137 r138 143 143 } 144 144 } 145 #endif 145 146 146 147 #undef FUNCTION … … 184 185 log_printf(FUNC,Behavioural,FUNCTION,"End"); 185 186 } 186 #endif 187 188 189 #undef FUNCTION 190 #define FUNCTION "Signal::alloc" 191 void dealloc (void) 192 { 193 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 194 195 switch (_direction) 196 { 197 case INTERNAL : 198 switch (_type_info) 199 { 200 case BOOL : delete (static_cast<sc_signal <bool > *>(_sc_signal_map)); break; 201 case UINT8_T : delete (static_cast<sc_signal <uint8_t > *>(_sc_signal_map)); break; 202 case UINT16_T : delete (static_cast<sc_signal <uint16_t> *>(_sc_signal_map)); break; 203 case UINT32_T : delete (static_cast<sc_signal <uint32_t> *>(_sc_signal_map)); break; 204 case UINT64_T : delete (static_cast<sc_signal <uint64_t> *>(_sc_signal_map)); break; 205 default : throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.\n")); 206 } 207 default : throw (ErrorMorpheo ("Signal \""+_name+"\" : invalid direction.\n")); 208 209 210 } 211 212 log_printf(FUNC,Behavioural,FUNCTION,"End"); 213 } 187 214 188 215 #ifdef VHDL -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Simulation.h
r124 r138 19 19 namespace behavioural { 20 20 21 typedef enum 22 { 23 ALL_THREAD, 24 EACH_THREAD_AND_CONTINUE, 25 EACH_THREAD_AND_STOP 26 } stop_type_t; 27 21 28 extern bool _simulation_stop_exception; 22 29 extern double _simulation_nb_cycle; 23 30 extern double _simulation_nb_instruction; 24 31 extern std::vector<double> _simulation_nb_instruction_commited; 32 extern stop_type_t _simulation_stop_type; 25 33 extern bool _simulation_file_with_date; 26 34 extern bool _simulation_file_with_pid ; … … 29 37 30 38 bool simulation_test_end (void); 31 void simulation_init (double nb_cycle, 32 double denug_nb_cycle, 33 double nb_instruction, 34 bool file_with_date, 35 bool file_with_pid); 39 void simulation_init (double nb_cycle, 40 double denug_nb_cycle, 41 double nb_instruction, 42 stop_type_t stop_type, 43 bool file_with_date, 44 bool file_with_pid); 36 45 }; // end namespace behavioural 46 47 template<> inline std::string toString<morpheo::behavioural::stop_type_t>(const morpheo::behavioural::stop_type_t& x) 48 { 49 switch (x) 50 { 51 case morpheo::behavioural::ALL_THREAD : return "all_thread"; break; 52 case morpheo::behavioural::EACH_THREAD_AND_CONTINUE : return "each_thread_and_continue"; break; 53 case morpheo::behavioural::EACH_THREAD_AND_STOP : return "each_thread_and_stop"; break; 54 default : return ""; break; 55 } 56 }; 57 58 template<> inline morpheo::behavioural::stop_type_t fromString<morpheo::behavioural::stop_type_t>(const std::string& x) 59 { 60 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::ALL_THREAD))) == 0) or 61 (x.compare(toString( morpheo::behavioural::ALL_THREAD )) == 0)) 62 return morpheo::behavioural::ALL_THREAD; 63 64 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::EACH_THREAD_AND_CONTINUE))) == 0) or 65 (x.compare(toString( morpheo::behavioural::EACH_THREAD_AND_CONTINUE )) == 0)) 66 return morpheo::behavioural::EACH_THREAD_AND_CONTINUE; 67 68 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::EACH_THREAD_AND_STOP))) == 0) or 69 (x.compare(toString( morpheo::behavioural::EACH_THREAD_AND_STOP )) == 0)) 70 return morpheo::behavioural::EACH_THREAD_AND_STOP; 71 72 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 73 }; 74 37 75 }; // end namespace morpheo 38 76 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat.h
r124 r138 49 49 private: const cycle_t _period; 50 50 private: const bool _save_periodic; 51 private: bool _generate_file; 52 51 53 // Tableau des variables 52 54 private: std::map<std::string, var_t> * _list_operand; 53 55 // Liste chaîné des expressions 54 56 private: std::list<expr_t> * _list_expr; 57 // List chaîné des "counters" (seulement pour la désallocation) 58 private: std::list<counters_t*> * _list_counters; 55 59 56 60 private: counter_t * _cycle; 57 61 58 62 private: std::list<Stat *> * _list_stat; 59 60 private: bool _generate_file;61 63 62 64 public : Stat (std::string name_instance, … … 73 75 std::string unit, 74 76 std::string description); 77 public : counters_t * create_counters (std::string varname, 78 uint32_t nb_counter, 79 std::string unit, 80 std::string description_counter, // need one %d 81 std::string description_percent, // need one %d 82 std::string description_average); 75 83 private : counter_t * alloc_operand (counter_type_t type, 76 84 std::string varname, -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat_type.h
r81 r138 6 6 #include <map> 7 7 #include <utility> 8 #include <cassert> 8 9 9 10 namespace morpheo { … … 19 20 //typedef std::pair<std::string, operator_t> pair_string_operator_t; 20 21 22 class counters_t 23 { 24 private : const uint32_t _nb_counter; 25 private : counter_t ** _counter; 26 27 public : counters_t (uint32_t nb_counter): 28 _nb_counter (nb_counter+1) 29 { 30 assert(nb_counter>0); 31 32 _counter = new counter_t * [_nb_counter]; 33 } 34 35 // public : counters_t (const counters_t & x): 36 // _nb_counter (x._nb_counter) 37 // { 38 // _counter = new counter_t [_nb_counter]; 39 40 // for (uint32_t i=0; i<_nb_counter; ++i) 41 // _counter[i] = x._counter[i]; 42 // } 43 44 public : ~counters_t (void) 45 { 46 delete [] _counter; 47 } 48 49 public : void set_counter (counter_t * counter, 50 uint32_t index) 51 { 52 assert((index >= 0) and (index < _nb_counter)); 53 54 _counter [index] = counter; 55 } 56 57 // public : friend const counters_t operator+ (const counters_t & left, 58 // const uint32_t right) 59 // { 60 // assert((right >= 0) and (right <= left._nb_counter)); 61 62 // counters_t tmp=left; 63 64 // tmp._counter[right] ++; 65 66 // return tmp; 67 // } 68 69 public : const counters_t & operator+= (const uint32_t value) 70 { 71 assert((value >= 0) and (value <= _nb_counter)); 72 73 (*_counter[value]) ++; 74 75 return *this; 76 } 77 78 }; 79 21 80 }; 22 81 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Types.h
r128 r138 172 172 template<> inline morpheo::behavioural::Tpriority_t fromString<morpheo::behavioural::Tpriority_t>(const std::string& x) 173 173 { 174 if ( 175 (x.compare("priority_static")== 0))174 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PRIORITY_STATIC))) == 0) or 175 (x.compare(toString( morpheo::behavioural::PRIORITY_STATIC )) == 0)) 176 176 return morpheo::behavioural::PRIORITY_STATIC; 177 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PRIORITY_ROUND_ROBIN))) == 0) or 178 (x.compare("priority_round_robin") == 0)) 177 178 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PRIORITY_ROUND_ROBIN))) == 0) or 179 (x.compare(toString( morpheo::behavioural::PRIORITY_ROUND_ROBIN )) == 0)) 179 180 return morpheo::behavioural::PRIORITY_ROUND_ROBIN; 181 180 182 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 181 183 }; … … 193 195 template<> inline morpheo::behavioural::Tload_balancing_t fromString<morpheo::behavioural::Tload_balancing_t>(const std::string& x) 194 196 { 195 if ( 196 (x.compare("load_balancing_balance") == 0))197 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::LOAD_BALANCING_BALANCE))) == 0) or 198 (x.compare(toString( morpheo::behavioural::LOAD_BALANCING_BALANCE )) == 0)) 197 199 return morpheo::behavioural::LOAD_BALANCING_BALANCE; 198 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::LOAD_BALANCING_MAXIMUM_FOR_PRIORITY))) == 0) or 199 (x.compare("load_balancing_maximum_for_priority") == 0)) 200 201 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::LOAD_BALANCING_MAXIMUM_FOR_PRIORITY))) == 0) or 202 (x.compare(toString( morpheo::behavioural::LOAD_BALANCING_MAXIMUM_FOR_PRIORITY )) == 0)) 200 203 return morpheo::behavioural::LOAD_BALANCING_MAXIMUM_FOR_PRIORITY; 204 201 205 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 202 206 }; … … 218 222 template<> inline morpheo::behavioural::Tvictim_t fromString<morpheo::behavioural::Tvictim_t>(const std::string& x) 219 223 { 220 if ( 221 (x.compare("victim_random")== 0))224 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_RANDOM ))) == 0) or 225 (x.compare(toString( morpheo::behavioural::VICTIM_RANDOM )) == 0)) 222 226 return morpheo::behavioural::VICTIM_RANDOM; 223 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_ROUND_ROBIN))) == 0) or 224 (x.compare("victim_round_robin") == 0)) 227 228 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_ROUND_ROBIN))) == 0) or 229 (x.compare(toString( morpheo::behavioural::VICTIM_ROUND_ROBIN )) == 0)) 225 230 return morpheo::behavioural::VICTIM_ROUND_ROBIN; 226 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_NLU ))) == 0) or 227 (x.compare("victim_nlu") == 0)) 231 232 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_NLU ))) == 0) or 233 (x.compare(toString( morpheo::behavioural::VICTIM_NLU )) == 0)) 228 234 return morpheo::behavioural::VICTIM_NLU; 229 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_PSEUDO_LRU ))) == 0) or 230 (x.compare("victim_pseudo_lru") == 0)) 235 236 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_PSEUDO_LRU ))) == 0) or 237 (x.compare(toString( morpheo::behavioural::VICTIM_PSEUDO_LRU )) == 0)) 231 238 return morpheo::behavioural::VICTIM_PSEUDO_LRU; 232 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_LRU ))) == 0) or 233 (x.compare("victim_lru") == 0)) 239 240 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_LRU ))) == 0) or 241 (x.compare(toString( morpheo::behavioural::VICTIM_LRU )) == 0)) 234 242 return morpheo::behavioural::VICTIM_LRU; 235 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_FIFO ))) == 0) or 236 (x.compare("victim_fifo") == 0)) 243 244 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::VICTIM_FIFO ))) == 0) or 245 (x.compare(toString( morpheo::behavioural::VICTIM_FIFO )) == 0)) 237 246 return morpheo::behavioural::VICTIM_FIFO; 247 238 248 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 239 249 }; … … 258 268 template<> inline morpheo::behavioural::Tpredictor_t fromString<morpheo::behavioural::Tpredictor_t>(const std::string& x) 259 269 { 260 if ( 261 (x.compare("predictor_never_take")== 0))270 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_NEVER_TAKE ))) == 0) or 271 (x.compare(toString( morpheo::behavioural::PREDICTOR_NEVER_TAKE )) == 0)) 262 272 return morpheo::behavioural::PREDICTOR_NEVER_TAKE; 263 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_ALWAYS_TAKE))) == 0) or 264 (x.compare("predictor_always_take") == 0)) 273 274 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_ALWAYS_TAKE))) == 0) or 275 (x.compare(toString( morpheo::behavioural::PREDICTOR_ALWAYS_TAKE )) == 0)) 265 276 return morpheo::behavioural::PREDICTOR_ALWAYS_TAKE; 266 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_STATIC ))) == 0) or 267 (x.compare("predictor_static") == 0)) 277 278 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_STATIC ))) == 0) or 279 (x.compare(toString( morpheo::behavioural::PREDICTOR_STATIC )) == 0)) 268 280 return morpheo::behavioural::PREDICTOR_STATIC; 269 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_LAST_TAKE ))) == 0) or 270 (x.compare("predictor_last_take") == 0)) 281 282 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_LAST_TAKE ))) == 0) or 283 (x.compare(toString( morpheo::behavioural::PREDICTOR_LAST_TAKE )) == 0)) 271 284 return morpheo::behavioural::PREDICTOR_LAST_TAKE; 272 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_COUNTER ))) == 0) or 273 (x.compare("predictor_counter") == 0)) 285 286 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_COUNTER ))) == 0) or 287 (x.compare(toString( morpheo::behavioural::PREDICTOR_COUNTER )) == 0)) 274 288 return morpheo::behavioural::PREDICTOR_COUNTER; 275 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_LOCAL ))) == 0) or 276 (x.compare("predictor_local") == 0)) 289 290 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_LOCAL ))) == 0) or 291 (x.compare(toString( morpheo::behavioural::PREDICTOR_LOCAL )) == 0)) 277 292 return morpheo::behavioural::PREDICTOR_LOCAL; 278 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_GLOBAL ))) == 0) or 279 (x.compare("predictor_global") == 0)) 293 294 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_GLOBAL ))) == 0) or 295 (x.compare(toString( morpheo::behavioural::PREDICTOR_GLOBAL )) == 0)) 280 296 return morpheo::behavioural::PREDICTOR_GLOBAL; 281 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_META ))) == 0) or 282 (x.compare("predictor_meta") == 0)) 297 298 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_META ))) == 0) or 299 (x.compare(toString( morpheo::behavioural::PREDICTOR_META )) == 0)) 283 300 return morpheo::behavioural::PREDICTOR_META; 284 if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_CUSTOM ))) == 0) or 285 (x.compare("predictor_custom") == 0)) 301 302 if ((x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::PREDICTOR_CUSTOM ))) == 0) or 303 (x.compare(toString( morpheo::behavioural::PREDICTOR_CUSTOM )) == 0)) 286 304 return morpheo::behavioural::PREDICTOR_CUSTOM; 305 287 306 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 288 307 };
Note: See TracChangeset
for help on using the changeset viewer.