[88] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 139 2010-07-30 14:47:27Z 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" |
---|
[138] | 23 | Parameters::Parameters (uint32_t nb_front_end , |
---|
[139] | 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] |
---|
[138] | 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 , |
---|
[139] | 41 | Trat_scheme_t * rat_scheme ,//[nb_front_end] |
---|
[138] | 42 | Tpriority_t priority , |
---|
| 43 | Tload_balancing_t load_balancing , |
---|
| 44 | uint32_t nb_rename_unit_select , |
---|
| 45 | uint32_t nb_thread , |
---|
[139] | 46 | uint32_t ** translate_num_context_to_num_thread,//[nb_front_end][nb_context] |
---|
[138] | 47 | bool is_toplevel): |
---|
| 48 | _nb_bank_access_commit (1 ) |
---|
[88] | 49 | { |
---|
| 50 | log_begin(Commit_unit,FUNCTION); |
---|
| 51 | |
---|
[110] | 52 | _nb_front_end = nb_front_end ; |
---|
| 53 | _nb_context = nb_context ; |
---|
| 54 | _nb_rename_unit = nb_rename_unit ; |
---|
| 55 | _size_queue = size_queue ; |
---|
| 56 | _nb_bank = nb_bank ; |
---|
[138] | 57 | _retire_ooo_scheme = retire_ooo_scheme ; |
---|
[110] | 58 | _nb_inst_insert = nb_inst_insert ; |
---|
| 59 | _nb_inst_retire = nb_inst_retire ; |
---|
| 60 | _nb_inst_commit = nb_inst_commit ; |
---|
| 61 | _nb_inst_reexecute = nb_inst_reexecute ; |
---|
| 62 | _nb_inst_branch_complete = nb_inst_branch_complete ; |
---|
| 63 | _nb_branch_speculated = nb_branch_speculated ; |
---|
[139] | 64 | _rat_scheme = rat_scheme ; |
---|
[110] | 65 | _priority = priority ; |
---|
| 66 | _load_balancing = load_balancing ; |
---|
| 67 | _nb_rename_unit_select = nb_rename_unit_select ; |
---|
| 68 | _nb_thread = nb_thread ; |
---|
| 69 | _translate_num_context_to_num_thread = translate_num_context_to_num_thread; |
---|
[88] | 70 | |
---|
| 71 | _size_rename_unit_id = log2(_nb_rename_unit); |
---|
| 72 | _max_nb_context = max<uint32_t>(_nb_context,_nb_front_end); |
---|
| 73 | _max_nb_inst_insert = max<uint32_t>(_nb_inst_insert,_nb_rename_unit); |
---|
| 74 | _max_nb_inst_retire = max<uint32_t>(_nb_inst_retire,_nb_rename_unit); |
---|
| 75 | _size_bank = _size_queue/_nb_bank; |
---|
| 76 | |
---|
[117] | 77 | // _shift_num_bank = 0; |
---|
| 78 | _mask_num_bank = gen_mask<Tpacket_t>(log2(_nb_bank)); |
---|
| 79 | _shift_num_slot = log2(_nb_bank); |
---|
| 80 | // _mask_num_slot = gen_mask<Tpacket_t>(log2(_size_bank)); |
---|
| 81 | |
---|
[88] | 82 | _have_port_rename_unit_id = _size_rename_unit_id > 0; |
---|
| 83 | |
---|
[110] | 84 | ALLOC2(_array_size_depth,uint32_t,_nb_front_end,_nb_context [it1]); |
---|
[88] | 85 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
[110] | 86 | for (uint32_t j=0; j<_nb_context [i]; j++) |
---|
| 87 | _array_size_depth [i][j] = (_nb_branch_speculated [i][j] == 0)?0:log2(_nb_branch_speculated [i][j]); |
---|
[88] | 88 | |
---|
| 89 | test(); |
---|
| 90 | |
---|
[110] | 91 | ALLOC1(_have_thread,bool,_nb_thread); |
---|
| 92 | for (uint32_t i=0; i<_nb_thread; i++) |
---|
| 93 | _have_thread[i] = false; |
---|
| 94 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
| 95 | for (uint32_t j=0; j<_nb_context [i]; j++) |
---|
| 96 | _have_thread[_translate_num_context_to_num_thread [i][j]] = true; |
---|
| 97 | |
---|
[88] | 98 | if (is_toplevel) |
---|
| 99 | { |
---|
| 100 | _size_front_end_id = log2(_nb_front_end); |
---|
| 101 | _size_context_id = log2(_max_nb_context); |
---|
| 102 | _size_rob_ptr = log2(_nb_bank)+log2(_size_bank); |
---|
| 103 | _size_instruction_address = size_general_data-2; |
---|
| 104 | _size_store_queue_ptr = size_store_queue_ptr ; |
---|
| 105 | _size_load_queue_ptr = size_load_queue_ptr ; |
---|
| 106 | _size_general_data = size_general_data ; |
---|
| 107 | _size_general_register = size_general_register ; |
---|
| 108 | _size_special_register = size_special_register ; |
---|
| 109 | _size_depth = max<uint32_t>(_array_size_depth,_nb_front_end,_nb_context); |
---|
| 110 | _size_nb_inst_commit = log2(_size_queue)+1; |
---|
[108] | 111 | _size_nb_inst_decod = size_nb_inst_decod; |
---|
[88] | 112 | |
---|
| 113 | _have_port_front_end_id = _size_front_end_id > 0; |
---|
| 114 | _have_port_context_id = _size_context_id > 0; |
---|
| 115 | _have_port_rob_ptr = _size_rob_ptr > 0; |
---|
| 116 | _have_port_load_queue_ptr = _size_load_queue_ptr > 0; |
---|
| 117 | _have_port_depth = _size_depth > 0; |
---|
| 118 | |
---|
| 119 | copy(); |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | log_end(Commit_unit,FUNCTION); |
---|
| 123 | }; |
---|
| 124 | |
---|
| 125 | // #undef FUNCTION |
---|
| 126 | // #define FUNCTION "Commit_unit::Parameters (copy)" |
---|
| 127 | // Parameters::Parameters (Parameters & param) |
---|
| 128 | // { |
---|
| 129 | // log_begin(Commit_unit,FUNCTION); |
---|
| 130 | // test(); |
---|
| 131 | // log_end(Commit_unit,FUNCTION); |
---|
| 132 | // }; |
---|
| 133 | |
---|
| 134 | #undef FUNCTION |
---|
| 135 | #define FUNCTION "Commit_unit::~Parameters" |
---|
| 136 | Parameters::~Parameters (void) |
---|
| 137 | { |
---|
| 138 | log_begin(Commit_unit,FUNCTION); |
---|
| 139 | |
---|
[110] | 140 | DELETE1(_have_thread ,_nb_thread); |
---|
| 141 | DELETE2(_array_size_depth,_nb_front_end,_nb_context [it1]); |
---|
[88] | 142 | |
---|
| 143 | log_end(Commit_unit,FUNCTION); |
---|
| 144 | }; |
---|
| 145 | |
---|
| 146 | #undef FUNCTION |
---|
| 147 | #define FUNCTION "Commit_unit::copy" |
---|
| 148 | void Parameters::copy (void) |
---|
| 149 | { |
---|
| 150 | log_begin(Commit_unit,FUNCTION); |
---|
| 151 | log_end(Commit_unit,FUNCTION); |
---|
| 152 | }; |
---|
| 153 | |
---|
| 154 | }; // end namespace commit_unit |
---|
| 155 | }; // end namespace ooo_engine |
---|
| 156 | }; // end namespace multi_ooo_engine |
---|
| 157 | }; // end namespace core |
---|
| 158 | |
---|
| 159 | }; // end namespace behavioural |
---|
| 160 | }; // end namespace morpheo |
---|