[78] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 88 2008-12-10 18:31:39Z 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 , |
---|
[88] | 31 | Tvictim_t victim_scheme , |
---|
| 32 | bool is_toplevel) |
---|
[78] | 33 | { |
---|
| 34 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"Begin"); |
---|
| 35 | |
---|
| 36 | _nb_context = nb_context ; |
---|
| 37 | _nb_instruction = nb_instruction ; |
---|
| 38 | _size_buffer = size_buffer ; |
---|
| 39 | _associativity = associativity ; |
---|
| 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_victim = log2(associativity); |
---|
| 48 | |
---|
| 49 | _have_component_victim = (_size_victim > 0); |
---|
| 50 | _is_full_associative = _size_bank == 1; |
---|
| 51 | uint32_t nb_access = nb_inst_predict + nb_inst_decod + nb_inst_update; |
---|
| 52 | |
---|
[88] | 53 | test(); |
---|
| 54 | |
---|
[78] | 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 , |
---|
[88] | 80 | size_address , |
---|
[78] | 81 | _nb_inst_predict , |
---|
| 82 | _nb_inst_decod , |
---|
| 83 | _nb_inst_update ); |
---|
[88] | 84 | |
---|
[78] | 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 , |
---|
[88] | 90 | size_address , |
---|
[78] | 91 | _size_counter , |
---|
| 92 | _nb_inst_predict, |
---|
| 93 | _nb_inst_decod , |
---|
| 94 | _nb_inst_update ); |
---|
| 95 | |
---|
[88] | 96 | if (is_toplevel) |
---|
| 97 | { |
---|
| 98 | _size_instruction_address = size_address ; |
---|
| 99 | _size_context_id = log2(nb_context); |
---|
| 100 | _have_port_context_id = (_size_context_id > 0); |
---|
| 101 | |
---|
| 102 | copy (); |
---|
| 103 | } |
---|
| 104 | |
---|
[78] | 105 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"End"); |
---|
| 106 | }; |
---|
| 107 | |
---|
| 108 | // #undef FUNCTION |
---|
| 109 | // #define FUNCTION "Branch_Target_Buffer::Parameters (copy)" |
---|
| 110 | // Parameters::Parameters (Parameters & param) |
---|
| 111 | // { |
---|
| 112 | // log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"Begin"); |
---|
| 113 | // test(); |
---|
| 114 | // log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"End"); |
---|
| 115 | // }; |
---|
| 116 | |
---|
| 117 | #undef FUNCTION |
---|
| 118 | #define FUNCTION "Branch_Target_Buffer::~Parameters" |
---|
| 119 | Parameters::~Parameters () |
---|
| 120 | { |
---|
| 121 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"Begin"); |
---|
| 122 | |
---|
| 123 | if (_have_component_victim) |
---|
| 124 | { |
---|
| 125 | delete _param_sort; |
---|
| 126 | delete _param_victim; |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | delete _param_branch_target_buffer_glue; |
---|
| 130 | delete _param_branch_target_buffer_register; |
---|
| 131 | |
---|
| 132 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"End"); |
---|
| 133 | }; |
---|
| 134 | |
---|
[88] | 135 | |
---|
| 136 | #undef FUNCTION |
---|
| 137 | #define FUNCTION "Branch_Target_Buffer::copy" |
---|
| 138 | void Parameters::copy (void) |
---|
| 139 | { |
---|
| 140 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"Begin"); |
---|
| 141 | |
---|
| 142 | if (_have_component_victim) |
---|
| 143 | { |
---|
| 144 | COPY(_param_sort); |
---|
| 145 | COPY(_param_victim); |
---|
| 146 | } |
---|
| 147 | COPY(_param_branch_target_buffer_glue); |
---|
| 148 | COPY(_param_branch_target_buffer_register); |
---|
| 149 | |
---|
| 150 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"End"); |
---|
| 151 | }; |
---|
| 152 | |
---|
| 153 | |
---|
[78] | 154 | }; // end namespace branch_target_buffer |
---|
| 155 | }; // end namespace prediction_unit |
---|
| 156 | }; // end namespace front_end |
---|
| 157 | }; // end namespace multi_front_end |
---|
| 158 | }; // end namespace core |
---|
| 159 | |
---|
| 160 | }; // end namespace behavioural |
---|
| 161 | }; // end namespace morpheo |
---|