[78] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 128 2009-06-26 08:43:23Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Parameters.h" |
---|
[111] | 9 | #include "Behavioural/include/Allocation.h" |
---|
[81] | 10 | #include "Common/include/Max.h" |
---|
[78] | 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | namespace core { |
---|
| 15 | namespace multi_front_end { |
---|
| 16 | namespace front_end { |
---|
| 17 | namespace prediction_unit { |
---|
| 18 | namespace update_prediction_table { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Update_Prediction_Table::Parameters" |
---|
[81] | 23 | Parameters::Parameters (uint32_t nb_context , |
---|
[88] | 24 | uint32_t * size_upt_queue , |
---|
| 25 | uint32_t * size_ufpt_queue , |
---|
[81] | 26 | uint32_t size_address , |
---|
| 27 | uint32_t nb_inst_predict , |
---|
| 28 | uint32_t nb_inst_decod , |
---|
| 29 | uint32_t nb_inst_branch_complete, |
---|
| 30 | uint32_t nb_inst_update , |
---|
| 31 | uint32_t size_history , |
---|
[88] | 32 | uint32_t * size_ras_index , |
---|
[111] | 33 | uint32_t nb_thread , |
---|
| 34 | uint32_t * translate_num_context_to_num_thread ,//[nb_context] |
---|
[88] | 35 | bool is_toplevel): |
---|
[122] | 36 | _always_accurate_predict (false), |
---|
| 37 | _always_accurate_decod (false), |
---|
| 38 | _can_accurate_predict (true ), |
---|
| 39 | _can_accurate_decod (true ) |
---|
[78] | 40 | { |
---|
| 41 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
[81] | 42 | |
---|
| 43 | _nb_context = nb_context ; |
---|
[88] | 44 | _size_upt_queue = size_upt_queue ; |
---|
| 45 | _size_ufpt_queue = size_ufpt_queue ; |
---|
| 46 | // _size_address = size_address ; |
---|
[81] | 47 | _nb_inst_predict = nb_inst_predict ; |
---|
| 48 | _nb_inst_decod = nb_inst_decod ; |
---|
| 49 | _nb_inst_branch_complete = nb_inst_branch_complete; |
---|
| 50 | _nb_inst_update = nb_inst_update ; |
---|
| 51 | _size_history = size_history ; |
---|
| 52 | _size_ras_index = size_ras_index ; |
---|
[111] | 53 | _nb_thread = nb_thread ; |
---|
| 54 | _translate_num_context_to_num_thread = translate_num_context_to_num_thread; |
---|
[81] | 55 | |
---|
| 56 | _max_size_ras_index = max<uint32_t>(_size_ras_index,nb_context); |
---|
| 57 | |
---|
| 58 | _have_port_history = _size_history > 0; |
---|
[88] | 59 | |
---|
| 60 | test(); |
---|
| 61 | |
---|
[111] | 62 | ALLOC1(_have_thread,bool,_nb_thread); |
---|
| 63 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
| 64 | _have_thread[i] = false; |
---|
[128] | 65 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
[111] | 66 | _have_thread[_translate_num_context_to_num_thread [i]] = true; |
---|
| 67 | |
---|
[88] | 68 | if (is_toplevel) |
---|
| 69 | { |
---|
| 70 | _size_instruction_address = size_address; |
---|
| 71 | _size_context_id = log2(nb_context); |
---|
| 72 | _size_depth = log2(max<uint32_t>(_size_upt_queue,_nb_context)); |
---|
| 73 | |
---|
| 74 | _have_port_context_id = _size_context_id> 0; |
---|
| 75 | _have_port_depth = _size_depth > 0; |
---|
| 76 | |
---|
| 77 | copy (); |
---|
| 78 | } |
---|
[81] | 79 | |
---|
[78] | 80 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 81 | }; |
---|
| 82 | |
---|
| 83 | // #undef FUNCTION |
---|
| 84 | // #define FUNCTION "Update_Prediction_Table::Parameters (copy)" |
---|
| 85 | // Parameters::Parameters (Parameters & param) |
---|
| 86 | // { |
---|
| 87 | // log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
| 88 | // test(); |
---|
| 89 | // log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 90 | // }; |
---|
| 91 | |
---|
| 92 | #undef FUNCTION |
---|
| 93 | #define FUNCTION "Update_Prediction_Table::~Parameters" |
---|
| 94 | Parameters::~Parameters () |
---|
| 95 | { |
---|
| 96 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
[111] | 97 | DELETE1(_have_thread ,_nb_thread); |
---|
[88] | 98 | // delete [] _size_depth ; |
---|
| 99 | // delete [] _have_port_depth; |
---|
[78] | 100 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 101 | }; |
---|
| 102 | |
---|
[88] | 103 | #undef FUNCTION |
---|
| 104 | #define FUNCTION "Update_Prediction_Table::copy" |
---|
| 105 | void Parameters::copy (void) |
---|
| 106 | { |
---|
| 107 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
| 108 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 109 | }; |
---|
| 110 | |
---|
[78] | 111 | }; // end namespace update_prediction_table |
---|
| 112 | }; // end namespace prediction_unit |
---|
| 113 | }; // end namespace front_end |
---|
| 114 | }; // end namespace multi_front_end |
---|
| 115 | }; // end namespace core |
---|
| 116 | |
---|
| 117 | }; // end namespace behavioural |
---|
| 118 | }; // end namespace morpheo |
---|