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
Files:
9 added
54 edited
4 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  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/include/Direction.h

    r82 r111  
    1313#endif
    1414
     15#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Direction_Glue/include/Direction_Glue.h"
     16#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Meta_Predictor.h"
    1517#include <iostream>
    1618#include "Common/include/ToString.h"
     
    2729#endif
    2830#include "Behavioural/include/Usage.h"
    29 
    30 #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Direction_Glue/include/Direction_Glue.h"
    3131
    3232namespace morpheo {
     
    7979
    8080    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     81  public    : morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Meta_Predictor * _component_meta_predictor;
    8182  public    : morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::direction_glue::Direction_Glue * _component_glue;
    8283
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/include/Parameters.h

    r88 r111  
    1414
    1515#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Direction_Glue/include/Parameters.h"
     16#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Parameters.h"
    1617
    1718namespace morpheo {
     
    4546
    4647  public : morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::direction_glue::Parameters * _param_glue;
     48  public : morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Parameters * _param_meta_predictor;
    4749
    4850    //-----[ methods ]-----------------------------------------------------------
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/src/Direction_allocation.cpp

    r88 r111  
    8484    std::string name;
    8585
     86    if (_param->_have_component_meta_predictor)
     87    {
     88      name = _name+"_meta_predictor";
     89      log_printf(INFO,Prediction_unit,FUNCTION,_("Create   : %s"),name.c_str());
     90     
     91      _component_meta_predictor = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Meta_Predictor
     92        (name.c_str()
     93#ifdef STATISTICS
     94         ,param_statistics
     95#endif
     96         ,_param->_param_meta_predictor
     97         ,_usage);
     98     
     99      _component->set_component (_component_meta_predictor->_component
     100#ifdef POSITION
     101                                 , 50, 50, 10, 10
     102#endif
     103                                 );
     104    }
     105
    86106    {
    87107      name = _name+"_glue";
     
    105125    // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    106126    std::string src,dest;
     127
     128    // ===================================================================   
     129    // =====[ Meta_Predictor ]============================================   
     130    // ===================================================================   
     131    if (_param->_have_component_meta_predictor)
     132    {
     133      src = _name+"_meta_predictor";
     134      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
     135     
     136      {
     137        dest = _name;
     138#ifdef POSITION
     139        _component->interface_map (src ,"",
     140                                   dest,"");
     141#endif
     142
     143        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
     144        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
     145      }
     146
     147      for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
     148        {
     149          dest = _name+"_glue";
     150#ifdef POSITION
     151          _component->interface_map (src ,"predict_"          +toString(i),
     152                                     dest,"predict_predictor_"+toString(i));
     153#endif
     154         
     155          COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+          "_VAL"        ,
     156                                   dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL"        );
     157          COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+          "_ACK"        ,
     158                                   dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK"        );
     159          COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+          "_ADDRESS"    ,
     160                                   dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC");
     161          COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+          "_DIRECTION"  ,
     162                                   dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION"  );
     163          COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+          "_HISTORY"    ,
     164                                   dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY"    );
     165        }
     166
     167      for (uint32_t i=0; i<_param->_nb_inst_update; i++)
     168        {
     169          dest = _name+"_glue";
     170#ifdef POSITION
     171          _component->interface_map (src ,"update_"          +toString(i),
     172                                     dest,"update_predictor_"+toString(i));
     173#endif
     174         
     175          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_VAL"        ,
     176                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL"        );
     177          COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+          "_ACK"        ,
     178                                   dest, "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK"        );
     179          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_ADDRESS"    ,
     180                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS"    );
     181          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_DIRECTION"  ,
     182                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION"  );
     183          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_HISTORY"    ,
     184                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY"    );
     185        }
     186    }
    107187   
     188    // ===================================================================   
     189    // =====[ Glue ]======================================================   
     190    // ===================================================================   
    108191    {
    109192      src = _name+"_glue";
     
    179262    }
    180263    // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    181 //      _component->test_map();
     264    if (DEBUG_Direction == true)
     265      _component->test_map();
    182266
    183267#ifdef POSITION
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/src/Direction_deallocation.cpp

    r88 r111  
    4545    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    4646    delete _component_glue;
     47    if (_param->_have_component_meta_predictor)
     48    delete _component_meta_predictor;
    4749    delete _component;
    4850
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/src/Parameters.cpp

    r88 r111  
    134134      }
    135135
    136     _size_history = 0;
     136    test();
     137
     138    if (_have_component_meta_predictor)
     139      _param_meta_predictor = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Parameters
     140        (
     141         _nb_inst_predict       ,
     142         _nb_inst_update        ,
     143          size_address          ,
     144         _have_bht              ,
     145         _bht_size_shifter      ,
     146         _bht_nb_shifter        ,
     147         _have_pht              ,
     148         _pht_size_counter      ,
     149         _pht_nb_counter        ,
     150         _pht_size_address_share
     151         );
    137152   
    138     for (uint32_t i=0; i<3; i++)
    139       _size_history += (((_have_bht [i])?_bht_size_shifter [i]:0) +
    140                         ((_have_pht [i])?_pht_size_counter [i]:0));
    141    
    142     _have_port_history = (_size_history > 0);
    143 
    144     test();
     153    _size_history = (_have_component_meta_predictor)?_param_meta_predictor->_size_history:0;
     154
     155    log_printf(TRACE,Direction,FUNCTION,"  * size_history : %d",_size_history);
     156
     157//     _size_history = 0;
     158//     for (uint32_t i=0; i<3; i++)
     159//       _size_history += (((_have_bht [i])?_bht_size_shifter [i]:0) +
     160//                         ((_have_pht [i])?_pht_size_counter [i]:0));
     161   
     162     _have_port_history = (_size_history > 0);
    145163
    146164    _param_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::direction_glue::Parameters
     
    177195
    178196    delete _param_glue;
     197    if (_have_component_meta_predictor)
     198    delete _param_meta_predictor;
     199
    179200    log_printf(FUNC,Direction,FUNCTION,"End");
    180201  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/src/Parameters_msg_error.cpp

    r81 r111  
    3939      case PREDICTOR_STATIC      :
    4040      case PREDICTOR_LAST_TAKE   :
    41         {
    42           break;
    43         }
    4441      case PREDICTOR_COUNTER     :
    4542      case PREDICTOR_LOCAL       :
     
    4744      case PREDICTOR_META        :
    4845      case PREDICTOR_CUSTOM      :
     46        {
     47          break;
     48        }
     49      default :
    4950        {
    5051          test.error("Unimplemented predictor_scheme : \""+toString(_predictor_scheme)+"\". (Coming Soon)");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Prediction_unit_Glue/src/Prediction_unit_Glue_genMealy_predict.cpp

    r107 r111  
    254254                        {
    255255                          log_printf(TRACE,Prediction_unit_Glue,FUNCTION,"      * BRANCH_CONDITION_READ_STACK");
     256                          log_printf(TRACE,Prediction_unit_Glue,FUNCTION,"        * ras_hit : %d",PORT_READ(in_PREDICT_RAS_HIT [i]));
    256257                          use_upt      = true;
    257258                          use_ras      = true;
    258259                          push         = false;
    259260                          direction    = true;
    260                           pc_next      = PORT_READ(in_PREDICT_RAS_HIT [i])?PORT_READ(in_PREDICT_RAS_ADDRESS_POP [i]):address_dest;
     261                          address_dest = PORT_READ(in_PREDICT_RAS_HIT [i])?PORT_READ(in_PREDICT_RAS_ADDRESS_POP [i]):address_dest;
     262                          pc_next      = address_dest;
    261263                          branch_state = BRANCH_STATE_SPEC_TAKE;
    262264                          is_accurate  &= (PORT_READ(in_PREDICT_RAS_HIT [i]) or btb_is_accurate); // if miss - prediction is not accurate
     
    273275                    log_printf(TRACE,Prediction_unit_Glue,FUNCTION,"    * direction             : %d",direction);
    274276                    log_printf(TRACE,Prediction_unit_Glue,FUNCTION,"    * branch_state          : %d",branch_state);
    275                     log_printf(TRACE,Prediction_unit_Glue,FUNCTION,"    * pc_next               : %.8x",pc_next);
     277                    log_printf(TRACE,Prediction_unit_Glue,FUNCTION,"    * pc_next               : 0x%.8x (0x%.8x)",pc_next,pc_next<<2);
    276278
    277279                    if (use_dir)
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_transition.cpp

    r107 r111  
    7676                  if (push)
    7777                    {
     78                      Taddress_t address = PORT_READ(in_PREDICT_ADDRESS_PUSH [i]);
     79
    7880                      log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * push (call procedure)");
     81                      log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * address_push        : 0x%.8x",address);
    7982
    8083                      // push : increase the top (circular)
     
    8285
    8386                      // Write new value in Queue
    84                       reg_stack [context][top_new]._address = PORT_READ(in_PREDICT_ADDRESS_PUSH [i]);
     87                      reg_stack [context][top_new]._address = address;
    8588
    8689                      // Test if full
     
    150153              if (push)
    151154                {
     155                  Taddress_t address = PORT_READ(in_DECOD_ADDRESS_PUSH [i]);
     156                 
    152157                  log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * push (call procedure)");
     158                  log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * address_push        : 0x%.8x",address);
    153159                 
    154160                  // push : increase the top (circular)
     
    156162                 
    157163                  // Write new value in Queue
    158                   reg_stack [context][top_new]._address = PORT_READ(in_DECOD_ADDRESS_PUSH [i]);
     164                  reg_stack [context][top_new]._address = address;
    159165                 
    160166                  // Test if full
     
    201207              //   if decod miss : ifetch can have predict call and return branchement. Also, the head of decod can be false
    202208
    203 //            Tcontrol_t miss       = PORT_READ(in_DECOD_MISS_PREDICTION [i]);
    204 
    205 //            if (miss)
    206 //              {
     209              Tcontrol_t miss       = PORT_READ(in_DECOD_MISS_PREDICTION [i]);
     210
     211              log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * miss                : %d",miss);
     212
     213              if (miss)
     214                {
     215
    207216//                reg_PREDICT_BOTTOM [context] = reg_BOTTOM [context];
    208 //                reg_PREDICT_TOP    [context] = reg_TOP    [context];
    209 //                reg_PREDICT_NB_ELT [context] = reg_NB_ELT [context];
    210                  
    211 //                // Scan full assoc !!!
    212 //                for (uint32_t j=0; j<_param->_size_queue [context]; j++)
    213 //                  // Test if this slot is tagged with "predict" : if true, tagged as miss
    214 //                  if (reg_stack [context][j]._predict)
    215 //                    {
    216 //                      reg_stack [context][j]._predict = false;
    217 //                      reg_stack [context][j]._miss    = true;
    218 //                    }
    219 //              }
     217                  reg_PREDICT_TOP    [context] = reg_TOP    [context];
     218                  reg_PREDICT_NB_ELT [context] = reg_NB_ELT [context];
     219                }
    220220            }
    221221
     
    252252                    {
    253253                      // reinsert push value
    254                       reg_stack [context_id][0]._address = PORT_READ(in_UPDATE_ADDRESS [i]);
     254                      Taddress_t address = PORT_READ(in_UPDATE_ADDRESS [i]);
     255                 
     256                      log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * flush and push");
     257                      log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * address_push        : 0x%.8x",address);
     258
     259                      reg_stack [context_id][value]._address = address;
    255260                    }
    256261                }
     
    292297#endif
    293298
    294 
    295299                      Tptr_t     top_old    = (prediction_ifetch)?reg_PREDICT_TOP    [context_id]:reg_TOP    [context_id];
    296300                      Tptr_t     top_new    = top_old;
     
    320324                      if (push)
    321325                        {
     326                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * previous is push, now pop");
     327
    322328                          // previous is push, now must be pop
    323329
     
    331337                      else
    332338                        {
     339                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * previous is pop, now push");
     340
    333341                          // previous is pop, now must be push
    334342                          Taddress_t address           = PORT_READ(in_UPDATE_ADDRESS           [i]);
     343
     344                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * address       : 0x%.8x",address);
    335345
    336346                          // push : increase the top (circular)
     
    345355                          top_new = index;
    346356                         
    347                           reg_stack [context_id][index]._address = address;
     357                          reg_stack [context_id][top_new]._address = address;
    348358                        }
    349359
     
    352362                      if (prediction_ifetch)
    353363                        {
    354                           log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_top     : %d",top_new);
    355 //                        log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_bottom  : %d",bottom_new);
    356                           log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_nb_elt  : %d",nb_elt_new);
    357 
     364                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_top     : %d",reg_TOP    [context_id]);
     365//                        log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_bottom  : %d",reg_BOTTOM [context_id]);
     366                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_nb_elt  : %d",reg_NB_ELT [context_id]);
     367
     368                          reg_PREDICT_TOP    [context_id] = reg_TOP    [context_id];
     369//                        reg_PREDICT_BOTTOM [context_id] = reg_BOTTOM [context_id];
     370                          reg_PREDICT_NB_ELT [context_id] = reg_NB_ELT [context_id];
     371
     372//                           log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_top     : %d",top_new   );
     373// //                        log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_bottom  : %d",bottom_new);
     374//                           log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_nb_elt  : %d",nb_elt_new);
     375
     376//                           reg_PREDICT_TOP    [context_id] = top_new   ;
     377// //                        reg_PREDICT_BOTTOM [context_id] = bottom_new;
     378//                           reg_PREDICT_NB_ELT [context_id] = nb_elt_new;
     379
     380                        }
     381                      else
     382                        {
     383                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_top     : %d",top_new);
     384//                        log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_bottom  : %d",bottom_new);
     385                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_nb_elt  : %d",nb_elt_new);
     386
     387                          reg_TOP            [context_id] = top_new   ;
     388//                        reg_BOTTOM         [context_id] = bottom_new;
     389                          reg_NB_ELT         [context_id] = nb_elt_new;
    358390                          reg_PREDICT_TOP    [context_id] = top_new   ;
    359391//                        reg_PREDICT_BOTTOM [context_id] = bottom_new;
    360392                          reg_PREDICT_NB_ELT [context_id] = nb_elt_new;
    361                         }
    362                       else
    363                         {
    364                           log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_top     : %d",top_new);
    365 //                        log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_bottom  : %d",bottom_new);
    366                           log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_nb_elt  : %d",nb_elt_new);
    367 
    368                           reg_TOP            [context_id] = top_new   ;
    369 //                        reg_BOTTOM         [context_id] = bottom_new;
    370                           reg_NB_ELT         [context_id] = nb_elt_new;
    371393                        }
    372394                    }
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/SelfTest/src/main.cpp

    r95 r111  
    107107    _ufpt_size_queue [i]                       = fromString<uint32_t    >(argv[x++]);
    108108
     109  uint32_t     _nb_thread                           = _nb_context;
     110  uint32_t *   _translate_num_context_to_num_thread = new uint32_t    [_nb_context];
     111  for (uint32_t i=0; i<_nb_context; i++)
     112    _translate_num_context_to_num_thread [i] = i;
     113
    109114  int _return = EXIT_SUCCESS;
    110115  try
     
    135140         _upt_size_queue            ,
    136141         _ufpt_size_queue           ,
     142         _nb_thread                          ,
     143         _translate_num_context_to_num_thread,
    137144         true // is_toplevel
    138145         );
     
    158165  delete [] _upt_size_queue            ;
    159166  delete [] _ufpt_size_queue           ;
     167  delete [] _translate_num_context_to_num_thread;
    160168
    161169  return (_return);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/SelfTest/src/test.cpp

    r110 r111  
    8282  ALLOC1_SC_SIGNAL( in_BRANCH_COMPLETE_NO_SEQUENCE        ," in_BRANCH_COMPLETE_NO_SEQUENCE        ",Tcontrol_t         ,_param->_nb_inst_branch_complete);
    8383  ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_MISS_PREDICTION    ,"out_BRANCH_COMPLETE_MISS_PREDICTION    ",Tcontrol_t         ,_param->_nb_inst_branch_complete);
    84   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_TAKE               ,"out_BRANCH_COMPLETE_TAKE               ",Tcontrol_t         ,_param->_nb_inst_branch_complete);
    85   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_SRC        ,"out_BRANCH_COMPLETE_ADDRESS_SRC        ",Taddress_t         ,_param->_nb_inst_branch_complete);
    86   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_DEST       ,"out_BRANCH_COMPLETE_ADDRESS_DEST       ",Taddress_t         ,_param->_nb_inst_branch_complete);
     84//   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_TAKE               ,"out_BRANCH_COMPLETE_TAKE               ",Tcontrol_t         ,_param->_nb_inst_branch_complete);
     85//   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_SRC        ,"out_BRANCH_COMPLETE_ADDRESS_SRC        ",Taddress_t         ,_param->_nb_inst_branch_complete);
     86//   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_DEST       ,"out_BRANCH_COMPLETE_ADDRESS_DEST       ",Taddress_t         ,_param->_nb_inst_branch_complete);
    8787                                                                                                                         
    8888  ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_VAL                   ,"out_BRANCH_EVENT_VAL                   ",Tcontrol_t         ,_param->_nb_context);
     
    151151  INSTANCE1_SC_SIGNAL(_Prediction_unit, in_BRANCH_COMPLETE_NO_SEQUENCE        ,_param->_nb_inst_branch_complete);
    152152  INSTANCE1_SC_SIGNAL(_Prediction_unit,out_BRANCH_COMPLETE_MISS_PREDICTION    ,_param->_nb_inst_branch_complete);
    153   INSTANCE1_SC_SIGNAL(_Prediction_unit,out_BRANCH_COMPLETE_TAKE               ,_param->_nb_inst_branch_complete);
    154   INSTANCE1_SC_SIGNAL(_Prediction_unit,out_BRANCH_COMPLETE_ADDRESS_SRC        ,_param->_nb_inst_branch_complete);
    155   INSTANCE1_SC_SIGNAL(_Prediction_unit,out_BRANCH_COMPLETE_ADDRESS_DEST       ,_param->_nb_inst_branch_complete);
     153//   INSTANCE1_SC_SIGNAL(_Prediction_unit,out_BRANCH_COMPLETE_TAKE               ,_param->_nb_inst_branch_complete);
     154//   INSTANCE1_SC_SIGNAL(_Prediction_unit,out_BRANCH_COMPLETE_ADDRESS_SRC        ,_param->_nb_inst_branch_complete);
     155//   INSTANCE1_SC_SIGNAL(_Prediction_unit,out_BRANCH_COMPLETE_ADDRESS_DEST       ,_param->_nb_inst_branch_complete);
    156156
    157157  INSTANCE1_SC_SIGNAL(_Prediction_unit,out_BRANCH_EVENT_VAL                   ,_param->_nb_context);
     
    361361  DELETE1_SC_SIGNAL( in_BRANCH_COMPLETE_NO_SEQUENCE    ,_param->_nb_inst_branch_complete);
    362362  DELETE1_SC_SIGNAL(out_BRANCH_COMPLETE_MISS_PREDICTION,_param->_nb_inst_branch_complete);
    363   DELETE1_SC_SIGNAL(out_BRANCH_COMPLETE_TAKE           ,_param->_nb_inst_branch_complete);
    364   DELETE1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_SRC    ,_param->_nb_inst_branch_complete);
    365   DELETE1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_DEST   ,_param->_nb_inst_branch_complete);
     363//   DELETE1_SC_SIGNAL(out_BRANCH_COMPLETE_TAKE           ,_param->_nb_inst_branch_complete);
     364//   DELETE1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_SRC    ,_param->_nb_inst_branch_complete);
     365//   DELETE1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_DEST   ,_param->_nb_inst_branch_complete);
    366366
    367367  DELETE1_SC_SIGNAL(out_BRANCH_EVENT_VAL              ,_param->_nb_context);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/main.cpp

    r88 r111  
    6262    _size_ras_index [i] = fromString<uint32_t>(argv[x++]);
    6363
     64  uint32_t     _nb_thread                           = _nb_context;
     65  uint32_t *   _translate_num_context_to_num_thread = new uint32_t    [_nb_context];
     66  for (uint32_t i=0; i<_nb_context; i++)
     67    _translate_num_context_to_num_thread [i] = i;
     68
    6469  int _return = EXIT_SUCCESS;
    6570  try
     
    7681         _size_history           ,
    7782         _size_ras_index         ,
     83         _nb_thread                          ,
     84         _translate_num_context_to_num_thread,
    7885         true //is_toplevel
    7986         );
     
    98105  delete [] _size_ufpt_queue;
    99106  delete [] _size_upt_queue;
     107  delete [] _translate_num_context_to_num_thread;
    100108
    101109  return (_return);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/test.cpp

    r110 r111  
    108108  ALLOC1_SC_SIGNAL( in_BRANCH_COMPLETE_NO_SEQUENCE    ," in_BRANCH_COMPLETE_NO_SEQUENCE    ",Tcontrol_t         ,_param->_nb_inst_branch_complete);
    109109  ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_MISS_PREDICTION,"out_BRANCH_COMPLETE_MISS_PREDICTION",Tcontrol_t         ,_param->_nb_inst_branch_complete);
    110   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_TAKE           ,"out_BRANCH_COMPLETE_TAKE           ",Tcontrol_t         ,_param->_nb_inst_branch_complete);
    111   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_SRC    ,"out_BRANCH_COMPLETE_ADDRESS_SRC    ",Taddress_t         ,_param->_nb_inst_branch_complete);
    112   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_DEST   ,"out_BRANCH_COMPLETE_ADDRESS_DEST   ",Taddress_t         ,_param->_nb_inst_branch_complete);
     110//   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_TAKE           ,"out_BRANCH_COMPLETE_TAKE           ",Tcontrol_t         ,_param->_nb_inst_branch_complete);
     111//   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_SRC    ,"out_BRANCH_COMPLETE_ADDRESS_SRC    ",Taddress_t         ,_param->_nb_inst_branch_complete);
     112//   ALLOC1_SC_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_DEST   ,"out_BRANCH_COMPLETE_ADDRESS_DEST   ",Taddress_t         ,_param->_nb_inst_branch_complete);
    113113
    114114  ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_VAL            ,"out_BRANCH_EVENT_VAL            ",Tcontrol_t         ,_param->_nb_context);
     
    202202  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_COMPLETE_NO_SEQUENCE    ,_param->_nb_inst_branch_complete);
    203203  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_COMPLETE_MISS_PREDICTION,_param->_nb_inst_branch_complete);
    204   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_COMPLETE_TAKE           ,_param->_nb_inst_branch_complete);
    205   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_COMPLETE_ADDRESS_SRC    ,_param->_nb_inst_branch_complete);
    206   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_COMPLETE_ADDRESS_DEST   ,_param->_nb_inst_branch_complete);
     204//   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_COMPLETE_TAKE           ,_param->_nb_inst_branch_complete);
     205//   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_COMPLETE_ADDRESS_SRC    ,_param->_nb_inst_branch_complete);
     206//   INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_COMPLETE_ADDRESS_DEST   ,_param->_nb_inst_branch_complete);
    207207
    208208  INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_EVENT_VAL            ,_param->_nb_context);
     
    519519                     
    520520                      TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_upt->miss_commit );
    521                       TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take_good   );
    522                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
    523                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_good);
     521//                    TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take_good   );
     522//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
     523//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_good);
    524524
    525525                      it_upt ++;
     
    832832                     
    833833                      TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_upt->miss_commit );
    834                       TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take_good   );
    835                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
    836                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_good);
     834//                    TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take_good   );
     835//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
     836//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_good);
    837837
    838838                      it_upt ++;
     
    12001200                     
    12011201                      TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_upt->miss_commit );
    1202                       TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take_good   );
    1203                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
    1204                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_good);
     1202//                    TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take_good   );
     1203//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
     1204//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_good);
    12051205
    12061206                      it_upt ++;
     
    17451745                     
    17461746                      TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_event->miss_commit );
    1747                       TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_event->take_good   );
    1748                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_event->address_src );
    1749                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_event->address_good);
     1747//                    TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_event->take_good   );
     1748//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_event->address_src );
     1749//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_event->address_good);
    17501750
    17511751                      upt_top_event [it_event->context] = upt_top [it_event->context];
     
    18091809                     
    18101810                      TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_upt->miss_commit );
    1811                       TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take        );
     1811//                    TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take        );
    18121812                      it_upt->take_good = it_upt->take;
    1813                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
    1814                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_dest);
     1813//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
     1814//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_dest);
    18151815
    18161816                      it_upt++;
     
    24642464                     
    24652465                      TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_upt->miss_commit );
    2466                       TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take        );
     2466//                    TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE           [port]->read(),it_upt->take        );
    24672467                      it_upt->take_good = it_upt->take;
    2468                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
    2469                       TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_dest);
     2468//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC    [port]->read(),it_upt->address_src );
     2469//                    TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST   [port]->read(),it_upt->address_dest);
    24702470
    24712471                      it_upt++;
     
    28502850  delete []  in_BRANCH_COMPLETE_NO_SEQUENCE    ;
    28512851  delete [] out_BRANCH_COMPLETE_MISS_PREDICTION;
    2852   delete [] out_BRANCH_COMPLETE_TAKE           ;
    2853   delete [] out_BRANCH_COMPLETE_ADDRESS_SRC    ;
    2854   delete [] out_BRANCH_COMPLETE_ADDRESS_DEST   ;
     2852//   delete [] out_BRANCH_COMPLETE_TAKE           ;
     2853//   delete [] out_BRANCH_COMPLETE_ADDRESS_SRC    ;
     2854//   delete [] out_BRANCH_COMPLETE_ADDRESS_DEST   ;
    28552855
    28562856  // ~~~~~[ Interface : "branch_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Parameters.h

    r88 r111  
    3535  public : uint32_t * _size_ras_index            ; // [nb_context]
    3636  public : const bool _not_accurate_block_predict;
     37  public : uint32_t   _nb_thread                          ;
     38  public : uint32_t * _translate_num_context_to_num_thread;//[nb_context]                   
    3739
    3840//public : uint32_t   _size_context_id           ;
     
    4648  public : bool       _have_port_history         ;
    4749   
     50  public : bool              * _have_thread             ;//[nb_thread]
     51
    4852    //-----[ methods ]-----------------------------------------------------------
    4953  public : Parameters  (uint32_t   nb_context             ,
     
    5761                        uint32_t   size_history           ,
    5862                        uint32_t * size_ras_index         ,
     63                        uint32_t   nb_thread                           ,
     64                        uint32_t * translate_num_context_to_num_thread ,//[nb_context]                   
    5965                        bool       is_toplevel=false);
    6066//public : Parameters  (Parameters & param) ;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Types.h

    r109 r111  
    8787  public : Tptr_t              _index_ras        ;
    8888  public : Tcontrol_t          _ifetch_prediction; // not in ufpt
     89
     90  public : bool                _retire_ok        ;
    8991  };
    9092
     
    146148      case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT: return "event_flush_ufpt_and_upt"; break;
    147149      case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_UPDATE_CONTEXT          : return "update_context"          ; break;
    148       case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_WAIT_END_EVENT          : return "wait_and_event"          ; break;
     150      case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_WAIT_END_EVENT          : return "wait_end_event"          ; break;
    149151      default    : return ""; break;
    150152      }
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h

    r110 r111  
    2727#endif
    2828#include "Behavioural/include/Usage.h"
     29#include <fstream>
    2930
    3031namespace morpheo {
     
    109110  public    : SC_IN (Tcontrol_t         )  **  in_BRANCH_COMPLETE_NO_SEQUENCE    ; //[nb_inst_branch_complete]
    110111  public    : SC_OUT(Tcontrol_t         )  ** out_BRANCH_COMPLETE_MISS_PREDICTION; //[nb_inst_branch_complete]
    111   public    : SC_OUT(Tcontrol_t         )  ** out_BRANCH_COMPLETE_TAKE           ; //[nb_inst_branch_complete]
    112   public    : SC_OUT(Taddress_t         )  ** out_BRANCH_COMPLETE_ADDRESS_SRC    ; //[nb_inst_branch_complete]
    113   public    : SC_OUT(Taddress_t         )  ** out_BRANCH_COMPLETE_ADDRESS_DEST   ; //[nb_inst_branch_complete]
     112//   public    : SC_OUT(Tcontrol_t         )  ** out_BRANCH_COMPLETE_TAKE           ; //[nb_inst_branch_complete]
     113//   public    : SC_OUT(Taddress_t         )  ** out_BRANCH_COMPLETE_ADDRESS_SRC    ; //[nb_inst_branch_complete]
     114//   public    : SC_OUT(Taddress_t         )  ** out_BRANCH_COMPLETE_ADDRESS_DEST   ; //[nb_inst_branch_complete]
    114115
    115116    // ~~~~~[ Interface : "branch_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    209210  private   : Tcontrol_t                    * internal_EVENT_ACK                      ; //[nb_context]
    210211
     212#if defined(DEBUG) and defined(DEBUG_Update_Prediction_Table) and (DEBUG_Update_Prediction_Table == true)
     213  private   : std::ofstream                 * branchement_log_file;
     214#endif
     215
    211216#endif
    212217
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Parameters.cpp

    r88 r111  
    77
    88#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Parameters.h"
     9#include "Behavioural/include/Allocation.h"
    910#include "Common/include/Max.h"
    1011
     
    3031                          uint32_t   size_history           ,
    3132                          uint32_t * size_ras_index         ,
     33                          uint32_t   nb_thread                           ,
     34                          uint32_t * translate_num_context_to_num_thread ,//[nb_context]
    3235                          bool       is_toplevel):
    3336    _not_accurate_block_predict (false)
     
    4548    _size_history            = size_history           ;
    4649    _size_ras_index          = size_ras_index         ;
     50    _nb_thread                           = nb_thread                          ;
     51    _translate_num_context_to_num_thread = translate_num_context_to_num_thread;
    4752   
    4853    _max_size_ras_index      = max<uint32_t>(_size_ras_index,nb_context);
     
    5156
    5257    test();
     58
     59    ALLOC1(_have_thread,bool,_nb_thread);
     60    for (uint32_t i=0; i<_nb_thread; i++)
     61      _have_thread[i] = false;
     62    for (uint32_t i=0; i<_nb_context; i++)
     63      _have_thread[_translate_num_context_to_num_thread [i]] = true;
    5364
    5465    if (is_toplevel)
     
    8192  {
    8293    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin");
     94    DELETE1(_have_thread     ,_nb_thread);
    8395//     delete [] _size_depth     ;
    8496//     delete [] _have_port_depth;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table.cpp

    r98 r111  
    166166       
    167167# ifdef SYSTEMCASS_SPECIFIC
    168         // List dependency information
    169         for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
    170           {
    171             if (_param->_have_port_context_id)
    172             (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
    173             if (_param->_have_port_depth)
    174             (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
    175             (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_NO_SEQUENCE[i]));
    176             (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
    177 
    178             if (_param->_have_port_context_id)
    179             (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
    180             if (_param->_have_port_depth)
    181             (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
    182             (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_NO_SEQUENCE[i]));
    183 
    184             if (_param->_have_port_context_id)
    185             (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
    186             if (_param->_have_port_depth)
    187             (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
    188 
    189             if (_param->_have_port_context_id)
    190             (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
    191             if (_param->_have_port_depth)
    192             (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
    193             (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
    194           }
     168//      // List dependency information
     169//      for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
     170//        {
     171//          if (_param->_have_port_context_id)
     172//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
     173//          if (_param->_have_port_depth)
     174//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
     175//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_NO_SEQUENCE[i]));
     176//          (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
     177
     178// //       if (_param->_have_port_context_id)
     179// //       (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
     180// //       if (_param->_have_port_depth)
     181// //       (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
     182// //       (*(out_BRANCH_COMPLETE_TAKE            [i])) (*(in_BRANCH_COMPLETE_NO_SEQUENCE[i]));
     183
     184// //       if (_param->_have_port_context_id)
     185// //       (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
     186// //       if (_param->_have_port_depth)
     187// //       (*(out_BRANCH_COMPLETE_ADDRESS_SRC     [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
     188
     189// //       if (_param->_have_port_context_id)
     190// //       (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i]));
     191// //       if (_param->_have_port_depth)
     192// //       (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_DEPTH      [i]));
     193// //       (*(out_BRANCH_COMPLETE_ADDRESS_DEST    [i])) (*(in_BRANCH_COMPLETE_ADDRESS    [i]));
     194//        }
    195195# endif   
    196196       
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_allocation.cpp

    r110 r111  
    106106      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_NO_SEQUENCE    ,"no_sequence"    ,Tcontrol_t,1);
    107107      ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_MISS_PREDICTION,"miss_prediction",Tcontrol_t,1);
    108       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_TAKE           ,"take"           ,Tcontrol_t,1);
    109       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_ADDRESS_SRC    ,"address_src"    ,Taddress_t,_param->_size_instruction_address);
    110       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_ADDRESS_DEST   ,"address_dest"   ,Taddress_t,_param->_size_instruction_address);
     108//       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_TAKE           ,"take"           ,Tcontrol_t,1);
     109//       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_ADDRESS_SRC    ,"address_src"    ,Taddress_t,_param->_size_instruction_address);
     110//       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_ADDRESS_DEST   ,"address_dest"   ,Taddress_t,_param->_size_instruction_address);
    111111    }
    112112
     
    225225#endif
    226226
     227#if defined(DEBUG) and defined(DEBUG_Update_Prediction_Table) and (DEBUG_Update_Prediction_Table == true)
     228    branchement_log_file = new std::ofstream [_param->_nb_thread];
     229    for (uint32_t i=0; i<_param->_nb_thread; ++i)
     230      if (_param->_have_thread [i])
     231        {
     232          std::string filename = "Branchement_prediction-thread_" + toString(i) + ".log";
     233         
     234          branchement_log_file [i] .open(filename.c_str() ,std::ios::out | std::ios::trunc);
     235        }
     236#endif
     237
    227238    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
    228239  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_deallocation.cpp

    r110 r111  
    7676        delete []  in_BRANCH_COMPLETE_NO_SEQUENCE    ;
    7777        delete [] out_BRANCH_COMPLETE_MISS_PREDICTION;
    78         delete [] out_BRANCH_COMPLETE_TAKE           ;
    79         delete [] out_BRANCH_COMPLETE_ADDRESS_SRC    ;
    80         delete [] out_BRANCH_COMPLETE_ADDRESS_DEST   ;
     78//      delete [] out_BRANCH_COMPLETE_TAKE           ;
     79//      delete [] out_BRANCH_COMPLETE_ADDRESS_SRC    ;
     80//      delete [] out_BRANCH_COMPLETE_ADDRESS_DEST   ;
    8181
    8282        // ~~~~~[ Interface : "branch_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    175175    delete _component;
    176176
     177#if defined(DEBUG) and defined(DEBUG_Update_Prediction_Table) and (DEBUG_Update_Prediction_Table == true)
     178    for (uint32_t i=0; i<_param->_nb_thread; ++i)
     179      if (_param->_have_thread [i])
     180        {
     181          branchement_log_file [i].close();
     182        }
     183#endif
     184
    177185    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
    178186  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_genMealy_branch_complete.cpp

    r98 r111  
    125125       
    126126        PORT_WRITE(out_BRANCH_COMPLETE_MISS_PREDICTION [i], internal_BRANCH_COMPLETE_MISS_PREDICTION [i]);
    127         PORT_WRITE(out_BRANCH_COMPLETE_TAKE            [i], internal_BRANCH_COMPLETE_TAKE            [i]);
    128         PORT_WRITE(out_BRANCH_COMPLETE_ADDRESS_SRC     [i], reg_UPDATE_PREDICTION_TABLE [context][depth]._address_src);
    129         PORT_WRITE(out_BRANCH_COMPLETE_ADDRESS_DEST    [i], internal_BRANCH_COMPLETE_ADDRESS_DEST    [i]);
     127//      PORT_WRITE(out_BRANCH_COMPLETE_TAKE            [i], internal_BRANCH_COMPLETE_TAKE            [i]);
     128//      PORT_WRITE(out_BRANCH_COMPLETE_ADDRESS_SRC     [i], reg_UPDATE_PREDICTION_TABLE [context][depth]._address_src);
     129//      PORT_WRITE(out_BRANCH_COMPLETE_ADDRESS_DEST    [i], internal_BRANCH_COMPLETE_ADDRESS_DEST    [i]);
    130130      }
    131131
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_genMoore.cpp

    r107 r111  
    139139                dir_val               = 0; // don't update btb (is update by the event branch (if conditionnal branch))
    140140//              dir_history           = ;
    141                 ras_val               = update_ras(condition); // repop/ repush data -> don't corrupt ras
     141                // repop/ repush data -> don't corrupt ras
     142                ras_val               = update_ras(condition);
    142143                ras_flush             = 0;
    143144                ras_push              = push_ras(condition);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp

    r109 r111  
    102102              if (end)
    103103                {
     104#if defined(DEBUG) and defined(DEBUG_Update_Prediction_Table) and (DEBUG_Update_Prediction_Table == true)
     105                  if (reg_UPDATE_PREDICTION_TABLE [i][bottom]._retire_ok)
     106                    {
     107                      uint32_t num_thread = _param->_translate_num_context_to_num_thread [i];
     108                      branchement_log_file [num_thread]
     109                        << std::hex
     110                        << "0x" << reg_UPDATE_PREDICTION_TABLE [i][bottom]._address_src  << " "
     111                        << "0x" << reg_UPDATE_PREDICTION_TABLE [i][bottom]._address_dest << " "
     112                        << std::dec
     113                        <<         reg_UPDATE_PREDICTION_TABLE [i][bottom]._good_take    << " "
     114                        << std::endl;
     115                    }
     116#endif
    104117                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * UPT [%d][%d]",i,bottom);
    105118                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * UPT [%d][%d]._state =  UPDATE_PREDICTION_STATE_EMPTY",i,bottom);
     
    180193//            reg_UFPT_UPDATE  [context] = reg_UFPT_TOP [context];
    181194              if (need_update(condition))
    182                 reg_UFPT_NB_NEED_UPDATE [context] ++;
     195                {
     196                  reg_UFPT_NB_NEED_UPDATE [context] ++;
     197                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * reg_UFPT_NB_NEED_UPDATE (after) : %d",reg_UFPT_NB_NEED_UPDATE [context]);
     198
     199                }
    183200            }
    184201
     
    293310                    {
    294311                      reg_UFPT_NB_NEED_UPDATE [context] --;
     312                      log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * reg_UFPT_NB_NEED_UPDATE (after) : %d",reg_UFPT_NB_NEED_UPDATE [context]);
     313
    295314                    }
    296315                }
     
    305324              log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * UPT  [%d][%d].state <- UPDATE_PREDICTION_STATE_WAIT_END (decod - hit)",context,upt_ptr_write);
    306325              reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._state = UPDATE_PREDICTION_STATE_WAIT_END;
    307              
     326              reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._retire_ok = false;
     327
    308328              // Write new accurate
    309329#ifdef DEBUG_TEST
     
    377397                      // Free a register that need update ?
    378398                      if (need_update(reg_UPDATE_FETCH_PREDICTION_TABLE [context][depth]._condition))
    379                         reg_UFPT_NB_NEED_UPDATE [context] --;
     399                        {
     400                          reg_UFPT_NB_NEED_UPDATE [context] --;
     401                          log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * reg_UFPT_NB_NEED_UPDATE (after) : %d",reg_UFPT_NB_NEED_UPDATE [context]);
     402                        }
    380403                    }
    381404                  else
     
    402425#ifdef STATISTICS
    403426                      Tbranch_condition_t condition = reg_UPDATE_PREDICTION_TABLE [context][depth]._condition;
     427#endif
    404428                      bool ok     = (reg_UPDATE_PREDICTION_TABLE [context][depth]._state == UPDATE_PREDICTION_STATE_OK);
    405 #endif
    406429                      bool ko     = (reg_UPDATE_PREDICTION_TABLE [context][depth]._state == UPDATE_PREDICTION_STATE_KO);
     430
     431                      if (ok or ko)
     432                        reg_UPDATE_PREDICTION_TABLE [context][depth]._retire_ok = true;
    407433
    408434                      // Have an update, test the state to transiste to the good state
     
    513539              if (miss)
    514540                {
     541                  // Flush UPT
     542                  uint32_t      top                 = reg_UPT_TOP [context];
     543                  uint32_t      new_update          = ((top==0)?_param->_size_upt_queue[context]:top)-1;
     544                                                   
     545                  Taddress_t    address_src         = reg_UPDATE_PREDICTION_TABLE [context][depth]._address_src;
     546                  event_state_t event_state         = reg_EVENT_STATE [context];
     547                  upt_state_t   event_top           = reg_UPDATE_PREDICTION_TABLE [context][top]._state;
     548                  bool          previous_ufpt_event = ((event_state == EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT ) or
     549                                                       (event_state == EVENT_STATE_MISS_FLUSH_UFPT         ) or
     550                                                       (event_state == EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT) or
     551                                                       (event_state == EVENT_STATE_EVENT_FLUSH_UFPT        ));
     552
     553                  bool          previous_upt_event  = ((event_state == EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT ) or
     554                                                       (event_state == EVENT_STATE_MISS_FLUSH_UPT          ) or
     555                                                       (event_state == EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT) or
     556                                                       (event_state == EVENT_STATE_EVENT_FLUSH_UPT         ) or
     557                                                       (event_top   == UPDATE_PREDICTION_STATE_END_KO      ) or
     558                                                       (event_top   == UPDATE_PREDICTION_STATE_KO          )
     559//                                                   (event_state == EVENT_STATE_WAIT_END_EVENT          ) or
     560//                                                   ((event_state == EVENT_STATE_UPDATE_CONTEXT         ) and
     561//                                                    (reg_EVENT_SOURCE [context] == EVENT_SOURCE_UPT))
     562                                                  );
     563//                bool          update_ras     = (new_update != depth);
     564
     565                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * top                 : %d",top);
     566                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * new_update          : %d",new_update);
     567//                log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * update_ras          : %d",update_ras);
     568                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * previous_upt_event  : %d",previous_upt_event);
     569                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * previous_ufpt_event : %d",previous_ufpt_event);
     570
    515571                  // Have a miss !!!
    516572                  // Flush UPFT
    517                   flush_UFPT [context] = true;
     573                  flush_UFPT [context] = not previous_ufpt_event;
    518574                 
    519                   // Flush UPT
    520                   uint32_t      top            = reg_UPT_TOP [context];
    521                   uint32_t      new_update     = ((top==0)?_param->_size_upt_queue[context]:top)-1;
    522 
    523                   Taddress_t    address_src    = reg_UPDATE_PREDICTION_TABLE [context][depth]._address_src;
    524                   event_state_t event_state    = reg_EVENT_STATE [context];
    525                   bool          previous_event = ((event_state == EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT ) or
    526                                                   (event_state == EVENT_STATE_MISS_FLUSH_UPT          ) or
    527                                                   (event_state == EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT) or
    528                                                   (event_state == EVENT_STATE_EVENT_FLUSH_UPT         ) or
    529                                                   ((event_state == EVENT_STATE_UPDATE_CONTEXT          ) and
    530                                                    (reg_EVENT_SOURCE [context] == EVENT_SOURCE_UPT)));
    531 //                bool          update_ras     = (new_update != depth);
    532 
    533                   log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * top            : %d",top);
    534                   log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * new_update     : %d",new_update);
    535 //                log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * update_ras     : %d",update_ras);
    536                   log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * previous_event : %d",previous_event);
    537 
    538575                  if (reg_UPDATE_PREDICTION_TABLE [context][depth]._state == UPDATE_PREDICTION_STATE_WAIT_END)
    539576                    {
     
    541578                           j!=top;
    542579                           j=(j+1)%_param->_size_upt_queue[context])
    543                         reg_UPDATE_PREDICTION_TABLE [context][j]._state = UPDATE_PREDICTION_STATE_EVENT;
     580                        {
     581                          reg_UPDATE_PREDICTION_TABLE [context][j]._state = UPDATE_PREDICTION_STATE_EVENT;
     582                          reg_UPDATE_PREDICTION_TABLE [context][j]._retire_ok = false;
     583                        }
    544584                     
    545585                 
     
    548588//                    reg_UPT_TOP_EVENT [context] = top;
    549589
    550                       if (not previous_event)
     590                      if (not previous_upt_event)
    551591                        {
    552592                          reg_UPT_TOP_EVENT [context] = top;
     
    556596                        {
    557597                          // Have event. Top index this slot
    558                          
    559                           switch (reg_UPDATE_PREDICTION_TABLE [context][top]._state)
     598                          reg_UPDATE_PREDICTION_TABLE [context][top]._retire_ok = false;
     599
     600                          switch (event_top)
    560601                            {
    561602                            case UPDATE_PREDICTION_STATE_END_KO :
     
    573614                            default :
    574615                              {
     616//                                 reg_UPDATE_PREDICTION_TABLE [context][top]._state = UPDATE_PREDICTION_STATE_EVENT;
     617//                                 break;
     618
    575619#ifdef DEBUG_TEST
    576620                                throw ERRORMORPHEO(FUNCTION,_("Branch complete : invalid upt state."));
     
    585629                      log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * UPT  [%d][%d].state <- UPDATE_PREDICTION_STATE_KO (branch_complete, ifetch hit)",context,depth);
    586630                      reg_UPDATE_PREDICTION_TABLE [context][depth]._state = UPDATE_PREDICTION_STATE_KO;
    587                      
    588                       if (reg_UFPT_NB_NEED_UPDATE [context] > 0)
     631
     632                      log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * reg_UFPT_NB_NEED_UPDATE [%d] : %d",context,reg_UFPT_NB_NEED_UPDATE [context]);
     633                     
     634                      if ( (reg_UFPT_NB_NEED_UPDATE [context] > 0) or
     635                           (reg_UFPT_NB_UPDATE      [context] > 0))
    589636                        {
    590637                          log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * EVENT [%d] <- EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT (branch_complete - miss)",context);
     
    736783                    uint32_t bottom     = reg_UPT_BOTTOM [i];
    737784                    uint32_t new_update = ((top==0)?_param->_size_upt_queue[i]:top)-1;
    738                     bool     full       = ((depth == top) and (top == bottom) and not reg_UPT_EMPTY [i]);
    739785//                     bool     empty      = reg_UPT_EMPTY [i];
    740786
     
    749795                                                         (event_state == EVENT_STATE_EVENT_FLUSH_UPT));
    750796
    751                     bool find = false; // have slot to update ???
     797                    bool     find = false; // have slot to update ???
     798                    Tdepth_t depth_new = depth;
    752799
    753800                    // flush all slot after the event
     
    760807                          find = true;
    761808                          reg_UPDATE_PREDICTION_TABLE [i][j]._state = UPDATE_PREDICTION_STATE_EVENT;
    762                         }
     809                          reg_UPDATE_PREDICTION_TABLE [i][j]._retire_ok = false;
     810                        }
     811                      else
     812                        if (not find) // while state == end or empty
     813                          depth_new ++;
    763814                   
    764815                    if ((reg_UPDATE_PREDICTION_TABLE [i][depth]._state != UPDATE_PREDICTION_STATE_END) and
     
    767818                        find = true;
    768819                        reg_UPDATE_PREDICTION_TABLE [i][depth]._state = UPDATE_PREDICTION_STATE_EVENT;
     820                        reg_UPDATE_PREDICTION_TABLE [i][depth]._retire_ok = false;
     821
    769822                      }
     823                    else
     824                      // while state == end or empty
     825                      depth = (depth_new+1)%_param->_size_upt_queue[i];
    770826
    771827                    log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * find       : %d",find);
     828                    log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * depth_new  : %d",depth_new);
    772829                   
    773830                    // Test if have update slot
    774831                    if (find)
    775832                      {
    776                         // flush all slot after the event
    777                         for (uint32_t j=(depth+1)%_param->_size_upt_queue[i];
    778                              j!=top;
    779                              j=(j+1)%_param->_size_upt_queue[i])
    780                           reg_UPDATE_PREDICTION_TABLE [i][j]._state = UPDATE_PREDICTION_STATE_EVENT;
    781 
    782                         reg_UPDATE_PREDICTION_TABLE [i][depth]._state = UPDATE_PREDICTION_STATE_EVENT;
     833//                         // flush all slot after the event
     834//                         for (uint32_t j=(depth+1)%_param->_size_upt_queue[i];
     835//                              j!=top;
     836//                              j=(j+1)%_param->_size_upt_queue[i])
     837//                           reg_UPDATE_PREDICTION_TABLE [i][j]._state = UPDATE_PREDICTION_STATE_EVENT;
     838
     839//                         reg_UPDATE_PREDICTION_TABLE [i][depth]._state = UPDATE_PREDICTION_STATE_EVENT;
    783840                       
    784841                        // reg_UPT_BOTTOM    [i];
     
    791848                      }
    792849
    793                     bool          update_ras = find and ((top != depth) or full);
     850                    bool     full       = ((depth == top) and (top == bottom) and not reg_UPT_EMPTY [i]);
     851                    bool     update_ras = find and ((top != depth) or full);
    794852                   
    795853                    log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * update_ras : %d",update_ras);
     
    807865                    reg_EVENT_UPT_PTR [i] = depth;
    808866
    809                     if (reg_UFPT_NB_NEED_UPDATE [i] > 0)
     867                    log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * reg_UFPT_NB_NEED_UPDATE          : %d",reg_UFPT_NB_NEED_UPDATE [i]);
     868//                     if (reg_UFPT_NB_NEED_UPDATE [i] > 0)
     869                    if ( (reg_UFPT_NB_NEED_UPDATE [i] > 0) or
     870                         (reg_UFPT_NB_UPDATE      [i] > 0))
    810871                      {
    811872                        if (update_ras)
     
    871932              if (reg_UFPT_NB_NEED_UPDATE [i] == 0)
    872933                {
    873 
    874934                  // No entry need prediction, flush all entry -> Reset
    875935                  for (uint32_t j=0; j<_param->_size_ufpt_queue[i]; ++j)
     
    881941              else
    882942                {
     943                  uint32_t bottom = reg_UFPT_BOTTOM [i];
    883944                  for (uint32_t j=0; j<_param->_size_ufpt_queue[i]; ++j)
    884                     // EMPTY : no event
    885                     // END   : already update
    886                     // EVENT : previous event
    887                     if (reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._state == UPDATE_FETCH_PREDICTION_STATE_WAIT_DECOD)
    888                       {
    889                         reg_UFPT_NB_UPDATE [i] ++;
    890                         reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._state = UPDATE_FETCH_PREDICTION_STATE_EVENT;
    891                       }
    892 
    893                   // TOP is next write slot : last slot is TOP-1
    894                   uint32_t top = reg_UFPT_TOP [i];
    895                   reg_UFPT_UPDATE    [i] = ((top==0)?_param->_size_ufpt_queue[i]:top)-1;
     945                    {
     946                      uint32_t index = (bottom+j)%_param->_size_ufpt_queue[i];
     947                      // EMPTY : no event
     948                      // END   : already update
     949                      // EVENT : previous event
     950                      if (reg_UPDATE_FETCH_PREDICTION_TABLE [i][index]._state == UPDATE_FETCH_PREDICTION_STATE_WAIT_DECOD)
     951                        {
     952                          reg_UFPT_UPDATE    [i] = index;
     953                          reg_UFPT_NB_UPDATE [i] ++;
     954                          reg_UPDATE_FETCH_PREDICTION_TABLE [i][index]._state = UPDATE_FETCH_PREDICTION_STATE_EVENT;
     955                        }
     956                    }
     957
     958//                   // TOP is next write slot : last slot is TOP-1
     959//                   uint32_t top = reg_UFPT_TOP [i];
     960//                   reg_UFPT_UPDATE    [i] = ((top==0)?_param->_size_ufpt_queue[i]:top)-1;
    896961
    897962//                reg_UFPT_BOTTOM    [i];
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/include/Parameters.h

    r95 r111  
    5252  public : uint32_t *   _upt_size_queue                ;//[nb_context]
    5353  public : uint32_t *   _ufpt_size_queue               ;//[nb_context]
     54  public : uint32_t     _nb_thread                          ;
     55  public : uint32_t *   _translate_num_context_to_num_thread;//[nb_context]                   
     56
     57
    5458
    5559//public : uint32_t     _size_context_id               ;
     
    98102                        uint32_t *   upt_size_queue                ,//[nb_context]
    99103                        uint32_t *   ufpt_size_queue               ,//[nb_context]
     104                        uint32_t     nb_thread                           ,
     105                        uint32_t *   translate_num_context_to_num_thread ,//[nb_context]                   
    100106                        bool         is_toplevel=false
    101107                        );
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/include/Prediction_unit.h

    r110 r111  
    101101  public    : SC_IN (Tcontrol_t         )  **  in_BRANCH_COMPLETE_NO_SEQUENCE         ; //[nb_inst_branch_complete]
    102102  public    : SC_OUT(Tcontrol_t         )  ** out_BRANCH_COMPLETE_MISS_PREDICTION     ; //[nb_inst_branch_complete]
    103   public    : SC_OUT(Tcontrol_t         )  ** out_BRANCH_COMPLETE_TAKE                ; //[nb_inst_branch_complete]
    104   public    : SC_OUT(Taddress_t         )  ** out_BRANCH_COMPLETE_ADDRESS_SRC         ; //[nb_inst_branch_complete]
    105   public    : SC_OUT(Taddress_t         )  ** out_BRANCH_COMPLETE_ADDRESS_DEST        ; //[nb_inst_branch_complete]
     103//   public    : SC_OUT(Tcontrol_t         )  ** out_BRANCH_COMPLETE_TAKE                ; //[nb_inst_branch_complete]
     104//   public    : SC_OUT(Taddress_t         )  ** out_BRANCH_COMPLETE_ADDRESS_SRC         ; //[nb_inst_branch_complete]
     105//   public    : SC_OUT(Taddress_t         )  ** out_BRANCH_COMPLETE_ADDRESS_DEST        ; //[nb_inst_branch_complete]
    106106
    107107    // ~~~~~[ Interface : "branch_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/src/Parameters.cpp

    r95 r111  
    4343                          uint32_t *   upt_size_queue                ,//[nb_context]
    4444                          uint32_t *   ufpt_size_queue               ,//[nb_context]
     45                          uint32_t     nb_thread                           ,
     46                          uint32_t *   translate_num_context_to_num_thread ,//[nb_context]                   
    4547                          bool         is_toplevel
    4648                          )
     
    7577    _upt_size_queue             = upt_size_queue            ;
    7678    _ufpt_size_queue            = ufpt_size_queue           ;
     79    _nb_thread                           = nb_thread                          ;
     80    _translate_num_context_to_num_thread = translate_num_context_to_num_thread;
    7781   
    7882    _array_size_depth           = new uint32_t [_nb_context];
     
    142146       _nb_inst_branch_update  ,
    143147       _size_history           ,
    144        _size_ras_index         );
     148       _size_ras_index         ,
     149       _nb_thread              ,
     150       _translate_num_context_to_num_thread
     151       );
    145152
    146153
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/src/Prediction_unit_allocation.cpp

    r110 r111  
    105105      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_NO_SEQUENCE    ,"no_sequence"    ,Tcontrol_t,1);
    106106      ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_MISS_PREDICTION,"miss_prediction",Tcontrol_t,1);
    107       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_TAKE           ,"take"           ,Tcontrol_t,1);
    108       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_ADDRESS_SRC    ,"address_src"    ,Taddress_t,_param->_size_address);
    109       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_ADDRESS_DEST   ,"address_dest"   ,Taddress_t,_param->_size_address);
     107//       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_TAKE           ,"take"           ,Tcontrol_t,1);
     108//       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_ADDRESS_SRC    ,"address_src"    ,Taddress_t,_param->_size_address);
     109//       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_ADDRESS_DEST   ,"address_dest"   ,Taddress_t,_param->_size_address);
    110110    }
    111111
     
    395395          if (_param->_have_port_history)
    396396          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_HISTORY"  ,
    397                                    dest, "in_PREDICT_"    +toString(i)+"_HISTORY"  );
     397                                   dest, "in_PREDICT_"    +toString(i)+"_DIR_HISTORY"  );
    398398          //out_PREDICT_DIR_LAST_TAKE - component_map branch_target_buffer
    399399        }
     
    684684          PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_MISS_PREDICTION",
    685685                              dest,"out_BRANCH_COMPLETE_"+toString(i)+"_MISS_PREDICTION");
    686           PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_TAKE"           ,
    687                               dest,"out_BRANCH_COMPLETE_"+toString(i)+"_TAKE"           );
    688           PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_SRC"    ,
    689                               dest,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_SRC"    );
    690           PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_DEST"   ,
    691                               dest,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_DEST"   );
     686//        PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_TAKE"           ,
     687//                            dest,"out_BRANCH_COMPLETE_"+toString(i)+"_TAKE"           );
     688//        PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_SRC"    ,
     689//                            dest,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_SRC"    );
     690//        PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_DEST"   ,
     691//                            dest,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_DEST"   );
    692692        }
    693693
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/src/Prediction_unit_deallocation.cpp

    r110 r111  
    5959        DELETE1_SIGNAL( in_BRANCH_COMPLETE_NO_SEQUENCE    ,_param->_nb_inst_branch_complete,1);
    6060        DELETE1_SIGNAL(out_BRANCH_COMPLETE_MISS_PREDICTION,_param->_nb_inst_branch_complete,1);
    61         DELETE1_SIGNAL(out_BRANCH_COMPLETE_TAKE           ,_param->_nb_inst_branch_complete,1);
    62         DELETE1_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_SRC    ,_param->_nb_inst_branch_complete,_param->_size_instruction_address);
    63         DELETE1_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_DEST   ,_param->_nb_inst_branch_complete,_param->_size_instruction_address);
     61//         DELETE1_SIGNAL(out_BRANCH_COMPLETE_TAKE           ,_param->_nb_inst_branch_complete,1);
     62//         DELETE1_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_SRC    ,_param->_nb_inst_branch_complete,_param->_size_instruction_address);
     63//         DELETE1_SIGNAL(out_BRANCH_COMPLETE_ADDRESS_DEST   ,_param->_nb_inst_branch_complete,_param->_size_instruction_address);
    6464
    6565        DELETE1_SIGNAL(out_BRANCH_EVENT_VAL              ,_param->_nb_context,1);
Note: See TracChangeset for help on using the changeset viewer.