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