Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/SelfTest/src/test.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/SelfTest/src/test.cpp	(revision 95)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/SelfTest/src/test.cpp	(revision 100)
@@ -125,5 +125,9 @@
 
   // Initialisation
-
+  const bool test1 = true;
+  const bool test2 = true;
+  const bool test3 = true;
+  const bool test4 = true;
+  
   const uint32_t seed = 0;
 //const uint32_t seed = static_cast<uint32_t>(time(NULL));
@@ -144,275 +148,447 @@
     {
       LABEL("Iteration %d",iteration);
-
-      if (1)
+      
+      if (test1)
 	{
-	uint32_t port = rand()%_param->_nb_inst_predict;
-
-	LABEL("PREDICT - PUSH");
+          uint32_t port = rand()%_param->_nb_inst_predict;
+          
+          LABEL("PREDICT - PUSH");
+          
+          in_PREDICT_VAL  [port]->write(1);
+          in_PREDICT_PUSH [port]->write(1);
+          
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]; j++)
+              {
+                in_PREDICT_CONTEXT_ID   [port]->write(i);
+                in_PREDICT_ADDRESS_PUSH [port]->write(0xdeadbeef+j);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_PREDICT_ACK  [port]->read(), 1);
+                TEST(Tptr_t    , out_PREDICT_INDEX[port]->read(),(j+1)%_param->_size_queue[i]);
+                
+                SC_START(1);
+                
+              }
+          in_PREDICT_VAL [port]->write(0);
+          
+          SC_START(1);
+          
+          in_PREDICT_VAL  [port]->write(1);
+          in_PREDICT_PUSH [port]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]; j++)
+              {
+                in_PREDICT_CONTEXT_ID   [port]->write(i);
+                in_PREDICT_ADDRESS_PUSH [port]->write(0x21071981+j);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_PREDICT_ACK        [port]->read(), 1);
+                TEST(Tptr_t    , out_PREDICT_INDEX      [port]->read(),(j+1)%_param->_size_queue[i]);
+                TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port]->read(),0xdeadbeef+j);
+                
+                SC_START(1);
+              }
+          in_PREDICT_VAL [port]->write(0);
+          
+          LABEL("PREDICT - POP");
+          
+          in_PREDICT_VAL  [port]->write(1);
+          in_PREDICT_PUSH [port]->write(0);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j< _param->_size_queue[i]; j++)
+              {
+                in_PREDICT_CONTEXT_ID   [port]->write(i);
+                in_PREDICT_ADDRESS_PUSH [port]->write(0xbabedead);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_PREDICT_ACK        [port]->read(), 1);
+                TEST(Tcontrol_t, out_PREDICT_HIT        [port]->read(), 1);
+                uint32_t k=(_param->_size_queue[i]-j)%_param->_size_queue[i];
+                TEST(Tptr_t    , out_PREDICT_INDEX      [port]->read(), k);
+                TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port]->read(),(0x21071981+((k==0)?(_param->_size_queue[i]-1):(k-1))));
+                
+                SC_START(1);
+              }
+          in_PREDICT_VAL [port]->write(0);
+
+          // Now, the stack is empty
+        }
+
+      if (test2)
+	{
+          uint32_t port = rand()%_param->_nb_inst_decod;
+          
+          LABEL("DECOD - without predict");
+          
+          LABEL("DECOD - PUSH");  
+          
+          in_DECOD_VAL             [port]->write(1);
+          in_DECOD_PUSH            [port]->write(1);
+          in_DECOD_MISS_PREDICTION [port]->write(0);
+          
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]; j++)
+              {
+                in_DECOD_CONTEXT_ID   [port]->write(i);
+                in_DECOD_ADDRESS_PUSH [port]->write(0xbeefcaca+j);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_DECOD_ACK  [port]->read(), 1);
+                TEST(Tptr_t    , out_DECOD_INDEX[port]->read(),(j+1)%_param->_size_queue[i]);
+                
+                SC_START(1);
+                
+              }
+          in_DECOD_VAL [port]->write(0);
 	
-	in_PREDICT_VAL  [port]->write(1);
-	in_PREDICT_PUSH [port]->write(1);
-	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  for (uint32_t j=0; j<_param->_size_queue[i]; j++)
-	    {
-	      in_PREDICT_CONTEXT_ID   [port]->write(i);
-	      in_PREDICT_ADDRESS_PUSH [port]->write(0xdeadbeef+j);
-	      
-	      SC_START(0);
-	      
-	      TEST(Tcontrol_t, out_PREDICT_ACK  [port]->read(), 1);
-	      TEST(Tptr_t    , out_PREDICT_INDEX[port]->read(),(j+1)%_param->_size_queue[i]);
-	      
-	      SC_START(1);
-	      
-	    }
-	in_PREDICT_VAL [port]->write(0);
-	
-	SC_START(1);
-	
-	in_PREDICT_VAL  [port]->write(1);
-	in_PREDICT_PUSH [port]->write(1);
-	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  for (uint32_t j=0; j<_param->_size_queue[i]; j++)
-	    {
-	      in_PREDICT_CONTEXT_ID   [port]->write(i);
-	      in_PREDICT_ADDRESS_PUSH [port]->write(0x21071981+j);
-	      
-	      SC_START(0);
-	      
-	      TEST(Tcontrol_t, out_PREDICT_ACK        [port]->read(), 1);
-	      TEST(Tptr_t    , out_PREDICT_INDEX      [port]->read(),(j+1)%_param->_size_queue[i]);
-	      TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port]->read(),0xdeadbeef+j);
-	      
-	      SC_START(1);
-	    }
-	in_PREDICT_VAL [port]->write(0);
-	
-	LABEL("PREDICT - POP");
-	
-	in_PREDICT_VAL  [port]->write(1);
-	in_PREDICT_PUSH [port]->write(0);
-	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  for (uint32_t j=0; j< _param->_size_queue[i]; j++)
-	    {
-	      in_PREDICT_CONTEXT_ID   [port]->write(i);
-	      in_PREDICT_ADDRESS_PUSH [port]->write(0xbabedead);
-	      
-	      SC_START(0);
-	      
-	      TEST(Tcontrol_t, out_PREDICT_ACK        [port]->read(), 1);
-	      TEST(Tcontrol_t, out_PREDICT_HIT        [port]->read(), 1);
-	      uint32_t k=(_param->_size_queue[i]-j)%_param->_size_queue[i];
-	      TEST(Tptr_t    , out_PREDICT_INDEX      [port]->read(), k);
-	      TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port]->read(),(0x21071981+((k==0)?(_param->_size_queue[i]-1):(k-1))));
-	      
-	      SC_START(1);
-	    }
-	in_PREDICT_VAL [port]->write(0);
-	}
-
-      // Now, the stack is empty
-
-      if (1)
-	{
-	uint32_t port1 = rand()%_param->_nb_inst_decod;
-	uint32_t port2 = rand()%_param->_nb_inst_predict;
-
-	LABEL("DECOD - without predict");
-	
-	LABEL("DECOD - PUSH");  
-	
-	in_DECOD_VAL             [port1]->write(1);
-	in_DECOD_PUSH            [port1]->write(1);
-	in_DECOD_MISS_PREDICTION [port1]->write(0);
-	
-	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  for (uint32_t j=0; j<_param->_size_queue[i]; j++)
-	    {
-	      in_DECOD_CONTEXT_ID   [port1]->write(i);
-	      in_DECOD_ADDRESS_PUSH [port1]->write(0xbeefcaca+j);
-	      
-	      SC_START(0);
-	      
-	      TEST(Tcontrol_t, out_DECOD_ACK  [port1]->read(), 1);
-	      TEST(Tptr_t    , out_DECOD_INDEX[port1]->read(),(j+1)%_param->_size_queue[i]);
-	      
-	      SC_START(1);
-	      
-	    }
-	in_DECOD_VAL [port1]->write(0);
-	
-	SC_START(1);
-	
-	in_DECOD_VAL  [port1]->write(1);
-	in_DECOD_PUSH [port1]->write(1);
-	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  for (uint32_t j=0; j<_param->_size_queue[i]; j++)
-	    {
-	      in_DECOD_CONTEXT_ID   [port1]->write(i);
-	      in_DECOD_ADDRESS_PUSH [port1]->write(0x21071981+j);
-	      
-	      SC_START(0);
-	      
-	      TEST(Tcontrol_t, out_DECOD_ACK        [port1]->read(), 1);
-	      TEST(Tptr_t    , out_DECOD_INDEX      [port1]->read(),(j+1)%_param->_size_queue[i]);
-	      TEST(Taddress_t, out_DECOD_ADDRESS_POP[port1]->read(),0xbeefcaca+j);
-	      
-	      SC_START(1);
-	    }
-	in_DECOD_VAL [port1]->write(0);
-	
-	LABEL("DECOD - POP");
-	
-	in_DECOD_VAL  [port1]->write(1);
-	in_DECOD_PUSH [port1]->write(0);
-	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  for (uint32_t j=0; j< _param->_size_queue[i]; j++)
-	    {
-	      in_DECOD_CONTEXT_ID   [port1]->write(i);
-	      in_DECOD_ADDRESS_PUSH [port1]->write(0xbabedead);
-	      
-	      SC_START(0);
-	      
-	      TEST(Tcontrol_t, out_DECOD_ACK        [port1]->read(), 1);
-	      TEST(Tcontrol_t, out_DECOD_HIT        [port1]->read(), 1);
-	      uint32_t k=(_param->_size_queue[i]-j)%_param->_size_queue[i];
-	      TEST(Tptr_t    , out_DECOD_INDEX      [port1]->read(), k);
-	      TEST(Taddress_t, out_DECOD_ADDRESS_POP[port1]->read(),(0x21071981+((k==0)?(_param->_size_queue[i]-1):(k-1))));
-	      
-	      SC_START(1);
-	    }
-	in_DECOD_VAL [port1]->write(0);
-
-	LABEL("DECOD - with predict");
-	
-	LABEL("DECOD - PUSH (size_queue/2)");  
-	
-	in_DECOD_VAL             [port1]->write(1);
-	in_DECOD_PUSH            [port1]->write(1);
-	in_DECOD_MISS_PREDICTION [port1]->write(1);
-	
-	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  for (uint32_t j=0; j<_param->_size_queue[i]/2;j++)
-	    {
-	      in_DECOD_CONTEXT_ID   [port1]->write(i);
-	      in_DECOD_ADDRESS_PUSH [port1]->write(0x01234567+j);
-	      
-	      SC_START(0);
-	      
-	      TEST(Tcontrol_t, out_DECOD_ACK  [port1]->read(), 1);
-	      TEST(Tptr_t    , out_DECOD_INDEX[port1]->read(),(j+1)%_param->_size_queue[i]);
-	      
-	      SC_START(1);
-	      
-	    }
-	in_DECOD_VAL [port1]->write(0);
-
-	LABEL("PREDICT - PUSH (size_queue/2)");  
-	
-	in_PREDICT_VAL             [port2]->write(1);
-	in_PREDICT_PUSH            [port2]->write(1);
-	
-	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  for (uint32_t j=0; j<_param->_size_queue[i]/2;j++)
-	    {
-	      in_PREDICT_CONTEXT_ID   [port2]->write(i);
-	      in_PREDICT_ADDRESS_PUSH [port2]->write((0x89abcdef+j)+(_param->_size_queue[i]/2));
-	      
-	      SC_START(0);
-	      
-	      TEST(Tcontrol_t, out_PREDICT_ACK  [port2]->read(), 1);
-	      TEST(Tptr_t    , out_PREDICT_INDEX[port2]->read(),(j+1+(_param->_size_queue[i]/2))%_param->_size_queue[i]);
-	      
-	      SC_START(1);
-	    }
-
-	in_PREDICT_VAL [port2]->write(0);
-
-	LABEL("PREDICT - POP (size_queue/2)");  
-
-	in_PREDICT_VAL  [port2]->write(1);
-	in_PREDICT_PUSH [port2]->write(0);
-	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  {
-	    for (uint32_t j=0; j< _param->_size_queue[i]/2; j++)
-	      {
-		in_PREDICT_CONTEXT_ID   [port2]->write(i);
-		in_PREDICT_ADDRESS_PUSH [port2]->write(0xbabedead);
-		
-		SC_START(0);
-		
-		TEST(Tcontrol_t, out_PREDICT_ACK        [port2]->read(), 1);
-		TEST(Tcontrol_t, out_PREDICT_HIT        [port2]->read(), 1);
-		uint32_t k=  (_param->_size_queue[i]-j)%_param->_size_queue[i];
-		TEST(Tptr_t    , out_PREDICT_INDEX      [port2]->read(), k);
-
-		Taddress_t res = (0x89abcdef+((k==0)?(_param->_size_queue[i]-1):(k-1)));
-		LABEL("k      : %d",k);
-		LABEL("res    : %x",res);
-		LABEL("@_pop  : %x",out_PREDICT_ADDRESS_POP[port2]->read());
-
-		TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port2]->read(),res);
-		
-		SC_START(1);
-	      }
-
-	    for (uint32_t j=0; j< _param->_size_queue[i]/2; j++)
-	      {
-		in_PREDICT_CONTEXT_ID   [port2]->write(i);
-		in_PREDICT_ADDRESS_PUSH [port2]->write(0xbabedead);
-		
-		SC_START(0);
-		
-		TEST(Tcontrol_t, out_PREDICT_ACK        [port2]->read(), 1);
-		TEST(Tcontrol_t, out_PREDICT_HIT        [port2]->read(), 1);
-		uint32_t k=(_param->_size_queue[i]/2-j)%_param->_size_queue[i];
-		TEST(Tptr_t    , out_PREDICT_INDEX      [port2]->read(), k);
-
-		Taddress_t res = (0x01234567+((k==0)?(_param->_size_queue[i]/2-1):(k-1)));
-
-		LABEL("k      : %d",k);
-		LABEL("res    : %x",res);
-		LABEL("@_pop  : %x",out_PREDICT_ADDRESS_POP[port2]->read());
-
-		TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port2]->read(),res);
-		
-		SC_START(1);
-	      }
-	  }
-
-	in_PREDICT_VAL [port2]->write(0);
-
-	in_DECOD_VAL  [port1]->write(1);
-	in_DECOD_PUSH [port1]->write(0);
-	in_DECOD_MISS_PREDICTION [port1]->write(0);
-
-	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  {
-	    for (uint32_t j=0; j< _param->_size_queue[i]/2; j++)
-	      {
-		in_DECOD_CONTEXT_ID   [port1]->write(i);
-		in_DECOD_ADDRESS_PUSH [port1]->write(0xbabedead);
-		
-		SC_START(0);
-		
-		TEST(Tcontrol_t, out_DECOD_ACK        [port1]->read(), 1);
-		TEST(Tcontrol_t, out_DECOD_HIT        [port1]->read(), 1);
-		uint32_t k=(_param->_size_queue[i]/2-j)%_param->_size_queue[i];
-		TEST(Tptr_t    , out_DECOD_INDEX      [port1]->read(), k);
-
-		Taddress_t res = (0x01234567+((k==0)?(_param->_size_queue[i]/2-1):(k-1)));
-
-		LABEL("k      : %d",k);
-		LABEL("res    : %x",res);
-		LABEL("@_pop  : %x",out_DECOD_ADDRESS_POP[port1]->read());
-
-		TEST(Taddress_t, out_DECOD_ADDRESS_POP[port1]->read(),res);
-		
-		SC_START(1);
-	      }
-	  }
-
-	in_DECOD_VAL [port1]->write(0);
+          SC_START(1);
+          
+          in_DECOD_VAL  [port]->write(1);
+          in_DECOD_PUSH [port]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]; j++)
+              {
+                in_DECOD_CONTEXT_ID   [port]->write(i);
+                in_DECOD_ADDRESS_PUSH [port]->write(0x21071981+j);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_DECOD_ACK        [port]->read(), 1);
+                TEST(Tptr_t    , out_DECOD_INDEX      [port]->read(),(j+1)%_param->_size_queue[i]);
+                TEST(Taddress_t, out_DECOD_ADDRESS_POP[port]->read(),0xbeefcaca+j);
+                
+                SC_START(1);
+              }
+          in_DECOD_VAL [port]->write(0);
+          
+          LABEL("DECOD - POP");
+          
+          in_DECOD_VAL  [port]->write(1);
+          in_DECOD_PUSH [port]->write(0);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j< _param->_size_queue[i]; j++)
+              {
+                in_DECOD_CONTEXT_ID   [port]->write(i);
+                in_DECOD_ADDRESS_PUSH [port]->write(0xbabedead);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_DECOD_ACK        [port]->read(), 1);
+                TEST(Tcontrol_t, out_DECOD_HIT        [port]->read(), 1);
+                uint32_t k=(_param->_size_queue[i]-j)%_param->_size_queue[i];
+                TEST(Tptr_t    , out_DECOD_INDEX      [port]->read(), k);
+                TEST(Taddress_t, out_DECOD_ADDRESS_POP[port]->read(),(0x21071981+((k==0)?(_param->_size_queue[i]-1):(k-1))));
+                
+                SC_START(1);
+              }
+          in_DECOD_VAL [port]->write(0);
+          // Now, the stack is empty
+        }
+
+      if (test3)
+        {
+          uint32_t port1 = rand()%_param->_nb_inst_predict;
+          uint32_t port2 = rand()%_param->_nb_inst_decod;
+          uint32_t port3 = rand()%_param->_nb_inst_update;
+
+          LABEL("Test UPDATE");
+
+          LABEL("Predict");
+          in_PREDICT_VAL  [port1]->write(1);
+          in_PREDICT_PUSH [port1]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]; j++)
+              {
+                in_PREDICT_CONTEXT_ID   [port1]->write(i);
+                in_PREDICT_ADDRESS_PUSH [port1]->write(0x25071959+j);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_PREDICT_ACK        [port1]->read(), 1);
+                TEST(Tptr_t    , out_PREDICT_INDEX      [port1]->read(),(j+1)%_param->_size_queue[i]);
+//              TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port1]->read(),0xdeadbeef+j);
+                
+                SC_START(1);
+              }
+          in_PREDICT_VAL [port1]->write(0);
+
+          LABEL("Decod");
+          in_DECOD_VAL  [port2]->write(1);
+          in_DECOD_PUSH [port2]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]/2; j++)
+              {
+                in_DECOD_CONTEXT_ID      [port2]->write(i);
+                in_DECOD_ADDRESS_PUSH    [port2]->write(0x25071959+j);
+                in_DECOD_MISS_PREDICTION [port2]->write(0);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_DECOD_ACK        [port2]->read(), 1);
+                TEST(Tptr_t    , out_DECOD_INDEX      [port2]->read(),(j+1)%_param->_size_queue[i]);
+                TEST(Taddress_t, out_DECOD_ADDRESS_POP[port2]->read(),0x25071959+j);
+                
+                SC_START(1);
+              }
+          in_DECOD_VAL [port2]->write(0);
+
+          LABEL("Update Decod OK");
+          in_UPDATE_VAL  [port3]->write(1);
+          in_UPDATE_PUSH [port3]->write(1);
+          in_UPDATE_FLUSH[port3]->write(0);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]/2; j++)
+              {
+                uint32_t x=(_param->_size_queue[i]/2)-1;
+                in_UPDATE_CONTEXT_ID        [port3]->write(i);
+                in_UPDATE_MISS_PREDICTION   [port3]->write(0);
+                in_UPDATE_PREDICTION_IFETCH [port3]->write(0);
+                in_UPDATE_INDEX             [port3]->write((x+1)%_param->_size_queue[i]);
+                in_UPDATE_ADDRESS           [port3]->write(0x25071959+x);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_UPDATE_ACK        [port3]->read(), 1);
+                
+                SC_START(1);
+              }
+          in_UPDATE_VAL [port3]->write(0);
+
+          LABEL("Update FLUSH");
+          in_UPDATE_VAL  [port3]->write(1);
+          in_UPDATE_FLUSH[port3]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]/2; j++)
+              {
+                in_UPDATE_CONTEXT_ID        [port3]->write(i);
+                SC_START(1);
+                TEST(Tcontrol_t, out_UPDATE_ACK        [port3]->read(), 1);
+              }
+          in_UPDATE_VAL [port3]->write(0);
+
+
+// Tcontrol_t, in_UPDATE_VAL               
+// Tcontrol_t,out_UPDATE_ACK               
+// Tcontext_t, in_UPDATE_CONTEXT_ID        
+// Tcontrol_t, in_UPDATE_PUSH              
+// Tcontrol_t, in_UPDATE_FLUSH             
+// Tptr_t    , in_UPDATE_INDEX             
+// Taddress_t, in_UPDATE_ADDRESS           
+// Tcontrol_t, in_UPDATE_MISS_PREDICTION   
+// Tcontrol_t, in_UPDATE_PREDICTION_IFETCH 
+
+
+        }
+
+      if (test4)
+        {
+          uint32_t port1 = rand()%_param->_nb_inst_predict;
+          uint32_t port2 = rand()%_param->_nb_inst_decod;
+          uint32_t port3 = rand()%_param->_nb_inst_update;
+
+          LABEL("Test UPDATE");
+
+          LABEL("Predict");
+          in_PREDICT_VAL  [port1]->write(1);
+          in_PREDICT_PUSH [port1]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]; j++)
+              {
+                in_PREDICT_CONTEXT_ID   [port1]->write(i);
+                in_PREDICT_ADDRESS_PUSH [port1]->write(0x14011959+j);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_PREDICT_ACK        [port1]->read(), 1);
+                TEST(Tptr_t    , out_PREDICT_INDEX      [port1]->read(),(j+1)%_param->_size_queue[i]);
+//              TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port1]->read(),0xdeadbeef+j);
+                
+                SC_START(1);
+              }
+          in_PREDICT_VAL [port1]->write(0);
+
+          LABEL("Decod");
+          in_DECOD_VAL  [port2]->write(1);
+          in_DECOD_PUSH [port2]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]/2; j++)
+              {
+                in_DECOD_CONTEXT_ID      [port2]->write(i);
+                in_DECOD_ADDRESS_PUSH    [port2]->write(0x14011959+j);
+                in_DECOD_MISS_PREDICTION [port2]->write(0);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_DECOD_ACK        [port2]->read(), 1);
+                TEST(Tptr_t    , out_DECOD_INDEX      [port2]->read(),(j+1)%_param->_size_queue[i]);
+                TEST(Taddress_t, out_DECOD_ADDRESS_POP[port2]->read(),0x14011959+j);
+                
+                SC_START(1);
+              }
+          in_DECOD_VAL [port2]->write(0);
+
+          LABEL("Update Decod KO");
+          in_UPDATE_VAL  [port3]->write(1);
+          in_UPDATE_PUSH [port3]->write(1);
+          in_UPDATE_FLUSH[port3]->write(0);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]/2; j++)
+              {
+                uint32_t x=(_param->_size_queue[i]/2);
+                in_UPDATE_CONTEXT_ID        [port3]->write(i);
+                in_UPDATE_MISS_PREDICTION   [port3]->write(1);
+                in_UPDATE_PREDICTION_IFETCH [port3]->write(0);
+                in_UPDATE_INDEX             [port3]->write((x-j)%_param->_size_queue[i]);
+                in_UPDATE_ADDRESS           [port3]->write(0xffffffff+x);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_UPDATE_ACK        [port3]->read(), 1);
+                
+                SC_START(1);
+              }
+          in_UPDATE_VAL [port3]->write(0);
+
+          LABEL("Decod");
+          in_DECOD_VAL  [port2]->write(1);
+          in_DECOD_PUSH [port2]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]/2; j++)
+              {
+                in_DECOD_CONTEXT_ID      [port2]->write(i);
+                in_DECOD_ADDRESS_PUSH    [port2]->write(0x14011959+j);
+                in_DECOD_MISS_PREDICTION [port2]->write(0);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_DECOD_ACK        [port2]->read(), 1);
+                TEST(Tptr_t    , out_DECOD_INDEX      [port2]->read(),(j+1)%_param->_size_queue[i]);
+                TEST(Taddress_t, out_DECOD_ADDRESS_POP[port2]->read(),0x14011959+j);
+                
+                SC_START(1);
+              }
+          in_DECOD_VAL [port2]->write(0);
+
+
+          LABEL("Update Decod KO");
+          in_UPDATE_VAL  [port3]->write(1);
+          in_UPDATE_PUSH [port3]->write(1);
+          in_UPDATE_FLUSH[port3]->write(0);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]/2; j++)
+              {
+                uint32_t x=(_param->_size_queue[i]/2);
+                in_UPDATE_CONTEXT_ID        [port3]->write(i);
+                in_UPDATE_MISS_PREDICTION   [port3]->write(1);
+                in_UPDATE_PREDICTION_IFETCH [port3]->write(0);
+                in_UPDATE_INDEX             [port3]->write((x-j)%_param->_size_queue[i]);
+                in_UPDATE_ADDRESS           [port3]->write(0xffffffff+x);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_UPDATE_ACK        [port3]->read(), 1);
+                
+                SC_START(1);
+              }
+          in_UPDATE_VAL [port3]->write(0);
+
+          LABEL("Update Predict KO");
+          in_UPDATE_VAL  [port3]->write(1);
+          in_UPDATE_PUSH [port3]->write(1);
+          in_UPDATE_FLUSH[port3]->write(0);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]; j++)
+              {
+                uint32_t x=(_param->_size_queue[i]);
+                in_UPDATE_CONTEXT_ID        [port3]->write(i);
+                in_UPDATE_MISS_PREDICTION   [port3]->write(1);
+                in_UPDATE_PREDICTION_IFETCH [port3]->write(1);
+                in_UPDATE_INDEX             [port3]->write((x-j)%_param->_size_queue[i]);
+                in_UPDATE_ADDRESS           [port3]->write(0xffffffff+x);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_UPDATE_ACK        [port3]->read(), 1);
+                
+                SC_START(1);
+              }
+          in_UPDATE_VAL [port3]->write(0);
+
+          LABEL("Predict");
+          in_PREDICT_VAL  [port1]->write(1);
+          in_PREDICT_PUSH [port1]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]; j++)
+              {
+                in_PREDICT_CONTEXT_ID   [port1]->write(i);
+                in_PREDICT_ADDRESS_PUSH [port1]->write(0x14011959+j);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_PREDICT_ACK        [port1]->read(), 1);
+                TEST(Tptr_t    , out_PREDICT_INDEX      [port1]->read(),(j+1)%_param->_size_queue[i]);
+                TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port1]->read(),0x14011959+j);
+                
+                SC_START(1);
+              }
+          in_PREDICT_VAL [port1]->write(0);
+
+          LABEL("Update Predict KO");
+          in_UPDATE_VAL  [port3]->write(1);
+          in_UPDATE_PUSH [port3]->write(0);
+          in_UPDATE_FLUSH[port3]->write(0);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]; j++)
+              {
+                uint32_t x=(_param->_size_queue[i]);
+                in_UPDATE_CONTEXT_ID        [port3]->write(i);
+                in_UPDATE_MISS_PREDICTION   [port3]->write(1);
+                in_UPDATE_PREDICTION_IFETCH [port3]->write(1);
+                in_UPDATE_INDEX             [port3]->write((x+j+1)%_param->_size_queue[i]);
+                in_UPDATE_ADDRESS           [port3]->write(0x87654321+j);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_UPDATE_ACK        [port3]->read(), 1);
+                
+                SC_START(1);
+              }
+          in_UPDATE_VAL [port3]->write(0);
+
+          LABEL("Predict");
+          in_PREDICT_VAL  [port1]->write(1);
+          in_PREDICT_PUSH [port1]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]; j++)
+              {
+                in_PREDICT_CONTEXT_ID   [port1]->write(i);
+                in_PREDICT_ADDRESS_PUSH [port1]->write(0x14011959+j);
+                
+                SC_START(0);
+                
+                TEST(Tcontrol_t, out_PREDICT_ACK        [port1]->read(), 1);
+                TEST(Tptr_t    , out_PREDICT_INDEX      [port1]->read(),(j+1)%_param->_size_queue[i]);
+                TEST(Taddress_t, out_PREDICT_ADDRESS_POP[port1]->read(),0x87654321+j);
+                
+                SC_START(1);
+              }
+          in_PREDICT_VAL [port1]->write(0);
+
+          LABEL("Update FLUSH");
+          in_UPDATE_VAL  [port3]->write(1);
+          in_UPDATE_FLUSH[port3]->write(1);
+          for (uint32_t i=0; i<_param->_nb_context; i++)
+            for (uint32_t j=0; j<_param->_size_queue[i]/2; j++)
+              {
+                in_UPDATE_CONTEXT_ID        [port3]->write(i);
+                SC_START(1);
+                TEST(Tcontrol_t, out_UPDATE_ACK        [port3]->read(), 1);
+              }
+          in_UPDATE_VAL [port3]->write(0);
         }
     }
