Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/config_meta_predictor.cfg
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/config_meta_predictor.cfg	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/config_meta_predictor.cfg	(revision 111)
@@ -0,0 +1,10 @@
+Meta_Predictor_Glue
+4       4       +1 # nb_inst_predict
+4       4       +1 # nb_inst_update
+3	3	+1 # nb_predictor                   
+8	8	+1 # predictor_size_history         [0] [nb_predictor]
+17	17	+1 # predictor_size_history         [1] [nb_predictor]
+4	4	+1 # predictor_size_history         [2] [nb_predictor]
+1	1	+1 # predictor_update_on_prediction [0] [nb_predictor]
+1	1	+1 # predictor_update_on_prediction [1] [nb_predictor]
+0	0	+1 # predictor_update_on_prediction [2] [nb_predictor]
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/config_two_level.cfg
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/config_two_level.cfg	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/config_two_level.cfg	(revision 111)
@@ -0,0 +1,6 @@
+Meta_Predictor_Glue
+4       4       +1 # nb_inst_predict
+4       4       +1 # nb_inst_update
+1	1	+1 # nb_predictor                   
+16	16	+1 # predictor_size_history         [0] [nb_predictor]
+1	1	+1 # predictor_update_on_prediction [0] [nb_predictor]
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/configuration.cfg
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/configuration.cfg	(revision 110)
+++ 	(revision )
@@ -1,1 +1,0 @@
-Meta_Predictor_Glue
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/main.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/main.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/main.cpp	(revision 111)
@@ -7,6 +7,7 @@
 
 #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/include/test.h"
+#include "Behavioural/include/Selftest.h"
 
-#define NB_PARAMS 0
+#define NB_PARAMS 3
 
 void usage (int argc, char * argv[])
@@ -14,5 +15,9 @@
   err (_("<Usage> %s name_instance list_params.\n"),argv[0]);
   err (_("list_params is :\n"));
-  err (_(" *  ()\n"));
+  err (_(" * nb_inst_predict                               (uint32_t)\n"));
+  err (_(" * nb_inst_update                                (uint32_t)\n"));
+  err (_(" * nb_predictor                                  (uint32_t)\n"));
+  err (_(" * predictor_size_history         [nb_predictor] (uint32_t)\n"));
+  err (_(" * predictor_update_on_prediction [nb_predictor] (bool    )\n"));
 
   exit (1);
@@ -25,5 +30,5 @@
 #endif
 {
-  if (argc != static_cast<int>(2+NB_PARAMS))
+  if (argc <= static_cast<int>(2+NB_PARAMS))
     usage (argc, argv);
 
@@ -32,4 +37,20 @@
   string name = argv[x++];
 
+  uint32_t   _nb_inst_predict               ;
+  uint32_t   _nb_inst_update                ;
+  uint32_t   _nb_predictor                  ;
+  uint32_t * _predictor_size_history        ;//[nb_predictor]
+  bool     * _predictor_update_on_prediction;//[nb_predictor]
+
+  SELFTEST0(_nb_inst_predict               ,uint32_t,argv,x);
+  SELFTEST0(_nb_inst_update                ,uint32_t,argv,x);
+  SELFTEST0(_nb_predictor                  ,uint32_t,argv,x);
+
+  if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_predictor))
+    usage (argc, argv);
+
+  SELFTEST1(_predictor_size_history        ,uint32_t,argv,x,_nb_predictor);
+  SELFTEST1(_predictor_update_on_prediction,bool    ,argv,x,_nb_predictor);
+ 
   int _return = EXIT_SUCCESS;
   try 
@@ -37,4 +58,9 @@
       morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue::Parameters
 	(
+         _nb_inst_predict               ,
+         _nb_inst_update                ,
+         _nb_predictor                  ,
+         _predictor_size_history        ,
+         _predictor_update_on_prediction,
          true //is_toplevel
         );
@@ -63,4 +89,7 @@
     }
 
+  DELETE1(_predictor_update_on_prediction,_param->_nb_predictor);
+  DELETE1(_predictor_size_history        ,_param->_nb_predictor);
+
   return (_return);
 }
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/test.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/test.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/test.cpp	(revision 111)
@@ -51,4 +51,24 @@
   sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
   
+  ALLOC1_SC_SIGNAL( in_PREDICT_VAL                    ," in_PREDICT_VAL                    ",Tcontrol_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL(out_PREDICT_ACK                    ,"out_PREDICT_ACK                    ",Tcontrol_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL(out_PREDICT_HISTORY                ,"out_PREDICT_HISTORY                ",Thistory_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL(out_PREDICT_DIRECTION              ,"out_PREDICT_DIRECTION              ",Tcontrol_t,_param->_nb_inst_predict);
+  ALLOC2_SC_SIGNAL(out_PREDICT_PREDICTOR_VAL          ,"out_PREDICT_PREDICTOR_VAL          ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_predict);
+  ALLOC2_SC_SIGNAL( in_PREDICT_PREDICTOR_ACK          ," in_PREDICT_PREDICTOR_ACK          ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_predict);
+  ALLOC2_SC_SIGNAL( in_PREDICT_PREDICTOR_HISTORY      ," in_PREDICT_PREDICTOR_HISTORY      ",Thistory_t,_param->_nb_predictor,_param->_nb_inst_predict);
+  ALLOC2_SC_SIGNAL( in_PREDICT_PREDICTOR_DIRECTION    ," in_PREDICT_PREDICTOR_DIRECTION    ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_predict);
+  ALLOC2_SC_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION_VAL,"out_PREDICT_PREDICTOR_DIRECTION_VAL",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_predict); // if update_on_prediction
+  ALLOC2_SC_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION    ,"out_PREDICT_PREDICTOR_DIRECTION    ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_predict); // if update_on_prediction
+  ALLOC1_SC_SIGNAL( in_UPDATE_VAL                     ," in_UPDATE_VAL                     ",Tcontrol_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL(out_UPDATE_ACK                     ,"out_UPDATE_ACK                     ",Tcontrol_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL( in_UPDATE_HISTORY                 ," in_UPDATE_HISTORY                 ",Thistory_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL( in_UPDATE_DIRECTION               ," in_UPDATE_DIRECTION               ",Tcontrol_t,_param->_nb_inst_update);
+  ALLOC2_SC_SIGNAL(out_UPDATE_PREDICTOR_VAL           ,"out_UPDATE_PREDICTOR_VAL           ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_update);
+  ALLOC2_SC_SIGNAL( in_UPDATE_PREDICTOR_ACK           ," in_UPDATE_PREDICTOR_ACK           ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_update);
+  ALLOC2_SC_SIGNAL(out_UPDATE_PREDICTOR_HISTORY       ,"out_UPDATE_PREDICTOR_HISTORY       ",Thistory_t,_param->_nb_predictor,_param->_nb_inst_update);
+  ALLOC2_SC_SIGNAL(out_UPDATE_PREDICTOR_DIRECTION     ,"out_UPDATE_PREDICTOR_DIRECTION     ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_update);
+  ALLOC2_SC_SIGNAL(out_UPDATE_PREDICTOR_MISS          ,"out_UPDATE_PREDICTOR_MISS          ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_update);
+
   /********************************************************
    * Instanciation
@@ -60,4 +80,33 @@
   (*(_Meta_Predictor_Glue->in_NRESET))       (*(in_NRESET));
 
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue, in_PREDICT_VAL                    ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_ACK                    ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_HISTORY                ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_DIRECTION              ,_param->_nb_inst_predict);
+
+  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_PREDICTOR_VAL          ,_param->_nb_predictor,_param->_nb_inst_predict);
+  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue, in_PREDICT_PREDICTOR_ACK          ,_param->_nb_predictor,_param->_nb_inst_predict);
+  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue, in_PREDICT_PREDICTOR_HISTORY      ,_param->_nb_predictor,_param->_nb_inst_predict);
+  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue, in_PREDICT_PREDICTOR_DIRECTION    ,_param->_nb_predictor,_param->_nb_inst_predict);
+  
+  for (uint32_t i=0; i<_param->_nb_predictor; ++i)
+    if (_param->_predictor_update_on_prediction [i])
+      {
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_PREDICTOR_DIRECTION_VAL[i],_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_PREDICTOR_DIRECTION    [i],_param->_nb_inst_predict);
+      }
+
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue, in_UPDATE_VAL                     ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_UPDATE_ACK                     ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue, in_UPDATE_HISTORY                 ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue, in_UPDATE_DIRECTION               ,_param->_nb_inst_update);
+
+  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue,out_UPDATE_PREDICTOR_VAL           ,_param->_nb_predictor,_param->_nb_inst_update);
+  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue, in_UPDATE_PREDICTOR_ACK           ,_param->_nb_predictor,_param->_nb_inst_update);
+  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue,out_UPDATE_PREDICTOR_HISTORY       ,_param->_nb_predictor,_param->_nb_inst_update);
+  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue,out_UPDATE_PREDICTOR_DIRECTION     ,_param->_nb_predictor,_param->_nb_inst_update);
+  for (uint32_t i=0; i<_param->_nb_predictor; ++i)
+    if (_param->_predictor_update_on_prediction [i])
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_UPDATE_PREDICTOR_MISS [i]                            ,_param->_nb_inst_update);
 
   msg(_("<%s> : Start Simulation ............\n"),name.c_str());
@@ -104,4 +153,27 @@
   delete in_CLOCK;
   delete in_NRESET;
+
+  DELETE1_SC_SIGNAL( in_PREDICT_VAL                    ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL(out_PREDICT_ACK                    ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL(out_PREDICT_HISTORY                ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL(out_PREDICT_DIRECTION              ,_param->_nb_inst_predict);
+
+  DELETE2_SC_SIGNAL(out_PREDICT_PREDICTOR_VAL          ,_param->_nb_predictor,_param->_nb_inst_predict);
+  DELETE2_SC_SIGNAL( in_PREDICT_PREDICTOR_ACK          ,_param->_nb_predictor,_param->_nb_inst_predict);
+  DELETE2_SC_SIGNAL( in_PREDICT_PREDICTOR_HISTORY      ,_param->_nb_predictor,_param->_nb_inst_predict);
+  DELETE2_SC_SIGNAL( in_PREDICT_PREDICTOR_DIRECTION    ,_param->_nb_predictor,_param->_nb_inst_predict);
+  DELETE2_SC_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION_VAL,_param->_nb_predictor,_param->_nb_inst_predict);
+  DELETE2_SC_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION    ,_param->_nb_predictor,_param->_nb_inst_predict);
+
+  DELETE1_SC_SIGNAL( in_UPDATE_VAL                     ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL(out_UPDATE_ACK                     ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL( in_UPDATE_HISTORY                 ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL( in_UPDATE_DIRECTION               ,_param->_nb_inst_update);
+
+  DELETE2_SC_SIGNAL(out_UPDATE_PREDICTOR_VAL           ,_param->_nb_predictor,_param->_nb_inst_update);
+  DELETE2_SC_SIGNAL( in_UPDATE_PREDICTOR_ACK           ,_param->_nb_predictor,_param->_nb_inst_update);
+  DELETE2_SC_SIGNAL(out_UPDATE_PREDICTOR_HISTORY       ,_param->_nb_predictor,_param->_nb_inst_update);
+  DELETE2_SC_SIGNAL(out_UPDATE_PREDICTOR_DIRECTION     ,_param->_nb_predictor,_param->_nb_inst_update);
+  DELETE2_SC_SIGNAL(out_UPDATE_PREDICTOR_MISS          ,_param->_nb_predictor,_param->_nb_inst_update);
     }
 #endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h	(revision 111)
@@ -66,4 +66,29 @@
   public    : SC_IN (Tcontrol_t)            *  in_NRESET       ;
 
+    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  public    : SC_IN (Tcontrol_t)           **  in_PREDICT_VAL                    ;//              [nb_inst_predict]
+  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_ACK                    ;//              [nb_inst_predict]
+  public    : SC_OUT(Thistory_t)           ** out_PREDICT_HISTORY                ;//              [nb_inst_predict]
+  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_DIRECTION              ;//              [nb_inst_predict]
+
+  public    : SC_OUT(Tcontrol_t)          *** out_PREDICT_PREDICTOR_VAL          ;//[nb_predictor][nb_inst_predict]
+  public    : SC_IN (Tcontrol_t)          ***  in_PREDICT_PREDICTOR_ACK          ;//[nb_predictor][nb_inst_predict]
+  public    : SC_IN (Thistory_t)          ***  in_PREDICT_PREDICTOR_HISTORY      ;//[nb_predictor][nb_inst_predict]
+  public    : SC_IN (Tcontrol_t)          ***  in_PREDICT_PREDICTOR_DIRECTION    ;//[nb_predictor][nb_inst_predict]
+  public    : SC_OUT(Tcontrol_t)          *** out_PREDICT_PREDICTOR_DIRECTION_VAL;//[nb_predictor][nb_inst_predict] // if update_on_prediction
+  public    : SC_OUT(Tcontrol_t)          *** out_PREDICT_PREDICTOR_DIRECTION    ;//[nb_predictor][nb_inst_predict] // if update_on_prediction
+
+    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_VAL                     ;//              [nb_inst_update]
+  public    : SC_OUT(Tcontrol_t)           ** out_UPDATE_ACK                     ;//              [nb_inst_update]
+  public    : SC_IN (Thistory_t)           **  in_UPDATE_HISTORY                 ;//              [nb_inst_update]
+  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_DIRECTION               ;//              [nb_inst_update]
+
+  public    : SC_OUT(Tcontrol_t)          *** out_UPDATE_PREDICTOR_VAL           ;//[nb_predictor][nb_inst_update]
+  public    : SC_IN (Tcontrol_t)          ***  in_UPDATE_PREDICTOR_ACK           ;//[nb_predictor][nb_inst_update]
+  public    : SC_OUT(Thistory_t)          *** out_UPDATE_PREDICTOR_HISTORY       ;//[nb_predictor][nb_inst_update]
+  public    : SC_OUT(Tcontrol_t)          *** out_UPDATE_PREDICTOR_DIRECTION     ;//[nb_predictor][nb_inst_update]
+  public    : SC_OUT(Tcontrol_t)          *** out_UPDATE_PREDICTOR_MISS          ;//[nb_predictor][nb_inst_update] // if update_on_prediction
+
     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
 
@@ -105,4 +130,10 @@
   public  : void        transition                (void);
 //public  : void        genMoore                  (void);
+
+  public  : void        genMealy_predict_valack   (void);
+  public  : void        genMealy_predict          (void);
+
+  public  : void        genMealy_update_valack    (void);
+  public  : void        genMealy_update           (void);
 #endif					       
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Parameters.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Parameters.h	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Parameters.h	(revision 111)
@@ -11,4 +11,5 @@
 #include "Behavioural/include/Parameters.h"
 #include "Common/include/Debug.h"
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Types.h"
 
 namespace morpheo {
@@ -26,7 +27,23 @@
   {
     //-----[ fields ]------------------------------------------------------------
+  public : uint32_t     _nb_inst_predict               ;
+  public : uint32_t     _nb_inst_update                ;
+  public : uint32_t     _nb_predictor                  ;
+  public : uint32_t   * _predictor_size_history        ;//[nb_predictor]
+  public : bool       * _predictor_update_on_prediction;//[nb_predictor]
+                      
+  public : uint32_t     _size_history                  ;
+  public : uint32_t   * _predictor_history_shift       ;//[nb_predictor]
+  public : uint32_t   * _predictor_history_shift_msb   ;//[nb_predictor]
+  public : Thistory_t * _predictor_history_mask        ;//[nb_predictor]    
+
 
     //-----[ methods ]-----------------------------------------------------------
-  public : Parameters  (bool is_toplevel=false);
+  public : Parameters  (uint32_t   nb_inst_predict               ,
+			uint32_t   nb_inst_update                ,
+                        uint32_t   nb_predictor                  ,
+                        uint32_t * predictor_size_history        ,//[nb_predictor]
+                        bool     * predictor_update_on_prediction,//[nb_predictor]
+                        bool       is_toplevel=false);
 //public : Parameters  (Parameters & param) ;
   public : ~Parameters (void);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue.cpp	(revision 111)
@@ -82,13 +82,60 @@
 # endif    
 
-// 	log_printf(INFO,Meta_Predictor_Glue,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str());
+	log_printf(INFO,Meta_Predictor_Glue,FUNCTION,_("<%s> : Method - genMealy_update_valack"),_name.c_str());
 
-// 	SC_METHOD (genMoore);
-// 	dont_initialize ();
-// 	sensitive << (*(in_CLOCK)).neg(); // need internal register
-	
-// # ifdef SYSTEMCASS_SPECIFIC
-// 	// List dependency information
-// # endif    
+	SC_METHOD (genMealy_update_valack);
+	dont_initialize ();
+// 	sensitive << (*(in_CLOCK)).neg(); // don't need internal register
+        for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
+          {
+            sensitive << (*(in_UPDATE_VAL [i]));
+
+            for (uint32_t j=0; j<_param->_nb_predictor; ++j)
+              sensitive << (*(in_UPDATE_PREDICTOR_ACK [j][i]));
+          }
+
+	log_printf(INFO,Meta_Predictor_Glue,FUNCTION,_("<%s> : Method - genMealy_update"),_name.c_str());
+
+	SC_METHOD (genMealy_update);
+	dont_initialize ();
+// 	sensitive << (*(in_CLOCK)).neg(); // don't need internal register
+        for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
+          sensitive << (*(in_UPDATE_HISTORY   [i]))
+                    << (*(in_UPDATE_DIRECTION [i]));
+
+# ifdef SYSTEMCASS_SPECIFIC
+	// List dependency information
+# endif    
+
+	log_printf(INFO,Meta_Predictor_Glue,FUNCTION,_("<%s> : Method - genMealy_predict_valack"),_name.c_str());
+
+	SC_METHOD (genMealy_predict_valack);
+	dont_initialize ();
+// 	sensitive << (*(in_CLOCK)).neg(); // don't need internal register
+        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
+          {
+            sensitive << (*(in_PREDICT_VAL [i]));
+
+            for (uint32_t j=0; j<_param->_nb_predictor; ++j)
+              sensitive << (*(in_PREDICT_PREDICTOR_ACK [j][i]));
+          }
+
+# ifdef SYSTEMCASS_SPECIFIC
+	// List dependency information
+# endif    
+
+	log_printf(INFO,Meta_Predictor_Glue,FUNCTION,_("<%s> : Method - genMealy_predict"),_name.c_str());
+
+	SC_METHOD (genMealy_predict);
+	dont_initialize ();
+// 	sensitive << (*(in_CLOCK)).neg(); // don't need internal register
+        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
+          for (uint32_t j=0; j<_param->_nb_predictor; ++j)
+            sensitive << (*(in_PREDICT_PREDICTOR_HISTORY   [j][i]))
+                      << (*(in_PREDICT_PREDICTOR_DIRECTION [j][i]));
+
+# ifdef SYSTEMCASS_SPECIFIC
+	// List dependency information
+# endif    
 	
 #endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_allocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_allocation.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_allocation.cpp	(revision 111)
@@ -58,4 +58,45 @@
       in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
     }
+
+    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    {
+      ALLOC1_INTERFACE("predict",IN,NORTH,_("Predict next address"),_param->_nb_inst_predict);
+
+      ALLOC1_SIGNAL_IN ( in_PREDICT_VAL                    ,"VAL"          ,Tcontrol_t,1);
+      ALLOC1_SIGNAL_OUT(out_PREDICT_ACK                    ,"ACK"          ,Tcontrol_t,1);
+      ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY                ,"HISTORY"      ,Thistory_t,_param->_size_history);
+      ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION              ,"DIRECTION"    ,Tcontrol_t,1);
+    }
+
+    {
+      ALLOC2_INTERFACE("predict_predictor",IN,NORTH,_("Predict next address"),_param->_nb_predictor,_param->_nb_inst_predict);
+      
+      ALLOC2_SIGNAL_OUT(out_PREDICT_PREDICTOR_VAL          ,"VAL"          ,Tcontrol_t,1);
+      ALLOC2_SIGNAL_IN ( in_PREDICT_PREDICTOR_ACK          ,"ACK"          ,Tcontrol_t,1);
+      ALLOC2_SIGNAL_IN ( in_PREDICT_PREDICTOR_HISTORY      ,"HISTORY"      ,Thistory_t,_param->_predictor_size_history[it1]);
+      ALLOC2_SIGNAL_IN ( in_PREDICT_PREDICTOR_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1);
+      ALLOC2_SIGNAL_OUT(out_PREDICT_PREDICTOR_DIRECTION_VAL,"DIRECTION_VAL",Tcontrol_t,(_param->_predictor_update_on_prediction [it1])?1:0);
+      ALLOC2_SIGNAL_OUT(out_PREDICT_PREDICTOR_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,(_param->_predictor_update_on_prediction [it1])?1:0);
+    }
+
+    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    {
+      ALLOC1_INTERFACE("update",IN,NORTH,_("Update predictor"),_param->_nb_inst_update);
+      
+      ALLOC1_SIGNAL_IN ( in_UPDATE_VAL                     ,"VAL"          ,Tcontrol_t,1);
+      ALLOC1_SIGNAL_OUT(out_UPDATE_ACK                     ,"ACK"          ,Tcontrol_t,1);
+      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY                 ,"HISTORY"      ,Thistory_t,_param->_size_history);
+      ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION               ,"DIRECTION"    ,Tcontrol_t,1);
+    }
+    {
+      ALLOC2_INTERFACE("update_predictor",IN,NORTH,_("Update predictor"),_param->_nb_predictor,_param->_nb_inst_update);
+      
+      ALLOC2_SIGNAL_OUT(out_UPDATE_PREDICTOR_VAL           ,"VAL"          ,Tcontrol_t,1);
+      ALLOC2_SIGNAL_IN ( in_UPDATE_PREDICTOR_ACK           ,"ACK"          ,Tcontrol_t,1);
+      ALLOC2_SIGNAL_OUT(out_UPDATE_PREDICTOR_HISTORY       ,"HISTORY"      ,Thistory_t,_param->_predictor_size_history[it1]);
+      ALLOC2_SIGNAL_OUT(out_UPDATE_PREDICTOR_DIRECTION     ,"DIRECTION"    ,Tcontrol_t,1);
+      ALLOC2_SIGNAL_OUT(out_UPDATE_PREDICTOR_MISS          ,"MISS"         ,Tcontrol_t,(_param->_predictor_update_on_prediction [it1])?1:0);
+    }
+
     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_deallocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_deallocation.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_deallocation.cpp	(revision 111)
@@ -30,7 +30,31 @@
 	delete    in_CLOCK ;
 	delete    in_NRESET;
+
+        DELETE1_SIGNAL( in_PREDICT_VAL                    ,_param->_nb_inst_predict,1);
+        DELETE1_SIGNAL(out_PREDICT_ACK                    ,_param->_nb_inst_predict,1);
+        DELETE1_SIGNAL(out_PREDICT_HISTORY                ,_param->_nb_inst_predict,_param->_size_history);
+        DELETE1_SIGNAL(out_PREDICT_DIRECTION              ,_param->_nb_inst_predict,1);
+
+        DELETE2_SIGNAL(out_PREDICT_PREDICTOR_VAL          ,_param->_nb_predictor,_param->_nb_inst_predict,1);
+        DELETE2_SIGNAL( in_PREDICT_PREDICTOR_ACK          ,_param->_nb_predictor,_param->_nb_inst_predict,1);
+        DELETE2_SIGNAL( in_PREDICT_PREDICTOR_HISTORY      ,_param->_nb_predictor,_param->_nb_inst_predict,_param->_predictor_size_history[it1]);
+        DELETE2_SIGNAL( in_PREDICT_PREDICTOR_DIRECTION    ,_param->_nb_predictor,_param->_nb_inst_predict,1);
+        DELETE2_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION_VAL,_param->_nb_predictor,_param->_nb_inst_predict,(_param->_predictor_update_on_prediction [it1])?1:0);
+        DELETE2_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION    ,_param->_nb_predictor,_param->_nb_inst_predict,(_param->_predictor_update_on_prediction [it1])?1:0);
+
+        DELETE1_SIGNAL( in_UPDATE_VAL                     ,_param->_nb_inst_update,1);
+        DELETE1_SIGNAL(out_UPDATE_ACK                     ,_param->_nb_inst_update,1);
+        DELETE1_SIGNAL( in_UPDATE_HISTORY                 ,_param->_nb_inst_update,_param->_size_history);
+        DELETE1_SIGNAL( in_UPDATE_DIRECTION               ,_param->_nb_inst_update,1);
+
+        DELETE2_SIGNAL(out_UPDATE_PREDICTOR_VAL           ,_param->_nb_predictor,_param->_nb_inst_update,1);
+        DELETE2_SIGNAL( in_UPDATE_PREDICTOR_ACK           ,_param->_nb_predictor,_param->_nb_inst_update,1);
+        DELETE2_SIGNAL(out_UPDATE_PREDICTOR_HISTORY       ,_param->_nb_predictor,_param->_nb_inst_update,_param->_predictor_size_history[it1]);
+        DELETE2_SIGNAL(out_UPDATE_PREDICTOR_DIRECTION     ,_param->_nb_predictor,_param->_nb_inst_update,1);
+        DELETE2_SIGNAL(out_UPDATE_PREDICTOR_MISS          ,_param->_nb_predictor,_param->_nb_inst_update,(_param->_predictor_update_on_prediction [it1])?1:0);
       }
+
     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
-
+    
     delete _component;
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_predict.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_predict.cpp	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_predict.cpp	(revision 111)
@@ -0,0 +1,105 @@
+#ifdef SYSTEMC
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h"
+
+namespace morpheo                    {
+namespace behavioural {
+namespace core {
+namespace multi_front_end {
+namespace front_end {
+namespace prediction_unit {
+namespace direction {
+namespace meta_predictor {
+namespace meta_predictor_glue {
+
+
+#undef  FUNCTION
+#define FUNCTION "Meta_Predictor_Glue::genMealy_predict"
+  void Meta_Predictor_Glue::genMealy_predict (void)
+  {
+    log_begin(Meta_Predictor_Glue,FUNCTION);
+    log_function(Meta_Predictor_Glue,FUNCTION,_name.c_str());
+
+    for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
+      {
+        Thistory_t history  ;
+        Tcontrol_t direction;
+
+        switch (_param->_nb_predictor)
+          {
+          case 1 :
+            {
+              history   = PORT_READ(in_PREDICT_PREDICTOR_HISTORY   [0][i]);
+              direction = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [0][i]);
+
+              if (_param->_predictor_update_on_prediction [0])
+                {
+                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [0][i],true     );
+                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION     [0][i],direction);
+                }
+              break;
+            }
+          case 3 :
+            {
+              Thistory_t history_0   = PORT_READ(in_PREDICT_PREDICTOR_HISTORY   [0][i]);
+              Thistory_t history_1   = PORT_READ(in_PREDICT_PREDICTOR_HISTORY   [1][i]);
+              Thistory_t history_2   = PORT_READ(in_PREDICT_PREDICTOR_HISTORY   [2][i]);
+              Tcontrol_t direction_0 = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [0][i]);
+              Tcontrol_t direction_1 = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [1][i]);
+              Tcontrol_t direction_2 = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [2][i]);
+
+              history   = ((history_0 <<_param->_predictor_history_shift [0]) |
+                           (history_1 <<_param->_predictor_history_shift [1]) |
+                           (history_2 <<_param->_predictor_history_shift [2]));
+
+              direction = ((    direction_2 and direction_1) or
+                           (not direction_2 and direction_0));
+              
+              if (_param->_predictor_update_on_prediction [0])
+                {
+                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [0][i],direction_2 == 0);
+                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION     [0][i],direction);
+                }
+              if (_param->_predictor_update_on_prediction [1])
+                {
+                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [1][i],direction_2 == 1);
+                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION     [1][i],direction);
+                }
+              if (_param->_predictor_update_on_prediction [2])
+                {
+                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [2][i],true);
+                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION     [2][i],direction_2);
+                }
+              
+              break;
+            }
+          default :
+            { 
+              break;
+            }
+          }
+
+        PORT_WRITE(out_PREDICT_HISTORY   [i],history  );
+        PORT_WRITE(out_PREDICT_DIRECTION [i],direction);
+      }
+
+    log_end(Meta_Predictor_Glue,FUNCTION);
+  };
+
+}; // end namespace meta_predictor_glue
+}; // end namespace meta_predictor
+}; // end namespace direction
+}; // end namespace prediction_unit
+}; // end namespace front_end
+}; // end namespace multi_front_end
+}; // end namespace core
+
+}; // end namespace behavioural
+}; // end namespace morpheo              
+#endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_predict_valack.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_predict_valack.cpp	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_predict_valack.cpp	(revision 111)
@@ -0,0 +1,57 @@
+#ifdef SYSTEMC
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h"
+
+namespace morpheo                    {
+namespace behavioural {
+namespace core {
+namespace multi_front_end {
+namespace front_end {
+namespace prediction_unit {
+namespace direction {
+namespace meta_predictor {
+namespace meta_predictor_glue {
+
+
+#undef  FUNCTION
+#define FUNCTION "Meta_Predictor_Glue::genMealy_predict_valack"
+  void Meta_Predictor_Glue::genMealy_predict_valack (void)
+  {
+    log_begin(Meta_Predictor_Glue,FUNCTION);
+    log_function(Meta_Predictor_Glue,FUNCTION,_name.c_str());
+
+    for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
+      {
+        Tcontrol_t val = PORT_READ(in_PREDICT_VAL [i]);
+        Tcontrol_t ack = true;
+
+        for (uint32_t j=0; j<_param->_nb_predictor; ++j)
+          {
+            PORT_WRITE(out_PREDICT_PREDICTOR_VAL [j][i],val);
+
+            ack &= PORT_READ(in_PREDICT_PREDICTOR_ACK [j][i]);
+          }
+
+        PORT_WRITE(out_PREDICT_ACK [i],ack);
+      }
+
+    log_end(Meta_Predictor_Glue,FUNCTION);
+  };
+
+}; // end namespace meta_predictor_glue
+}; // end namespace meta_predictor
+}; // end namespace direction
+}; // end namespace prediction_unit
+}; // end namespace front_end
+}; // end namespace multi_front_end
+}; // end namespace core
+
+}; // end namespace behavioural
+}; // end namespace morpheo              
+#endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_update.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_update.cpp	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_update.cpp	(revision 111)
@@ -0,0 +1,122 @@
+#ifdef SYSTEMC
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h"
+
+namespace morpheo                    {
+namespace behavioural {
+namespace core {
+namespace multi_front_end {
+namespace front_end {
+namespace prediction_unit {
+namespace direction {
+namespace meta_predictor {
+namespace meta_predictor_glue {
+
+
+#undef  FUNCTION
+#define FUNCTION "Meta_Predictor_Glue::genMealy_update"
+  void Meta_Predictor_Glue::genMealy_update (void)
+  {
+    log_begin(Meta_Predictor_Glue,FUNCTION);
+    log_function(Meta_Predictor_Glue,FUNCTION,_name.c_str());
+
+    for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
+      {
+        Thistory_t history   = PORT_READ(in_UPDATE_HISTORY   [i]);
+        Tcontrol_t direction = PORT_READ(in_UPDATE_DIRECTION [i]);
+
+        switch (_param->_nb_predictor)
+          {
+          case 1 :
+            {
+              Thistory_t history_0       =  history;
+              Tcontrol_t direction_old_0 = (history_0>>_param->_predictor_history_shift_msb[0])&1;
+              PORT_WRITE(out_UPDATE_PREDICTOR_HISTORY   [0][i],history_0);
+              PORT_WRITE(out_UPDATE_PREDICTOR_DIRECTION [0][i],direction);
+              if (_param->_predictor_update_on_prediction [0])
+              PORT_WRITE(out_UPDATE_PREDICTOR_MISS      [0][i],direction xor direction_old_0);
+
+              break;
+            }
+          case 3 :
+            {
+              /*
+                dir_0 dir_1 dir_2 | good_dir  || next_dir_2
+                ------------------+-----------++-----------
+                  0     0     0   |     0     || no change 
+                  1     0     0   |     0     ||         1 select pred_0 but miss
+                  0     1     0   |     0     ||         0 select pred_0 and hit 
+                  1     1     0   |     0     || no change
+                  0     0     1   |     0     || no change
+                  1     0     1   |     0     ||         1 select pred_1 and hit 
+                  0     1     1   |     0     ||         0 select pred_1 but miss
+                  1     1     1   |     0     || no change
+                  0     0     0   |     1     || no change
+                  1     0     0   |     1     ||         0 select pred_0 and hit 
+                  0     1     0   |     1     ||         1 select pred_0 but miss
+                  1     1     0   |     1     || no change
+                  0     0     1   |     1     || no change
+                  1     0     1   |     1     ||         0 select pred_1 but miss
+                  0     1     1   |     1     ||         1 select pred_1 and hit 
+                  1     1     1   |     1     || no change
+                
+                next_dir_2 = (good_dir and dir_1) or (not good_dir and dir_0)
+              */
+
+              Thistory_t history_0       = (history  >>_param->_predictor_history_shift    [0])&_param->_predictor_history_mask [0];
+              Thistory_t history_1       = (history  >>_param->_predictor_history_shift    [1])&_param->_predictor_history_mask [1];
+              Thistory_t history_2       = (history  >>_param->_predictor_history_shift    [2])&_param->_predictor_history_mask [2];
+              Tcontrol_t direction_old_0 = (history_0>>_param->_predictor_history_shift_msb[0])&1;
+              Tcontrol_t direction_old_1 = (history_1>>_param->_predictor_history_shift_msb[1])&1;
+              Tcontrol_t direction_old_2 = (history_2>>_param->_predictor_history_shift_msb[2])&1;
+              Tcontrol_t direction_new_2 = direction_old_2;
+
+              // Test if two predictor is different
+              if (direction_old_0 xor direction_old_1)
+                direction_new_2 = ((    direction and direction_old_1) or 
+                                   (not direction and direction_old_0));
+
+              PORT_WRITE(out_UPDATE_PREDICTOR_DIRECTION [0][i],direction);
+              PORT_WRITE(out_UPDATE_PREDICTOR_DIRECTION [1][i],direction);
+              PORT_WRITE(out_UPDATE_PREDICTOR_DIRECTION [2][i],direction_new_2);
+
+              if (_param->_predictor_update_on_prediction [0])
+              PORT_WRITE(out_UPDATE_PREDICTOR_MISS      [0][i],direction       xor direction_old_0);
+              if (_param->_predictor_update_on_prediction [1])
+              PORT_WRITE(out_UPDATE_PREDICTOR_MISS      [1][i],direction       xor direction_old_1);
+              if (_param->_predictor_update_on_prediction [2])
+              PORT_WRITE(out_UPDATE_PREDICTOR_MISS      [2][i],direction_new_2 xor direction_old_2);
+
+              PORT_WRITE(out_UPDATE_PREDICTOR_HISTORY   [0][i],history_0);
+              PORT_WRITE(out_UPDATE_PREDICTOR_HISTORY   [1][i],history_1);
+              PORT_WRITE(out_UPDATE_PREDICTOR_HISTORY   [2][i],history_2);
+
+              break;
+            }
+          default :
+            { 
+              break;
+            }
+          }
+      }
+
+    log_end(Meta_Predictor_Glue,FUNCTION);
+  };
+
+}; // end namespace meta_predictor_glue
+}; // end namespace meta_predictor
+}; // end namespace direction
+}; // end namespace prediction_unit
+}; // end namespace front_end
+}; // end namespace multi_front_end
+}; // end namespace core
+
+}; // end namespace behavioural
+}; // end namespace morpheo              
+#endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_update_valack.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_update_valack.cpp	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_update_valack.cpp	(revision 111)
@@ -0,0 +1,57 @@
+#ifdef SYSTEMC
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h"
+
+namespace morpheo                    {
+namespace behavioural {
+namespace core {
+namespace multi_front_end {
+namespace front_end {
+namespace prediction_unit {
+namespace direction {
+namespace meta_predictor {
+namespace meta_predictor_glue {
+
+
+#undef  FUNCTION
+#define FUNCTION "Meta_Predictor_Glue::genMealy_update_valack"
+  void Meta_Predictor_Glue::genMealy_update_valack (void)
+  {
+    log_begin(Meta_Predictor_Glue,FUNCTION);
+    log_function(Meta_Predictor_Glue,FUNCTION,_name.c_str());
+
+    for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
+      {
+        Tcontrol_t val = PORT_READ(in_UPDATE_VAL [i]);
+        Tcontrol_t ack = true;
+
+        for (uint32_t j=0; j<_param->_nb_predictor; ++j)
+          {
+            PORT_WRITE(out_UPDATE_PREDICTOR_VAL [j][i],val);
+
+            ack &= PORT_READ(in_UPDATE_PREDICTOR_ACK [j][i]);
+          }
+
+        PORT_WRITE(out_UPDATE_ACK [i],ack);
+      }
+
+    log_end(Meta_Predictor_Glue,FUNCTION);
+  };
+
+}; // end namespace meta_predictor_glue
+}; // end namespace meta_predictor
+}; // end namespace direction
+}; // end namespace prediction_unit
+}; // end namespace front_end
+}; // end namespace multi_front_end
+}; // end namespace core
+
+}; // end namespace behavioural
+}; // end namespace morpheo              
+#endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_transition.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_transition.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_transition.cpp	(revision 111)
@@ -25,4 +25,5 @@
   {
     log_begin(Meta_Predictor_Glue,FUNCTION);
+    log_function(Meta_Predictor_Glue,FUNCTION,_name.c_str());
 
 #if defined(STATISTICS) or defined(VHDL_TESTBENCH)
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Parameters.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Parameters.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Parameters.cpp	(revision 111)
@@ -7,4 +7,6 @@
 
 #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Parameters.h"
+#include "Behavioural/include/Allocation.h"
+#include "Common/include/BitManipulation.h"
 
 namespace morpheo {
@@ -21,9 +23,38 @@
 #undef  FUNCTION
 #define FUNCTION "Meta_Predictor_Glue::Parameters"
-  Parameters::Parameters (bool is_toplevel)
+  Parameters::Parameters (uint32_t   nb_inst_predict         ,
+                          uint32_t   nb_inst_update          ,
+                          uint32_t   nb_predictor                  ,
+                          uint32_t * predictor_size_history        ,//[nb_predictor]
+                          bool     * predictor_update_on_prediction,//[nb_predictor]
+                          bool       is_toplevel             )
   {
     log_begin(Meta_Predictor_Glue,FUNCTION);
 
+    _nb_inst_predict                = nb_inst_predict               ;
+    _nb_inst_update                 = nb_inst_update                ;
+    _nb_predictor                   = nb_predictor                  ;
+    _predictor_size_history         = predictor_size_history        ;
+    _predictor_update_on_prediction = predictor_update_on_prediction;
+
+    _size_history = 0;
+    for (uint32_t i=0; i<_nb_predictor; ++i)
+      _size_history += _predictor_size_history [i];
+
     test();
+
+    ALLOC1(_predictor_history_shift    ,uint32_t  ,_nb_predictor);
+    ALLOC1(_predictor_history_shift_msb,uint32_t  ,_nb_predictor);
+    ALLOC1(_predictor_history_mask     ,Thistory_t,_nb_predictor);
+
+    uint32_t shift = 0;
+    for (uint32_t i=0; i<_nb_predictor; ++i)
+      {
+        _predictor_history_shift     [i] = shift;
+        _predictor_history_shift_msb [i] = _predictor_size_history [i]-1;
+        _predictor_history_mask      [i] = gen_mask<Thistory_t>(_predictor_size_history [i]);
+
+        shift += _predictor_size_history [i];
+      }
 
     if (is_toplevel)
@@ -57,4 +88,8 @@
   {
     log_begin(Meta_Predictor_Glue,FUNCTION);
+
+    DELETE1(_predictor_history_mask ,_nb_predictor);
+    DELETE1(_predictor_history_shift,_nb_predictor);
+
     log_end(Meta_Predictor_Glue,FUNCTION);
   };
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/config-alpha_21264.cfg
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/config-alpha_21264.cfg	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/config-alpha_21264.cfg	(revision 111)
@@ -0,0 +1,25 @@
+Meta_Predictor
+1       1       +1      # nb_inst_predict
+1       1       +1      # nb_inst_update
+30      30      *2      # size_address
+1       1       +1      # predictor_0_have_bht              
+10      10      +1      # predictor_0_bht_size_shifter      
+1024    1024    *2      # predictor_0_bht_nb_shifter
+1       1       +1      # predictor_0_have_pht              
+3       3       +1      # predictor_0_pht_size_counter      
+1024    1024    *2      # predictor_0_pht_nb_counter
+0       0       +1      # predictor_0_pht_size_address_share
+1       1       +1      # predictor_1_have_bht              
+12      12      +1      # predictor_1_bht_size_shifter      
+2       2       *2      # predictor_1_bht_nb_shifter
+1       1       +1      # predictor_1_have_pht              
+2       2       +1      # predictor_1_pht_size_counter      
+4096    4096    *2      # predictor_1_pht_nb_counter
+0       0       +1      # predictor_1_pht_size_address_share
+0       0       +1      # predictor_2_have_bht              
+4       4       +1      # predictor_2_bht_size_shifter      
+256     256     *2      # predictor_2_bht_nb_shifter
+1       1       +1      # predictor_2_have_pht              
+2       2       +1      # predictor_2_pht_size_counter      
+4096    4096    *2      # predictor_2_pht_nb_counter
+0       0       +1      # predictor_2_pht_size_address_share
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/configuration.cfg
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/configuration.cfg	(revision 110)
+++ 	(revision )
@@ -1,1 +1,0 @@
-Meta_Predictor
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/src/main.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/src/main.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/src/main.cpp	(revision 111)
@@ -7,6 +7,7 @@
 
 #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/include/test.h"
+#include "Behavioural/include/Selftest.h"
 
-#define NB_PARAMS 0
+#define NB_PARAMS 3+7*3
 
 void usage (int argc, char * argv[])
@@ -14,6 +15,14 @@
   err (_("<Usage> %s name_instance list_params.\n"),argv[0]);
   err (_("list_params is :\n"));
-  err (_(" *  ()\n"));
-
+  err (_(" * nb_inst_predict            (uint32_t)\n"));
+  err (_(" * nb_inst_update             (uint32_t)\n"));
+  err (_(" * size_address               (uint32_t)\n"));
+  err (_(" * have_bht               [3] (bool    )\n"));
+  err (_(" * bht_size_shifter       [3] (uint32_t)\n"));
+  err (_(" * bht_nb_shifter         [3] (uint32_t)\n"));
+  err (_(" * have_pht               [3] (bool    )\n"));
+  err (_(" * pht_size_counter       [3] (uint32_t)\n"));
+  err (_(" * pht_nb_counter         [3] (uint32_t)\n"));
+  err (_(" * pht_size_address_share [3] (uint32_t)\n"));
   exit (1);
 }
@@ -31,4 +40,29 @@
 
   string name = argv[x++];
+  uint32_t _nb_inst_predict           ;
+  uint32_t _nb_inst_update            ;
+  uint32_t _size_address              ;
+  bool     _have_bht               [3];
+  uint32_t _bht_size_shifter       [3];
+  uint32_t _bht_nb_shifter         [3];
+  bool     _have_pht               [3];
+  uint32_t _pht_size_counter       [3];
+  uint32_t _pht_nb_counter         [3];
+  uint32_t _pht_size_address_share [3];
+
+  SELFTEST0(_nb_inst_predict           ,uint32_t,argv,x);
+  SELFTEST0(_nb_inst_update            ,uint32_t,argv,x);
+  SELFTEST0(_size_address              ,uint32_t,argv,x);
+
+  for (uint32_t i=0; i<3; ++i)
+    {
+  SELFTEST0(_have_bht               [i],bool    ,argv,x);
+  SELFTEST0(_bht_size_shifter       [i],uint32_t,argv,x);
+  SELFTEST0(_bht_nb_shifter         [i],uint32_t,argv,x);
+  SELFTEST0(_have_pht               [i],bool    ,argv,x);
+  SELFTEST0(_pht_size_counter       [i],uint32_t,argv,x);
+  SELFTEST0(_pht_nb_counter         [i],uint32_t,argv,x);
+  SELFTEST0(_pht_size_address_share [i],uint32_t,argv,x);
+    }
 
   int _return = EXIT_SUCCESS;
@@ -37,4 +71,14 @@
       morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Parameters
 	(
+         _nb_inst_predict       ,
+         _nb_inst_update        ,
+         _size_address          ,
+         _have_bht              ,
+         _bht_size_shifter      ,
+         _bht_nb_shifter        ,
+         _have_pht              ,
+         _pht_size_counter      ,
+         _pht_nb_counter        ,
+         _pht_size_address_share,
          true // is_toplevel
         );
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/src/test.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/src/test.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/src/test.cpp	(revision 111)
@@ -50,4 +50,15 @@
   sc_clock              *  in_CLOCK  = new sc_clock ("clock", 1.0, 0.5);	 
   sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
+  ALLOC1_SC_SIGNAL( in_PREDICT_VAL          ," in_PREDICT_VAL          ",Tcontrol_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL(out_PREDICT_ACK          ,"out_PREDICT_ACK          ",Tcontrol_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL( in_PREDICT_ADDRESS      ," in_PREDICT_ADDRESS      ",Taddress_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL(out_PREDICT_DIRECTION    ,"out_PREDICT_DIRECTION    ",Tcontrol_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL(out_PREDICT_HISTORY      ,"out_PREDICT_HISTORY      ",Thistory_t,_param->_nb_inst_predict);
+  
+  ALLOC1_SC_SIGNAL( in_UPDATE_VAL           ," in_UPDATE_VAL           ",Tcontrol_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL(out_UPDATE_ACK           ,"out_UPDATE_ACK           ",Tcontrol_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL( in_UPDATE_ADDRESS       ," in_UPDATE_ADDRESS       ",Taddress_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL( in_UPDATE_HISTORY       ," in_UPDATE_HISTORY       ",Thistory_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL( in_UPDATE_DIRECTION     ," in_UPDATE_DIRECTION     ",Tcontrol_t,_param->_nb_inst_update);
   
   /********************************************************
@@ -60,4 +71,15 @@
   (*(_Meta_Predictor->in_NRESET))       (*(in_NRESET));
 
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_PREDICT_VAL          ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor,out_PREDICT_ACK          ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_PREDICT_ADDRESS      ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor,out_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor,out_PREDICT_HISTORY      ,_param->_nb_inst_predict);
+
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_UPDATE_VAL           ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor,out_UPDATE_ACK           ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_UPDATE_ADDRESS       ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_UPDATE_HISTORY       ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_UPDATE_DIRECTION     ,_param->_nb_inst_update);
 
   msg(_("<%s> : Start Simulation ............\n"),name.c_str());
@@ -104,4 +126,16 @@
   delete in_CLOCK;
   delete in_NRESET;
+
+  DELETE1_SC_SIGNAL( in_PREDICT_VAL          ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL(out_PREDICT_ACK          ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL( in_PREDICT_ADDRESS      ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL(out_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL(out_PREDICT_HISTORY      ,_param->_nb_inst_predict);
+
+  DELETE1_SC_SIGNAL( in_UPDATE_VAL           ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL(out_UPDATE_ACK           ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update);
     }
 #endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/config_bht_and_pht.cfg
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/config_bht_and_pht.cfg	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/config_bht_and_pht.cfg	(revision 111)
@@ -0,0 +1,12 @@
+Two_Level_Branch_Predictor
+4       4       *2      # nb_inst_predict       
+4       4       *2      # nb_inst_update        
+30      30      *2      # size_address          
+1       1       +1      # have_bht              
+4       4       *4      # bht_size_shifter      
+16      16      *4      # bht_nb_shifter        
+1	1	+1	# have_pht              
+4	4  	*2	# pht_size_counter      
+32	32	*4	# pht_nb_counter        
+0	2	+1	# pht_size_address_share
+1       1       +1      # update_on_prediction
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/config_bht_only.cfg
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/config_bht_only.cfg	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/config_bht_only.cfg	(revision 111)
@@ -0,0 +1,12 @@
+Two_Level_Branch_Predictor
+4       4       *2      # nb_inst_predict       
+4       4       *2      # nb_inst_update        
+30      30      *2      # size_address          
+1       1       +1      # have_bht              
+1       16      *4      # bht_size_shifter      
+1       16      *4      # bht_nb_shifter        
+0	0	+1	# have_pht              
+0	0	+1	# pht_size_counter      
+0	0	*2	# pht_nb_counter        
+0	0	+1	# pht_size_address_share
+1       1       +1      # update_on_prediction
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/config_pht_only.cfg
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/config_pht_only.cfg	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/config_pht_only.cfg	(revision 111)
@@ -0,0 +1,12 @@
+Two_Level_Branch_Predictor
+4       4       *2      # nb_inst_predict       
+4       4       *2      # nb_inst_update        
+30      30      *2      # size_address          
+0       0       +1      # have_bht              
+0       0       *4      # bht_size_shifter      
+0       0       *4      # bht_nb_shifter        
+1	1	+1	# have_pht              
+1	4  	*2	# pht_size_counter      
+1	16	*4	# pht_nb_counter        
+0	0	+1	# pht_size_address_share
+1       1       +1      # update_on_prediction
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/configuration.cfg
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/configuration.cfg	(revision 110)
+++ 	(revision )
@@ -1,1 +1,0 @@
-Two_Level_Branch_Predictor
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/include/test.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/include/test.h	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/include/test.h	(revision 111)
@@ -11,5 +11,5 @@
 #endif
 
-#define NB_ITERATION  1
+#define NB_ITERATION  16
 #define CYCLE_MAX     (1024*NB_ITERATION)
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/src/main.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/src/main.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/src/main.cpp	(revision 111)
@@ -7,6 +7,7 @@
 
 #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/include/test.h"
+#include "Behavioural/include/Selftest.h"
 
-#define NB_PARAMS 0
+#define NB_PARAMS 11
 
 void usage (int argc, char * argv[])
@@ -14,5 +15,15 @@
   err (_("<Usage> %s name_instance list_params.\n"),argv[0]);
   err (_("list_params is :\n"));
-  err (_(" *  ()\n"));
+  err (_(" * nb_inst_predict        (uint32_t)\n"));
+  err (_(" * nb_inst_update         (uint32_t)\n"));
+  err (_(" * size_address           (uint32_t)\n"));
+  err (_(" * have_bht               (bool    )\n"));
+  err (_(" * bht_size_shifter       (uint32_t)\n"));
+  err (_(" * bht_nb_shifter         (uint32_t)\n"));
+  err (_(" * have_pht               (bool    )\n"));
+  err (_(" * pht_size_counter       (uint32_t)\n"));
+  err (_(" * pht_nb_counter         (uint32_t)\n"));
+  err (_(" * pht_size_address_share (uint32_t)\n"));
+  err (_(" * update_on_prediction   (bool    )\n"));
 
   exit (1);
@@ -32,4 +43,28 @@
   string name = argv[x++];
 
+  uint32_t nb_inst_predict       ;
+  uint32_t nb_inst_update        ;
+  uint32_t size_address          ;
+  bool     have_bht              ;
+  uint32_t bht_size_shifter      ;
+  uint32_t bht_nb_shifter        ;
+  bool     have_pht              ;
+  uint32_t pht_size_counter      ;
+  uint32_t pht_nb_counter        ;
+  uint32_t pht_size_address_share;
+  bool     update_on_prediction  ;
+
+  SELFTEST0(nb_inst_predict       ,uint32_t,argv,x);
+  SELFTEST0(nb_inst_update        ,uint32_t,argv,x);
+  SELFTEST0(size_address          ,uint32_t,argv,x);
+  SELFTEST0(have_bht              ,bool    ,argv,x);
+  SELFTEST0(bht_size_shifter      ,uint32_t,argv,x);
+  SELFTEST0(bht_nb_shifter        ,uint32_t,argv,x);
+  SELFTEST0(have_pht              ,bool    ,argv,x);
+  SELFTEST0(pht_size_counter      ,uint32_t,argv,x);
+  SELFTEST0(pht_nb_counter        ,uint32_t,argv,x);
+  SELFTEST0(pht_size_address_share,uint32_t,argv,x);
+  SELFTEST0(update_on_prediction  ,bool    ,argv,x);
+
   int _return = EXIT_SUCCESS;
   try 
@@ -37,4 +72,15 @@
       morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters
 	(
+         nb_inst_predict       ,
+         nb_inst_update        ,
+         size_address          ,
+         have_bht              ,
+         bht_size_shifter      ,
+         bht_nb_shifter        ,
+         have_pht              ,
+         pht_size_counter      ,
+         pht_nb_counter        ,
+         pht_size_address_share,
+         update_on_prediction  ,
          true //is_toplevel
         );
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/src/test.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/src/test.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/src/test.cpp	(revision 111)
@@ -50,4 +50,19 @@
   sc_clock              *  in_CLOCK  = new sc_clock ("clock", 1.0, 0.5);	 
   sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
+
+  ALLOC1_SC_SIGNAL( in_PREDICT_VAL          ," in_PREDICT_VAL          ",Tcontrol_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL(out_PREDICT_ACK          ,"out_PREDICT_ACK          ",Tcontrol_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL( in_PREDICT_ADDRESS      ," in_PREDICT_ADDRESS      ",Taddress_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL(out_PREDICT_DIRECTION    ,"out_PREDICT_DIRECTION    ",Tcontrol_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL(out_PREDICT_HISTORY      ,"out_PREDICT_HISTORY      ",Thistory_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL( in_PREDICT_DIRECTION_VAL," in_PREDICT_DIRECTION_VAL",Tcontrol_t,_param->_nb_inst_predict);
+  ALLOC1_SC_SIGNAL( in_PREDICT_DIRECTION    ," in_PREDICT_DIRECTION    ",Tcontrol_t,_param->_nb_inst_predict);
+  
+  ALLOC1_SC_SIGNAL( in_UPDATE_VAL           ," in_UPDATE_VAL           ",Tcontrol_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL(out_UPDATE_ACK           ,"out_UPDATE_ACK           ",Tcontrol_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL( in_UPDATE_ADDRESS       ," in_UPDATE_ADDRESS       ",Taddress_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL( in_UPDATE_HISTORY       ," in_UPDATE_HISTORY       ",Thistory_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL( in_UPDATE_DIRECTION     ," in_UPDATE_DIRECTION     ",Tcontrol_t,_param->_nb_inst_update);
+  ALLOC1_SC_SIGNAL( in_UPDATE_MISS          ," in_UPDATE_MISS          ",Tcontrol_t,_param->_nb_inst_update);
   
   /********************************************************
@@ -60,4 +75,22 @@
   (*(_Two_Level_Branch_Predictor->in_NRESET))       (*(in_NRESET));
 
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_VAL          ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_ACK          ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_ADDRESS      ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_HISTORY      ,_param->_nb_inst_predict);
+  if (_param->_update_on_prediction)
+    {
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict);
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
+    }
+
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_VAL           ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_UPDATE_ACK           ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_ADDRESS       ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_HISTORY       ,_param->_nb_inst_update);
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_DIRECTION     ,_param->_nb_inst_update);
+  if (_param->_update_on_prediction)
+  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_MISS          ,_param->_nb_inst_update);
 
   msg(_("<%s> : Start Simulation ............\n"),name.c_str());
@@ -76,6 +109,14 @@
   srand(seed);
 
+  const  int32_t percent_transaction_predict = 75;
+  const  int32_t percent_transaction_update  = 75;
+
   SC_START(0);
   LABEL("Initialisation");
+
+  for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
+    in_PREDICT_VAL [i]->write(0);
+  for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
+    in_UPDATE_VAL [i]->write(0);
 
   LABEL("Reset");
@@ -85,9 +126,92 @@
 
   LABEL("Loop of Test");
-
+  
+  Thistory_t bht;
+  Thistory_t pht [_param->_pht_size_bank];
+  
   for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
     {
       LABEL("Iteration %d",iteration);
 
+      uint32_t bht_num_reg  = (_param->_have_bht)?(rand()%_param->_bht_nb_shifter):0;
+      uint32_t pht_num_bank = (_param->_have_pht)?(rand()%_param->_pht_nb_bank   ):0;
+
+      LABEL("  * bht_num_reg  : %d",bht_num_reg );
+      LABEL("  * pht_num_bank : %d",pht_num_bank);
+
+      {
+        LABEL("Init BHT and PHT");
+
+        bht = 0;
+        for (uint32_t i=0; i<_param->_pht_size_bank; ++i)
+          pht [i] = 0;
+        
+        uint32_t port = rand()%_param->_nb_inst_update;
+
+        if (_param->_have_bht)
+          {        
+            bool find = false;
+            while (not find)
+              {
+                bool val = ((rand()%2)<percent_transaction_update);
+                in_UPDATE_VAL       [port]->write(val);
+                in_UPDATE_DIRECTION [port]->write(0);
+                
+                if (_param->_update_on_prediction)
+                  in_UPDATE_MISS      [port]->write(1); // miss
+                in_UPDATE_HISTORY   [port]->write(0);
+                in_UPDATE_ADDRESS   [port]->write(bht_num_reg);
+                
+                SC_START(0);
+                
+                if (val and out_UPDATE_ACK [port]->read())
+                  {
+                    LABEL("UPDATE[%d] - Transaction accepted",port);
+                    find = true;
+                  }
+                
+                SC_START(1);
+              }
+            in_UPDATE_VAL [port]->write(0);
+          }
+
+        if (_param->_have_pht)
+          {        
+            for (uint32_t i=0; i<_param->_pht_size_bank; ++i)
+              {
+                bool find = false;
+                
+                while (not find)
+                  {
+                    bool val = ((rand()%2)<percent_transaction_update);
+                    in_UPDATE_VAL       [port]->write(val);
+                    in_UPDATE_DIRECTION [port]->write(0);
+                    
+                    if (_param->_update_on_prediction)
+                      in_UPDATE_MISS      [port]->write(1); // miss
+                    in_UPDATE_HISTORY   [port]->write(i<<_param->_bht_history_rshift);
+                    in_UPDATE_ADDRESS   [port]->write(pht_num_bank<<_param->_pht_address_bank_rshift);
+                    
+                    SC_START(0);
+                    
+                    if (val and out_UPDATE_ACK [port]->read())
+                      {
+                        LABEL("UPDATE[%d] - Transaction accepted",port);
+                        find = true;
+                      }
+                    
+                    SC_START(1);
+                  }
+                in_UPDATE_VAL [port]->write(0);
+              }
+          }
+      }
+
+//       if (1)
+//         {
+//           LABEL("Saturation all PHT");
+          
+//         }
+
       SC_START(1);
     }
@@ -104,4 +228,19 @@
   delete in_CLOCK;
   delete in_NRESET;
+
+  DELETE1_SC_SIGNAL( in_PREDICT_VAL          ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL(out_PREDICT_ACK          ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL( in_PREDICT_ADDRESS      ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL(out_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL(out_PREDICT_HISTORY      ,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL( in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict);
+  DELETE1_SC_SIGNAL( in_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
+
+  DELETE1_SC_SIGNAL( in_UPDATE_VAL           ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL(out_UPDATE_ACK           ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update);
+  DELETE1_SC_SIGNAL( in_UPDATE_MISS          ,_param->_nb_inst_update);
     }
 #endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h	(revision 111)
@@ -9,4 +9,5 @@
  */
 
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Types.h"
 #include "Behavioural/include/Parameters.h"
 #include "Common/include/Debug.h"
@@ -26,7 +27,49 @@
   {
     //-----[ fields ]------------------------------------------------------------
+  public : uint32_t   _nb_inst_predict         ;
+  public : uint32_t   _nb_inst_update          ;
+  public : uint32_t   _size_address            ;
+  public : bool       _have_bht                ;
+  public : uint32_t   _bht_size_shifter        ;
+  public : uint32_t   _bht_nb_shifter          ;
+  public : bool       _have_pht                ;
+  public : uint32_t   _pht_size_counter        ;
+  public : uint32_t   _pht_nb_counter          ;
+  public : uint32_t   _pht_size_address_share  ;
+  public : bool       _update_on_prediction    ;
+                                       
+  public : Thistory_t _pht_counter_max         ;
+        
+  public : uint32_t   _size_history            ;
+                                               
+  public : Thistory_t _bht_history_mask        ;
+  public : Thistory_t _bht_history_rshift      ;
+  public : Thistory_t _pht_history_mask        ;
+  public : Thistory_t _pht_history_rshift      ;
+                                               
+  public : uint32_t   _bht_size_address        ;
+  public : uint32_t   _pht_size_address        ;
+                                               
+  public : Taddress_t _bht_address_mask        ;
+  public : uint32_t   _pht_nb_bank             ;
+  public : uint32_t   _pht_size_bank           ;
+  public : Taddress_t _pht_address_share_mask  ;
+  public : Taddress_t _pht_address_share_lshift;
+  public : Taddress_t _pht_address_bank_mask   ;
+  public : Taddress_t _pht_address_bank_rshift ;
 
     //-----[ methods ]-----------------------------------------------------------
-  public : Parameters  (bool is_toplevel=false);
+  public : Parameters  (uint32_t nb_inst_predict       ,
+			uint32_t nb_inst_update        ,
+			uint32_t size_address          ,
+                        bool     have_bht              ,
+			uint32_t bht_size_shifter      ,
+			uint32_t bht_nb_shifter        ,
+			bool     have_pht              ,
+			uint32_t pht_size_counter      ,
+			uint32_t pht_nb_counter        ,
+			uint32_t pht_size_address_share,
+                        bool     update_on_prediction  ,
+                        bool is_toplevel=false);
 //public : Parameters  (Parameters & param) ;
   public : ~Parameters (void);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h	(revision 111)
@@ -66,9 +66,34 @@
   public    : SC_IN (Tcontrol_t)            *  in_NRESET       ;
 
+    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  public    : SC_IN (Tcontrol_t)           **  in_PREDICT_VAL          ;//[nb_inst_predict]
+  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_ACK          ;//[nb_inst_predict]
+  public    : SC_IN (Taddress_t)           **  in_PREDICT_ADDRESS      ;//[nb_inst_predict]
+  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_DIRECTION    ;//[nb_inst_predict] // = MSB[history]
+  public    : SC_OUT(Thistory_t)           ** out_PREDICT_HISTORY      ;//[nb_inst_predict]
+  public    : SC_IN (Tcontrol_t)           **  in_PREDICT_DIRECTION_VAL;//[nb_inst_predict] // if update_on_prediction
+  public    : SC_IN (Tcontrol_t)           **  in_PREDICT_DIRECTION    ;//[nb_inst_predict] // if update_on_prediction
+
+    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_VAL           ;//[nb_inst_update]
+  public    : SC_OUT(Tcontrol_t)           ** out_UPDATE_ACK           ;//[nb_inst_update]
+  public    : SC_IN (Taddress_t)           **  in_UPDATE_ADDRESS       ;//[nb_inst_update]
+  public    : SC_IN (Thistory_t)           **  in_UPDATE_HISTORY       ;//[nb_inst_update]
+  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_DIRECTION     ;//[nb_inst_update]
+  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_MISS          ;//[nb_inst_update] // if update_on_prediction
+
     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
-
+    
     // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
+  private   : Thistory_t                    * reg_BHT                       ;//[bht_nb_shifter]
+  private   : Thistory_t                   ** reg_PHT                       ;//[pht_nb_counter][pht_nb_bank]
 
     // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  private   : Tcontrol_t                    * internal_PREDICT_ACK          ;//[nb_inst_predict]
+  private   : Thistory_t                    * internal_PREDICT_BHT_NUM_REG  ;//[nb_inst_predict] // if update_on_prediction
+  private   : Thistory_t                    * internal_PREDICT_PHT_NUM_BANK ;//[nb_inst_predict] // if update_on_prediction
+  private   : Thistory_t                    * internal_PREDICT_PHT_NUM_REG  ;//[nb_inst_predict] // if update_on_prediction
+
+  private   : Tcontrol_t                    * internal_UPDATE_ACK           ;//[nb_inst_update]
 #endif
 
@@ -104,5 +129,5 @@
 #ifdef SYSTEMC				       
   public  : void        transition                (void);
-//public  : void        genMoore                  (void);
+  public  : void        genMealy_predict          (void);
 #endif					       
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.cpp	(revision 111)
@@ -7,4 +7,5 @@
 
 #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h"
+#include "Common/include/BitManipulation.h"
 
 namespace morpheo {
@@ -21,14 +22,78 @@
 #undef  FUNCTION
 #define FUNCTION "Two_Level_Branch_Predictor::Parameters"
-  Parameters::Parameters (bool is_toplevel)
+  Parameters::Parameters (uint32_t nb_inst_predict       ,
+                          uint32_t nb_inst_update        ,
+                          uint32_t size_address          ,
+                          bool     have_bht              ,
+                          uint32_t bht_size_shifter      ,
+                          uint32_t bht_nb_shifter        ,
+                          bool     have_pht              ,
+                          uint32_t pht_size_counter      ,
+                          uint32_t pht_nb_counter        ,
+                          uint32_t pht_size_address_share,
+                          bool     update_on_prediction  ,
+                          bool is_toplevel)
   {
     log_begin(Two_Level_Branch_Predictor,FUNCTION);
 
-    test();
+    _nb_inst_predict         = nb_inst_predict       ;
+    _nb_inst_update          = nb_inst_update        ;
+    _size_address            = size_address          ;
+    _have_bht                = have_bht              ;
+    _bht_size_shifter        = (have_bht)?(bht_size_shifter):0;
+    _bht_nb_shifter          = (have_bht)?(bht_nb_shifter  ):0;
+    _have_pht                = have_pht              ;
+    _pht_size_counter        = (have_pht)?(pht_size_counter      ):0;
+    _pht_nb_counter          = (have_pht)?(pht_nb_counter        ):0;
+    _pht_size_address_share  = (have_bht and have_pht)?(pht_size_address_share):0;
+    _update_on_prediction    = update_on_prediction  ;
+                             
+    _bht_size_address        = (_have_bht)?log2(_bht_nb_shifter):0;
+    _pht_size_address        = (_have_pht)?log2(_pht_nb_counter):0;
+                             
+    test();                  
+
+    _size_history            = _bht_size_shifter + _pht_size_counter;
+                             
+    _bht_history_mask        = gen_mask<Thistory_t>(_bht_size_shifter);
+    _bht_history_rshift      = 0;
+    _pht_history_mask        = gen_mask<Thistory_t>(_pht_size_counter);
+    _pht_history_rshift      = _bht_size_shifter;
+                             
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _size_history             : %d",_size_history  );
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_mask         : 0x%x",_bht_history_mask  );
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_rshift       : %d",_bht_history_rshift);
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_mask         : 0x%x",_pht_history_mask  );
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_rshift       : %d",_pht_history_rshift);
+
+    if (_have_bht)
+      {
+        _bht_address_mask        = gen_mask<Taddress_t>(_bht_size_address);
+
+        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_address_mask         : 0x%x",_bht_address_mask  );
+      }
+
+    if (_have_pht)
+      {
+        _pht_counter_max         = (1<<_pht_size_counter)-1;
+        
+        _pht_nb_bank             = (_pht_nb_counter - (1<<_bht_size_shifter))+1;
+        _pht_size_bank           = _pht_nb_counter / _pht_nb_bank;
+
+        _pht_address_share_mask  = gen_mask<Taddress_t>(_pht_size_address_share);
+        _pht_address_share_lshift= _bht_size_shifter-_pht_size_address_share;
+        _pht_address_bank_mask   = gen_mask<Taddress_t>(log2(_pht_nb_bank));
+        _pht_address_bank_rshift = _pht_size_address_share;
+
+        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_nb_bank              : %d"  ,_pht_nb_bank   );
+        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_size_bank            : %d"  ,_pht_size_bank );
+        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_mask   : 0x%x",_pht_address_share_mask  );
+        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_lshift : %d"  ,_pht_address_share_lshift);
+        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_mask    : 0x%x",_pht_address_bank_mask   );
+        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_rshift  : %d"  ,_pht_address_bank_rshift );
+      }
 
     if (is_toplevel)
-      {
-        copy();
-      }
+      copy();
 
     log_end(Two_Level_Branch_Predictor,FUNCTION);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters_msg_error.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters_msg_error.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters_msg_error.cpp	(revision 111)
@@ -29,4 +29,19 @@
     Parameters_test test ("Two_Level_Branch_Predictor");
 
+    if ((_have_bht or _have_pht) == false)
+      test.error(_("They have no Branch History Table and no Pattern History Table. You need a less of a BHT or a PHT\n"));
+
+    if ( _have_bht and (_size_address < _bht_size_address))
+      test.error(_("The address's size must to large to the number of shifter in the Branch History Table.\n"));
+
+    if (_have_pht and (_size_address < _pht_size_address))
+      test.error(_("The address's size must to large to the number of counter in the Pattern History Table.\n"));
+
+    if (_have_pht and _have_bht and (_bht_size_address > _pht_nb_counter))
+      test.error (_("The size of shifter don't must too large that the number of counter in the Pattern History Table.\n"));
+
+    if (_have_pht and _have_bht and (_pht_size_address_share > _bht_size_shifter))
+      test.error (_("The size of address share don't must too large that the size of shifter in the Branch History Table.\n"));
+
     log_end(Two_Level_Branch_Predictor,FUNCTION);
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor.cpp	(revision 111)
@@ -72,4 +72,17 @@
     if (usage_is_set(_usage,USE_SYSTEMC))
       {
+        // Constants :
+        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
+          {
+            internal_PREDICT_ACK [i] = 1;
+            PORT_WRITE(out_PREDICT_ACK [i], internal_PREDICT_ACK [i]);
+          }
+        for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
+          {
+            internal_UPDATE_ACK [i] = 1;
+            PORT_WRITE(out_UPDATE_ACK [i], internal_UPDATE_ACK [i]);
+          }
+        
+
 	log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - transition"),_name.c_str());
 
@@ -82,13 +95,18 @@
 # endif    
 
-// 	log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str());
+	log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - genMealy_predict"),_name.c_str());
 
-// 	SC_METHOD (genMoore);
-// 	dont_initialize ();
-// 	sensitive << (*(in_CLOCK)).neg(); // need internal register
-	
-// # ifdef SYSTEMCASS_SPECIFIC
-// 	// List dependency information
-// # endif    
+	SC_METHOD (genMealy_predict);
+	dont_initialize ();
+	sensitive << (*(in_CLOCK)).neg(); // need internal register
+
+        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
+          sensitive 
+//             << (*(in_PREDICT_VAL     [i]))
+            << (*(in_PREDICT_ADDRESS [i]));
+        	
+# ifdef SYSTEMCASS_SPECIFIC
+	// List dependency information
+# endif    
 	
 #endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_allocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_allocation.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_allocation.cpp	(revision 111)
@@ -19,6 +19,4 @@
 namespace meta_predictor {
 namespace two_level_branch_predictor {
-
-
 
 #undef  FUNCTION
@@ -58,6 +56,69 @@
       in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
     }
+
+    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    {
+      ALLOC1_INTERFACE("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict);
+
+      ALLOC1_VALACK_IN ( in_PREDICT_VAL          ,VAL);
+      ALLOC1_VALACK_OUT(out_PREDICT_ACK          ,ACK);
+      ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS      ,"ADDRESS"      ,Taddress_t,_param->_size_address);
+      ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
+      ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY      ,"HISTORY"      ,Thistory_t,_param->_size_history);
+      if (_param->_update_on_prediction)
+        {
+      ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION_VAL,"DIRECTION_VAL",Tcontrol_t,1                    );
+      ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
+        }
+    }
+
+    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    {
+      ALLOC1_INTERFACE("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update);
+
+      ALLOC1_VALACK_IN ( in_UPDATE_VAL           ,VAL);
+      ALLOC1_VALACK_OUT(out_UPDATE_ACK           ,ACK);
+      ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS       ,"ADDRESS"      ,Taddress_t,_param->_size_address);
+      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY       ,"HISTORY"      ,Thistory_t,_param->_size_history);
+      ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION     ,"DIRECTION"    ,Tcontrol_t,1                    );
+      if (_param->_update_on_prediction)
+      ALLOC1_SIGNAL_IN ( in_UPDATE_MISS          ,"MISS"         ,Tcontrol_t,1                    );
+    }
+
+    if (usage_is_set(_usage,USE_SYSTEMC))
+      {
+        if (_param->_have_bht)
+          {
+        ALLOC1(reg_BHT                       ,Thistory_t,_param->_bht_nb_shifter);
+
+        for (uint32_t i=0; i<_param->_bht_nb_shifter; ++i)
+          reg_BHT [i] = 0;
+          }
+
+        if (_param->_have_pht)
+          {
+        ALLOC2(reg_PHT                       ,Thistory_t,_param->_pht_nb_bank,_param->_pht_size_bank);
+
+        for (uint32_t i=0; i<_param->_pht_nb_bank; ++i)
+          for (uint32_t j=0; j<_param->_pht_size_bank; ++j)
+            reg_PHT [i][j] = 0;
+          }
+
+
+        ALLOC1(internal_PREDICT_ACK          ,Tcontrol_t,_param->_nb_inst_predict);
+        if (_param->_update_on_prediction)
+          {
+        if (_param->_have_bht)
+        ALLOC1(internal_PREDICT_BHT_NUM_REG  ,Thistory_t,_param->_nb_inst_predict);
+        if (_param->_have_pht)
+          {
+        ALLOC1(internal_PREDICT_PHT_NUM_BANK ,Thistory_t,_param->_nb_inst_predict);
+        ALLOC1(internal_PREDICT_PHT_NUM_REG  ,Thistory_t,_param->_nb_inst_predict);
+          }
+          }
+        ALLOC1(internal_UPDATE_ACK           ,Tcontrol_t,_param->_nb_inst_update );
+      }
+
     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
-
 #ifdef POSITION
     if (usage_is_set(_usage,USE_POSITION))
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_deallocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_deallocation.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_deallocation.cpp	(revision 111)
@@ -30,4 +30,41 @@
 	delete    in_CLOCK ;
 	delete    in_NRESET;
+
+        DELETE1_SIGNAL( in_PREDICT_VAL          ,_param->_nb_inst_predict,1                    );
+        DELETE1_SIGNAL(out_PREDICT_ACK          ,_param->_nb_inst_predict,1                    );
+        DELETE1_SIGNAL( in_PREDICT_ADDRESS      ,_param->_nb_inst_predict,_param->_size_address);
+        DELETE1_SIGNAL(out_PREDICT_DIRECTION    ,_param->_nb_inst_predict,1                    );
+        DELETE1_SIGNAL(out_PREDICT_HISTORY      ,_param->_nb_inst_predict,_param->_size_history);
+        if (_param->_update_on_prediction)                               
+          {                                                              
+        DELETE1_SIGNAL( in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict,1                    );
+        DELETE1_SIGNAL( in_PREDICT_DIRECTION    ,_param->_nb_inst_predict,1                    );
+          }
+        
+        DELETE1_SIGNAL( in_UPDATE_VAL           ,_param->_nb_inst_update,1                    );
+        DELETE1_SIGNAL(out_UPDATE_ACK           ,_param->_nb_inst_update,1                    );
+        DELETE1_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update,_param->_size_address);
+        DELETE1_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update,_param->_size_history);
+        DELETE1_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update,1                    );
+        if (_param->_update_on_prediction)                              
+        DELETE1_SIGNAL( in_UPDATE_MISS          ,_param->_nb_inst_update,1                    );
+        
+        if (_param->_have_bht)
+        DELETE1(reg_BHT                         ,_param->_bht_nb_shifter);
+        if (_param->_have_pht)
+        DELETE2(reg_PHT                         ,_param->_pht_nb_bank,_param->_pht_size_bank);
+        
+        DELETE1(internal_PREDICT_ACK            ,_param->_nb_inst_predict);
+        if (_param->_update_on_prediction)      
+          {                                     
+        if (_param->_have_bht)
+        DELETE1(internal_PREDICT_BHT_NUM_REG    ,_param->_nb_inst_predict);
+        if (_param->_have_pht)
+          {
+        DELETE1(internal_PREDICT_PHT_NUM_BANK   ,_param->_nb_inst_predict);
+        DELETE1(internal_PREDICT_PHT_NUM_REG    ,_param->_nb_inst_predict);
+          }
+          }                                     
+        DELETE1(internal_UPDATE_ACK             ,_param->_nb_inst_update );
       }
     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_genMealy_predict.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_genMealy_predict.cpp	(revision 111)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_genMealy_predict.cpp	(revision 111)
@@ -0,0 +1,102 @@
+#ifdef SYSTEMC
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h"
+
+namespace morpheo                    {
+namespace behavioural {
+namespace core {
+namespace multi_front_end {
+namespace front_end {
+namespace prediction_unit {
+namespace direction {
+namespace meta_predictor {
+namespace two_level_branch_predictor {
+
+
+#undef  FUNCTION
+#define FUNCTION "Two_Level_Branch_Predictor::genMealy_predict"
+  void Two_Level_Branch_Predictor::genMealy_predict (void)
+  {
+    log_begin(Two_Level_Branch_Predictor,FUNCTION);
+    log_function(Two_Level_Branch_Predictor,FUNCTION,_name.c_str());
+
+    // ===================================================================
+    // =====[ PREDICT ]===================================================
+    // ===================================================================
+
+    for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
+//       if (PORT_READ(in_PREDICT_VAL[i]))
+        {
+          log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * PREDICT [%d]",i);
+
+          Taddress_t address     = PORT_READ(in_PREDICT_ADDRESS   [i]);
+          Thistory_t history     = 0;
+          Tcontrol_t direction;
+
+          log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * address          : 0x%.8x",address);
+
+          Thistory_t pht_bht_history = 0;
+          if (_param->_have_bht)
+            {
+              Thistory_t bht_num_reg = address & _param->_bht_address_mask;
+              Thistory_t bht_history = reg_BHT [bht_num_reg];
+              pht_bht_history = bht_history;
+
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history      : 0x%x",bht_history);
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_num_reg      : %d",bht_num_reg);
+
+              history   = (bht_history << _param->_bht_history_rshift)&_param->_bht_history_mask ;
+              direction = (bht_history >> (_param->_bht_size_shifter-1))&1;
+
+              if (_param->_update_on_prediction)
+              internal_PREDICT_BHT_NUM_REG [i] = bht_num_reg;
+            }
+
+          if (_param->_have_pht)
+            {
+              Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask;
+              Thistory_t pht_num_reg = (pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift));
+              Thistory_t pht_history = reg_PHT [pht_num_bank][pht_num_reg];
+              
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history      : 0x%x",pht_bht_history);
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history      : 0x%x",pht_history);
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %d",pht_num_reg);
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %d",pht_num_bank);
+              
+              history  |= (pht_history << _param->_pht_history_rshift)&_param->_pht_history_mask;
+              direction = (pht_history >> (_param->_pht_size_counter-1))&1;
+
+              if (_param->_update_on_prediction)
+                {
+              internal_PREDICT_PHT_NUM_REG [i] = pht_num_reg;
+              internal_PREDICT_PHT_NUM_BANK[i] = pht_num_bank;
+                }
+            }
+
+          log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * direction        : %d",direction);
+          log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * history          : 0x%x",history);
+
+          PORT_WRITE(out_PREDICT_DIRECTION [i],direction);
+          PORT_WRITE(out_PREDICT_HISTORY   [i],history  );
+        }
+
+    log_end(Two_Level_Branch_Predictor,FUNCTION);
+  };
+
+}; // end namespace two_level_branch_predictor
+}; // end namespace meta_predictor
+}; // end namespace direction
+}; // end namespace prediction_unit
+}; // end namespace front_end
+}; // end namespace multi_front_end
+}; // end namespace core
+
+}; // end namespace behavioural
+}; // end namespace morpheo              
+#endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_transition.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_transition.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_transition.cpp	(revision 111)
@@ -25,4 +25,180 @@
   {
     log_begin(Two_Level_Branch_Predictor,FUNCTION);
+    log_function(Two_Level_Branch_Predictor,FUNCTION,_name.c_str());
+
+    if (PORT_READ(in_NRESET) == 0)
+      {
+      }
+    else
+      {
+        // ===================================================================
+        // =====[ PREDICT ]===================================================
+        // ===================================================================
+
+        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
+          if (PORT_READ(in_PREDICT_VAL[i]) and internal_PREDICT_ACK[i])
+            {
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * PREDICT [%d]",i);
+
+              // Predict if 
+              //  * update_on_prediction and direction is valid
+              if (_param->_update_on_prediction)
+                if (PORT_READ(in_PREDICT_DIRECTION_VAL [i]))
+                  {
+                    Tcontrol_t direction = PORT_READ(in_PREDICT_DIRECTION [i]);
+                    
+                    if (_param->_have_bht)
+                      {
+                        Thistory_t bht_num_reg = internal_PREDICT_BHT_NUM_REG [i];
+                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_num_reg      : %d",bht_num_reg);
+
+                        Thistory_t bht_history = reg_BHT[bht_num_reg];
+                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",bht_history);
+
+                        
+                        bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
+                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (new): %x",bht_history);
+                        reg_BHT [bht_num_reg] = bht_history;
+                      }
+
+                    if (_param->_have_pht)
+                      {
+                        Thistory_t pht_num_reg = internal_PREDICT_PHT_NUM_REG  [i];
+                        Thistory_t pht_num_bank= internal_PREDICT_PHT_NUM_BANK [i];
+                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %d",pht_num_reg);
+                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %d",pht_num_bank);
+
+                        Thistory_t pht_history = reg_PHT [pht_num_bank][pht_num_reg];
+                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (old): %x",pht_history);
+                        
+                        // PHT : saturation counter
+                        pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history));
+                        
+                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (new): %x",pht_history);
+                        
+                        reg_PHT [pht_num_bank][pht_num_reg] = pht_history;
+                      }
+                  }
+            }        
+
+        // ===================================================================
+        // =====[ UPDATE ]====================================================
+        // ===================================================================
+        
+        for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
+          if (PORT_READ(in_UPDATE_VAL[i]) and internal_UPDATE_ACK[i])
+            {
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * UPDATE [%d]",i);
+              
+              // Update if 
+              //  * update_on_prediction and miss
+              //  * not update_on_prediction
+              if (not _param->_update_on_prediction or (_param->_update_on_prediction and PORT_READ(in_UPDATE_MISS [i])))
+                {
+                  Taddress_t address     = PORT_READ(in_UPDATE_ADDRESS   [i]);
+                  Thistory_t history     = PORT_READ(in_UPDATE_HISTORY   [i]);
+                  Tcontrol_t direction   = PORT_READ(in_UPDATE_DIRECTION [i])&1;
+
+                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * address          : %.8x",address);
+                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * direction        : %d",direction);
+
+                  Thistory_t pht_bht_history = 0;
+
+                  if (_param->_have_bht)
+                    {
+                      Thistory_t bht_history = (history>>_param->_bht_history_rshift)&_param->_bht_history_mask;
+                      Thistory_t bht_num_reg = address & _param->_bht_address_mask;
+                      
+                      pht_bht_history = bht_history;
+                      
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",bht_history);
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_num_reg      : %x",bht_num_reg);
+                      
+                      // BHT : shift register
+                      
+                      bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (new): %x",bht_history);
+                      reg_BHT [bht_num_reg]               = bht_history;
+                    }
+
+                  if (_param->_have_pht)
+                    {
+                      Thistory_t pht_history = (history>>_param->_pht_history_rshift)&_param->_pht_history_mask;
+                      Thistory_t pht_num_reg = pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift);
+                      Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask;
+                      
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",pht_bht_history);
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (old): %x",pht_history);
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %x",pht_num_reg);
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %x",pht_num_bank);
+                      
+                      // PHT : saturation counter
+                      pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history));
+                      
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (new): %x",pht_history);
+                      
+                      reg_PHT [pht_num_bank][pht_num_reg] = pht_history;
+                    }
+                }
+            }
+      }
+
+#if defined(DEBUG) and DEBUG_Two_Level_Branch_Predictor and (DEBUG >= DEBUG_TRACE)
+    if (0)
+    {
+      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * Dump Two_Level_Branch_Predictor");
+
+      if (_param->_have_bht)
+        {
+          log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * Dump BHT");
+
+          uint32_t limit = 4;
+
+          for (uint32_t i=0; i<_param->_bht_nb_shifter; i+=limit)
+            {
+              std::string str = "";
+
+              for (uint32_t j=0; j<limit; j++)
+                {
+                  uint32_t index = i+j;
+                  if (index >= _param->_bht_nb_shifter)
+                    break;
+                  else
+                    str+=toString("[%.4d] %.4x ",index,reg_BHT[index]);
+                }
+              
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    %s",str.c_str());
+            }
+        }
+
+      if (_param->_have_pht)
+        {
+          log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * Dump PHT");
+
+          uint32_t limit = 4;
+
+          for (uint32_t num_bank=0; num_bank <_param->_pht_nb_bank; ++num_bank)
+            {
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  [%.4d]",num_bank);
+
+              for (uint32_t i=0; i<_param->_pht_size_bank; i+=limit)
+                {
+                  std::string str = "";
+                  
+                  for (uint32_t j=0; j<limit; j++)
+                    {
+                      uint32_t index = i+j;
+                      if (index >= _param->_pht_nb_counter)
+                        break;
+                      else
+                        str+=toString("[%.4d] %.4x ",index,reg_PHT[num_bank][index]);
+                    }
+                  
+                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    %s",str.c_str());
+                }
+            }
+        }
+    }
+#endif
 
 #if defined(STATISTICS) or defined(VHDL_TESTBENCH)
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Meta_Predictor.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Meta_Predictor.h	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Meta_Predictor.h	(revision 111)
@@ -12,4 +12,7 @@
 #include "systemc.h"
 #endif
+
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h"
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h"
 
 #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Parameters.h"
@@ -65,5 +68,21 @@
   public    : SC_IN (Tcontrol_t)            *  in_NRESET       ;
 
+    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  public    : SC_IN (Tcontrol_t)           **  in_PREDICT_VAL          ;//[nb_inst_predict]
+  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_ACK          ;//[nb_inst_predict]
+  public    : SC_IN (Taddress_t)           **  in_PREDICT_ADDRESS      ;//[nb_inst_predict]
+  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_DIRECTION    ;//[nb_inst_predict] // = MSB[history]
+  public    : SC_OUT(Thistory_t)           ** out_PREDICT_HISTORY      ;//[nb_inst_predict]
+
+    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_VAL           ;//[nb_inst_update]
+  public    : SC_OUT(Tcontrol_t)           ** out_UPDATE_ACK           ;//[nb_inst_update]
+  public    : SC_IN (Taddress_t)           **  in_UPDATE_ADDRESS       ;//[nb_inst_update]
+  public    : SC_IN (Thistory_t)           **  in_UPDATE_HISTORY       ;//[nb_inst_update]
+  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_DIRECTION     ;//[nb_inst_update]
+
     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
+  private   : morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Two_Level_Branch_Predictor ** _component_two_level_branch_predictor;//[nb_predictor]
+  private   : morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue       ::Meta_Predictor_Glue         * _component_glue;
 
     // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Parameters.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Parameters.h	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Parameters.h	(revision 111)
@@ -9,6 +9,10 @@
  */
 
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h"
+#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Parameters.h"
+
 #include "Behavioural/include/Parameters.h"
 #include "Common/include/Debug.h"
+
 
 namespace morpheo {
@@ -25,7 +29,37 @@
   {
     //-----[ fields ]------------------------------------------------------------
+  public : uint32_t   _nb_inst_predict           ;
+  public : uint32_t   _nb_inst_update            ;
+  public : uint32_t   _size_address              ;
+  public : bool       _have_bht               [3];
+  public : uint32_t   _bht_size_shifter       [3];
+  public : uint32_t   _bht_nb_shifter         [3];
+  public : bool       _have_pht               [3];
+  public : uint32_t   _pht_size_counter       [3];
+  public : uint32_t   _pht_nb_counter         [3];
+  public : uint32_t   _pht_size_address_share [3];
+                     
+  public : bool       _have_meta_predictor       ;
+  public : uint32_t   _nb_predictor              ;
+
+  public : bool     * _predictor_update_on_prediction;//[nb_predictor]
+  public : uint32_t * _predictor_size_history        ;//[nb_predictor]
+  public : uint32_t   _size_history                  ;
+                        
+  public : morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters ** _param_two_level_branch_predictor;//[nb_predictor]
+  public : morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue       ::Parameters  * _param_glue;
 
     //-----[ methods ]-----------------------------------------------------------
-  public : Parameters  (bool is_toplevel=false);
+  public : Parameters  (uint32_t nb_inst_predict           ,
+			uint32_t nb_inst_update            ,
+			uint32_t size_address              ,
+                        bool     have_bht               [3],
+			uint32_t bht_size_shifter       [3],
+			uint32_t bht_nb_shifter         [3],
+			bool     have_pht               [3],
+			uint32_t pht_size_counter       [3],
+			uint32_t pht_nb_counter         [3],
+			uint32_t pht_size_address_share [3],
+                        bool     is_toplevel=false);
 //public : Parameters  (Parameters & param) ;
   public : ~Parameters (void);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Meta_Predictor_allocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Meta_Predictor_allocation.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Meta_Predictor_allocation.cpp	(revision 111)
@@ -18,6 +18,4 @@
 namespace meta_predictor {
 
-
-
 #undef  FUNCTION
 #define FUNCTION "Meta_Predictor::allocation"
@@ -57,9 +55,252 @@
       in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
     }
+
+    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    {
+      ALLOC1_INTERFACE("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict);
+
+      ALLOC1_VALACK_IN ( in_PREDICT_VAL          ,VAL);
+      ALLOC1_VALACK_OUT(out_PREDICT_ACK          ,ACK);
+      ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS      ,"ADDRESS"      ,Taddress_t,_param->_size_address);
+      ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
+      ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY      ,"HISTORY"      ,Thistory_t,_param->_size_history);
+    }
+
+    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    {
+      ALLOC1_INTERFACE("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update);
+
+      ALLOC1_VALACK_IN ( in_UPDATE_VAL           ,VAL);
+      ALLOC1_VALACK_OUT(out_UPDATE_ACK           ,ACK);
+      ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS       ,"ADDRESS"      ,Taddress_t,_param->_size_address);
+      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY       ,"HISTORY"      ,Thistory_t,_param->_size_history);
+      ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION     ,"DIRECTION"    ,Tcontrol_t,1                    );
+    }
     
     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    std::string name;
+
+    
+    {
+      _component_two_level_branch_predictor = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Two_Level_Branch_Predictor * [_param->_nb_predictor];
+
+      for (uint32_t i=0; i<_param->_nb_predictor; ++i)
+        {
+          name = _name+"_two_level_branch_predictor_"+toString(i);
+          log_printf(INFO,Meta_Predictor,FUNCTION,_("Create   : %s"),name.c_str());
+          
+          _component_two_level_branch_predictor [i] = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Two_Level_Branch_Predictor
+            (name.c_str()
+#ifdef STATISTICS
+             ,param_statistics
+#endif
+             ,_param->_param_two_level_branch_predictor[i]
+             ,_usage);
+          
+          _component->set_component (_component_two_level_branch_predictor[i]->_component
+#ifdef POSITION
+                                     , 50, 50, 10, 10
+#endif
+                                     );
+        }
+    }
+    
+    {
+      name = _name+"_glue";
+      log_printf(INFO,Meta_Predictor,FUNCTION,_("Create   : %s"),name.c_str());
+      
+      _component_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue::Meta_Predictor_Glue
+        (name.c_str()
+#ifdef STATISTICS
+         ,param_statistics
+#endif
+         ,_param->_param_glue
+         ,_usage);
+      
+      _component->set_component (_component_glue->_component
+#ifdef POSITION
+                                 , 50, 50, 10, 10
+#endif
+                                 );
+    }
     
     // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
     std::string src,dest;
+
+    // ===================================================================
+    // =====[ Two_Level_Branch_Predictor ]================================
+    // ===================================================================
+    
+    for (uint32_t i=0; i<_param->_nb_predictor; ++i)
+    {
+      src = _name+"_two_level_branch_predictor_"+toString(i);
+      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
+      
+      {
+        dest = _name;
+#ifdef POSITION
+        _component->interface_map (src ,"",
+                                   dest,"");
+#endif
+
+        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
+        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
+      }
+
+      // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+      for (uint32_t j=0; j<_param->_nb_inst_predict; ++j)
+        {
+          dest = _name;
+
+#ifdef POSITION
+          _component->interface_map (src ,"predict_"+toString(j),
+                                     dest,"predict_"+toString(j));
+#endif
+
+          PORT_MAP(_component,src , "in_PREDICT_"+toString(j)+"_ADDRESS"      ,
+                              dest, "in_PREDICT_"+toString(j)+"_ADDRESS"      );
+
+          dest = _name+"_glue";
+
+#ifdef POSITION
+          _component->interface_map (src ,"predict_"+toString(j),
+                                     dest,"predict_predictor_"+toString(i)+"_"+toString(j));
+#endif
+
+          COMPONENT_MAP(_component,src , "in_PREDICT_"                          +toString(j)+"_VAL"          ,
+                                   dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_VAL"          );
+          COMPONENT_MAP(_component,src ,"out_PREDICT_"                          +toString(j)+"_ACK"          ,
+                                   dest, "in_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ACK"          );
+//        COMPONENT_MAP(_component,src , "in_PREDICT_"                          +toString(j)+"_ADDRESS"      ,
+//                                 dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ADDRESS"      );
+          COMPONENT_MAP(_component,src ,"out_PREDICT_"                          +toString(j)+"_DIRECTION"    ,
+                                   dest, "in_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION"    );
+          COMPONENT_MAP(_component,src ,"out_PREDICT_"                          +toString(j)+"_HISTORY"      ,
+                                   dest, "in_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_HISTORY"      );
+          if (_param->_predictor_update_on_prediction [i])
+            {
+          COMPONENT_MAP(_component,src , "in_PREDICT_"                          +toString(j)+"_DIRECTION_VAL",
+                                   dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION_VAL");
+          COMPONENT_MAP(_component,src , "in_PREDICT_"                          +toString(j)+"_DIRECTION"    ,
+                                   dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION"    );
+            }
+        }
+
+      // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+      for (uint32_t j=0; j<_param->_nb_inst_update; ++j)
+        {
+          dest = _name;
+
+#ifdef POSITION
+          _component->interface_map (src ,"update_"+toString(j),
+                                     dest,"update_"+toString(j));
+#endif
+
+          PORT_MAP(_component,src , "in_UPDATE_"+toString(j)+"_ADDRESS"      ,
+                              dest, "in_UPDATE_"+toString(j)+"_ADDRESS"      );
+
+          dest = _name+"_glue";
+
+#ifdef POSITION
+          _component->interface_map (src ,"update_"+toString(j),
+                                     dest,"update_predictor_"+toString(i)+"_"+toString(j));
+#endif
+
+          COMPONENT_MAP(_component,src , "in_UPDATE_"                          +toString(j)+"_VAL"          ,
+                                   dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_VAL"          );
+          COMPONENT_MAP(_component,src ,"out_UPDATE_"                          +toString(j)+"_ACK"          ,
+                                   dest, "in_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ACK"          );
+//        COMPONENT_MAP(_component,src , "in_UPDATE_"                          +toString(j)+"_ADDRESS"      ,
+//                                 dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ADDRESS"      );
+          COMPONENT_MAP(_component,src , "in_UPDATE_"                          +toString(j)+"_DIRECTION"    ,
+                                   dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION"    );
+          COMPONENT_MAP(_component,src , "in_UPDATE_"                          +toString(j)+"_HISTORY"      ,
+                                   dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_HISTORY"      );
+          if (_param->_predictor_update_on_prediction [i])
+          COMPONENT_MAP(_component,src , "in_UPDATE_"                          +toString(j)+"_MISS"         ,
+                                   dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_MISS"         );
+        }
+//     // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//   public    : SC_IN (Tcontrol_t)           **  in_UPDATE_VAL           ;//[nb_inst_update]
+//   public    : SC_OUT(Tcontrol_t)           ** out_UPDATE_ACK           ;//[nb_inst_update]
+//   public    : SC_IN (Taddress_t)           **  in_UPDATE_ADDRESS       ;//[nb_inst_update]
+//   public    : SC_IN (Thistory_t)           **  in_UPDATE_HISTORY       ;//[nb_inst_update]
+//   public    : SC_IN (Tcontrol_t)           **  in_UPDATE_DIRECTION     ;//[nb_inst_update]
+//   public    : SC_IN (Tcontrol_t)           **  in_UPDATE_MISS          ;//[nb_inst_update] // if update_on_prediction
+
+    }
+      
+    // ===================================================================    
+    // =====[ Glue ]======================================================    
+    // ===================================================================    
+
+    {
+      src = _name+"_glue";
+      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
+      
+      {
+        dest = _name;
+#ifdef POSITION
+        _component->interface_map (src ,"",
+                                   dest,"");
+#endif
+
+        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
+        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
+      }
+
+      // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+      for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
+        {
+          dest = _name;
+#ifdef POSITION
+          _component->interface_map (src ,"predict_"+toString(i),
+                                     dest,"predict_"+toString(i));
+#endif
+           
+          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VAL"      ,
+                              dest, "in_PREDICT_"+toString(i)+"_VAL"      );
+          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ACK"      ,
+                              dest,"out_PREDICT_"+toString(i)+"_ACK"      );
+          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_HISTORY"  ,
+                              dest,"out_PREDICT_"+toString(i)+"_HISTORY"  );
+          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_DIRECTION",
+                              dest,"out_PREDICT_"+toString(i)+"_DIRECTION");
+        }
+
+      //  out_PREDICT_PREDICTOR_VAL           -> two_level_branch_predictor. in_PREDICT_PREDICTOR_VAL          
+      //   in_PREDICT_PREDICTOR_ACK           -> two_level_branch_predictor.out_PREDICT_PREDICTOR_ACK          
+      //   in_PREDICT_PREDICTOR_HISTORY       -> two_level_branch_predictor.out_PREDICT_PREDICTOR_HISTORY      
+      //   in_PREDICT_PREDICTOR_DIRECTION     -> two_level_branch_predictor.out_PREDICT_PREDICTOR_DIRECTION    
+      //  out_PREDICT_PREDICTOR_DIRECTION_VAL -> two_level_branch_predictor. in_PREDICT_PREDICTOR_DIRECTION_VAL
+      //  out_PREDICT_PREDICTOR_DIRECTION     -> two_level_branch_predictor. in_PREDICT_PREDICTOR_DIRECTION    
+
+      // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+      for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
+        {
+          dest = _name;
+#ifdef POSITION
+          _component->interface_map (src ,"update_"+toString(i),
+                                     dest,"update_"+toString(i));
+#endif
+
+          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VAL"      ,
+                              dest, "in_UPDATE_"+toString(i)+"_VAL"      );
+          PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_ACK"      ,
+                              dest,"out_UPDATE_"+toString(i)+"_ACK"      );
+          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_HISTORY"  ,
+                              dest, "in_UPDATE_"+toString(i)+"_HISTORY"  );
+          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_DIRECTION",
+                              dest, "in_UPDATE_"+toString(i)+"_DIRECTION");
+        }
+      
+      //  out_UPDATE_PREDICTOR_VAL       -> two_level_branch_predictor. in_UPDATE_PREDICTOR_VAL      
+      //   in_UPDATE_PREDICTOR_ACK       -> two_level_branch_predictor.out_UPDATE_PREDICTOR_ACK      
+      //  out_UPDATE_PREDICTOR_HISTORY   -> two_level_branch_predictor. in_UPDATE_PREDICTOR_HISTORY  
+      //  out_UPDATE_PREDICTOR_DIRECTION -> two_level_branch_predictor. in_UPDATE_PREDICTOR_DIRECTION
+      //  out_UPDATE_PREDICTOR_MISS      -> two_level_branch_predictor. in_UPDATE_PREDICTOR_MISS     
+
+    }
 
     // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Meta_Predictor_deallocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Meta_Predictor_deallocation.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Meta_Predictor_deallocation.cpp	(revision 111)
@@ -29,8 +29,24 @@
 	delete    in_CLOCK ;
 	delete    in_NRESET;
+
+        DELETE1_SIGNAL( in_PREDICT_VAL          ,_param->_nb_inst_predict,1                    );
+        DELETE1_SIGNAL(out_PREDICT_ACK          ,_param->_nb_inst_predict,1                    );
+        DELETE1_SIGNAL( in_PREDICT_ADDRESS      ,_param->_nb_inst_predict,_param->_size_address);
+        DELETE1_SIGNAL(out_PREDICT_DIRECTION    ,_param->_nb_inst_predict,1                    );
+        DELETE1_SIGNAL(out_PREDICT_HISTORY      ,_param->_nb_inst_predict,_param->_size_history);
+        
+        DELETE1_SIGNAL( in_UPDATE_VAL           ,_param->_nb_inst_update,1                    );
+        DELETE1_SIGNAL(out_UPDATE_ACK           ,_param->_nb_inst_update,1                    );
+        DELETE1_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update,_param->_size_address);
+        DELETE1_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update,_param->_size_history);
+        DELETE1_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update,1                    );
       }
     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
 
+    DELETE0(_component_glue);
+    DELETE1(_component_two_level_branch_predictor,_param->_nb_predictor);
+
     delete _component;
+
 
     log_end(Meta_Predictor,FUNCTION);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Parameters.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Parameters.cpp	(revision 110)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Parameters.cpp	(revision 111)
@@ -7,4 +7,5 @@
 
 #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Parameters.h"
+#include "Behavioural/include/Allocation.h"
 
 namespace morpheo {
@@ -20,10 +21,78 @@
 #undef  FUNCTION
 #define FUNCTION "Meta_Predictor::Parameters"
-  Parameters::Parameters (bool is_toplevel)
+  Parameters::Parameters (uint32_t nb_inst_predict           ,
+                          uint32_t nb_inst_update            ,
+                          uint32_t size_address              ,
+                          bool     have_bht               [3],
+                          uint32_t bht_size_shifter       [3],
+                          uint32_t bht_nb_shifter         [3],
+                          bool     have_pht               [3],
+                          uint32_t pht_size_counter       [3],
+                          uint32_t pht_nb_counter         [3],
+                          uint32_t pht_size_address_share [3],
+                          bool     is_toplevel)
   {
     log_begin(Meta_Predictor,FUNCTION);
 
+    _nb_inst_predict            = nb_inst_predict           ;
+    _nb_inst_update             = nb_inst_update            ;
+    _size_address               = size_address              ;
+    for (uint32_t i=0; i<3; ++i)
+      {
+    _have_bht               [i] =                 have_bht               [i];
+    _bht_size_shifter       [i] = (_have_bht [i])?bht_size_shifter       [i]:0;
+    _bht_nb_shifter         [i] = (_have_bht [i])?bht_nb_shifter         [i]:0;
+    _have_pht               [i] =                 have_pht               [i];
+    _pht_size_counter       [i] = (_have_pht [i])?pht_size_counter       [i]:0;
+    _pht_nb_counter         [i] = (_have_pht [i])?pht_nb_counter         [i]:0;
+    _pht_size_address_share [i] = (_have_bht[i] and _have_pht [i])?pht_size_address_share [i]:0;
+      }
+
     test();
 
+    _have_meta_predictor        = (_have_bht [2] or _have_pht [2]);
+    _nb_predictor               = (_have_meta_predictor)?3:1;
+    
+    ALLOC1(_predictor_update_on_prediction,bool    , _nb_predictor);
+    ALLOC1(_predictor_size_history        ,uint32_t, _nb_predictor);
+    
+    // All predictor can update on prediction ....
+    for (uint32_t i=0; i<_nb_predictor; ++i)
+      _predictor_update_on_prediction [i] = true;
+
+    // ... But the selector prediction can't
+    if (_have_meta_predictor)
+      _predictor_update_on_prediction [_nb_predictor-1] = false;
+
+    _param_two_level_branch_predictor = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters * [_nb_predictor];
+    for (uint32_t i=0; i<_nb_predictor; ++i)
+      {
+        _param_two_level_branch_predictor [i] = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters
+          (_nb_inst_predict                   ,
+           _nb_inst_update                    ,
+           _size_address                      ,
+           _have_bht                       [i],
+           _bht_size_shifter               [i],
+           _bht_nb_shifter                 [i],
+           _have_pht                       [i],
+           _pht_size_counter               [i],
+           _pht_nb_counter                 [i],
+           _pht_size_address_share         [i],
+           _predictor_update_on_prediction [i]
+           );
+
+        _predictor_size_history [i] = _param_two_level_branch_predictor [i]->_size_history;
+      }
+
+    _param_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue::Parameters  
+      (
+       _nb_inst_predict               ,
+       _nb_inst_update                ,
+       _nb_predictor                  ,
+       _predictor_size_history        ,
+       _predictor_update_on_prediction
+       );
+    _size_history = _param_glue->_size_history;
+    
     if (is_toplevel)
       {
@@ -48,4 +117,10 @@
   {
     log_begin(Meta_Predictor,FUNCTION);
+
+    DELETE1(_param_two_level_branch_predictor, _nb_predictor);
+
+    DELETE1(_predictor_size_history          , _nb_predictor);
+    DELETE1(_predictor_update_on_prediction  , _nb_predictor);
+
     log_end(Meta_Predictor,FUNCTION);
   };
@@ -56,4 +131,9 @@
   {
     log_begin(Meta_Predictor,FUNCTION);
+
+    COPY(_param_glue);
+    for (uint32_t i=0; i<_nb_predictor; ++i)
+      COPY(_param_two_level_branch_predictor [i]);
+
     log_end(Meta_Predictor,FUNCTION);
   };
