[2] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
[48] | 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h" |
---|
[2] | 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
[48] | 12 | namespace core { |
---|
| 13 | namespace multi_front_end { |
---|
| 14 | namespace front_end { |
---|
| 15 | namespace prediction_unit { |
---|
| 16 | namespace direction { |
---|
| 17 | |
---|
[2] | 18 | namespace meta_predictor { |
---|
| 19 | namespace two_level_branch_predictor { |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | Parameters::Parameters (bool have_bht , |
---|
| 23 | uint32_t bht_size_shifter , |
---|
| 24 | uint32_t bht_nb_shifter , |
---|
| 25 | bool have_pht , |
---|
| 26 | uint32_t pht_size_counter , |
---|
| 27 | uint32_t pht_nb_counter , |
---|
| 28 | uint32_t pht_size_address_share, |
---|
| 29 | uint32_t size_address , |
---|
| 30 | uint32_t nb_prediction , |
---|
| 31 | uint32_t nb_branch_complete ) : |
---|
| 32 | _have_bht (have_bht ), |
---|
| 33 | _bht_size_shifter ((_have_bht == true)?bht_size_shifter:0), |
---|
| 34 | _bht_nb_shifter ((_have_bht == true)?bht_nb_shifter :0), |
---|
| 35 | _have_pht (have_pht ), |
---|
| 36 | _pht_size_counter ((_have_pht == true)?pht_size_counter:0), |
---|
| 37 | _pht_nb_counter ((_have_pht == true)?pht_nb_counter :0), |
---|
[3] | 38 | _pht_size_address_share (((_have_bht and _have_pht) == true)?pht_size_address_share:0), |
---|
[2] | 39 | _size_address (size_address ), |
---|
| 40 | _nb_prediction (nb_prediction ), |
---|
| 41 | _nb_branch_complete (nb_branch_complete), |
---|
| 42 | _bht_size_address (static_cast<uint32_t>(ceil(log2(bht_nb_shifter)))), |
---|
| 43 | _pht_size_address (static_cast<uint32_t>(ceil(log2(pht_nb_counter)))) |
---|
| 44 | { |
---|
| 45 | log_printf(FUNC,Two_Level_Branch_Predictor,"Parameters","Begin"); |
---|
| 46 | |
---|
[3] | 47 | if (_have_bht) |
---|
[48] | 48 | _param_branch_history_table = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::branch_history_table ::Parameters (_bht_size_shifter , |
---|
[2] | 49 | _bht_nb_shifter , |
---|
| 50 | _nb_prediction , |
---|
| 51 | _nb_branch_complete); |
---|
[3] | 52 | if (_have_pht) |
---|
[48] | 53 | _param_pattern_history_table = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::pattern_history_table::Parameters (_pht_size_counter , |
---|
[2] | 54 | _pht_nb_counter , |
---|
| 55 | _nb_prediction , |
---|
| 56 | _nb_branch_complete); |
---|
| 57 | |
---|
| 58 | |
---|
[48] | 59 | _param_two_level_branch_predictor_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::two_level_branch_predictor_glue::Parameters (_have_bht , |
---|
[2] | 60 | _bht_size_shifter , |
---|
| 61 | _bht_size_address , |
---|
| 62 | _have_pht , |
---|
| 63 | _pht_size_address , |
---|
| 64 | _pht_size_address_share, |
---|
| 65 | _size_address , |
---|
| 66 | _nb_prediction , |
---|
| 67 | _nb_branch_complete ); |
---|
| 68 | |
---|
| 69 | test(); |
---|
| 70 | log_printf(FUNC,Two_Level_Branch_Predictor,"Parameters","End"); |
---|
| 71 | }; |
---|
| 72 | |
---|
| 73 | Parameters::Parameters (Parameters & param) : |
---|
| 74 | _have_bht (param._have_bht ), |
---|
| 75 | _bht_size_shifter (param._bht_size_shifter ), |
---|
| 76 | _bht_nb_shifter (param._bht_nb_shifter ), |
---|
| 77 | _have_pht (param._have_pht ), |
---|
| 78 | _pht_size_counter (param._pht_size_counter ), |
---|
| 79 | _pht_nb_counter (param._pht_nb_counter ), |
---|
| 80 | _pht_size_address_share (param._pht_size_address_share), |
---|
| 81 | _size_address (param._size_address ), |
---|
| 82 | _nb_prediction (param._nb_prediction ), |
---|
| 83 | _nb_branch_complete (param._nb_branch_complete ), |
---|
| 84 | _bht_size_address (param._bht_size_address ), |
---|
| 85 | _pht_size_address (param._pht_size_address ) |
---|
| 86 | |
---|
| 87 | { |
---|
| 88 | log_printf(FUNC,Two_Level_Branch_Predictor,"Parameters","Begin"); |
---|
| 89 | |
---|
[3] | 90 | if (_have_bht) |
---|
[48] | 91 | _param_branch_history_table = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::branch_history_table ::Parameters (_bht_size_shifter , |
---|
[2] | 92 | _bht_nb_shifter , |
---|
| 93 | _nb_prediction , |
---|
| 94 | _nb_branch_complete); |
---|
[3] | 95 | if (_have_pht) |
---|
[48] | 96 | _param_pattern_history_table = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::pattern_history_table::Parameters (_pht_size_counter , |
---|
[2] | 97 | _pht_nb_counter , |
---|
| 98 | _nb_prediction , |
---|
| 99 | _nb_branch_complete); |
---|
| 100 | |
---|
[48] | 101 | _param_two_level_branch_predictor_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::two_level_branch_predictor_glue::Parameters (_have_bht , |
---|
[2] | 102 | _bht_size_shifter , |
---|
| 103 | _bht_size_address , |
---|
| 104 | _have_pht , |
---|
| 105 | _pht_size_address , |
---|
| 106 | _pht_size_address_share, |
---|
| 107 | _size_address , |
---|
| 108 | _nb_prediction , |
---|
| 109 | _nb_branch_complete ); |
---|
| 110 | |
---|
| 111 | test(); |
---|
| 112 | log_printf(FUNC,Two_Level_Branch_Predictor,"Parameters","End"); |
---|
| 113 | }; |
---|
| 114 | |
---|
| 115 | Parameters::~Parameters () |
---|
| 116 | { |
---|
| 117 | log_printf(FUNC,Two_Level_Branch_Predictor,"~Parameters","Begin"); |
---|
| 118 | |
---|
[3] | 119 | if (_have_bht) |
---|
[2] | 120 | delete _param_branch_history_table; |
---|
[3] | 121 | if (_have_pht) |
---|
[2] | 122 | delete _param_pattern_history_table; |
---|
| 123 | delete _param_two_level_branch_predictor_glue; |
---|
| 124 | log_printf(FUNC,Two_Level_Branch_Predictor,"~Parameters","End"); |
---|
| 125 | }; |
---|
| 126 | |
---|
| 127 | }; // end namespace two_level_branch_predictor |
---|
| 128 | }; // end namespace meta_predictor |
---|
| 129 | |
---|
[48] | 130 | }; // end namespace core |
---|
| 131 | }; // end namespace multi_front_end |
---|
| 132 | }; // end namespace front_end |
---|
| 133 | }; // end namespace prediction_unit |
---|
| 134 | }; // end namespace direction |
---|
| 135 | |
---|
| 136 | |
---|
[2] | 137 | }; // end namespace behavioural |
---|
| 138 | }; // end namespace morpheo |
---|