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