[78] | 1 | /* |
---|
| 2 | * $Id: Parameters.cpp 120 2009-05-26 19:01:47Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/include/Parameters.h" |
---|
[88] | 9 | #include "Common/include/Max.h" |
---|
[78] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_execute_loop { |
---|
| 15 | namespace execute_loop { |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | #undef FUNCTION |
---|
| 19 | #define FUNCTION "Execute_loop::Parameters" |
---|
| 20 | Parameters::Parameters (uint32_t nb_read_unit , |
---|
| 21 | uint32_t nb_functionnal_unit , |
---|
| 22 | uint32_t nb_load_store_unit , |
---|
| 23 | uint32_t nb_write_unit , |
---|
| 24 | |
---|
| 25 | uint32_t nb_context , |
---|
| 26 | uint32_t nb_front_end , |
---|
| 27 | uint32_t nb_ooo_engine , |
---|
| 28 | uint32_t nb_packet , |
---|
| 29 | uint32_t size_general_data , |
---|
| 30 | uint32_t size_special_data , |
---|
| 31 | |
---|
[88] | 32 | uint32_t * size_read_queue ,//[nb_read_unit] |
---|
| 33 | uint32_t * size_reservation_station ,//[nb_read_unit] |
---|
| 34 | uint32_t * nb_inst_retire ,//[nb_read_unit] |
---|
| 35 | |
---|
| 36 | uint32_t * nb_inst_functionnal_unit ,//[nb_functionnal_unit] |
---|
| 37 | execute_timing_t *** timing ,//[nb_functionnal_unit][nb_type][nb_operation] |
---|
| 38 | morpheo::behavioural::custom::custom_information_t (*get_custom_information) (void), |
---|
[78] | 39 | |
---|
[88] | 40 | uint32_t * size_store_queue ,//[nb_load_store_unit] |
---|
| 41 | uint32_t * size_load_queue ,//[nb_load_store_unit] |
---|
| 42 | uint32_t * size_speculative_access_queue ,//[nb_load_store_unit] |
---|
| 43 | uint32_t * nb_port_check ,//[nb_load_store_unit] |
---|
| 44 | Tspeculative_load_t * speculative_load ,//[nb_load_store_unit] |
---|
| 45 | uint32_t * nb_bypass_memory ,//[nb_load_store_unit] |
---|
| 46 | uint32_t * nb_cache_port ,//[nb_load_store_unit] |
---|
| 47 | uint32_t * nb_inst_memory ,//[nb_load_store_unit] |
---|
[78] | 48 | |
---|
[88] | 49 | uint32_t * size_write_queue ,//[nb_write_unit] |
---|
| 50 | uint32_t * size_execute_queue ,//[nb_write_unit] |
---|
| 51 | uint32_t * nb_bypass_write ,//[nb_write_unit] |
---|
[115] | 52 | multi_write_unit::write_unit::write_queue::Twrite_queue_scheme_t * write_queue_scheme,//[nb_write_unit] |
---|
[78] | 53 | |
---|
| 54 | uint32_t nb_gpr_bank , |
---|
| 55 | uint32_t nb_gpr_port_read_by_bank , |
---|
| 56 | uint32_t nb_gpr_port_write_by_bank , |
---|
| 57 | uint32_t nb_spr_bank , |
---|
| 58 | uint32_t nb_spr_port_read_by_bank , |
---|
| 59 | uint32_t nb_spr_port_write_by_bank , |
---|
[88] | 60 | uint32_t * nb_general_register ,//[nb_ooo_engine] |
---|
| 61 | uint32_t * nb_special_register ,//[nb_ooo_engine] |
---|
| 62 | uint32_t * nb_inst_insert_rob ,//[nb_ooo_engine] |
---|
| 63 | uint32_t * nb_inst_retire_rob ,//[nb_ooo_engine] |
---|
[78] | 64 | |
---|
| 65 | Tpriority_t execution_unit_to_write_unit_priority , |
---|
[88] | 66 | bool *** execution_unit_to_write_unit_table_routing,//[nb_execute_unit][nb_execute_unit_port][nb_write_unit] |
---|
| 67 | bool ** execution_unit_to_write_unit_table_thread ,//[nb_write_unit][nb_thread] |
---|
| 68 | |
---|
| 69 | Tpriority_t read_unit_to_execution_unit_priority , |
---|
| 70 | bool *** read_unit_to_execution_unit_table_routing ,//[nb_read_unit][nb_execute_unit][nb_execute_unit_port] |
---|
| 71 | bool ** read_unit_to_execution_unit_table_thread ,//[nb_execute_unit][nb_thread] |
---|
| 72 | |
---|
| 73 | bool * is_load_store_unit ,//[nb_execute_unit] |
---|
| 74 | uint32_t * translate_num_execute_unit ,//[nb_execute_unit] |
---|
[120] | 75 | |
---|
| 76 | bool * num_thread_valid ,//[nb_thread] |
---|
[88] | 77 | |
---|
| 78 | bool is_toplevel |
---|
| 79 | ) |
---|
[78] | 80 | { |
---|
| 81 | log_printf(FUNC,Execute_loop,FUNCTION,"Begin"); |
---|
| 82 | |
---|
[88] | 83 | _nb_read_unit = nb_read_unit ; |
---|
| 84 | _nb_functionnal_unit = nb_functionnal_unit ; |
---|
| 85 | _nb_load_store_unit = nb_load_store_unit ; |
---|
| 86 | _nb_write_unit = nb_write_unit ; |
---|
| 87 | |
---|
| 88 | _nb_context = nb_context ; |
---|
| 89 | _nb_front_end = nb_front_end ; |
---|
| 90 | _nb_ooo_engine = nb_ooo_engine ; |
---|
| 91 | _nb_packet = nb_packet ; |
---|
| 92 | |
---|
| 93 | _size_read_queue = size_read_queue ; |
---|
| 94 | _size_reservation_station = size_reservation_station ; |
---|
| 95 | _nb_inst_retire = nb_inst_retire ; |
---|
| 96 | |
---|
| 97 | _nb_inst_functionnal_unit = nb_inst_functionnal_unit ; |
---|
| 98 | _timing = timing ; |
---|
| 99 | _get_custom_information = get_custom_information ; |
---|
| 100 | |
---|
| 101 | _size_store_queue = size_store_queue ; |
---|
| 102 | _size_load_queue = size_load_queue ; |
---|
| 103 | _size_speculative_access_queue = size_speculative_access_queue ; |
---|
| 104 | _nb_port_check = nb_port_check ; |
---|
| 105 | _speculative_load = speculative_load ; |
---|
| 106 | _nb_bypass_memory = nb_bypass_memory ; |
---|
| 107 | _nb_cache_port = nb_cache_port ; |
---|
| 108 | _nb_inst_memory = nb_inst_memory ; |
---|
| 109 | |
---|
| 110 | _size_write_queue = size_write_queue ; |
---|
| 111 | _size_execute_queue = size_execute_queue ; |
---|
| 112 | _nb_bypass_write = nb_bypass_write ; |
---|
[115] | 113 | _write_queue_scheme = write_queue_scheme ; |
---|
[88] | 114 | |
---|
| 115 | _nb_gpr_bank = nb_gpr_bank ; |
---|
| 116 | _nb_gpr_port_read_by_bank = nb_gpr_port_read_by_bank ; |
---|
| 117 | _nb_gpr_port_write_by_bank = nb_gpr_port_write_by_bank ; |
---|
| 118 | _nb_spr_bank = nb_spr_bank ; |
---|
| 119 | _nb_spr_port_read_by_bank = nb_spr_port_read_by_bank ; |
---|
| 120 | _nb_spr_port_write_by_bank = nb_spr_port_write_by_bank ; |
---|
| 121 | _nb_general_register = nb_general_register ; |
---|
| 122 | _nb_special_register = nb_special_register ; |
---|
| 123 | _nb_inst_insert_rob = nb_inst_insert_rob ; |
---|
| 124 | _nb_inst_retire_rob = nb_inst_retire_rob ; |
---|
[78] | 125 | |
---|
| 126 | _execution_unit_to_write_unit_priority = execution_unit_to_write_unit_priority; |
---|
| 127 | _execution_unit_to_write_unit_table_routing = execution_unit_to_write_unit_table_routing; |
---|
| 128 | _execution_unit_to_write_unit_table_thread = execution_unit_to_write_unit_table_thread ; |
---|
| 129 | |
---|
[88] | 130 | _read_unit_to_execution_unit_priority = read_unit_to_execution_unit_priority ; |
---|
[78] | 131 | _read_unit_to_execution_unit_table_routing = read_unit_to_execution_unit_table_routing ; |
---|
| 132 | _read_unit_to_execution_unit_table_thread = read_unit_to_execution_unit_table_thread ; |
---|
| 133 | |
---|
[88] | 134 | _is_load_store_unit = is_load_store_unit ; |
---|
| 135 | _translate_num_execute_unit = translate_num_execute_unit; |
---|
[78] | 136 | |
---|
[120] | 137 | _num_thread_valid = num_thread_valid; |
---|
| 138 | |
---|
[88] | 139 | _nb_execute_unit = _nb_functionnal_unit + _nb_load_store_unit; |
---|
[78] | 140 | |
---|
[88] | 141 | _nb_execute_unit_port = new uint32_t [_nb_execute_unit]; |
---|
| 142 | |
---|
[78] | 143 | _read_unit_to_execution_unit_table_execute_type = new bool * [_nb_execute_unit]; |
---|
| 144 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
| 145 | { |
---|
| 146 | _read_unit_to_execution_unit_table_execute_type [i] = new bool [_nb_type]; |
---|
| 147 | for (uint32_t j=0; j<_nb_type; j++) |
---|
| 148 | _read_unit_to_execution_unit_table_execute_type [i][j] = false; |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | // Fill execute_type |
---|
| 152 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
[88] | 153 | // is load store |
---|
| 154 | if (is_load_store_unit [i]) |
---|
| 155 | _read_unit_to_execution_unit_table_execute_type [i][TYPE_MEMORY] = true; |
---|
| 156 | else |
---|
| 157 | for (uint32_t j=0; j<_nb_type; j++) |
---|
| 158 | if (is_type_valid (j)) |
---|
| 159 | for (uint32_t k=0; k<_nb_operation; k++) |
---|
| 160 | { |
---|
| 161 | uint32_t x = translate_num_execute_unit [i]; |
---|
| 162 | if (timing[x][j][k]._latence > 0) |
---|
| 163 | { |
---|
[109] | 164 | log_printf(TRACE,Execute_loop,FUNCTION," * Execute unit '%d' (functional unit '%d') can execute type '%s'.",i,x,toString(j).c_str()); |
---|
[88] | 165 | _read_unit_to_execution_unit_table_execute_type [i][j] = true; |
---|
| 166 | break; // find an operation |
---|
| 167 | } |
---|
| 168 | } |
---|
[78] | 169 | |
---|
[109] | 170 | for (uint32_t i=0; i<_nb_load_store_unit; ++i) |
---|
| 171 | log_printf(TRACE,Execute_loop,FUNCTION," * Load_store_unit [%d] - nb_inst : %d",i,_nb_inst_memory [i]); |
---|
| 172 | for (uint32_t i=0; i<_nb_functionnal_unit; ++i) |
---|
| 173 | log_printf(TRACE,Execute_loop,FUNCTION," * Functionnal_unit [%d] - nb_inst : %d",i,_nb_inst_functionnal_unit [i]); |
---|
| 174 | |
---|
| 175 | |
---|
[78] | 176 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
[88] | 177 | { |
---|
| 178 | uint32_t x = translate_num_execute_unit [i]; |
---|
| 179 | |
---|
| 180 | if (_is_load_store_unit [i]) |
---|
| 181 | _nb_execute_unit_port [i] = _nb_inst_memory [x]; |
---|
| 182 | else |
---|
| 183 | _nb_execute_unit_port [i] = _nb_inst_functionnal_unit [x]; |
---|
[109] | 184 | |
---|
| 185 | log_printf(TRACE,Execute_loop,FUNCTION," * Execute unit [%d] (%d) - nb_inst : %d",i,x,_nb_execute_unit_port [i]); |
---|
[88] | 186 | } |
---|
[78] | 187 | |
---|
| 188 | _nb_gpr_read = 2*_nb_read_unit; |
---|
| 189 | _nb_spr_read = 1*_nb_read_unit; |
---|
| 190 | _nb_gpr_write = 1*_nb_write_unit; |
---|
| 191 | _nb_spr_write = 1*_nb_write_unit; |
---|
| 192 | |
---|
[88] | 193 | _max_nb_general_register = max<uint32_t>(nb_general_register,nb_ooo_engine); |
---|
| 194 | _max_nb_special_register = max<uint32_t>(nb_special_register,nb_ooo_engine); |
---|
[78] | 195 | |
---|
[88] | 196 | _max_size_store_queue = max<uint32_t>(size_store_queue,nb_load_store_unit); |
---|
| 197 | _max_size_load_queue = max<uint32_t>(size_load_queue ,nb_load_store_unit); |
---|
[78] | 198 | |
---|
| 199 | uint32_t _nb_thread = get_nb_thread(_nb_context, |
---|
| 200 | _nb_front_end, |
---|
| 201 | _nb_ooo_engine); |
---|
| 202 | |
---|
[88] | 203 | uint32_t _max_nb_inst_memory = max<uint32_t>(_nb_inst_memory,_nb_load_store_unit); |
---|
| 204 | |
---|
[78] | 205 | _set_read_unit_source_register_write = new std::set<uint32_t> [_nb_read_unit]; |
---|
| 206 | _set_read_unit_source_bypass_write = new std::set<uint32_t> [_nb_read_unit]; |
---|
| 207 | _set_read_unit_source_bypass_memory = new std::set<uint32_t> [_nb_read_unit]; |
---|
| 208 | |
---|
| 209 | _read_unit_nb_register_write = new uint32_t [_nb_read_unit]; |
---|
| 210 | _read_unit_nb_bypass_write = new uint32_t [_nb_read_unit]; |
---|
| 211 | _read_unit_nb_bypass_memory = new uint32_t [_nb_read_unit]; |
---|
| 212 | |
---|
[88] | 213 | _link_read_unit_with_load_store_unit = new bool ** [nb_read_unit]; |
---|
| 214 | _link_read_unit_with_write_unit = new bool * [nb_read_unit]; |
---|
| 215 | _link_read_unit_with_thread = new bool * [nb_read_unit]; |
---|
[78] | 216 | |
---|
| 217 | for (uint32_t i=0; i<_nb_read_unit; i++) |
---|
| 218 | { |
---|
| 219 | _read_unit_nb_register_write [i] = 0; |
---|
| 220 | _read_unit_nb_bypass_write [i] = 0; |
---|
| 221 | _read_unit_nb_bypass_memory [i] = 0; |
---|
| 222 | |
---|
[88] | 223 | _link_read_unit_with_load_store_unit [i] = new bool * [_nb_execute_unit]; |
---|
| 224 | _link_read_unit_with_write_unit [i] = new bool [_nb_write_unit]; |
---|
| 225 | _link_read_unit_with_thread [i] = new bool [_nb_thread]; |
---|
[78] | 226 | |
---|
| 227 | for (uint32_t j=0; j<_nb_execute_unit; j++) |
---|
[88] | 228 | { |
---|
| 229 | _link_read_unit_with_load_store_unit [i][j] = new bool [_max_nb_inst_memory]; |
---|
| 230 | |
---|
| 231 | for (uint32_t k=0; k<_max_nb_inst_memory; k++) |
---|
| 232 | _link_read_unit_with_load_store_unit [i][j][k] = false; |
---|
| 233 | } |
---|
[78] | 234 | for (uint32_t j=0; j<_nb_write_unit; j++) |
---|
| 235 | _link_read_unit_with_write_unit [i][j] = false; |
---|
| 236 | for (uint32_t j=0; j<_nb_thread; j++) |
---|
| 237 | _link_read_unit_with_thread [i][j] = false; |
---|
| 238 | |
---|
| 239 | // fill link array |
---|
[88] | 240 | for (uint32_t x=0; x<_nb_execute_unit; x++) |
---|
| 241 | for (uint32_t y=0; y<_nb_execute_unit_port[x]; y++) |
---|
| 242 | { |
---|
| 243 | // Test if this read unit can send operation at this execute_unit |
---|
| 244 | if (_read_unit_to_execution_unit_table_routing [i][x][y]) |
---|
| 245 | { |
---|
| 246 | if (_is_load_store_unit [x]) |
---|
| 247 | { |
---|
| 248 | _link_read_unit_with_load_store_unit [i][x][y] = true; |
---|
| 249 | } |
---|
| 250 | |
---|
| 251 | for (uint32_t k=0; k<_nb_thread; k++) |
---|
| 252 | { |
---|
| 253 | if (_read_unit_to_execution_unit_table_thread [x][k]) |
---|
| 254 | { |
---|
| 255 | _link_read_unit_with_thread [i][k] = true; |
---|
| 256 | } |
---|
| 257 | } |
---|
| 258 | // Scearch associed write_unit |
---|
| 259 | for (uint32_t k=0; k<_nb_write_unit; k++) |
---|
| 260 | { |
---|
[109] | 261 | log_printf(TRACE,Execute_loop,FUNCTION," * Execution_unit_to_write_unit_table_routing [%d][%d][%d]",x,y,k); |
---|
| 262 | |
---|
[88] | 263 | // Test if this execute_unit can send operation at this write_unit |
---|
| 264 | // Test if have not a previous link ! (a same read_unit can send operation à two execute_unit and each execute_unit send at the same write_unit) |
---|
| 265 | if (_execution_unit_to_write_unit_table_routing [x][y][k] and |
---|
| 266 | not _link_read_unit_with_write_unit [i][k]) |
---|
| 267 | // if yes : this write_unit can have operation sended by this read_unit |
---|
| 268 | { |
---|
| 269 | _link_read_unit_with_write_unit [i][k] = true; |
---|
| 270 | } |
---|
| 271 | } |
---|
| 272 | } |
---|
| 273 | } |
---|
[78] | 274 | } |
---|
| 275 | |
---|
| 276 | // Compute the gpr_write and spr_write port for the read_unit : |
---|
| 277 | // * Max : 2*nb_write_unit gpr_write_port. |
---|
| 278 | // * a specific read_unit and a specific write_unit can execute a null intersection of thread operation. Also it's unnecessarry to send the gpr_write at the read_unit. |
---|
| 279 | |
---|
| 280 | |
---|
[88] | 281 | // std::cout << "_link_......." << std::endl; |
---|
| 282 | // std::cout << "_link_read_unit_with_load_store_unit" << std::endl; |
---|
| 283 | // for (uint32_t i=0; i<_nb_read_unit; i++) |
---|
| 284 | // { |
---|
| 285 | // std::cout << "\t" << std::endl; |
---|
| 286 | // for (uint32_t j=0; j<_nb_execute_unit; j++) |
---|
| 287 | // for (uint32_t k=0; k<_nb_execute_unit_port[j]; k++) |
---|
| 288 | // std::cout << _link_read_unit_with_load_store_unit [i][j][k] << " "; |
---|
| 289 | // std::cout << std::endl; |
---|
| 290 | // } |
---|
| 291 | // std::cout << "_link_read_unit_with_write_unit" << std::endl; |
---|
| 292 | // for (uint32_t i=0; i<_nb_read_unit; i++) |
---|
| 293 | // { |
---|
| 294 | // std::cout << "\t" << std::endl; |
---|
| 295 | // for (uint32_t j=0; j<_nb_write_unit; j++) |
---|
| 296 | // std::cout << _link_read_unit_with_write_unit [i][j] << " "; |
---|
| 297 | // std::cout << std::endl; |
---|
| 298 | // } |
---|
| 299 | // std::cout << "_link_read_unit_with_thread" << std::endl; |
---|
| 300 | // for (uint32_t i=0; i<_nb_read_unit; i++) |
---|
| 301 | // { |
---|
| 302 | // std::cout << "\t" << std::endl; |
---|
| 303 | // for (uint32_t j=0; j<_nb_thread; j++) |
---|
| 304 | // std::cout << _link_read_unit_with_thread [i][j] << " "; |
---|
| 305 | // std::cout << std::endl; |
---|
| 306 | // } |
---|
[78] | 307 | |
---|
[88] | 308 | // std::cout << "_set_......." << std::endl; |
---|
[78] | 309 | |
---|
| 310 | for (uint32_t i=0; i<_nb_read_unit; i++) |
---|
| 311 | { |
---|
[88] | 312 | // std::cout << " * Read_unit[" << i << "]" << std::endl; |
---|
[78] | 313 | for (uint32_t j=0; j<_nb_write_unit; j++) |
---|
| 314 | { |
---|
[88] | 315 | // std::cout << " * Write_unit[" << j << "]" << std::endl; |
---|
[78] | 316 | // Test the thread executed on this write_unit |
---|
| 317 | for (uint32_t k=0; k<_nb_thread; k++) |
---|
| 318 | { |
---|
[88] | 319 | // std::cout << " * Thread[" << k << "]" << std::endl; |
---|
[78] | 320 | if ( (_execution_unit_to_write_unit_table_thread [j][k]) and |
---|
| 321 | (_link_read_unit_with_thread [i][k])) |
---|
| 322 | { |
---|
[88] | 323 | // std::cout << " * Find !!!!" << std::endl; |
---|
| 324 | // std::cout << " * Read_unit "+toString(i)+" must take the gpr_write with write_unit "+toString(j)+"." << std::endl; |
---|
[78] | 325 | _set_read_unit_source_register_write[i].insert(j); |
---|
| 326 | _read_unit_nb_register_write [i] ++; |
---|
| 327 | |
---|
[88] | 328 | // std::cout << " * bypass_write : " << _nb_bypass_write [j] << std::endl; |
---|
| 329 | // std::cout << " * Read_unit "+toString(i)+" must take the bypass_write with write_unit "+toString(j)+"." << std::endl; |
---|
[78] | 330 | _set_read_unit_source_bypass_write [i].insert(j); |
---|
| 331 | _read_unit_nb_bypass_write [i] += _nb_bypass_write [j]; |
---|
| 332 | break; |
---|
| 333 | } |
---|
| 334 | } |
---|
| 335 | } |
---|
| 336 | } |
---|
| 337 | |
---|
| 338 | for (uint32_t i=0; i<_nb_read_unit; i++) |
---|
| 339 | { |
---|
[88] | 340 | // std::cout << " * Read_unit[" << i << "]" << std::endl; |
---|
[78] | 341 | for (uint32_t j=0; j<_nb_execute_unit; j++) |
---|
| 342 | { |
---|
[88] | 343 | uint32_t x = translate_num_execute_unit [j]; |
---|
| 344 | |
---|
| 345 | // std::cout << " * Execute_unit[" << j << "]" << std::endl; |
---|
[78] | 346 | // Test the thread executed on this execute_unit |
---|
| 347 | for (uint32_t k=0; k<_nb_thread; k++) |
---|
| 348 | { |
---|
[88] | 349 | // std::cout << " * Thread[" << k << "]" << std::endl; |
---|
[78] | 350 | if ((_read_unit_to_execution_unit_table_thread [j][k]) and |
---|
| 351 | (_link_read_unit_with_thread [i][k]) and |
---|
| 352 | (_is_load_store_unit [j])) |
---|
| 353 | { |
---|
[88] | 354 | // std::cout << " * Find !!!!" << std::endl; |
---|
| 355 | // std::cout << " * Bypass_memory !!!!" << std::endl; |
---|
| 356 | // std::cout << " * Read_unit "+toString(i)+" must take the bypass_memory with load_store_unit "+toString(j)+"." << std::endl; |
---|
[78] | 357 | |
---|
| 358 | _set_read_unit_source_bypass_memory [i].insert(j); |
---|
[88] | 359 | _read_unit_nb_bypass_memory [i] += _nb_bypass_memory [x]; |
---|
| 360 | |
---|
| 361 | break; // loop on thread |
---|
[78] | 362 | } |
---|
| 363 | } |
---|
| 364 | } |
---|
| 365 | } |
---|
| 366 | |
---|
[88] | 367 | uint32_t size_ooo_engine_id = log2(nb_ooo_engine ); |
---|
| 368 | uint32_t size_general_register = log2(_max_nb_general_register); |
---|
| 369 | uint32_t size_special_register = log2(_max_nb_special_register); |
---|
| 370 | |
---|
[78] | 371 | test(); |
---|
| 372 | |
---|
[88] | 373 | log_printf(TRACE,Execute_loop,FUNCTION,"Parameters : glue"); |
---|
| 374 | |
---|
| 375 | _param_glue = new morpheo::behavioural::core::multi_execute_loop::execute_loop::execute_loop_glue::Parameters |
---|
| 376 | (_nb_gpr_write , |
---|
| 377 | _nb_spr_write , |
---|
| 378 | size_ooo_engine_id , |
---|
| 379 | size_general_register , |
---|
| 380 | size_special_register , |
---|
| 381 | size_general_data , |
---|
| 382 | size_special_data ); |
---|
| 383 | |
---|
| 384 | log_printf(TRACE,Execute_loop,FUNCTION,"Parameters : read_unit"); |
---|
| 385 | |
---|
[78] | 386 | _param_read_unit = new morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit::read_unit::Parameters * [_nb_read_unit]; |
---|
| 387 | for (uint32_t i=0; i<_nb_read_unit; i++) |
---|
| 388 | _param_read_unit [i] = new morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit::read_unit::Parameters |
---|
| 389 | (_size_read_queue [i], |
---|
| 390 | _size_reservation_station [i], |
---|
| 391 | _nb_context , |
---|
| 392 | _nb_front_end , |
---|
| 393 | _nb_ooo_engine , |
---|
| 394 | _nb_packet , |
---|
[88] | 395 | size_general_data , |
---|
| 396 | size_special_data , |
---|
[78] | 397 | _max_nb_general_register , |
---|
| 398 | _max_nb_special_register , |
---|
| 399 | 1*_read_unit_nb_register_write [i], |
---|
| 400 | 1*_read_unit_nb_register_write [i], |
---|
| 401 | _max_size_store_queue , |
---|
| 402 | _max_size_load_queue , |
---|
| 403 | _nb_inst_retire [i], |
---|
| 404 | _read_unit_nb_bypass_write [i], |
---|
| 405 | _read_unit_nb_bypass_memory [i]); |
---|
| 406 | |
---|
[88] | 407 | log_printf(TRACE,Execute_loop,FUNCTION,"Parameters : execute_unit"); |
---|
| 408 | |
---|
[78] | 409 | _param_functionnal_unit = new morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::functionnal_unit::Parameters * [_nb_functionnal_unit]; |
---|
| 410 | _param_load_store_unit = new morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Parameters * [_nb_load_store_unit]; |
---|
| 411 | |
---|
| 412 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
[88] | 413 | { |
---|
| 414 | uint32_t x = _translate_num_execute_unit [i]; |
---|
| 415 | if (_is_load_store_unit [i] == false) |
---|
[78] | 416 | _param_functionnal_unit [x] = new morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::functionnal_unit::Parameters |
---|
| 417 | (_nb_context , |
---|
| 418 | _nb_front_end , |
---|
| 419 | _nb_ooo_engine , |
---|
| 420 | _nb_packet , |
---|
[88] | 421 | size_general_data , |
---|
[78] | 422 | _max_nb_general_register , |
---|
[88] | 423 | size_special_data , |
---|
[78] | 424 | _max_nb_special_register , |
---|
| 425 | _max_size_store_queue , |
---|
| 426 | _max_size_load_queue , |
---|
[88] | 427 | _timing [x], |
---|
[78] | 428 | _get_custom_information ); |
---|
[88] | 429 | else |
---|
| 430 | _param_load_store_unit [x] = new morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Parameters |
---|
| 431 | (_size_store_queue [x], |
---|
| 432 | _size_load_queue [x], |
---|
| 433 | _size_speculative_access_queue [x], |
---|
| 434 | _nb_port_check [x], |
---|
| 435 | _speculative_load [x], |
---|
| 436 | _nb_bypass_memory [x], |
---|
| 437 | _nb_cache_port [x], |
---|
| 438 | _nb_inst_memory [x], |
---|
[78] | 439 | _nb_context , |
---|
| 440 | _nb_front_end , |
---|
| 441 | _nb_ooo_engine , |
---|
| 442 | _nb_packet , |
---|
[88] | 443 | size_general_data , |
---|
| 444 | size_special_data , |
---|
[78] | 445 | _max_nb_special_register , |
---|
| 446 | _max_nb_general_register ); |
---|
[88] | 447 | } |
---|
[78] | 448 | |
---|
[88] | 449 | log_printf(TRACE,Execute_loop,FUNCTION,"Parameters : write_unit"); |
---|
| 450 | |
---|
[78] | 451 | _param_write_unit = new morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_write_unit::write_unit::Parameters * [_nb_write_unit]; |
---|
| 452 | for (uint32_t i=0; i<_nb_write_unit; i++) |
---|
| 453 | _param_write_unit [i] = new morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_write_unit::write_unit::Parameters |
---|
| 454 | (_size_write_queue [i], |
---|
| 455 | _size_execute_queue [i], |
---|
| 456 | _nb_context , |
---|
| 457 | _nb_front_end , |
---|
| 458 | _nb_ooo_engine , |
---|
| 459 | _nb_packet , |
---|
[88] | 460 | size_general_data , |
---|
[78] | 461 | _max_nb_general_register , |
---|
[88] | 462 | size_special_data , |
---|
[78] | 463 | _max_nb_special_register , |
---|
[115] | 464 | _nb_bypass_write [i], |
---|
| 465 | _write_queue_scheme [i]); |
---|
[78] | 466 | |
---|
[88] | 467 | log_printf(TRACE,Execute_loop,FUNCTION,"Parameters : read_unit_to_execution_unit"); |
---|
| 468 | |
---|
[78] | 469 | _param_read_unit_to_execution_unit = new morpheo::behavioural::core::multi_execute_loop::execute_loop::network::read_unit_to_execution_unit::Parameters |
---|
| 470 | (_nb_read_unit , |
---|
[88] | 471 | _nb_inst_retire , |
---|
[78] | 472 | _nb_execute_unit , |
---|
[88] | 473 | _nb_execute_unit_port , |
---|
[78] | 474 | _nb_context , |
---|
| 475 | _nb_front_end , |
---|
| 476 | _nb_ooo_engine , |
---|
| 477 | _nb_packet , |
---|
[88] | 478 | size_general_data , |
---|
| 479 | size_special_data , |
---|
[78] | 480 | _max_nb_general_register , |
---|
| 481 | _max_nb_special_register , |
---|
| 482 | _max_size_store_queue , |
---|
| 483 | _max_size_load_queue , |
---|
| 484 | _read_unit_to_execution_unit_priority , |
---|
| 485 | _read_unit_to_execution_unit_table_routing , |
---|
| 486 | _read_unit_to_execution_unit_table_execute_type, |
---|
[120] | 487 | _read_unit_to_execution_unit_table_thread , |
---|
| 488 | _num_thread_valid); |
---|
[78] | 489 | |
---|
[88] | 490 | log_printf(TRACE,Execute_loop,FUNCTION,"Parameters : execution_unit_to_write_unit"); |
---|
| 491 | |
---|
[78] | 492 | _param_execution_unit_to_write_unit = new morpheo::behavioural::core::multi_execute_loop::execute_loop::network::execution_unit_to_write_unit::Parameters |
---|
| 493 | (_nb_execute_unit , |
---|
[88] | 494 | _nb_execute_unit_port , |
---|
[78] | 495 | _nb_write_unit , |
---|
| 496 | _nb_context , |
---|
| 497 | _nb_front_end , |
---|
| 498 | _nb_ooo_engine , |
---|
| 499 | _nb_packet , |
---|
[88] | 500 | size_general_data , |
---|
| 501 | size_special_data , |
---|
[78] | 502 | _max_nb_general_register , |
---|
| 503 | _max_nb_special_register , |
---|
| 504 | _execution_unit_to_write_unit_priority , |
---|
| 505 | _execution_unit_to_write_unit_table_routing, |
---|
[120] | 506 | _execution_unit_to_write_unit_table_thread , |
---|
| 507 | _num_thread_valid); |
---|
[78] | 508 | |
---|
[88] | 509 | log_printf(TRACE,Execute_loop,FUNCTION,"Parameters : register_unit"); |
---|
| 510 | |
---|
[78] | 511 | _param_register_unit = new morpheo::behavioural::core::multi_execute_loop::execute_loop::register_unit::Parameters |
---|
| 512 | (_nb_ooo_engine , |
---|
[88] | 513 | size_general_data , |
---|
| 514 | size_special_data , |
---|
[78] | 515 | _nb_gpr_read , |
---|
| 516 | _nb_gpr_write , |
---|
| 517 | _nb_gpr_bank , |
---|
| 518 | _nb_gpr_port_read_by_bank , |
---|
| 519 | _nb_gpr_port_write_by_bank , |
---|
| 520 | _nb_spr_read , |
---|
| 521 | _nb_spr_write , |
---|
| 522 | _nb_spr_bank , |
---|
| 523 | _nb_spr_port_read_by_bank , |
---|
| 524 | _nb_spr_port_write_by_bank , |
---|
| 525 | _nb_general_register , |
---|
| 526 | _nb_special_register , |
---|
| 527 | _nb_inst_insert_rob , |
---|
| 528 | _nb_inst_retire_rob ); |
---|
| 529 | |
---|
| 530 | _max_size_dcache_context_id = 0; |
---|
| 531 | _max_size_dcache_packet_id = 0; |
---|
| 532 | |
---|
| 533 | for (uint32_t i=0; i<_nb_load_store_unit; i++) |
---|
| 534 | { |
---|
| 535 | if (_param_load_store_unit [i]->_size_dcache_context_id > _max_size_dcache_context_id) _max_size_dcache_context_id = _param_load_store_unit [i]->_size_dcache_context_id; |
---|
| 536 | if (_param_load_store_unit [i]->_size_dcache_packet_id > _max_size_dcache_packet_id) _max_size_dcache_packet_id = _param_load_store_unit [i]->_size_dcache_packet_id; |
---|
| 537 | } |
---|
| 538 | |
---|
[117] | 539 | // log_printf(TRACE,Load_store_unit,FUNCTION,"kane : size_dcache_context_id : %d",_max_size_dcache_context_id ); |
---|
| 540 | // log_printf(TRACE,Load_store_unit,FUNCTION,"kane : size_dcache_packet_id : %d",_max_size_dcache_packet_id ); |
---|
[78] | 541 | |
---|
[117] | 542 | _have_port_dcache_context_id = (_max_size_dcache_context_id>0); |
---|
[88] | 543 | |
---|
[117] | 544 | // log_printf(TRACE,Load_store_unit,FUNCTION,"kane : have_port_dcache_context_id : %d",_have_port_dcache_context_id); |
---|
| 545 | |
---|
[88] | 546 | if (is_toplevel) |
---|
| 547 | { |
---|
[97] | 548 | _size_instruction_address= size_general_data-2; |
---|
[88] | 549 | _size_context_id = log2(nb_context); |
---|
| 550 | _size_front_end_id = log2(nb_front_end); |
---|
| 551 | _size_ooo_engine_id = size_ooo_engine_id; |
---|
| 552 | _size_rob_ptr = log2(nb_packet); |
---|
| 553 | _size_general_data = size_general_data; |
---|
| 554 | _size_special_data = size_special_data; |
---|
| 555 | _size_general_register = size_general_register; |
---|
| 556 | _size_special_register = size_special_register; |
---|
| 557 | |
---|
| 558 | _size_store_queue_ptr = log2(_max_size_store_queue); |
---|
| 559 | _size_load_queue_ptr = log2(_max_size_load_queue ); |
---|
| 560 | |
---|
| 561 | _have_port_context_id = _size_context_id > 0; |
---|
| 562 | _have_port_front_end_id = _size_front_end_id > 0; |
---|
| 563 | _have_port_ooo_engine_id = _size_ooo_engine_id > 0; |
---|
| 564 | _have_port_rob_ptr = _size_rob_ptr > 0; |
---|
| 565 | _have_port_load_queue_ptr= _size_load_queue_ptr > 0; |
---|
| 566 | |
---|
| 567 | copy(); |
---|
| 568 | } |
---|
| 569 | |
---|
[78] | 570 | log_printf(FUNC,Execute_loop,FUNCTION,"End"); |
---|
| 571 | }; |
---|
| 572 | |
---|
| 573 | // #undef FUNCTION |
---|
| 574 | // #define FUNCTION "Execute_loop::Parameters (copy)" |
---|
| 575 | // Parameters::Parameters (Parameters & param) |
---|
| 576 | // { |
---|
| 577 | // log_printf(FUNC,Execute_loop,FUNCTION,"Begin"); |
---|
| 578 | |
---|
| 579 | // test(); |
---|
| 580 | |
---|
| 581 | // log_printf(FUNC,Execute_loop,FUNCTION,"End"); |
---|
| 582 | // }; |
---|
| 583 | |
---|
| 584 | #undef FUNCTION |
---|
| 585 | #define FUNCTION "Execute_loop::~Parameters" |
---|
[88] | 586 | Parameters::~Parameters (void) |
---|
[78] | 587 | { |
---|
| 588 | log_printf(FUNC,Execute_loop,FUNCTION,"Begin"); |
---|
| 589 | |
---|
[88] | 590 | delete _param_glue; |
---|
| 591 | for (uint32_t i=0; i<_nb_read_unit; i++) |
---|
| 592 | delete _param_read_unit [i]; |
---|
[78] | 593 | delete [] _param_read_unit; |
---|
[88] | 594 | |
---|
| 595 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
| 596 | { |
---|
| 597 | uint32_t x = _translate_num_execute_unit [i]; |
---|
| 598 | |
---|
| 599 | if (_is_load_store_unit [i] == false) |
---|
| 600 | delete _param_functionnal_unit [x]; |
---|
| 601 | else |
---|
| 602 | delete _param_load_store_unit [x]; |
---|
| 603 | } |
---|
[78] | 604 | delete [] _param_functionnal_unit; |
---|
| 605 | delete [] _param_load_store_unit; |
---|
[88] | 606 | for (uint32_t i=0; i<_nb_write_unit; i++) |
---|
| 607 | delete _param_write_unit [i]; |
---|
[78] | 608 | delete [] _param_write_unit; |
---|
| 609 | delete _param_read_unit_to_execution_unit; |
---|
| 610 | delete _param_execution_unit_to_write_unit; |
---|
| 611 | delete _param_register_unit; |
---|
| 612 | |
---|
| 613 | delete [] _read_unit_to_execution_unit_table_execute_type; |
---|
| 614 | delete [] _read_unit_nb_register_write; |
---|
| 615 | delete [] _read_unit_nb_bypass_write; |
---|
| 616 | delete [] _read_unit_nb_bypass_memory; |
---|
| 617 | delete [] _set_read_unit_source_register_write ; |
---|
| 618 | delete [] _set_read_unit_source_bypass_write ; |
---|
| 619 | delete [] _set_read_unit_source_bypass_memory ; |
---|
| 620 | delete [] _link_read_unit_with_load_store_unit; |
---|
| 621 | delete [] _link_read_unit_with_write_unit; |
---|
| 622 | delete [] _link_read_unit_with_thread; |
---|
| 623 | delete [] _is_load_store_unit; |
---|
| 624 | delete [] _translate_num_execute_unit; |
---|
[88] | 625 | delete [] _nb_execute_unit_port; |
---|
| 626 | log_printf(FUNC,Execute_loop,FUNCTION,"End"); |
---|
| 627 | }; |
---|
[78] | 628 | |
---|
[88] | 629 | |
---|
| 630 | #undef FUNCTION |
---|
| 631 | #define FUNCTION "Execute_loop::copy" |
---|
| 632 | void Parameters::copy (void) |
---|
| 633 | { |
---|
| 634 | log_printf(FUNC,Execute_loop,FUNCTION,"Begin"); |
---|
| 635 | |
---|
| 636 | COPY(_param_glue); |
---|
| 637 | for (uint32_t i=0; i<_nb_read_unit; i++) |
---|
| 638 | COPY(_param_read_unit [i]); |
---|
| 639 | |
---|
| 640 | for (uint32_t i=0; i<_nb_execute_unit; i++) |
---|
| 641 | { |
---|
| 642 | uint32_t x = _translate_num_execute_unit [i]; |
---|
| 643 | |
---|
| 644 | if (_is_load_store_unit [i] == false) |
---|
| 645 | COPY(_param_functionnal_unit [x]); |
---|
| 646 | else |
---|
| 647 | COPY(_param_load_store_unit [x]); |
---|
| 648 | } |
---|
| 649 | for (uint32_t i=0; i<_nb_write_unit; i++) |
---|
| 650 | COPY(_param_write_unit [i]); |
---|
| 651 | COPY(_param_read_unit_to_execution_unit); |
---|
| 652 | COPY(_param_execution_unit_to_write_unit); |
---|
| 653 | COPY(_param_register_unit); |
---|
| 654 | |
---|
[78] | 655 | log_printf(FUNC,Execute_loop,FUNCTION,"End"); |
---|
| 656 | }; |
---|
| 657 | |
---|
| 658 | }; // end namespace execute_loop |
---|
| 659 | }; // end namespace multi_execute_loop |
---|
| 660 | }; // end namespace core |
---|
| 661 | |
---|
| 662 | }; // end namespace behavioural |
---|
| 663 | }; // end namespace morpheo |
---|