Changeset 62 for sources/src/sc_port.cc


Ignore:
Timestamp:
Feb 16, 2017, 3:46:11 PM (8 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/sc_port.cc

    r60 r62  
    5353    extern char unstable;
    5454    char unstable = 0; // not in sc_core namespace because dynamic link support C linkage only
    55     int32 * pending_write_vector_nb = 0;
     55    int32_t * pending_write_vector_nb = 0;
    5656    unsigned long long int total_assig = 0;
     57#ifdef USE_OPENMP
    5758#pragma omp threadprivate (pending_write_vector_nb, total_assig)
     59#endif
    5860}
    5961
     
    6567const char * const sc_signal_base::kind_string = "sc_signal";
    6668
    67 unsigned int pending_write_vector_capacity = 512;
     69unsigned int pending_write_vector_capacity;
    6870pending_write_vector_t pending_write_vector = NULL;
     71#ifdef USE_OPENMP
    6972#pragma omp threadprivate (pending_write_vector)
     73#endif
    7074extern equi_list_t equi_list;
    7175
     
    215219    void update() {
    216220#if defined(DUMP_STAGE)
    217             cerr << "Updating... ";
    218 #endif
    219             // stl vectors are too slow
    220             // memcopy is not better
    221             // signal table sorting doesn't give any better performance
     221        cerr << "Updating... ";
     222#endif
     223        // stl vectors are too slow
     224        // memcopy is not better
     225        // signal table sorting doesn't give any better performance
    222226#if defined(DUMP_STAGE)
    223             cerr << "(" << *pending_write_vector_nb
    224                 << " internal pending writings) ";
    225 #endif
    226             unsigned int i;
    227             for (i = 0; i < *pending_write_vector_nb; ++i) {
     227        cerr << "(" << *pending_write_vector_nb
     228            << " internal pending writings) ";
     229#endif
     230        unsigned int i;
     231        for (i = 0; i < *pending_write_vector_nb; ++i) {
    228232#define iter (sc_core::pending_write_vector[i])
    229233#ifdef CONFIG_DEBUG
    230                 if (iter.pointer == NULL) {
    231                     cerr << "Internal error : trying to apply a posted write from an unassigned signal/port\n";
    232                     exit (8);
    233                 }
     234            if (iter.pointer == NULL) {
     235                cerr << "Internal error : trying to apply a posted write from an unassigned signal/port\n";
     236                exit (8);
     237            }
    234238#endif
    235239#ifdef DUMP_SIGNAL_STATS
    236                 if (*(iter.pointer) == iter.value) {
    237                     unnecessary++;
    238                 }
    239                 counter[iter.pointer]++;
    240 #endif
    241                 *(iter.pointer) = iter.value;
     240            if (*(iter.pointer) == iter.value) {
     241                unnecessary++;
     242            }
     243            counter[iter.pointer]++;
     244#endif
     245            *(iter.pointer) = iter.value;
    242246#undef iter
    243             }
     247        }
    244248#ifdef DUMP_SIGNAL_STATS
    245             total_assig += *pending_write_vector_nb;
    246 #endif
    247             total_assig += *pending_write_vector_nb;
    248             *pending_write_vector_nb = 0;
     249        total_assig += *pending_write_vector_nb;
     250#endif
     251        total_assig += *pending_write_vector_nb;
     252        *pending_write_vector_nb = 0;
    249253
    250254#if defined(DUMP_STAGE)
    251             cerr << "done.\n";
    252 #endif
    253         }
     255        cerr << "done.\n";
     256#endif
     257    }
    254258
    255259} // end of extern "C"
Note: See TracChangeset for help on using the changeset viewer.