[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/Update_Prediction_Table/include/Parameters.h" |
---|
[81] | 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 | namespace update_prediction_table { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Update_Prediction_Table::Parameters" |
---|
[81] | 22 | Parameters::Parameters (uint32_t nb_context , |
---|
| 23 | uint32_t * size_queue , |
---|
| 24 | uint32_t size_address , |
---|
| 25 | uint32_t nb_inst_predict , |
---|
| 26 | uint32_t nb_inst_decod , |
---|
| 27 | uint32_t nb_inst_branch_complete, |
---|
| 28 | uint32_t nb_inst_update , |
---|
| 29 | uint32_t size_history , |
---|
| 30 | uint32_t * size_ras_index ) |
---|
[78] | 31 | { |
---|
| 32 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
[81] | 33 | |
---|
| 34 | _nb_context = nb_context ; |
---|
| 35 | _size_queue = size_queue ; |
---|
| 36 | _size_address = size_address ; |
---|
| 37 | _nb_inst_predict = nb_inst_predict ; |
---|
| 38 | _nb_inst_decod = nb_inst_decod ; |
---|
| 39 | _nb_inst_branch_complete = nb_inst_branch_complete; |
---|
| 40 | _nb_inst_update = nb_inst_update ; |
---|
| 41 | _size_history = size_history ; |
---|
| 42 | _size_ras_index = size_ras_index ; |
---|
| 43 | |
---|
| 44 | _size_context_id = log2(nb_context); |
---|
[82] | 45 | _size_depth = new uint32_t[_nb_context]; |
---|
| 46 | _have_port_depth = new bool [_nb_context]; |
---|
| 47 | for (uint32_t i=0; i<_nb_context; i++) |
---|
| 48 | { |
---|
| 49 | _size_depth [i] = log2(_size_queue[i]); |
---|
| 50 | _have_port_depth [i] = (_size_depth [i] > 0); |
---|
| 51 | } |
---|
| 52 | _max_size_depth = max<uint32_t>(_size_depth,_nb_context); |
---|
[81] | 53 | _max_size_ras_index = max<uint32_t>(_size_ras_index,nb_context); |
---|
| 54 | |
---|
| 55 | _have_port_context_id = _size_context_id> 0; |
---|
[82] | 56 | _have_port_max_depth = _max_size_depth > 0; |
---|
[81] | 57 | _have_port_history = _size_history > 0; |
---|
| 58 | |
---|
[78] | 59 | test(); |
---|
| 60 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 61 | }; |
---|
| 62 | |
---|
| 63 | // #undef FUNCTION |
---|
| 64 | // #define FUNCTION "Update_Prediction_Table::Parameters (copy)" |
---|
| 65 | // Parameters::Parameters (Parameters & param) |
---|
| 66 | // { |
---|
| 67 | // log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
| 68 | // test(); |
---|
| 69 | // log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 70 | // }; |
---|
| 71 | |
---|
| 72 | #undef FUNCTION |
---|
| 73 | #define FUNCTION "Update_Prediction_Table::~Parameters" |
---|
| 74 | Parameters::~Parameters () |
---|
| 75 | { |
---|
| 76 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
[82] | 77 | delete [] _size_depth ; |
---|
| 78 | delete [] _have_port_depth; |
---|
[78] | 79 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 80 | }; |
---|
| 81 | |
---|
| 82 | }; // end namespace update_prediction_table |
---|
| 83 | }; // end namespace prediction_unit |
---|
| 84 | }; // end namespace front_end |
---|
| 85 | }; // end namespace multi_front_end |
---|
| 86 | }; // end namespace core |
---|
| 87 | |
---|
| 88 | }; // end namespace behavioural |
---|
| 89 | }; // end namespace morpheo |
---|