- Timestamp:
- Feb 14, 2017, 11:30:19 AM (8 years ago)
- Location:
- sources
- Files:
-
- 55 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; -
sources/test_regression/02052006/system.cpp
r55 r60 121 121 sc_signal<bool> resetn("resetn"); 122 122 123 // Setup number of threads open-mp to 1 with the macro threads_omp() 124 threads_omp(); 125 123 126 test test1("test1"); 124 127 test1.clk(signal_clk); -
sources/test_regression/04052005/system.cpp
r55 r60 23 23 e = 0x11; 24 24 f = 0x1A0; 25 26 // Setup number of threads open-mp to 1 with the macro threads_omp() 27 threads_omp(); 25 28 26 29 cout << "a = 0x" << hex << (unsigned int) a << " = " << a.to_string(SC_BIN) << "\n"; -
sources/test_regression/05092005/system.cpp
r56 r60 22 22 sc_clock signal_clk("my_clock", sc_time(1, sc_core::SC_NS)); 23 23 sc_signal<bool> s[5]; 24 25 // Setup number of threads open-mp to 1 with the macro threads_omp() 26 threads_omp(); 27 24 28 hard a("a"); 25 29 hard b("b"); -
sources/test_regression/07052005/system.cpp
r56 r60 39 39 i = e; 40 40 41 // Setup number of threads open-mp to 1 with the macro threads_omp() 42 threads_omp(); 43 41 44 cout << "a = 0x" << hex << (unsigned int) a << " = " << a.to_string(SC_BIN) << "\n"; 42 45 //ASSERT(a.to_string(SC_BIN) == "0b000000111100010001"); -
sources/test_regression/07122006a/system.cpp
r56 r60 19 19 sc_signal<int> in ("in"); 20 20 sc_signal<int> out("out"); 21 22 // Setup number of threads open-mp to 1 with the macro threads_omp() 23 threads_omp(); 21 24 22 25 test test("test"); -
sources/test_regression/07122006b/system.cpp
r55 r60 65 65 sc_signal<int> out("out"); 66 66 67 // Setup number of threads open-mp to 1 with the macro threads_omp() 68 threads_omp(); 69 67 70 test test("test"); 68 71 test.clk(clk); -
sources/test_regression/08092005/system.cpp
r55 r60 40 40 hard b("b"); 41 41 hard c("c"); 42 43 // Setup number of threads open-mp to 1 with the macro threads_omp() 44 threads_omp(); 42 45 43 46 a.clk(clk); -
sources/test_regression/09092005a/system.cpp
r56 r60 14 14 15 15 int sc_main (int argc, char ** argv) { 16 17 // Setup number of threads open-mp to 1 with the macro threads_omp() 18 threads_omp(); 16 19 17 20 sc_uint<ADDRSIZE> LINEADDR_MASK = ~(((sc_uint<ADDRSIZE>) ~0x0) >> (ADDRSIZE - OFFSETSIZE - BPFSIZE)); -
sources/test_regression/09092005b/system.cpp
r55 r60 39 39 hard b("b"); 40 40 hard c("c"); 41 42 // Setup number of threads open-mp to 1 with the macro threads_omp() 43 threads_omp(); 41 44 42 45 a.clk(clk1); -
sources/test_regression/09092005c/system.cpp
r56 r60 82 82 top_level t("top_level"); 83 83 84 // Setup number of threads open-mp to 1 with the macro threads_omp() 85 threads_omp(); 86 84 87 t.clk(clk); 85 88 t.o(out); -
sources/test_regression/11062007/system.cpp
r55 r60 104 104 sc_signal<bool> s1("s1"),s2("s2"),s3("s3"),s4("s4"),s5("s5"); 105 105 106 // Setup number of threads open-mp to 1 with the macro threads_omp() 107 threads_omp(); 108 106 109 A a("a"); 107 110 B b("b"); -
sources/test_regression/14092005/system.cpp
r56 r60 48 48 sc_signal<int> s[10]; 49 49 hard a("a"); 50 51 // Setup number of threads open-mp to 1 with the macro threads_omp() 52 threads_omp(); 50 53 51 54 a.clk(clk1); -
sources/test_regression/15042009a/system.cpp
r55 r60 123 123 top_level t("top_level"); 124 124 125 // Setup number of threads open-mp to 1 with the macro threads_omp() 126 threads_omp(); 127 125 128 t.clk(clk); 126 129 t.o(out); -
sources/test_regression/15042009b/system.cpp
r55 r60 17 17 a = ca; 18 18 b = cb; 19 20 // Setup number of threads open-mp to 1 with the macro threads_omp() 21 threads_omp(); 19 22 20 23 c = a & b; -
sources/test_regression/15042009c/system.cpp
r55 r60 32 32 const long long int ca = 0xf00000000LLU; 33 33 a = ca; 34 35 // Setup number of threads open-mp to 1 with the macro threads_omp() 36 threads_omp(); 34 37 35 38 test_t<param_t> test1, test2; -
sources/test_regression/15062006/system.cpp
r55 r60 77 77 sc_signal<int> s01("s01"), s02("s02"), s03("s03"), s04("s04"); 78 78 79 // Setup number of threads open-mp to 1 with the macro threads_omp() 80 threads_omp(); 81 79 82 test<int> test1("test1"); 80 83 test1.clk(signal_clk); -
sources/test_regression/15092005a/system.cpp
r55 r60 89 89 top_level t("top_level"); 90 90 91 // Setup number of threads open-mp to 1 with the macro threads_omp() 92 threads_omp(); 93 91 94 t.clk(clk); 92 95 t.o(out); -
sources/test_regression/15092005b/system.cpp
r55 r60 92 92 top_level t("top_level"); 93 93 94 // Setup number of threads open-mp to 1 with the macro threads_omp() 95 threads_omp(); 96 94 97 t.clk(clk); 95 98 t.o(out); -
sources/test_regression/15092005c/system.cpp
r55 r60 87 87 top_level t("top_level"); 88 88 89 // Setup number of threads open-mp to 1 with the macro threads_omp() 90 threads_omp(); 91 89 92 t.clk(clk); 90 93 t.o(out); -
sources/test_regression/15092005d/system.cpp
r55 r60 90 90 top_level t("top_level"); 91 91 92 // Setup number of threads open-mp to 1 with the macro threads_omp() 93 threads_omp(); 94 92 95 t.clk(clk); 93 96 t.o(out); -
sources/test_regression/16022007/system.cpp
r55 r60 213 213 s15("s15"); 214 214 215 // Setup number of threads open-mp to 1 with the macro threads_omp() 216 threads_omp(); 215 217 216 218 M_0i1o a("a"); -
sources/test_regression/16062005a/system.cpp
r55 r60 75 75 } 76 76 77 // Setup number of threads open-mp to 1 with the macro threads_omp() 78 threads_omp(); 79 77 80 sc_clock clk("clock"); 78 81 top_level1 top1("top1"); -
sources/test_regression/16062005b/system.cpp
r55 r60 65 65 } 66 66 67 // Setup number of threads open-mp to 1 with the macro threads_omp() 68 threads_omp(); 69 67 70 ofstream o; 68 71 o.open (argv[1], ios::out | ios::trunc); -
sources/test_regression/16112005a/system.cpp
r55 r60 40 40 sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4"); 41 41 42 // Setup number of threads open-mp to 1 with the macro threads_omp() 43 threads_omp(); 44 42 45 m.i1 (s1); 43 46 m.i2 (s1); -
sources/test_regression/16112005b/system.cpp
r55 r60 38 38 sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4"); 39 39 40 // Setup number of threads open-mp to 1 with the macro threads_omp() 41 threads_omp(); 42 40 43 m.i1(s1); 41 44 m.i3(s1); -
sources/test_regression/16112005c/system.cpp
r55 r60 38 38 sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4"); 39 39 40 // Setup number of threads open-mp to 1 with the macro threads_omp() 41 threads_omp(); 42 40 43 m.i1 (s1); 41 44 m.i2 (s1); -
sources/test_regression/16122005/system.cpp
r55 r60 67 67 } 68 68 69 // Setup number of threads open-mp to 1 with the macro threads_omp() 70 threads_omp(); 71 69 72 sc_clock clk("clock"); 70 73 top_level1 top1("top1"); -
sources/test_regression/17022006/system.cpp
r55 r60 69 69 sc_signal<char> s04_0("s04_0"), s04_1("s04_1"), s04_2("s04_2"); 70 70 71 // Setup number of threads open-mp to 1 with the macro threads_omp() 72 threads_omp(); 73 71 74 test test1("test1"); 72 75 test1.clk(signal_clk); -
sources/test_regression/17032005/system.cpp
r55 r60 76 76 test.clk(clk); 77 77 test.resetn(resetn); 78 79 // Setup number of threads open-mp to 1 with the macro threads_omp() 80 threads_omp(); 78 81 79 82 sc_trace_file * tf; -
sources/test_regression/19042005/system.cpp
r55 r60 78 78 sc_signal< sc_uint<64> > s11("s11"), s12("s12"), s13("s13"); 79 79 sc_signal< sc_uint<32> > s16("s16"); 80 81 // Setup number of threads open-mp to 1 with the macro threads_omp() 82 threads_omp(); 80 83 81 84 test test1("test1"); -
sources/test_regression/19122005/system.cpp
r55 r60 127 127 sc_clock signal_clk("my_clock", 1, 0.5); 128 128 129 // Setup number of threads open-mp to 1 with the macro threads_omp() 130 threads_omp(); 131 129 132 test test1("test1"); 130 133 test1.clk(signal_clk); -
sources/test_regression/20122006/system.cpp
r55 r60 226 226 s15("s15"); 227 227 228 // Setup number of threads open-mp to 1 with the macro threads_omp() 229 threads_omp(); 228 230 229 231 M_0i1o a("a"); -
sources/test_regression/21062005/system.cpp
r55 r60 48 48 sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4"); 49 49 50 // Setup number of threads open-mp to 1 with the macro threads_omp() 51 threads_omp(); 52 50 53 m.i1 (s1); 51 54 m.i2 (s1); -
sources/test_regression/24082009/system.cpp
r55 r60 42 42 sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4"); 43 43 44 // Setup number of threads open-mp to 1 with the macro threads_omp() 45 threads_omp(); 46 44 47 A a("a"); 45 48 A b("b"); -
sources/test_regression/25032005/system.cpp
r55 r60 103 103 sc_signal<bool> s1("s1"), s2("s2"), s3("s3"), s4("s4"), s5("s5"); 104 104 105 // Setup number of threads open-mp to 1 with the macro threads_omp() 106 threads_omp(); 107 105 108 A a("a"); 106 109 B b("b"); -
sources/test_regression/28102005/system.cpp
r55 r60 47 47 sc_clock clk("clock"); 48 48 49 // Setup number of threads open-mp to 1 with the macro threads_omp() 50 threads_omp(); 51 49 52 check_time(0); 50 53 sc_start(sc_time(0, sc_core::SC_NS)); -
sources/test_regression/29032005/system.cpp
r55 r60 216 216 s15("s15"); 217 217 218 // Setup number of threads open-mp to 1 with the macro threads_omp() 219 threads_omp(); 218 220 219 221 M_0i1o a("a"); -
sources/test_regression/30032005a/system.cpp
r55 r60 119 119 s15("s15"); 120 120 121 // Setup number of threads open-mp to 1 with the macro threads_omp() 122 threads_omp(); 121 123 122 124 M1_3i3o a("a"); -
sources/test_regression/30032005b/system.cpp
r55 r60 74 74 s15("s15"); 75 75 76 // Setup number of threads open-mp to 1 with the macro threads_omp() 77 threads_omp(); 76 78 77 79 M1_1i1o a("a"); -
sources/test_regression/30032005c/system.cpp
r55 r60 108 108 s15("s15"); 109 109 110 // Setup number of threads open-mp to 1 with the macro threads_omp() 111 threads_omp(); 110 112 111 113 M1_3i2o a("a"); -
sources/test_regression/test.h
r55 r60 1 2 #ifdef _OPENMP 3 #include <omp.h> 4 #endif 1 5 2 6 #define ASSERT(x) \ … … 8 12 } 9 13 14 #ifdef _OPENMP 15 #define threads_omp() \ 16 ({ \ 17 omp_set_dynamic(false);\ 18 omp_set_num_threads(1);\ 19 }) 20 #else 21 #define threads_omp() 22 #endif 23
Note: See TracChangeset
for help on using the changeset viewer.