Index: /sources/src/casc.h
===================================================================
--- /sources/src/casc.h	(revision 59)
+++ /sources/src/casc.h	(revision 60)
@@ -24,5 +24,6 @@
 
 EXTERN char unstable;
-EXTERN int32 pending_write_vector_nb;
+EXTERN int32 * pending_write_vector_nb;
+#pragma omp threadprivate (pending_write_vector_nb)
 
 namespace sc_core {
Index: /sources/src/entity.cc
===================================================================
--- /sources/src/entity.cc	(revision 59)
+++ /sources/src/entity.cc	(revision 60)
@@ -188,4 +188,5 @@
     }
     cerr << "Internal error : get_equi(" << pointer << ")\n";
+    abort();
     exit(11);
 }
@@ -412,4 +413,29 @@
             }
         }
+#if 0
+        sc_interface *reg = get_signal (*i);
+        sc_interface *out = get_out_port (*i);
+        if (reg) {
+            std::cerr << "binding " << *i << " to reg "
+                << reg << std::endl;
+            bind_equi_to_table (*i, reg->get_pointer ());
+        } else if (out) {
+            std::cerr << "binding " << *i << " to out "
+                << out << std::endl;
+            bind_equi_to_table (*i, out->get_pointer ());
+        } else {
+            reg = get_localvar (*i);
+            if (reg) {
+                std::cerr << "binding " << *i << " to localvar "
+                    << reg << std::endl;
+                bind_equi_to_table (*i, reg->get_pointer ());
+            } else {
+                std::cerr << "binding " << *i << " to index "
+                    << index << std::endl;
+                bind_equi_to_table (*i, &(equi_table[index]));
+                index += (i->begin()->data_size_in_bytes() - 1) / sizeof(tab_t) + 1;
+            }
+        }
+#endif
     }
 }
Index: /sources/src/gen_code.cc
===================================================================
--- /sources/src/gen_code.cc	(revision 59)
+++ /sources/src/gen_code.cc	(revision 60)
@@ -49,4 +49,7 @@
 #include <iostream>
 #include <fstream>
+#ifdef _OPENMP
+#include <omp.h>
+#endif
 
 #include "internal.h"
@@ -58,8 +61,4 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
-
-#ifdef _OPENMP
-#include <omp.h>
 #endif
 
@@ -246,5 +245,5 @@
         method_process_list_t &
         moore_func_list,
-        strong_component_list_t &
+        strong_component_list_t *
         strongcomponents) {
     if (dump_stage) {
@@ -277,5 +276,7 @@
     gen_transition(o, transition_func_list);
     gen_moore(o, moore_func_list);
-    gen_mealy(o, strongcomponents);
+    if (strongcomponents != NULL) {
+        gen_mealy      (o, *strongcomponents);
+    }
 
     o << " \n}\n";
@@ -575,6 +576,13 @@
  */
 
-static method_process_list_t func_list[2];
+unsigned int nb_func[2];
+static method_process_t **func_list[2];
+#pragma omp threadprivate (nb_func, func_list)
 static strong_component_list_t quasistatic_list;
+
+unsigned long long busy_wait_f0, busy_wait_f1, busy_wait_up, busy_wait_ml;
+unsigned long long last_wait_f0, last_wait_f1, last_wait_up, last_wait_ml;
+#pragma omp threadprivate (busy_wait_f0, busy_wait_f1, busy_wait_up,busy_wait_ml)
+#pragma omp threadprivate (last_wait_f0, last_wait_f1, last_wait_up,last_wait_ml)
 
 static void Call(const method_process_t & m) {
@@ -611,17 +619,71 @@
 }
 
+unsigned int expected_globaltime = 0;
+volatile unsigned int globaltime __attribute__ ((aligned (128))) = 0;
+#pragma omp shared (globaltime)
+#pragma omp threadprivate (expected_globaltime)
+
+unsigned int num_omp_threads;
 
 void quasistatic_simulate_1_cycle(void) {
-    method_process_list_t::iterator mm;
-    for (mm = func_list[0].begin(); mm != func_list[0].end(); ++mm) {
-        method_process_t & m = **mm;
-        Call(m);
-    }
+    int i;
+
+    for (i = 0; i < nb_func[0]; ++i) {
+        Call(*(func_list[0][i]));
+    }
+#define USE_BUSY_WAIT 1
     update();
-    for (mm = func_list[1].begin(); mm != func_list[1].end(); ++mm) {
-        method_process_t & m = **mm;
-        Call(m);
-    }
-    quasistatic_mealy_generation();
+#if USE_BUSY_WAIT
+    expected_globaltime += num_omp_threads;
+    if (__sync_add_and_fetch(&globaltime, 1) == expected_globaltime) {
+        last_wait_up++;
+    }
+    __asm volatile("mfence");
+    while (globaltime < expected_globaltime) {
+        busy_wait_up++;
+        __asm volatile("lfence");
+    }
+
+#else
+#pragma omp barrier
+#endif
+
+    for (i = 0; i < nb_func[1]; ++i) {
+        Call(*(func_list[1][i]));
+    }
+
+#if USE_BUSY_WAIT
+    expected_globaltime += num_omp_threads;
+    if (__sync_add_and_fetch(&globaltime, 1) == expected_globaltime) {
+        last_wait_f1++;
+    }
+    __asm volatile("mfence");
+    while (globaltime < expected_globaltime) {
+        busy_wait_f1++;
+        __asm volatile("lfence");
+    }
+#else
+#pragma omp barrier
+#endif
+    if (!quasistatic_list.empty()) {
+#pragma omp master
+        {
+            quasistatic_mealy_generation();
+        }
+#if USE_BUSY_WAIT
+        expected_globaltime += num_omp_threads;
+        if (__sync_add_and_fetch(&globaltime, 1) == expected_globaltime) {
+            last_wait_ml++;
+        }
+        __asm volatile("mfence");
+        while (globaltime < expected_globaltime) {
+            busy_wait_ml++;
+            __asm volatile("lfence");
+        }
+#else
+#pragma omp barrier
+#endif
+    }
+
 }
 
@@ -631,5 +693,5 @@
         method_process_list_t &
         moore_func_list,
-        strong_component_list_t &
+        strong_component_list_t *
         mealy_func_list) {
     if (dump_stage) {
@@ -637,7 +699,22 @@
     }
 
-    func_list[0] = transition_func_list;
-    func_list[1] = moore_func_list;
-    quasistatic_list = mealy_func_list;
+    nb_func[0] = transition_func_list.size();
+    nb_func[1] = moore_func_list.size();
+
+    func_list[0] = (method_process_t**) malloc(sizeof (method_process_t*) * nb_func[0]);
+    func_list[1] = (method_process_t**) malloc(sizeof (method_process_t*) * nb_func[1]);
+
+    unsigned int i;
+    for (i = 0; i < nb_func[0]; ++i) {
+        func_list[0][i] = (transition_func_list[i]);
+    }
+
+    for (i = 0; i < nb_func[1]; ++i) {
+        func_list[1][i] = (moore_func_list[i]);
+    }
+
+    if (mealy_func_list != NULL) {
+        quasistatic_list = *mealy_func_list;
+    }
 
     if (dump_stage) {
Index: /sources/src/gen_code.h
===================================================================
--- /sources/src/gen_code.h	(revision 59)
+++ /sources/src/gen_code.h	(revision 60)
@@ -21,4 +21,8 @@
 #include "process_dependency.h"
 
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
 //-------------------------------------------------------------------
 #ifdef __GNUC__
@@ -40,5 +44,5 @@
       method_process_list_t   &transition_list,
       method_process_list_t   &moore_list,
-      strong_component_list_t &mealy_list);
+      strong_component_list_t *mealy_list);
 
 extern void  gen_scheduling_code_for_static_func(
@@ -55,5 +59,5 @@
       method_process_list_t   &transition_list,
       method_process_list_t   &moore_list,
-      strong_component_list_t &strongcomponents);
+      strong_component_list_t *strongcomponents);
 
 /* function when any dynamic link is impossible */
@@ -81,21 +85,90 @@
 inline void internal_sc_cycle2() {
 #ifdef DUMP_STAGE
-    std::cerr << "begin of cycle #" << sc_simulation_time () << "\n";
-#endif
-    func_simulate_1_cycle();  
-    ++nb_cycles;
+#pragma omp master
+    {
+        std::cerr << "begin of cycle #" << sc_simulation_time() << "\n";
+    }
+#endif
+
+	func_simulate_1_cycle();
+
+	++nb_cycles;
 #ifdef DUMP_STAGE
-    std::cerr << "end of cycle\n";
+#pragma omp master
+    {
+        std::cerr << "end of cycle\n";
+    }
 #endif
 }
 
-
 inline void internal_sc_cycle1(int number_of_cycles) {  
-    //while ((! have_to_stop) && (number_of_cycles != 0)) {
-    while (!((have_to_stop) || (number_of_cycles == 0))) {
-        trace_all(false);
-        internal_sc_cycle2();
-        trace_all(true);
-        number_of_cycles = (number_of_cycles < 0) ? number_of_cycles : number_of_cycles - 1;
+    extern unsigned long long busy_wait_f0, busy_wait_f1, busy_wait_up, busy_wait_ml;
+    extern unsigned long long last_wait_f0, last_wait_f1, last_wait_up, last_wait_ml;
+    extern unsigned int nb_func[2];
+#pragma omp threadprivate (busy_wait_f0, busy_wait_f1, busy_wait_up, busy_wait_ml, nb_func)
+#pragma omp threadprivate (last_wait_f0, last_wait_f1, last_wait_up, last_wait_ml)
+    extern unsigned int expected_globaltime;
+    extern volatile unsigned int globaltime;
+#pragma omp shared (globaltime)
+#pragma omp threadprivate (expected_globaltime)
+
+    extern unsigned int num_omp_threads;
+
+
+#pragma omp parallel 
+    {
+//        int cyclecount = number_of_cycles;
+        busy_wait_f0 = busy_wait_f1 = busy_wait_up = busy_wait_ml = total_assig = 0;
+        last_wait_f0 = last_wait_f1 = last_wait_up = last_wait_ml = 0;
+
+        expected_globaltime = 0;
+#pragma omp master
+        {
+            globaltime = 0;
+#ifdef _OPENMP
+            num_omp_threads = omp_get_num_threads();
+#else
+            num_omp_threads = 1;
+#endif
+        }
+
+#pragma omp barrier
+        // while (!((have_to_stop) | (cyclecount == 0))) {
+        while (!((have_to_stop) || (number_of_cycles == 0))) {
+#pragma omp master
+            {
+                trace_all(false);
+            }
+            internal_sc_cycle2();
+#pragma omp master
+            {
+                trace_all(true);
+            }
+            // cyclecount = (number_of_cycles < 0) ? number_of_cycles : cyclecount - 1;
+            number_of_cycles = (number_of_cycles < 0) ? number_of_cycles : number_of_cycles - 1;
+        }
+#pragma omp barrier
+#if 0
+#ifdef _OPENMP
+#pragma omp critical
+        {
+            std::cerr << "Thread " << omp_get_thread_num() << " busy_wait " <<
+                busy_wait_f0 << " " << busy_wait_up << " " <<
+                busy_wait_f1 << " " << busy_wait_ml << std::endl;
+        }
+#pragma omp critical
+        {
+            std::cerr << "Thread " << omp_get_thread_num() << " last_wait " <<
+                last_wait_f0 << " " << last_wait_up << " " <<
+                last_wait_f1 << " " << last_wait_ml << std::endl;
+        }
+#pragma omp critical
+        {
+            std::cerr << "Thread " << omp_get_thread_num() << " nfuncs "
+                << nb_func[0] << " " << nb_func[1] << " total_assig " <<
+                total_assig << std::endl;
+        }
+#endif
+#endif
     }
 }
@@ -117,5 +190,6 @@
 
     if (is_posted_write()) {
-        // update posted value to external signals
+        // update posted value to external signals		
+#pragma omp parallel
         update();
         func_combinationals();
@@ -126,4 +200,5 @@
     // don't need to do func_combinationals since 'unstable' flag is now false
     if (is_posted_write()) {
+#pragma omp parallel
         update();
         func_combinationals();
Index: /sources/src/global_functions.cc
===================================================================
--- /sources/src/global_functions.cc	(revision 59)
+++ /sources/src/global_functions.cc	(revision 60)
@@ -246,10 +246,23 @@
     pending_write_vector_capacity = get_signal_table_size();
 
-    if (pending_write_vector_capacity == 0) {
-        pending_write_vector = NULL;
-    }
-    else {
-        pending_write_vector = (pending_write_vector_t) realloc(pending_write_vector, sizeof(pending_write_t) * pending_write_vector_capacity);
-    }
+    assert(pending_write_vector_capacity != 0);
+
+#ifdef _OPENMP
+#define LINE_SIZE 128L
+    int malloc_size = (sizeof (pending_write_t) * (pending_write_vector_capacity + 1) + (LINE_SIZE - 1)) & ~(LINE_SIZE - 1);
+    assert((sizeof(pending_write_t) * (pending_write_vector_capacity + 1)) <= malloc_size && "bad allocation size");
+
+#pragma omp parallel
+    {
+        posix_memalign((void **) &pending_write_vector, LINE_SIZE, malloc_size);
+        pending_write_vector_nb = (int32_t *) &pending_write_vector[0];
+        pending_write_vector = &pending_write_vector[1];
+        //printf("malloc 0x%x @%p, idx @0x%x\n", malloc_size, pending_write_vector, pending_write_vector_nb);
+        *pending_write_vector_nb = 0;
+    }
+#else
+    pending_write_vector = (pending_write_vector_t) malloc(sizeof(pending_write_t) * pending_write_vector_capacity);
+#endif
+
 
     // create the clock list
@@ -267,5 +280,5 @@
     }
     // Check if any constructor wrote into registers
-    if (pending_write_vector_nb != 0) {
+    if (*pending_write_vector_nb != 0) {
         cerr <<
             "Error : Register/Signal writing is not allowed before sc_initialize.\n"
@@ -285,5 +298,5 @@
     }
 
-    pending_write_vector_nb = 0;
+    *pending_write_vector_nb = 0;
 
     check_all_ports();
Index: /sources/src/sc_main.cc
===================================================================
--- /sources/src/sc_main.cc	(revision 59)
+++ /sources/src/sc_main.cc	(revision 60)
@@ -37,4 +37,5 @@
 #include <sstream>
 #include <list>
+#include <omp.h>
 #include <set>
 #include <cstring> // strcmp
@@ -393,5 +394,5 @@
 
     int ret = sc_main(argc, argv);
-    free(pending_write_vector);
+    //free(pending_write_vector);
     close_systemcass();
 
Index: /sources/src/sc_module.cc
===================================================================
--- /sources/src/sc_module.cc	(revision 59)
+++ /sources/src/sc_module.cc	(revision 60)
@@ -38,4 +38,7 @@
 #include <vector>
 #include <set>
+#ifdef _OPENMP
+#include <omp.h>
+#endif
 
 #include "sc_module.h"
@@ -124,8 +127,11 @@
 // ----------------------------------------------------------------------------
 method_process_t::method_process_t(const char * nm, SC_ENTRY_FUNC fn, sc_module & mod) {
-  name = nm;
-  func = fn; 
-  module = &mod;
-  dont_initialize = false;
+    name = nm;
+    func = fn; 
+    module = &mod;
+    dont_initialize = false;
+#ifdef _OPENMP
+    omp_threadnum = omp_get_thread_num();
+#endif
 }
 
Index: /sources/src/sc_module.h
===================================================================
--- /sources/src/sc_module.h	(revision 59)
+++ /sources/src/sc_module.h	(revision 60)
@@ -70,4 +70,5 @@
     sensitivity_list_t sensitivity_list;
     bool dont_initialize;
+    int omp_threadnum;
 
     // constructors
Index: /sources/src/sc_port.cc
===================================================================
--- /sources/src/sc_port.cc	(revision 59)
+++ /sources/src/sc_port.cc	(revision 60)
@@ -53,5 +53,7 @@
     extern char unstable;
     char unstable = 0; // not in sc_core namespace because dynamic link support C linkage only
-    int32 pending_write_vector_nb = 0;
+    int32 * pending_write_vector_nb = 0;
+    unsigned long long int total_assig = 0;
+#pragma omp threadprivate (pending_write_vector_nb, total_assig)
 }
 
@@ -65,4 +67,5 @@
 unsigned int pending_write_vector_capacity = 512;
 pending_write_vector_t pending_write_vector = NULL;
+#pragma omp threadprivate (pending_write_vector)
 extern equi_list_t equi_list;
 
@@ -218,9 +221,9 @@
             // signal table sorting doesn't give any better performance
 #if defined(DUMP_STAGE)
-            cerr << "(" << pending_write_vector_nb 
+            cerr << "(" << *pending_write_vector_nb 
                 << " internal pending writings) ";
 #endif
             unsigned int i;
-            for (i = 0; i < pending_write_vector_nb; ++i) {
+            for (i = 0; i < *pending_write_vector_nb; ++i) {
 #define iter (sc_core::pending_write_vector[i])
 #ifdef CONFIG_DEBUG
@@ -240,7 +243,8 @@
             }
 #ifdef DUMP_SIGNAL_STATS
-            total_assig += pending_write_vector_nb;
-#endif
-            pending_write_vector_nb = 0;
+            total_assig += *pending_write_vector_nb;
+#endif
+            total_assig += *pending_write_vector_nb;
+            *pending_write_vector_nb = 0;
 
 #if defined(DUMP_STAGE)
Index: /sources/src/sc_port_ext.h
===================================================================
--- /sources/src/sc_port_ext.h	(revision 59)
+++ /sources/src/sc_port_ext.h	(revision 60)
@@ -295,9 +295,12 @@
     std::cerr << "write " << value_ << " on in/out port (writing into a signal) '" << name() << "'\n";
 #endif
-    //  T& ref = *(T*)(get_pointer());
+  T *p = (T*)get_pointer();
+  if (*p != value_) {
+	*p = value_;
 #ifndef USE_PORT_DEPENDENCY
-    unstable |= (value_) != val; //ref;
-#endif
-    /*ref*/ val = (value_);
+	if (unstable == 0)
+		unstable = 1;
+#endif
+  }
 }
 
Index: /sources/src/sc_signal.h
===================================================================
--- /sources/src/sc_signal.h	(revision 59)
+++ /sources/src/sc_signal.h	(revision 60)
@@ -18,4 +18,5 @@
 #include <iostream>
 #include <cstdlib>
+#include <cstring>
 #include <typeinfo> // for typeid
 
@@ -67,8 +68,11 @@
 // Pending write to register (simple stack)
 typedef pending_write_t * pending_write_vector_t;
+extern "C" int32_t * pending_write_vector_nb;
+extern "C" unsigned long long int total_assig;
+#pragma omp threadprivate(pending_write_vector_nb, total_assig)
+extern unsigned int pending_write_vector_capacity;
+
 extern pending_write_vector_t pending_write_vector;
-extern "C" unsigned int pending_write_vector_nb;
-extern unsigned int pending_write_vector_capacity;
-
+#pragma omp threadprivate(pending_write_vector)
 
 template < typename T >
@@ -92,5 +96,5 @@
     else {
 #if defined(CONFIG_DEBUG)
-        if (pending_write_vector_nb >= pending_write_vector_capacity) {
+        if (*pending_write_vector_nb >= pending_write_vector_capacity) {
             std::cerr << "Error : The array for posted writing on register is too small.\n";
             std::cerr << "Up to 1 writing per register is allowed during a cycle.\n";
@@ -99,10 +103,10 @@
         }
 #endif
-        pending_write_vector[pending_write_vector_nb].pointer = pointer_;
-        // pending_write_vector[pending_write_vector_nb++].value = *(reinterpret_cast<const base_type*const>(&value_)); => bug !
-        pending_write_vector[pending_write_vector_nb++].value = value_; // => bug avec blues !
+        pending_write_vector[*pending_write_vector_nb].pointer = pointer_;
+        // pending_write_vector[(*pending_write_vector_nb)++].value = *(reinterpret_cast<const base_type*const>(&value_)); => bug !
+        pending_write_vector[(*pending_write_vector_nb)++].value = value_; // => bug avec blues !
 
         // -> fix to use user-defined struct in sc_signal/sc_in/sc_out/sc_inout
-        // pending_write_vector[pending_write_vector_nb++].value = *((base_type*)&value_); => bug !
+        // pending_write_vector[(*pending_write_vector_nb)++].value = *((base_type*)&value_); => bug !
 #if 0
         std::cerr << "posted write : ptr = " << pointer_ << ", val = " << value_ << "\n";
@@ -119,5 +123,5 @@
 
 inline bool is_posted_write() {
-    return pending_write_vector_nb > 0;
+    return *pending_write_vector_nb > 0;
 }
 
@@ -165,5 +169,5 @@
 
     T val;
-
+    T new_val;
     typedef T data_type;
     typedef sc_signal < T > this_type;
@@ -216,4 +220,29 @@
         sc_signal< T >::write(read() + a.read());
         return *this;
+    }
+
+    inline void * operator new (size_t size, size_t align) {
+        void * p;
+        const size_t nsize = (size + align - 1) & ~(align - 1);
+        if (nsize < size) {
+            std::cerr << "sc_signal new() alignement doesn't work (" <<
+                nsize << " < " << size << ")" << std::endl;
+            abort();
+        }
+
+        if (posix_memalign(&p, align, nsize) == 0) {
+            return p;
+        }
+        else {
+            return NULL;
+        }
+    }
+
+    inline void * operator new (size_t size) {
+        return malloc(size);
+    }
+
+    inline void * operator new (size_t size, void * p) {
+        return p;
     }
 
@@ -247,7 +276,11 @@
     set_kind(kind_string);
     sc_interface::init(sizeof(data_type)); 
+#if 0
     val = (T) 0; /* The simulator initializes the signal/register to 0.    */
-    /* However, hardware initialization still has to be done. */
-    /* This kind of initialization is for trace diffing.      */
+                 /* However, hardware initialization still has to be done. */
+                 /* This kind of initialization is for trace diffing.      */
+#else
+    memset(&val, 0, sizeof(val));
+#endif
 }
 
@@ -267,4 +300,7 @@
 template < typename T >
 inline void sc_signal< T >::write(const data_type & value_) {
+    if (sc_signal< T >::val == value_ && sc_signal< T >::new_val == value_) {
+        return;
+    }
 #ifdef CONFIG_DEBUG
     if (get_pointer() == NULL) {
@@ -279,5 +315,5 @@
     std::cerr << "write (posted) " << value_ << " on sc_signal (writing into register) '" << name() << "'\n";
 #endif
-    
+    sc_signal<T>::new_val = value_;
     post_write(/*(tab_t*)&val*/ get_pointer(), value_);
 }
Index: /sources/src/sc_time.cc
===================================================================
--- /sources/src/sc_time.cc	(revision 59)
+++ /sources/src/sc_time.cc	(revision 60)
@@ -55,4 +55,5 @@
 
 uint64 nb_cycles = 0;
+#pragma omp threadprivate(nb_cycles)
 
 const sc_time SC_ZERO_TIME(0, SC_NS);
Index: /sources/src/sc_time.h
===================================================================
--- /sources/src/sc_time.h	(revision 59)
+++ /sources/src/sc_time.h	(revision 60)
@@ -43,4 +43,5 @@
 
 extern uint64 nb_cycles;
+#pragma omp threadprivate(nb_cycles)
 
 inline double sc_simulation_time() {
Index: /sources/src/schedulers.cc
===================================================================
--- /sources/src/schedulers.cc	(revision 59)
+++ /sources/src/schedulers.cc	(revision 60)
@@ -49,4 +49,8 @@
 #include "graph_signals.h" // makegraph
 
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -57,4 +61,9 @@
 namespace sc_core {
 
+// sort_functions splits and sorts instances_list into three functions lists : 
+method_process_list_t * transition_func_list;
+method_process_list_t * moore_func_list;
+#pragma omp threadprivate(transition_func_list, moore_func_list)
+method_process_list_t combinational_func_list;
 /* ***************************** */
 /* Dumping functions (for debug) */
@@ -74,8 +83,4 @@
 /****************/
 
-// sort_functions splits and sorts instances_list into three functions lists : 
-method_process_list_t transition_func_list;
-method_process_list_t moore_func_list;
-method_process_list_t combinational_func_list;
 
 
@@ -115,19 +120,33 @@
 void sort_functions() {
     method_process_list_t::const_iterator m;
+#pragma omp parallel
+#pragma omp critical
+    {
+        transition_func_list = new method_process_list_t;
+        moore_func_list = new method_process_list_t;
+        for (m = method_process_list.begin(); m != method_process_list.end(); ++m) {
+#ifdef _OPENMP
+            if ((*m)->omp_threadnum == omp_get_thread_num())
+#endif
+            {
+                if ((*m)->is_transition()) {
+                    transition_func_list->push_back(*m);
+                }
+                else if ((*m)->is_genmoore()) {
+                    moore_func_list->push_back(*m);
+                }
+            }
+        }
+        // Sort transition functions by method pointer (1) and by module pointer (2)
+        std::sort(transition_func_list->begin(), transition_func_list->end(), sort_by_fct_ptr);
+        // Sort generation functions by method pointer (1) and by module pointer (2)
+        std::sort(moore_func_list->begin(), moore_func_list->end(), sort_by_fct_ptr);
+    }
+
     for (m = method_process_list.begin(); m != method_process_list.end(); ++m) {
         if ((*m)->is_combinational()) {
             combinational_func_list.push_back(*m);
         }
-        else if ((*m)->is_transition ()) {
-            transition_func_list.push_back(*m);
-        }
-        else if ((*m)->is_genmoore ()) {
-            moore_func_list.push_back(*m);
-        }
-    }
-    // Sort transition functions by method pointer (1) and by module pointer (2)
-    std::sort (transition_func_list.begin(), transition_func_list.end(), sort_by_fct_ptr);
-    // Sort generation functions by method pointer (1) and by module pointer (2)
-    std::sort (moore_func_list.begin(), moore_func_list.end(), sort_by_fct_ptr);
+    }
 }
 
@@ -203,4 +222,5 @@
 
 string get_scheduling(int scheduling_method) {
+    string base_name;
     /* marque les fonctions comme fonction de mealy ou non */
     if (dump_funclist_info) {
@@ -209,12 +229,22 @@
 
     sort_functions();
-    if (dump_funclist_info) {
-        cerr << "Transition functions : " << transition_func_list << "\n";
-        cerr << "Moore generation functions : " << moore_func_list << "\n";
-        cerr << "Mealy generation functions : " << combinational_func_list << "\n";
-    }
+#pragma omp parallel
+#pragma omp critical
+    {
+        if (dump_funclist_info) {
+#ifdef _OPENMP
+            cerr << "Thread " << omp_get_thread_num() << "\n";
+#endif
+            cerr << "  Transition functions : " << *transition_func_list << "\n";
+            cerr << "  Moore generation functions : " << *moore_func_list << "\n";
+#pragma omp master
+            {
+                if (!combinational_func_list.empty()) {
+                    cerr << "Mealy generation functions : " << combinational_func_list << "\n";
+                }
+            }
+        }
 
     /* Schedule */
-    string base_name;
     switch (scheduling_method) {
         case BUCHMANN_SCHEDULING :
@@ -225,8 +255,8 @@
             ProcessDependencyList * process_list = BuchmannScheduling();
             if (dynamic_link_of_scheduling_code) {
-                base_name = gen_scheduling_code_for_dynamic_link(transition_func_list, moore_func_list, *process_list);
+                base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, *process_list);
             }
             else {
-                gen_scheduling_code_for_static_func(transition_func_list, moore_func_list, *process_list);
+                gen_scheduling_code_for_static_func(*transition_func_list, *moore_func_list, *process_list);
             }
             break;
@@ -242,8 +272,8 @@
             ProcessDependencyList * process_list = MouchardScheduling();
             if (dynamic_link_of_scheduling_code) {
-                base_name = gen_scheduling_code_for_dynamic_link(transition_func_list, moore_func_list, *process_list);
+                base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, *process_list);
             }
             else {
-                gen_scheduling_code_for_static_func (transition_func_list, moore_func_list, *process_list);
+                gen_scheduling_code_for_static_func (*transition_func_list, *moore_func_list, *process_list);
             }
             break;
@@ -255,14 +285,18 @@
             // Hommais's thesis explains this scheduling method (like CASS strategy)
             // Doesn't use port dependancies
-            Graph * g = makegraph (&combinational_func_list);
-            if (dump_all_graph && g) {
-                graph2dot("module_graph", *g);
-            }
-            strong_component_list_t * strong_list = strong_component(g);
+            strong_component_list_t * strong_list = NULL;
+#pragma omp master
+            {
+                Graph * g = makegraph (&combinational_func_list);
+                if (dump_all_graph && g) {
+                    graph2dot("module_graph", *g);
+                }
+                strong_list = strong_component(g);
+            }
             if (dynamic_link_of_scheduling_code) {
-                base_name = gen_scheduling_code_for_dynamic_link(transition_func_list, moore_func_list, *strong_list);
+                base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, strong_list);
             }
             else {
-                gen_scheduling_code_for_quasistatic_func (transition_func_list, moore_func_list, *strong_list);
+                gen_scheduling_code_for_quasistatic_func (*transition_func_list, *moore_func_list, strong_list);
             }
             break;
@@ -272,4 +306,5 @@
                     "Please select a scheduling method.\n";
             exit (35);
+    }
     }
     return base_name;
Index: /sources/test_regression/02052006/system.cpp
===================================================================
--- /sources/test_regression/02052006/system.cpp	(revision 59)
+++ /sources/test_regression/02052006/system.cpp	(revision 60)
@@ -121,4 +121,7 @@
     sc_signal<bool> resetn("resetn");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     test test1("test1");
     test1.clk(signal_clk);
Index: /sources/test_regression/04052005/system.cpp
===================================================================
--- /sources/test_regression/04052005/system.cpp	(revision 59)
+++ /sources/test_regression/04052005/system.cpp	(revision 60)
@@ -23,4 +23,7 @@
     e = 0x11;
     f = 0x1A0;
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     cout << "a = 0x" << hex << (unsigned int) a << " = " << a.to_string(SC_BIN) << "\n";
Index: /sources/test_regression/05092005/system.cpp
===================================================================
--- /sources/test_regression/05092005/system.cpp	(revision 59)
+++ /sources/test_regression/05092005/system.cpp	(revision 60)
@@ -22,4 +22,8 @@
     sc_clock signal_clk("my_clock", sc_time(1, sc_core::SC_NS));
     sc_signal<bool> s[5];
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     hard a("a");
     hard b("b");
Index: /sources/test_regression/07052005/system.cpp
===================================================================
--- /sources/test_regression/07052005/system.cpp	(revision 59)
+++ /sources/test_regression/07052005/system.cpp	(revision 60)
@@ -39,4 +39,7 @@
     i = e;
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     cout << "a = 0x" << hex << (unsigned int) a << " = " << a.to_string(SC_BIN) << "\n";
     //ASSERT(a.to_string(SC_BIN) == "0b000000111100010001");
Index: /sources/test_regression/07122006a/system.cpp
===================================================================
--- /sources/test_regression/07122006a/system.cpp	(revision 59)
+++ /sources/test_regression/07122006a/system.cpp	(revision 60)
@@ -19,4 +19,7 @@
     sc_signal<int> in ("in");
     sc_signal<int> out("out");
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     test test("test");
Index: /sources/test_regression/07122006b/system.cpp
===================================================================
--- /sources/test_regression/07122006b/system.cpp	(revision 59)
+++ /sources/test_regression/07122006b/system.cpp	(revision 60)
@@ -65,4 +65,7 @@
     sc_signal<int> out("out");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     test test("test");
     test.clk(clk);
Index: /sources/test_regression/08092005/system.cpp
===================================================================
--- /sources/test_regression/08092005/system.cpp	(revision 59)
+++ /sources/test_regression/08092005/system.cpp	(revision 60)
@@ -40,4 +40,7 @@
     hard b("b");
     hard c("c");
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     a.clk(clk);
Index: /sources/test_regression/09092005a/system.cpp
===================================================================
--- /sources/test_regression/09092005a/system.cpp	(revision 59)
+++ /sources/test_regression/09092005a/system.cpp	(revision 60)
@@ -14,4 +14,7 @@
 
 int sc_main (int argc, char ** argv) {
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     sc_uint<ADDRSIZE> LINEADDR_MASK = ~(((sc_uint<ADDRSIZE>) ~0x0) >> (ADDRSIZE - OFFSETSIZE - BPFSIZE));
Index: /sources/test_regression/09092005b/system.cpp
===================================================================
--- /sources/test_regression/09092005b/system.cpp	(revision 59)
+++ /sources/test_regression/09092005b/system.cpp	(revision 60)
@@ -39,4 +39,7 @@
     hard b("b");
     hard c("c");
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     a.clk(clk1);
Index: /sources/test_regression/09092005c/system.cpp
===================================================================
--- /sources/test_regression/09092005c/system.cpp	(revision 59)
+++ /sources/test_regression/09092005c/system.cpp	(revision 60)
@@ -82,4 +82,7 @@
     top_level t("top_level");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     t.clk(clk);
     t.o(out);
Index: /sources/test_regression/11062007/system.cpp
===================================================================
--- /sources/test_regression/11062007/system.cpp	(revision 59)
+++ /sources/test_regression/11062007/system.cpp	(revision 60)
@@ -104,4 +104,7 @@
     sc_signal<bool> s1("s1"),s2("s2"),s3("s3"),s4("s4"),s5("s5");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     A a("a");
     B b("b");
Index: /sources/test_regression/14092005/system.cpp
===================================================================
--- /sources/test_regression/14092005/system.cpp	(revision 59)
+++ /sources/test_regression/14092005/system.cpp	(revision 60)
@@ -48,4 +48,7 @@
     sc_signal<int> s[10];
     hard a("a");
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     a.clk(clk1);
Index: /sources/test_regression/15042009a/system.cpp
===================================================================
--- /sources/test_regression/15042009a/system.cpp	(revision 59)
+++ /sources/test_regression/15042009a/system.cpp	(revision 60)
@@ -123,4 +123,7 @@
     top_level t("top_level");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     t.clk(clk);
     t.o(out);
Index: /sources/test_regression/15042009b/system.cpp
===================================================================
--- /sources/test_regression/15042009b/system.cpp	(revision 59)
+++ /sources/test_regression/15042009b/system.cpp	(revision 60)
@@ -17,4 +17,7 @@
     a = ca;
     b = cb;
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     c = a & b;
Index: /sources/test_regression/15042009c/system.cpp
===================================================================
--- /sources/test_regression/15042009c/system.cpp	(revision 59)
+++ /sources/test_regression/15042009c/system.cpp	(revision 60)
@@ -32,4 +32,7 @@
     const long long int ca = 0xf00000000LLU;
     a = ca;
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     test_t<param_t> test1, test2;
Index: /sources/test_regression/15062006/system.cpp
===================================================================
--- /sources/test_regression/15062006/system.cpp	(revision 59)
+++ /sources/test_regression/15062006/system.cpp	(revision 60)
@@ -77,4 +77,7 @@
     sc_signal<int> s01("s01"), s02("s02"), s03("s03"), s04("s04");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     test<int> test1("test1");
     test1.clk(signal_clk);
Index: /sources/test_regression/15092005a/system.cpp
===================================================================
--- /sources/test_regression/15092005a/system.cpp	(revision 59)
+++ /sources/test_regression/15092005a/system.cpp	(revision 60)
@@ -89,4 +89,7 @@
     top_level t("top_level");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     t.clk(clk);
     t.o(out);
Index: /sources/test_regression/15092005b/system.cpp
===================================================================
--- /sources/test_regression/15092005b/system.cpp	(revision 59)
+++ /sources/test_regression/15092005b/system.cpp	(revision 60)
@@ -92,4 +92,7 @@
     top_level t("top_level");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     t.clk(clk);
     t.o(out);
Index: /sources/test_regression/15092005c/system.cpp
===================================================================
--- /sources/test_regression/15092005c/system.cpp	(revision 59)
+++ /sources/test_regression/15092005c/system.cpp	(revision 60)
@@ -87,4 +87,7 @@
     top_level t("top_level");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     t.clk(clk);
     t.o(out);
Index: /sources/test_regression/15092005d/system.cpp
===================================================================
--- /sources/test_regression/15092005d/system.cpp	(revision 59)
+++ /sources/test_regression/15092005d/system.cpp	(revision 60)
@@ -90,4 +90,7 @@
     top_level t("top_level");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     t.clk(clk);
     t.o(out);
Index: /sources/test_regression/16022007/system.cpp
===================================================================
--- /sources/test_regression/16022007/system.cpp	(revision 59)
+++ /sources/test_regression/16022007/system.cpp	(revision 60)
@@ -213,4 +213,6 @@
         s15("s15");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     M_0i1o a("a");
Index: /sources/test_regression/16062005a/system.cpp
===================================================================
--- /sources/test_regression/16062005a/system.cpp	(revision 59)
+++ /sources/test_regression/16062005a/system.cpp	(revision 60)
@@ -75,4 +75,7 @@
     }
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     sc_clock clk("clock");
     top_level1 top1("top1");
Index: /sources/test_regression/16062005b/system.cpp
===================================================================
--- /sources/test_regression/16062005b/system.cpp	(revision 59)
+++ /sources/test_regression/16062005b/system.cpp	(revision 60)
@@ -65,4 +65,7 @@
     }
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     ofstream o;
     o.open (argv[1], ios::out | ios::trunc);
Index: /sources/test_regression/16112005a/system.cpp
===================================================================
--- /sources/test_regression/16112005a/system.cpp	(revision 59)
+++ /sources/test_regression/16112005a/system.cpp	(revision 60)
@@ -40,4 +40,7 @@
     sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     m.i1 (s1);
     m.i2 (s1);
Index: /sources/test_regression/16112005b/system.cpp
===================================================================
--- /sources/test_regression/16112005b/system.cpp	(revision 59)
+++ /sources/test_regression/16112005b/system.cpp	(revision 60)
@@ -38,4 +38,7 @@
     sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     m.i1(s1);
     m.i3(s1);
Index: /sources/test_regression/16112005c/system.cpp
===================================================================
--- /sources/test_regression/16112005c/system.cpp	(revision 59)
+++ /sources/test_regression/16112005c/system.cpp	(revision 60)
@@ -38,4 +38,7 @@
     sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     m.i1 (s1);
     m.i2 (s1);
Index: /sources/test_regression/16122005/system.cpp
===================================================================
--- /sources/test_regression/16122005/system.cpp	(revision 59)
+++ /sources/test_regression/16122005/system.cpp	(revision 60)
@@ -67,4 +67,7 @@
     }
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     sc_clock clk("clock");
     top_level1 top1("top1");
Index: /sources/test_regression/17022006/system.cpp
===================================================================
--- /sources/test_regression/17022006/system.cpp	(revision 59)
+++ /sources/test_regression/17022006/system.cpp	(revision 60)
@@ -69,4 +69,7 @@
     sc_signal<char> s04_0("s04_0"), s04_1("s04_1"), s04_2("s04_2");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     test test1("test1");
     test1.clk(signal_clk);
Index: /sources/test_regression/17032005/system.cpp
===================================================================
--- /sources/test_regression/17032005/system.cpp	(revision 59)
+++ /sources/test_regression/17032005/system.cpp	(revision 60)
@@ -76,4 +76,7 @@
     test.clk(clk);
     test.resetn(resetn);
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     sc_trace_file * tf;
Index: /sources/test_regression/19042005/system.cpp
===================================================================
--- /sources/test_regression/19042005/system.cpp	(revision 59)
+++ /sources/test_regression/19042005/system.cpp	(revision 60)
@@ -78,4 +78,7 @@
     sc_signal< sc_uint<64> > s11("s11"), s12("s12"), s13("s13");
     sc_signal< sc_uint<32> > s16("s16");
+
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     test test1("test1");
Index: /sources/test_regression/19122005/system.cpp
===================================================================
--- /sources/test_regression/19122005/system.cpp	(revision 59)
+++ /sources/test_regression/19122005/system.cpp	(revision 60)
@@ -127,4 +127,7 @@
     sc_clock  signal_clk("my_clock", 1, 0.5);
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     test test1("test1");
     test1.clk(signal_clk);
Index: /sources/test_regression/20122006/system.cpp
===================================================================
--- /sources/test_regression/20122006/system.cpp	(revision 59)
+++ /sources/test_regression/20122006/system.cpp	(revision 60)
@@ -226,4 +226,6 @@
         s15("s15");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     M_0i1o a("a");
Index: /sources/test_regression/21062005/system.cpp
===================================================================
--- /sources/test_regression/21062005/system.cpp	(revision 59)
+++ /sources/test_regression/21062005/system.cpp	(revision 60)
@@ -48,4 +48,7 @@
     sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     m.i1 (s1);
     m.i2 (s1);
Index: /sources/test_regression/24082009/system.cpp
===================================================================
--- /sources/test_regression/24082009/system.cpp	(revision 59)
+++ /sources/test_regression/24082009/system.cpp	(revision 60)
@@ -42,4 +42,7 @@
     sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     A a("a");
     A b("b");
Index: /sources/test_regression/25032005/system.cpp
===================================================================
--- /sources/test_regression/25032005/system.cpp	(revision 59)
+++ /sources/test_regression/25032005/system.cpp	(revision 60)
@@ -103,4 +103,7 @@
     sc_signal<bool> s1("s1"), s2("s2"), s3("s3"), s4("s4"), s5("s5");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     A a("a");
     B b("b");
Index: /sources/test_regression/28102005/system.cpp
===================================================================
--- /sources/test_regression/28102005/system.cpp	(revision 59)
+++ /sources/test_regression/28102005/system.cpp	(revision 60)
@@ -47,4 +47,7 @@
     sc_clock clk("clock");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
+
     check_time(0);
     sc_start(sc_time(0, sc_core::SC_NS));
Index: /sources/test_regression/29032005/system.cpp
===================================================================
--- /sources/test_regression/29032005/system.cpp	(revision 59)
+++ /sources/test_regression/29032005/system.cpp	(revision 60)
@@ -216,4 +216,6 @@
         s15("s15");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     M_0i1o a("a");
Index: /sources/test_regression/30032005a/system.cpp
===================================================================
--- /sources/test_regression/30032005a/system.cpp	(revision 59)
+++ /sources/test_regression/30032005a/system.cpp	(revision 60)
@@ -119,4 +119,6 @@
         s15("s15");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     M1_3i3o a("a");
Index: /sources/test_regression/30032005b/system.cpp
===================================================================
--- /sources/test_regression/30032005b/system.cpp	(revision 59)
+++ /sources/test_regression/30032005b/system.cpp	(revision 60)
@@ -74,4 +74,6 @@
         s15("s15");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     M1_1i1o a("a");
Index: /sources/test_regression/30032005c/system.cpp
===================================================================
--- /sources/test_regression/30032005c/system.cpp	(revision 59)
+++ /sources/test_regression/30032005c/system.cpp	(revision 60)
@@ -108,4 +108,6 @@
         s15("s15");
 
+    // Setup number of threads open-mp to 1 with the macro threads_omp()
+    threads_omp();
 
     M1_3i2o a("a");
Index: /sources/test_regression/test.h
===================================================================
--- /sources/test_regression/test.h	(revision 59)
+++ /sources/test_regression/test.h	(revision 60)
@@ -1,2 +1,6 @@
+
+#ifdef _OPENMP
+    #include <omp.h>
+#endif
 
 #define ASSERT(x)                    \
@@ -8,2 +12,12 @@
 }
 
+#ifdef _OPENMP
+    #define threads_omp()      \
+    ({                         \
+        omp_set_dynamic(false);\
+        omp_set_num_threads(1);\
+    })
+#else
+    #define threads_omp()
+#endif
+
