[88] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Commit_unit_transition.cpp 134 2009-07-15 08:41:01Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h" |
---|
[110] | 10 | #include "Behavioural/include/Simulation.h" |
---|
[88] | 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | namespace core { |
---|
| 15 | namespace multi_ooo_engine { |
---|
| 16 | namespace ooo_engine { |
---|
| 17 | namespace commit_unit { |
---|
| 18 | |
---|
| 19 | #undef FUNCTION |
---|
| 20 | #define FUNCTION "Commit_unit::transition" |
---|
| 21 | void Commit_unit::transition (void) |
---|
| 22 | { |
---|
| 23 | log_begin(Commit_unit,FUNCTION); |
---|
| 24 | log_function(Commit_unit,FUNCTION,_name.c_str()); |
---|
| 25 | |
---|
| 26 | if (PORT_READ(in_NRESET) == 0) |
---|
| 27 | { |
---|
[100] | 28 | // Clear all bank |
---|
[115] | 29 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
[88] | 30 | { |
---|
[115] | 31 | while(not _rob[i].empty()) |
---|
| 32 | { |
---|
| 33 | delete _rob[i].front(); |
---|
| 34 | _rob[i].pop_front(); |
---|
| 35 | } |
---|
[88] | 36 | reg_BANK_PTR [i] = 0; |
---|
| 37 | } |
---|
| 38 | |
---|
[100] | 39 | // Reset pointer |
---|
[88] | 40 | reg_NUM_BANK_HEAD = 0; |
---|
| 41 | reg_NUM_BANK_TAIL = 0; |
---|
[122] | 42 | reg_NUM_PTR_TAIL = 0; |
---|
[88] | 43 | |
---|
[100] | 44 | // Reset counter |
---|
[88] | 45 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 46 | for (uint32_t j=0; j<_param->_nb_context [i]; j++) |
---|
| 47 | { |
---|
[109] | 48 | _nb_cycle_idle [i][j] = 0; |
---|
| 49 | |
---|
[104] | 50 | reg_NB_INST_COMMIT_ALL [i][j] = 0; |
---|
| 51 | reg_NB_INST_COMMIT_MEM [i][j] = 0; |
---|
| 52 | |
---|
[122] | 53 | reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_NO_EVENT; |
---|
| 54 | // reg_EVENT_FLUSH [i][j] = false; |
---|
[123] | 55 | // reg_EVENT_STOP [i][j] = false; |
---|
[128] | 56 | reg_EVENT_NUM_BANK [i][j] = 0; // not necessary |
---|
| 57 | reg_EVENT_NUM_PTR [i][j] = 0; // not necessary |
---|
| 58 | //reg_EVENT_CAN_RESTART [i][j] = 0; // not necessary |
---|
| 59 | reg_EVENT_PACKET [i][j] = 0; // not necessary |
---|
[124] | 60 | reg_EVENT_NB_INST [i][j] = 0; |
---|
[122] | 61 | reg_EVENT_LAST [i][j] = false; |
---|
[128] | 62 | reg_EVENT_LAST_NUM_BANK [i][j] = 0; // not necessary |
---|
| 63 | reg_EVENT_LAST_NUM_PTR [i][j] = 0; // not necessary |
---|
[100] | 64 | |
---|
[123] | 65 | reg_EVENT_NEXT_STOP [i][j] = false; |
---|
[128] | 66 | reg_EVENT_NEXT_PACKET [i][j] = 0; // not necessary |
---|
[123] | 67 | |
---|
[104] | 68 | // reg_PC_PREVIOUS [i][j] = (0x100-4)>>2; |
---|
| 69 | reg_PC_CURRENT [i][j] = (0x100 )>>2; |
---|
| 70 | reg_PC_CURRENT_IS_DS [i][j] = 0; |
---|
| 71 | reg_PC_CURRENT_IS_DS_TAKE [i][j] = 0; |
---|
[105] | 72 | reg_PC_NEXT [i][j] = (0x100+4)>>2; |
---|
[88] | 73 | } |
---|
| 74 | |
---|
[100] | 75 | // Reset priority algorithm |
---|
[88] | 76 | _priority_insert->reset(); |
---|
| 77 | } |
---|
| 78 | else |
---|
| 79 | { |
---|
[109] | 80 | // Increase number idle cycle |
---|
| 81 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 82 | for (uint32_t j=0; j<_param->_nb_context [i]; j++) |
---|
| 83 | _nb_cycle_idle [i][j] ++; |
---|
| 84 | |
---|
[100] | 85 | // Compute next priority |
---|
[88] | 86 | _priority_insert->transition(); |
---|
| 87 | |
---|
| 88 | // =================================================================== |
---|
[100] | 89 | // =====[ GARBAGE COLLECTOR ]========================================= |
---|
| 90 | // =================================================================== |
---|
| 91 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 92 | for (uint32_t j=0; j<_param->_nb_context [i]; j++) |
---|
[122] | 93 | { |
---|
| 94 | // Test if can_restart : (can_restart is to signal at the state than the decod_queue is empty) |
---|
| 95 | // * no previous can_restart (trap for one) |
---|
| 96 | // * and decod_queue is empty |
---|
| 97 | // * and have an event or have a futur event |
---|
[123] | 98 | // if (not reg_EVENT_CAN_RESTART [i][j] and |
---|
| 99 | // (PORT_READ(in_NB_INST_DECOD_ALL [i][j]) == 0) and |
---|
| 100 | // (reg_EVENT_STOP [i][j] or (reg_EVENT_STATE [i][j] != COMMIT_EVENT_STATE_NO_EVENT))) |
---|
| 101 | // reg_EVENT_CAN_RESTART [i][j] = true; |
---|
[122] | 102 | |
---|
| 103 | // Test event state |
---|
| 104 | switch (reg_EVENT_STATE [i][j]) |
---|
[104] | 105 | { |
---|
[122] | 106 | case COMMIT_EVENT_STATE_EVENT : |
---|
| 107 | { |
---|
| 108 | // Have an event, test if all composant have ack |
---|
| 109 | if (internal_RETIRE_EVENT_VAL [i][j] and in_RETIRE_EVENT_ACK [i][j]) |
---|
| 110 | { |
---|
| 111 | // A minor optimisation : test if wait_decod is previously empty. |
---|
[123] | 112 | // if (not reg_EVENT_CAN_RESTART [i][j]) |
---|
| 113 | // reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_WAIT_DECOD; |
---|
| 114 | // else |
---|
[122] | 115 | reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_WAIT_END; |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | break; |
---|
| 119 | } |
---|
[123] | 120 | // case COMMIT_EVENT_STATE_WAIT_DECOD : |
---|
| 121 | // { |
---|
| 122 | // // Wait flush of decod_queue. |
---|
| 123 | // // Test if can restart now |
---|
| 124 | // if (reg_EVENT_CAN_RESTART [i][j]) |
---|
| 125 | // { |
---|
| 126 | // //reg_EVENT_FLUSH [i][j] = false; |
---|
[122] | 127 | |
---|
[123] | 128 | // // A minor optimisation : test if the last element is already retire |
---|
| 129 | // if (not reg_EVENT_LAST [i][j]) |
---|
| 130 | // reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_WAIT_END; |
---|
| 131 | // else |
---|
| 132 | // reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_END; |
---|
| 133 | // } |
---|
| 134 | // break; |
---|
| 135 | // } |
---|
[124] | 136 | |
---|
| 137 | // case COMMIT_EVENT_STATE_WAIT_END : |
---|
| 138 | // { |
---|
| 139 | // // Wait the flush of Re Order Buffer. |
---|
| 140 | // // Test if the last element is retire |
---|
| 141 | // if (reg_EVENT_LAST [i][j]) |
---|
| 142 | // reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_END ; |
---|
| 143 | |
---|
| 144 | // break; |
---|
| 145 | // } |
---|
| 146 | // case COMMIT_EVENT_STATE_END : |
---|
| 147 | // { |
---|
| 148 | // // Just one cycle |
---|
| 149 | |
---|
| 150 | // // flush of re order buffer is finish |
---|
| 151 | // reg_EVENT_LAST [i][j] = false; |
---|
| 152 | |
---|
| 153 | // if (not reg_EVENT_NEXT_STOP [i][j]) |
---|
| 154 | // reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_NO_EVENT; |
---|
| 155 | // else |
---|
| 156 | // { |
---|
| 157 | // reg_EVENT_NEXT_STOP [i][j] = false; |
---|
| 158 | // reg_EVENT_PACKET [i][j] = reg_EVENT_NEXT_PACKET [i][j]; |
---|
| 159 | // reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_NOT_YET_EVENT; |
---|
| 160 | // // reg_EVENT_STOP [i][j] = true; |
---|
| 161 | // reg_EVENT_LAST_NUM_BANK [i][j] = ((reg_NUM_BANK_TAIL==0)?_param->_nb_bank:reg_NUM_BANK_TAIL)-1; |
---|
| 162 | // reg_EVENT_LAST_NUM_PTR [i][j] = reg_NUM_PTR_TAIL; |
---|
| 163 | // } |
---|
| 164 | |
---|
| 165 | // break; |
---|
| 166 | // } |
---|
| 167 | |
---|
| 168 | |
---|
[122] | 169 | case COMMIT_EVENT_STATE_WAIT_END : |
---|
| 170 | { |
---|
| 171 | // Wait the flush of Re Order Buffer. |
---|
| 172 | // Test if the last element is retire |
---|
| 173 | if (reg_EVENT_LAST [i][j]) |
---|
[124] | 174 | { |
---|
| 175 | // flush of re order buffer is finish |
---|
| 176 | reg_EVENT_LAST [i][j] = false; |
---|
| 177 | |
---|
| 178 | if (not reg_EVENT_NEXT_STOP [i][j]) |
---|
| 179 | reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_NO_EVENT; |
---|
| 180 | else |
---|
| 181 | { |
---|
| 182 | reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_NOT_YET_EVENT; |
---|
[123] | 183 | |
---|
[124] | 184 | reg_EVENT_NEXT_STOP [i][j] = false; |
---|
| 185 | reg_EVENT_PACKET [i][j] = reg_EVENT_NEXT_PACKET [i][j]; |
---|
| 186 | reg_EVENT_NB_INST [i][j] = reg_NB_INST_COMMIT_ALL [i][j]; |
---|
| 187 | //reg_EVENT_STOP [i][j] = true; |
---|
| 188 | reg_EVENT_LAST_NUM_BANK [i][j] = ((reg_NUM_BANK_TAIL==0)?_param->_nb_bank:reg_NUM_BANK_TAIL)-1; |
---|
| 189 | reg_EVENT_LAST_NUM_PTR [i][j] = reg_NUM_PTR_TAIL; |
---|
| 190 | } |
---|
[123] | 191 | } |
---|
[122] | 192 | break; |
---|
| 193 | } |
---|
[124] | 194 | |
---|
[122] | 195 | //case COMMIT_EVENT_STATE_NO_EVENT : |
---|
[123] | 196 | //case COMMIT_EVENT_STATE_NOT_YET_EVENT : |
---|
[122] | 197 | default : break; |
---|
[104] | 198 | } |
---|
[122] | 199 | } |
---|
[100] | 200 | |
---|
| 201 | // =================================================================== |
---|
[88] | 202 | // =====[ INSERT ]==================================================== |
---|
| 203 | // =================================================================== |
---|
[122] | 204 | { |
---|
[124] | 205 | // for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
| 206 | // for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++) |
---|
| 207 | // log_printf(TRACE,Commit_unit,FUNCTION," * INSERT_VAL [%d][%d] : %d",i,j,PORT_READ(in_INSERT_VAL [i][j])); |
---|
| 208 | |
---|
[122] | 209 | // variable to count instruction insert |
---|
| 210 | uint32_t nb_insert = 0; |
---|
[124] | 211 | |
---|
[122] | 212 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 213 | { |
---|
| 214 | // compute first bank number |
---|
| 215 | uint32_t num_bank = (reg_NUM_BANK_TAIL+i)%_param->_nb_bank; |
---|
| 216 | |
---|
| 217 | if (internal_BANK_INSERT_VAL [num_bank]) |
---|
| 218 | { |
---|
| 219 | // get rename unit source and instruction. |
---|
| 220 | uint32_t x = internal_BANK_INSERT_NUM_RENAME_UNIT [num_bank]; |
---|
| 221 | uint32_t y = internal_BANK_INSERT_NUM_INST [num_bank]; |
---|
| 222 | |
---|
| 223 | // Test if an instruction is valid |
---|
| 224 | // (all in_order insert combinatory is in rename_unit ) |
---|
| 225 | if (PORT_READ(in_INSERT_VAL [x][y])) |
---|
| 226 | { |
---|
| 227 | log_printf(TRACE,Commit_unit,FUNCTION," * INSERT [%d][%d]",x,y); |
---|
| 228 | |
---|
| 229 | // get information |
---|
| 230 | Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_INSERT_FRONT_END_ID [x][y]):0; |
---|
| 231 | Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_INSERT_CONTEXT_ID [x][y]):0; |
---|
| 232 | Ttype_t type = PORT_READ(in_INSERT_TYPE [x][y]); |
---|
| 233 | Toperation_t operation = PORT_READ(in_INSERT_OPERATION [x][y]); |
---|
| 234 | bool is_store = is_operation_memory_store(operation); |
---|
| 235 | |
---|
| 236 | Texception_t exception = PORT_READ(in_INSERT_EXCEPTION [x][y]); |
---|
| 237 | Tcontrol_t no_execute = PORT_READ(in_INSERT_NO_EXECUTE [x][y]); |
---|
| 238 | |
---|
| 239 | log_printf(TRACE,Commit_unit,FUNCTION," * front_end_id : %d",front_end_id); |
---|
| 240 | log_printf(TRACE,Commit_unit,FUNCTION," * context_id : %d",context_id); |
---|
| 241 | log_printf(TRACE,Commit_unit,FUNCTION," * type : %s",toString(type).c_str()); |
---|
| 242 | log_printf(TRACE,Commit_unit,FUNCTION," * operation : %d",operation ); |
---|
| 243 | log_printf(TRACE,Commit_unit,FUNCTION," * exception : %d",exception ); |
---|
| 244 | |
---|
| 245 | // Create new entry and write information |
---|
| 246 | entry_t * entry = new entry_t; |
---|
| 247 | uint32_t ptr = reg_BANK_PTR [num_bank]; |
---|
[88] | 248 | |
---|
[122] | 249 | entry->ptr = ptr; |
---|
| 250 | entry->front_end_id = front_end_id; |
---|
| 251 | entry->context_id = context_id ; |
---|
| 252 | entry->rename_unit_id = x; |
---|
| 253 | entry->depth = (_param->_have_port_depth)?PORT_READ(in_INSERT_DEPTH [x][y]):0; |
---|
| 254 | entry->type = type; |
---|
| 255 | entry->operation = operation; |
---|
| 256 | entry->is_delay_slot = PORT_READ(in_INSERT_IS_DELAY_SLOT [x][y]); |
---|
| 257 | // entry->address = PORT_READ(in_INSERT_ADDRESS [x][y]); |
---|
| 258 | entry->exception = exception; |
---|
| 259 | entry->exception_use = PORT_READ(in_INSERT_EXCEPTION_USE [x][y]); |
---|
| 260 | entry->use_store_queue = (type == TYPE_MEMORY) and ( is_store) and (not no_execute); |
---|
| 261 | entry->use_load_queue = (type == TYPE_MEMORY) and (not is_store) and (not no_execute); |
---|
| 262 | entry->store_queue_ptr_write = PORT_READ(in_INSERT_STORE_QUEUE_PTR_WRITE [x][y]); |
---|
| 263 | entry->load_queue_ptr_write = (_param->_have_port_load_queue_ptr)?PORT_READ(in_INSERT_LOAD_QUEUE_PTR_WRITE [x][y]):0; |
---|
| 264 | #ifdef DEBUG |
---|
| 265 | entry->read_ra = PORT_READ(in_INSERT_READ_RA [x][y]); |
---|
| 266 | entry->num_reg_ra_log = PORT_READ(in_INSERT_NUM_REG_RA_LOG [x][y]); |
---|
| 267 | entry->num_reg_ra_phy = PORT_READ(in_INSERT_NUM_REG_RA_PHY [x][y]); |
---|
| 268 | entry->read_rb = PORT_READ(in_INSERT_READ_RB [x][y]); |
---|
| 269 | entry->num_reg_rb_log = PORT_READ(in_INSERT_NUM_REG_RB_LOG [x][y]); |
---|
| 270 | entry->num_reg_rb_phy = PORT_READ(in_INSERT_NUM_REG_RB_PHY [x][y]); |
---|
| 271 | entry->read_rc = PORT_READ(in_INSERT_READ_RC [x][y]); |
---|
| 272 | entry->num_reg_rc_log = PORT_READ(in_INSERT_NUM_REG_RC_LOG [x][y]); |
---|
| 273 | entry->num_reg_rc_phy = PORT_READ(in_INSERT_NUM_REG_RC_PHY [x][y]); |
---|
| 274 | #endif |
---|
| 275 | entry->write_rd = PORT_READ(in_INSERT_WRITE_RD [x][y]); |
---|
| 276 | entry->num_reg_rd_log = PORT_READ(in_INSERT_NUM_REG_RD_LOG [x][y]); |
---|
| 277 | entry->num_reg_rd_phy_old = PORT_READ(in_INSERT_NUM_REG_RD_PHY_OLD [x][y]); |
---|
| 278 | entry->num_reg_rd_phy_new = PORT_READ(in_INSERT_NUM_REG_RD_PHY_NEW [x][y]); |
---|
| 279 | entry->write_re = PORT_READ(in_INSERT_WRITE_RE [x][y]); |
---|
| 280 | entry->num_reg_re_log = PORT_READ(in_INSERT_NUM_REG_RE_LOG [x][y]); |
---|
| 281 | entry->num_reg_re_phy_old = PORT_READ(in_INSERT_NUM_REG_RE_PHY_OLD [x][y]); |
---|
| 282 | entry->num_reg_re_phy_new = PORT_READ(in_INSERT_NUM_REG_RE_PHY_NEW [x][y]); |
---|
[128] | 283 | |
---|
| 284 | entry->flags = 0; // not necessary |
---|
[122] | 285 | entry->no_sequence = type == TYPE_BRANCH; |
---|
[124] | 286 | // entry->speculative = true; |
---|
[122] | 287 | #ifdef DEBUG |
---|
| 288 | entry->address = PORT_READ(in_INSERT_ADDRESS [x][y]); |
---|
[128] | 289 | #else |
---|
| 290 | entry->address = 0; // not necessary |
---|
[122] | 291 | #endif |
---|
| 292 | entry->address_next = PORT_READ(in_INSERT_ADDRESS_NEXT [x][y]); |
---|
| 293 | #ifdef DEBUG |
---|
| 294 | entry->cycle_rob_in = simulation_cycle(); |
---|
| 295 | entry->cycle_commit = simulation_cycle(); |
---|
| 296 | #endif |
---|
| 297 | |
---|
| 298 | // Test if exception : |
---|
| 299 | // * yes : no execute instruction, wait ROB Head |
---|
| 300 | // * no : test if no_execute (== instruction is flushed) |
---|
| 301 | // else test type |
---|
| 302 | // * BRANCH : l.j -> branch is ended |
---|
| 303 | // other -> wait the execution end of branchment |
---|
| 304 | // * MEMORY : store -> wait store is at head of ROB |
---|
| 305 | // other -> wait end of instruction |
---|
| 306 | // * OTHER |
---|
| 307 | |
---|
| 308 | { |
---|
| 309 | if (exception == EXCEPTION_NONE) |
---|
| 310 | { |
---|
| 311 | // no_execute : l.j, l.nop, l.rfe |
---|
| 312 | |
---|
| 313 | log_printf(TRACE,Commit_unit,FUNCTION," * no_execute : %d",no_execute); |
---|
| 314 | |
---|
| 315 | switch (type) |
---|
| 316 | { |
---|
| 317 | case TYPE_BRANCH : {entry->state=(no_execute==1)?ROB_BRANCH_COMPLETE:ROB_BRANCH_WAIT_END ; break;} |
---|
| 318 | case TYPE_MEMORY : {entry->state=(no_execute==1)?ROB_END_OK_SPECULATIVE:(entry->state=(is_store ==1)?ROB_STORE_WAIT_END_OK:ROB_OTHER_WAIT_END); break;} |
---|
| 319 | default : {entry->state=(no_execute==1)?ROB_END_OK_SPECULATIVE:ROB_OTHER_WAIT_END; break;} |
---|
| 320 | } |
---|
| 321 | } |
---|
| 322 | else |
---|
| 323 | { |
---|
| 324 | // Have an exception : wait head of ROB |
---|
| 325 | // in_INSERT_NO_EXECUTE [x][y] : l.sys, l.trap |
---|
| 326 | |
---|
| 327 | entry->state = ROB_END_EXCEPTION_WAIT_HEAD; |
---|
| 328 | } |
---|
| 329 | } |
---|
[100] | 330 | |
---|
[122] | 331 | #ifdef STATISTICS |
---|
| 332 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 333 | (*_stat_nb_inst_insert [x]) ++; |
---|
[121] | 334 | #endif |
---|
[122] | 335 | |
---|
| 336 | // Push entry in rob |
---|
| 337 | _rob[num_bank].push_back(entry); |
---|
| 338 | |
---|
| 339 | // Update counter and pointer |
---|
| 340 | reg_NB_INST_COMMIT_ALL [front_end_id][context_id] ++; |
---|
| 341 | if (type == TYPE_MEMORY) |
---|
| 342 | reg_NB_INST_COMMIT_MEM [front_end_id][context_id] ++; |
---|
| 343 | |
---|
[88] | 344 | |
---|
[122] | 345 | // flush = present event or future event. |
---|
| 346 | // * present event = don't can restart |
---|
[88] | 347 | |
---|
[122] | 348 | // bool flush = reg_EVENT_FLUSH [front_end_id][context_id]; |
---|
[88] | 349 | |
---|
[122] | 350 | // bool flush = (((reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_EVENT) or |
---|
| 351 | // (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_DECOD)) or |
---|
| 352 | // (reg_EVENT_STOP [front_end_id][context_id])); |
---|
| 353 | |
---|
| 354 | // New instruction from decod_queue. Flush if : |
---|
| 355 | // * future event (instruction don't need execute because they are a previous event (miss load/branch or exception)) |
---|
| 356 | // * or present_event |
---|
| 357 | // * and not can_restart (previous empty decod queue), because between the event_stop (branch_complete) and the state event (miss in head), many cycle is occured. |
---|
[123] | 358 | // bool flush = ((// present event |
---|
| 359 | // ((reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_EVENT) or |
---|
| 360 | // (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_DECOD) |
---|
| 361 | // ) or |
---|
| 362 | // futur event |
---|
| 363 | // reg_EVENT_STOP [front_end_id][context_id]) |
---|
| 364 | // // can't restart |
---|
| 365 | // and not reg_EVENT_CAN_RESTART[front_end_id][context_id] |
---|
| 366 | // ); |
---|
[100] | 367 | |
---|
[123] | 368 | // if (flush) |
---|
| 369 | // { |
---|
| 370 | // // A new invalid instruction is push in rob -> new last instruction |
---|
| 371 | // reg_EVENT_LAST [front_end_id][context_id] = false; |
---|
| 372 | // reg_EVENT_LAST_NUM_BANK [front_end_id][context_id] = num_bank; |
---|
| 373 | // reg_EVENT_LAST_NUM_PTR [front_end_id][context_id] = ptr; |
---|
| 374 | // } |
---|
[122] | 375 | |
---|
| 376 | // Update pointer |
---|
| 377 | reg_NUM_PTR_TAIL = ptr; |
---|
| 378 | reg_BANK_PTR [num_bank] = (reg_BANK_PTR [num_bank]+1)%_param->_size_bank; |
---|
| 379 | nb_insert ++; |
---|
[108] | 380 | } |
---|
[122] | 381 | } |
---|
| 382 | } |
---|
| 383 | // Update pointer |
---|
| 384 | reg_NUM_BANK_TAIL = (reg_NUM_BANK_TAIL+nb_insert)%_param->_nb_bank; |
---|
| 385 | } |
---|
[88] | 386 | |
---|
| 387 | // =================================================================== |
---|
| 388 | // =====[ COMMIT ]==================================================== |
---|
| 389 | // =================================================================== |
---|
| 390 | |
---|
| 391 | #ifdef STATISTICS |
---|
| 392 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 393 | (*_stat_nb_inst_commit_conflit_access) += internal_BANK_COMMIT_CONFLIT_ACCESS; |
---|
| 394 | #endif |
---|
| 395 | |
---|
[122] | 396 | // For each commit instruction ... |
---|
[88] | 397 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 398 | for (uint32_t j=0; j<_param->_nb_bank_access_commit; j++) |
---|
[122] | 399 | // ... test if an instruction have finish this execution |
---|
[88] | 400 | if (internal_BANK_COMMIT_VAL [i][j]) |
---|
| 401 | { |
---|
[122] | 402 | // An instruction is executed -> Change state of this instruction |
---|
[100] | 403 | |
---|
[122] | 404 | // Get information |
---|
[88] | 405 | uint32_t x = internal_BANK_COMMIT_NUM_INST [i][j]; |
---|
| 406 | |
---|
[122] | 407 | // Test if instruction is valid and is enable |
---|
| 408 | // (can be disable if this instruction is reexecute) |
---|
[88] | 409 | if (PORT_READ(in_COMMIT_VAL [x]) and PORT_READ(in_COMMIT_WEN [x])) |
---|
| 410 | { |
---|
| 411 | log_printf(TRACE,Commit_unit,FUNCTION," * COMMIT [%d]",x); |
---|
| 412 | |
---|
| 413 | #ifdef STATISTICS |
---|
| 414 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 415 | (*_stat_nb_inst_commit) ++; |
---|
| 416 | #endif |
---|
| 417 | |
---|
[124] | 418 | log_printf(TRACE,Commit_unit,FUNCTION," * num_bank : %d",i); |
---|
[88] | 419 | |
---|
| 420 | // find the good entry !!! |
---|
[100] | 421 | entry_t * entry = internal_BANK_COMMIT_ENTRY [i][j]; |
---|
[123] | 422 | |
---|
[124] | 423 | log_printf(TRACE,Commit_unit,FUNCTION," * ptr : %d",entry->ptr); |
---|
[100] | 424 | |
---|
| 425 | //Toperation_t operation = PORT_READ(in_COMMIT_OPERATION [x]); |
---|
[122] | 426 | Ttype_t type = entry->type; |
---|
| 427 | Tcontrol_t no_sequence = PORT_READ(in_COMMIT_NO_SEQUENCE [x]); |
---|
| 428 | |
---|
| 429 | #if 0 |
---|
| 430 | if ((type == TYPE_MEMORY) and no_sequence) |
---|
| 431 | continue; |
---|
| 432 | #endif |
---|
| 433 | |
---|
[100] | 434 | Texception_t exception = PORT_READ(in_COMMIT_EXCEPTION [x]); |
---|
[88] | 435 | |
---|
[100] | 436 | rob_state_t state = entry->state; |
---|
| 437 | Tcontext_t front_end_id = entry->front_end_id; |
---|
| 438 | Tcontext_t context_id = entry->context_id; |
---|
[88] | 439 | |
---|
[100] | 440 | // change state : test exception_use |
---|
[88] | 441 | |
---|
[100] | 442 | bool have_exception = false; |
---|
| 443 | bool have_miss_speculation = false; |
---|
| 444 | |
---|
[122] | 445 | // Test if have an exception ... |
---|
[88] | 446 | if (exception != EXCEPTION_NONE) |
---|
[100] | 447 | { |
---|
[122] | 448 | // Test if the instruction is a load and is a miss speculation |
---|
| 449 | // (load is commit, but they have an dependence with a previous store -> need restart pipeline) |
---|
| 450 | |
---|
[100] | 451 | have_miss_speculation = (exception == EXCEPTION_MEMORY_MISS_SPECULATION); |
---|
[88] | 452 | |
---|
[122] | 453 | // * Test if the exception generated can be trap by this exception |
---|
[100] | 454 | switch (entry->exception_use) |
---|
| 455 | { |
---|
| 456 | // Have overflow exception if bit overflow enable is set. |
---|
| 457 | case EXCEPTION_USE_RANGE : {have_exception = ((exception == EXCEPTION_RANGE) and PORT_READ(in_SPR_READ_SR_OVE[front_end_id][context_id])); break;} |
---|
| 458 | case EXCEPTION_USE_MEMORY_WITH_ALIGNMENT : {have_exception = ((exception == EXCEPTION_BUS_ERROR) or |
---|
| 459 | (exception == EXCEPTION_DATA_TLB ) or |
---|
| 460 | (exception == EXCEPTION_DATA_PAGE) or |
---|
| 461 | (exception == EXCEPTION_ALIGNMENT)); break;}; |
---|
| 462 | case EXCEPTION_USE_MEMORY_WITHOUT_ALIGNMENT : {have_exception = ((exception == EXCEPTION_BUS_ERROR) or |
---|
| 463 | (exception == EXCEPTION_DATA_TLB ) or |
---|
| 464 | (exception == EXCEPTION_DATA_PAGE)); break;}; |
---|
| 465 | case EXCEPTION_USE_CUSTOM_0 : {have_exception = (exception == EXCEPTION_CUSTOM_0); break;}; |
---|
| 466 | case EXCEPTION_USE_CUSTOM_1 : {have_exception = (exception == EXCEPTION_CUSTOM_1); break;}; |
---|
| 467 | case EXCEPTION_USE_CUSTOM_2 : {have_exception = (exception == EXCEPTION_CUSTOM_2); break;}; |
---|
| 468 | case EXCEPTION_USE_CUSTOM_3 : {have_exception = (exception == EXCEPTION_CUSTOM_3); break;}; |
---|
| 469 | case EXCEPTION_USE_CUSTOM_4 : {have_exception = (exception == EXCEPTION_CUSTOM_4); break;}; |
---|
| 470 | case EXCEPTION_USE_CUSTOM_5 : {have_exception = (exception == EXCEPTION_CUSTOM_5); break;}; |
---|
| 471 | case EXCEPTION_USE_CUSTOM_6 : {have_exception = (exception == EXCEPTION_CUSTOM_6); break;}; |
---|
| 472 | // Case already manage (decod stage -> in insert in ROB) |
---|
| 473 | case EXCEPTION_USE_TRAP : {have_exception = false; exception = EXCEPTION_NONE; break;}; |
---|
| 474 | case EXCEPTION_USE_NONE : {have_exception = false; exception = EXCEPTION_NONE; break;}; |
---|
| 475 | case EXCEPTION_USE_ILLEGAL_INSTRUCTION : {have_exception = false; exception = EXCEPTION_NONE; break;}; |
---|
| 476 | case EXCEPTION_USE_SYSCALL : {have_exception = false; exception = EXCEPTION_NONE; break;}; |
---|
| 477 | default : |
---|
| 478 | { |
---|
| 479 | throw ERRORMORPHEO(FUNCTION,_("Commit : invalid exception_use.\n")); |
---|
| 480 | break; |
---|
| 481 | } |
---|
| 482 | } |
---|
| 483 | } |
---|
[124] | 484 | |
---|
| 485 | log_printf(TRACE,Commit_unit,FUNCTION," * have_exception : %d",have_exception ); |
---|
| 486 | log_printf(TRACE,Commit_unit,FUNCTION," * have_miss_speculation : %d",have_miss_speculation); |
---|
| 487 | |
---|
[100] | 488 | |
---|
[122] | 489 | // Next state depends of previous state |
---|
[100] | 490 | switch (state) |
---|
| 491 | { |
---|
[122] | 492 | // Branch : if no exception, the branchement can be completed |
---|
| 493 | case ROB_BRANCH_WAIT_END : |
---|
| 494 | { |
---|
| 495 | if (not have_exception) |
---|
| 496 | state = ROB_BRANCH_COMPLETE; |
---|
| 497 | else |
---|
| 498 | state = ROB_END_EXCEPTION_WAIT_HEAD; |
---|
| 499 | break; |
---|
| 500 | } |
---|
| 501 | // Previous event -> set state as execute |
---|
| 502 | case ROB_STORE_KO_WAIT_END : |
---|
| 503 | case ROB_EVENT_WAIT_END : |
---|
| 504 | { |
---|
| 505 | state = ROB_END_KO_SPECULATIVE; |
---|
| 506 | break; |
---|
| 507 | } |
---|
| 508 | // No previous event - Load and other instruction |
---|
| 509 | case ROB_STORE_OK_WAIT_END : |
---|
| 510 | case ROB_OTHER_WAIT_END : |
---|
| 511 | { |
---|
| 512 | if (not have_exception) |
---|
| 513 | { |
---|
| 514 | if (not have_miss_speculation) |
---|
| 515 | state = ROB_END_OK_SPECULATIVE; |
---|
| 516 | else |
---|
| 517 | state = ROB_END_LOAD_MISS_SPECULATIVE; |
---|
| 518 | } |
---|
| 519 | else |
---|
| 520 | state = ROB_END_EXCEPTION_WAIT_HEAD; |
---|
| 521 | break; |
---|
| 522 | } |
---|
| 523 | case ROB_STORE_WAIT_END_OK : |
---|
| 524 | { |
---|
| 525 | if (not have_exception) |
---|
| 526 | state = ROB_STORE_OK; |
---|
| 527 | else |
---|
| 528 | state = ROB_STORE_EVENT; |
---|
| 529 | break; |
---|
| 530 | } |
---|
| 531 | case ROB_STORE_WAIT_END_KO : |
---|
| 532 | { |
---|
| 533 | // if (not have_exception) |
---|
| 534 | state = ROB_STORE_KO; |
---|
| 535 | // else |
---|
| 536 | // state = ROB_END_EXCEPTION_WAIT_HEAD; |
---|
| 537 | break; |
---|
| 538 | } |
---|
| 539 | |
---|
| 540 | |
---|
[100] | 541 | default : |
---|
| 542 | { |
---|
[115] | 543 | throw ERRORMORPHEO(FUNCTION,toString(_("Commit [%d] : Bank [%d][%d], invalid state value (%s).\n"),x,i,j,toString(state).c_str())); |
---|
[100] | 544 | break; |
---|
| 545 | } |
---|
| 546 | } |
---|
[88] | 547 | |
---|
[122] | 548 | // Commit an instruction ... |
---|
[123] | 549 | // Test if have an event (miss_speculation or exception) |
---|
[112] | 550 | |
---|
[123] | 551 | if (have_exception or have_miss_speculation) |
---|
[122] | 552 | { |
---|
[123] | 553 | // Two case : |
---|
| 554 | // if no previous manage event -> generate an event |
---|
| 555 | // if previous manage event -> next generate an event |
---|
| 556 | |
---|
| 557 | // bool flush = reg_EVENT_FLUSH [front_end_id][context_id]; |
---|
| 558 | bool flush = ((reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_EVENT) or |
---|
| 559 | // (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_DECOD) or |
---|
[124] | 560 | (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_END)// or |
---|
| 561 | // (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_END) |
---|
[123] | 562 | ); |
---|
| 563 | |
---|
[122] | 564 | uint32_t packet = ((entry->ptr << _param->_shift_num_slot) | i); |
---|
[123] | 565 | uint32_t _top = ((_rob[ reg_NUM_BANK_HEAD].front()->ptr << _param->_shift_num_slot) | reg_NUM_BANK_HEAD); |
---|
[124] | 566 | |
---|
| 567 | log_printf(TRACE,Commit_unit,FUNCTION," * flush : %d",flush); |
---|
| 568 | log_printf(TRACE,Commit_unit,FUNCTION," * packet : %d",packet); |
---|
[123] | 569 | |
---|
| 570 | if (not flush) |
---|
[122] | 571 | { |
---|
[123] | 572 | bool can = true; |
---|
| 573 | // test have a previous event detected (event_stop = 1) |
---|
| 574 | // if yes, test if the actual event if "before (in order)" that the previous event |
---|
| 575 | if (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_NOT_YET_EVENT) |
---|
| 576 | { |
---|
| 577 | // Compare packet_id (by construction instruction is insert in order by increase packet_id) |
---|
| 578 | |
---|
| 579 | uint32_t _old = reg_EVENT_PACKET [front_end_id][context_id]; |
---|
| 580 | uint32_t _new = packet; |
---|
| 581 | if (_old < _top) _old = _old+_param->_size_queue; |
---|
| 582 | if (_new < _top) _new = _new+_param->_size_queue; |
---|
| 583 | if (_new < _old) reg_EVENT_PACKET [front_end_id][context_id] = packet; |
---|
| 584 | else can = false; |
---|
| 585 | } |
---|
| 586 | else |
---|
| 587 | reg_EVENT_PACKET [front_end_id][context_id] = packet; |
---|
| 588 | |
---|
| 589 | if (can) |
---|
| 590 | { |
---|
| 591 | // have an error, stop issue instruction |
---|
| 592 | reg_EVENT_STATE [front_end_id][context_id] = COMMIT_EVENT_STATE_NOT_YET_EVENT; |
---|
[124] | 593 | |
---|
| 594 | reg_EVENT_NB_INST [front_end_id][context_id] = reg_NB_INST_COMMIT_ALL [front_end_id][context_id]; |
---|
| 595 | |
---|
| 596 | //reg_EVENT_STOP [front_end_id][context_id] = true; |
---|
[123] | 597 | |
---|
| 598 | reg_EVENT_LAST_NUM_BANK [front_end_id][context_id] = ((reg_NUM_BANK_TAIL==0)?_param->_nb_bank:reg_NUM_BANK_TAIL)-1; |
---|
| 599 | reg_EVENT_LAST_NUM_PTR [front_end_id][context_id] = reg_NUM_PTR_TAIL; |
---|
| 600 | } |
---|
[122] | 601 | } |
---|
| 602 | else |
---|
[123] | 603 | { |
---|
| 604 | bool find = true; |
---|
[122] | 605 | |
---|
[124] | 606 | log_printf(TRACE,Commit_unit,FUNCTION," * reg_EVENT_NEXT_STOP : %d",reg_EVENT_NEXT_STOP [front_end_id][context_id]); |
---|
| 607 | log_printf(TRACE,Commit_unit,FUNCTION," * reg_EVENT_NEXT_PACKET : %d",reg_EVENT_NEXT_PACKET[front_end_id][context_id]); |
---|
| 608 | |
---|
[123] | 609 | // already manage an event. |
---|
| 610 | if (reg_EVENT_NEXT_STOP [front_end_id][context_id]) |
---|
| 611 | { |
---|
| 612 | // after last ? |
---|
| 613 | uint32_t _old = reg_EVENT_NEXT_PACKET [front_end_id][context_id]; |
---|
| 614 | uint32_t _new = packet; |
---|
[124] | 615 | |
---|
| 616 | log_printf(TRACE,Commit_unit,FUNCTION," * _top : %d",_top ); |
---|
| 617 | log_printf(TRACE,Commit_unit,FUNCTION," * _old (before) : %d",_old ); |
---|
| 618 | log_printf(TRACE,Commit_unit,FUNCTION," * _new (before) : %d",_new ); |
---|
| 619 | |
---|
[123] | 620 | if (_old < _top) _old = _old+_param->_size_queue; |
---|
| 621 | if (_new < _top) _new = _new+_param->_size_queue; |
---|
| 622 | if (_new > _old) reg_EVENT_NEXT_PACKET [front_end_id][context_id] = packet; |
---|
[124] | 623 | else find = false; |
---|
| 624 | |
---|
| 625 | log_printf(TRACE,Commit_unit,FUNCTION," * _old (after) : %d",_old ); |
---|
| 626 | log_printf(TRACE,Commit_unit,FUNCTION," * _new (after) : %d",_new ); |
---|
[123] | 627 | } |
---|
| 628 | else |
---|
| 629 | { |
---|
| 630 | // after last ? |
---|
| 631 | uint32_t _old = ((reg_EVENT_LAST_NUM_PTR [front_end_id][context_id] << _param->_shift_num_slot) | reg_EVENT_LAST_NUM_BANK [front_end_id][context_id]); |
---|
| 632 | uint32_t _new = packet; |
---|
[124] | 633 | |
---|
| 634 | log_printf(TRACE,Commit_unit,FUNCTION," * _top : %d",_top ); |
---|
| 635 | log_printf(TRACE,Commit_unit,FUNCTION," * _old (before) : %d",_old ); |
---|
| 636 | log_printf(TRACE,Commit_unit,FUNCTION," * _new (before) : %d",_new ); |
---|
| 637 | |
---|
[123] | 638 | if (_old < _top) _old = _old+_param->_size_queue; |
---|
| 639 | if (_new < _top) _new = _new+_param->_size_queue; |
---|
| 640 | if (_new > _old) reg_EVENT_NEXT_PACKET [front_end_id][context_id] = packet; |
---|
[124] | 641 | else find = false; |
---|
| 642 | |
---|
| 643 | log_printf(TRACE,Commit_unit,FUNCTION," * _old (after) : %d",_old ); |
---|
| 644 | log_printf(TRACE,Commit_unit,FUNCTION," * _new (after) : %d",_new ); |
---|
[123] | 645 | } |
---|
| 646 | |
---|
[124] | 647 | log_printf(TRACE,Commit_unit,FUNCTION," * find : %d",find); |
---|
| 648 | |
---|
[123] | 649 | if (find) |
---|
| 650 | reg_EVENT_NEXT_STOP [front_end_id][context_id] = true; // in all case : need stop |
---|
| 651 | } |
---|
[122] | 652 | } |
---|
[123] | 653 | |
---|
[122] | 654 | // Update Re Order Buffer |
---|
[105] | 655 | entry->state = state; |
---|
| 656 | entry->exception = exception; |
---|
| 657 | entry->flags = PORT_READ(in_COMMIT_FLAGS [x]); |
---|
[122] | 658 | entry->no_sequence = no_sequence; |
---|
[105] | 659 | // jalr, jr : address_dest is in register |
---|
[122] | 660 | if (( type == TYPE_BRANCH) and |
---|
[105] | 661 | (entry->operation == OPERATION_BRANCH_L_JALR) and |
---|
| 662 | (entry->read_rb)) |
---|
| 663 | entry->address_next = PORT_READ(in_COMMIT_ADDRESS [x]); |
---|
[111] | 664 | |
---|
| 665 | #ifdef DEBUG |
---|
[122] | 666 | entry->load_data = PORT_READ(in_COMMIT_ADDRESS [x]); |
---|
| 667 | entry->cycle_commit = simulation_cycle(); |
---|
[111] | 668 | #endif |
---|
[88] | 669 | } |
---|
| 670 | } |
---|
| 671 | |
---|
| 672 | // =================================================================== |
---|
| 673 | // =====[ RETIRE ]==================================================== |
---|
| 674 | // =================================================================== |
---|
| 675 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
[110] | 676 | { |
---|
[122] | 677 | // Compute bank number |
---|
[110] | 678 | uint32_t num_bank = (internal_BANK_RETIRE_HEAD+i)%_param->_nb_bank; |
---|
| 679 | |
---|
[122] | 680 | // Test if have an request |
---|
[110] | 681 | if (internal_BANK_RETIRE_VAL [num_bank]) |
---|
| 682 | { |
---|
[122] | 683 | // Take num instruction |
---|
[110] | 684 | uint32_t x = internal_BANK_RETIRE_NUM_RENAME_UNIT [num_bank]; |
---|
| 685 | uint32_t y = internal_BANK_RETIRE_NUM_INST [num_bank]; |
---|
| 686 | |
---|
| 687 | log_printf(TRACE,Commit_unit,FUNCTION," * RETIRE [%d][%d]",x,y); |
---|
[112] | 688 | log_printf(TRACE,Commit_unit,FUNCTION," * num_bank : %d",num_bank ); |
---|
[110] | 689 | |
---|
[88] | 690 | #ifdef DEBUG_TEST |
---|
[110] | 691 | if (not PORT_READ(in_RETIRE_ACK [x][y])) |
---|
| 692 | throw ERRORMORPHEO(FUNCTION,_("Retire : retire_ack must be set.\n")); |
---|
[88] | 693 | #endif |
---|
| 694 | |
---|
| 695 | |
---|
[122] | 696 | #ifdef STATISTICS |
---|
| 697 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 698 | (*_stat_nb_inst_retire [x]) ++; |
---|
[110] | 699 | |
---|
[111] | 700 | #endif |
---|
[110] | 701 | |
---|
[122] | 702 | // Read information |
---|
| 703 | entry_t * entry = _rob [num_bank].front(); |
---|
[105] | 704 | |
---|
[122] | 705 | entry->state_old = entry->state; |
---|
| 706 | entry->state = ROB_END; |
---|
[110] | 707 | } |
---|
| 708 | } |
---|
[109] | 709 | |
---|
[122] | 710 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
[88] | 711 | { |
---|
[122] | 712 | // Compute bank number |
---|
| 713 | bool can_continue = false; |
---|
| 714 | uint32_t num_bank = reg_NUM_BANK_HEAD; |
---|
| 715 | |
---|
| 716 | if (not _rob [num_bank].empty ()) |
---|
| 717 | { |
---|
| 718 | entry_t * entry = _rob [num_bank].front(); |
---|
| 719 | |
---|
| 720 | if (entry->state == ROB_END) |
---|
| 721 | { |
---|
| 722 | log_printf(TRACE,Commit_unit,FUNCTION," * RETIRE_ROB [%d]",num_bank); |
---|
| 723 | |
---|
| 724 | can_continue = true; |
---|
[101] | 725 | |
---|
[122] | 726 | Tcontext_t front_end_id = entry->front_end_id; |
---|
| 727 | Tcontext_t context_id = entry->context_id ; |
---|
| 728 | uint32_t num_thread = _param->_translate_num_context_to_num_thread [front_end_id][context_id]; |
---|
| 729 | rob_state_t state = entry->state_old; |
---|
| 730 | Ttype_t type = entry->type ; |
---|
| 731 | bool retire_ok = false; |
---|
| 732 | uint32_t packet_id = ((entry->ptr << _param->_shift_num_slot) | num_bank); |
---|
| 733 | |
---|
| 734 | log_printf(TRACE,Commit_unit,FUNCTION," * front_end_id : %d",front_end_id ); |
---|
| 735 | log_printf(TRACE,Commit_unit,FUNCTION," * context_id : %d",context_id ); |
---|
| 736 | log_printf(TRACE,Commit_unit,FUNCTION," * rob_ptr : %d",packet_id ); |
---|
| 737 | log_printf(TRACE,Commit_unit,FUNCTION," * num_thread : %d",num_thread ); |
---|
| 738 | log_printf(TRACE,Commit_unit,FUNCTION," * type : %s",toString(type).c_str()); |
---|
| 739 | log_printf(TRACE,Commit_unit,FUNCTION," * state : %s",toString(state).c_str()); |
---|
| 740 | |
---|
| 741 | // Test if the instruction is valid |
---|
| 742 | // (BRANCH_MISS = instruction branch is valid, but have make an invalid prediction) |
---|
| 743 | // (LOAD_MISS = instruction load is valid, but have make an invalid result) |
---|
| 744 | if ((state == ROB_END_OK ) or |
---|
| 745 | // (state == ROB_END_KO ) or |
---|
| 746 | (state == ROB_END_BRANCH_MISS) or |
---|
| 747 | (state == ROB_END_LOAD_MISS )// or |
---|
| 748 | // (state == ROB_END_MISS ) or |
---|
| 749 | // (state == ROB_END_EXCEPTION ) |
---|
| 750 | ) |
---|
| 751 | { |
---|
| 752 | log_printf(TRACE,Commit_unit,FUNCTION," * retire_ok"); |
---|
| 753 | |
---|
| 754 | retire_ok = true; |
---|
| 755 | |
---|
| 756 | // Update PC information |
---|
| 757 | // reg_PC_PREVIOUS [front_end_id][context_id] = reg_PC_CURRENT [front_end_id][context_id]; |
---|
| 758 | reg_PC_CURRENT [front_end_id][context_id] = reg_PC_NEXT [front_end_id][context_id]; |
---|
| 759 | reg_PC_CURRENT_IS_DS [front_end_id][context_id] = type == TYPE_BRANCH; |
---|
| 760 | reg_PC_CURRENT_IS_DS_TAKE [front_end_id][context_id] = entry->no_sequence; |
---|
| 761 | reg_PC_NEXT [front_end_id][context_id] = (entry->no_sequence)?(entry->address_next):(reg_PC_CURRENT [front_end_id][context_id]+1); |
---|
| 762 | } |
---|
| 763 | |
---|
| 764 | // Test if have an event |
---|
| 765 | if ((state == ROB_END_BRANCH_MISS) or |
---|
| 766 | (state == ROB_END_LOAD_MISS)) |
---|
| 767 | { |
---|
| 768 | reg_EVENT_STATE [front_end_id][context_id] = COMMIT_EVENT_STATE_EVENT; |
---|
[123] | 769 | // reg_EVENT_STOP [front_end_id][context_id] = false; // instruction flow can continue |
---|
[122] | 770 | reg_EVENT_LAST [front_end_id][context_id] = false; |
---|
| 771 | // it the head ! |
---|
| 772 | reg_EVENT_PACKET [front_end_id][context_id] = packet_id; |
---|
| 773 | |
---|
[123] | 774 | // // If event is an load_miss, many instruction can be inserted. |
---|
| 775 | // // -> new last instruction |
---|
| 776 | // if (state == ROB_END_LOAD_MISS) |
---|
| 777 | // { |
---|
| 778 | // // reg_EVENT_CAN_RESTART [front_end_id][context_id] = false; |
---|
[122] | 779 | |
---|
[123] | 780 | // reg_EVENT_LAST_NUM_BANK [front_end_id][context_id] = ((reg_NUM_BANK_TAIL==0)?_param->_nb_bank:reg_NUM_BANK_TAIL)-1; |
---|
| 781 | // reg_EVENT_LAST_NUM_PTR [front_end_id][context_id] = reg_NUM_PTR_TAIL; |
---|
| 782 | // } |
---|
[122] | 783 | } |
---|
| 784 | |
---|
| 785 | // Test if this instruction is the last instruction of an event |
---|
| 786 | // * need event |
---|
| 787 | // * packet id = last packet id |
---|
[124] | 788 | // for (uint32_t x=0; x<_param->_nb_front_end; x++) |
---|
| 789 | // for (uint32_t y=0; y<_param->_nb_context [x]; y++) |
---|
| 790 | // if (((reg_EVENT_STATE [x][y] != COMMIT_EVENT_STATE_NO_EVENT ) and |
---|
| 791 | // (reg_EVENT_STATE [x][y] != COMMIT_EVENT_STATE_NOT_YET_EVENT)) and |
---|
| 792 | // (reg_EVENT_LAST_NUM_BANK [x][y] == num_bank ) and |
---|
| 793 | // (reg_EVENT_LAST_NUM_PTR [x][y] == entry->ptr )) |
---|
| 794 | // reg_EVENT_LAST [x][y] = true; |
---|
| 795 | |
---|
| 796 | |
---|
| 797 | if (reg_EVENT_NB_INST [front_end_id][context_id] > 0) |
---|
| 798 | { |
---|
| 799 | reg_EVENT_NB_INST [front_end_id][context_id] --; |
---|
| 800 | if (reg_EVENT_NB_INST [front_end_id][context_id] == 0) |
---|
| 801 | reg_EVENT_LAST [front_end_id][context_id] = true; |
---|
| 802 | } |
---|
| 803 | |
---|
[122] | 804 | // Update nb_inst |
---|
| 805 | reg_NB_INST_COMMIT_ALL [front_end_id][context_id] --; |
---|
| 806 | if (type == TYPE_MEMORY) |
---|
| 807 | reg_NB_INST_COMMIT_MEM [front_end_id][context_id] --; |
---|
| 808 | |
---|
| 809 | // Update pointer |
---|
| 810 | reg_NUM_BANK_HEAD = (num_bank+1)%_param->_nb_bank; |
---|
| 811 | |
---|
| 812 | // Reset watch dog timer because have transaction on retire interface |
---|
| 813 | _nb_cycle_idle [front_end_id][context_id] = 0; |
---|
| 814 | |
---|
| 815 | // Increase stop condition |
---|
| 816 | if (retire_ok) |
---|
| 817 | _simulation_nb_instruction_commited [num_thread] ++; |
---|
[88] | 818 | |
---|
[122] | 819 | #ifdef STATISTICS |
---|
| 820 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 821 | { |
---|
| 822 | if (retire_ok) |
---|
| 823 | { |
---|
| 824 | (*_stat_nb_inst_retire_ok [num_thread]) ++; |
---|
| 825 | (*_stat_nb_inst_type [type] ) ++; |
---|
| 826 | } |
---|
| 827 | else |
---|
| 828 | (*_stat_nb_inst_retire_ko [num_thread]) ++; |
---|
| 829 | } |
---|
| 830 | #endif |
---|
[88] | 831 | |
---|
[122] | 832 | #if defined(DEBUG) and defined(DEBUG_Commit_unit) and (DEBUG_Commit_unit == true) |
---|
[134] | 833 | if (log_file_generate) |
---|
| 834 | { |
---|
| 835 | // log file |
---|
| 836 | instruction_log_file [num_thread] |
---|
| 837 | << "[" << simulation_cycle() << "] " |
---|
| 838 | << std::hex |
---|
| 839 | << (entry->address<<2) << " (" << (entry->address) << ") " |
---|
| 840 | << std::dec |
---|
| 841 | << "[" << entry->cycle_rob_in << ", " << entry->cycle_commit << "] " |
---|
| 842 | << "{" << ((retire_ok)?"OK":"KO") << "} "; |
---|
| 843 | |
---|
| 844 | if ((type == TYPE_MEMORY) and is_operation_memory_load(entry->operation)) |
---|
| 845 | instruction_log_file [num_thread] << std::hex << entry->load_data << std::dec; |
---|
| 846 | |
---|
| 847 | instruction_log_file [num_thread] << std::endl; |
---|
| 848 | } |
---|
[122] | 849 | #endif |
---|
[123] | 850 | |
---|
| 851 | // Remove entry |
---|
| 852 | delete entry; |
---|
| 853 | _rob [num_bank].pop_front(); |
---|
[122] | 854 | } |
---|
[88] | 855 | } |
---|
[122] | 856 | |
---|
| 857 | if (not can_continue) |
---|
| 858 | break; // stop scan |
---|
[88] | 859 | } |
---|
| 860 | |
---|
| 861 | // =================================================================== |
---|
[122] | 862 | // =====[ REEXECUTE ]================================================= |
---|
| 863 | // =================================================================== |
---|
| 864 | // Test if have an reexecute instruction (an store in head of rob) |
---|
| 865 | for (uint32_t i=0; i<_param->_nb_inst_reexecute; ++i) |
---|
| 866 | if (internal_REEXECUTE_VAL [i] and PORT_READ(in_REEXECUTE_ACK [i])) |
---|
| 867 | { |
---|
| 868 | log_printf(TRACE,Commit_unit,FUNCTION," * REEXECUTE [%d]",i); |
---|
| 869 | |
---|
| 870 | uint32_t num_bank = internal_REEXECUTE_NUM_BANK [i]; |
---|
| 871 | |
---|
| 872 | entry_t * entry = _rob [num_bank].front(); |
---|
| 873 | rob_state_t state = entry->state; |
---|
| 874 | |
---|
| 875 | // Change state |
---|
| 876 | switch (state) |
---|
| 877 | { |
---|
| 878 | case ROB_STORE_OK : {state = ROB_STORE_OK_WAIT_END; break; } |
---|
| 879 | case ROB_STORE_KO : {state = ROB_STORE_KO_WAIT_END; break; } |
---|
| 880 | case ROB_STORE_EVENT : {state = ROB_EVENT_WAIT_END; break; } |
---|
| 881 | default : {throw ERRORMORPHEO(FUNCTION,_("Reexecute : invalid state value.\n"));} |
---|
| 882 | } |
---|
| 883 | |
---|
| 884 | entry->state = state; |
---|
| 885 | } |
---|
| 886 | |
---|
| 887 | // =================================================================== |
---|
[88] | 888 | // =====[ BRANCH_COMPLETE ]=========================================== |
---|
| 889 | // =================================================================== |
---|
| 890 | for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++) |
---|
[122] | 891 | // Test if the prediction_unit have accept the branch complete transaction |
---|
[88] | 892 | if (internal_BRANCH_COMPLETE_VAL [i] and PORT_READ(in_BRANCH_COMPLETE_ACK [i])) |
---|
| 893 | { |
---|
[101] | 894 | log_printf(TRACE,Commit_unit,FUNCTION," * BRANCH_COMPLETE [%d]",i); |
---|
| 895 | |
---|
[122] | 896 | // Read information |
---|
[88] | 897 | uint32_t num_bank = internal_BRANCH_COMPLETE_NUM_BANK [i]; |
---|
| 898 | |
---|
| 899 | entry_t * entry = _rob [num_bank].front(); |
---|
| 900 | |
---|
| 901 | #ifdef DEBUG_TEST |
---|
| 902 | rob_state_t state = entry->state; |
---|
| 903 | if (state != ROB_BRANCH_COMPLETE) |
---|
| 904 | throw ERRORMORPHEO(FUNCTION,_("Branch_complete : Invalid state value.\n")); |
---|
| 905 | #endif |
---|
[112] | 906 | Tcontrol_t miss = PORT_READ(in_BRANCH_COMPLETE_MISS_PREDICTION [i]); |
---|
[122] | 907 | |
---|
| 908 | log_printf(TRACE,Commit_unit,FUNCTION," * miss_prediction : %d",miss); |
---|
[112] | 909 | |
---|
| 910 | entry->state = (miss)?ROB_END_BRANCH_MISS_SPECULATIVE:ROB_END_OK_SPECULATIVE; |
---|
[88] | 911 | |
---|
[122] | 912 | // bool flush = reg_EVENT_FLUSH [entry->front_end_id][entry->context_id]; |
---|
[112] | 913 | |
---|
[122] | 914 | // Branch_complete can be execute if |
---|
| 915 | // * no present event |
---|
| 916 | // * futur event and most not speculative that the event |
---|
| 917 | |
---|
| 918 | // Also, test if in this cycle, they have not an most recently event !!! |
---|
| 919 | if (miss) |
---|
| 920 | { |
---|
[123] | 921 | bool can = true; |
---|
[122] | 922 | uint32_t packet = ((entry->ptr << _param->_shift_num_slot) | num_bank); |
---|
| 923 | |
---|
| 924 | // test if this packet is before previous event |
---|
[123] | 925 | if (reg_EVENT_STATE [entry->front_end_id][entry->context_id] == COMMIT_EVENT_STATE_NOT_YET_EVENT) |
---|
[122] | 926 | { |
---|
| 927 | uint32_t _top = ((_rob[ reg_NUM_BANK_HEAD].front()->ptr << _param->_shift_num_slot) | reg_NUM_BANK_HEAD); |
---|
| 928 | uint32_t _old = reg_EVENT_PACKET [entry->front_end_id][entry->context_id]; |
---|
| 929 | uint32_t _new = packet; |
---|
| 930 | if (_old < _top) _old = _old+_param->_size_queue; |
---|
| 931 | if (_new < _top) _new = _new+_param->_size_queue; |
---|
| 932 | if (_new < _old) reg_EVENT_PACKET [entry->front_end_id][entry->context_id] = packet; |
---|
[123] | 933 | else can = false; |
---|
[122] | 934 | } |
---|
| 935 | else |
---|
| 936 | reg_EVENT_PACKET [entry->front_end_id][entry->context_id] = packet; |
---|
| 937 | |
---|
[123] | 938 | if (can) |
---|
| 939 | { |
---|
| 940 | // In all case, stop instruction flow |
---|
| 941 | reg_EVENT_STATE [entry->front_end_id][entry->context_id] = COMMIT_EVENT_STATE_NOT_YET_EVENT; |
---|
[124] | 942 | reg_EVENT_NB_INST [entry->front_end_id][entry->context_id] = reg_NB_INST_COMMIT_ALL [entry->front_end_id][entry->context_id]; |
---|
| 943 | |
---|
[123] | 944 | // reg_EVENT_STOP [entry->front_end_id][entry->context_id] = true; |
---|
[122] | 945 | |
---|
[123] | 946 | // reg_EVENT_CAN_RESTART [entry->front_end_id][entry->context_id] = false; |
---|
[122] | 947 | |
---|
[123] | 948 | reg_EVENT_LAST_NUM_BANK [entry->front_end_id][entry->context_id] = ((reg_NUM_BANK_TAIL==0)?_param->_nb_bank:reg_NUM_BANK_TAIL)-1; |
---|
| 949 | reg_EVENT_LAST_NUM_PTR [entry->front_end_id][entry->context_id] = reg_NUM_PTR_TAIL; |
---|
| 950 | } |
---|
[122] | 951 | } |
---|
[88] | 952 | } |
---|
| 953 | |
---|
| 954 | // =================================================================== |
---|
[100] | 955 | // =====[ UPDATE ]==================================================== |
---|
| 956 | // =================================================================== |
---|
[122] | 957 | // Update when exception or load_miss |
---|
[105] | 958 | if (internal_UPDATE_VAL and PORT_READ(in_UPDATE_ACK)) |
---|
| 959 | { |
---|
| 960 | log_printf(TRACE,Commit_unit,FUNCTION," * UPDATE"); |
---|
[100] | 961 | |
---|
[122] | 962 | // Change state |
---|
[105] | 963 | entry_t * entry = _rob [internal_UPDATE_NUM_BANK].front(); |
---|
| 964 | |
---|
| 965 | switch (entry->state) |
---|
| 966 | { |
---|
| 967 | // case ROB_END_EXCEPTION_UPDATE : |
---|
| 968 | // { |
---|
| 969 | // entry->state = ROB_END_KO; |
---|
| 970 | // throw ERRORMORPHEO(FUNCTION,_("Moore : exception is not yet supported (Coming Soon).\n")); |
---|
| 971 | // break; |
---|
| 972 | // } |
---|
| 973 | case ROB_END_LOAD_MISS_UPDATE : |
---|
| 974 | { |
---|
| 975 | log_printf(TRACE,Commit_unit,FUNCTION," * ROB_END_LOAD_MISS_UPDATE"); |
---|
| 976 | |
---|
| 977 | entry->state = ROB_END_LOAD_MISS; |
---|
| 978 | break; |
---|
| 979 | } |
---|
| 980 | default : |
---|
| 981 | { |
---|
| 982 | throw ERRORMORPHEO(FUNCTION,_("Update : invalid state.\n")); |
---|
| 983 | break; |
---|
| 984 | } |
---|
| 985 | } |
---|
| 986 | } |
---|
| 987 | |
---|
[100] | 988 | // =================================================================== |
---|
[88] | 989 | // =====[ EVENT ]===================================================== |
---|
| 990 | // =================================================================== |
---|
[108] | 991 | // for (uint32_t i=0; i < _param->_nb_front_end; ++i) |
---|
| 992 | // for (uint32_t j=0; j < _param->_nb_context[i]; ++j) |
---|
| 993 | // if (PORT_READ(in_EVENT_VAL [i][j]) and internal_EVENT_ACK [i][j]) |
---|
| 994 | // { |
---|
| 995 | // log_printf(TRACE,Commit_unit,FUNCTION," * EVENT [%d][%d]",i,j); |
---|
[88] | 996 | |
---|
[108] | 997 | // reg_PC_CURRENT [i][j] = PORT_READ(in_EVENT_ADDRESS [i][j]); |
---|
| 998 | // reg_PC_CURRENT_IS_DS [i][j] = PORT_READ(in_EVENT_IS_DS_TAKE [i][j]); // ?? |
---|
| 999 | // reg_PC_CURRENT_IS_DS_TAKE [i][j] = PORT_READ(in_EVENT_IS_DS_TAKE [i][j]); |
---|
| 1000 | // reg_PC_NEXT [i][j] = PORT_READ(in_EVENT_ADDRESS_NEXT [i][j]); |
---|
| 1001 | // // PORT_READ(in_EVENT_ADDRESS_NEXT_VAL [i][j]); |
---|
| 1002 | // } |
---|
| 1003 | |
---|
[88] | 1004 | // =================================================================== |
---|
| 1005 | // =====[ DEPTH - HEAD ]============================================== |
---|
| 1006 | // =================================================================== |
---|
| 1007 | |
---|
[122] | 1008 | { |
---|
[124] | 1009 | bool can_continue [_param->_nb_front_end][_param->_max_nb_context]; |
---|
| 1010 | uint32_t event_nb_inst [_param->_nb_front_end][_param->_max_nb_context]; |
---|
| 1011 | bool is_speculative [_param->_nb_front_end][_param->_max_nb_context]; |
---|
[122] | 1012 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 1013 | for (uint32_t j=0; j<_param->_nb_context [i]; j++) |
---|
[124] | 1014 | { |
---|
| 1015 | event_nb_inst [i][j] = 0; |
---|
| 1016 | is_speculative[i][j] = false; |
---|
| 1017 | can_continue [i][j] = (((reg_EVENT_NB_INST [i][j] == 0) or |
---|
| 1018 | ( event_nb_inst [i][j] < reg_EVENT_NB_INST [i][j])) and |
---|
| 1019 | not reg_EVENT_LAST [i][j]); |
---|
| 1020 | } |
---|
[122] | 1021 | |
---|
| 1022 | // Read all instruction of all top bank |
---|
| 1023 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 1024 | { |
---|
| 1025 | uint32_t num_bank = (reg_NUM_BANK_HEAD+i)%_param->_nb_bank; |
---|
[88] | 1026 | |
---|
[122] | 1027 | // Test if have an instruction |
---|
| 1028 | if (not _rob[num_bank].empty()) |
---|
| 1029 | { |
---|
| 1030 | // Scan all instruction in windows and test if instruction is speculative |
---|
| 1031 | entry_t * entry = _rob [num_bank].front(); |
---|
[124] | 1032 | |
---|
| 1033 | uint32_t num_packet = ((entry->ptr << _param->_shift_num_slot) | num_bank); |
---|
[122] | 1034 | Tcontext_t front_end_id = entry->front_end_id; |
---|
| 1035 | Tcontext_t context_id = entry->context_id ; |
---|
[124] | 1036 | |
---|
| 1037 | log_printf(TRACE,Commit_unit,FUNCTION," * HEAD [%d] - %d",num_bank,num_packet); |
---|
| 1038 | log_printf(TRACE,Commit_unit,FUNCTION," * front_end_id : %d",front_end_id); |
---|
| 1039 | log_printf(TRACE,Commit_unit,FUNCTION," * context_id : %d",context_id); |
---|
| 1040 | log_printf(TRACE,Commit_unit,FUNCTION," * EVENT_LAST : %d",reg_EVENT_LAST [front_end_id][context_id]); |
---|
| 1041 | log_printf(TRACE,Commit_unit,FUNCTION," * EVENT_NB_INST : %d",reg_EVENT_NB_INST [front_end_id][context_id]); |
---|
| 1042 | log_printf(TRACE,Commit_unit,FUNCTION," * event_nb_inst : %d", event_nb_inst [front_end_id][context_id]); |
---|
[122] | 1043 | |
---|
| 1044 | // scan while last event instruction is not retire |
---|
[124] | 1045 | if (can_continue [front_end_id][context_id]) |
---|
[122] | 1046 | { |
---|
| 1047 | // Read information |
---|
| 1048 | rob_state_t state = entry->state; |
---|
| 1049 | Tdepth_t depth = entry->depth; |
---|
| 1050 | |
---|
| 1051 | Tdepth_t depth_min = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN[front_end_id][context_id]):0; |
---|
| 1052 | Tdepth_t depth_max = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MAX[front_end_id][context_id]):0; |
---|
| 1053 | Tcontrol_t depth_full = PORT_READ(in_DEPTH_FULL [front_end_id][context_id]); |
---|
| 1054 | |
---|
| 1055 | // is a valid instruction ? |
---|
| 1056 | // If DEPTH_CURRENT : |
---|
| 1057 | // equal at DEPTH_MIN -> not speculative |
---|
| 1058 | // not include ]DEPTH_MIN:DEPTH_MAX] -> previous branch miss |
---|
| 1059 | // include ]DEPTH_MIN:DEPTH_MAX] -> speculative |
---|
| 1060 | |
---|
| 1061 | // All case |
---|
| 1062 | // ....... min ...X... max ....... OK |
---|
| 1063 | // ....... min ....... max ...X... KO |
---|
| 1064 | // ...X... min ....... max ....... KO |
---|
| 1065 | // ....... max ....... min ...X... OK |
---|
| 1066 | // ...X... max ....... min ....... OK |
---|
| 1067 | // ....... max ...X... min ....... KO |
---|
| 1068 | |
---|
| 1069 | bool flush = ((reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_EVENT) or |
---|
[123] | 1070 | // (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_DECOD) or |
---|
[122] | 1071 | (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_END)); |
---|
[124] | 1072 | bool speculative = is_speculative [front_end_id][context_id]; |
---|
| 1073 | |
---|
| 1074 | // bool speculative = entry->speculative and not (depth == depth_min); |
---|
| 1075 | // Tcontrol_t is_valid = ((not speculative or |
---|
| 1076 | // (speculative and (depth_full or // all is valid |
---|
| 1077 | // ((depth_min <= depth_max)? // test if depth is overflow |
---|
| 1078 | // ((depth >= depth_min) and (depth <=depth_max)): |
---|
| 1079 | // ((depth >= depth_min) or (depth <=depth_max)))))) |
---|
| 1080 | // and not flush); // no event |
---|
| 1081 | |
---|
| 1082 | Tcontrol_t is_valid = not flush; |
---|
| 1083 | |
---|
| 1084 | |
---|
[122] | 1085 | //Tcontrol_t is_valid = ((depth == depth_min) and not flush); |
---|
| 1086 | |
---|
| 1087 | |
---|
| 1088 | log_printf(TRACE,Commit_unit,FUNCTION," * is_valid : %d ((depth == depth_min) and not flush)",is_valid); |
---|
| 1089 | log_printf(TRACE,Commit_unit,FUNCTION," * depth : %d",depth ); |
---|
| 1090 | log_printf(TRACE,Commit_unit,FUNCTION," * depth_min : %d",depth_min); |
---|
| 1091 | log_printf(TRACE,Commit_unit,FUNCTION," * depth_max : %d",depth_max); |
---|
| 1092 | log_printf(TRACE,Commit_unit,FUNCTION," * depth_full : %d",depth_full); |
---|
| 1093 | log_printf(TRACE,Commit_unit,FUNCTION," * speculative : %d",speculative); |
---|
| 1094 | log_printf(TRACE,Commit_unit,FUNCTION," * flush : %d",flush); |
---|
[124] | 1095 | log_printf(TRACE,Commit_unit,FUNCTION," * state (before) : %s",toString(state).c_str()); |
---|
| 1096 | |
---|
| 1097 | // //------------------------------------------------------ |
---|
| 1098 | // // Event ? |
---|
| 1099 | // //------------------------------------------------------ |
---|
| 1100 | |
---|
| 1101 | // if ((reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_NOT_YET_EVENT) and |
---|
| 1102 | // (reg_EVENT_PACKET [front_end_id][context_id] == num_packet)) |
---|
| 1103 | // { |
---|
| 1104 | // switch (state) |
---|
| 1105 | // { |
---|
| 1106 | // case ROB_END_BRANCH_MISS_SPECULATIVE : {state = ROB_END_BRANCH_MISS ; break;} |
---|
| 1107 | // case ROB_END_LOAD_MISS_SPECULATIVE : {state = ROB_END_LOAD_MISS_UPDATE ; break;} |
---|
| 1108 | // case ROB_END_BRANCH_MISS : |
---|
| 1109 | // case ROB_END_LOAD_MISS : |
---|
| 1110 | // case ROB_END : |
---|
| 1111 | // {break;} |
---|
| 1112 | // default : |
---|
| 1113 | // { |
---|
| 1114 | // throw ERRORMORPHEO(FUNCTION,toString(_("Head [%d] : invalid state (%s)"),num_packet,toString(state).c_str())); |
---|
| 1115 | // break; |
---|
| 1116 | // } |
---|
| 1117 | // } |
---|
| 1118 | // } |
---|
[122] | 1119 | |
---|
| 1120 | //------------------------------------------------------ |
---|
| 1121 | // test if instruction is miss speculative |
---|
| 1122 | //------------------------------------------------------ |
---|
| 1123 | if (not is_valid) |
---|
| 1124 | { |
---|
| 1125 | // Change state |
---|
| 1126 | switch (state) |
---|
| 1127 | { |
---|
| 1128 | case ROB_BRANCH_WAIT_END : {state = ROB_EVENT_WAIT_END; break;} |
---|
| 1129 | case ROB_BRANCH_COMPLETE : {state = ROB_END_MISS ; break;} |
---|
| 1130 | case ROB_END_BRANCH_MISS : |
---|
| 1131 | case ROB_END_BRANCH_MISS_SPECULATIVE : {state = ROB_END_MISS ; break;} |
---|
[124] | 1132 | case ROB_END_LOAD_MISS : |
---|
[122] | 1133 | case ROB_END_LOAD_MISS_UPDATE : |
---|
| 1134 | case ROB_END_LOAD_MISS_SPECULATIVE : {state = ROB_END_MISS ; break;} |
---|
| 1135 | case ROB_STORE_OK : {state = ROB_STORE_KO ; break;} |
---|
| 1136 | case ROB_STORE_WAIT_END_OK : {state = ROB_STORE_WAIT_END_KO; break;} |
---|
| 1137 | case ROB_STORE_OK_WAIT_END : {state = ROB_STORE_KO_WAIT_END; break;} |
---|
| 1138 | case ROB_OTHER_WAIT_END : {state = ROB_EVENT_WAIT_END; break;} |
---|
| 1139 | case ROB_END_OK : |
---|
| 1140 | case ROB_END_OK_SPECULATIVE : {state = ROB_END_MISS ; break;} |
---|
| 1141 | case ROB_END_KO : |
---|
| 1142 | case ROB_END_KO_SPECULATIVE : {state = ROB_END_MISS ; break;} |
---|
| 1143 | case ROB_END_EXCEPTION_UPDATE : |
---|
| 1144 | case ROB_END_EXCEPTION : |
---|
| 1145 | case ROB_END_EXCEPTION_WAIT_HEAD : {state = ROB_END_MISS ; break;} |
---|
| 1146 | |
---|
| 1147 | // don't change state -> wait |
---|
| 1148 | case ROB_STORE_WAIT_END_KO : {break;} |
---|
| 1149 | case ROB_STORE_KO : {break;} |
---|
| 1150 | case ROB_STORE_KO_WAIT_END : {break;} |
---|
| 1151 | case ROB_STORE_EVENT : {break;} |
---|
| 1152 | case ROB_EVENT_WAIT_END : {break;} |
---|
| 1153 | case ROB_END_MISS : {break;} |
---|
| 1154 | case ROB_END : {break;} |
---|
| 1155 | |
---|
| 1156 | // can't have miss speculation -> invalid state |
---|
| 1157 | default : |
---|
| 1158 | { |
---|
| 1159 | throw ERRORMORPHEO(FUNCTION,toString(_("Miss Speculation : Invalide state : %s.\n"),toString(state).c_str())); |
---|
| 1160 | break; |
---|
| 1161 | } |
---|
| 1162 | } |
---|
| 1163 | } |
---|
[124] | 1164 | |
---|
| 1165 | //------------------------------------------------------ |
---|
| 1166 | // test if instruction is branch not finish |
---|
| 1167 | //------------------------------------------------------ |
---|
| 1168 | switch (state) |
---|
| 1169 | { |
---|
| 1170 | case ROB_BRANCH_WAIT_END : |
---|
| 1171 | case ROB_BRANCH_COMPLETE : |
---|
| 1172 | { |
---|
| 1173 | is_speculative [front_end_id][context_id] = true; |
---|
| 1174 | break; |
---|
| 1175 | } |
---|
| 1176 | default : break; |
---|
| 1177 | } |
---|
[122] | 1178 | |
---|
| 1179 | //------------------------------------------------------ |
---|
| 1180 | // test if instruction is not speculative |
---|
| 1181 | //------------------------------------------------------ |
---|
[124] | 1182 | // entry->speculative = speculative; |
---|
[122] | 1183 | // if (entry->depth == depth_min) |
---|
| 1184 | // test if instruction is speculative (depth != depth_min) |
---|
| 1185 | if (not speculative) |
---|
| 1186 | { |
---|
| 1187 | switch (state) |
---|
| 1188 | { |
---|
| 1189 | case ROB_END_OK_SPECULATIVE : {state = ROB_END_OK ; break;} |
---|
| 1190 | case ROB_END_KO_SPECULATIVE : {state = ROB_END_KO ; break;} |
---|
| 1191 | case ROB_END_BRANCH_MISS_SPECULATIVE : {state = ROB_END_BRANCH_MISS ; break;} |
---|
| 1192 | case ROB_END_LOAD_MISS_SPECULATIVE : {state = ROB_END_LOAD_MISS_UPDATE ; break;} |
---|
| 1193 | default : {break;} // else, no change |
---|
| 1194 | } |
---|
| 1195 | } |
---|
| 1196 | |
---|
| 1197 | //------------------------------------------------------ |
---|
| 1198 | // test if instruction wait head and is the top of rob |
---|
| 1199 | //------------------------------------------------------ |
---|
| 1200 | // TODO : retire OOO |
---|
| 1201 | if (i == 0) |
---|
| 1202 | { |
---|
| 1203 | switch (state) |
---|
| 1204 | { |
---|
| 1205 | // case ROB_STORE_WAIT_HEAD_OK : {state = ROB_STORE_HEAD_OK; break;} |
---|
| 1206 | case ROB_END_EXCEPTION_WAIT_HEAD : {state = ROB_END_EXCEPTION_UPDATE; break;} |
---|
| 1207 | default : {break;} // else, no change |
---|
| 1208 | } |
---|
| 1209 | } |
---|
| 1210 | |
---|
| 1211 | // Write new state |
---|
| 1212 | entry->state = state; |
---|
[124] | 1213 | |
---|
| 1214 | log_printf(TRACE,Commit_unit,FUNCTION," * state (after ) : %s",toString(state).c_str()); |
---|
[122] | 1215 | |
---|
[124] | 1216 | // log_printf(TRACE,Commit_unit,FUNCTION," * Stop Scan !!!"); |
---|
[122] | 1217 | |
---|
[124] | 1218 | event_nb_inst [front_end_id][context_id] ++; |
---|
| 1219 | |
---|
| 1220 | // stop if : |
---|
| 1221 | // * begin event |
---|
| 1222 | // * end event |
---|
| 1223 | if (((reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_NOT_YET_EVENT) and |
---|
| 1224 | (reg_EVENT_PACKET[front_end_id][context_id] == num_packet)) or |
---|
| 1225 | ((reg_EVENT_NB_INST [front_end_id][context_id] > 0) and |
---|
| 1226 | ( event_nb_inst [front_end_id][context_id] >= reg_EVENT_NB_INST [front_end_id][context_id]))) |
---|
| 1227 | can_continue [front_end_id][context_id] = false; |
---|
[122] | 1228 | } |
---|
| 1229 | } |
---|
| 1230 | } |
---|
| 1231 | } |
---|
[105] | 1232 | |
---|
| 1233 | |
---|
[101] | 1234 | |
---|
[122] | 1235 | #ifdef STATISTICS |
---|
[124] | 1236 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 1237 | { |
---|
| 1238 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 1239 | *(_stat_bank_nb_inst [i]) += _rob[i].size(); |
---|
| 1240 | |
---|
| 1241 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 1242 | for (uint32_t j=0; j<_param->_nb_context [i]; j++) |
---|
| 1243 | { |
---|
| 1244 | uint32_t num_thread = _param->_translate_num_context_to_num_thread [i][j]; |
---|
| 1245 | |
---|
| 1246 | switch (reg_EVENT_STATE [i][j]) |
---|
| 1247 | { |
---|
| 1248 | case COMMIT_EVENT_STATE_NO_EVENT : (*_stat_nb_cycle_state_no_event [num_thread])++; break; |
---|
| 1249 | case COMMIT_EVENT_STATE_NOT_YET_EVENT : (*_stat_nb_cycle_state_not_yet_event [num_thread])++; break; |
---|
| 1250 | case COMMIT_EVENT_STATE_EVENT : (*_stat_nb_cycle_state_event [num_thread])++; break; |
---|
| 1251 | case COMMIT_EVENT_STATE_WAIT_END : (*_stat_nb_cycle_state_wait_end [num_thread])++; break; |
---|
| 1252 | } |
---|
| 1253 | } |
---|
| 1254 | } |
---|
[122] | 1255 | #endif |
---|
[88] | 1256 | } |
---|
| 1257 | |
---|
| 1258 | // =================================================================== |
---|
| 1259 | // =====[ OTHER ]===================================================== |
---|
| 1260 | // =================================================================== |
---|
| 1261 | |
---|
[108] | 1262 | #if (DEBUG >= DEBUG_TRACE) and (DEBUG_Commit_unit == true) |
---|
| 1263 | { |
---|
| 1264 | log_printf(TRACE,Commit_unit,FUNCTION," * Dump ROB (Re-Order-Buffer)"); |
---|
| 1265 | log_printf(TRACE,Commit_unit,FUNCTION," * num_bank_head : %d",reg_NUM_BANK_HEAD); |
---|
| 1266 | log_printf(TRACE,Commit_unit,FUNCTION," * num_bank_tail : %d",reg_NUM_BANK_TAIL); |
---|
[122] | 1267 | log_printf(TRACE,Commit_unit,FUNCTION," * num_ptr_tail : %d",reg_NUM_PTR_TAIL ); |
---|
[108] | 1268 | |
---|
| 1269 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 1270 | for (uint32_t j=0; j<_param->_nb_context [i]; j++) |
---|
| 1271 | { |
---|
[110] | 1272 | log_printf(TRACE,Commit_unit,FUNCTION," * [%d][%d] - %d",i,j,_param->_translate_num_context_to_num_thread [i][j]); |
---|
[122] | 1273 | log_printf(TRACE,Commit_unit,FUNCTION," * EVENT_STATE : %s - %s",toString(reg_EVENT_STATE [i][j]).c_str(),toString(commit_event_state_to_event_state(reg_EVENT_STATE [i][j])).c_str()); |
---|
| 1274 | // log_printf(TRACE,Commit_unit,FUNCTION," * EVENT_FLUSH : %d",reg_EVENT_FLUSH [i][j]); |
---|
[123] | 1275 | // log_printf(TRACE,Commit_unit,FUNCTION," * EVENT_STOP : %d",reg_EVENT_STOP [i][j]); |
---|
| 1276 | // log_printf(TRACE,Commit_unit,FUNCTION," * EVENT : %d (bank %d, ptr %d)",((reg_EVENT_NUM_PTR [i][j] << _param->_shift_num_slot) | reg_EVENT_NUM_BANK [i][j]), reg_EVENT_NUM_BANK [i][j],reg_EVENT_NUM_PTR [i][j]); |
---|
| 1277 | // log_printf(TRACE,Commit_unit,FUNCTION," * EVENT_CAN_RESTART : %d",reg_EVENT_CAN_RESTART [i][j]); |
---|
[124] | 1278 | log_printf(TRACE,Commit_unit,FUNCTION," * EVENT_LAST : %d - packet %d - ptr %d (bank %d, ptr %d)",reg_EVENT_LAST [i][j],reg_EVENT_PACKET[i][j],((reg_EVENT_LAST_NUM_PTR [i][j] << _param->_shift_num_slot) | reg_EVENT_LAST_NUM_BANK [i][j]), reg_EVENT_LAST_NUM_BANK [i][j],reg_EVENT_LAST_NUM_PTR [i][j]); |
---|
| 1279 | log_printf(TRACE,Commit_unit,FUNCTION," * EVENT_NEXT : stop : %d - packet : %d",reg_EVENT_NEXT_STOP [i][j],reg_EVENT_NEXT_PACKET[i][j]); |
---|
| 1280 | log_printf(TRACE,Commit_unit,FUNCTION," * NB_INST_ALL : all : %d - mem : %d - event : %d",reg_NB_INST_COMMIT_ALL[i][j], reg_NB_INST_COMMIT_MEM[i][j],reg_EVENT_NB_INST[i][j]); |
---|
| 1281 | log_printf(TRACE,Commit_unit,FUNCTION," * PC : %.8x (%.8x) - %d %d - %.8x (%.8x)",reg_PC_CURRENT [i][j],reg_PC_CURRENT [i][j]<<2, reg_PC_CURRENT_IS_DS [i][j], reg_PC_CURRENT_IS_DS_TAKE [i][j],reg_PC_NEXT [i][j],reg_PC_NEXT [i][j]<<2); |
---|
[108] | 1282 | } |
---|
| 1283 | |
---|
[122] | 1284 | std::list<entry_t*>::iterator iter [_param->_nb_bank]; |
---|
[108] | 1285 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
[104] | 1286 | { |
---|
[108] | 1287 | uint32_t num_bank = (reg_NUM_BANK_HEAD+i)%_param->_nb_bank; |
---|
[122] | 1288 | // log_printf(TRACE,Commit_unit,FUNCTION," * Bank [%d] size : %d, ptr : %d",num_bank,(int)_rob[num_bank].size(), reg_BANK_PTR [i]); |
---|
[108] | 1289 | |
---|
[122] | 1290 | iter [num_bank] = _rob[num_bank].begin(); |
---|
| 1291 | } |
---|
| 1292 | |
---|
[123] | 1293 | bool all_empty = false; |
---|
| 1294 | uint32_t nb_write_rd = 0; |
---|
| 1295 | uint32_t nb_write_re = 0; |
---|
| 1296 | |
---|
[122] | 1297 | while (not all_empty) |
---|
| 1298 | { |
---|
| 1299 | all_empty = true; |
---|
[108] | 1300 | |
---|
[122] | 1301 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
[108] | 1302 | { |
---|
[122] | 1303 | uint32_t num_bank = (reg_NUM_BANK_HEAD+i)%_param->_nb_bank; |
---|
| 1304 | |
---|
| 1305 | std::list<entry_t*>::iterator it = iter[num_bank]; |
---|
| 1306 | if (it != _rob[num_bank].end()) |
---|
| 1307 | { |
---|
| 1308 | all_empty = false; |
---|
| 1309 | |
---|
[123] | 1310 | nb_write_rd += ((*it)->write_rd)?1:0; |
---|
| 1311 | nb_write_re += ((*it)->write_re)?1:0; |
---|
| 1312 | |
---|
[124] | 1313 | log_printf(TRACE,Commit_unit,FUNCTION," [%.4d][%.4d] %.4d %.4d %.4d %.4d, %.3d %.3d, %.1d, %.1d %.4d, %.1d %.4d, %s", |
---|
[122] | 1314 | num_bank , |
---|
| 1315 | (*it)->ptr , |
---|
| 1316 | (*it)->front_end_id , |
---|
| 1317 | (*it)->context_id , |
---|
| 1318 | (*it)->rename_unit_id , |
---|
| 1319 | (*it)->depth , |
---|
| 1320 | (*it)->type , |
---|
| 1321 | (*it)->operation , |
---|
| 1322 | (*it)->is_delay_slot , |
---|
| 1323 | (*it)->use_store_queue , |
---|
| 1324 | (*it)->store_queue_ptr_write , |
---|
| 1325 | (*it)->use_load_queue , |
---|
| 1326 | (*it)->load_queue_ptr_write , |
---|
| 1327 | toString((*it)->state).c_str() ); |
---|
[124] | 1328 | log_printf(TRACE,Commit_unit,FUNCTION," (%.4d) %.1d %.2d %.6d, %.1d %.2d %.6d, %.1d %.1d %.6d, %.1d %.2d %.6d %.6d, %.1d %.1d %.6d %.6d ", |
---|
| 1329 | (((*it)->ptr << _param->_shift_num_slot) | num_bank), |
---|
[122] | 1330 | (*it)->read_ra , |
---|
| 1331 | (*it)->num_reg_ra_log , |
---|
| 1332 | (*it)->num_reg_ra_phy , |
---|
| 1333 | (*it)->read_rb , |
---|
| 1334 | (*it)->num_reg_rb_log , |
---|
| 1335 | (*it)->num_reg_rb_phy , |
---|
| 1336 | (*it)->read_rc , |
---|
| 1337 | (*it)->num_reg_rc_log , |
---|
| 1338 | (*it)->num_reg_rc_phy , |
---|
| 1339 | (*it)->write_rd , |
---|
| 1340 | (*it)->num_reg_rd_log , |
---|
| 1341 | (*it)->num_reg_rd_phy_old , |
---|
| 1342 | (*it)->num_reg_rd_phy_new , |
---|
| 1343 | (*it)->write_re , |
---|
| 1344 | (*it)->num_reg_re_log , |
---|
| 1345 | (*it)->num_reg_re_phy_old , |
---|
| 1346 | (*it)->num_reg_re_phy_new ); |
---|
| 1347 | |
---|
[124] | 1348 | log_printf(TRACE,Commit_unit,FUNCTION," %.2d %.2d %.1d %.1d - %.8x (%.8x) %.8x (%.8x)", |
---|
[122] | 1349 | (*it)->exception_use , |
---|
| 1350 | (*it)->exception , |
---|
| 1351 | (*it)->flags , |
---|
| 1352 | (*it)->no_sequence , |
---|
[128] | 1353 | // (*it)->speculative , |
---|
[122] | 1354 | (*it)->address , |
---|
| 1355 | (*it)->address<<2 , |
---|
| 1356 | (*it)->address_next , |
---|
| 1357 | (*it)->address_next<<2 |
---|
| 1358 | ); |
---|
| 1359 | |
---|
| 1360 | iter [num_bank] ++; |
---|
| 1361 | } |
---|
[108] | 1362 | } |
---|
[104] | 1363 | } |
---|
[123] | 1364 | |
---|
| 1365 | log_printf(TRACE,Commit_unit,FUNCTION," * nb_write_rd : %d",nb_write_rd); |
---|
| 1366 | log_printf(TRACE,Commit_unit,FUNCTION," * nb_write_re : %d",nb_write_re); |
---|
[108] | 1367 | } |
---|
[88] | 1368 | #endif |
---|
| 1369 | |
---|
[108] | 1370 | #ifdef DEBUG_TEST |
---|
| 1371 | { |
---|
| 1372 | uint32_t x=reg_NUM_BANK_HEAD; |
---|
| 1373 | if (not _rob[x].empty()) |
---|
| 1374 | { |
---|
| 1375 | entry_t * entry = _rob [x].front(); |
---|
[97] | 1376 | |
---|
[108] | 1377 | if (false |
---|
| 1378 | // or (entry->state == ROB_EMPTY ) |
---|
| 1379 | // or (entry->state == ROB_BRANCH_WAIT_END ) |
---|
| 1380 | // or (entry->state == ROB_BRANCH_COMPLETE ) |
---|
| 1381 | // or (entry->state == ROB_STORE_WAIT_HEAD_OK ) |
---|
| 1382 | // //or (entry->state == ROB_STORE_WAIT_HEAD_KO ) |
---|
| 1383 | // or (entry->state == ROB_STORE_HEAD_OK ) |
---|
| 1384 | // or (entry->state == ROB_STORE_HEAD_KO ) |
---|
| 1385 | // or (entry->state == ROB_OTHER_WAIT_END ) |
---|
[112] | 1386 | // or (entry->state == ROB_EVENT_WAIT_END ) |
---|
[108] | 1387 | // or (entry->state == ROB_END_OK_SPECULATIVE ) |
---|
| 1388 | or (entry->state == ROB_END_OK ) |
---|
| 1389 | // or (entry->state == ROB_END_KO_SPECULATIVE ) |
---|
| 1390 | // or (entry->state == ROB_END_KO ) |
---|
| 1391 | // or (entry->state == ROB_END_BRANCH_MISS_SPECULATIVE) |
---|
| 1392 | or (entry->state == ROB_END_BRANCH_MISS ) |
---|
| 1393 | // or (entry->state == ROB_END_LOAD_MISS_SPECULATIVE ) |
---|
| 1394 | // or (entry->state == ROB_END_LOAD_MISS_UPDATE ) |
---|
| 1395 | or (entry->state == ROB_END_LOAD_MISS ) |
---|
| 1396 | // or (entry->state == ROB_END_MISS ) |
---|
| 1397 | // or (entry->state == ROB_END_EXCEPTION_WAIT_HEAD ) |
---|
| 1398 | // or (entry->state == ROB_END_EXCEPTION_UPDATE ) |
---|
| 1399 | // or (entry->state == ROB_END_EXCEPTION ) |
---|
| 1400 | ) |
---|
| 1401 | if (entry->address != reg_PC_CURRENT[entry->front_end_id][entry->context_id]) |
---|
[122] | 1402 | throw ERRORMORPHEO(FUNCTION,toString(_("Rob top address (0x%x) is different of reg_PC_CURRENT[%d][%d] (0x%x).\n"), |
---|
[108] | 1403 | entry->address, |
---|
| 1404 | entry->front_end_id, |
---|
| 1405 | entry->context_id, |
---|
| 1406 | reg_PC_CURRENT[entry->front_end_id][entry->context_id])); |
---|
| 1407 | } |
---|
| 1408 | } |
---|
[124] | 1409 | { |
---|
| 1410 | uint32_t NB_INST [_param->_nb_front_end][_param->_max_nb_context]; |
---|
| 1411 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 1412 | for (uint32_t j=0; j<_param->_nb_context [i]; j++) |
---|
| 1413 | NB_INST [i][j] = 0; //reg_EVENT_NB_INST [i][j]; |
---|
| 1414 | |
---|
| 1415 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
| 1416 | for (std::list<entry_t*>::iterator it=_rob[i].begin(); |
---|
| 1417 | it!=_rob [i].end(); |
---|
| 1418 | ++it) |
---|
| 1419 | NB_INST [(*it)->front_end_id][(*it)->context_id] ++; |
---|
| 1420 | |
---|
| 1421 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 1422 | for (uint32_t j=0; j<_param->_nb_context [i]; j++) |
---|
| 1423 | if (NB_INST [i][j] != reg_NB_INST_COMMIT_ALL [i][j]) |
---|
| 1424 | throw ERRORMORPHEO(FUNCTION,toString(_("Context [%d][%d] have not the good nb_inst (%d in rob, %d in register).\n"),i,j,NB_INST[i][j], reg_NB_INST_COMMIT_ALL [i][j])); |
---|
| 1425 | } |
---|
[108] | 1426 | #endif |
---|
[88] | 1427 | |
---|
| 1428 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 1429 | end_cycle (); |
---|
| 1430 | #endif |
---|
| 1431 | |
---|
[109] | 1432 | // Stop Condition |
---|
| 1433 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 1434 | for (uint32_t j=0; j<_param->_nb_context [i]; j++) |
---|
[110] | 1435 | if (_nb_cycle_idle [i][j] >= debug_idle_cycle) |
---|
| 1436 | throw ERRORMORPHEO(FUNCTION,toString(_("Thread [%d] is idle since %.0f cycles.\n"),_param->_translate_num_context_to_num_thread[i][j],_nb_cycle_idle [i][j])); |
---|
[109] | 1437 | |
---|
[88] | 1438 | log_end(Commit_unit,FUNCTION); |
---|
| 1439 | }; |
---|
| 1440 | |
---|
| 1441 | }; // end namespace commit_unit |
---|
| 1442 | }; // end namespace ooo_engine |
---|
| 1443 | }; // end namespace multi_ooo_engine |
---|
| 1444 | }; // end namespace core |
---|
| 1445 | |
---|
| 1446 | }; // end namespace behavioural |
---|
| 1447 | }; // end namespace morpheo |
---|
| 1448 | #endif |
---|