[78] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 82 2008-05-01 16:48:45Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/include/Parameters.h" |
---|
[82] | 9 | #include "Common/include/Max.h" |
---|
[78] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_front_end { |
---|
| 15 | namespace front_end { |
---|
| 16 | namespace prediction_unit { |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | #undef FUNCTION |
---|
| 20 | #define FUNCTION "Prediction_unit::Parameters" |
---|
[82] | 21 | Parameters::Parameters (uint32_t nb_context , |
---|
| 22 | uint32_t nb_decod_unit , |
---|
| 23 | uint32_t size_address , |
---|
| 24 | uint32_t * nb_instruction ,//[nb_context] |
---|
| 25 | uint32_t * nb_inst_decod ,//[nb_decod_unit] |
---|
| 26 | uint32_t nb_inst_branch_predict , |
---|
| 27 | uint32_t nb_inst_branch_decod , |
---|
| 28 | uint32_t nb_inst_branch_update , |
---|
| 29 | uint32_t nb_inst_branch_complete , |
---|
| 30 | uint32_t btb_size_queue , |
---|
| 31 | uint32_t btb_associativity , |
---|
| 32 | uint32_t btb_size_counter , |
---|
| 33 | Tvictim_t btb_victim_scheme , |
---|
| 34 | Tpredictor_t dir_predictor_scheme , |
---|
| 35 | bool dir_have_bht [3], |
---|
| 36 | uint32_t dir_bht_size_shifter [3], |
---|
| 37 | uint32_t dir_bht_nb_shifter [3], |
---|
| 38 | bool dir_have_pht [3], |
---|
| 39 | uint32_t dir_pht_size_counter [3], |
---|
| 40 | uint32_t dir_pht_nb_counter [3], |
---|
| 41 | uint32_t dir_pht_size_address_share [3], |
---|
| 42 | uint32_t * ras_size_queue ,//[nb_context] |
---|
| 43 | uint32_t * upt_size_queue //[nb_context] |
---|
| 44 | ) |
---|
[78] | 45 | { |
---|
| 46 | log_printf(FUNC,Prediction_unit,FUNCTION,"Begin"); |
---|
[82] | 47 | |
---|
| 48 | _nb_context = nb_context ; |
---|
| 49 | _nb_decod_unit = nb_decod_unit ; |
---|
| 50 | _size_address = size_address ; |
---|
| 51 | _nb_instruction = nb_instruction ; |
---|
| 52 | _nb_inst_decod = nb_inst_decod ; |
---|
| 53 | _nb_inst_branch_predict = nb_inst_branch_predict ; |
---|
| 54 | _nb_inst_branch_decod = nb_inst_branch_decod ; |
---|
| 55 | _nb_inst_branch_update = nb_inst_branch_update ; |
---|
| 56 | _nb_inst_branch_complete = nb_inst_branch_complete ; |
---|
| 57 | _btb_size_queue = btb_size_queue ; |
---|
| 58 | _btb_associativity = btb_associativity ; |
---|
| 59 | _btb_size_counter = btb_size_counter ; |
---|
| 60 | _btb_victim_scheme = btb_victim_scheme ; |
---|
| 61 | _dir_predictor_scheme = dir_predictor_scheme ; |
---|
| 62 | for (uint32_t i=0; i<3; i++) |
---|
| 63 | { |
---|
| 64 | _dir_have_bht [i] = dir_have_bht [i]; |
---|
| 65 | _dir_bht_size_shifter [i] = dir_bht_size_shifter [i]; |
---|
| 66 | _dir_bht_nb_shifter [i] = dir_bht_nb_shifter [i]; |
---|
| 67 | _dir_have_pht [i] = dir_have_pht [i]; |
---|
| 68 | _dir_pht_size_counter [i] = dir_pht_size_counter [i]; |
---|
| 69 | _dir_pht_nb_counter [i] = dir_pht_nb_counter [i]; |
---|
| 70 | _dir_pht_size_address_share [i] = dir_pht_size_address_share [i]; |
---|
| 71 | } |
---|
| 72 | _ras_size_queue = ras_size_queue ; |
---|
| 73 | _upt_size_queue = upt_size_queue ; |
---|
| 74 | |
---|
| 75 | _size_context_id = log2(_nb_context); |
---|
| 76 | // public : uint32_t * _size_inst_ifetch_ptr ;//[nb_context] |
---|
| 77 | |
---|
| 78 | _size_depth = new uint32_t [_nb_context]; |
---|
| 79 | _size_ras_index = new uint32_t [_nb_context]; |
---|
| 80 | for (uint32_t i=0; i<_nb_context; i++) |
---|
| 81 | { |
---|
| 82 | _size_depth [i] = log2(_upt_size_queue [i]); |
---|
| 83 | _size_ras_index [i] = log2(_ras_size_queue [i]); |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | _max_size_depth = max<uint32_t>(_size_depth,_nb_context); |
---|
| 87 | _have_port_context_id = (_size_context_id > 0); |
---|
| 88 | _have_port_max_depth = (_max_size_depth > 0); |
---|
| 89 | // public : bool * _have_port_inst_ifetch_ptr ;//[nb_context] |
---|
| 90 | |
---|
| 91 | _param_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::prediction_unit_glue ::Parameters |
---|
| 92 | (_nb_context , |
---|
| 93 | _nb_decod_unit , |
---|
| 94 | _size_address , |
---|
| 95 | _nb_instruction , |
---|
| 96 | _size_depth , |
---|
| 97 | _nb_inst_decod , |
---|
| 98 | _nb_inst_branch_predict, |
---|
| 99 | _nb_inst_branch_decod , |
---|
| 100 | _nb_inst_branch_update ); |
---|
| 101 | |
---|
| 102 | _size_inst_ifetch_ptr = _param_glue->_size_inst_ifetch_ptr ; |
---|
| 103 | _have_port_depth = _param_glue->_have_port_depth; |
---|
| 104 | _have_port_inst_ifetch_ptr = _param_glue->_have_port_inst_ifetch_ptr; |
---|
| 105 | _have_port_history = (_size_history > 0); |
---|
| 106 | |
---|
| 107 | _param_btb = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer ::Parameters |
---|
| 108 | (_nb_context , |
---|
| 109 | _nb_instruction , |
---|
| 110 | _btb_size_queue , |
---|
| 111 | _btb_associativity , |
---|
| 112 | _size_address , |
---|
| 113 | _btb_size_counter , |
---|
| 114 | _nb_inst_branch_predict, |
---|
| 115 | _nb_inst_branch_decod , |
---|
| 116 | _nb_inst_branch_update , |
---|
| 117 | _btb_victim_scheme ); |
---|
| 118 | |
---|
| 119 | _param_dir = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction ::Parameters |
---|
| 120 | (_dir_predictor_scheme , |
---|
| 121 | _nb_inst_branch_predict , |
---|
| 122 | _nb_inst_branch_update , |
---|
| 123 | _size_address , |
---|
| 124 | _dir_have_bht , |
---|
| 125 | _dir_bht_size_shifter , |
---|
| 126 | _dir_bht_nb_shifter , |
---|
| 127 | _dir_have_pht , |
---|
| 128 | _dir_pht_size_counter , |
---|
| 129 | _dir_pht_nb_counter , |
---|
| 130 | _dir_pht_size_address_share); |
---|
| 131 | |
---|
| 132 | _size_history = _param_dir->_size_history; |
---|
| 133 | |
---|
| 134 | _param_ras = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::return_address_stack ::Parameters |
---|
| 135 | (_nb_context , |
---|
| 136 | _ras_size_queue , |
---|
| 137 | _size_address , |
---|
| 138 | _nb_inst_branch_predict, |
---|
| 139 | _nb_inst_branch_decod , |
---|
| 140 | _nb_inst_branch_update ); |
---|
| 141 | |
---|
| 142 | _param_upt = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::Parameters |
---|
| 143 | (_nb_context , |
---|
| 144 | _upt_size_queue , |
---|
| 145 | _size_address , |
---|
| 146 | _nb_inst_branch_predict , |
---|
| 147 | _nb_inst_branch_decod , |
---|
| 148 | _nb_inst_branch_complete, |
---|
| 149 | _nb_inst_branch_update , |
---|
| 150 | _size_history , |
---|
| 151 | _size_ras_index ); |
---|
| 152 | |
---|
[78] | 153 | test(); |
---|
| 154 | log_printf(FUNC,Prediction_unit,FUNCTION,"End"); |
---|
| 155 | }; |
---|
| 156 | |
---|
| 157 | // #undef FUNCTION |
---|
| 158 | // #define FUNCTION "Prediction_unit::Parameters (copy)" |
---|
| 159 | // Parameters::Parameters (Parameters & param) |
---|
| 160 | // { |
---|
| 161 | // log_printf(FUNC,Prediction_unit,FUNCTION,"Begin"); |
---|
| 162 | // test(); |
---|
| 163 | // log_printf(FUNC,Prediction_unit,FUNCTION,"End"); |
---|
| 164 | // }; |
---|
| 165 | |
---|
| 166 | #undef FUNCTION |
---|
| 167 | #define FUNCTION "Prediction_unit::~Parameters" |
---|
| 168 | Parameters::~Parameters () |
---|
| 169 | { |
---|
| 170 | log_printf(FUNC,Prediction_unit,FUNCTION,"Begin"); |
---|
[82] | 171 | |
---|
| 172 | delete _param_btb; |
---|
| 173 | delete _param_dir; |
---|
| 174 | delete _param_ras; |
---|
| 175 | delete _param_upt; |
---|
| 176 | delete _param_glue; |
---|
| 177 | |
---|
| 178 | delete [] _size_depth ; |
---|
| 179 | delete [] _size_ras_index; |
---|
| 180 | |
---|
[78] | 181 | log_printf(FUNC,Prediction_unit,FUNCTION,"End"); |
---|
| 182 | }; |
---|
| 183 | |
---|
| 184 | }; // end namespace prediction_unit |
---|
| 185 | }; // end namespace front_end |
---|
| 186 | }; // end namespace multi_front_end |
---|
| 187 | }; // end namespace core |
---|
| 188 | |
---|
| 189 | }; // end namespace behavioural |
---|
| 190 | }; // end namespace morpheo |
---|