[78] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/include/Parameters.h" |
---|
| 9 | #include "Common/include/Max.h" |
---|
| 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 branch_target_buffer { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Branch_Target_Buffer::Parameters" |
---|
| 22 | Parameters::Parameters (uint32_t nb_context , |
---|
| 23 | uint32_t * nb_instruction , |
---|
| 24 | uint32_t size_buffer , |
---|
| 25 | uint32_t associativity , |
---|
| 26 | uint32_t size_address , |
---|
| 27 | uint32_t size_counter , |
---|
| 28 | uint32_t nb_inst_predict, |
---|
| 29 | uint32_t nb_inst_decod , |
---|
| 30 | uint32_t nb_inst_update , |
---|
| 31 | Tvictim_t victim_scheme ) |
---|
| 32 | { |
---|
| 33 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"Begin"); |
---|
| 34 | |
---|
| 35 | _nb_context = nb_context ; |
---|
| 36 | _nb_instruction = nb_instruction ; |
---|
| 37 | _size_buffer = size_buffer ; |
---|
| 38 | _associativity = associativity ; |
---|
| 39 | _size_address = size_address ; |
---|
| 40 | _size_counter = size_counter ; |
---|
| 41 | _nb_inst_predict = nb_inst_predict; |
---|
| 42 | _nb_inst_decod = nb_inst_decod ; |
---|
| 43 | _nb_inst_update = nb_inst_update ; |
---|
| 44 | _victim_scheme = victim_scheme ; |
---|
| 45 | |
---|
| 46 | _size_bank = size_buffer/associativity; |
---|
| 47 | _size_context_id = log2(nb_context); |
---|
| 48 | _size_victim = log2(associativity); |
---|
| 49 | |
---|
| 50 | _have_port_context_id = (_size_context_id > 0); |
---|
| 51 | _have_component_victim = (_size_victim > 0); |
---|
| 52 | _is_full_associative = _size_bank == 1; |
---|
| 53 | uint32_t nb_access = nb_inst_predict + nb_inst_decod + nb_inst_update; |
---|
| 54 | |
---|
| 55 | if (_have_component_victim) |
---|
| 56 | { |
---|
| 57 | _param_sort = new morpheo::behavioural::generic::sort::Parameters |
---|
| 58 | (_associativity, // nb_input |
---|
| 59 | 1 , // nb_output |
---|
| 60 | true , // ascending |
---|
| 61 | _size_victim , // size_data |
---|
| 62 | true , // have_port_index_out |
---|
| 63 | false // have_port_data_out |
---|
| 64 | ); |
---|
| 65 | |
---|
| 66 | _param_victim = new morpheo::behavioural::generic::victim::Parameters |
---|
| 67 | (_victim_scheme, //victim_scheme |
---|
| 68 | _associativity, //nb_entity |
---|
| 69 | _size_bank , //nb_entry |
---|
| 70 | nb_access , //nb_access |
---|
| 71 | false //table_global |
---|
| 72 | ); |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | _param_branch_target_buffer_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::branch_target_buffer_glue::Parameters |
---|
| 76 | ( |
---|
| 77 | max<uint32_t>(_nb_instruction, _nb_context), |
---|
| 78 | _size_buffer , |
---|
| 79 | _associativity , |
---|
| 80 | _size_address , |
---|
| 81 | _nb_inst_predict , |
---|
| 82 | _nb_inst_decod , |
---|
| 83 | _nb_inst_update ); |
---|
| 84 | |
---|
| 85 | _param_branch_target_buffer_register = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::branch_target_buffer_register::Parameters |
---|
| 86 | (_nb_context , |
---|
| 87 | _nb_instruction , |
---|
| 88 | _size_buffer , |
---|
| 89 | _associativity , |
---|
| 90 | _size_address , |
---|
| 91 | _size_counter , |
---|
| 92 | _nb_inst_predict, |
---|
| 93 | _nb_inst_decod , |
---|
| 94 | _nb_inst_update ); |
---|
| 95 | |
---|
| 96 | test(); |
---|
| 97 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"End"); |
---|
| 98 | }; |
---|
| 99 | |
---|
| 100 | // #undef FUNCTION |
---|
| 101 | // #define FUNCTION "Branch_Target_Buffer::Parameters (copy)" |
---|
| 102 | // Parameters::Parameters (Parameters & param) |
---|
| 103 | // { |
---|
| 104 | // log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"Begin"); |
---|
| 105 | // test(); |
---|
| 106 | // log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"End"); |
---|
| 107 | // }; |
---|
| 108 | |
---|
| 109 | #undef FUNCTION |
---|
| 110 | #define FUNCTION "Branch_Target_Buffer::~Parameters" |
---|
| 111 | Parameters::~Parameters () |
---|
| 112 | { |
---|
| 113 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"Begin"); |
---|
| 114 | |
---|
| 115 | if (_have_component_victim) |
---|
| 116 | { |
---|
| 117 | delete _param_sort; |
---|
| 118 | delete _param_victim; |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | delete _param_branch_target_buffer_glue; |
---|
| 122 | delete _param_branch_target_buffer_register; |
---|
| 123 | |
---|
| 124 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"End"); |
---|
| 125 | }; |
---|
| 126 | |
---|
| 127 | }; // end namespace branch_target_buffer |
---|
| 128 | }; // end namespace prediction_unit |
---|
| 129 | }; // end namespace front_end |
---|
| 130 | }; // end namespace multi_front_end |
---|
| 131 | }; // end namespace core |
---|
| 132 | |
---|
| 133 | }; // end namespace behavioural |
---|
| 134 | }; // end namespace morpheo |
---|