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_);
 }
