Ignore:
Timestamp:
Dec 19, 2008, 4:34:00 PM (16 years ago)
Author:
rosiere
Message:

1) Update Prediction Table : statistics
2) Size instruction address on 30 bits
3) Change Log File
4) Add debug_level in simulation configuration file

Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table.cpp

    r88 r97  
    7676    if (usage_is_set(_usage,USE_SYSTEMC))
    7777      {
    78 
     78        // Constant
    7979        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
    8080          {
     
    8282            PORT_WRITE(out_BRANCH_COMPLETE_ACK [i], internal_BRANCH_COMPLETE_ACK [i]);
    8383          }
     84        for (uint32_t i=0; i<_param->_nb_context; ++i)
     85          {
     86            internal_EVENT_ACK [i] = 1;
     87            PORT_WRITE(out_EVENT_ACK [i], internal_EVENT_ACK [i]);
     88          }
    8489
    8590        log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - transition");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_allocation.cpp

    r95 r97  
    151151      ALLOC1_INTERFACE("event", IN,SOUTH,"event", _param->_nb_context);
    152152
    153       ALLOC1_SIGNAL_IN ( in_EVENT_STATE  ,"state",Tevent_state_t,_param->_size_event_state);
     153      ALLOC1_VALACK_IN ( in_EVENT_VAL    ,VAL);
     154      ALLOC1_VALACK_OUT(out_EVENT_ACK    ,ACK);
    154155      ALLOC1_SIGNAL_IN ( in_EVENT_TYPE   ,"type" ,Tevent_type_t ,_param->_size_event_type );
    155156      ALLOC1_SIGNAL_IN ( in_EVENT_DEPTH  ,"depth",Tdepth_t      ,_param->_size_depth      );
     
    183184    ALLOC1(internal_UPDATE_DEPTH                    ,Tdepth_t  ,_param->_nb_inst_update);
    184185    ALLOC1(internal_UPDATE_RAS                      ,bool      ,_param->_nb_inst_update);
     186    ALLOC1(internal_EVENT_ACK                       ,Tcontrol_t,_param->_nb_context);
    185187
    186188    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_deallocation.cpp

    r95 r97  
    111111
    112112        // ~~~~~[ Interface : "event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    113         DELETE1_SIGNAL( in_EVENT_STATE  ,_param->_nb_context,_param->_size_event_state);
     113        DELETE1_SIGNAL( in_EVENT_VAL    ,_param->_nb_context,1);
     114        DELETE1_SIGNAL(out_EVENT_ACK    ,_param->_nb_context,1);
    114115        DELETE1_SIGNAL( in_EVENT_TYPE   ,_param->_nb_context,_param->_size_event_type );
    115116        DELETE1_SIGNAL( in_EVENT_DEPTH  ,_param->_nb_context,_param->_size_depth      );
     
    137138        DELETE1(internal_UPDATE_DEPTH                    ,_param->_nb_inst_update);
    138139        DELETE1(internal_UPDATE_RAS                      ,_param->_nb_inst_update);
     140        DELETE1(internal_EVENT_ACK                       ,_param->_nb_context);
    139141       
    140142        // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
  • 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

    r94 r97  
    6767              if (take != 1)
    6868                throw ERRORMORPHEO(FUNCTION,toString("Branch_complete[%d] (condition %s) : bad direction.",i,toString(condition).c_str()));
    69               if (addr_dest != addr_good)
    70                 throw ERRORMORPHEO(FUNCTION,toString("Branch_complete[%d] (condition %s) : bad destination address.",i,toString(condition).c_str()));
     69//               if (addr_dest != addr_good)
     70//                 throw ERRORMORPHEO(FUNCTION,toString("Branch_complete[%d] (condition %s) : bad destination address.",i,toString(condition).c_str()));
    7171#endif
    7272
     
    8585
    8686#ifdef DEBUG_TEST
    87               if (addr_dest != addr_good)
    88                 throw ERRORMORPHEO(FUNCTION,toString("Branch_complete[%d] (condition %s) : bad destination address.",i,toString(condition).c_str()));
     87//               if (addr_dest != addr_good)
     88//                 throw ERRORMORPHEO(FUNCTION,toString("Branch_complete[%d] (condition %s) : bad destination address.",i,toString(condition).c_str()));
    8989#endif
    9090
     
    103103
    104104#ifdef DEBUG_TEST
    105               if (addr_dest != addr_good)
    106                 throw ERRORMORPHEO(FUNCTION,toString("Branch_complete[%d] (condition %s) : bad destination address.",i,toString(condition).c_str()));
     105//               if (addr_dest != addr_good)
     106//                 throw ERRORMORPHEO(FUNCTION,toString("Branch_complete[%d] (condition %s) : bad destination address.",i,toString(condition).c_str()));
    107107#endif
    108108
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_statistics_allocation.cpp

    r88 r97  
    88
    99#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h"
     10#include "Behavioural/include/Allocation.h"
     11
    1012
    1113namespace morpheo {
     
    2830                      param_statistics);
    2931
    30 //     _stat_nb_branch_hit        = new counter_t * [_param->_nb_context];
    31 //     _stat_nb_branch_miss       = new counter_t * [_param->_nb_context];
    32 //     _stat_nb_branch_unused     = new counter_t * [_param->_nb_context];
    33 //     _stat_queue_nb_cycle_empty = new counter_t * [_param->_nb_context];
    34 //     _stat_queue_nb_cycle_full  = new counter_t * [_param->_nb_context];
    35 //     _stat_queue_nb_elt         = new counter_t * [_param->_nb_context];
    36  
    37 //     for (uint32_t i=0; i<_param->_nb_context; ++i)
    38 //       {
    39 //         _stat_nb_branch_hit        [i] = _stat->create_counter("nb_branch_hit_"       +toString(i),"",toString(_("Branch hit speculation (context %d)"),i));
    40 //         _stat_nb_branch_miss       [i] = _stat->create_counter("nb_branch_miss_"      +toString(i),"",toString(_("Branch miss speculation (context %d)"),i));
    41 //         _stat_nb_branch_unused     [i] = _stat->create_counter("nb_branch_unused_"    +toString(i),"",toString(_("Branch unused, because an previous branch have miss speculation (context %d)"),i));
    42 //         _stat_queue_nb_cycle_empty [i] = _stat->create_counter("queue_nb_cycle_empty_"+toString(i),"",toString(_("Cycle number where the Update Prediction Table is empty (context %d)"),i));
    43 //         _stat_queue_nb_cycle_full  [i] = _stat->create_counter("queue_nb_cycle_full_" +toString(i),"",toString(_("Cycle number where the Update Prediction Table is full (%d elements) (context %d)"),_param->_size_queue[i],i));
    44 //         _stat_queue_nb_elt         [i] = _stat->create_counter("queue_nb_elt_"        +toString(i),"",toString(_("Average branchement by cycle in Update Prediction Table (context %d)"),i));
    45 //       }
    46    
     32    {
     33      ALLOC2(_stat_nb_branch_hit        ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION);
     34      ALLOC2(_stat_nb_branch_miss       ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION);
     35      ALLOC1(_stat_nb_branch_unused     ,counter_t *,_param->_nb_context);
     36     
     37      for (uint32_t i=0; i<_param->_nb_context; ++i)
     38        {
     39          std::string sum_miss        = "0";
     40          std::string sum_branchement = "0";
     41
     42          for (uint32_t j=0; j<MAX_BRANCH_CONDITION; ++j)
     43            if (is_branch_condition_valid(j))
     44              {
     45                std::string nb_miss        = "nb_branch_miss_"+toString(i)+"_"+toString(j);
     46                std::string nb_branchement = "+ nb_branch_hit_"+toString(i)+"_"+toString(j)+" nb_branch_miss_"+toString(i)+"_"+toString(j);
     47                _stat_nb_branch_hit  [i][j] = _stat->create_counter("nb_branch_hit_" +toString(i)+"_"+toString(j),"",toString(_("Branch hit  speculation, branch condition : %s (context %d)"),toString(static_cast<branch_condition_t>(j)).c_str(),i));
     48                _stat_nb_branch_miss [i][j] = _stat->create_counter(nb_miss,"",toString(_("Branch miss speculation, branch condition : %s (context %d)"),toString(static_cast<branch_condition_t>(j)).c_str(),i));
     49
     50//                 _stat->create_expr_average("average_miss_"+toString(i)+"_"+toString(j),
     51//                                            "nb_branch_miss_"+toString(i)+"_"+toString(j),
     52//                                            nb_branchement,
     53//                                            "miss/branchement",
     54//                                            toString(_("Average miss by branchement, branch condition : %s (context %d)"),toString(static_cast<branch_condition_t>(j)).c_str(),i));
     55
     56                _stat->create_expr_percent("percent_miss_"+toString(i)+"_"+toString(j),
     57                                           nb_miss,
     58                                           nb_branchement,
     59                                           toString(_("Percent miss by branchement, branch condition : %s (context %d)"),toString(static_cast<branch_condition_t>(j)).c_str(),i));
     60
     61                sum_miss        = "+ "+nb_miss       +" "+ sum_miss;
     62                sum_branchement = "+ "+nb_branchement+" "+sum_branchement;
     63              }
     64
     65//           _stat->create_expr_average("average_miss_"+toString(i),
     66//                                      sum_miss,
     67//                                      sum_branchement,
     68//                                      "miss/branchement",
     69//                                      toString(_("Average miss by branchement (context %d)"),i));
     70
     71          _stat->create_expr_percent("percent_miss_"+toString(i),
     72                                     sum_miss,
     73                                     sum_branchement,
     74                                     toString(_("Percent miss by branchement (context %d)"),i));
     75         
     76          _stat_nb_branch_unused [i] = _stat->create_counter("nb_branch_unused_" +toString(i),"",toString(_("Branch unused (previous speculation) (context %d)"),i));
     77        }
     78    }
     79
     80    {
     81      ALLOC1(_stat_ufpt_queue_nb_elt        ,counter_t *,_param->_nb_context);
     82     
     83      for (uint32_t i=0; i<_param->_nb_context; ++i)
     84        {
     85          _stat_ufpt_queue_nb_elt         [i] = _stat->create_counter("ufpt_queue_nb_elt_"+toString(i),"",toString(_("Branchement in Update Fetch Prediction Table (context %d)"),i));
     86         
     87          _stat->create_expr_average_by_cycle("average_occupation_ufpt_queue_"+toString(i),"ufpt_queue_nb_elt_"+toString(i), "", toString(_("Average instruction by cycle in Update Fetch Prediction Table (context %d)"),i));
     88          _stat->create_expr_percent         ("percent_occupation_ufpt_queue_"+toString(i), "average_occupation_ufpt_queue_"+toString(i), toString(_param->_size_ufpt_queue[i]), toString(_("Percent occupation of Update Fetch Prediction Table (context %d)"),i));
     89        }
     90    }
     91
     92    {
     93      ALLOC1(_stat_upt_queue_nb_elt        ,counter_t *,_param->_nb_context);
     94     
     95      for (uint32_t i=0; i<_param->_nb_context; ++i)
     96        {
     97          _stat_upt_queue_nb_elt         [i] = _stat->create_counter("upt_queue_nb_elt_"+toString(i),"",toString(_("Average branchement by cycle in Update Prediction Table (context %d)"),i));
     98         
     99          _stat->create_expr_average_by_cycle("average_occupation_upt_queue_"+toString(i),"upt_queue_nb_elt_"+toString(i), "", toString(_("Average instruction by cycle in Update Prediction Table (context %d)"),i));
     100          _stat->create_expr_percent         ("percent_occupation_upt_queue_"+toString(i), "average_occupation_upt_queue_"+toString(i), toString(_param->_size_upt_queue[i]), toString(_("Percent occupation of Update Prediction Table (context %d)"),i));
     101        }
     102    }
     103
    47104    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
    48105  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_statistics_deallocation.cpp

    r88 r97  
    88
    99#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h"
     10#include "Behavioural/include/Allocation.h"
    1011
    1112namespace morpheo {
     
    2728   
    2829    delete    _stat;
    29 //     delete [] _stat_nb_branch_hit       ;
    30 //     delete [] _stat_nb_branch_miss      ;
    31 //     delete [] _stat_nb_branch_unused    ;
    32 //     delete [] _stat_queue_nb_cycle_empty;
    33 //     delete [] _stat_queue_nb_cycle_full ;
    34 //     delete [] _stat_queue_nb_elt        ;
     30
     31    DELETE2(_stat_nb_branch_hit            ,_param->_nb_context,MAX_BRANCH_CONDITION);
     32    DELETE2(_stat_nb_branch_miss           ,_param->_nb_context,MAX_BRANCH_CONDITION);
     33    DELETE1(_stat_nb_branch_unused         ,_param->_nb_context);
     34    DELETE1(_stat_ufpt_queue_nb_elt        ,_param->_nb_context);
     35    DELETE1(_stat_upt_queue_nb_elt         ,_param->_nb_context);
    3536   
    3637    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp

    r95 r97  
    472472//                    bool have_event = ((reg_UPDATE_PREDICTION_TABLE [context][depth]._state == UPDATE_PREDICTION_STATE_KO) or
    473473//                                       (reg_UPDATE_PREDICTION_TABLE [context][depth]._state == UPDATE_PREDICTION_STATE_EVENT));
     474#ifdef STATISTICS
     475                      Tbranch_condition_t condition = reg_UPDATE_PREDICTION_TABLE [context][depth]._condition;
     476                      bool ok     = (reg_UPDATE_PREDICTION_TABLE [context][depth]._state == UPDATE_PREDICTION_STATE_OK);
     477#endif
    474478                      bool ko     = (reg_UPDATE_PREDICTION_TABLE [context][depth]._state == UPDATE_PREDICTION_STATE_KO);
    475479
     
    480484                         
    481485                          reg_UPDATE_PREDICTION_TABLE [context][depth]._state = UPDATE_PREDICTION_STATE_END_KO;
     486
     487#ifdef STATISTICS
     488                          if (usage_is_set(_usage,USE_STATISTICS))
     489                            (*_stat_nb_branch_miss [context][condition])++;
     490#endif
    482491                        }
    483492                      else
     
    486495                         
    487496                          reg_UPDATE_PREDICTION_TABLE [context][depth]._state = UPDATE_PREDICTION_STATE_END_OK;
     497
     498
     499#ifdef STATISTICS
     500                          if (usage_is_set(_usage,USE_STATISTICS))
     501                            {
     502                              if (ok)
     503                                (*_stat_nb_branch_hit    [context][condition]) ++;
     504                              else
     505                                (*_stat_nb_branch_unused [context]) ++;
     506                            }
     507#endif
    488508                        }
    489509                     
     
    548568        // ===================================================================
    549569        for (uint32_t i=0; i<_param->_nb_context; ++i)
    550           {
    551             //----------------------------------------------------------------
    552             // Cases
    553             //----------------------------------------------------------------
    554             //   * EVENT_TYPE_NONE               - nothing
    555             //   * EVENT_TYPE_MISS_SPECULATION   
    556             //     * EVENT_STATE_END             - Change state, reset pointer
    557             //   * EVENT_TYPE_EXCEPTION          -
    558             //     * EVENT_STATE_EVENT           - Flush upft and upt
    559             //     * EVENT_STATE_END             - Change state, reset pointer
    560             //   * EVENT_TYPE_BRANCH_NO_ACCURATE - nothing : manage in decod and update
    561             //   * EVENT_TYPE_SPR_ACCESS         - nothing
    562             //   * EVENT_TYPE_MSYNC              - nothing
    563             //   * EVENT_TYPE_PSYNC              - nothing
    564             //   * EVENT_TYPE_CSYNC              - nothing
    565 
    566             Tevent_state_t event_state = PORT_READ(in_EVENT_STATE [i]);
    567             Tevent_type_t  event_type  = PORT_READ(in_EVENT_TYPE  [i]);
    568 //             Tdepth_t       depth       = PORT_READ(in_EVENT_DEPTH [i]);
     570          if (PORT_READ(in_EVENT_VAL [i]) and internal_EVENT_ACK [i])
     571            {
     572              //----------------------------------------------------------------
     573              // Cases
     574              //----------------------------------------------------------------
     575              //   * EVENT_TYPE_NONE               - nothing
     576              //   * EVENT_TYPE_MISS_SPECULATION   - Change state, reset pointer
     577              //   * EVENT_TYPE_EXCEPTION          - Flush upft and upt, Change state, reset pointer
     578              //   * EVENT_TYPE_BRANCH_NO_ACCURATE - nothing : manage in decod and update
     579              //   * EVENT_TYPE_SPR_ACCESS         - nothing
     580              //   * EVENT_TYPE_MSYNC              - nothing
     581              //   * EVENT_TYPE_PSYNC              - nothing
     582              //   * EVENT_TYPE_CSYNC              - nothing
     583             
     584              Tevent_type_t  event_type  = PORT_READ(in_EVENT_TYPE  [i]);
     585//            Tdepth_t       depth       = PORT_READ(in_EVENT_DEPTH [i]);
    569586           
    570             // Test if end of miss
    571             if ((event_state == EVENT_STATE_END) and
    572                 (event_type  == EVENT_TYPE_MISS_SPECULATION))
    573               {
    574                 log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * EVENT");
    575                 log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * state : EVENT_STATE_END");
    576                 log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * type  : EVENT_TYPE_MISS_SPECULATION");
    577 
    578 #ifdef DEBUG_TEST
    579                 if (reg_EVENT_STATE [i] != EVENT_STATE_WAIT_END_EVENT)
    580                   throw ERRORMORPHEO(FUNCTION,_("Event : invalid event state."));
    581 #endif
    582                
    583                 // Change state
    584                 log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * EVENT [%d] <- EVENT_STATE_OK (event)",i);
    585                
    586                 reg_EVENT_STATE [i] = EVENT_STATE_OK;
    587 
    588 //                 uint32_t bottom = reg_UPT_BOTTOM [i];
    589 
    590 //                 reg_UPT_TOP    [i] = bottom;
    591 //                 reg_UPT_UPDATE [i] = bottom;
    592               }
    593           }
     587              // Test if end of miss
     588              if (event_type  == EVENT_TYPE_MISS_SPECULATION)
     589                {
     590                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * EVENT");
     591                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * type  : EVENT_TYPE_MISS_SPECULATION");
     592                 
     593#ifdef DEBUG_TEST
     594                  if (reg_EVENT_STATE [i] != EVENT_STATE_WAIT_END_EVENT)
     595                    throw ERRORMORPHEO(FUNCTION,_("Event : invalid event state."));
     596#endif
     597                 
     598                  // Change state
     599                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * EVENT [%d] <- EVENT_STATE_OK (event)",i);
     600                 
     601                  reg_EVENT_STATE [i] = EVENT_STATE_OK;
     602                }
     603            }
    594604
    595605        // ===================================================================
     
    634644          }
    635645
     646#ifdef STATISTICS
     647        if (usage_is_set(_usage,USE_STATISTICS))
     648          for (uint32_t i=0; i<_param->_nb_context; i++)
     649            {
     650              for (uint32_t j=0; j<_param->_size_ufpt_queue[i]; j++)
     651                if (reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._state != UPDATE_FETCH_PREDICTION_STATE_EMPTY)
     652                  (*_stat_ufpt_queue_nb_elt [i]) ++;
     653              for (uint32_t j=0; j<_param->_size_upt_queue[i]; j++)
     654                if (reg_UPDATE_PREDICTION_TABLE [i][j]._state != UPDATE_PREDICTION_STATE_EMPTY)
     655                  (*_stat_upt_queue_nb_elt [i]) ++;
     656            }
     657#endif
     658       
    636659        // ===================================================================
    637660        // =====[ PRINT ]=====================================================
Note: See TracChangeset for help on using the changeset viewer.