Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/config_min.cfg
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/config_min.cfg	(revision 82)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/config_min.cfg	(revision 82)
@@ -0,0 +1,10 @@
+Update_Prediction_Table
+1	1	+1	# nb_context             
+1	4	*4	# size_queue             [0] [nb_context]
+32	32	*2	# size_address           
+1	1	*4	# nb_inst_predict        
+1	1	*4	# nb_inst_decod          
+1	1	*4	# nb_inst_branch_complete
+1	1	*4	# nb_inst_update         
+0	0	+1	# size_history           
+1	1	*2	# size_ras_index         [0] [nb_context]
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/test.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/test.cpp	(revision 81)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/test.cpp	(revision 82)
@@ -71,7 +71,9 @@
   ALLOC1_SC_SIGNAL( in_DECOD_RAS_ADDRESS              ," in_DECOD_RAS_ADDRESS              ",Taddress_t         ,_param->_nb_inst_decod);
   ALLOC1_SC_SIGNAL( in_DECOD_RAS_INDEX                ," in_DECOD_RAS_INDEX                ",Tptr_t             ,_param->_nb_inst_decod);
-  ALLOC1_SC_SIGNAL( in_DECOD_MISS_PREDICTION          ," in_DECOD_MISS_PREDICTION          ",Tcontrol_t         ,_param->_nb_inst_decod);
+  ALLOC1_SC_SIGNAL( in_DECOD_MISS_IFETCH              ," in_DECOD_MISS_IFETCH              ",Tcontrol_t         ,_param->_nb_inst_decod);
+  ALLOC1_SC_SIGNAL( in_DECOD_MISS_DECOD               ," in_DECOD_MISS_DECOD               ",Tcontrol_t         ,_param->_nb_inst_decod);
   ALLOC1_SC_SIGNAL( in_DECOD_UPDATE_PREDICTION_ID     ," in_DECOD_UPDATE_PREDICTION_ID     ",Tprediction_ptr_t  ,_param->_nb_inst_decod);
 //ALLOC1_SC_SIGNAL(out_DECOD_DEPTH                    ,"out_DECOD_DEPTH                    ",Tdepth_t           ,_param->_nb_inst_decod);
+
   ALLOC1_SC_SIGNAL( in_BRANCH_COMPLETE_VAL            ," in_BRANCH_COMPLETE_VAL            ",Tcontrol_t         ,_param->_nb_inst_branch_complete);
   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ACK            ,"out_BRANCH_COMPLETE_ACK            ",Tcontrol_t         ,_param->_nb_inst_branch_complete);
@@ -84,4 +86,13 @@
   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_SRC    ,"out_BRANCH_COMPLETE_ADDRESS_SRC    ",Taddress_t         ,_param->_nb_inst_branch_complete);
   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_DEST   ,"out_BRANCH_COMPLETE_ADDRESS_DEST   ",Taddress_t         ,_param->_nb_inst_branch_complete);
+
+  ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_VAL            ,"out_BRANCH_EVENT_VAL            ",Tcontrol_t         ,_param->_nb_context);
+  ALLOC1_SC_SIGNAL( in_BRANCH_EVENT_ACK            ," in_BRANCH_EVENT_ACK            ",Tcontrol_t         ,_param->_nb_context);
+//   ALLOC1_SC_SIGNAL( in_BRANCH_EVENT_CONTEXT_ID     ," in_BRANCH_EVENT_CONTEXT_ID     ",Tcontext_t         ,_param->_nb_context);
+//   ALLOC1_SC_SIGNAL( in_BRANCH_EVENT_DEPTH          ," in_BRANCH_EVENT_DEPTH          ",Tdepth_t           ,_param->_nb_context);
+//   ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_MISS_PREDICTION,"out_BRANCH_EVENT_MISS_PREDICTION",Tcontrol_t         ,_param->_nb_context);
+  ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_ADDRESS_SRC    ,"out_BRANCH_EVENT_ADDRESS_SRC    ",Taddress_t         ,_param->_nb_context);
+  ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_ADDRESS_DEST   ,"out_BRANCH_EVENT_ADDRESS_DEST   ",Taddress_t         ,_param->_nb_context);
+
   ALLOC1_SC_SIGNAL(out_UPDATE_VAL                     ,"out_UPDATE_VAL                     ",Tcontrol_t         ,_param->_nb_inst_update);
   ALLOC1_SC_SIGNAL( in_UPDATE_ACK                     ," in_UPDATE_ACK                     ",Tcontrol_t         ,_param->_nb_inst_update);
@@ -96,4 +107,5 @@
   ALLOC1_SC_SIGNAL(out_UPDATE_DIR_HISTORY             ,"out_UPDATE_DIR_HISTORY             ",Thistory_t         ,_param->_nb_inst_update);
   ALLOC1_SC_SIGNAL(out_UPDATE_RAS_VAL                 ,"out_UPDATE_RAS_VAL                 ",Tcontrol_t         ,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL(out_UPDATE_RAS_PUSH                ,"out_UPDATE_RAS_PUSH                ",Tcontrol_t         ,_param->_nb_inst_update);
   ALLOC1_SC_SIGNAL(out_UPDATE_RAS_ADDRESS             ,"out_UPDATE_RAS_ADDRESS             ",Taddress_t         ,_param->_nb_inst_update);
   ALLOC1_SC_SIGNAL(out_UPDATE_RAS_INDEX               ,"out_UPDATE_RAS_INDEX               ",Tptr_t             ,_param->_nb_inst_update);
@@ -136,6 +148,7 @@
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_RAS_ADDRESS              ,_param->_nb_inst_decod);
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_RAS_INDEX                ,_param->_nb_inst_decod);
-  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_MISS_PREDICTION          ,_param->_nb_inst_decod);
-  if (_param->_have_port_depth)
+  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_MISS_IFETCH              ,_param->_nb_inst_decod);
+  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_MISS_DECOD               ,_param->_nb_inst_decod);
+  if (_param->_have_port_max_depth)
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_UPDATE_PREDICTION_ID     ,_param->_nb_inst_decod);
 //if (_param->_have_port_depth)
@@ -145,5 +158,5 @@
   if (_param->_have_port_context_id)
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_COMPLETE_CONTEXT_ID     ,_param->_nb_inst_branch_complete);
-  if (_param->_have_port_depth)
+  if (_param->_have_port_max_depth)
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_COMPLETE_DEPTH          ,_param->_nb_inst_branch_complete);
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_COMPLETE_ADDRESS        ,_param->_nb_inst_branch_complete);
@@ -153,4 +166,16 @@
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_COMPLETE_ADDRESS_SRC    ,_param->_nb_inst_branch_complete);
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_COMPLETE_ADDRESS_DEST   ,_param->_nb_inst_branch_complete);
+
+  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_EVENT_VAL            ,_param->_nb_context);
+  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_EVENT_ACK            ,_param->_nb_context);
+//   if (_param->_have_port_context_id)
+//   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_EVENT_CONTEXT_ID     ,_param->_nb_context);
+//   if (_param->_have_port_max_depth)
+//   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_EVENT_DEPTH          ,_param->_nb_context);
+//   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_EVENT_ADDRESS        ,_param->_nb_context);
+//   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_EVENT_MISS_PREDICTION,_param->_nb_context);
+  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_EVENT_ADDRESS_SRC    ,_param->_nb_context);
+  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_EVENT_ADDRESS_DEST   ,_param->_nb_context);
+
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_VAL                     ,_param->_nb_inst_update);
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_UPDATE_ACK                     ,_param->_nb_inst_update);
@@ -167,11 +192,16 @@
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_DIR_HISTORY             ,_param->_nb_inst_update);
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_VAL                 ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_PUSH                ,_param->_nb_inst_update);
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_ADDRESS             ,_param->_nb_inst_update);
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_INDEX               ,_param->_nb_inst_update);
   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_PREDICTION_IFETCH   ,_param->_nb_inst_update);
-  if (_param->_have_port_depth)
-  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_NB_BRANCH                ,_param->_nb_context);
-  if (_param->_have_port_depth)
-  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_TAIL                     ,_param->_nb_context);
+  for (uint32_t i=0; i<_param->_nb_context; i++)
+    {
+      if (_param->_have_port_depth[i])
+	{
+	  INSTANCE_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_TAIL      [i]);
+	}
+      INSTANCE_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_NB_BRANCH [i]);
+    }
 
   msg(_("<%s> : Start Simulation ............\n"),name.c_str());
@@ -202,4 +232,9 @@
   SC_START(5);
   in_NRESET->write(1);  
+
+  for (uint32_t i=0; i<_param->_nb_context; i++)
+    {
+      PORT_WRITE(in_BRANCH_EVENT_ACK [i],1);
+    }
 
   LABEL("Loop of Test");
@@ -236,9 +271,10 @@
 		  in_PREDICT_RAS_INDEX        [port]->write((0x12345678+i)%_param->_size_ras_index[context]);
 		  
-		  if (_param->_have_port_depth)
+		  if (_param->_have_port_depth[context])
 		    {
 		      TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		    }
 		      TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), i);
-		    }
+		      
 		  SC_START(0);
 		  
@@ -256,9 +292,10 @@
 	      in_PREDICT_VAL              [port]->write(0);
 	      
-	      if (_param->_have_port_depth)
+	      if (_param->_have_port_depth[context])
 		{
 		  TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		}
 		  TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), i+1);
-		}
+
 	    }
 	}
@@ -283,12 +320,13 @@
 		  in_DECOD_RAS_ADDRESS          [port]->write(0xdeaddead+i);
 		  in_DECOD_RAS_INDEX            [port]->write((0x12345678+i)%_param->_size_ras_index[context]);
-		  in_DECOD_MISS_PREDICTION      [port]->write(false);
+		  in_DECOD_MISS_IFETCH          [port]->write(false);
+		  in_DECOD_MISS_DECOD           [port]->write(false);
 		  in_DECOD_UPDATE_PREDICTION_ID [port]->write(i);
 		  
-		  if (_param->_have_port_depth)
+		  if (_param->_have_port_depth[context])
 		    {
 		      TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		    }
 		      TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]);
-		    }
 		  
 		  SC_START(0);
@@ -307,9 +345,9 @@
 	      in_DECOD_VAL              [port]->write(0);
 	      
-	      if (_param->_have_port_depth)
+	      if (_param->_have_port_depth[context])
 		{
 		  TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		}
 		  TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]);
-		}
 	    }
 	}
@@ -331,9 +369,9 @@
 		  in_BRANCH_COMPLETE_FLAG                 [port]->write(1);
 		  
-		  if (_param->_have_port_depth)
+		  if (_param->_have_port_depth[context])
 		    {
 		      TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		    }
 		      TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]);
-		    }
 		  
 		  SC_START(0);
@@ -357,9 +395,9 @@
 	      in_BRANCH_COMPLETE_VAL              [port]->write(0);
 	      
-	      if (_param->_have_port_depth)
+	      if (_param->_have_port_depth[context])
 		{
 		  TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		}
 		  TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]);
-		}
 	    }
 	}
@@ -396,4 +434,5 @@
 			TEST(Thistory_t         ,out_UPDATE_DIR_HISTORY           [port]->read(), i);
 		      TEST(Tcontrol_t         ,out_UPDATE_RAS_VAL               [port]->read(), 0);
+		      TEST(Tcontrol_t         ,out_UPDATE_RAS_PUSH              [port]->read(), 0);
 		      TEST(Taddress_t         ,out_UPDATE_RAS_ADDRESS           [port]->read(), 0xdeaddead+i);
 		      TEST(Tptr_t             ,out_UPDATE_RAS_INDEX             [port]->read(), (0x12345678+i)%_param->_size_ras_index[context]);
@@ -411,11 +450,10 @@
   
 	  // wait the garbage collector
-	  if (_param->_have_port_depth)
-	    while ((out_DEPTH_TAIL     [context]->read() != 0) and
-		   (out_DEPTH_NB_BRANCH[context]->read() != 0))
-	      {
-		LABEL("DEPTH [%d] nb_branch : %d - tail : %d",context,out_DEPTH_NB_BRANCH[context]->read(), out_DEPTH_TAIL [context]->read());
-		SC_START(1);
-	      }
+	  while ((not (_param->_have_port_depth[context]) or (out_DEPTH_TAIL     [context]->read() != 0)) and
+		 (out_DEPTH_NB_BRANCH[context]->read() != 0))
+	    {
+	      LABEL("DEPTH [%d] nb_branch : %d - tail : %d",context,out_DEPTH_NB_BRANCH[context]->read(), out_DEPTH_TAIL [context]->read());
+	      SC_START(1);
+	    }
 	}
       }
@@ -448,9 +486,10 @@
 		  in_PREDICT_RAS_INDEX        [port]->write((0x12345678+i)%_param->_size_ras_index[context]);
 		  
-		  if (_param->_have_port_depth)
+		  if (_param->_have_port_depth[context])
 		    {
 		      TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		    }
 		      TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), i);
-		    }
+
 		  SC_START(0);
 		  
@@ -468,9 +507,9 @@
 	      in_PREDICT_VAL              [port]->write(0);
 	      
-	      if (_param->_have_port_depth)
+	      if (_param->_have_port_depth[context])
 		{
 		  TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		}
 		  TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), i+1);
-		}
 	    }
 	}
@@ -495,12 +534,13 @@
 		  in_DECOD_RAS_ADDRESS          [port]->write(0xdeaddead+i);
 		  in_DECOD_RAS_INDEX            [port]->write((0x12345678+i)%_param->_size_ras_index[context]);
-		  in_DECOD_MISS_PREDICTION      [port]->write(false);
+		  in_DECOD_MISS_IFETCH          [port]->write(false);
+		  in_DECOD_MISS_DECOD           [port]->write(false);
 		  in_DECOD_UPDATE_PREDICTION_ID [port]->write(i);
 		  
-		  if (_param->_have_port_depth)
+		  if (_param->_have_port_depth[context])
 		    {
 		      TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		    }
 		      TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]);
-		    }
 		  
 		  SC_START(0);
@@ -519,9 +559,9 @@
 	      in_DECOD_VAL              [port]->write(0);
 	      
-	      if (_param->_have_port_depth)
+	      if (_param->_have_port_depth[context])
 		{
 		  TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		}
 		  TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]);
-		}
 	    }
 	}
@@ -543,9 +583,9 @@
 		  in_BRANCH_COMPLETE_FLAG                 [port]->write(0);
 		  
-		  if (_param->_have_port_depth)
+		  if (_param->_have_port_depth[context])
 		    {
 		      TEST(Tdepth_t,out_DEPTH_TAIL     [context]->read(), 0);
+		    }
 		      TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]);
-		    }
 		  
 		  SC_START(0);
@@ -604,4 +644,5 @@
 			TEST(Thistory_t         ,out_UPDATE_DIR_HISTORY           [port]->read(), i);
 		      TEST(Tcontrol_t         ,out_UPDATE_RAS_VAL               [port]->read(), 0);
+		      TEST(Tcontrol_t         ,out_UPDATE_RAS_PUSH              [port]->read(), 0);
 		      TEST(Taddress_t         ,out_UPDATE_RAS_ADDRESS           [port]->read(), 0xdeaddead+i);
 		      TEST(Tptr_t             ,out_UPDATE_RAS_INDEX             [port]->read(), (0x12345678+i)%_param->_size_ras_index[context]);
@@ -619,7 +660,6 @@
 	    
 	    // wait the garbage collector
-	    if (_param->_have_port_depth)
-	      while ((out_DEPTH_TAIL     [context]->read() != 0) and
-		     (out_DEPTH_NB_BRANCH[context]->read() != 0))
+	    while (((not (_param->_have_port_depth[context])) or (out_DEPTH_TAIL     [context]->read() != 0)) and
+		   (out_DEPTH_NB_BRANCH[context]->read() != 0))
 		{
 		  LABEL("DEPTH [%d] nb_branch : %d - tail : %d",context,out_DEPTH_NB_BRANCH[context]->read(), out_DEPTH_TAIL [context]->read());
@@ -671,5 +711,6 @@
   delete []  in_DECOD_RAS_ADDRESS           ;
   delete []  in_DECOD_RAS_INDEX             ;
-  delete []  in_DECOD_MISS_PREDICTION       ;
+  delete []  in_DECOD_MISS_IFETCH           ;
+  delete []  in_DECOD_MISS_DECOD            ;
   delete []  in_DECOD_UPDATE_PREDICTION_ID  ;
 //delete [] out_DECOD_DEPTH                 ;
@@ -686,4 +727,13 @@
   delete [] out_BRANCH_COMPLETE_ADDRESS_SRC    ;
   delete [] out_BRANCH_COMPLETE_ADDRESS_DEST   ;
+
+  // ~~~~~[ Interface : "branch_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  delete [] out_BRANCH_EVENT_VAL            ;
+  delete []  in_BRANCH_EVENT_ACK            ;
+//   delete []  in_BRANCH_EVENT_CONTEXT_ID     ;
+//   delete []  in_BRANCH_EVENT_DEPTH          ;
+//   delete [] out_BRANCH_EVENT_MISS_PREDICTION;
+  delete [] out_BRANCH_EVENT_ADDRESS_SRC    ;
+  delete [] out_BRANCH_EVENT_ADDRESS_DEST   ;
   
   // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -700,4 +750,5 @@
   delete [] out_UPDATE_DIR_HISTORY          ;
   delete [] out_UPDATE_RAS_VAL              ;
+  delete [] out_UPDATE_RAS_PUSH             ;
   delete [] out_UPDATE_RAS_ADDRESS          ;
   delete [] out_UPDATE_RAS_INDEX            ;
