Ignore:
Timestamp:
Jul 17, 2007, 4:47:56 PM (17 years ago)
Author:
rosiere
Message:

Modification des classes d'encapsulation des interfaces.
Stable sur tous les composants actuels

File:
1 edited

Legend:

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

    r5 r44  
    2323    log_printf(FUNC,Meta_Predictor_Glue,"allocation","Begin");
    2424
    25 #if defined(STATISTICS) or defined(VHDL_TESTBENCH)
    26     in_CLOCK  = new SC_CLOCK           ("in_CLOCK");
    27 #endif
    28 
    29     // Interface Predict
     25    _component   = new Component ();
     26
     27    Entity * entity = _component->set_entity (_name                 
     28                                             ,"Two_Level_Branch_Predictor_Glue"
     29#ifdef POSITION
     30                                             ,COMBINATORY
     31#endif
     32                                              );
     33   
     34    _interfaces = entity->set_interfaces();
     35
     36    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     37    {
     38      Interface * interface = _interfaces->set_interface(""
     39#ifdef POSITION
     40                                                         , IN 
     41                                                         , SOUTH
     42                                                         , "Generalist interface"
     43#endif
     44                                                         );
     45     
     46      in_CLOCK              = interface->set_signal_clk              ("clock" ,1,CLOCK_VHDL_NO);
     47      in_NRESET             = interface->set_signal_in  <Tcontrol_t> ("nreset",1,RESET_VHDL_NO);
     48    }
     49
     50
     51    // ~~~~~[ Interface : "Predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3052
    3153    if (_param._have_meta_predictor)
     
    5678    for (uint32_t i=0; i<_param._nb_prediction; i++)
    5779      {
    58         if (_param._have_meta_predictor)
    59           {
    60         rename = " in_PREDICT_PREDICTOR_0_ACK_"          +toString(i);
    61          in_PREDICT_PREDICTOR_0_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
     80        Interface_fifo * interface = _interfaces->set_interface("predict_"+toString(i)
     81#ifdef POSITION
     82                                                                , IN 
     83                                                                , WEST
     84                                                                , "Interface Predict"
     85#endif
     86                                                                );
     87
     88        if (_param._have_meta_predictor)
     89          {
     90         in_PREDICT_PREDICTOR_0_ACK                   [i] = interface->set_signal_in  <Tcontrol_t>     ("predictor_0_ack"        , 1);
     91         in_PREDICT_PREDICTOR_1_ACK                   [i] = interface->set_signal_in  <Tcontrol_t>     ("predictor_1_ack"        , 1);
     92          }
     93         in_PREDICT_PREDICTOR_2_ACK                   [i] = interface->set_signal_in  <Tcontrol_t>     ("predictor_2_ack"        , 1);
    6294       
    63         rename = " in_PREDICT_PREDICTOR_1_ACK_"          +toString(i);
    64          in_PREDICT_PREDICTOR_1_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
    65           }
    66         rename = " in_PREDICT_PREDICTOR_2_ACK_"          +toString(i);
    67          in_PREDICT_PREDICTOR_2_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
    68        
    69         rename = "out_PREDICT_ACK_"                    +toString(i);
    70         out_PREDICT_ACK                               [i] = new SC_OUT(Tcontrol_t)     (rename.c_str());
     95        out_PREDICT_ACK                               [i] = interface->set_signal_out <Tcontrol_t>     ("ack"                    , 1);
    7196
    7297        if (_param._have_meta_predictor)
    7398          {
    7499        if (_param._predictor_0_have_bht)
    75           {
    76         rename = " in_PREDICT_PREDICTOR_0_BHT_HISTORY_"+toString(i);
    77          in_PREDICT_PREDICTOR_0_BHT_HISTORY           [i] = new SC_IN (Tbht_history_t) (rename.c_str());
    78           }
     100         in_PREDICT_PREDICTOR_0_BHT_HISTORY           [i] = interface->set_signal_in  <Tbht_history_t> ("predictor_0_bht_history", _param._predictor_0_bht_size_shifter);
    79101        if (_param._predictor_0_have_pht)
    80           {
    81         rename = " in_PREDICT_PREDICTOR_0_PHT_HISTORY_"+toString(i);
    82          in_PREDICT_PREDICTOR_0_PHT_HISTORY           [i] = new SC_IN (Tpht_history_t) (rename.c_str());
    83           }
     102         in_PREDICT_PREDICTOR_0_PHT_HISTORY           [i] = interface->set_signal_in  <Tpht_history_t> ("predictor_0_pht_history", _param._predictor_0_pht_size_counter);
    84103        if (_param._predictor_1_have_bht)
    85           {
    86         rename = " in_PREDICT_PREDICTOR_1_BHT_HISTORY_"+toString(i);
    87          in_PREDICT_PREDICTOR_1_BHT_HISTORY           [i] = new SC_IN (Tbht_history_t) (rename.c_str());
    88           }
     104         in_PREDICT_PREDICTOR_1_BHT_HISTORY           [i] = interface->set_signal_in  <Tbht_history_t> ("predictor_1_bht_history", _param._predictor_1_bht_size_shifter);
    89105        if (_param._predictor_1_have_pht)
    90           {
    91         rename = " in_PREDICT_PREDICTOR_1_PHT_HISTORY_"+toString(i);
    92          in_PREDICT_PREDICTOR_1_PHT_HISTORY           [i] = new SC_IN (Tpht_history_t) (rename.c_str());
    93           }
     106         in_PREDICT_PREDICTOR_1_PHT_HISTORY           [i] = interface->set_signal_in  <Tpht_history_t> ("predictor_1_pht_history", _param._predictor_1_pht_size_counter);
    94107          }
    95108        if (_param._predictor_2_have_bht)
    96           {
    97         rename = " in_PREDICT_PREDICTOR_2_BHT_HISTORY_"+toString(i);
    98          in_PREDICT_PREDICTOR_2_BHT_HISTORY           [i] = new SC_IN (Tbht_history_t) (rename.c_str());
    99           }
     109         in_PREDICT_PREDICTOR_2_BHT_HISTORY           [i] = interface->set_signal_in  <Tbht_history_t> ("predictor_2_bht_history", _param._predictor_2_bht_size_shifter);
    100110        if (_param._predictor_2_have_pht)
    101           {
    102         rename = " in_PREDICT_PREDICTOR_2_PHT_HISTORY_"+toString(i);
    103          in_PREDICT_PREDICTOR_2_PHT_HISTORY           [i] = new SC_IN (Tpht_history_t) (rename.c_str());
    104           }
    105         rename = "out_PREDICT_HISTORY_"                +toString(i);
    106         out_PREDICT_HISTORY                           [i] = new SC_OUT(Thistory_t)     (rename.c_str());
    107 
    108         rename = "out_PREDICT_DIRECTION_"              +toString(i);
    109         out_PREDICT_DIRECTION                         [i] = new SC_OUT(Tcontrol_t)     (rename.c_str());
    110       }
    111 
    112     // Interface Branch_complete
     111         in_PREDICT_PREDICTOR_2_PHT_HISTORY           [i] = interface->set_signal_in  <Tpht_history_t> ("predictor_2_pht_history", _param._predictor_2_pht_size_counter);
     112        out_PREDICT_HISTORY                           [i] = interface->set_signal_out <Thistory_t>     ("history"                , _param._size_history);
     113        out_PREDICT_DIRECTION                         [i] = interface->set_signal_out <Tcontrol_t>     ("direction"              , 1);
     114      }
     115
     116    // ~~~~~[ Interface : "branch_complete" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    113117   
    114118    if (_param._have_meta_predictor)
     
    145149    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
    146150      {
    147         if (_param._have_meta_predictor)
    148           {
    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 
    155         rename = " in_BRANCH_COMPLETE_PREDICTOR_0_ACK_"          +toString(i);
    156          in_BRANCH_COMPLETE_PREDICTOR_0_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
    157        
    158         rename = " in_BRANCH_COMPLETE_PREDICTOR_1_ACK_"          +toString(i);
    159          in_BRANCH_COMPLETE_PREDICTOR_1_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
    160           }
    161         rename = " in_BRANCH_COMPLETE_PREDICTOR_2_ACK_"          +toString(i);
    162          in_BRANCH_COMPLETE_PREDICTOR_2_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
    163        
    164         rename = "out_BRANCH_COMPLETE_ACK_"                    +toString(i);
    165         out_BRANCH_COMPLETE_ACK                               [i] = new SC_OUT(Tcontrol_t)     (rename.c_str());
    166 
     151        Interface_fifo * interface = _interfaces->set_interface("branch_complete_"+toString(i)
     152#ifdef POSITION
     153                                                                , IN 
     154                                                                , EAST
     155                                                                , "Interface branch complete"
     156#endif
     157                                                                );
     158
     159        if (_param._have_meta_predictor)
     160          {
     161         in_BRANCH_COMPLETE_VAL                      [i] = interface->set_signal_in  <Tcontrol_t>     ("val"            , 1);
     162        out_BRANCH_COMPLETE_PREDICTOR_2_VAL          [i] = interface->set_signal_out <Tcontrol_t>     ("predictor_2_val", 1);
     163         in_BRANCH_COMPLETE_PREDICTOR_0_ACK          [i] = interface->set_signal_in  <Tcontrol_t>     ("predictor_0_ack", 1);
     164         in_BRANCH_COMPLETE_PREDICTOR_1_ACK          [i] = interface->set_signal_in  <Tcontrol_t>     ("predictor_1_ack", 1);
     165          }
     166         in_BRANCH_COMPLETE_PREDICTOR_2_ACK          [i] = interface->set_signal_in  <Tcontrol_t>     ("predictor_2_ack" , 1);
     167        out_BRANCH_COMPLETE_ACK                      [i] = interface->set_signal_out <Tcontrol_t>     ("ack"             , 1);
    167168        if (_param._have_meta_predictor)
    168169          {
    169170        if (_param._predictor_0_have_bht)
    170           {
    171         rename = "out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY_"+toString(i);
    172         out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY           [i] = new SC_OUT(Tbht_history_t) (rename.c_str());
    173           }
     171        out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY  [i] = interface->set_signal_out <Tbht_history_t> ("predictor_0_bht_history" , _param._predictor_0_bht_size_shifter );
    174172        if (_param._predictor_0_have_pht)
    175           {
    176         rename = "out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY_"+toString(i);
    177         out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY           [i] = new SC_OUT(Tpht_history_t) (rename.c_str());
    178           }
     173        out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY  [i] = interface->set_signal_out <Tpht_history_t> ("predictor_0_pht_history" , _param._predictor_0_pht_size_counter);
    179174        if (_param._predictor_1_have_bht)
    180           {
    181         rename = "out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY_"+toString(i);
    182         out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY           [i] = new SC_OUT(Tbht_history_t) (rename.c_str());
    183           }
     175        out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY  [i] = interface->set_signal_out <Tbht_history_t> ("predictor_1_bht_history" , _param._predictor_1_bht_size_shifter );
    184176        if (_param._predictor_1_have_pht)
    185           {
    186         rename = "out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY_"+toString(i);
    187         out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY           [i] = new SC_OUT(Tpht_history_t) (rename.c_str());
    188           }
     177        out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY  [i] = interface->set_signal_out <Tpht_history_t> ("predictor_1_pht_history" , _param._predictor_1_pht_size_counter );
    189178          }
    190179        if (_param._predictor_2_have_bht)
    191           {
    192         rename = "out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY_"+toString(i);
    193         out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY           [i] = new SC_OUT(Tbht_history_t) (rename.c_str());
    194           }
     180        out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY  [i] = interface->set_signal_out <Tbht_history_t> ("predictor_2_bht_history" , _param._predictor_2_bht_size_shifter);
    195181        if (_param._predictor_2_have_pht)
    196           {
    197         rename = "out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY_"+toString(i);
    198         out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY           [i] = new SC_OUT(Tpht_history_t) (rename.c_str());
    199           }
    200         rename = " in_BRANCH_COMPLETE_HISTORY_"                +toString(i);
    201          in_BRANCH_COMPLETE_HISTORY                           [i] = new SC_IN (Thistory_t)     (rename.c_str());
    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());
     182        out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY  [i] = interface->set_signal_out <Tpht_history_t> ("predictor_2_pht_history" , _param._predictor_2_pht_size_counter);
     183         in_BRANCH_COMPLETE_HISTORY                  [i] = interface->set_signal_in  <Thistory_t>     ("history"                 , _param._size_history);
     184        if (_param._have_meta_predictor)
     185          {
     186         in_BRANCH_COMPLETE_DIRECTION                [i] = interface->set_signal_in  <Tcontrol_t>     ("direction"             , 1);
     187        out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION    [i] = interface->set_signal_out <Tcontrol_t>     ("predictor_2_direction" , 1);
    210188          }
    211189      }
    212190    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     191
     192#ifdef POSITION
     193    _component->generate_file();
     194#endif
    213195
    214196    log_printf(FUNC,Meta_Predictor_Glue,"allocation","End");
Note: See TracChangeset for help on using the changeset viewer.