[88] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 145 2010-10-13 18:15:51Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Parameters.h" |
---|
[110] | 9 | #include "Behavioural/include/Allocation.h" |
---|
[88] | 10 | #include "Common/include/Max.h" |
---|
| 11 | #include "Common/include/BitManipulation.h" |
---|
| 12 | |
---|
| 13 | namespace morpheo { |
---|
| 14 | namespace behavioural { |
---|
| 15 | namespace core { |
---|
| 16 | namespace multi_ooo_engine { |
---|
| 17 | namespace ooo_engine { |
---|
| 18 | namespace commit_unit { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Commit_unit::Parameters" |
---|
[145] | 23 | Parameters::Parameters (uint32_t nb_front_end , |
---|
| 24 | uint32_t * nb_context ,//[nb_front_end] |
---|
| 25 | uint32_t nb_rename_unit , |
---|
| 26 | uint32_t size_queue , |
---|
| 27 | uint32_t nb_bank , |
---|
| 28 | Tretire_ooo_scheme_t retire_ooo_scheme , |
---|
| 29 | uint32_t * nb_inst_insert ,//[nb_rename_unit] |
---|
| 30 | uint32_t * nb_inst_retire ,//[nb_rename_unit] |
---|
| 31 | uint32_t nb_inst_commit , |
---|
| 32 | uint32_t nb_inst_reexecute , |
---|
| 33 | uint32_t nb_inst_branch_complete , |
---|
| 34 | uint32_t ** nb_branch_speculated ,//[nb_front_end][nb_context] |
---|
| 35 | uint32_t size_nb_inst_decod , |
---|
| 36 | uint32_t size_general_data , |
---|
| 37 | uint32_t size_store_queue_ptr , |
---|
| 38 | uint32_t size_load_queue_ptr , |
---|
| 39 | uint32_t size_general_register , |
---|
| 40 | uint32_t size_special_register , |
---|
| 41 | Trat_scheme_t * rat_scheme ,//[nb_rename_unit] |
---|
| 42 | std::vector<uint32_t>* link_front_end_with_rename_unit ,//[nb_rename_unit] |
---|
| 43 | Tpriority_t priority , |
---|
| 44 | Tload_balancing_t load_balancing , |
---|
| 45 | uint32_t nb_rename_unit_select , |
---|
| 46 | uint32_t nb_thread , |
---|
| 47 | uint32_t ** translate_num_context_to_num_thread,//[nb_front_end][nb_context] |
---|
| 48 | bool is_toplevel): |
---|
[138] | 49 | _nb_bank_access_commit (1 ) |
---|
[88] | 50 | { |
---|
| 51 | log_begin(Commit_unit,FUNCTION); |
---|
| 52 | |
---|
[110] | 53 | _nb_front_end = nb_front_end ; |
---|
| 54 | _nb_context = nb_context ; |
---|
| 55 | _nb_rename_unit = nb_rename_unit ; |
---|
| 56 | _size_queue = size_queue ; |
---|
| 57 | _nb_bank = nb_bank ; |
---|
[138] | 58 | _retire_ooo_scheme = retire_ooo_scheme ; |
---|
[110] | 59 | _nb_inst_insert = nb_inst_insert ; |
---|
| 60 | _nb_inst_retire = nb_inst_retire ; |
---|
| 61 | _nb_inst_commit = nb_inst_commit ; |
---|
| 62 | _nb_inst_reexecute = nb_inst_reexecute ; |
---|
| 63 | _nb_inst_branch_complete = nb_inst_branch_complete ; |
---|
| 64 | _nb_branch_speculated = nb_branch_speculated ; |
---|
[139] | 65 | _rat_scheme = rat_scheme ; |
---|
[145] | 66 | _link_front_end_with_rename_unit = link_front_end_with_rename_unit ; |
---|
[110] | 67 | _priority = priority ; |
---|
| 68 | _load_balancing = load_balancing ; |
---|
| 69 | _nb_rename_unit_select = nb_rename_unit_select ; |
---|
| 70 | _nb_thread = nb_thread ; |
---|
| 71 | _translate_num_context_to_num_thread = translate_num_context_to_num_thread; |
---|
[88] | 72 | |
---|
| 73 | _size_rename_unit_id = log2(_nb_rename_unit); |
---|
| 74 | _max_nb_context = max<uint32_t>(_nb_context,_nb_front_end); |
---|
| 75 | _max_nb_inst_insert = max<uint32_t>(_nb_inst_insert,_nb_rename_unit); |
---|
| 76 | _max_nb_inst_retire = max<uint32_t>(_nb_inst_retire,_nb_rename_unit); |
---|
| 77 | _size_bank = _size_queue/_nb_bank; |
---|
| 78 | |
---|
[117] | 79 | // _shift_num_bank = 0; |
---|
| 80 | _mask_num_bank = gen_mask<Tpacket_t>(log2(_nb_bank)); |
---|
| 81 | _shift_num_slot = log2(_nb_bank); |
---|
| 82 | // _mask_num_slot = gen_mask<Tpacket_t>(log2(_size_bank)); |
---|
| 83 | |
---|
[88] | 84 | _have_port_rename_unit_id = _size_rename_unit_id > 0; |
---|
| 85 | |
---|
[145] | 86 | ALLOC1(_front_end_rat_scheme, Trat_scheme_t,_nb_front_end); |
---|
| 87 | // one rename unit per front_end |
---|
| 88 | for (uint32_t i=0; i<_nb_rename_unit; ++i) |
---|
| 89 | for (std::vector<uint32_t>::iterator it=_link_front_end_with_rename_unit[i].begin(); |
---|
| 90 | it != _link_front_end_with_rename_unit[i].end(); |
---|
| 91 | ++it) |
---|
| 92 | _front_end_rat_scheme[*it] = _rat_scheme[i]; |
---|
| 93 | |
---|
[110] | 94 | ALLOC2(_array_size_depth,uint32_t,_nb_front_end,_nb_context [it1]); |
---|
[88] | 95 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
[110] | 96 | for (uint32_t j=0; j<_nb_context [i]; j++) |
---|
| 97 | _array_size_depth [i][j] = (_nb_branch_speculated [i][j] == 0)?0:log2(_nb_branch_speculated [i][j]); |
---|
[88] | 98 | |
---|
| 99 | test(); |
---|
| 100 | |
---|
[110] | 101 | ALLOC1(_have_thread,bool,_nb_thread); |
---|
| 102 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
| 103 | _have_thread[i] = false; |
---|
| 104 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
| 105 | for (uint32_t j=0; j<_nb_context [i]; j++) |
---|
| 106 | _have_thread[_translate_num_context_to_num_thread [i][j]] = true; |
---|
| 107 | |
---|
[88] | 108 | if (is_toplevel) |
---|
| 109 | { |
---|
| 110 | _size_front_end_id = log2(_nb_front_end); |
---|
| 111 | _size_context_id = log2(_max_nb_context); |
---|
| 112 | _size_rob_ptr = log2(_nb_bank)+log2(_size_bank); |
---|
| 113 | _size_instruction_address = size_general_data-2; |
---|
| 114 | _size_store_queue_ptr = size_store_queue_ptr ; |
---|
| 115 | _size_load_queue_ptr = size_load_queue_ptr ; |
---|
| 116 | _size_general_data = size_general_data ; |
---|
| 117 | _size_general_register = size_general_register ; |
---|
| 118 | _size_special_register = size_special_register ; |
---|
| 119 | _size_depth = max<uint32_t>(_array_size_depth,_nb_front_end,_nb_context); |
---|
| 120 | _size_nb_inst_commit = log2(_size_queue)+1; |
---|
[108] | 121 | _size_nb_inst_decod = size_nb_inst_decod; |
---|
[88] | 122 | |
---|
| 123 | _have_port_front_end_id = _size_front_end_id > 0; |
---|
| 124 | _have_port_context_id = _size_context_id > 0; |
---|
| 125 | _have_port_rob_ptr = _size_rob_ptr > 0; |
---|
| 126 | _have_port_load_queue_ptr = _size_load_queue_ptr > 0; |
---|
| 127 | _have_port_depth = _size_depth > 0; |
---|
| 128 | |
---|
| 129 | copy(); |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | log_end(Commit_unit,FUNCTION); |
---|
| 133 | }; |
---|
| 134 | |
---|
| 135 | // #undef FUNCTION |
---|
| 136 | // #define FUNCTION "Commit_unit::Parameters (copy)" |
---|
| 137 | // Parameters::Parameters (Parameters & param) |
---|
| 138 | // { |
---|
| 139 | // log_begin(Commit_unit,FUNCTION); |
---|
| 140 | // test(); |
---|
| 141 | // log_end(Commit_unit,FUNCTION); |
---|
| 142 | // }; |
---|
| 143 | |
---|
| 144 | #undef FUNCTION |
---|
| 145 | #define FUNCTION "Commit_unit::~Parameters" |
---|
| 146 | Parameters::~Parameters (void) |
---|
| 147 | { |
---|
| 148 | log_begin(Commit_unit,FUNCTION); |
---|
| 149 | |
---|
[145] | 150 | DELETE1(_have_thread ,_nb_thread); |
---|
| 151 | DELETE2(_array_size_depth ,_nb_front_end,_nb_context [it1]); |
---|
| 152 | DELETE1(_front_end_rat_scheme,_nb_front_end); |
---|
[88] | 153 | |
---|
| 154 | log_end(Commit_unit,FUNCTION); |
---|
| 155 | }; |
---|
| 156 | |
---|
| 157 | #undef FUNCTION |
---|
| 158 | #define FUNCTION "Commit_unit::copy" |
---|
| 159 | void Parameters::copy (void) |
---|
| 160 | { |
---|
| 161 | log_begin(Commit_unit,FUNCTION); |
---|
| 162 | log_end(Commit_unit,FUNCTION); |
---|
| 163 | }; |
---|
| 164 | |
---|
| 165 | }; // end namespace commit_unit |
---|
| 166 | }; // end namespace ooo_engine |
---|
| 167 | }; // end namespace multi_ooo_engine |
---|
| 168 | }; // end namespace core |
---|
| 169 | |
---|
| 170 | }; // end namespace behavioural |
---|
| 171 | }; // end namespace morpheo |
---|