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