Changeset 5 for trunk/IPs/systemC


Ignore:
Timestamp:
Mar 9, 2007, 7:16:58 PM (18 years ago)
Author:
rosiere
Message:

Ajout du composant Meta_Predictor

Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor
Files:
38 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/test.cpp

    r4 r5  
    4545
    4646    // Interface Branch_complete
     47  sc_signal<Tcontrol_t>           ** BRANCH_COMPLETE_VAL                    ;
     48  sc_signal<Tcontrol_t>           ** BRANCH_COMPLETE_PREDICTOR_2_VAL        ;
     49
    4750  sc_signal<Tcontrol_t>           ** BRANCH_COMPLETE_PREDICTOR_0_ACK        ;
    4851  sc_signal<Tcontrol_t>           ** BRANCH_COMPLETE_PREDICTOR_1_ACK        ;
     
    5760  sc_signal<Tpht_history_t>       ** BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY;
    5861  sc_signal<Thistory_t>           ** BRANCH_COMPLETE_HISTORY                ;
    59 
     62  sc_signal<Tcontrol_t>           ** BRANCH_COMPLETE_DIRECTION              ;
     63  sc_signal<Tcontrol_t>           ** BRANCH_COMPLETE_PREDICTOR_2_DIRECTION  ;
    6064  string rename;
    6165
     
    108112
    109113    // Interface Branch_complete
    110    
     114    BRANCH_COMPLETE_VAL                     = new sc_signal<Tcontrol_t>     * [_param._nb_branch_complete     ];
     115    BRANCH_COMPLETE_PREDICTOR_2_VAL         = new sc_signal<Tcontrol_t>     * [_param._nb_branch_complete     ];
    111116    BRANCH_COMPLETE_PREDICTOR_0_ACK         = new sc_signal<Tcontrol_t>     * [_param._nb_branch_complete     ];
    112117    BRANCH_COMPLETE_PREDICTOR_1_ACK         = new sc_signal<Tcontrol_t>     * [_param._nb_branch_complete     ];
     
    120125    BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY = new sc_signal<Tpht_history_t> * [_param._nb_branch_complete     ];
    121126    BRANCH_COMPLETE_HISTORY                 = new sc_signal<Thistory_t>     * [_param._nb_branch_complete     ];
     127    BRANCH_COMPLETE_DIRECTION               = new sc_signal<Tcontrol_t>     * [_param._nb_branch_complete     ];
     128    BRANCH_COMPLETE_PREDICTOR_2_DIRECTION   = new sc_signal<Tcontrol_t>     * [_param._nb_branch_complete     ];
    122129
    123130    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
    124131      {
     132        rename = "BRANCH_COMPLETE_VAL_"                      +toString(i);
     133        BRANCH_COMPLETE_VAL                               [i] = new sc_signal<Tcontrol_t>     (rename.c_str());
     134        rename = "BRANCH_COMPLETE_PREDICTOR_2_VAL_"          +toString(i);
     135        BRANCH_COMPLETE_PREDICTOR_2_VAL                   [i] = new sc_signal<Tcontrol_t>     (rename.c_str());
    125136        rename = "BRANCH_COMPLETE_PREDICTOR_0_ACK_"          +toString(i);
    126137        BRANCH_COMPLETE_PREDICTOR_0_ACK                   [i] = new sc_signal<Tcontrol_t>     (rename.c_str());
     
    145156        rename = "BRANCH_COMPLETE_HISTORY_"                +toString(i);
    146157        BRANCH_COMPLETE_HISTORY                           [i] = new sc_signal<Thistory_t>     (rename.c_str());
     158        rename = "BRANCH_COMPLETE_DIRECTION_"              +toString(i);
     159        BRANCH_COMPLETE_DIRECTION                         [i] = new sc_signal<Tcontrol_t>     (rename.c_str());
     160        rename = "BRANCH_COMPLETE_PREDICTOR_2_DIRECTION_"  +toString(i);
     161        BRANCH_COMPLETE_PREDICTOR_2_DIRECTION             [i] = new sc_signal<Tcontrol_t>     (rename.c_str());
    147162      }
    148163
     
    192207        if (_param._have_meta_predictor)
    193208          {
     209        (*(_Meta_Predictor_Glue-> in_BRANCH_COMPLETE_VAL                     [i])) (*(BRANCH_COMPLETE_VAL                     [i]));
     210        (*(_Meta_Predictor_Glue->out_BRANCH_COMPLETE_PREDICTOR_2_VAL         [i])) (*(BRANCH_COMPLETE_PREDICTOR_2_VAL         [i]));
     211
    194212        (*(_Meta_Predictor_Glue-> in_BRANCH_COMPLETE_PREDICTOR_0_ACK         [i])) (*(BRANCH_COMPLETE_PREDICTOR_0_ACK         [i]));
    195213        (*(_Meta_Predictor_Glue-> in_BRANCH_COMPLETE_PREDICTOR_1_ACK         [i])) (*(BRANCH_COMPLETE_PREDICTOR_1_ACK         [i]));
     
    214232        (*(_Meta_Predictor_Glue->out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY [i])) (*(BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY [i]));
    215233        (*(_Meta_Predictor_Glue-> in_BRANCH_COMPLETE_HISTORY                 [i])) (*(BRANCH_COMPLETE_HISTORY                 [i]));
     234        if (_param._have_meta_predictor)       
     235          {
     236        (*(_Meta_Predictor_Glue-> in_BRANCH_COMPLETE_DIRECTION               [i])) (*(BRANCH_COMPLETE_DIRECTION               [i]));
     237        (*(_Meta_Predictor_Glue->out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION   [i])) (*(BRANCH_COMPLETE_PREDICTOR_2_DIRECTION   [i]));
     238          }
    216239      }
    217240
     
    241264  Tcontrol_t     predict_direction                       [_param._nb_prediction];
    242265               
     266  Tcontrol_t     branch_complete_predictor_2_val         [_param._nb_branch_complete];
    243267  Tcontrol_t     branch_complete_ack                     [_param._nb_branch_complete];
    244268  Tbht_history_t branch_complete_predictor_0_bht_history [_param._nb_branch_complete];
     
    248272  Tbht_history_t branch_complete_predictor_2_bht_history [_param._nb_branch_complete];
    249273  Tpht_history_t branch_complete_predictor_2_pht_history [_param._nb_branch_complete];
     274  Tcontrol_t     branch_complete_predictor_2_direction   [_param._nb_branch_complete];
    250275
    251276  uint32_t shift_0 = 0;
     
    255280  uint32_t shift_4 = shift_3 + _param._predictor_1_pht_size_counter;
    256281  uint32_t shift_5 = shift_4 + _param._predictor_2_bht_size_shifter;
    257 //uint32_t shift_5 = shift_5 + _param._predictor_2_pht_size_counter;
     282//uint32_t shift_6 = shift_5 + _param._predictor_2_pht_size_counter;
    258283
    259284  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
     
    353378                                                             (branch_complete_predictor_2_bht_history [i] << shift_4) |
    354379                                                             (branch_complete_predictor_2_pht_history [i] << shift_5) );
     380
     381          Tcontrol_t direction_0 = ((_param._predictor_0_have_pht)?(branch_complete_predictor_0_pht_history [i] >> (_param._predictor_0_pht_size_counter-1)):(branch_complete_predictor_0_bht_history [i] >> (_param._predictor_0_bht_size_shifter-1)))&1;
     382          Tcontrol_t direction_1 = ((_param._predictor_1_have_pht)?(branch_complete_predictor_1_pht_history [i] >> (_param._predictor_1_pht_size_counter-1)):(branch_complete_predictor_1_bht_history [i] >> (_param._predictor_1_bht_size_shifter-1)))&1;
     383          Tcontrol_t direction_2 = ((_param._predictor_2_have_pht)?(branch_complete_predictor_2_pht_history [i] >> (_param._predictor_2_pht_size_counter-1)):(branch_complete_predictor_2_bht_history [i] >> (_param._predictor_2_bht_size_shifter-1)))&1;
     384
     385          Tcontrol_t direction   = ((rand()%2) != 0);
     386          Tcontrol_t val         = ((rand()%2) != 0);
     387
     388          cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} " << endl
     389               << "  * val             : " << val << endl
     390               << "  * direction_good  : " << direction << endl
     391               << "    * direction_0   : " << direction_0 << endl
     392               << "    * direction_1   : " << direction_1 << endl
     393               << "    * direction_2   : " << direction_2 << endl;
     394         
     395          BRANCH_COMPLETE_VAL       [i] ->write (val);
     396          BRANCH_COMPLETE_DIRECTION [i] ->write (direction);
     397         
     398          if (val == 0)
     399            {
     400              branch_complete_predictor_2_val [i] = val;
     401            }
     402          else
     403            {
     404              branch_complete_predictor_2_val [i] = (direction_0 xor direction_1);
     405              if (direction_2 == 0)
     406                if (direction_0 == direction)
     407                  branch_complete_predictor_2_direction [i] = 0;
     408                else
     409                  branch_complete_predictor_2_direction [i] = 1;
     410              else
     411                if (direction_1 == direction)
     412                  branch_complete_predictor_2_direction [i] = 1;
     413                else
     414                  branch_complete_predictor_2_direction [i] = 0;
     415            }
    355416        }
    356417
     
    370431        if (_param._have_meta_predictor)       
    371432          {                                     
     433          TEST(Tcontrol_t    , BRANCH_COMPLETE_PREDICTOR_2_VAL         [i]->read(), branch_complete_predictor_2_val         [i]);
     434
     435          if (branch_complete_predictor_2_val         [i])
     436          TEST(Tcontrol_t    , BRANCH_COMPLETE_PREDICTOR_2_DIRECTION   [i]->read(), branch_complete_predictor_2_direction   [i]); 
     437
    372438        if (_param._predictor_0_have_bht)
    373439          TEST(Tbht_history_t, BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY [i]->read(), branch_complete_predictor_0_bht_history [i]);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h

    r4 r5  
    8282
    8383    // Interface Branch_complete
     84  public    : SC_IN (Tcontrol_t)           **  in_BRANCH_COMPLETE_VAL                    ;
     85  public    : SC_OUT(Tcontrol_t)           ** out_BRANCH_COMPLETE_PREDICTOR_2_VAL        ;
     86
    8487  public    : SC_IN (Tcontrol_t)           **  in_BRANCH_COMPLETE_PREDICTOR_0_ACK        ;
    8588  public    : SC_IN (Tcontrol_t)           **  in_BRANCH_COMPLETE_PREDICTOR_1_ACK        ;
     
    9497  public    : SC_OUT(Tpht_history_t)       ** out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY;
    9598  public    : SC_IN (Thistory_t)           **  in_BRANCH_COMPLETE_HISTORY                ;
     99  public    : SC_IN (Tcontrol_t)           **  in_BRANCH_COMPLETE_DIRECTION              ;
     100  public    : SC_OUT(Tcontrol_t)           ** out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION  ;
    96101
    97102    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     
    130135  public  : void     genMealy_predict_ack             (void);
    131136  public  : void     genMealy_predict_history         (void);
     137  public  : void     genMealy_branch_complete_val     (void);
    132138  public  : void     genMealy_branch_complete_ack     (void);
    133139  public  : void     genMealy_branch_complete_history (void);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/include/Parameters.h

    r4 r5  
    4646  public : const uint32_t _size_history                      ;
    4747
     48  public : const uint32_t _shift_0;
     49  public : const uint32_t _shift_1;
     50  public : const uint32_t _shift_2;
     51  public : const uint32_t _shift_3;
     52  public : const uint32_t _shift_4;
     53  public : const uint32_t _shift_5;
     54  public : const uint32_t _shift_6;
     55
    4856    //-----[ methods ]-----------------------------------------------------------
    4957  public : Parameters  (bool     have_meta_predictor               ,
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue.cpp

    r4 r5  
    163163      }
    164164#endif   
     165
     166    if (_param._have_meta_predictor)
     167      {
     168    log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","method - genMealy_branch_complete_val");
     169    SC_METHOD (genMealy_branch_complete_val);
     170    dont_initialize ();
     171    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
     172      {
     173        sensitive << *(in_BRANCH_COMPLETE_VAL       [i])
     174                  << *(in_BRANCH_COMPLETE_HISTORY   [i])
     175                  << *(in_BRANCH_COMPLETE_DIRECTION [i]);
     176      }
     177
     178#ifdef SYSTEMCASS_SPECIFIC
     179    // List dependency information
     180    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
     181      {
     182        (*(out_BRANCH_COMPLETE_PREDICTOR_2_VAL       [i])) (*(in_BRANCH_COMPLETE_VAL       [i]));
     183        (*(out_BRANCH_COMPLETE_PREDICTOR_2_VAL       [i])) (*(in_BRANCH_COMPLETE_HISTORY   [i]));
     184        (*(out_BRANCH_COMPLETE_PREDICTOR_2_VAL       [i])) (*(in_BRANCH_COMPLETE_DIRECTION [i]));
     185
     186        (*(out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i])) (*(in_BRANCH_COMPLETE_VAL       [i]));
     187        (*(out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i])) (*(in_BRANCH_COMPLETE_HISTORY   [i]));
     188        (*(out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i])) (*(in_BRANCH_COMPLETE_DIRECTION [i]));
     189      }
     190#endif   
     191      }
    165192
    166193    log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","method - genMealy_branch_complete_ack");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_allocation.cpp

    r4 r5  
    114114    if (_param._have_meta_predictor)
    115115      {
     116     in_BRANCH_COMPLETE_VAL                     = new SC_IN (Tcontrol_t)     * [_param._nb_branch_complete     ];
     117    out_BRANCH_COMPLETE_PREDICTOR_2_VAL         = new SC_OUT(Tcontrol_t)     * [_param._nb_branch_complete     ];
     118
    116119     in_BRANCH_COMPLETE_PREDICTOR_0_ACK         = new SC_IN (Tcontrol_t)     * [_param._nb_branch_complete     ];
    117120     in_BRANCH_COMPLETE_PREDICTOR_1_ACK         = new SC_IN (Tcontrol_t)     * [_param._nb_branch_complete     ];
     
    135138    out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY = new SC_OUT(Tpht_history_t) * [_param._nb_branch_complete     ];
    136139     in_BRANCH_COMPLETE_HISTORY                 = new SC_IN (Thistory_t)     * [_param._nb_branch_complete     ];
    137 
     140    if (_param._have_meta_predictor)
     141      {
     142     in_BRANCH_COMPLETE_DIRECTION               = new SC_IN (Tcontrol_t)     * [_param._nb_branch_complete     ];
     143    out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION   = new SC_OUT(Tcontrol_t)     * [_param._nb_branch_complete     ];
     144      }
    138145    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
    139146      {
    140147        if (_param._have_meta_predictor)
    141148          {
     149        rename = " in_BRANCH_COMPLETE_VAL_"                      +toString(i);
     150         in_BRANCH_COMPLETE_VAL                               [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
     151       
     152        rename = "out_BRANCH_COMPLETE_PREDICTOR_2_VAL_"          +toString(i);
     153        out_BRANCH_COMPLETE_PREDICTOR_2_VAL                   [i] = new SC_OUT(Tcontrol_t)     (rename.c_str());
     154
    142155        rename = " in_BRANCH_COMPLETE_PREDICTOR_0_ACK_"          +toString(i);
    143156         in_BRANCH_COMPLETE_PREDICTOR_0_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
     
    187200        rename = " in_BRANCH_COMPLETE_HISTORY_"                +toString(i);
    188201         in_BRANCH_COMPLETE_HISTORY                           [i] = new SC_IN (Thistory_t)     (rename.c_str());
    189       }
    190 
     202
     203        if (_param._have_meta_predictor)
     204          {
     205        rename = " in_BRANCH_COMPLETE_DIRECTION_"              +toString(i);
     206         in_BRANCH_COMPLETE_DIRECTION                         [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
     207
     208        rename = "out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION_"  +toString(i);
     209        out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION             [i] = new SC_OUT(Tcontrol_t)     (rename.c_str());
     210          }
     211      }
    191212    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    192213
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_deallocation.cpp

    r4 r5  
    8484        if (_param._have_meta_predictor)
    8585        {
     86        delete  in_BRANCH_COMPLETE_VAL                               [i];
     87        delete out_BRANCH_COMPLETE_PREDICTOR_2_VAL                   [i];
     88
    8689        delete  in_BRANCH_COMPLETE_PREDICTOR_0_ACK                   [i];
    8790        delete  in_BRANCH_COMPLETE_PREDICTOR_1_ACK                   [i];
     
    106109        delete out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY           [i];
    107110        delete  in_BRANCH_COMPLETE_HISTORY                           [i];
     111        if (_param._have_meta_predictor)
     112          {
     113        delete  in_BRANCH_COMPLETE_DIRECTION                         [i];
     114        delete out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION             [i];
     115          }
    108116      }
    109117
    110118    if (_param._have_meta_predictor)
    111119    {
     120    delete  in_BRANCH_COMPLETE_VAL                     ;
     121    delete out_BRANCH_COMPLETE_PREDICTOR_2_VAL         ;
     122
    112123    delete  in_BRANCH_COMPLETE_PREDICTOR_0_ACK         ;
    113124    delete  in_BRANCH_COMPLETE_PREDICTOR_1_ACK         ;
     
    131142    delete out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY ;
    132143    delete  in_BRANCH_COMPLETE_HISTORY                 ;
    133 
     144    if (_param._have_meta_predictor)
     145      {
     146    delete  in_BRANCH_COMPLETE_DIRECTION               ;
     147    delete out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION   ;
     148      }
    134149    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    135150
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_branch_complete_history.cpp

    r4 r5  
    2828          {
    2929        if (_param._predictor_0_have_bht)
    30           {
    31         PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY [i], history & gen_mask<Tbht_history_t>(_param._predictor_0_bht_size_shifter));
    32         history >>= _param._predictor_0_bht_size_shifter;
    33           }
     30        PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY [i], (history >> _param._shift_0) & gen_mask<Tbht_history_t>(_param._predictor_0_bht_size_shifter));
    3431        if (_param._predictor_0_have_pht)
    35           {
    36         PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY [i], history & gen_mask<Tpht_history_t>(_param._predictor_0_pht_size_counter));
    37         history >>= _param._predictor_0_pht_size_counter;
     32        PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY [i], (history >> _param._shift_1) & gen_mask<Tpht_history_t>(_param._predictor_0_pht_size_counter));
    3833          }
    3934
    4035        if (_param._predictor_1_have_bht)
    4136          {
    42         PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY [i], history & gen_mask<Tbht_history_t>(_param._predictor_1_bht_size_shifter));
    43         history >>= _param._predictor_1_bht_size_shifter;
    44           }
     37        PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY [i], (history >> _param._shift_2) & gen_mask<Tbht_history_t>(_param._predictor_1_bht_size_shifter));
     38
    4539        if (_param._predictor_1_have_pht)
    46           {
    47         PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY [i], history & gen_mask<Tpht_history_t>(_param._predictor_1_pht_size_counter));
    48         history >>= _param._predictor_1_pht_size_counter;
    49           }
     40        PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY [i], (history >> _param._shift_3) & gen_mask<Tpht_history_t>(_param._predictor_1_pht_size_counter));
    5041          }
    5142
    5243        if (_param._predictor_2_have_bht)
    53           {
    54         PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY [i], history & gen_mask<Tbht_history_t>(_param._predictor_2_bht_size_shifter));
    55         history >>= _param._predictor_2_bht_size_shifter;
    56           }
     44        PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY [i], (history >> _param._shift_4) & gen_mask<Tbht_history_t>(_param._predictor_2_bht_size_shifter));
    5745        if (_param._predictor_2_have_pht)
    58           {
    59         PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY [i], history & gen_mask<Tpht_history_t>(_param._predictor_2_pht_size_counter));
    60         history >>= _param._predictor_2_pht_size_counter;
    61           }
     46        PORT_WRITE(out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY [i], (history >> _param._shift_5) & gen_mask<Tpht_history_t>(_param._predictor_2_pht_size_counter));
    6247      }
    6348
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_genMealy_predict_history.cpp

    r4 r5  
    3535        predictor_2_pht_history   = PORT_READ(in_PREDICT_PREDICTOR_2_PHT_HISTORY [i]);
    3636        predictor_2_pht_direction = predictor_2_pht_history >> (_param._predictor_2_pht_size_counter-1);
    37         history                   = (history << _param._predictor_2_pht_size_counter) | predictor_2_pht_history;
     37        history                  |= (predictor_2_pht_history << _param._shift_5);
    3838          }
    3939        if (_param._predictor_2_have_bht)
     
    4141        predictor_2_bht_history   = PORT_READ(in_PREDICT_PREDICTOR_2_BHT_HISTORY [i]);
    4242        predictor_2_bht_direction = predictor_2_bht_history >> (_param._predictor_2_bht_size_shifter-1);
    43         history                   = (history << _param._predictor_2_bht_size_shifter) | predictor_2_bht_history;
     43        history                  |= (predictor_2_bht_history << _param._shift_4);
    4444          }
    4545
     
    5252        predictor_1_pht_history   = PORT_READ(in_PREDICT_PREDICTOR_1_PHT_HISTORY [i]);
    5353        predictor_1_pht_direction = predictor_1_pht_history >> (_param._predictor_1_pht_size_counter-1);
    54         history                   = (history << _param._predictor_1_pht_size_counter) | predictor_1_pht_history;
     54        history                  |= (predictor_1_pht_history << _param._shift_3);
    5555          }
    5656        if (_param._predictor_1_have_bht)
     
    5858        predictor_1_bht_history   = PORT_READ(in_PREDICT_PREDICTOR_1_BHT_HISTORY [i]);
    5959        predictor_1_bht_direction = predictor_1_bht_history >> (_param._predictor_1_bht_size_shifter-1);
    60         history                   = (history << _param._predictor_1_bht_size_shifter) | predictor_1_bht_history;
     60        history                  |= (predictor_1_bht_history << _param._shift_2) ;
    6161          }
    6262        if (_param._predictor_0_have_pht)
     
    6464        predictor_0_pht_history   = PORT_READ(in_PREDICT_PREDICTOR_0_PHT_HISTORY [i]);
    6565        predictor_0_pht_direction = predictor_0_pht_history >> (_param._predictor_0_pht_size_counter-1);
    66         history                   = (history << _param._predictor_0_pht_size_counter) | predictor_0_pht_history;
     66        history                  |= (predictor_0_pht_history << _param._shift_1);
    6767          }
    6868        if (_param._predictor_0_have_bht)
     
    7070        predictor_0_bht_history   = PORT_READ(in_PREDICT_PREDICTOR_0_BHT_HISTORY [i]);
    7171        predictor_0_bht_direction = predictor_0_bht_history >> (_param._predictor_0_bht_size_shifter-1);
    72         history                   = (history << _param._predictor_0_bht_size_shifter) | predictor_0_bht_history;
     72        history                  |= (predictor_0_bht_history << _param._shift_0);
    7373          }
    7474
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_vhdl_body.cpp

    r4 r5  
    7171        vhdl.set_body ("");
    7272        if (_param._have_meta_predictor)
    73           vhdl.set_body ("out_PREDICT_DIRECTION_"+toString(i)+"   <= predictor_0_direction_"+toString(i)+" when predictor_2_direction_"+toString(i)+"='0' else predictor_1_direction_"+toString(i)+";");
     73          vhdl.set_body ("out_PREDICT_DIRECTION_"+toString(i)+"   <= predict_predictor_0_direction_"+toString(i)+" when predict_predictor_2_direction_"+toString(i)+"='0' else predict_predictor_1_direction_"+toString(i)+";");
    7474        else
    75           vhdl.set_body ("out_PREDICT_DIRECTION_"+toString(i)+"   <= predictor_2_direction_"+toString(i)+";");
     75          vhdl.set_body ("out_PREDICT_DIRECTION_"+toString(i)+"   <= predict_predictor_2_direction_"+toString(i)+";");
    7676      }
    7777
     
    8282    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
    8383      {
     84        // branch_complete_predictor_2 val and directionn
     85        if (_param._have_meta_predictor)
     86          {
     87        vhdl.set_body ("out_BRANCH_COMPLETE_PREDICTOR_2_VAL_"+toString(i)+"       <= (branch_complete_predictor_0_direction_"+toString(i)+" xor branch_complete_predictor_1_direction_"+toString(i)+") and "+"in_BRANCH_COMPLETE_VAL_"+toString(i)+";");
     88        vhdl.set_body ("out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION_"+toString(i)+" <= (branch_complete_predictor_0_direction_"+toString(i)+" and not in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+") or (branch_complete_predictor_1_direction_"+toString(i)+" and in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+");");
     89          }
     90
    8491        string meta_predictor_ack =  (_param._have_meta_predictor==true)?("in_BRANCH_COMPLETE_PREDICTOR_0_ACK_"+toString(i)+" and in_BRANCH_COMPLETE_PREDICTOR_1_ACK_"+toString(i)):"'1'";
    8592
    86         vhdl.set_body ("out_BRANCH_COMPLETE_ACK_"+toString(i)+" <= "+meta_predictor_ack+" and "+"in_BRANCH_COMPLETE_PREDICTOR_2_ACK_"+toString(i)+";");
     93        vhdl.set_body ("out_BRANCH_COMPLETE_ACK_"+toString(i)+"                   <= "+meta_predictor_ack+" and "+"in_BRANCH_COMPLETE_PREDICTOR_2_ACK_"+toString(i)+";");
    8794
    8895        uint32_t index=_param._size_history;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_vhdl_declaration.cpp

    r4 r5  
    2626          {
    2727        if (_param._predictor_0_have_pht)
    28           vhdl.set_alias ("predictor_0_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_0_PHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_0_pht_size_counter-1,_param._predictor_0_pht_size_counter-1));
     28          vhdl.set_alias ("predict_predictor_0_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_0_PHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_0_pht_size_counter-1,_param._predictor_0_pht_size_counter-1));
    2929        else
    30           vhdl.set_alias ("predictor_0_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_0_BHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_0_bht_size_shifter-1,_param._predictor_0_bht_size_shifter-1));
     30          vhdl.set_alias ("predict_predictor_0_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_0_BHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_0_bht_size_shifter-1,_param._predictor_0_bht_size_shifter-1));
    3131        if (_param._predictor_1_have_pht)
    32           vhdl.set_alias ("predictor_1_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_1_PHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_1_pht_size_counter-1,_param._predictor_1_pht_size_counter-1));
     32          vhdl.set_alias ("predict_predictor_1_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_1_PHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_1_pht_size_counter-1,_param._predictor_1_pht_size_counter-1));
    3333        else
    34           vhdl.set_alias ("predictor_1_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_1_BHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_1_bht_size_shifter-1,_param._predictor_1_bht_size_shifter-1));
     34          vhdl.set_alias ("predict_predictor_1_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_1_BHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_1_bht_size_shifter-1,_param._predictor_1_bht_size_shifter-1));
    3535          }
    3636
    3737        if (_param._predictor_2_have_pht)
    38           vhdl.set_alias ("predictor_2_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_2_PHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_2_pht_size_counter-1,_param._predictor_2_pht_size_counter-1));
     38          vhdl.set_alias ("predict_predictor_2_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_2_PHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_2_pht_size_counter-1,_param._predictor_2_pht_size_counter-1));
    3939        else
    40           vhdl.set_alias ("predictor_2_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_2_BHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_2_bht_size_shifter-1,_param._predictor_2_bht_size_shifter-1));
     40          vhdl.set_alias ("predict_predictor_2_direction_"+toString(i),std_logic(1), "in_PREDICT_PREDICTOR_2_BHT_HISTORY_"+toString(i),std_logic_range(_param._predictor_2_bht_size_shifter-1,_param._predictor_2_bht_size_shifter-1));
    4141      }
     42
     43    if (_param._have_meta_predictor)
     44      {
     45    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
     46      {
     47//      if (_param._predictor_2_have_pht)
     48//      vhdl.set_alias ("branch_complete_predictor_2_direction_"+toString(i),std_logic(1)," in_BRANCH_COMPLETE_HISTORY_"+toString(i),std_logic_range(_param._shift_6-1, _param._shift_6-1));
     49//      else
     50//      vhdl.set_alias ("branch_complete_predictor_2_direction_"+toString(i),std_logic(1)," in_BRANCH_COMPLETE_HISTORY_"+toString(i),std_logic_range(_param._shift_5-1, _param._shift_5-1));
     51
     52        if (_param._predictor_1_have_pht)
     53        vhdl.set_alias ("branch_complete_predictor_1_direction_"+toString(i),std_logic(1)," in_BRANCH_COMPLETE_HISTORY_"+toString(i),std_logic_range(_param._shift_4-1, _param._shift_4-1));
     54        else
     55        vhdl.set_alias ("branch_complete_predictor_1_direction_"+toString(i),std_logic(1)," in_BRANCH_COMPLETE_HISTORY_"+toString(i),std_logic_range(_param._shift_3-1, _param._shift_3-1));
     56
     57        if (_param._predictor_0_have_pht)
     58        vhdl.set_alias ("branch_complete_predictor_0_direction_"+toString(i),std_logic(1)," in_BRANCH_COMPLETE_HISTORY_"+toString(i),std_logic_range(_param._shift_2-1, _param._shift_2-1));
     59        else
     60        vhdl.set_alias ("branch_complete_predictor_0_direction_"+toString(i),std_logic(1)," in_BRANCH_COMPLETE_HISTORY_"+toString(i),std_logic_range(_param._shift_1-1, _param._shift_1-1));
     61
     62      }
     63      }
     64
     65
     66
    4267    log_printf(FUNC,Meta_Predictor_Glue,"vhdl_declaration","End");
    4368  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_vhdl_port.cpp

    r4 r5  
    5555        if (_param._have_meta_predictor)
    5656          {
     57        vhdl.set_port (" in_BRANCH_COMPLETE_VAL_"+toString(i)+"                    ", IN, 1);
     58        vhdl.set_port ("out_BRANCH_COMPLETE_PREDICTOR_2_VAL_"+toString(i)+"        ",OUT, 1);
     59
    5760        vhdl.set_port (" in_BRANCH_COMPLETE_PREDICTOR_0_ACK_"+toString(i)+"        ", IN, 1);
    5861        vhdl.set_port (" in_BRANCH_COMPLETE_PREDICTOR_1_ACK_"+toString(i)+"        ", IN, 1);
     
    7881
    7982        vhdl.set_port (" in_BRANCH_COMPLETE_HISTORY_"+toString(i)+"                ", IN,_param._size_history);
     83        if (_param._have_meta_predictor)
     84          {
     85        vhdl.set_port (" in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+"              ", IN,1);
     86        vhdl.set_port ("out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION_"+toString(i)+"  ",OUT,1);
     87          }
    8088      }
    8189
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_vhdl_testbench_port.cpp

    r4 r5  
    5555        if (_param._have_meta_predictor)
    5656          {
     57        _vhdl_testbench->set_port (" in_BRANCH_COMPLETE_VAL_"+toString(i)+"                    ", IN, 1);
     58        _vhdl_testbench->set_port ("out_BRANCH_COMPLETE_PREDICTOR_2_VAL_"+toString(i)+"        ",OUT, 1);
     59
    5760        _vhdl_testbench->set_port (" in_BRANCH_COMPLETE_PREDICTOR_0_ACK_"+toString(i)+"        ", IN, 1);
    5861        _vhdl_testbench->set_port (" in_BRANCH_COMPLETE_PREDICTOR_1_ACK_"+toString(i)+"        ", IN, 1);
     
    7881
    7982        _vhdl_testbench->set_port (" in_BRANCH_COMPLETE_HISTORY_"+toString(i)+"                ", IN,_param._size_history);
     83        if (_param._have_meta_predictor)
     84          {
     85        _vhdl_testbench->set_port (" in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+"              ", IN,1);
     86        _vhdl_testbench->set_port ("out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION_"+toString(i)+"  ",OUT,1);
     87          }
    8088      }
    8189
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_vhdl_testbench_transition.cpp

    r4 r5  
    6262        if (_param._have_meta_predictor)
    6363          {
     64        _vhdl_testbench->add_input (PORT_READ( in_BRANCH_COMPLETE_VAL             [i]));
     65        _vhdl_testbench->add_output(PORT_READ(out_BRANCH_COMPLETE_PREDICTOR_2_VAL [i]));
     66
    6467        _vhdl_testbench->add_input (PORT_READ( in_BRANCH_COMPLETE_PREDICTOR_0_ACK [i]));
    6568        _vhdl_testbench->add_input (PORT_READ( in_BRANCH_COMPLETE_PREDICTOR_1_ACK [i]));
     
    8487        _vhdl_testbench->add_output(PORT_READ(out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY [i]));
    8588
    86         _vhdl_testbench->add_input (PORT_READ( in_BRANCH_COMPLETE_HISTORY [i]));
     89        _vhdl_testbench->add_input (PORT_READ( in_BRANCH_COMPLETE_HISTORY   [i]));
     90        if (_param._have_meta_predictor)
     91          {
     92        _vhdl_testbench->add_input (PORT_READ( in_BRANCH_COMPLETE_DIRECTION [i]));
     93        _vhdl_testbench->add_output(PORT_READ(out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i]));
     94          }
    8795      }
    8896   
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Parameters.cpp

    r4 r5  
    5353    _size_history                       (_predictor_0_bht_size_shifter + _predictor_0_pht_size_counter +
    5454                                         _predictor_1_bht_size_shifter + _predictor_1_pht_size_counter +
    55                                          _predictor_2_bht_size_shifter + _predictor_2_pht_size_counter )
     55                                         _predictor_2_bht_size_shifter + _predictor_2_pht_size_counter ),
     56
     57    _shift_0                            (0),
     58    _shift_1                            (_shift_0 + _predictor_0_bht_size_shifter),
     59    _shift_2                            (_shift_1 + _predictor_0_pht_size_counter),
     60    _shift_3                            (_shift_2 + _predictor_1_bht_size_shifter),
     61    _shift_4                            (_shift_3 + _predictor_1_pht_size_counter),
     62    _shift_5                            (_shift_4 + _predictor_2_bht_size_shifter),
     63    _shift_6                            (_shift_5 + _predictor_2_pht_size_counter)
    5664  {
    5765    log_printf(FUNC,Meta_Predictor_Glue,"Parameters","Begin");
     
    8189    _nb_branch_complete                 (param._nb_branch_complete                 ),
    8290
    83     _size_history                       (param._size_history                       )
     91    _size_history                       (param._size_history                       ),
     92
     93    _shift_0                            (param._shift_0                            ),
     94    _shift_1                            (param._shift_1                            ),
     95    _shift_2                            (param._shift_2                            ),
     96    _shift_3                            (param._shift_3                            ),
     97    _shift_4                            (param._shift_4                            ),
     98    _shift_5                            (param._shift_5                            ),
     99    _shift_6                            (param._shift_6                            )
     100
    84101  {
    85102    log_printf(FUNC,Meta_Predictor_Glue,"Parameters","Begin");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/configuration.cfg

    r3 r5  
    11Two_Level_Branch_Predictor
    221       1       +1      # have_bht           
    3 6       8       +1      # bht_size_shifter   
    4 64      64      *2      # bht_nb_shifter     
    5 0       1       +1      # have_pht           
    6 4       4       +1      # pht_size_counter   
    7 256     512     *2      # pht_nb_counter     
    8 0       2       +1      # pht_size_address_share
     38       8       +1      # bht_size_shifter   
     4512     512     *2      # bht_nb_shifter     
     51       1       +1      # have_pht           
     68       8       +1      # pht_size_counter   
     7512     512     *2      # pht_nb_counter     
     82       2       +1      # pht_size_address_share
    9916      16      +1      # size_address     
    10 1       1       +1      # nb_prediction     
    11 1       1       +1      # nb_branch_complete
     102       2       +1      # nb_prediction     
     112       2       +1      # nb_branch_complete
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/src/test.cpp

    r3 r5  
    220220      cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} Predict          : bht_history " << bht_history << " - pht_history " << pht_history[bht_history] << endl;
    221221
     222
    222223      // Ask a new prediction
    223224      PREDICT_VAL                  [num_port_predict        ]->write(1);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Two_Level_Branch_Predictor_Glue/include/Two_Level_Branch_Predictor_Glue.h

    r2 r5  
    5151  protected : const Parameters _param;
    5252//#ifdef STATISTICS
    53 //  protected : const morpheo::behavioural::Parameters_Statistics _param_statistics;
     53//protected : const morpheo::behavioural::Parameters_Statistics _param_statistics;
    5454//#endif
    5555
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor.cpp

    r2 r5  
    5757    allocation ();
    5858
     59#if (defined(STATISTICS) || defined (VHDL_TESTBENCH))
    5960    SC_METHOD (transition);
    6061    dont_initialize ();
    6162    sensitive_pos << *(in_CLOCK);
     63#endif
    6264
    6365//     SC_METHOD (genMoore);
Note: See TracChangeset for help on using the changeset viewer.