[88] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Reexecute_unit_genMealy_commit.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Reexecute_unit/include/Reexecute_unit.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_ooo_engine { |
---|
| 15 | namespace ooo_engine { |
---|
| 16 | namespace reexecute_unit { |
---|
| 17 | |
---|
| 18 | #undef FUNCTION |
---|
| 19 | #define FUNCTION "Reexecute_unit::genMealy_commit" |
---|
| 20 | void Reexecute_unit::genMealy_commit (void) |
---|
| 21 | { |
---|
| 22 | log_begin(Reexecute_unit,FUNCTION); |
---|
| 23 | |
---|
| 24 | // Initialisation |
---|
| 25 | Tcontrol_t execute_loop_ack [_param->_nb_execute_loop][_param->_max_nb_inst_execute]; |
---|
| 26 | |
---|
| 27 | for (uint32_t i=0; i<_param->_nb_execute_loop; ++i) |
---|
| 28 | for (uint32_t j=0; j<_param->_nb_inst_execute [i]; ++j) |
---|
| 29 | execute_loop_ack [i][j] = false; |
---|
| 30 | |
---|
| 31 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 32 | internal_QUEUE_PUSH [i] = 0; |
---|
| 33 | |
---|
| 34 | // execute_loop interface |
---|
| 35 | std::list<generic::priority::select_t> * select_queue_in = _priority_queue_in ->select(); |
---|
| 36 | std::list<generic::priority::select_t>::iterator it_queue_in = select_queue_in ->begin(); |
---|
| 37 | |
---|
| 38 | std::list<generic::priority::select_t> * select_execute_loop = _priority_execute_loop ->select(); |
---|
| 39 | std::list<generic::priority::select_t>::iterator it_execute_loop= select_execute_loop ->begin(); |
---|
| 40 | |
---|
| 41 | // For each nb_inst |
---|
| 42 | for (uint32_t i=0; i<_param->_nb_inst_commit; ++i) |
---|
| 43 | { |
---|
| 44 | Tcontrol_t commit_val = false; |
---|
| 45 | |
---|
| 46 | // find a executed instruction |
---|
| 47 | for (; |
---|
| 48 | (it_execute_loop!=select_execute_loop->end()) and (commit_val == false); |
---|
| 49 | ++it_execute_loop) |
---|
| 50 | { |
---|
| 51 | // take num_execute_loop and num_inst_execute |
---|
| 52 | uint32_t x = it_execute_loop->grp; |
---|
| 53 | uint32_t y = it_execute_loop->elt; |
---|
| 54 | |
---|
| 55 | // test id instruction is valid |
---|
| 56 | if (PORT_READ(in_EXECUTE_LOOP_VAL [x][y])) |
---|
| 57 | { |
---|
| 58 | // Need spr_acces / reexecute ? |
---|
| 59 | Texception_t exception = PORT_READ(in_EXECUTE_LOOP_EXCEPTION [x][y]); |
---|
| 60 | Tgeneral_data_t address = PORT_READ(in_EXECUTE_LOOP_ADDRESS [x][y]); |
---|
| 61 | Tcontrol_t spr_access = ((exception == EXCEPTION_ALU_SPR_ACCESS_MUST_READ ) or |
---|
| 62 | (exception == EXCEPTION_ALU_SPR_ACCESS_MUST_WRITE)); |
---|
| 63 | if (spr_access) |
---|
| 64 | { |
---|
| 65 | // find a not full bank |
---|
| 66 | bool find = false; |
---|
| 67 | for (; |
---|
| 68 | (it_queue_in!=select_queue_in->end()) and (find == false); |
---|
| 69 | ++it_queue_in) |
---|
| 70 | { |
---|
| 71 | uint32_t num_bank = it_queue_in->grp; |
---|
| 72 | if (_reexecute_queue [num_bank].size() < _param->_size_queue) |
---|
| 73 | { |
---|
| 74 | find = true; |
---|
| 75 | |
---|
| 76 | // this instruction don't need spr access. send at the re order buffer |
---|
| 77 | commit_val = 1; // in_EXECUTE_LOOP_VAL = 1 |
---|
| 78 | execute_loop_ack [x][y] = PORT_READ(in_COMMIT_ACK [i]); |
---|
| 79 | |
---|
| 80 | internal_QUEUE_PUSH [num_bank] = execute_loop_ack [x][y]; // in_EXECUTE_LOOP_VAL = 1 |
---|
| 81 | internal_QUEUE_NUM_EXECUTE_LOOP [num_bank] = x; |
---|
| 82 | internal_QUEUE_NUM_INST_EXECUTE [num_bank] = y; |
---|
| 83 | internal_QUEUE_NUM_INST_COMMIT [num_bank] = i; |
---|
| 84 | internal_QUEUE_INFO [num_bank].spr_wen = (exception == EXCEPTION_ALU_SPR_ACCESS_MUST_WRITE); |
---|
| 85 | |
---|
| 86 | // if reexecute, don't commit, just read instruction information (num_reg_rd) |
---|
| 87 | PORT_WRITE(out_COMMIT_WEN [i], not must_reexecute(address & 0xffff, internal_QUEUE_INFO[num_bank])); |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | else |
---|
| 92 | { |
---|
| 93 | // this instruction don't need spr access. send at the re order buffer |
---|
| 94 | commit_val = 1; // in_EXECUTE_LOOP_VAL = 1 |
---|
| 95 | execute_loop_ack [x][y] = PORT_READ(in_COMMIT_ACK [i]); |
---|
| 96 | |
---|
| 97 | PORT_WRITE(out_COMMIT_WEN [i], 1); |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | if (commit_val) |
---|
| 101 | { |
---|
| 102 | if (_param->_have_port_context_id) |
---|
| 103 | PORT_WRITE(out_COMMIT_CONTEXT_ID [i], PORT_READ(in_EXECUTE_LOOP_CONTEXT_ID [x][y])); |
---|
| 104 | if (_param->_have_port_front_end_id) |
---|
| 105 | PORT_WRITE(out_COMMIT_FRONT_END_ID [i], PORT_READ(in_EXECUTE_LOOP_FRONT_END_ID [x][y])); |
---|
| 106 | if (_param->_have_port_rob_ptr ) |
---|
| 107 | PORT_WRITE(out_COMMIT_PACKET_ID [i], PORT_READ(in_EXECUTE_LOOP_PACKET_ID [x][y])); |
---|
| 108 | //PORT_WRITE(out_COMMIT_OPERATION [i], PORT_READ(in_EXECUTE_LOOP_OPERATION [x][y])); |
---|
| 109 | //PORT_WRITE(out_COMMIT_TYPE [i], PORT_READ(in_EXECUTE_LOOP_TYPE [x][y])); |
---|
| 110 | PORT_WRITE(out_COMMIT_FLAGS [i], PORT_READ(in_EXECUTE_LOOP_FLAGS [x][y])); |
---|
| 111 | PORT_WRITE(out_COMMIT_EXCEPTION [i], exception); |
---|
| 112 | PORT_WRITE(out_COMMIT_NO_SEQUENCE [i], PORT_READ(in_EXECUTE_LOOP_NO_SEQUENCE [x][y])); |
---|
| 113 | PORT_WRITE(out_COMMIT_ADDRESS [i], address); |
---|
| 114 | } |
---|
| 115 | } |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | #ifdef STATISTICS |
---|
| 119 | internal_COMMIT_VAL [i] = commit_val; |
---|
| 120 | #endif |
---|
| 121 | PORT_WRITE(out_COMMIT_VAL [i], commit_val); |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | for (uint32_t i=0; i<_param->_nb_execute_loop; ++i) |
---|
| 125 | for (uint32_t j=0; j<_param->_nb_inst_execute [i]; ++j) |
---|
| 126 | PORT_WRITE(out_EXECUTE_LOOP_ACK [i][j], execute_loop_ack [i][j]); |
---|
| 127 | |
---|
| 128 | log_end(Reexecute_unit,FUNCTION); |
---|
| 129 | }; |
---|
| 130 | |
---|
| 131 | }; // end namespace reexecute_unit |
---|
| 132 | }; // end namespace ooo_engine |
---|
| 133 | }; // end namespace multi_ooo_engine |
---|
| 134 | }; // end namespace core |
---|
| 135 | |
---|
| 136 | }; // end namespace behavioural |
---|
| 137 | }; // end namespace morpheo |
---|
| 138 | #endif |
---|
| 139 | |
---|
| 140 | |
---|