Changeset 62 for sources/src/gen_code.h


Ignore:
Timestamp:
Feb 16, 2017, 3:46:11 PM (7 years ago)
Author:
meunier
Message:
  • Functional (or supposedly functional) OpenMP support configure must be run with --enable-use-omp and the topcell must define the USE_OPENMP flag before including the .h files of systemcass (if openmp enabled).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sources/src/gen_code.h

    r61 r62  
    106106    extern unsigned long long last_wait_f0, last_wait_f1, last_wait_up, last_wait_ml;
    107107    extern unsigned int nb_func[2];
     108    extern unsigned int expected_globaltime;
     109    extern volatile unsigned int globaltime;
     110#ifdef USE_OPENMP
    108111#pragma omp threadprivate (busy_wait_f0, busy_wait_f1, busy_wait_up, busy_wait_ml, nb_func)
    109112#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;
     113#pragma omp threadprivate (expected_globaltime)
    112114#pragma omp shared (globaltime)
    113 #pragma omp threadprivate (expected_globaltime)
    114 
     115#endif
    115116    extern unsigned int num_omp_threads;
    116117
    117118
     119#ifdef USE_OPENMP
    118120#pragma omp parallel
     121#endif
    119122    {
    120 //        int cyclecount = number_of_cycles;
     123        int cyclecount = number_of_cycles;
    121124        busy_wait_f0 = busy_wait_f1 = busy_wait_up = busy_wait_ml = total_assig = 0;
    122125        last_wait_f0 = last_wait_f1 = last_wait_up = last_wait_ml = 0;
    123126
    124127        expected_globaltime = 0;
    125 #pragma omp master
     128#ifdef USE_OPENMP
     129#pragma omp master
     130#endif
    126131        {
    127132            globaltime = 0;
    128 #ifdef _OPENMP
     133#ifdef USE_OPENMP
    129134            num_omp_threads = omp_get_num_threads();
    130135#else
     
    133138        }
    134139
     140#ifdef USE_OPENMP
    135141#pragma omp barrier
    136         // while (!((have_to_stop) | (cyclecount == 0))) {
    137         while (!((have_to_stop) || (number_of_cycles == 0))) {
    138 #pragma omp master
     142#endif
     143        while (!(have_to_stop || cyclecount == 0)) {
     144        //while (!(have_to_stop || number_of_cycles == 0)) {
     145#ifdef USE_OPENMP
     146#pragma omp master
     147#endif
    139148            {
    140149                trace_all(false);
    141150            }
    142151            internal_sc_cycle2();
    143 #pragma omp master
     152#ifdef USE_OPENMP
     153#pragma omp master
     154#endif
    144155            {
    145156                trace_all(true);
    146157            }
    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         }
     158            cyclecount = (number_of_cycles < 0) ? number_of_cycles : cyclecount - 1;
     159            // number_of_cycles = (number_of_cycles < 0) ? number_of_cycles : number_of_cycles - 1;
     160        }
     161#ifdef USE_OPENMP
    150162#pragma omp barrier
     163#endif
    151164#if 0
    152 #ifdef _OPENMP
     165#ifdef USE_OPENMP
    153166#pragma omp critical
    154167        {
     
    191204    if (is_posted_write()) {
    192205        // update posted value to external signals             
     206#ifdef USE_OPENMP
    193207#pragma omp parallel
     208#endif
    194209        update();
    195210        func_combinationals();
     
    200215    // don't need to do func_combinationals since 'unstable' flag is now false
    201216    if (is_posted_write()) {
     217#ifdef USE_OPENMP
    202218#pragma omp parallel
     219#endif
    203220        update();
    204221        func_combinationals();
Note: See TracChangeset for help on using the changeset viewer.