[78] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 98 2008-12-31 10:18:08Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/Branch_Target_Buffer_Glue/include/Parameters.h" |
---|
| 9 | #include "Common/include/BitManipulation.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 | namespace branch_target_buffer_glue { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Branch_Target_Buffer_Glue::Parameters" |
---|
| 23 | Parameters::Parameters (uint32_t max_nb_instruction, |
---|
| 24 | uint32_t size_buffer , |
---|
| 25 | uint32_t associativity , |
---|
| 26 | uint32_t size_address , |
---|
| 27 | uint32_t nb_inst_predict , |
---|
| 28 | uint32_t nb_inst_decod , |
---|
[88] | 29 | uint32_t nb_inst_update , |
---|
| 30 | bool is_toplevel) |
---|
[78] | 31 | { |
---|
| 32 | log_printf(FUNC,Branch_Target_Buffer_Glue,FUNCTION,"Begin"); |
---|
| 33 | |
---|
| 34 | _max_nb_instruction = max_nb_instruction; |
---|
| 35 | _size_buffer = size_buffer ; |
---|
| 36 | _associativity = associativity ; |
---|
[88] | 37 | // _size_address = size_address ; |
---|
[78] | 38 | _nb_inst_predict = nb_inst_predict ; |
---|
| 39 | _nb_inst_decod = nb_inst_decod ; |
---|
| 40 | _nb_inst_update = nb_inst_update ; |
---|
| 41 | |
---|
| 42 | _size_bank = size_buffer/associativity; |
---|
| 43 | _size_victim = log2(associativity); |
---|
| 44 | _size_victim_address = log2(_size_bank); |
---|
| 45 | |
---|
| 46 | _have_port_victim = (_size_victim > 0); |
---|
| 47 | _is_full_associative = _size_bank == 1; |
---|
| 48 | |
---|
| 49 | _mask_bank = gen_mask<Tgeneral_data_t> (_size_victim_address); |
---|
[98] | 50 | _shift_bank = log2(max_nb_instruction); |
---|
[78] | 51 | |
---|
| 52 | test(); |
---|
[88] | 53 | |
---|
| 54 | if (is_toplevel) |
---|
| 55 | { |
---|
| 56 | _size_instruction_address = size_address; |
---|
| 57 | |
---|
| 58 | copy(); |
---|
| 59 | } |
---|
| 60 | |
---|
[78] | 61 | log_printf(FUNC,Branch_Target_Buffer_Glue,FUNCTION,"End"); |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | // #undef FUNCTION |
---|
| 65 | // #define FUNCTION "Branch_Target_Buffer_Glue::Parameters (copy)" |
---|
| 66 | // Parameters::Parameters (Parameters & param) |
---|
| 67 | // { |
---|
| 68 | // log_printf(FUNC,Branch_Target_Buffer_Glue,FUNCTION,"Begin"); |
---|
| 69 | // test(); |
---|
| 70 | // log_printf(FUNC,Branch_Target_Buffer_Glue,FUNCTION,"End"); |
---|
| 71 | // }; |
---|
| 72 | |
---|
| 73 | #undef FUNCTION |
---|
| 74 | #define FUNCTION "Branch_Target_Buffer_Glue::~Parameters" |
---|
| 75 | Parameters::~Parameters () |
---|
| 76 | { |
---|
| 77 | log_printf(FUNC,Branch_Target_Buffer_Glue,FUNCTION,"Begin"); |
---|
| 78 | log_printf(FUNC,Branch_Target_Buffer_Glue,FUNCTION,"End"); |
---|
| 79 | }; |
---|
| 80 | |
---|
[88] | 81 | #undef FUNCTION |
---|
| 82 | #define FUNCTION "Branch_Target_Buffer_Glue::copy" |
---|
| 83 | void Parameters::copy (void) |
---|
| 84 | { |
---|
| 85 | log_printf(FUNC,Branch_Target_Buffer_Glue,FUNCTION,"Begin"); |
---|
| 86 | log_printf(FUNC,Branch_Target_Buffer_Glue,FUNCTION,"End"); |
---|
| 87 | }; |
---|
| 88 | |
---|
[78] | 89 | }; // end namespace branch_target_buffer_glue |
---|
| 90 | }; // end namespace branch_target_buffer |
---|
| 91 | }; // end namespace prediction_unit |
---|
| 92 | }; // end namespace front_end |
---|
| 93 | }; // end namespace multi_front_end |
---|
| 94 | }; // end namespace core |
---|
| 95 | |
---|
| 96 | }; // end namespace behavioural |
---|
| 97 | }; // end namespace morpheo |
---|