Changeset 60 for sources/src/schedulers.cc
- Timestamp:
- Feb 14, 2017, 11:30:19 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/src/schedulers.cc
r59 r60 49 49 #include "graph_signals.h" // makegraph 50 50 51 #ifdef _OPENMP 52 #include <omp.h> 53 #endif 54 51 55 #ifdef HAVE_CONFIG_H 52 56 #include "config.h" … … 57 61 namespace sc_core { 58 62 63 // sort_functions splits and sorts instances_list into three functions lists : 64 method_process_list_t * transition_func_list; 65 method_process_list_t * moore_func_list; 66 #pragma omp threadprivate(transition_func_list, moore_func_list) 67 method_process_list_t combinational_func_list; 59 68 /* ***************************** */ 60 69 /* Dumping functions (for debug) */ … … 74 83 /****************/ 75 84 76 // sort_functions splits and sorts instances_list into three functions lists :77 method_process_list_t transition_func_list;78 method_process_list_t moore_func_list;79 method_process_list_t combinational_func_list;80 85 81 86 … … 115 120 void sort_functions() { 116 121 method_process_list_t::const_iterator m; 122 #pragma omp parallel 123 #pragma omp critical 124 { 125 transition_func_list = new method_process_list_t; 126 moore_func_list = new method_process_list_t; 127 for (m = method_process_list.begin(); m != method_process_list.end(); ++m) { 128 #ifdef _OPENMP 129 if ((*m)->omp_threadnum == omp_get_thread_num()) 130 #endif 131 { 132 if ((*m)->is_transition()) { 133 transition_func_list->push_back(*m); 134 } 135 else if ((*m)->is_genmoore()) { 136 moore_func_list->push_back(*m); 137 } 138 } 139 } 140 // Sort transition functions by method pointer (1) and by module pointer (2) 141 std::sort(transition_func_list->begin(), transition_func_list->end(), sort_by_fct_ptr); 142 // Sort generation functions by method pointer (1) and by module pointer (2) 143 std::sort(moore_func_list->begin(), moore_func_list->end(), sort_by_fct_ptr); 144 } 145 117 146 for (m = method_process_list.begin(); m != method_process_list.end(); ++m) { 118 147 if ((*m)->is_combinational()) { 119 148 combinational_func_list.push_back(*m); 120 149 } 121 else if ((*m)->is_transition ()) { 122 transition_func_list.push_back(*m); 123 } 124 else if ((*m)->is_genmoore ()) { 125 moore_func_list.push_back(*m); 126 } 127 } 128 // Sort transition functions by method pointer (1) and by module pointer (2) 129 std::sort (transition_func_list.begin(), transition_func_list.end(), sort_by_fct_ptr); 130 // Sort generation functions by method pointer (1) and by module pointer (2) 131 std::sort (moore_func_list.begin(), moore_func_list.end(), sort_by_fct_ptr); 150 } 132 151 } 133 152 … … 203 222 204 223 string get_scheduling(int scheduling_method) { 224 string base_name; 205 225 /* marque les fonctions comme fonction de mealy ou non */ 206 226 if (dump_funclist_info) { … … 209 229 210 230 sort_functions(); 211 if (dump_funclist_info) { 212 cerr << "Transition functions : " << transition_func_list << "\n"; 213 cerr << "Moore generation functions : " << moore_func_list << "\n"; 214 cerr << "Mealy generation functions : " << combinational_func_list << "\n"; 215 } 231 #pragma omp parallel 232 #pragma omp critical 233 { 234 if (dump_funclist_info) { 235 #ifdef _OPENMP 236 cerr << "Thread " << omp_get_thread_num() << "\n"; 237 #endif 238 cerr << " Transition functions : " << *transition_func_list << "\n"; 239 cerr << " Moore generation functions : " << *moore_func_list << "\n"; 240 #pragma omp master 241 { 242 if (!combinational_func_list.empty()) { 243 cerr << "Mealy generation functions : " << combinational_func_list << "\n"; 244 } 245 } 246 } 216 247 217 248 /* Schedule */ 218 string base_name;219 249 switch (scheduling_method) { 220 250 case BUCHMANN_SCHEDULING : … … 225 255 ProcessDependencyList * process_list = BuchmannScheduling(); 226 256 if (dynamic_link_of_scheduling_code) { 227 base_name = gen_scheduling_code_for_dynamic_link( transition_func_list,moore_func_list, *process_list);257 base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, *process_list); 228 258 } 229 259 else { 230 gen_scheduling_code_for_static_func( transition_func_list,moore_func_list, *process_list);260 gen_scheduling_code_for_static_func(*transition_func_list, *moore_func_list, *process_list); 231 261 } 232 262 break; … … 242 272 ProcessDependencyList * process_list = MouchardScheduling(); 243 273 if (dynamic_link_of_scheduling_code) { 244 base_name = gen_scheduling_code_for_dynamic_link( transition_func_list,moore_func_list, *process_list);274 base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, *process_list); 245 275 } 246 276 else { 247 gen_scheduling_code_for_static_func ( transition_func_list,moore_func_list, *process_list);277 gen_scheduling_code_for_static_func (*transition_func_list, *moore_func_list, *process_list); 248 278 } 249 279 break; … … 255 285 // Hommais's thesis explains this scheduling method (like CASS strategy) 256 286 // Doesn't use port dependancies 257 Graph * g = makegraph (&combinational_func_list); 258 if (dump_all_graph && g) { 259 graph2dot("module_graph", *g); 260 } 261 strong_component_list_t * strong_list = strong_component(g); 287 strong_component_list_t * strong_list = NULL; 288 #pragma omp master 289 { 290 Graph * g = makegraph (&combinational_func_list); 291 if (dump_all_graph && g) { 292 graph2dot("module_graph", *g); 293 } 294 strong_list = strong_component(g); 295 } 262 296 if (dynamic_link_of_scheduling_code) { 263 base_name = gen_scheduling_code_for_dynamic_link( transition_func_list, moore_func_list, *strong_list);297 base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, strong_list); 264 298 } 265 299 else { 266 gen_scheduling_code_for_quasistatic_func ( transition_func_list, moore_func_list, *strong_list);300 gen_scheduling_code_for_quasistatic_func (*transition_func_list, *moore_func_list, strong_list); 267 301 } 268 302 break; … … 272 306 "Please select a scheduling method.\n"; 273 307 exit (35); 308 } 274 309 } 275 310 return base_name;
Note: See TracChangeset
for help on using the changeset viewer.