Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Load_Store_pointer_unit/src/Load_Store_pointer_unit_transition.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Load_Store_pointer_unit/src/Load_Store_pointer_unit_transition.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Load_Store_pointer_unit/src/Load_Store_pointer_unit_transition.cpp	(revision 122)
@@ -38,4 +38,10 @@
 	      reg_LOAD_QUEUE_USE  [i][j] = false;
 	  }
+        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
+          for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
+            {
+              reg_STORE_QUEUE_PTR_READ  [i][j] = 0;
+              reg_STORE_QUEUE_EMPTY     [i][j] = true;
+            }
       }
     else
@@ -56,4 +62,6 @@
  		    log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"    * use STORE_QUEUE");
 
+		    Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_INSERT_FRONT_END_ID [i]):0;
+		    Tcontext_t context_id   = (_param->_have_port_context_id  )?PORT_READ(in_INSERT_CONTEXT_ID   [i]):0;
 		    uint32_t   lsq = internal_INSERT_LSQ [i];
 		    Tlsq_ptr_t ptr = internal_INSERT_PTR [i];
@@ -62,4 +70,5 @@
  		    log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"    * ptr : %d",ptr);
 
+		    reg_STORE_QUEUE_EMPTY     [front_end_id][context_id] = false; // new element
 		    reg_STORE_QUEUE_PTR_WRITE [lsq]      = (ptr+1)%_param->_size_store_queue[lsq];
 		    reg_STORE_QUEUE_NB_USE    [lsq]      ++;
@@ -109,5 +118,7 @@
  		    log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"    * lsq : %d",lsq);
  		    log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"    * ptr : %d",ptr);
-		    
+	
+                    // TODO : if ROB retire ooo context, can retire store ooo.
+
 // 		    reg_STORE_QUEUE_PTR_WRITE [lsq]      = ((ptr==0)?_param->_size_store_queue[lsq]:ptr)-1;
 		    reg_STORE_QUEUE_NB_USE    [lsq]      --;
@@ -137,6 +148,36 @@
 		}	
 	    }
+        
+        for (uint32_t i=0; i<_param->_nb_front_end; ++i)
+          for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
+            {
+              uint32_t lsq = _param->_link_load_store_unit_with_thread[i][j];
+                    
+              if (PORT_READ(in_RETIRE_EVENT_STATE [i][j]) == EVENT_STATE_NO_EVENT)
+                {
+                  uint32_t ptr_old =  reg_STORE_QUEUE_PTR_READ[i][j];
+                  uint32_t ptr_new = (reg_STORE_QUEUE_PTR_READ[i][j]+1)%_param->_size_store_queue[lsq];
+
+                  if ((reg_STORE_QUEUE_USE [lsq][ptr_old] == false) and
+		      (reg_STORE_QUEUE_EMPTY    [i][j] == false))
+                    {
+                      reg_STORE_QUEUE_PTR_READ [i][j] = ptr_new;
+                      if (ptr_new == reg_STORE_QUEUE_PTR_WRITE [lsq])
+                      reg_STORE_QUEUE_EMPTY    [i][j] = true;
+                    }
+                }
+              
+              if (PORT_READ(in_RETIRE_EVENT_VAL[i][j]) and internal_RETIRE_EVENT_ACK [i][j])
+                if (PORT_READ(in_RETIRE_EVENT_STATE [i][j]) == EVENT_STATE_EVENT)
+                  {
+		    log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"  * EVENT [%d][%d]",i,j);
+
+                    // reset ptr_read
+                    reg_STORE_QUEUE_PTR_READ [i][j] = reg_STORE_QUEUE_PTR_WRITE [lsq];
+                    reg_STORE_QUEUE_EMPTY    [i][j] = true;
+                  }
+            }
       }
-
+    
     // ===================================================================
     // =====[ OTHER ]=====================================================
@@ -150,4 +191,8 @@
         {
           log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"    * Load_Store_unit [%d]",i);
+          log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"      * reg_LOAD_QUEUE_PTR_WRITE  : %d", reg_LOAD_QUEUE_PTR_WRITE [i]);
+          log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"      * reg_LOAD_QUEUE_USE        :");
+          for (uint32_t j=0; j<_param->_size_load_queue [i]; ++j)
+          log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"        [%d] %d",j,reg_LOAD_QUEUE_USE [i][j]);
           log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"      * reg_STORE_QUEUE_NB_USE    : %d", reg_STORE_QUEUE_NB_USE   [i]);
           log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"      * reg_STORE_QUEUE_PTR_WRITE : %d", reg_STORE_QUEUE_PTR_WRITE[i]);
@@ -155,9 +200,11 @@
           for (uint32_t j=0; j<_param->_size_store_queue [i]; ++j)
           log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"        [%d] %d",j,reg_STORE_QUEUE_USE [i][j]);
-          log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"      * reg_LOAD_QUEUE_PTR_WRITE  : %d", reg_LOAD_QUEUE_PTR_WRITE [i]);
-          log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"      * reg_LOAD_QUEUE_USE        :");
-          for (uint32_t j=0; j<_param->_size_load_queue [i]; ++j)
-          log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"        [%d] %d",j,reg_LOAD_QUEUE_USE [i][j]);
         }
+      for (uint32_t i=0; i<_param->_nb_front_end; ++i)
+        for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
+          {
+          log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"      * reg_STORE_QUEUE_PTR_READ [%d][%d] : %d",i,j,reg_STORE_QUEUE_PTR_READ [i][j]);
+          log_printf(TRACE,Load_Store_pointer_unit,FUNCTION,"      * reg_STORE_QUEUE_EMPTY    [%d][%d] : %d",i,j,reg_STORE_QUEUE_EMPTY    [i][j]);
+          }
     }
 #endif
