[78] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 111 2009-02-27 18:37:40Z 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): |
---|
| 36 | _not_accurate_block_predict (false) |
---|
[78] | 37 | { |
---|
| 38 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
[81] | 39 | |
---|
| 40 | _nb_context = nb_context ; |
---|
[88] | 41 | _size_upt_queue = size_upt_queue ; |
---|
| 42 | _size_ufpt_queue = size_ufpt_queue ; |
---|
| 43 | // _size_address = size_address ; |
---|
[81] | 44 | _nb_inst_predict = nb_inst_predict ; |
---|
| 45 | _nb_inst_decod = nb_inst_decod ; |
---|
| 46 | _nb_inst_branch_complete = nb_inst_branch_complete; |
---|
| 47 | _nb_inst_update = nb_inst_update ; |
---|
| 48 | _size_history = size_history ; |
---|
| 49 | _size_ras_index = size_ras_index ; |
---|
[111] | 50 | _nb_thread = nb_thread ; |
---|
| 51 | _translate_num_context_to_num_thread = translate_num_context_to_num_thread; |
---|
[81] | 52 | |
---|
| 53 | _max_size_ras_index = max<uint32_t>(_size_ras_index,nb_context); |
---|
| 54 | |
---|
| 55 | _have_port_history = _size_history > 0; |
---|
[88] | 56 | |
---|
| 57 | test(); |
---|
| 58 | |
---|
[111] | 59 | ALLOC1(_have_thread,bool,_nb_thread); |
---|
| 60 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
| 61 | _have_thread[i] = false; |
---|
| 62 | for (uint32_t i=0; i<_nb_context; i++) |
---|
| 63 | _have_thread[_translate_num_context_to_num_thread [i]] = true; |
---|
| 64 | |
---|
[88] | 65 | if (is_toplevel) |
---|
| 66 | { |
---|
| 67 | _size_instruction_address = size_address; |
---|
| 68 | _size_context_id = log2(nb_context); |
---|
| 69 | _size_depth = log2(max<uint32_t>(_size_upt_queue,_nb_context)); |
---|
| 70 | |
---|
| 71 | _have_port_context_id = _size_context_id> 0; |
---|
| 72 | _have_port_depth = _size_depth > 0; |
---|
| 73 | |
---|
| 74 | copy (); |
---|
| 75 | } |
---|
[81] | 76 | |
---|
[78] | 77 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 78 | }; |
---|
| 79 | |
---|
| 80 | // #undef FUNCTION |
---|
| 81 | // #define FUNCTION "Update_Prediction_Table::Parameters (copy)" |
---|
| 82 | // Parameters::Parameters (Parameters & param) |
---|
| 83 | // { |
---|
| 84 | // log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
| 85 | // test(); |
---|
| 86 | // log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 87 | // }; |
---|
| 88 | |
---|
| 89 | #undef FUNCTION |
---|
| 90 | #define FUNCTION "Update_Prediction_Table::~Parameters" |
---|
| 91 | Parameters::~Parameters () |
---|
| 92 | { |
---|
| 93 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
[111] | 94 | DELETE1(_have_thread ,_nb_thread); |
---|
[88] | 95 | // delete [] _size_depth ; |
---|
| 96 | // delete [] _have_port_depth; |
---|
[78] | 97 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 98 | }; |
---|
| 99 | |
---|
[88] | 100 | #undef FUNCTION |
---|
| 101 | #define FUNCTION "Update_Prediction_Table::copy" |
---|
| 102 | void Parameters::copy (void) |
---|
| 103 | { |
---|
| 104 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
| 105 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 106 | }; |
---|
| 107 | |
---|
[78] | 108 | }; // end namespace update_prediction_table |
---|
| 109 | }; // end namespace prediction_unit |
---|
| 110 | }; // end namespace front_end |
---|
| 111 | }; // end namespace multi_front_end |
---|
| 112 | }; // end namespace core |
---|
| 113 | |
---|
| 114 | }; // end namespace behavioural |
---|
| 115 | }; // end namespace morpheo |
---|