Changeset 60 for sources/src
- Timestamp:
- Feb 14, 2017, 11:30:19 AM (8 years ago)
- Location:
- sources/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/src/casc.h
r59 r60 24 24 25 25 EXTERN char unstable; 26 EXTERN int32 pending_write_vector_nb; 26 EXTERN int32 * pending_write_vector_nb; 27 #pragma omp threadprivate (pending_write_vector_nb) 27 28 28 29 namespace sc_core { -
sources/src/entity.cc
r59 r60 188 188 } 189 189 cerr << "Internal error : get_equi(" << pointer << ")\n"; 190 abort(); 190 191 exit(11); 191 192 } … … 412 413 } 413 414 } 415 #if 0 416 sc_interface *reg = get_signal (*i); 417 sc_interface *out = get_out_port (*i); 418 if (reg) { 419 std::cerr << "binding " << *i << " to reg " 420 << reg << std::endl; 421 bind_equi_to_table (*i, reg->get_pointer ()); 422 } else if (out) { 423 std::cerr << "binding " << *i << " to out " 424 << out << std::endl; 425 bind_equi_to_table (*i, out->get_pointer ()); 426 } else { 427 reg = get_localvar (*i); 428 if (reg) { 429 std::cerr << "binding " << *i << " to localvar " 430 << reg << std::endl; 431 bind_equi_to_table (*i, reg->get_pointer ()); 432 } else { 433 std::cerr << "binding " << *i << " to index " 434 << index << std::endl; 435 bind_equi_to_table (*i, &(equi_table[index])); 436 index += (i->begin()->data_size_in_bytes() - 1) / sizeof(tab_t) + 1; 437 } 438 } 439 #endif 414 440 } 415 441 } -
sources/src/gen_code.cc
r59 r60 49 49 #include <iostream> 50 50 #include <fstream> 51 #ifdef _OPENMP 52 #include <omp.h> 53 #endif 51 54 52 55 #include "internal.h" … … 58 61 #ifdef HAVE_CONFIG_H 59 62 #include "config.h" 60 #endif61 62 #ifdef _OPENMP63 #include <omp.h>64 63 #endif 65 64 … … 246 245 method_process_list_t & 247 246 moore_func_list, 248 strong_component_list_t &247 strong_component_list_t * 249 248 strongcomponents) { 250 249 if (dump_stage) { … … 277 276 gen_transition(o, transition_func_list); 278 277 gen_moore(o, moore_func_list); 279 gen_mealy(o, strongcomponents); 278 if (strongcomponents != NULL) { 279 gen_mealy (o, *strongcomponents); 280 } 280 281 281 282 o << " \n}\n"; … … 575 576 */ 576 577 577 static method_process_list_t func_list[2]; 578 unsigned int nb_func[2]; 579 static method_process_t **func_list[2]; 580 #pragma omp threadprivate (nb_func, func_list) 578 581 static strong_component_list_t quasistatic_list; 582 583 unsigned long long busy_wait_f0, busy_wait_f1, busy_wait_up, busy_wait_ml; 584 unsigned long long last_wait_f0, last_wait_f1, last_wait_up, last_wait_ml; 585 #pragma omp threadprivate (busy_wait_f0, busy_wait_f1, busy_wait_up,busy_wait_ml) 586 #pragma omp threadprivate (last_wait_f0, last_wait_f1, last_wait_up,last_wait_ml) 579 587 580 588 static void Call(const method_process_t & m) { … … 611 619 } 612 620 621 unsigned int expected_globaltime = 0; 622 volatile unsigned int globaltime __attribute__ ((aligned (128))) = 0; 623 #pragma omp shared (globaltime) 624 #pragma omp threadprivate (expected_globaltime) 625 626 unsigned int num_omp_threads; 613 627 614 628 void quasistatic_simulate_1_cycle(void) { 615 method_process_list_t::iterator mm; 616 for (mm = func_list[0].begin(); mm != func_list[0].end(); ++mm) { 617 method_process_t & m = **mm; 618 Call(m); 619 } 629 int i; 630 631 for (i = 0; i < nb_func[0]; ++i) { 632 Call(*(func_list[0][i])); 633 } 634 #define USE_BUSY_WAIT 1 620 635 update(); 621 for (mm = func_list[1].begin(); mm != func_list[1].end(); ++mm) { 622 method_process_t & m = **mm; 623 Call(m); 624 } 625 quasistatic_mealy_generation(); 636 #if USE_BUSY_WAIT 637 expected_globaltime += num_omp_threads; 638 if (__sync_add_and_fetch(&globaltime, 1) == expected_globaltime) { 639 last_wait_up++; 640 } 641 __asm volatile("mfence"); 642 while (globaltime < expected_globaltime) { 643 busy_wait_up++; 644 __asm volatile("lfence"); 645 } 646 647 #else 648 #pragma omp barrier 649 #endif 650 651 for (i = 0; i < nb_func[1]; ++i) { 652 Call(*(func_list[1][i])); 653 } 654 655 #if USE_BUSY_WAIT 656 expected_globaltime += num_omp_threads; 657 if (__sync_add_and_fetch(&globaltime, 1) == expected_globaltime) { 658 last_wait_f1++; 659 } 660 __asm volatile("mfence"); 661 while (globaltime < expected_globaltime) { 662 busy_wait_f1++; 663 __asm volatile("lfence"); 664 } 665 #else 666 #pragma omp barrier 667 #endif 668 if (!quasistatic_list.empty()) { 669 #pragma omp master 670 { 671 quasistatic_mealy_generation(); 672 } 673 #if USE_BUSY_WAIT 674 expected_globaltime += num_omp_threads; 675 if (__sync_add_and_fetch(&globaltime, 1) == expected_globaltime) { 676 last_wait_ml++; 677 } 678 __asm volatile("mfence"); 679 while (globaltime < expected_globaltime) { 680 busy_wait_ml++; 681 __asm volatile("lfence"); 682 } 683 #else 684 #pragma omp barrier 685 #endif 686 } 687 626 688 } 627 689 … … 631 693 method_process_list_t & 632 694 moore_func_list, 633 strong_component_list_t &695 strong_component_list_t * 634 696 mealy_func_list) { 635 697 if (dump_stage) { … … 637 699 } 638 700 639 func_list[0] = transition_func_list; 640 func_list[1] = moore_func_list; 641 quasistatic_list = mealy_func_list; 701 nb_func[0] = transition_func_list.size(); 702 nb_func[1] = moore_func_list.size(); 703 704 func_list[0] = (method_process_t**) malloc(sizeof (method_process_t*) * nb_func[0]); 705 func_list[1] = (method_process_t**) malloc(sizeof (method_process_t*) * nb_func[1]); 706 707 unsigned int i; 708 for (i = 0; i < nb_func[0]; ++i) { 709 func_list[0][i] = (transition_func_list[i]); 710 } 711 712 for (i = 0; i < nb_func[1]; ++i) { 713 func_list[1][i] = (moore_func_list[i]); 714 } 715 716 if (mealy_func_list != NULL) { 717 quasistatic_list = *mealy_func_list; 718 } 642 719 643 720 if (dump_stage) { -
sources/src/gen_code.h
r59 r60 21 21 #include "process_dependency.h" 22 22 23 #ifdef _OPENMP 24 #include <omp.h> 25 #endif 26 23 27 //------------------------------------------------------------------- 24 28 #ifdef __GNUC__ … … 40 44 method_process_list_t &transition_list, 41 45 method_process_list_t &moore_list, 42 strong_component_list_t &mealy_list);46 strong_component_list_t *mealy_list); 43 47 44 48 extern void gen_scheduling_code_for_static_func( … … 55 59 method_process_list_t &transition_list, 56 60 method_process_list_t &moore_list, 57 strong_component_list_t &strongcomponents);61 strong_component_list_t *strongcomponents); 58 62 59 63 /* function when any dynamic link is impossible */ … … 81 85 inline void internal_sc_cycle2() { 82 86 #ifdef DUMP_STAGE 83 std::cerr << "begin of cycle #" << sc_simulation_time () << "\n"; 84 #endif 85 func_simulate_1_cycle(); 86 ++nb_cycles; 87 #pragma omp master 88 { 89 std::cerr << "begin of cycle #" << sc_simulation_time() << "\n"; 90 } 91 #endif 92 93 func_simulate_1_cycle(); 94 95 ++nb_cycles; 87 96 #ifdef DUMP_STAGE 88 std::cerr << "end of cycle\n"; 97 #pragma omp master 98 { 99 std::cerr << "end of cycle\n"; 100 } 89 101 #endif 90 102 } 91 103 92 93 104 inline void internal_sc_cycle1(int number_of_cycles) { 94 //while ((! have_to_stop) && (number_of_cycles != 0)) { 95 while (!((have_to_stop) || (number_of_cycles == 0))) { 96 trace_all(false); 97 internal_sc_cycle2(); 98 trace_all(true); 99 number_of_cycles = (number_of_cycles < 0) ? number_of_cycles : number_of_cycles - 1; 105 extern unsigned long long busy_wait_f0, busy_wait_f1, busy_wait_up, busy_wait_ml; 106 extern unsigned long long last_wait_f0, last_wait_f1, last_wait_up, last_wait_ml; 107 extern unsigned int nb_func[2]; 108 #pragma omp threadprivate (busy_wait_f0, busy_wait_f1, busy_wait_up, busy_wait_ml, nb_func) 109 #pragma omp threadprivate (last_wait_f0, last_wait_f1, last_wait_up, last_wait_ml) 110 extern unsigned int expected_globaltime; 111 extern volatile unsigned int globaltime; 112 #pragma omp shared (globaltime) 113 #pragma omp threadprivate (expected_globaltime) 114 115 extern unsigned int num_omp_threads; 116 117 118 #pragma omp parallel 119 { 120 // int cyclecount = number_of_cycles; 121 busy_wait_f0 = busy_wait_f1 = busy_wait_up = busy_wait_ml = total_assig = 0; 122 last_wait_f0 = last_wait_f1 = last_wait_up = last_wait_ml = 0; 123 124 expected_globaltime = 0; 125 #pragma omp master 126 { 127 globaltime = 0; 128 #ifdef _OPENMP 129 num_omp_threads = omp_get_num_threads(); 130 #else 131 num_omp_threads = 1; 132 #endif 133 } 134 135 #pragma omp barrier 136 // while (!((have_to_stop) | (cyclecount == 0))) { 137 while (!((have_to_stop) || (number_of_cycles == 0))) { 138 #pragma omp master 139 { 140 trace_all(false); 141 } 142 internal_sc_cycle2(); 143 #pragma omp master 144 { 145 trace_all(true); 146 } 147 // cyclecount = (number_of_cycles < 0) ? number_of_cycles : cyclecount - 1; 148 number_of_cycles = (number_of_cycles < 0) ? number_of_cycles : number_of_cycles - 1; 149 } 150 #pragma omp barrier 151 #if 0 152 #ifdef _OPENMP 153 #pragma omp critical 154 { 155 std::cerr << "Thread " << omp_get_thread_num() << " busy_wait " << 156 busy_wait_f0 << " " << busy_wait_up << " " << 157 busy_wait_f1 << " " << busy_wait_ml << std::endl; 158 } 159 #pragma omp critical 160 { 161 std::cerr << "Thread " << omp_get_thread_num() << " last_wait " << 162 last_wait_f0 << " " << last_wait_up << " " << 163 last_wait_f1 << " " << last_wait_ml << std::endl; 164 } 165 #pragma omp critical 166 { 167 std::cerr << "Thread " << omp_get_thread_num() << " nfuncs " 168 << nb_func[0] << " " << nb_func[1] << " total_assig " << 169 total_assig << std::endl; 170 } 171 #endif 172 #endif 100 173 } 101 174 } … … 117 190 118 191 if (is_posted_write()) { 119 // update posted value to external signals 192 // update posted value to external signals 193 #pragma omp parallel 120 194 update(); 121 195 func_combinationals(); … … 126 200 // don't need to do func_combinationals since 'unstable' flag is now false 127 201 if (is_posted_write()) { 202 #pragma omp parallel 128 203 update(); 129 204 func_combinationals(); -
sources/src/global_functions.cc
r59 r60 246 246 pending_write_vector_capacity = get_signal_table_size(); 247 247 248 if (pending_write_vector_capacity == 0) { 249 pending_write_vector = NULL; 250 } 251 else { 252 pending_write_vector = (pending_write_vector_t) realloc(pending_write_vector, sizeof(pending_write_t) * pending_write_vector_capacity); 253 } 248 assert(pending_write_vector_capacity != 0); 249 250 #ifdef _OPENMP 251 #define LINE_SIZE 128L 252 int malloc_size = (sizeof (pending_write_t) * (pending_write_vector_capacity + 1) + (LINE_SIZE - 1)) & ~(LINE_SIZE - 1); 253 assert((sizeof(pending_write_t) * (pending_write_vector_capacity + 1)) <= malloc_size && "bad allocation size"); 254 255 #pragma omp parallel 256 { 257 posix_memalign((void **) &pending_write_vector, LINE_SIZE, malloc_size); 258 pending_write_vector_nb = (int32_t *) &pending_write_vector[0]; 259 pending_write_vector = &pending_write_vector[1]; 260 //printf("malloc 0x%x @%p, idx @0x%x\n", malloc_size, pending_write_vector, pending_write_vector_nb); 261 *pending_write_vector_nb = 0; 262 } 263 #else 264 pending_write_vector = (pending_write_vector_t) malloc(sizeof(pending_write_t) * pending_write_vector_capacity); 265 #endif 266 254 267 255 268 // create the clock list … … 267 280 } 268 281 // Check if any constructor wrote into registers 269 if ( pending_write_vector_nb != 0) {282 if (*pending_write_vector_nb != 0) { 270 283 cerr << 271 284 "Error : Register/Signal writing is not allowed before sc_initialize.\n" … … 285 298 } 286 299 287 pending_write_vector_nb = 0;300 *pending_write_vector_nb = 0; 288 301 289 302 check_all_ports(); -
sources/src/sc_main.cc
r52 r60 37 37 #include <sstream> 38 38 #include <list> 39 #include <omp.h> 39 40 #include <set> 40 41 #include <cstring> // strcmp … … 393 394 394 395 int ret = sc_main(argc, argv); 395 free(pending_write_vector);396 //free(pending_write_vector); 396 397 close_systemcass(); 397 398 -
sources/src/sc_module.cc
r59 r60 38 38 #include <vector> 39 39 #include <set> 40 #ifdef _OPENMP 41 #include <omp.h> 42 #endif 40 43 41 44 #include "sc_module.h" … … 124 127 // ---------------------------------------------------------------------------- 125 128 method_process_t::method_process_t(const char * nm, SC_ENTRY_FUNC fn, sc_module & mod) { 126 name = nm; 127 func = fn; 128 module = &mod; 129 dont_initialize = false; 129 name = nm; 130 func = fn; 131 module = &mod; 132 dont_initialize = false; 133 #ifdef _OPENMP 134 omp_threadnum = omp_get_thread_num(); 135 #endif 130 136 } 131 137 -
sources/src/sc_module.h
r52 r60 70 70 sensitivity_list_t sensitivity_list; 71 71 bool dont_initialize; 72 int omp_threadnum; 72 73 73 74 // constructors -
sources/src/sc_port.cc
r59 r60 53 53 extern char unstable; 54 54 char unstable = 0; // not in sc_core namespace because dynamic link support C linkage only 55 int32 pending_write_vector_nb = 0; 55 int32 * pending_write_vector_nb = 0; 56 unsigned long long int total_assig = 0; 57 #pragma omp threadprivate (pending_write_vector_nb, total_assig) 56 58 } 57 59 … … 65 67 unsigned int pending_write_vector_capacity = 512; 66 68 pending_write_vector_t pending_write_vector = NULL; 69 #pragma omp threadprivate (pending_write_vector) 67 70 extern equi_list_t equi_list; 68 71 … … 218 221 // signal table sorting doesn't give any better performance 219 222 #if defined(DUMP_STAGE) 220 cerr << "(" << pending_write_vector_nb223 cerr << "(" << *pending_write_vector_nb 221 224 << " internal pending writings) "; 222 225 #endif 223 226 unsigned int i; 224 for (i = 0; i < pending_write_vector_nb; ++i) {227 for (i = 0; i < *pending_write_vector_nb; ++i) { 225 228 #define iter (sc_core::pending_write_vector[i]) 226 229 #ifdef CONFIG_DEBUG … … 240 243 } 241 244 #ifdef DUMP_SIGNAL_STATS 242 total_assig += pending_write_vector_nb; 243 #endif 244 pending_write_vector_nb = 0; 245 total_assig += *pending_write_vector_nb; 246 #endif 247 total_assig += *pending_write_vector_nb; 248 *pending_write_vector_nb = 0; 245 249 246 250 #if defined(DUMP_STAGE) -
sources/src/sc_port_ext.h
r52 r60 295 295 std::cerr << "write " << value_ << " on in/out port (writing into a signal) '" << name() << "'\n"; 296 296 #endif 297 // T& ref = *(T*)(get_pointer()); 297 T *p = (T*)get_pointer(); 298 if (*p != value_) { 299 *p = value_; 298 300 #ifndef USE_PORT_DEPENDENCY 299 unstable |= (value_) != val; //ref; 300 #endif 301 /*ref*/ val = (value_); 301 if (unstable == 0) 302 unstable = 1; 303 #endif 304 } 302 305 } 303 306 -
sources/src/sc_signal.h
r59 r60 18 18 #include <iostream> 19 19 #include <cstdlib> 20 #include <cstring> 20 21 #include <typeinfo> // for typeid 21 22 … … 67 68 // Pending write to register (simple stack) 68 69 typedef pending_write_t * pending_write_vector_t; 70 extern "C" int32_t * pending_write_vector_nb; 71 extern "C" unsigned long long int total_assig; 72 #pragma omp threadprivate(pending_write_vector_nb, total_assig) 73 extern unsigned int pending_write_vector_capacity; 74 69 75 extern pending_write_vector_t pending_write_vector; 70 extern "C" unsigned int pending_write_vector_nb; 71 extern unsigned int pending_write_vector_capacity; 72 76 #pragma omp threadprivate(pending_write_vector) 73 77 74 78 template < typename T > … … 92 96 else { 93 97 #if defined(CONFIG_DEBUG) 94 if ( pending_write_vector_nb >= pending_write_vector_capacity) {98 if (*pending_write_vector_nb >= pending_write_vector_capacity) { 95 99 std::cerr << "Error : The array for posted writing on register is too small.\n"; 96 100 std::cerr << "Up to 1 writing per register is allowed during a cycle.\n"; … … 99 103 } 100 104 #endif 101 pending_write_vector[ pending_write_vector_nb].pointer = pointer_;102 // pending_write_vector[ pending_write_vector_nb++].value = *(reinterpret_cast<const base_type*const>(&value_)); => bug !103 pending_write_vector[ pending_write_vector_nb++].value = value_; // => bug avec blues !105 pending_write_vector[*pending_write_vector_nb].pointer = pointer_; 106 // pending_write_vector[(*pending_write_vector_nb)++].value = *(reinterpret_cast<const base_type*const>(&value_)); => bug ! 107 pending_write_vector[(*pending_write_vector_nb)++].value = value_; // => bug avec blues ! 104 108 105 109 // -> fix to use user-defined struct in sc_signal/sc_in/sc_out/sc_inout 106 // pending_write_vector[ pending_write_vector_nb++].value = *((base_type*)&value_); => bug !110 // pending_write_vector[(*pending_write_vector_nb)++].value = *((base_type*)&value_); => bug ! 107 111 #if 0 108 112 std::cerr << "posted write : ptr = " << pointer_ << ", val = " << value_ << "\n"; … … 119 123 120 124 inline bool is_posted_write() { 121 return pending_write_vector_nb > 0;125 return *pending_write_vector_nb > 0; 122 126 } 123 127 … … 165 169 166 170 T val; 167 171 T new_val; 168 172 typedef T data_type; 169 173 typedef sc_signal < T > this_type; … … 216 220 sc_signal< T >::write(read() + a.read()); 217 221 return *this; 222 } 223 224 inline void * operator new (size_t size, size_t align) { 225 void * p; 226 const size_t nsize = (size + align - 1) & ~(align - 1); 227 if (nsize < size) { 228 std::cerr << "sc_signal new() alignement doesn't work (" << 229 nsize << " < " << size << ")" << std::endl; 230 abort(); 231 } 232 233 if (posix_memalign(&p, align, nsize) == 0) { 234 return p; 235 } 236 else { 237 return NULL; 238 } 239 } 240 241 inline void * operator new (size_t size) { 242 return malloc(size); 243 } 244 245 inline void * operator new (size_t size, void * p) { 246 return p; 218 247 } 219 248 … … 247 276 set_kind(kind_string); 248 277 sc_interface::init(sizeof(data_type)); 278 #if 0 249 279 val = (T) 0; /* The simulator initializes the signal/register to 0. */ 250 /* However, hardware initialization still has to be done. */ 251 /* This kind of initialization is for trace diffing. */ 280 /* However, hardware initialization still has to be done. */ 281 /* This kind of initialization is for trace diffing. */ 282 #else 283 memset(&val, 0, sizeof(val)); 284 #endif 252 285 } 253 286 … … 267 300 template < typename T > 268 301 inline void sc_signal< T >::write(const data_type & value_) { 302 if (sc_signal< T >::val == value_ && sc_signal< T >::new_val == value_) { 303 return; 304 } 269 305 #ifdef CONFIG_DEBUG 270 306 if (get_pointer() == NULL) { … … 279 315 std::cerr << "write (posted) " << value_ << " on sc_signal (writing into register) '" << name() << "'\n"; 280 316 #endif 281 317 sc_signal<T>::new_val = value_; 282 318 post_write(/*(tab_t*)&val*/ get_pointer(), value_); 283 319 } -
sources/src/sc_time.cc
r59 r60 55 55 56 56 uint64 nb_cycles = 0; 57 #pragma omp threadprivate(nb_cycles) 57 58 58 59 const sc_time SC_ZERO_TIME(0, SC_NS); -
sources/src/sc_time.h
r59 r60 43 43 44 44 extern uint64 nb_cycles; 45 #pragma omp threadprivate(nb_cycles) 45 46 46 47 inline double sc_simulation_time() { -
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.