Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/src/test.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/src/test.cpp	(revision 98)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/src/test.cpp	(revision 101)
@@ -213,4 +213,17 @@
   // Initialisation
 
+  const bool test1  = true;
+  const bool test2  = true;
+  const bool test3  = true;
+  const bool test4  = true;
+  const bool test5  = true;
+  const bool test6  = true;
+  const bool test7  = true;
+  const bool test8  = true;
+  const bool test9  = true;
+  const bool test10 = true;
+  const bool test11 = true;
+  const bool test12 = true;
+
   const uint32_t seed = 0;
 //const uint32_t seed = static_cast<uint32_t>(time(NULL));
@@ -264,5 +277,5 @@
       uint32_t context    = rand()%_param->_nb_context;
 
-      if (1)
+      if (test1)
 	{
 	  SC_START(3);
@@ -285,13 +298,25 @@
 	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
 	  
-	  do
-	    {
-	      in_DECOD_EVENT_VAL [port]->write(rand()%percent_transaction_decod_event);
-	      
-	      SC_START(1);
-	    }
-	  while (not ( in_DECOD_EVENT_VAL [port]->read() and
-		       out_DECOD_EVENT_ACK [port]->read()));
-	  in_DECOD_EVENT_VAL [port]->write(0);
+          in_DECOD_EVENT_VAL           [port]->write(1);
+
+          SC_START(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+	  TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 0);
+
+          SC_START(1);
+
+	  in_NB_INST_DECOD_ALL  [context]->write(0);
+	  in_NB_INST_COMMIT_ALL [context]->write(0);
+	  in_NB_INST_COMMIT_MEM [context]->write(0);
+          
+          LABEL("msync (send decod)");
+          SC_START(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+	  TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 1);
+
+	  SC_START(1);
+
+          in_DECOD_EVENT_VAL     [port]->write(0);
+	  in_NB_INST_COMMIT_ALL  [context]->write(1);
 	  
 	  LABEL("msync (wait end)");
@@ -300,102 +325,16 @@
 	  SC_START(3);
 	  
-	  in_NB_INST_DECOD_ALL  [context]->write(0);
-	  in_NB_INST_COMMIT_ALL [context]->write(1);
-	  in_NB_INST_COMMIT_MEM [context]->write(0);
-	  
-	  SC_START(1);
-	  
-	  LABEL("msync (send decod)");
-	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
-	  
-	  SC_START(3);
-	  
-	  in_NB_INST_DECOD_ALL  [context]->write(1);
-	  SC_START(1);
-	  
-	  LABEL("msync (wait end)");
-	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
-	  in_NB_INST_DECOD_ALL  [context]->write(0);
-	  in_NB_INST_COMMIT_MEM [context]->write(1);
-	  
-	  SC_START(3);
-	  
-	  in_NB_INST_COMMIT_MEM [context]->write(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
+	  in_NB_INST_COMMIT_ALL [context]->write(0);
+
 	  SC_START(1);
 	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
 	}
       
-      if (1)
+      if (test2)
 	{
 	  SC_START(3);
-
+	  
 	  LABEL("psync (begin)");
-	  in_NB_INST_DECOD_ALL  [context]->write(1);
-	  in_NB_INST_COMMIT_ALL [context]->write(1);
-	  in_NB_INST_COMMIT_MEM [context]->write(1);
-	  
-	  uint32_t port = rand()%_param->_nb_decod_unit;
-	  
-	  in_DECOD_EVENT_CONTEXT_ID    [port]->write(context);
-	  in_DECOD_EVENT_IS_DELAY_SLOT [port]->write(0);
-	  in_DECOD_EVENT_ADDRESS       [port]->write(0x200);
-	  in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdeadbebe);
-	  if (_param->_have_port_depth)
-          in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
-	  in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_PSYNC);
-	  
-	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
-	  
-	  do
-	    {
-	      in_DECOD_EVENT_VAL [port]->write(rand()%percent_transaction_decod_event);
-	  
-	      SC_START(1);
-	    }
-	  while (not ( in_DECOD_EVENT_VAL [port]->read() and
-		       out_DECOD_EVENT_ACK [port]->read()));
-	  in_DECOD_EVENT_VAL [port]->write(0);
-	  
-	  LABEL("psync (wait end)");
-	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
-	  
-	  SC_START(3);
-	  
-	  in_NB_INST_DECOD_ALL  [context]->write(0);
-	  in_NB_INST_COMMIT_ALL [context]->write(0);
-	  in_NB_INST_COMMIT_MEM [context]->write(0);
-	  
-	  SC_START(1);
-
-	  bool find = false;
-	  do
-	    {
-	      in_EVENT_ACK [context]->write(rand()%percent_transaction_event);
-	  
-	      SC_START(0);
-	  
-	      if (out_EVENT_VAL [context]->read() and in_EVENT_ACK [context]->read())
-	        {
-		  TEST(Taddress_t,out_EVENT_ADDRESS          [context]->read(),0x201);
-		  TEST(Taddress_t,out_EVENT_ADDRESS_NEXT     [context]->read(),0xdeadbebe); 
-		  TEST(Tcontrol_t,out_EVENT_ADDRESS_NEXT_VAL [context]->read(),0);
-		  TEST(Tcontrol_t,out_EVENT_IS_DS_TAKE       [context]->read(),0);
-		  
-		  find = true;
-	        }
-	      
-	      SC_START(1);
-	    }
-	  while (not find);
-
-	  in_EVENT_ACK [context]->write(0);
-	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
-	}
-
-      if (1)
-	{
-	  SC_START(3);
-
-	  LABEL("csync (begin)");
 	  in_NB_INST_DECOD_ALL  [context]->write(1);
 	  in_NB_INST_COMMIT_ALL [context]->write(1);
@@ -410,27 +349,38 @@
 	  if (_param->_have_port_depth)
 	  in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
-	  in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_CSYNC);
-	  
-	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
-	  
-	  do
-	    {
-	      in_DECOD_EVENT_VAL [port]->write(rand()%percent_transaction_decod_event);
-	  
-	      SC_START(1);
-	    }
-	  while (not ( in_DECOD_EVENT_VAL [port]->read() and
-		       out_DECOD_EVENT_ACK [port]->read()));
-	  in_DECOD_EVENT_VAL [port]->write(0);
-	  
-	  LABEL("csync (wait end)");
-	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
-	  
-	  SC_START(3);
-	  
+	  in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_PSYNC);
+	  
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+	  
+          in_DECOD_EVENT_VAL           [port]->write(1);
+
+          SC_START(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+	  TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 0);
+
+          SC_START(1);
+
 	  in_NB_INST_DECOD_ALL  [context]->write(0);
 	  in_NB_INST_COMMIT_ALL [context]->write(0);
 	  in_NB_INST_COMMIT_MEM [context]->write(0);
-	  
+          
+          LABEL("psync (send decod)");
+          SC_START(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+	  TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 1);
+
+	  SC_START(1);
+
+          in_DECOD_EVENT_VAL     [port]->write(0);
+	  in_NB_INST_COMMIT_ALL  [context]->write(1);
+	  
+	  LABEL("psync (wait end)");
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
+	  
+	  SC_START(3);
+	  
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
+	  in_NB_INST_COMMIT_ALL [context]->write(0);
+
 	  SC_START(1);
 
@@ -448,19 +398,21 @@
 		  TEST(Tcontrol_t,out_EVENT_ADDRESS_NEXT_VAL [context]->read(),0);
 		  TEST(Tcontrol_t,out_EVENT_IS_DS_TAKE       [context]->read(),0);
-	  
-		  find = true;
-	        }
-	      
-	      SC_START(1);
-	    }
-	  while (not find);
+		  
+		  find = true;
+	        }
+	      
+	      SC_START(1);
+	    }
+	  while (not find);
+
 	  in_EVENT_ACK [context]->write(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
 	}
 
-      if (1)
+      if (test3)
 	{
 	  SC_START(3);
 	  
-	  LABEL("spr (begin)");
+	  LABEL("csync (begin)");
 	  in_NB_INST_DECOD_ALL  [context]->write(1);
 	  in_NB_INST_COMMIT_ALL [context]->write(1);
@@ -471,6 +423,85 @@
 	  in_DECOD_EVENT_CONTEXT_ID    [port]->write(context);
 	  in_DECOD_EVENT_IS_DELAY_SLOT [port]->write(0);
-	  in_DECOD_EVENT_ADDRESS       [port]->write(0x100);
-	  in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdeadbeef);
+	  in_DECOD_EVENT_ADDRESS       [port]->write(0x300);
+	  in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdead0300);
+	  if (_param->_have_port_depth)
+	  in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
+	  in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_CSYNC);
+	  
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+	  
+          in_DECOD_EVENT_VAL           [port]->write(1);
+
+          SC_START(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+	  TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 0);
+
+          SC_START(1);
+
+	  in_NB_INST_DECOD_ALL  [context]->write(0);
+	  in_NB_INST_COMMIT_ALL [context]->write(0);
+	  in_NB_INST_COMMIT_MEM [context]->write(0);
+          
+          LABEL("csync (send decod)");
+          SC_START(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+	  TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 1);
+
+	  SC_START(1);
+
+          in_DECOD_EVENT_VAL     [port]->write(0);
+	  in_NB_INST_COMMIT_ALL  [context]->write(1);
+	  
+	  LABEL("csync (wait end)");
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
+	  
+	  SC_START(3);
+	  
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
+	  in_NB_INST_COMMIT_ALL [context]->write(0);
+
+	  SC_START(1);
+
+	  bool find = false;
+	  do
+	    {
+	      in_EVENT_ACK [context]->write(rand()%percent_transaction_event);
+	  
+	      SC_START(0);
+	  
+	      if (out_EVENT_VAL [context]->read() and in_EVENT_ACK [context]->read())
+	        {
+		  TEST(Taddress_t,out_EVENT_ADDRESS          [context]->read(),0x301);
+		  TEST(Taddress_t,out_EVENT_ADDRESS_NEXT     [context]->read(),0xdead0300); 
+		  TEST(Tcontrol_t,out_EVENT_ADDRESS_NEXT_VAL [context]->read(),0);
+		  TEST(Tcontrol_t,out_EVENT_IS_DS_TAKE       [context]->read(),0);
+		  
+		  find = true;
+	        }
+	      
+	      SC_START(1);
+	    }
+	  while (not find);
+
+	  in_EVENT_ACK [context]->write(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+
+	}
+
+      if (test4)
+	{
+	  SC_START(3);
+	  
+	  LABEL("spr_access (begin)");
+	  in_NB_INST_DECOD_ALL  [context]->write(1);
+	  in_NB_INST_COMMIT_ALL [context]->write(1);
+	  in_NB_INST_COMMIT_MEM [context]->write(1);
+	  
+	  uint32_t port = rand()%_param->_nb_decod_unit;
+	  
+	  in_DECOD_EVENT_CONTEXT_ID    [port]->write(context);
+	  in_DECOD_EVENT_IS_DELAY_SLOT [port]->write(0);
+	  in_DECOD_EVENT_ADDRESS       [port]->write(0x400);
+	  in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdead0400);
 	  if (_param->_have_port_depth)
 	  in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
@@ -479,46 +510,39 @@
 	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
 	  
-	  do
-	    {
-	      in_DECOD_EVENT_VAL [port]->write(rand()%percent_transaction_decod_event);
-	      
-	      SC_START(1);
-	    }
-	  while (not ( in_DECOD_EVENT_VAL [port]->read() and
-		       out_DECOD_EVENT_ACK [port]->read()));
-	  in_DECOD_EVENT_VAL [port]->write(0);
-	  
-	  LABEL("spr (wait end)");
-	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
-	  
-	  SC_START(3);
-	  
+          in_DECOD_EVENT_VAL           [port]->write(1);
+
+          SC_START(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+	  TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 0);
+
+          SC_START(1);
+
 	  in_NB_INST_DECOD_ALL  [context]->write(0);
 	  in_NB_INST_COMMIT_ALL [context]->write(0);
 	  in_NB_INST_COMMIT_MEM [context]->write(0);
-	  
-	  SC_START(1);
-	  
-	  LABEL("spr (send decod)");
-	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
-	  
-	  SC_START(3);
-	  
-	  in_NB_INST_DECOD_ALL  [context]->write(1);
-	  SC_START(1);
-	  
-	  LABEL("spr (wait end)");
-	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
-	  in_NB_INST_DECOD_ALL  [context]->write(0);
-	  in_NB_INST_COMMIT_ALL [context]->write(1);
-	  
-	  SC_START(3);
-	  
-	  in_NB_INST_COMMIT_ALL [context]->write(0);
+          
+          LABEL("spr_access (send decod)");
+          SC_START(0);
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
+	  TEST(Tcontrol_t, out_DECOD_EVENT_ACK     [port]   ->read(), 1);
+
+	  SC_START(1);
+
+          in_DECOD_EVENT_VAL     [port]->write(0);
+	  in_NB_INST_COMMIT_ALL  [context]->write(1);
+	  
+	  LABEL("spr_access (wait end)");
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
+	  
+	  SC_START(3);
+	  
+	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
+	  in_NB_INST_COMMIT_ALL [context]->write(0);
+
 	  SC_START(1);
 	  TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
 	}
 
-      if (1)
+      if (test5)
 	{
 	  SC_START(3);
@@ -610,5 +634,5 @@
 	}
 
-      if (1)
+      if (test6)
 	{
 	  SC_START(3);
@@ -697,5 +721,5 @@
 	}
 
-      if (1)
+      if (test7)
 	{
 	  SC_START(3);
@@ -791,5 +815,5 @@
 	}
 
-      if (1)
+      if (test8)
 	{
 	  SC_START(3);
@@ -885,5 +909,5 @@
 	}
 
-      if (1)
+      if (test9)
 	{
 	  SC_START(3);
@@ -979,5 +1003,5 @@
 	}
       
-      if (1)
+      if (test10)
 	{
 	  SC_START(3);
@@ -1073,5 +1097,5 @@
 	}
 
-      if (1)
+      if (test11)
 	{
 	  SC_START(3);
@@ -1167,5 +1191,5 @@
 	}
       
-      if (1)
+      if (test12)
 	{
 	  SC_START(3);
