Ignore:
Timestamp:
Feb 27, 2009, 7:37:40 PM (15 years ago)
Author:
rosiere
Message:

1) Decod_queue : multi implementation (one_fifo, multi_fifo)
2) Issue_queue : multi implementation (in_order, out_of_order)
3) Direction : Add Meta predictor
4) Context_State : re add Branch_complete, More priority to Load miss (is not speculative)
5) Return_Address_Stack : update reg_PREDICT pointer on decod miss prediction
6) UPT : Fix bug in multi event
7) Prediction_glue : in read_stack case, insert in UPT pc_next
8) Rename select : when rob have an event (need flush), read_r{a,b,c} and write_r{d,e} is set at 0

Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor
Files:
8 added
27 edited
3 moved

Legend:

Unmodified
Added
Removed
  • 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

    r110 r111  
    11Meta_Predictor_Glue
     24       4       +1 # nb_inst_predict
     34       4       +1 # nb_inst_update
     43       3       +1 # nb_predictor                   
     58       8       +1 # predictor_size_history         [0] [nb_predictor]
     617      17      +1 # predictor_size_history         [1] [nb_predictor]
     74       4       +1 # predictor_size_history         [2] [nb_predictor]
     81       1       +1 # predictor_update_on_prediction [0] [nb_predictor]
     91       1       +1 # predictor_update_on_prediction [1] [nb_predictor]
     100       0       +1 # predictor_update_on_prediction [2] [nb_predictor]
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/main.cpp

    r110 r111  
    77
    88#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/include/test.h"
     9#include "Behavioural/include/Selftest.h"
    910
    10 #define NB_PARAMS 0
     11#define NB_PARAMS 3
    1112
    1213void usage (int argc, char * argv[])
     
    1415  err (_("<Usage> %s name_instance list_params.\n"),argv[0]);
    1516  err (_("list_params is :\n"));
    16   err (_(" *  ()\n"));
     17  err (_(" * nb_inst_predict                               (uint32_t)\n"));
     18  err (_(" * nb_inst_update                                (uint32_t)\n"));
     19  err (_(" * nb_predictor                                  (uint32_t)\n"));
     20  err (_(" * predictor_size_history         [nb_predictor] (uint32_t)\n"));
     21  err (_(" * predictor_update_on_prediction [nb_predictor] (bool    )\n"));
    1722
    1823  exit (1);
     
    2530#endif
    2631{
    27   if (argc != static_cast<int>(2+NB_PARAMS))
     32  if (argc <= static_cast<int>(2+NB_PARAMS))
    2833    usage (argc, argv);
    2934
     
    3237  string name = argv[x++];
    3338
     39  uint32_t   _nb_inst_predict               ;
     40  uint32_t   _nb_inst_update                ;
     41  uint32_t   _nb_predictor                  ;
     42  uint32_t * _predictor_size_history        ;//[nb_predictor]
     43  bool     * _predictor_update_on_prediction;//[nb_predictor]
     44
     45  SELFTEST0(_nb_inst_predict               ,uint32_t,argv,x);
     46  SELFTEST0(_nb_inst_update                ,uint32_t,argv,x);
     47  SELFTEST0(_nb_predictor                  ,uint32_t,argv,x);
     48
     49  if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_predictor))
     50    usage (argc, argv);
     51
     52  SELFTEST1(_predictor_size_history        ,uint32_t,argv,x,_nb_predictor);
     53  SELFTEST1(_predictor_update_on_prediction,bool    ,argv,x,_nb_predictor);
     54 
    3455  int _return = EXIT_SUCCESS;
    3556  try
     
    3758      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
    3859        (
     60         _nb_inst_predict               ,
     61         _nb_inst_update                ,
     62         _nb_predictor                  ,
     63         _predictor_size_history        ,
     64         _predictor_update_on_prediction,
    3965         true //is_toplevel
    4066        );
     
    6389    }
    6490
     91  DELETE1(_predictor_update_on_prediction,_param->_nb_predictor);
     92  DELETE1(_predictor_size_history        ,_param->_nb_predictor);
     93
    6594  return (_return);
    6695}
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/test.cpp

    r110 r111  
    5151  sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
    5252 
     53  ALLOC1_SC_SIGNAL( in_PREDICT_VAL                    ," in_PREDICT_VAL                    ",Tcontrol_t,_param->_nb_inst_predict);
     54  ALLOC1_SC_SIGNAL(out_PREDICT_ACK                    ,"out_PREDICT_ACK                    ",Tcontrol_t,_param->_nb_inst_predict);
     55  ALLOC1_SC_SIGNAL(out_PREDICT_HISTORY                ,"out_PREDICT_HISTORY                ",Thistory_t,_param->_nb_inst_predict);
     56  ALLOC1_SC_SIGNAL(out_PREDICT_DIRECTION              ,"out_PREDICT_DIRECTION              ",Tcontrol_t,_param->_nb_inst_predict);
     57  ALLOC2_SC_SIGNAL(out_PREDICT_PREDICTOR_VAL          ,"out_PREDICT_PREDICTOR_VAL          ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_predict);
     58  ALLOC2_SC_SIGNAL( in_PREDICT_PREDICTOR_ACK          ," in_PREDICT_PREDICTOR_ACK          ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_predict);
     59  ALLOC2_SC_SIGNAL( in_PREDICT_PREDICTOR_HISTORY      ," in_PREDICT_PREDICTOR_HISTORY      ",Thistory_t,_param->_nb_predictor,_param->_nb_inst_predict);
     60  ALLOC2_SC_SIGNAL( in_PREDICT_PREDICTOR_DIRECTION    ," in_PREDICT_PREDICTOR_DIRECTION    ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_predict);
     61  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
     62  ALLOC2_SC_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION    ,"out_PREDICT_PREDICTOR_DIRECTION    ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_predict); // if update_on_prediction
     63  ALLOC1_SC_SIGNAL( in_UPDATE_VAL                     ," in_UPDATE_VAL                     ",Tcontrol_t,_param->_nb_inst_update);
     64  ALLOC1_SC_SIGNAL(out_UPDATE_ACK                     ,"out_UPDATE_ACK                     ",Tcontrol_t,_param->_nb_inst_update);
     65  ALLOC1_SC_SIGNAL( in_UPDATE_HISTORY                 ," in_UPDATE_HISTORY                 ",Thistory_t,_param->_nb_inst_update);
     66  ALLOC1_SC_SIGNAL( in_UPDATE_DIRECTION               ," in_UPDATE_DIRECTION               ",Tcontrol_t,_param->_nb_inst_update);
     67  ALLOC2_SC_SIGNAL(out_UPDATE_PREDICTOR_VAL           ,"out_UPDATE_PREDICTOR_VAL           ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_update);
     68  ALLOC2_SC_SIGNAL( in_UPDATE_PREDICTOR_ACK           ," in_UPDATE_PREDICTOR_ACK           ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_update);
     69  ALLOC2_SC_SIGNAL(out_UPDATE_PREDICTOR_HISTORY       ,"out_UPDATE_PREDICTOR_HISTORY       ",Thistory_t,_param->_nb_predictor,_param->_nb_inst_update);
     70  ALLOC2_SC_SIGNAL(out_UPDATE_PREDICTOR_DIRECTION     ,"out_UPDATE_PREDICTOR_DIRECTION     ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_update);
     71  ALLOC2_SC_SIGNAL(out_UPDATE_PREDICTOR_MISS          ,"out_UPDATE_PREDICTOR_MISS          ",Tcontrol_t,_param->_nb_predictor,_param->_nb_inst_update);
     72
    5373  /********************************************************
    5474   * Instanciation
     
    6080  (*(_Meta_Predictor_Glue->in_NRESET))       (*(in_NRESET));
    6181
     82  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue, in_PREDICT_VAL                    ,_param->_nb_inst_predict);
     83  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_ACK                    ,_param->_nb_inst_predict);
     84  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_HISTORY                ,_param->_nb_inst_predict);
     85  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_DIRECTION              ,_param->_nb_inst_predict);
     86
     87  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_PREDICTOR_VAL          ,_param->_nb_predictor,_param->_nb_inst_predict);
     88  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue, in_PREDICT_PREDICTOR_ACK          ,_param->_nb_predictor,_param->_nb_inst_predict);
     89  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue, in_PREDICT_PREDICTOR_HISTORY      ,_param->_nb_predictor,_param->_nb_inst_predict);
     90  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue, in_PREDICT_PREDICTOR_DIRECTION    ,_param->_nb_predictor,_param->_nb_inst_predict);
     91 
     92  for (uint32_t i=0; i<_param->_nb_predictor; ++i)
     93    if (_param->_predictor_update_on_prediction [i])
     94      {
     95  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_PREDICTOR_DIRECTION_VAL[i],_param->_nb_inst_predict);
     96  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_PREDICT_PREDICTOR_DIRECTION    [i],_param->_nb_inst_predict);
     97      }
     98
     99  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue, in_UPDATE_VAL                     ,_param->_nb_inst_update);
     100  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_UPDATE_ACK                     ,_param->_nb_inst_update);
     101  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue, in_UPDATE_HISTORY                 ,_param->_nb_inst_update);
     102  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue, in_UPDATE_DIRECTION               ,_param->_nb_inst_update);
     103
     104  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue,out_UPDATE_PREDICTOR_VAL           ,_param->_nb_predictor,_param->_nb_inst_update);
     105  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue, in_UPDATE_PREDICTOR_ACK           ,_param->_nb_predictor,_param->_nb_inst_update);
     106  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue,out_UPDATE_PREDICTOR_HISTORY       ,_param->_nb_predictor,_param->_nb_inst_update);
     107  INSTANCE2_SC_SIGNAL(_Meta_Predictor_Glue,out_UPDATE_PREDICTOR_DIRECTION     ,_param->_nb_predictor,_param->_nb_inst_update);
     108  for (uint32_t i=0; i<_param->_nb_predictor; ++i)
     109    if (_param->_predictor_update_on_prediction [i])
     110  INSTANCE1_SC_SIGNAL(_Meta_Predictor_Glue,out_UPDATE_PREDICTOR_MISS [i]                            ,_param->_nb_inst_update);
    62111
    63112  msg(_("<%s> : Start Simulation ............\n"),name.c_str());
     
    104153  delete in_CLOCK;
    105154  delete in_NRESET;
     155
     156  DELETE1_SC_SIGNAL( in_PREDICT_VAL                    ,_param->_nb_inst_predict);
     157  DELETE1_SC_SIGNAL(out_PREDICT_ACK                    ,_param->_nb_inst_predict);
     158  DELETE1_SC_SIGNAL(out_PREDICT_HISTORY                ,_param->_nb_inst_predict);
     159  DELETE1_SC_SIGNAL(out_PREDICT_DIRECTION              ,_param->_nb_inst_predict);
     160
     161  DELETE2_SC_SIGNAL(out_PREDICT_PREDICTOR_VAL          ,_param->_nb_predictor,_param->_nb_inst_predict);
     162  DELETE2_SC_SIGNAL( in_PREDICT_PREDICTOR_ACK          ,_param->_nb_predictor,_param->_nb_inst_predict);
     163  DELETE2_SC_SIGNAL( in_PREDICT_PREDICTOR_HISTORY      ,_param->_nb_predictor,_param->_nb_inst_predict);
     164  DELETE2_SC_SIGNAL( in_PREDICT_PREDICTOR_DIRECTION    ,_param->_nb_predictor,_param->_nb_inst_predict);
     165  DELETE2_SC_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION_VAL,_param->_nb_predictor,_param->_nb_inst_predict);
     166  DELETE2_SC_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION    ,_param->_nb_predictor,_param->_nb_inst_predict);
     167
     168  DELETE1_SC_SIGNAL( in_UPDATE_VAL                     ,_param->_nb_inst_update);
     169  DELETE1_SC_SIGNAL(out_UPDATE_ACK                     ,_param->_nb_inst_update);
     170  DELETE1_SC_SIGNAL( in_UPDATE_HISTORY                 ,_param->_nb_inst_update);
     171  DELETE1_SC_SIGNAL( in_UPDATE_DIRECTION               ,_param->_nb_inst_update);
     172
     173  DELETE2_SC_SIGNAL(out_UPDATE_PREDICTOR_VAL           ,_param->_nb_predictor,_param->_nb_inst_update);
     174  DELETE2_SC_SIGNAL( in_UPDATE_PREDICTOR_ACK           ,_param->_nb_predictor,_param->_nb_inst_update);
     175  DELETE2_SC_SIGNAL(out_UPDATE_PREDICTOR_HISTORY       ,_param->_nb_predictor,_param->_nb_inst_update);
     176  DELETE2_SC_SIGNAL(out_UPDATE_PREDICTOR_DIRECTION     ,_param->_nb_predictor,_param->_nb_inst_update);
     177  DELETE2_SC_SIGNAL(out_UPDATE_PREDICTOR_MISS          ,_param->_nb_predictor,_param->_nb_inst_update);
    106178    }
    107179#endif
  • 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

    r110 r111  
    6666  public    : SC_IN (Tcontrol_t)            *  in_NRESET       ;
    6767
     68    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     69  public    : SC_IN (Tcontrol_t)           **  in_PREDICT_VAL                    ;//              [nb_inst_predict]
     70  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_ACK                    ;//              [nb_inst_predict]
     71  public    : SC_OUT(Thistory_t)           ** out_PREDICT_HISTORY                ;//              [nb_inst_predict]
     72  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_DIRECTION              ;//              [nb_inst_predict]
     73
     74  public    : SC_OUT(Tcontrol_t)          *** out_PREDICT_PREDICTOR_VAL          ;//[nb_predictor][nb_inst_predict]
     75  public    : SC_IN (Tcontrol_t)          ***  in_PREDICT_PREDICTOR_ACK          ;//[nb_predictor][nb_inst_predict]
     76  public    : SC_IN (Thistory_t)          ***  in_PREDICT_PREDICTOR_HISTORY      ;//[nb_predictor][nb_inst_predict]
     77  public    : SC_IN (Tcontrol_t)          ***  in_PREDICT_PREDICTOR_DIRECTION    ;//[nb_predictor][nb_inst_predict]
     78  public    : SC_OUT(Tcontrol_t)          *** out_PREDICT_PREDICTOR_DIRECTION_VAL;//[nb_predictor][nb_inst_predict] // if update_on_prediction
     79  public    : SC_OUT(Tcontrol_t)          *** out_PREDICT_PREDICTOR_DIRECTION    ;//[nb_predictor][nb_inst_predict] // if update_on_prediction
     80
     81    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     82  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_VAL                     ;//              [nb_inst_update]
     83  public    : SC_OUT(Tcontrol_t)           ** out_UPDATE_ACK                     ;//              [nb_inst_update]
     84  public    : SC_IN (Thistory_t)           **  in_UPDATE_HISTORY                 ;//              [nb_inst_update]
     85  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_DIRECTION               ;//              [nb_inst_update]
     86
     87  public    : SC_OUT(Tcontrol_t)          *** out_UPDATE_PREDICTOR_VAL           ;//[nb_predictor][nb_inst_update]
     88  public    : SC_IN (Tcontrol_t)          ***  in_UPDATE_PREDICTOR_ACK           ;//[nb_predictor][nb_inst_update]
     89  public    : SC_OUT(Thistory_t)          *** out_UPDATE_PREDICTOR_HISTORY       ;//[nb_predictor][nb_inst_update]
     90  public    : SC_OUT(Tcontrol_t)          *** out_UPDATE_PREDICTOR_DIRECTION     ;//[nb_predictor][nb_inst_update]
     91  public    : SC_OUT(Tcontrol_t)          *** out_UPDATE_PREDICTOR_MISS          ;//[nb_predictor][nb_inst_update] // if update_on_prediction
     92
    6893    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    6994
     
    105130  public  : void        transition                (void);
    106131//public  : void        genMoore                  (void);
     132
     133  public  : void        genMealy_predict_valack   (void);
     134  public  : void        genMealy_predict          (void);
     135
     136  public  : void        genMealy_update_valack    (void);
     137  public  : void        genMealy_update           (void);
    107138#endif                                         
    108139
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Parameters.h

    r110 r111  
    1111#include "Behavioural/include/Parameters.h"
    1212#include "Common/include/Debug.h"
     13#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Types.h"
    1314
    1415namespace morpheo {
     
    2627  {
    2728    //-----[ fields ]------------------------------------------------------------
     29  public : uint32_t     _nb_inst_predict               ;
     30  public : uint32_t     _nb_inst_update                ;
     31  public : uint32_t     _nb_predictor                  ;
     32  public : uint32_t   * _predictor_size_history        ;//[nb_predictor]
     33  public : bool       * _predictor_update_on_prediction;//[nb_predictor]
     34                     
     35  public : uint32_t     _size_history                  ;
     36  public : uint32_t   * _predictor_history_shift       ;//[nb_predictor]
     37  public : uint32_t   * _predictor_history_shift_msb   ;//[nb_predictor]
     38  public : Thistory_t * _predictor_history_mask        ;//[nb_predictor]   
     39
    2840
    2941    //-----[ methods ]-----------------------------------------------------------
    30   public : Parameters  (bool is_toplevel=false);
     42  public : Parameters  (uint32_t   nb_inst_predict               ,
     43                        uint32_t   nb_inst_update                ,
     44                        uint32_t   nb_predictor                  ,
     45                        uint32_t * predictor_size_history        ,//[nb_predictor]
     46                        bool     * predictor_update_on_prediction,//[nb_predictor]
     47                        bool       is_toplevel=false);
    3148//public : Parameters  (Parameters & param) ;
    3249  public : ~Parameters (void);
  • 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

    r110 r111  
    8282# endif   
    8383
    84 //      log_printf(INFO,Meta_Predictor_Glue,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str());
     84        log_printf(INFO,Meta_Predictor_Glue,FUNCTION,_("<%s> : Method - genMealy_update_valack"),_name.c_str());
    8585
    86 //      SC_METHOD (genMoore);
    87 //      dont_initialize ();
    88 //      sensitive << (*(in_CLOCK)).neg(); // need internal register
    89        
    90 // # ifdef SYSTEMCASS_SPECIFIC
    91 //      // List dependency information
    92 // # endif   
     86        SC_METHOD (genMealy_update_valack);
     87        dont_initialize ();
     88//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
     89        for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
     90          {
     91            sensitive << (*(in_UPDATE_VAL [i]));
     92
     93            for (uint32_t j=0; j<_param->_nb_predictor; ++j)
     94              sensitive << (*(in_UPDATE_PREDICTOR_ACK [j][i]));
     95          }
     96
     97        log_printf(INFO,Meta_Predictor_Glue,FUNCTION,_("<%s> : Method - genMealy_update"),_name.c_str());
     98
     99        SC_METHOD (genMealy_update);
     100        dont_initialize ();
     101//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
     102        for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
     103          sensitive << (*(in_UPDATE_HISTORY   [i]))
     104                    << (*(in_UPDATE_DIRECTION [i]));
     105
     106# ifdef SYSTEMCASS_SPECIFIC
     107        // List dependency information
     108# endif   
     109
     110        log_printf(INFO,Meta_Predictor_Glue,FUNCTION,_("<%s> : Method - genMealy_predict_valack"),_name.c_str());
     111
     112        SC_METHOD (genMealy_predict_valack);
     113        dont_initialize ();
     114//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
     115        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     116          {
     117            sensitive << (*(in_PREDICT_VAL [i]));
     118
     119            for (uint32_t j=0; j<_param->_nb_predictor; ++j)
     120              sensitive << (*(in_PREDICT_PREDICTOR_ACK [j][i]));
     121          }
     122
     123# ifdef SYSTEMCASS_SPECIFIC
     124        // List dependency information
     125# endif   
     126
     127        log_printf(INFO,Meta_Predictor_Glue,FUNCTION,_("<%s> : Method - genMealy_predict"),_name.c_str());
     128
     129        SC_METHOD (genMealy_predict);
     130        dont_initialize ();
     131//      sensitive << (*(in_CLOCK)).neg(); // don't need internal register
     132        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     133          for (uint32_t j=0; j<_param->_nb_predictor; ++j)
     134            sensitive << (*(in_PREDICT_PREDICTOR_HISTORY   [j][i]))
     135                      << (*(in_PREDICT_PREDICTOR_DIRECTION [j][i]));
     136
     137# ifdef SYSTEMCASS_SPECIFIC
     138        // List dependency information
     139# endif   
    93140       
    94141#endif
  • 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

    r110 r111  
    5858      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
    5959    }
     60
     61    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     62    {
     63      ALLOC1_INTERFACE("predict",IN,NORTH,_("Predict next address"),_param->_nb_inst_predict);
     64
     65      ALLOC1_SIGNAL_IN ( in_PREDICT_VAL                    ,"VAL"          ,Tcontrol_t,1);
     66      ALLOC1_SIGNAL_OUT(out_PREDICT_ACK                    ,"ACK"          ,Tcontrol_t,1);
     67      ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY                ,"HISTORY"      ,Thistory_t,_param->_size_history);
     68      ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION              ,"DIRECTION"    ,Tcontrol_t,1);
     69    }
     70
     71    {
     72      ALLOC2_INTERFACE("predict_predictor",IN,NORTH,_("Predict next address"),_param->_nb_predictor,_param->_nb_inst_predict);
     73     
     74      ALLOC2_SIGNAL_OUT(out_PREDICT_PREDICTOR_VAL          ,"VAL"          ,Tcontrol_t,1);
     75      ALLOC2_SIGNAL_IN ( in_PREDICT_PREDICTOR_ACK          ,"ACK"          ,Tcontrol_t,1);
     76      ALLOC2_SIGNAL_IN ( in_PREDICT_PREDICTOR_HISTORY      ,"HISTORY"      ,Thistory_t,_param->_predictor_size_history[it1]);
     77      ALLOC2_SIGNAL_IN ( in_PREDICT_PREDICTOR_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1);
     78      ALLOC2_SIGNAL_OUT(out_PREDICT_PREDICTOR_DIRECTION_VAL,"DIRECTION_VAL",Tcontrol_t,(_param->_predictor_update_on_prediction [it1])?1:0);
     79      ALLOC2_SIGNAL_OUT(out_PREDICT_PREDICTOR_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,(_param->_predictor_update_on_prediction [it1])?1:0);
     80    }
     81
     82    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     83    {
     84      ALLOC1_INTERFACE("update",IN,NORTH,_("Update predictor"),_param->_nb_inst_update);
     85     
     86      ALLOC1_SIGNAL_IN ( in_UPDATE_VAL                     ,"VAL"          ,Tcontrol_t,1);
     87      ALLOC1_SIGNAL_OUT(out_UPDATE_ACK                     ,"ACK"          ,Tcontrol_t,1);
     88      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY                 ,"HISTORY"      ,Thistory_t,_param->_size_history);
     89      ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION               ,"DIRECTION"    ,Tcontrol_t,1);
     90    }
     91    {
     92      ALLOC2_INTERFACE("update_predictor",IN,NORTH,_("Update predictor"),_param->_nb_predictor,_param->_nb_inst_update);
     93     
     94      ALLOC2_SIGNAL_OUT(out_UPDATE_PREDICTOR_VAL           ,"VAL"          ,Tcontrol_t,1);
     95      ALLOC2_SIGNAL_IN ( in_UPDATE_PREDICTOR_ACK           ,"ACK"          ,Tcontrol_t,1);
     96      ALLOC2_SIGNAL_OUT(out_UPDATE_PREDICTOR_HISTORY       ,"HISTORY"      ,Thistory_t,_param->_predictor_size_history[it1]);
     97      ALLOC2_SIGNAL_OUT(out_UPDATE_PREDICTOR_DIRECTION     ,"DIRECTION"    ,Tcontrol_t,1);
     98      ALLOC2_SIGNAL_OUT(out_UPDATE_PREDICTOR_MISS          ,"MISS"         ,Tcontrol_t,(_param->_predictor_update_on_prediction [it1])?1:0);
     99    }
     100
    60101    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    61102
  • 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

    r110 r111  
    3030        delete    in_CLOCK ;
    3131        delete    in_NRESET;
     32
     33        DELETE1_SIGNAL( in_PREDICT_VAL                    ,_param->_nb_inst_predict,1);
     34        DELETE1_SIGNAL(out_PREDICT_ACK                    ,_param->_nb_inst_predict,1);
     35        DELETE1_SIGNAL(out_PREDICT_HISTORY                ,_param->_nb_inst_predict,_param->_size_history);
     36        DELETE1_SIGNAL(out_PREDICT_DIRECTION              ,_param->_nb_inst_predict,1);
     37
     38        DELETE2_SIGNAL(out_PREDICT_PREDICTOR_VAL          ,_param->_nb_predictor,_param->_nb_inst_predict,1);
     39        DELETE2_SIGNAL( in_PREDICT_PREDICTOR_ACK          ,_param->_nb_predictor,_param->_nb_inst_predict,1);
     40        DELETE2_SIGNAL( in_PREDICT_PREDICTOR_HISTORY      ,_param->_nb_predictor,_param->_nb_inst_predict,_param->_predictor_size_history[it1]);
     41        DELETE2_SIGNAL( in_PREDICT_PREDICTOR_DIRECTION    ,_param->_nb_predictor,_param->_nb_inst_predict,1);
     42        DELETE2_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION_VAL,_param->_nb_predictor,_param->_nb_inst_predict,(_param->_predictor_update_on_prediction [it1])?1:0);
     43        DELETE2_SIGNAL(out_PREDICT_PREDICTOR_DIRECTION    ,_param->_nb_predictor,_param->_nb_inst_predict,(_param->_predictor_update_on_prediction [it1])?1:0);
     44
     45        DELETE1_SIGNAL( in_UPDATE_VAL                     ,_param->_nb_inst_update,1);
     46        DELETE1_SIGNAL(out_UPDATE_ACK                     ,_param->_nb_inst_update,1);
     47        DELETE1_SIGNAL( in_UPDATE_HISTORY                 ,_param->_nb_inst_update,_param->_size_history);
     48        DELETE1_SIGNAL( in_UPDATE_DIRECTION               ,_param->_nb_inst_update,1);
     49
     50        DELETE2_SIGNAL(out_UPDATE_PREDICTOR_VAL           ,_param->_nb_predictor,_param->_nb_inst_update,1);
     51        DELETE2_SIGNAL( in_UPDATE_PREDICTOR_ACK           ,_param->_nb_predictor,_param->_nb_inst_update,1);
     52        DELETE2_SIGNAL(out_UPDATE_PREDICTOR_HISTORY       ,_param->_nb_predictor,_param->_nb_inst_update,_param->_predictor_size_history[it1]);
     53        DELETE2_SIGNAL(out_UPDATE_PREDICTOR_DIRECTION     ,_param->_nb_predictor,_param->_nb_inst_update,1);
     54        DELETE2_SIGNAL(out_UPDATE_PREDICTOR_MISS          ,_param->_nb_predictor,_param->_nb_inst_update,(_param->_predictor_update_on_prediction [it1])?1:0);
    3255      }
     56
    3357    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    34 
     58   
    3559    delete _component;
    3660
  • 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

    r110 r111  
    2525  {
    2626    log_begin(Meta_Predictor_Glue,FUNCTION);
     27    log_function(Meta_Predictor_Glue,FUNCTION,_name.c_str());
    2728
    2829#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Parameters.cpp

    r110 r111  
    77
    88#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Parameters.h"
     9#include "Behavioural/include/Allocation.h"
     10#include "Common/include/BitManipulation.h"
    911
    1012namespace morpheo {
     
    2123#undef  FUNCTION
    2224#define FUNCTION "Meta_Predictor_Glue::Parameters"
    23   Parameters::Parameters (bool is_toplevel)
     25  Parameters::Parameters (uint32_t   nb_inst_predict         ,
     26                          uint32_t   nb_inst_update          ,
     27                          uint32_t   nb_predictor                  ,
     28                          uint32_t * predictor_size_history        ,//[nb_predictor]
     29                          bool     * predictor_update_on_prediction,//[nb_predictor]
     30                          bool       is_toplevel             )
    2431  {
    2532    log_begin(Meta_Predictor_Glue,FUNCTION);
    2633
     34    _nb_inst_predict                = nb_inst_predict               ;
     35    _nb_inst_update                 = nb_inst_update                ;
     36    _nb_predictor                   = nb_predictor                  ;
     37    _predictor_size_history         = predictor_size_history        ;
     38    _predictor_update_on_prediction = predictor_update_on_prediction;
     39
     40    _size_history = 0;
     41    for (uint32_t i=0; i<_nb_predictor; ++i)
     42      _size_history += _predictor_size_history [i];
     43
    2744    test();
     45
     46    ALLOC1(_predictor_history_shift    ,uint32_t  ,_nb_predictor);
     47    ALLOC1(_predictor_history_shift_msb,uint32_t  ,_nb_predictor);
     48    ALLOC1(_predictor_history_mask     ,Thistory_t,_nb_predictor);
     49
     50    uint32_t shift = 0;
     51    for (uint32_t i=0; i<_nb_predictor; ++i)
     52      {
     53        _predictor_history_shift     [i] = shift;
     54        _predictor_history_shift_msb [i] = _predictor_size_history [i]-1;
     55        _predictor_history_mask      [i] = gen_mask<Thistory_t>(_predictor_size_history [i]);
     56
     57        shift += _predictor_size_history [i];
     58      }
    2859
    2960    if (is_toplevel)
     
    5788  {
    5889    log_begin(Meta_Predictor_Glue,FUNCTION);
     90
     91    DELETE1(_predictor_history_mask ,_nb_predictor);
     92    DELETE1(_predictor_history_shift,_nb_predictor);
     93
    5994    log_end(Meta_Predictor_Glue,FUNCTION);
    6095  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/config-alpha_21264.cfg

    r110 r111  
    11Meta_Predictor
     21       1       +1      # nb_inst_predict
     31       1       +1      # nb_inst_update
     430      30      *2      # size_address
     51       1       +1      # predictor_0_have_bht             
     610      10      +1      # predictor_0_bht_size_shifter     
     71024    1024    *2      # predictor_0_bht_nb_shifter
     81       1       +1      # predictor_0_have_pht             
     93       3       +1      # predictor_0_pht_size_counter     
     101024    1024    *2      # predictor_0_pht_nb_counter
     110       0       +1      # predictor_0_pht_size_address_share
     121       1       +1      # predictor_1_have_bht             
     1312      12      +1      # predictor_1_bht_size_shifter     
     142       2       *2      # predictor_1_bht_nb_shifter
     151       1       +1      # predictor_1_have_pht             
     162       2       +1      # predictor_1_pht_size_counter     
     174096    4096    *2      # predictor_1_pht_nb_counter
     180       0       +1      # predictor_1_pht_size_address_share
     190       0       +1      # predictor_2_have_bht             
     204       4       +1      # predictor_2_bht_size_shifter     
     21256     256     *2      # predictor_2_bht_nb_shifter
     221       1       +1      # predictor_2_have_pht             
     232       2       +1      # predictor_2_pht_size_counter     
     244096    4096    *2      # predictor_2_pht_nb_counter
     250       0       +1      # predictor_2_pht_size_address_share
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/src/main.cpp

    r110 r111  
    77
    88#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/include/test.h"
     9#include "Behavioural/include/Selftest.h"
    910
    10 #define NB_PARAMS 0
     11#define NB_PARAMS 3+7*3
    1112
    1213void usage (int argc, char * argv[])
     
    1415  err (_("<Usage> %s name_instance list_params.\n"),argv[0]);
    1516  err (_("list_params is :\n"));
    16   err (_(" *  ()\n"));
    17 
     17  err (_(" * nb_inst_predict            (uint32_t)\n"));
     18  err (_(" * nb_inst_update             (uint32_t)\n"));
     19  err (_(" * size_address               (uint32_t)\n"));
     20  err (_(" * have_bht               [3] (bool    )\n"));
     21  err (_(" * bht_size_shifter       [3] (uint32_t)\n"));
     22  err (_(" * bht_nb_shifter         [3] (uint32_t)\n"));
     23  err (_(" * have_pht               [3] (bool    )\n"));
     24  err (_(" * pht_size_counter       [3] (uint32_t)\n"));
     25  err (_(" * pht_nb_counter         [3] (uint32_t)\n"));
     26  err (_(" * pht_size_address_share [3] (uint32_t)\n"));
    1827  exit (1);
    1928}
     
    3140
    3241  string name = argv[x++];
     42  uint32_t _nb_inst_predict           ;
     43  uint32_t _nb_inst_update            ;
     44  uint32_t _size_address              ;
     45  bool     _have_bht               [3];
     46  uint32_t _bht_size_shifter       [3];
     47  uint32_t _bht_nb_shifter         [3];
     48  bool     _have_pht               [3];
     49  uint32_t _pht_size_counter       [3];
     50  uint32_t _pht_nb_counter         [3];
     51  uint32_t _pht_size_address_share [3];
     52
     53  SELFTEST0(_nb_inst_predict           ,uint32_t,argv,x);
     54  SELFTEST0(_nb_inst_update            ,uint32_t,argv,x);
     55  SELFTEST0(_size_address              ,uint32_t,argv,x);
     56
     57  for (uint32_t i=0; i<3; ++i)
     58    {
     59  SELFTEST0(_have_bht               [i],bool    ,argv,x);
     60  SELFTEST0(_bht_size_shifter       [i],uint32_t,argv,x);
     61  SELFTEST0(_bht_nb_shifter         [i],uint32_t,argv,x);
     62  SELFTEST0(_have_pht               [i],bool    ,argv,x);
     63  SELFTEST0(_pht_size_counter       [i],uint32_t,argv,x);
     64  SELFTEST0(_pht_nb_counter         [i],uint32_t,argv,x);
     65  SELFTEST0(_pht_size_address_share [i],uint32_t,argv,x);
     66    }
    3367
    3468  int _return = EXIT_SUCCESS;
     
    3771      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
    3872        (
     73         _nb_inst_predict       ,
     74         _nb_inst_update        ,
     75         _size_address          ,
     76         _have_bht              ,
     77         _bht_size_shifter      ,
     78         _bht_nb_shifter        ,
     79         _have_pht              ,
     80         _pht_size_counter      ,
     81         _pht_nb_counter        ,
     82         _pht_size_address_share,
    3983         true // is_toplevel
    4084        );
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/src/test.cpp

    r110 r111  
    5050  sc_clock              *  in_CLOCK  = new sc_clock ("clock", 1.0, 0.5);         
    5151  sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
     52  ALLOC1_SC_SIGNAL( in_PREDICT_VAL          ," in_PREDICT_VAL          ",Tcontrol_t,_param->_nb_inst_predict);
     53  ALLOC1_SC_SIGNAL(out_PREDICT_ACK          ,"out_PREDICT_ACK          ",Tcontrol_t,_param->_nb_inst_predict);
     54  ALLOC1_SC_SIGNAL( in_PREDICT_ADDRESS      ," in_PREDICT_ADDRESS      ",Taddress_t,_param->_nb_inst_predict);
     55  ALLOC1_SC_SIGNAL(out_PREDICT_DIRECTION    ,"out_PREDICT_DIRECTION    ",Tcontrol_t,_param->_nb_inst_predict);
     56  ALLOC1_SC_SIGNAL(out_PREDICT_HISTORY      ,"out_PREDICT_HISTORY      ",Thistory_t,_param->_nb_inst_predict);
     57 
     58  ALLOC1_SC_SIGNAL( in_UPDATE_VAL           ," in_UPDATE_VAL           ",Tcontrol_t,_param->_nb_inst_update);
     59  ALLOC1_SC_SIGNAL(out_UPDATE_ACK           ,"out_UPDATE_ACK           ",Tcontrol_t,_param->_nb_inst_update);
     60  ALLOC1_SC_SIGNAL( in_UPDATE_ADDRESS       ," in_UPDATE_ADDRESS       ",Taddress_t,_param->_nb_inst_update);
     61  ALLOC1_SC_SIGNAL( in_UPDATE_HISTORY       ," in_UPDATE_HISTORY       ",Thistory_t,_param->_nb_inst_update);
     62  ALLOC1_SC_SIGNAL( in_UPDATE_DIRECTION     ," in_UPDATE_DIRECTION     ",Tcontrol_t,_param->_nb_inst_update);
    5263 
    5364  /********************************************************
     
    6071  (*(_Meta_Predictor->in_NRESET))       (*(in_NRESET));
    6172
     73  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_PREDICT_VAL          ,_param->_nb_inst_predict);
     74  INSTANCE1_SC_SIGNAL(_Meta_Predictor,out_PREDICT_ACK          ,_param->_nb_inst_predict);
     75  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_PREDICT_ADDRESS      ,_param->_nb_inst_predict);
     76  INSTANCE1_SC_SIGNAL(_Meta_Predictor,out_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
     77  INSTANCE1_SC_SIGNAL(_Meta_Predictor,out_PREDICT_HISTORY      ,_param->_nb_inst_predict);
     78
     79  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_UPDATE_VAL           ,_param->_nb_inst_update);
     80  INSTANCE1_SC_SIGNAL(_Meta_Predictor,out_UPDATE_ACK           ,_param->_nb_inst_update);
     81  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_UPDATE_ADDRESS       ,_param->_nb_inst_update);
     82  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_UPDATE_HISTORY       ,_param->_nb_inst_update);
     83  INSTANCE1_SC_SIGNAL(_Meta_Predictor, in_UPDATE_DIRECTION     ,_param->_nb_inst_update);
    6284
    6385  msg(_("<%s> : Start Simulation ............\n"),name.c_str());
     
    104126  delete in_CLOCK;
    105127  delete in_NRESET;
     128
     129  DELETE1_SC_SIGNAL( in_PREDICT_VAL          ,_param->_nb_inst_predict);
     130  DELETE1_SC_SIGNAL(out_PREDICT_ACK          ,_param->_nb_inst_predict);
     131  DELETE1_SC_SIGNAL( in_PREDICT_ADDRESS      ,_param->_nb_inst_predict);
     132  DELETE1_SC_SIGNAL(out_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
     133  DELETE1_SC_SIGNAL(out_PREDICT_HISTORY      ,_param->_nb_inst_predict);
     134
     135  DELETE1_SC_SIGNAL( in_UPDATE_VAL           ,_param->_nb_inst_update);
     136  DELETE1_SC_SIGNAL(out_UPDATE_ACK           ,_param->_nb_inst_update);
     137  DELETE1_SC_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update);
     138  DELETE1_SC_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update);
     139  DELETE1_SC_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update);
    106140    }
    107141#endif
  • 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

    r110 r111  
    11Two_Level_Branch_Predictor
     24       4       *2      # nb_inst_predict       
     34       4       *2      # nb_inst_update       
     430      30      *2      # size_address         
     51       1       +1      # have_bht             
     61       16      *4      # bht_size_shifter     
     71       16      *4      # bht_nb_shifter       
     80       0       +1      # have_pht             
     90       0       +1      # pht_size_counter     
     100       0       *2      # pht_nb_counter       
     110       0       +1      # pht_size_address_share
     121       1       +1      # update_on_prediction
  • 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

    r110 r111  
    1111#endif
    1212
    13 #define NB_ITERATION  1
     13#define NB_ITERATION  16
    1414#define CYCLE_MAX     (1024*NB_ITERATION)
    1515
  • 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

    r110 r111  
    77
    88#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/include/test.h"
     9#include "Behavioural/include/Selftest.h"
    910
    10 #define NB_PARAMS 0
     11#define NB_PARAMS 11
    1112
    1213void usage (int argc, char * argv[])
     
    1415  err (_("<Usage> %s name_instance list_params.\n"),argv[0]);
    1516  err (_("list_params is :\n"));
    16   err (_(" *  ()\n"));
     17  err (_(" * nb_inst_predict        (uint32_t)\n"));
     18  err (_(" * nb_inst_update         (uint32_t)\n"));
     19  err (_(" * size_address           (uint32_t)\n"));
     20  err (_(" * have_bht               (bool    )\n"));
     21  err (_(" * bht_size_shifter       (uint32_t)\n"));
     22  err (_(" * bht_nb_shifter         (uint32_t)\n"));
     23  err (_(" * have_pht               (bool    )\n"));
     24  err (_(" * pht_size_counter       (uint32_t)\n"));
     25  err (_(" * pht_nb_counter         (uint32_t)\n"));
     26  err (_(" * pht_size_address_share (uint32_t)\n"));
     27  err (_(" * update_on_prediction   (bool    )\n"));
    1728
    1829  exit (1);
     
    3243  string name = argv[x++];
    3344
     45  uint32_t nb_inst_predict       ;
     46  uint32_t nb_inst_update        ;
     47  uint32_t size_address          ;
     48  bool     have_bht              ;
     49  uint32_t bht_size_shifter      ;
     50  uint32_t bht_nb_shifter        ;
     51  bool     have_pht              ;
     52  uint32_t pht_size_counter      ;
     53  uint32_t pht_nb_counter        ;
     54  uint32_t pht_size_address_share;
     55  bool     update_on_prediction  ;
     56
     57  SELFTEST0(nb_inst_predict       ,uint32_t,argv,x);
     58  SELFTEST0(nb_inst_update        ,uint32_t,argv,x);
     59  SELFTEST0(size_address          ,uint32_t,argv,x);
     60  SELFTEST0(have_bht              ,bool    ,argv,x);
     61  SELFTEST0(bht_size_shifter      ,uint32_t,argv,x);
     62  SELFTEST0(bht_nb_shifter        ,uint32_t,argv,x);
     63  SELFTEST0(have_pht              ,bool    ,argv,x);
     64  SELFTEST0(pht_size_counter      ,uint32_t,argv,x);
     65  SELFTEST0(pht_nb_counter        ,uint32_t,argv,x);
     66  SELFTEST0(pht_size_address_share,uint32_t,argv,x);
     67  SELFTEST0(update_on_prediction  ,bool    ,argv,x);
     68
    3469  int _return = EXIT_SUCCESS;
    3570  try
     
    3772      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
    3873        (
     74         nb_inst_predict       ,
     75         nb_inst_update        ,
     76         size_address          ,
     77         have_bht              ,
     78         bht_size_shifter      ,
     79         bht_nb_shifter        ,
     80         have_pht              ,
     81         pht_size_counter      ,
     82         pht_nb_counter        ,
     83         pht_size_address_share,
     84         update_on_prediction  ,
    3985         true //is_toplevel
    4086        );
  • 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

    r110 r111  
    5050  sc_clock              *  in_CLOCK  = new sc_clock ("clock", 1.0, 0.5);         
    5151  sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
     52
     53  ALLOC1_SC_SIGNAL( in_PREDICT_VAL          ," in_PREDICT_VAL          ",Tcontrol_t,_param->_nb_inst_predict);
     54  ALLOC1_SC_SIGNAL(out_PREDICT_ACK          ,"out_PREDICT_ACK          ",Tcontrol_t,_param->_nb_inst_predict);
     55  ALLOC1_SC_SIGNAL( in_PREDICT_ADDRESS      ," in_PREDICT_ADDRESS      ",Taddress_t,_param->_nb_inst_predict);
     56  ALLOC1_SC_SIGNAL(out_PREDICT_DIRECTION    ,"out_PREDICT_DIRECTION    ",Tcontrol_t,_param->_nb_inst_predict);
     57  ALLOC1_SC_SIGNAL(out_PREDICT_HISTORY      ,"out_PREDICT_HISTORY      ",Thistory_t,_param->_nb_inst_predict);
     58  ALLOC1_SC_SIGNAL( in_PREDICT_DIRECTION_VAL," in_PREDICT_DIRECTION_VAL",Tcontrol_t,_param->_nb_inst_predict);
     59  ALLOC1_SC_SIGNAL( in_PREDICT_DIRECTION    ," in_PREDICT_DIRECTION    ",Tcontrol_t,_param->_nb_inst_predict);
     60 
     61  ALLOC1_SC_SIGNAL( in_UPDATE_VAL           ," in_UPDATE_VAL           ",Tcontrol_t,_param->_nb_inst_update);
     62  ALLOC1_SC_SIGNAL(out_UPDATE_ACK           ,"out_UPDATE_ACK           ",Tcontrol_t,_param->_nb_inst_update);
     63  ALLOC1_SC_SIGNAL( in_UPDATE_ADDRESS       ," in_UPDATE_ADDRESS       ",Taddress_t,_param->_nb_inst_update);
     64  ALLOC1_SC_SIGNAL( in_UPDATE_HISTORY       ," in_UPDATE_HISTORY       ",Thistory_t,_param->_nb_inst_update);
     65  ALLOC1_SC_SIGNAL( in_UPDATE_DIRECTION     ," in_UPDATE_DIRECTION     ",Tcontrol_t,_param->_nb_inst_update);
     66  ALLOC1_SC_SIGNAL( in_UPDATE_MISS          ," in_UPDATE_MISS          ",Tcontrol_t,_param->_nb_inst_update);
    5267 
    5368  /********************************************************
     
    6075  (*(_Two_Level_Branch_Predictor->in_NRESET))       (*(in_NRESET));
    6176
     77  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_VAL          ,_param->_nb_inst_predict);
     78  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_ACK          ,_param->_nb_inst_predict);
     79  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_ADDRESS      ,_param->_nb_inst_predict);
     80  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
     81  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_HISTORY      ,_param->_nb_inst_predict);
     82  if (_param->_update_on_prediction)
     83    {
     84  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict);
     85  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
     86    }
     87
     88  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_VAL           ,_param->_nb_inst_update);
     89  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_UPDATE_ACK           ,_param->_nb_inst_update);
     90  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_ADDRESS       ,_param->_nb_inst_update);
     91  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_HISTORY       ,_param->_nb_inst_update);
     92  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_DIRECTION     ,_param->_nb_inst_update);
     93  if (_param->_update_on_prediction)
     94  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_MISS          ,_param->_nb_inst_update);
    6295
    6396  msg(_("<%s> : Start Simulation ............\n"),name.c_str());
     
    76109  srand(seed);
    77110
     111  const  int32_t percent_transaction_predict = 75;
     112  const  int32_t percent_transaction_update  = 75;
     113
    78114  SC_START(0);
    79115  LABEL("Initialisation");
     116
     117  for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     118    in_PREDICT_VAL [i]->write(0);
     119  for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
     120    in_UPDATE_VAL [i]->write(0);
    80121
    81122  LABEL("Reset");
     
    85126
    86127  LABEL("Loop of Test");
    87 
     128 
     129  Thistory_t bht;
     130  Thistory_t pht [_param->_pht_size_bank];
     131 
    88132  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
    89133    {
    90134      LABEL("Iteration %d",iteration);
    91135
     136      uint32_t bht_num_reg  = (_param->_have_bht)?(rand()%_param->_bht_nb_shifter):0;
     137      uint32_t pht_num_bank = (_param->_have_pht)?(rand()%_param->_pht_nb_bank   ):0;
     138
     139      LABEL("  * bht_num_reg  : %d",bht_num_reg );
     140      LABEL("  * pht_num_bank : %d",pht_num_bank);
     141
     142      {
     143        LABEL("Init BHT and PHT");
     144
     145        bht = 0;
     146        for (uint32_t i=0; i<_param->_pht_size_bank; ++i)
     147          pht [i] = 0;
     148       
     149        uint32_t port = rand()%_param->_nb_inst_update;
     150
     151        if (_param->_have_bht)
     152          {       
     153            bool find = false;
     154            while (not find)
     155              {
     156                bool val = ((rand()%2)<percent_transaction_update);
     157                in_UPDATE_VAL       [port]->write(val);
     158                in_UPDATE_DIRECTION [port]->write(0);
     159               
     160                if (_param->_update_on_prediction)
     161                  in_UPDATE_MISS      [port]->write(1); // miss
     162                in_UPDATE_HISTORY   [port]->write(0);
     163                in_UPDATE_ADDRESS   [port]->write(bht_num_reg);
     164               
     165                SC_START(0);
     166               
     167                if (val and out_UPDATE_ACK [port]->read())
     168                  {
     169                    LABEL("UPDATE[%d] - Transaction accepted",port);
     170                    find = true;
     171                  }
     172               
     173                SC_START(1);
     174              }
     175            in_UPDATE_VAL [port]->write(0);
     176          }
     177
     178        if (_param->_have_pht)
     179          {       
     180            for (uint32_t i=0; i<_param->_pht_size_bank; ++i)
     181              {
     182                bool find = false;
     183               
     184                while (not find)
     185                  {
     186                    bool val = ((rand()%2)<percent_transaction_update);
     187                    in_UPDATE_VAL       [port]->write(val);
     188                    in_UPDATE_DIRECTION [port]->write(0);
     189                   
     190                    if (_param->_update_on_prediction)
     191                      in_UPDATE_MISS      [port]->write(1); // miss
     192                    in_UPDATE_HISTORY   [port]->write(i<<_param->_bht_history_rshift);
     193                    in_UPDATE_ADDRESS   [port]->write(pht_num_bank<<_param->_pht_address_bank_rshift);
     194                   
     195                    SC_START(0);
     196                   
     197                    if (val and out_UPDATE_ACK [port]->read())
     198                      {
     199                        LABEL("UPDATE[%d] - Transaction accepted",port);
     200                        find = true;
     201                      }
     202                   
     203                    SC_START(1);
     204                  }
     205                in_UPDATE_VAL [port]->write(0);
     206              }
     207          }
     208      }
     209
     210//       if (1)
     211//         {
     212//           LABEL("Saturation all PHT");
     213         
     214//         }
     215
    92216      SC_START(1);
    93217    }
     
    104228  delete in_CLOCK;
    105229  delete in_NRESET;
     230
     231  DELETE1_SC_SIGNAL( in_PREDICT_VAL          ,_param->_nb_inst_predict);
     232  DELETE1_SC_SIGNAL(out_PREDICT_ACK          ,_param->_nb_inst_predict);
     233  DELETE1_SC_SIGNAL( in_PREDICT_ADDRESS      ,_param->_nb_inst_predict);
     234  DELETE1_SC_SIGNAL(out_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
     235  DELETE1_SC_SIGNAL(out_PREDICT_HISTORY      ,_param->_nb_inst_predict);
     236  DELETE1_SC_SIGNAL( in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict);
     237  DELETE1_SC_SIGNAL( in_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
     238
     239  DELETE1_SC_SIGNAL( in_UPDATE_VAL           ,_param->_nb_inst_update);
     240  DELETE1_SC_SIGNAL(out_UPDATE_ACK           ,_param->_nb_inst_update);
     241  DELETE1_SC_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update);
     242  DELETE1_SC_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update);
     243  DELETE1_SC_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update);
     244  DELETE1_SC_SIGNAL( in_UPDATE_MISS          ,_param->_nb_inst_update);
    106245    }
    107246#endif
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h

    r110 r111  
    99 */
    1010
     11#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Types.h"
    1112#include "Behavioural/include/Parameters.h"
    1213#include "Common/include/Debug.h"
     
    2627  {
    2728    //-----[ fields ]------------------------------------------------------------
     29  public : uint32_t   _nb_inst_predict         ;
     30  public : uint32_t   _nb_inst_update          ;
     31  public : uint32_t   _size_address            ;
     32  public : bool       _have_bht                ;
     33  public : uint32_t   _bht_size_shifter        ;
     34  public : uint32_t   _bht_nb_shifter          ;
     35  public : bool       _have_pht                ;
     36  public : uint32_t   _pht_size_counter        ;
     37  public : uint32_t   _pht_nb_counter          ;
     38  public : uint32_t   _pht_size_address_share  ;
     39  public : bool       _update_on_prediction    ;
     40                                       
     41  public : Thistory_t _pht_counter_max         ;
     42       
     43  public : uint32_t   _size_history            ;
     44                                               
     45  public : Thistory_t _bht_history_mask        ;
     46  public : Thistory_t _bht_history_rshift      ;
     47  public : Thistory_t _pht_history_mask        ;
     48  public : Thistory_t _pht_history_rshift      ;
     49                                               
     50  public : uint32_t   _bht_size_address        ;
     51  public : uint32_t   _pht_size_address        ;
     52                                               
     53  public : Taddress_t _bht_address_mask        ;
     54  public : uint32_t   _pht_nb_bank             ;
     55  public : uint32_t   _pht_size_bank           ;
     56  public : Taddress_t _pht_address_share_mask  ;
     57  public : Taddress_t _pht_address_share_lshift;
     58  public : Taddress_t _pht_address_bank_mask   ;
     59  public : Taddress_t _pht_address_bank_rshift ;
    2860
    2961    //-----[ methods ]-----------------------------------------------------------
    30   public : Parameters  (bool is_toplevel=false);
     62  public : Parameters  (uint32_t nb_inst_predict       ,
     63                        uint32_t nb_inst_update        ,
     64                        uint32_t size_address          ,
     65                        bool     have_bht              ,
     66                        uint32_t bht_size_shifter      ,
     67                        uint32_t bht_nb_shifter        ,
     68                        bool     have_pht              ,
     69                        uint32_t pht_size_counter      ,
     70                        uint32_t pht_nb_counter        ,
     71                        uint32_t pht_size_address_share,
     72                        bool     update_on_prediction  ,
     73                        bool is_toplevel=false);
    3174//public : Parameters  (Parameters & param) ;
    3275  public : ~Parameters (void);
  • 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

    r110 r111  
    6666  public    : SC_IN (Tcontrol_t)            *  in_NRESET       ;
    6767
     68    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     69  public    : SC_IN (Tcontrol_t)           **  in_PREDICT_VAL          ;//[nb_inst_predict]
     70  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_ACK          ;//[nb_inst_predict]
     71  public    : SC_IN (Taddress_t)           **  in_PREDICT_ADDRESS      ;//[nb_inst_predict]
     72  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_DIRECTION    ;//[nb_inst_predict] // = MSB[history]
     73  public    : SC_OUT(Thistory_t)           ** out_PREDICT_HISTORY      ;//[nb_inst_predict]
     74  public    : SC_IN (Tcontrol_t)           **  in_PREDICT_DIRECTION_VAL;//[nb_inst_predict] // if update_on_prediction
     75  public    : SC_IN (Tcontrol_t)           **  in_PREDICT_DIRECTION    ;//[nb_inst_predict] // if update_on_prediction
     76
     77    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     78  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_VAL           ;//[nb_inst_update]
     79  public    : SC_OUT(Tcontrol_t)           ** out_UPDATE_ACK           ;//[nb_inst_update]
     80  public    : SC_IN (Taddress_t)           **  in_UPDATE_ADDRESS       ;//[nb_inst_update]
     81  public    : SC_IN (Thistory_t)           **  in_UPDATE_HISTORY       ;//[nb_inst_update]
     82  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_DIRECTION     ;//[nb_inst_update]
     83  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_MISS          ;//[nb_inst_update] // if update_on_prediction
     84
    6885    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    69 
     86   
    7087    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     88  private   : Thistory_t                    * reg_BHT                       ;//[bht_nb_shifter]
     89  private   : Thistory_t                   ** reg_PHT                       ;//[pht_nb_counter][pht_nb_bank]
    7190
    7291    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     92  private   : Tcontrol_t                    * internal_PREDICT_ACK          ;//[nb_inst_predict]
     93  private   : Thistory_t                    * internal_PREDICT_BHT_NUM_REG  ;//[nb_inst_predict] // if update_on_prediction
     94  private   : Thistory_t                    * internal_PREDICT_PHT_NUM_BANK ;//[nb_inst_predict] // if update_on_prediction
     95  private   : Thistory_t                    * internal_PREDICT_PHT_NUM_REG  ;//[nb_inst_predict] // if update_on_prediction
     96
     97  private   : Tcontrol_t                    * internal_UPDATE_ACK           ;//[nb_inst_update]
    7398#endif
    7499
     
    104129#ifdef SYSTEMC                                 
    105130  public  : void        transition                (void);
    106 //public  : void        genMoore                  (void);
     131  public  : void        genMealy_predict          (void);
    107132#endif                                         
    108133
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.cpp

    r110 r111  
    77
    88#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h"
     9#include "Common/include/BitManipulation.h"
    910
    1011namespace morpheo {
     
    2122#undef  FUNCTION
    2223#define FUNCTION "Two_Level_Branch_Predictor::Parameters"
    23   Parameters::Parameters (bool is_toplevel)
     24  Parameters::Parameters (uint32_t nb_inst_predict       ,
     25                          uint32_t nb_inst_update        ,
     26                          uint32_t size_address          ,
     27                          bool     have_bht              ,
     28                          uint32_t bht_size_shifter      ,
     29                          uint32_t bht_nb_shifter        ,
     30                          bool     have_pht              ,
     31                          uint32_t pht_size_counter      ,
     32                          uint32_t pht_nb_counter        ,
     33                          uint32_t pht_size_address_share,
     34                          bool     update_on_prediction  ,
     35                          bool is_toplevel)
    2436  {
    2537    log_begin(Two_Level_Branch_Predictor,FUNCTION);
    2638
    27     test();
     39    _nb_inst_predict         = nb_inst_predict       ;
     40    _nb_inst_update          = nb_inst_update        ;
     41    _size_address            = size_address          ;
     42    _have_bht                = have_bht              ;
     43    _bht_size_shifter        = (have_bht)?(bht_size_shifter):0;
     44    _bht_nb_shifter          = (have_bht)?(bht_nb_shifter  ):0;
     45    _have_pht                = have_pht              ;
     46    _pht_size_counter        = (have_pht)?(pht_size_counter      ):0;
     47    _pht_nb_counter          = (have_pht)?(pht_nb_counter        ):0;
     48    _pht_size_address_share  = (have_bht and have_pht)?(pht_size_address_share):0;
     49    _update_on_prediction    = update_on_prediction  ;
     50                             
     51    _bht_size_address        = (_have_bht)?log2(_bht_nb_shifter):0;
     52    _pht_size_address        = (_have_pht)?log2(_pht_nb_counter):0;
     53                             
     54    test();                 
     55
     56    _size_history            = _bht_size_shifter + _pht_size_counter;
     57                             
     58    _bht_history_mask        = gen_mask<Thistory_t>(_bht_size_shifter);
     59    _bht_history_rshift      = 0;
     60    _pht_history_mask        = gen_mask<Thistory_t>(_pht_size_counter);
     61    _pht_history_rshift      = _bht_size_shifter;
     62                             
     63    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _size_history             : %d",_size_history  );
     64    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_mask         : 0x%x",_bht_history_mask  );
     65    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_rshift       : %d",_bht_history_rshift);
     66    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_mask         : 0x%x",_pht_history_mask  );
     67    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_rshift       : %d",_pht_history_rshift);
     68
     69    if (_have_bht)
     70      {
     71        _bht_address_mask        = gen_mask<Taddress_t>(_bht_size_address);
     72
     73        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_address_mask         : 0x%x",_bht_address_mask  );
     74      }
     75
     76    if (_have_pht)
     77      {
     78        _pht_counter_max         = (1<<_pht_size_counter)-1;
     79       
     80        _pht_nb_bank             = (_pht_nb_counter - (1<<_bht_size_shifter))+1;
     81        _pht_size_bank           = _pht_nb_counter / _pht_nb_bank;
     82
     83        _pht_address_share_mask  = gen_mask<Taddress_t>(_pht_size_address_share);
     84        _pht_address_share_lshift= _bht_size_shifter-_pht_size_address_share;
     85        _pht_address_bank_mask   = gen_mask<Taddress_t>(log2(_pht_nb_bank));
     86        _pht_address_bank_rshift = _pht_size_address_share;
     87
     88        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_nb_bank              : %d"  ,_pht_nb_bank   );
     89        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_size_bank            : %d"  ,_pht_size_bank );
     90        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_mask   : 0x%x",_pht_address_share_mask  );
     91        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_lshift : %d"  ,_pht_address_share_lshift);
     92        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_mask    : 0x%x",_pht_address_bank_mask   );
     93        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_rshift  : %d"  ,_pht_address_bank_rshift );
     94      }
    2895
    2996    if (is_toplevel)
    30       {
    31         copy();
    32       }
     97      copy();
    3398
    3499    log_end(Two_Level_Branch_Predictor,FUNCTION);
  • 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

    r110 r111  
    2929    Parameters_test test ("Two_Level_Branch_Predictor");
    3030
     31    if ((_have_bht or _have_pht) == false)
     32      test.error(_("They have no Branch History Table and no Pattern History Table. You need a less of a BHT or a PHT\n"));
     33
     34    if ( _have_bht and (_size_address < _bht_size_address))
     35      test.error(_("The address's size must to large to the number of shifter in the Branch History Table.\n"));
     36
     37    if (_have_pht and (_size_address < _pht_size_address))
     38      test.error(_("The address's size must to large to the number of counter in the Pattern History Table.\n"));
     39
     40    if (_have_pht and _have_bht and (_bht_size_address > _pht_nb_counter))
     41      test.error (_("The size of shifter don't must too large that the number of counter in the Pattern History Table.\n"));
     42
     43    if (_have_pht and _have_bht and (_pht_size_address_share > _bht_size_shifter))
     44      test.error (_("The size of address share don't must too large that the size of shifter in the Branch History Table.\n"));
     45
    3146    log_end(Two_Level_Branch_Predictor,FUNCTION);
    3247
  • 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

    r110 r111  
    7272    if (usage_is_set(_usage,USE_SYSTEMC))
    7373      {
     74        // Constants :
     75        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     76          {
     77            internal_PREDICT_ACK [i] = 1;
     78            PORT_WRITE(out_PREDICT_ACK [i], internal_PREDICT_ACK [i]);
     79          }
     80        for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
     81          {
     82            internal_UPDATE_ACK [i] = 1;
     83            PORT_WRITE(out_UPDATE_ACK [i], internal_UPDATE_ACK [i]);
     84          }
     85       
     86
    7487        log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - transition"),_name.c_str());
    7588
     
    8295# endif   
    8396
    84 //      log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str());
     97        log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - genMealy_predict"),_name.c_str());
    8598
    86 //      SC_METHOD (genMoore);
    87 //      dont_initialize ();
    88 //      sensitive << (*(in_CLOCK)).neg(); // need internal register
    89        
    90 // # ifdef SYSTEMCASS_SPECIFIC
    91 //      // List dependency information
    92 // # endif   
     99        SC_METHOD (genMealy_predict);
     100        dont_initialize ();
     101        sensitive << (*(in_CLOCK)).neg(); // need internal register
     102
     103        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     104          sensitive
     105//             << (*(in_PREDICT_VAL     [i]))
     106            << (*(in_PREDICT_ADDRESS [i]));
     107               
     108# ifdef SYSTEMCASS_SPECIFIC
     109        // List dependency information
     110# endif   
    93111       
    94112#endif
  • 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

    r110 r111  
    1919namespace meta_predictor {
    2020namespace two_level_branch_predictor {
    21 
    22 
    2321
    2422#undef  FUNCTION
     
    5856      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
    5957    }
     58
     59    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     60    {
     61      ALLOC1_INTERFACE("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict);
     62
     63      ALLOC1_VALACK_IN ( in_PREDICT_VAL          ,VAL);
     64      ALLOC1_VALACK_OUT(out_PREDICT_ACK          ,ACK);
     65      ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS      ,"ADDRESS"      ,Taddress_t,_param->_size_address);
     66      ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
     67      ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY      ,"HISTORY"      ,Thistory_t,_param->_size_history);
     68      if (_param->_update_on_prediction)
     69        {
     70      ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION_VAL,"DIRECTION_VAL",Tcontrol_t,1                    );
     71      ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
     72        }
     73    }
     74
     75    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     76    {
     77      ALLOC1_INTERFACE("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update);
     78
     79      ALLOC1_VALACK_IN ( in_UPDATE_VAL           ,VAL);
     80      ALLOC1_VALACK_OUT(out_UPDATE_ACK           ,ACK);
     81      ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS       ,"ADDRESS"      ,Taddress_t,_param->_size_address);
     82      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY       ,"HISTORY"      ,Thistory_t,_param->_size_history);
     83      ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION     ,"DIRECTION"    ,Tcontrol_t,1                    );
     84      if (_param->_update_on_prediction)
     85      ALLOC1_SIGNAL_IN ( in_UPDATE_MISS          ,"MISS"         ,Tcontrol_t,1                    );
     86    }
     87
     88    if (usage_is_set(_usage,USE_SYSTEMC))
     89      {
     90        if (_param->_have_bht)
     91          {
     92        ALLOC1(reg_BHT                       ,Thistory_t,_param->_bht_nb_shifter);
     93
     94        for (uint32_t i=0; i<_param->_bht_nb_shifter; ++i)
     95          reg_BHT [i] = 0;
     96          }
     97
     98        if (_param->_have_pht)
     99          {
     100        ALLOC2(reg_PHT                       ,Thistory_t,_param->_pht_nb_bank,_param->_pht_size_bank);
     101
     102        for (uint32_t i=0; i<_param->_pht_nb_bank; ++i)
     103          for (uint32_t j=0; j<_param->_pht_size_bank; ++j)
     104            reg_PHT [i][j] = 0;
     105          }
     106
     107
     108        ALLOC1(internal_PREDICT_ACK          ,Tcontrol_t,_param->_nb_inst_predict);
     109        if (_param->_update_on_prediction)
     110          {
     111        if (_param->_have_bht)
     112        ALLOC1(internal_PREDICT_BHT_NUM_REG  ,Thistory_t,_param->_nb_inst_predict);
     113        if (_param->_have_pht)
     114          {
     115        ALLOC1(internal_PREDICT_PHT_NUM_BANK ,Thistory_t,_param->_nb_inst_predict);
     116        ALLOC1(internal_PREDICT_PHT_NUM_REG  ,Thistory_t,_param->_nb_inst_predict);
     117          }
     118          }
     119        ALLOC1(internal_UPDATE_ACK           ,Tcontrol_t,_param->_nb_inst_update );
     120      }
     121
    60122    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    61 
    62123#ifdef POSITION
    63124    if (usage_is_set(_usage,USE_POSITION))
  • 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

    r110 r111  
    3030        delete    in_CLOCK ;
    3131        delete    in_NRESET;
     32
     33        DELETE1_SIGNAL( in_PREDICT_VAL          ,_param->_nb_inst_predict,1                    );
     34        DELETE1_SIGNAL(out_PREDICT_ACK          ,_param->_nb_inst_predict,1                    );
     35        DELETE1_SIGNAL( in_PREDICT_ADDRESS      ,_param->_nb_inst_predict,_param->_size_address);
     36        DELETE1_SIGNAL(out_PREDICT_DIRECTION    ,_param->_nb_inst_predict,1                    );
     37        DELETE1_SIGNAL(out_PREDICT_HISTORY      ,_param->_nb_inst_predict,_param->_size_history);
     38        if (_param->_update_on_prediction)                               
     39          {                                                             
     40        DELETE1_SIGNAL( in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict,1                    );
     41        DELETE1_SIGNAL( in_PREDICT_DIRECTION    ,_param->_nb_inst_predict,1                    );
     42          }
     43       
     44        DELETE1_SIGNAL( in_UPDATE_VAL           ,_param->_nb_inst_update,1                    );
     45        DELETE1_SIGNAL(out_UPDATE_ACK           ,_param->_nb_inst_update,1                    );
     46        DELETE1_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update,_param->_size_address);
     47        DELETE1_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update,_param->_size_history);
     48        DELETE1_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update,1                    );
     49        if (_param->_update_on_prediction)                             
     50        DELETE1_SIGNAL( in_UPDATE_MISS          ,_param->_nb_inst_update,1                    );
     51       
     52        if (_param->_have_bht)
     53        DELETE1(reg_BHT                         ,_param->_bht_nb_shifter);
     54        if (_param->_have_pht)
     55        DELETE2(reg_PHT                         ,_param->_pht_nb_bank,_param->_pht_size_bank);
     56       
     57        DELETE1(internal_PREDICT_ACK            ,_param->_nb_inst_predict);
     58        if (_param->_update_on_prediction)     
     59          {                                     
     60        if (_param->_have_bht)
     61        DELETE1(internal_PREDICT_BHT_NUM_REG    ,_param->_nb_inst_predict);
     62        if (_param->_have_pht)
     63          {
     64        DELETE1(internal_PREDICT_PHT_NUM_BANK   ,_param->_nb_inst_predict);
     65        DELETE1(internal_PREDICT_PHT_NUM_REG    ,_param->_nb_inst_predict);
     66          }
     67          }                                     
     68        DELETE1(internal_UPDATE_ACK             ,_param->_nb_inst_update );
    3269      }
    3370    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
  • 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

    r110 r111  
    2525  {
    2626    log_begin(Two_Level_Branch_Predictor,FUNCTION);
     27    log_function(Two_Level_Branch_Predictor,FUNCTION,_name.c_str());
     28
     29    if (PORT_READ(in_NRESET) == 0)
     30      {
     31      }
     32    else
     33      {
     34        // ===================================================================
     35        // =====[ PREDICT ]===================================================
     36        // ===================================================================
     37
     38        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     39          if (PORT_READ(in_PREDICT_VAL[i]) and internal_PREDICT_ACK[i])
     40            {
     41              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * PREDICT [%d]",i);
     42
     43              // Predict if
     44              //  * update_on_prediction and direction is valid
     45              if (_param->_update_on_prediction)
     46                if (PORT_READ(in_PREDICT_DIRECTION_VAL [i]))
     47                  {
     48                    Tcontrol_t direction = PORT_READ(in_PREDICT_DIRECTION [i]);
     49                   
     50                    if (_param->_have_bht)
     51                      {
     52                        Thistory_t bht_num_reg = internal_PREDICT_BHT_NUM_REG [i];
     53                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_num_reg      : %d",bht_num_reg);
     54
     55                        Thistory_t bht_history = reg_BHT[bht_num_reg];
     56                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",bht_history);
     57
     58                       
     59                        bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
     60                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (new): %x",bht_history);
     61                        reg_BHT [bht_num_reg] = bht_history;
     62                      }
     63
     64                    if (_param->_have_pht)
     65                      {
     66                        Thistory_t pht_num_reg = internal_PREDICT_PHT_NUM_REG  [i];
     67                        Thistory_t pht_num_bank= internal_PREDICT_PHT_NUM_BANK [i];
     68                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %d",pht_num_reg);
     69                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %d",pht_num_bank);
     70
     71                        Thistory_t pht_history = reg_PHT [pht_num_bank][pht_num_reg];
     72                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (old): %x",pht_history);
     73                       
     74                        // PHT : saturation counter
     75                        pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history));
     76                       
     77                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (new): %x",pht_history);
     78                       
     79                        reg_PHT [pht_num_bank][pht_num_reg] = pht_history;
     80                      }
     81                  }
     82            }       
     83
     84        // ===================================================================
     85        // =====[ UPDATE ]====================================================
     86        // ===================================================================
     87       
     88        for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
     89          if (PORT_READ(in_UPDATE_VAL[i]) and internal_UPDATE_ACK[i])
     90            {
     91              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * UPDATE [%d]",i);
     92             
     93              // Update if
     94              //  * update_on_prediction and miss
     95              //  * not update_on_prediction
     96              if (not _param->_update_on_prediction or (_param->_update_on_prediction and PORT_READ(in_UPDATE_MISS [i])))
     97                {
     98                  Taddress_t address     = PORT_READ(in_UPDATE_ADDRESS   [i]);
     99                  Thistory_t history     = PORT_READ(in_UPDATE_HISTORY   [i]);
     100                  Tcontrol_t direction   = PORT_READ(in_UPDATE_DIRECTION [i])&1;
     101
     102                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * address          : %.8x",address);
     103                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * direction        : %d",direction);
     104
     105                  Thistory_t pht_bht_history = 0;
     106
     107                  if (_param->_have_bht)
     108                    {
     109                      Thistory_t bht_history = (history>>_param->_bht_history_rshift)&_param->_bht_history_mask;
     110                      Thistory_t bht_num_reg = address & _param->_bht_address_mask;
     111                     
     112                      pht_bht_history = bht_history;
     113                     
     114                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",bht_history);
     115                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_num_reg      : %x",bht_num_reg);
     116                     
     117                      // BHT : shift register
     118                     
     119                      bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
     120                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (new): %x",bht_history);
     121                      reg_BHT [bht_num_reg]               = bht_history;
     122                    }
     123
     124                  if (_param->_have_pht)
     125                    {
     126                      Thistory_t pht_history = (history>>_param->_pht_history_rshift)&_param->_pht_history_mask;
     127                      Thistory_t pht_num_reg = pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift);
     128                      Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask;
     129                     
     130                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",pht_bht_history);
     131                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (old): %x",pht_history);
     132                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %x",pht_num_reg);
     133                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %x",pht_num_bank);
     134                     
     135                      // PHT : saturation counter
     136                      pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history));
     137                     
     138                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (new): %x",pht_history);
     139                     
     140                      reg_PHT [pht_num_bank][pht_num_reg] = pht_history;
     141                    }
     142                }
     143            }
     144      }
     145
     146#if defined(DEBUG) and DEBUG_Two_Level_Branch_Predictor and (DEBUG >= DEBUG_TRACE)
     147    if (0)
     148    {
     149      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * Dump Two_Level_Branch_Predictor");
     150
     151      if (_param->_have_bht)
     152        {
     153          log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * Dump BHT");
     154
     155          uint32_t limit = 4;
     156
     157          for (uint32_t i=0; i<_param->_bht_nb_shifter; i+=limit)
     158            {
     159              std::string str = "";
     160
     161              for (uint32_t j=0; j<limit; j++)
     162                {
     163                  uint32_t index = i+j;
     164                  if (index >= _param->_bht_nb_shifter)
     165                    break;
     166                  else
     167                    str+=toString("[%.4d] %.4x ",index,reg_BHT[index]);
     168                }
     169             
     170              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    %s",str.c_str());
     171            }
     172        }
     173
     174      if (_param->_have_pht)
     175        {
     176          log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * Dump PHT");
     177
     178          uint32_t limit = 4;
     179
     180          for (uint32_t num_bank=0; num_bank <_param->_pht_nb_bank; ++num_bank)
     181            {
     182              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  [%.4d]",num_bank);
     183
     184              for (uint32_t i=0; i<_param->_pht_size_bank; i+=limit)
     185                {
     186                  std::string str = "";
     187                 
     188                  for (uint32_t j=0; j<limit; j++)
     189                    {
     190                      uint32_t index = i+j;
     191                      if (index >= _param->_pht_nb_counter)
     192                        break;
     193                      else
     194                        str+=toString("[%.4d] %.4x ",index,reg_PHT[num_bank][index]);
     195                    }
     196                 
     197                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    %s",str.c_str());
     198                }
     199            }
     200        }
     201    }
     202#endif
    27203
    28204#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Meta_Predictor.h

    r110 r111  
    1212#include "systemc.h"
    1313#endif
     14
     15#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h"
     16#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h"
    1417
    1518#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Parameters.h"
     
    6568  public    : SC_IN (Tcontrol_t)            *  in_NRESET       ;
    6669
     70    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     71  public    : SC_IN (Tcontrol_t)           **  in_PREDICT_VAL          ;//[nb_inst_predict]
     72  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_ACK          ;//[nb_inst_predict]
     73  public    : SC_IN (Taddress_t)           **  in_PREDICT_ADDRESS      ;//[nb_inst_predict]
     74  public    : SC_OUT(Tcontrol_t)           ** out_PREDICT_DIRECTION    ;//[nb_inst_predict] // = MSB[history]
     75  public    : SC_OUT(Thistory_t)           ** out_PREDICT_HISTORY      ;//[nb_inst_predict]
     76
     77    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     78  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_VAL           ;//[nb_inst_update]
     79  public    : SC_OUT(Tcontrol_t)           ** out_UPDATE_ACK           ;//[nb_inst_update]
     80  public    : SC_IN (Taddress_t)           **  in_UPDATE_ADDRESS       ;//[nb_inst_update]
     81  public    : SC_IN (Thistory_t)           **  in_UPDATE_HISTORY       ;//[nb_inst_update]
     82  public    : SC_IN (Tcontrol_t)           **  in_UPDATE_DIRECTION     ;//[nb_inst_update]
     83
    6784    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     85  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]
     86  private   : morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue       ::Meta_Predictor_Glue         * _component_glue;
    6887
    6988    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Parameters.h

    r110 r111  
    99 */
    1010
     11#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h"
     12#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Parameters.h"
     13
    1114#include "Behavioural/include/Parameters.h"
    1215#include "Common/include/Debug.h"
     16
    1317
    1418namespace morpheo {
     
    2529  {
    2630    //-----[ fields ]------------------------------------------------------------
     31  public : uint32_t   _nb_inst_predict           ;
     32  public : uint32_t   _nb_inst_update            ;
     33  public : uint32_t   _size_address              ;
     34  public : bool       _have_bht               [3];
     35  public : uint32_t   _bht_size_shifter       [3];
     36  public : uint32_t   _bht_nb_shifter         [3];
     37  public : bool       _have_pht               [3];
     38  public : uint32_t   _pht_size_counter       [3];
     39  public : uint32_t   _pht_nb_counter         [3];
     40  public : uint32_t   _pht_size_address_share [3];
     41                     
     42  public : bool       _have_meta_predictor       ;
     43  public : uint32_t   _nb_predictor              ;
     44
     45  public : bool     * _predictor_update_on_prediction;//[nb_predictor]
     46  public : uint32_t * _predictor_size_history        ;//[nb_predictor]
     47  public : uint32_t   _size_history                  ;
     48                       
     49  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]
     50  public : morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue       ::Parameters  * _param_glue;
    2751
    2852    //-----[ methods ]-----------------------------------------------------------
    29   public : Parameters  (bool is_toplevel=false);
     53  public : Parameters  (uint32_t nb_inst_predict           ,
     54                        uint32_t nb_inst_update            ,
     55                        uint32_t size_address              ,
     56                        bool     have_bht               [3],
     57                        uint32_t bht_size_shifter       [3],
     58                        uint32_t bht_nb_shifter         [3],
     59                        bool     have_pht               [3],
     60                        uint32_t pht_size_counter       [3],
     61                        uint32_t pht_nb_counter         [3],
     62                        uint32_t pht_size_address_share [3],
     63                        bool     is_toplevel=false);
    3064//public : Parameters  (Parameters & param) ;
    3165  public : ~Parameters (void);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Meta_Predictor_allocation.cpp

    r110 r111  
    1818namespace meta_predictor {
    1919
    20 
    21 
    2220#undef  FUNCTION
    2321#define FUNCTION "Meta_Predictor::allocation"
     
    5755      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
    5856    }
     57
     58    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     59    {
     60      ALLOC1_INTERFACE("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict);
     61
     62      ALLOC1_VALACK_IN ( in_PREDICT_VAL          ,VAL);
     63      ALLOC1_VALACK_OUT(out_PREDICT_ACK          ,ACK);
     64      ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS      ,"ADDRESS"      ,Taddress_t,_param->_size_address);
     65      ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
     66      ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY      ,"HISTORY"      ,Thistory_t,_param->_size_history);
     67    }
     68
     69    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     70    {
     71      ALLOC1_INTERFACE("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update);
     72
     73      ALLOC1_VALACK_IN ( in_UPDATE_VAL           ,VAL);
     74      ALLOC1_VALACK_OUT(out_UPDATE_ACK           ,ACK);
     75      ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS       ,"ADDRESS"      ,Taddress_t,_param->_size_address);
     76      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY       ,"HISTORY"      ,Thistory_t,_param->_size_history);
     77      ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION     ,"DIRECTION"    ,Tcontrol_t,1                    );
     78    }
    5979   
    6080    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     81
     82    std::string name;
     83
     84   
     85    {
     86      _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];
     87
     88      for (uint32_t i=0; i<_param->_nb_predictor; ++i)
     89        {
     90          name = _name+"_two_level_branch_predictor_"+toString(i);
     91          log_printf(INFO,Meta_Predictor,FUNCTION,_("Create   : %s"),name.c_str());
     92         
     93          _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
     94            (name.c_str()
     95#ifdef STATISTICS
     96             ,param_statistics
     97#endif
     98             ,_param->_param_two_level_branch_predictor[i]
     99             ,_usage);
     100         
     101          _component->set_component (_component_two_level_branch_predictor[i]->_component
     102#ifdef POSITION
     103                                     , 50, 50, 10, 10
     104#endif
     105                                     );
     106        }
     107    }
     108   
     109    {
     110      name = _name+"_glue";
     111      log_printf(INFO,Meta_Predictor,FUNCTION,_("Create   : %s"),name.c_str());
     112     
     113      _component_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue::Meta_Predictor_Glue
     114        (name.c_str()
     115#ifdef STATISTICS
     116         ,param_statistics
     117#endif
     118         ,_param->_param_glue
     119         ,_usage);
     120     
     121      _component->set_component (_component_glue->_component
     122#ifdef POSITION
     123                                 , 50, 50, 10, 10
     124#endif
     125                                 );
     126    }
    61127   
    62128    // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    63129    std::string src,dest;
     130
     131    // ===================================================================
     132    // =====[ Two_Level_Branch_Predictor ]================================
     133    // ===================================================================
     134   
     135    for (uint32_t i=0; i<_param->_nb_predictor; ++i)
     136    {
     137      src = _name+"_two_level_branch_predictor_"+toString(i);
     138      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
     139     
     140      {
     141        dest = _name;
     142#ifdef POSITION
     143        _component->interface_map (src ,"",
     144                                   dest,"");
     145#endif
     146
     147        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
     148        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
     149      }
     150
     151      // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     152      for (uint32_t j=0; j<_param->_nb_inst_predict; ++j)
     153        {
     154          dest = _name;
     155
     156#ifdef POSITION
     157          _component->interface_map (src ,"predict_"+toString(j),
     158                                     dest,"predict_"+toString(j));
     159#endif
     160
     161          PORT_MAP(_component,src , "in_PREDICT_"+toString(j)+"_ADDRESS"      ,
     162                              dest, "in_PREDICT_"+toString(j)+"_ADDRESS"      );
     163
     164          dest = _name+"_glue";
     165
     166#ifdef POSITION
     167          _component->interface_map (src ,"predict_"+toString(j),
     168                                     dest,"predict_predictor_"+toString(i)+"_"+toString(j));
     169#endif
     170
     171          COMPONENT_MAP(_component,src , "in_PREDICT_"                          +toString(j)+"_VAL"          ,
     172                                   dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_VAL"          );
     173          COMPONENT_MAP(_component,src ,"out_PREDICT_"                          +toString(j)+"_ACK"          ,
     174                                   dest, "in_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ACK"          );
     175//        COMPONENT_MAP(_component,src , "in_PREDICT_"                          +toString(j)+"_ADDRESS"      ,
     176//                                 dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ADDRESS"      );
     177          COMPONENT_MAP(_component,src ,"out_PREDICT_"                          +toString(j)+"_DIRECTION"    ,
     178                                   dest, "in_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION"    );
     179          COMPONENT_MAP(_component,src ,"out_PREDICT_"                          +toString(j)+"_HISTORY"      ,
     180                                   dest, "in_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_HISTORY"      );
     181          if (_param->_predictor_update_on_prediction [i])
     182            {
     183          COMPONENT_MAP(_component,src , "in_PREDICT_"                          +toString(j)+"_DIRECTION_VAL",
     184                                   dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION_VAL");
     185          COMPONENT_MAP(_component,src , "in_PREDICT_"                          +toString(j)+"_DIRECTION"    ,
     186                                   dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION"    );
     187            }
     188        }
     189
     190      // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     191      for (uint32_t j=0; j<_param->_nb_inst_update; ++j)
     192        {
     193          dest = _name;
     194
     195#ifdef POSITION
     196          _component->interface_map (src ,"update_"+toString(j),
     197                                     dest,"update_"+toString(j));
     198#endif
     199
     200          PORT_MAP(_component,src , "in_UPDATE_"+toString(j)+"_ADDRESS"      ,
     201                              dest, "in_UPDATE_"+toString(j)+"_ADDRESS"      );
     202
     203          dest = _name+"_glue";
     204
     205#ifdef POSITION
     206          _component->interface_map (src ,"update_"+toString(j),
     207                                     dest,"update_predictor_"+toString(i)+"_"+toString(j));
     208#endif
     209
     210          COMPONENT_MAP(_component,src , "in_UPDATE_"                          +toString(j)+"_VAL"          ,
     211                                   dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_VAL"          );
     212          COMPONENT_MAP(_component,src ,"out_UPDATE_"                          +toString(j)+"_ACK"          ,
     213                                   dest, "in_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ACK"          );
     214//        COMPONENT_MAP(_component,src , "in_UPDATE_"                          +toString(j)+"_ADDRESS"      ,
     215//                                 dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ADDRESS"      );
     216          COMPONENT_MAP(_component,src , "in_UPDATE_"                          +toString(j)+"_DIRECTION"    ,
     217                                   dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION"    );
     218          COMPONENT_MAP(_component,src , "in_UPDATE_"                          +toString(j)+"_HISTORY"      ,
     219                                   dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_HISTORY"      );
     220          if (_param->_predictor_update_on_prediction [i])
     221          COMPONENT_MAP(_component,src , "in_UPDATE_"                          +toString(j)+"_MISS"         ,
     222                                   dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_MISS"         );
     223        }
     224//     // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     225//   public    : SC_IN (Tcontrol_t)           **  in_UPDATE_VAL           ;//[nb_inst_update]
     226//   public    : SC_OUT(Tcontrol_t)           ** out_UPDATE_ACK           ;//[nb_inst_update]
     227//   public    : SC_IN (Taddress_t)           **  in_UPDATE_ADDRESS       ;//[nb_inst_update]
     228//   public    : SC_IN (Thistory_t)           **  in_UPDATE_HISTORY       ;//[nb_inst_update]
     229//   public    : SC_IN (Tcontrol_t)           **  in_UPDATE_DIRECTION     ;//[nb_inst_update]
     230//   public    : SC_IN (Tcontrol_t)           **  in_UPDATE_MISS          ;//[nb_inst_update] // if update_on_prediction
     231
     232    }
     233     
     234    // ===================================================================   
     235    // =====[ Glue ]======================================================   
     236    // ===================================================================   
     237
     238    {
     239      src = _name+"_glue";
     240      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
     241     
     242      {
     243        dest = _name;
     244#ifdef POSITION
     245        _component->interface_map (src ,"",
     246                                   dest,"");
     247#endif
     248
     249        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
     250        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
     251      }
     252
     253      // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     254      for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     255        {
     256          dest = _name;
     257#ifdef POSITION
     258          _component->interface_map (src ,"predict_"+toString(i),
     259                                     dest,"predict_"+toString(i));
     260#endif
     261           
     262          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VAL"      ,
     263                              dest, "in_PREDICT_"+toString(i)+"_VAL"      );
     264          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ACK"      ,
     265                              dest,"out_PREDICT_"+toString(i)+"_ACK"      );
     266          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_HISTORY"  ,
     267                              dest,"out_PREDICT_"+toString(i)+"_HISTORY"  );
     268          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_DIRECTION",
     269                              dest,"out_PREDICT_"+toString(i)+"_DIRECTION");
     270        }
     271
     272      //  out_PREDICT_PREDICTOR_VAL           -> two_level_branch_predictor. in_PREDICT_PREDICTOR_VAL         
     273      //   in_PREDICT_PREDICTOR_ACK           -> two_level_branch_predictor.out_PREDICT_PREDICTOR_ACK         
     274      //   in_PREDICT_PREDICTOR_HISTORY       -> two_level_branch_predictor.out_PREDICT_PREDICTOR_HISTORY     
     275      //   in_PREDICT_PREDICTOR_DIRECTION     -> two_level_branch_predictor.out_PREDICT_PREDICTOR_DIRECTION   
     276      //  out_PREDICT_PREDICTOR_DIRECTION_VAL -> two_level_branch_predictor. in_PREDICT_PREDICTOR_DIRECTION_VAL
     277      //  out_PREDICT_PREDICTOR_DIRECTION     -> two_level_branch_predictor. in_PREDICT_PREDICTOR_DIRECTION   
     278
     279      // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     280      for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
     281        {
     282          dest = _name;
     283#ifdef POSITION
     284          _component->interface_map (src ,"update_"+toString(i),
     285                                     dest,"update_"+toString(i));
     286#endif
     287
     288          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VAL"      ,
     289                              dest, "in_UPDATE_"+toString(i)+"_VAL"      );
     290          PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_ACK"      ,
     291                              dest,"out_UPDATE_"+toString(i)+"_ACK"      );
     292          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_HISTORY"  ,
     293                              dest, "in_UPDATE_"+toString(i)+"_HISTORY"  );
     294          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_DIRECTION",
     295                              dest, "in_UPDATE_"+toString(i)+"_DIRECTION");
     296        }
     297     
     298      //  out_UPDATE_PREDICTOR_VAL       -> two_level_branch_predictor. in_UPDATE_PREDICTOR_VAL     
     299      //   in_UPDATE_PREDICTOR_ACK       -> two_level_branch_predictor.out_UPDATE_PREDICTOR_ACK     
     300      //  out_UPDATE_PREDICTOR_HISTORY   -> two_level_branch_predictor. in_UPDATE_PREDICTOR_HISTORY 
     301      //  out_UPDATE_PREDICTOR_DIRECTION -> two_level_branch_predictor. in_UPDATE_PREDICTOR_DIRECTION
     302      //  out_UPDATE_PREDICTOR_MISS      -> two_level_branch_predictor. in_UPDATE_PREDICTOR_MISS     
     303
     304    }
    64305
    65306    // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Meta_Predictor_deallocation.cpp

    r110 r111  
    2929        delete    in_CLOCK ;
    3030        delete    in_NRESET;
     31
     32        DELETE1_SIGNAL( in_PREDICT_VAL          ,_param->_nb_inst_predict,1                    );
     33        DELETE1_SIGNAL(out_PREDICT_ACK          ,_param->_nb_inst_predict,1                    );
     34        DELETE1_SIGNAL( in_PREDICT_ADDRESS      ,_param->_nb_inst_predict,_param->_size_address);
     35        DELETE1_SIGNAL(out_PREDICT_DIRECTION    ,_param->_nb_inst_predict,1                    );
     36        DELETE1_SIGNAL(out_PREDICT_HISTORY      ,_param->_nb_inst_predict,_param->_size_history);
     37       
     38        DELETE1_SIGNAL( in_UPDATE_VAL           ,_param->_nb_inst_update,1                    );
     39        DELETE1_SIGNAL(out_UPDATE_ACK           ,_param->_nb_inst_update,1                    );
     40        DELETE1_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update,_param->_size_address);
     41        DELETE1_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update,_param->_size_history);
     42        DELETE1_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update,1                    );
    3143      }
    3244    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    3345
     46    DELETE0(_component_glue);
     47    DELETE1(_component_two_level_branch_predictor,_param->_nb_predictor);
     48
    3449    delete _component;
     50
    3551
    3652    log_end(Meta_Predictor,FUNCTION);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Parameters.cpp

    r110 r111  
    77
    88#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Parameters.h"
     9#include "Behavioural/include/Allocation.h"
    910
    1011namespace morpheo {
     
    2021#undef  FUNCTION
    2122#define FUNCTION "Meta_Predictor::Parameters"
    22   Parameters::Parameters (bool is_toplevel)
     23  Parameters::Parameters (uint32_t nb_inst_predict           ,
     24                          uint32_t nb_inst_update            ,
     25                          uint32_t size_address              ,
     26                          bool     have_bht               [3],
     27                          uint32_t bht_size_shifter       [3],
     28                          uint32_t bht_nb_shifter         [3],
     29                          bool     have_pht               [3],
     30                          uint32_t pht_size_counter       [3],
     31                          uint32_t pht_nb_counter         [3],
     32                          uint32_t pht_size_address_share [3],
     33                          bool     is_toplevel)
    2334  {
    2435    log_begin(Meta_Predictor,FUNCTION);
    2536
     37    _nb_inst_predict            = nb_inst_predict           ;
     38    _nb_inst_update             = nb_inst_update            ;
     39    _size_address               = size_address              ;
     40    for (uint32_t i=0; i<3; ++i)
     41      {
     42    _have_bht               [i] =                 have_bht               [i];
     43    _bht_size_shifter       [i] = (_have_bht [i])?bht_size_shifter       [i]:0;
     44    _bht_nb_shifter         [i] = (_have_bht [i])?bht_nb_shifter         [i]:0;
     45    _have_pht               [i] =                 have_pht               [i];
     46    _pht_size_counter       [i] = (_have_pht [i])?pht_size_counter       [i]:0;
     47    _pht_nb_counter         [i] = (_have_pht [i])?pht_nb_counter         [i]:0;
     48    _pht_size_address_share [i] = (_have_bht[i] and _have_pht [i])?pht_size_address_share [i]:0;
     49      }
     50
    2651    test();
    2752
     53    _have_meta_predictor        = (_have_bht [2] or _have_pht [2]);
     54    _nb_predictor               = (_have_meta_predictor)?3:1;
     55   
     56    ALLOC1(_predictor_update_on_prediction,bool    , _nb_predictor);
     57    ALLOC1(_predictor_size_history        ,uint32_t, _nb_predictor);
     58   
     59    // All predictor can update on prediction ....
     60    for (uint32_t i=0; i<_nb_predictor; ++i)
     61      _predictor_update_on_prediction [i] = true;
     62
     63    // ... But the selector prediction can't
     64    if (_have_meta_predictor)
     65      _predictor_update_on_prediction [_nb_predictor-1] = false;
     66
     67    _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];
     68    for (uint32_t i=0; i<_nb_predictor; ++i)
     69      {
     70        _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
     71          (_nb_inst_predict                   ,
     72           _nb_inst_update                    ,
     73           _size_address                      ,
     74           _have_bht                       [i],
     75           _bht_size_shifter               [i],
     76           _bht_nb_shifter                 [i],
     77           _have_pht                       [i],
     78           _pht_size_counter               [i],
     79           _pht_nb_counter                 [i],
     80           _pht_size_address_share         [i],
     81           _predictor_update_on_prediction [i]
     82           );
     83
     84        _predictor_size_history [i] = _param_two_level_branch_predictor [i]->_size_history;
     85      }
     86
     87    _param_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue::Parameters 
     88      (
     89       _nb_inst_predict               ,
     90       _nb_inst_update                ,
     91       _nb_predictor                  ,
     92       _predictor_size_history        ,
     93       _predictor_update_on_prediction
     94       );
     95    _size_history = _param_glue->_size_history;
     96   
    2897    if (is_toplevel)
    2998      {
     
    48117  {
    49118    log_begin(Meta_Predictor,FUNCTION);
     119
     120    DELETE1(_param_two_level_branch_predictor, _nb_predictor);
     121
     122    DELETE1(_predictor_size_history          , _nb_predictor);
     123    DELETE1(_predictor_update_on_prediction  , _nb_predictor);
     124
    50125    log_end(Meta_Predictor,FUNCTION);
    51126  };
     
    56131  {
    57132    log_begin(Meta_Predictor,FUNCTION);
     133
     134    COPY(_param_glue);
     135    for (uint32_t i=0; i<_nb_predictor; ++i)
     136      COPY(_param_two_level_branch_predictor [i]);
     137
    58138    log_end(Meta_Predictor,FUNCTION);
    59139  };
Note: See TracChangeset for help on using the changeset viewer.