[88] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Core_Glue_genMealy_issue.cpp 138 2010-05-12 17:34:01Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Core_Glue/include/Core_Glue.h" |
---|
| 10 | #include "Common/include/Max.h" |
---|
| 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | namespace core { |
---|
| 15 | namespace core_glue { |
---|
| 16 | |
---|
[117] | 17 | /* |
---|
[138] | 18 | OOO Execute Loop |
---|
| 19 | ---+ +----- |
---|
| 20 | | +-----+ | |
---|
| 21 | -+->| |-+-> |
---|
| 22 | | | | | |
---|
| 23 | -+->| |-+-> |
---|
| 24 | | | | | |
---|
| 25 | -+->| | +----- |
---|
| 26 | | | | |
---|
| 27 | -+->| | +----- |
---|
| 28 | | | | | |
---|
| 29 | ---+ | _ _ |-+-> |
---|
| 30 | | _X_ | | |
---|
| 31 | ---+ | |-+-> |
---|
| 32 | | | | | |
---|
| 33 | -+->| | +----- |
---|
| 34 | | | | |
---|
| 35 | -+->| | +----- |
---|
| 36 | | | | | |
---|
| 37 | -+->| |-+-> |
---|
| 38 | | | | | |
---|
| 39 | -+->| |-+-> |
---|
| 40 | | +-----+ | |
---|
| 41 | ---+ dispatch +----- |
---|
[117] | 42 | */ |
---|
[88] | 43 | |
---|
[117] | 44 | |
---|
| 45 | // class num_read_unit_t |
---|
| 46 | // { |
---|
| 47 | // public : const uint32_t num_execute_loop; |
---|
| 48 | // public : const uint32_t num_read_unit; |
---|
| 49 | |
---|
| 50 | // public : num_read_unit_t (uint32_t num_execute_loop, |
---|
| 51 | // uint32_t num_read_unit) : |
---|
| 52 | // this->num_execute_loop (num_execute_loop), |
---|
| 53 | // this->num_read_unit (num_read_unit ) |
---|
| 54 | // {}; |
---|
| 55 | // } |
---|
| 56 | |
---|
[88] | 57 | #undef FUNCTION |
---|
| 58 | #define FUNCTION "Core_Glue::genMealy_issue" |
---|
| 59 | void Core_Glue::genMealy_issue (void) |
---|
| 60 | { |
---|
| 61 | log_begin(Core_Glue,FUNCTION); |
---|
| 62 | log_function(Core_Glue,FUNCTION,_name.c_str()); |
---|
| 63 | |
---|
[117] | 64 | Tcontrol_t ISSUE_OOO_ENGINE_ACK [_param->_nb_ooo_engine ][_param->_max_nb_inst_issue_queue]; |
---|
| 65 | Tcontrol_t ISSUE_EXECUTE_LOOP_VAL [_param->_nb_execute_loop][_param->_max_nb_read_unit]; |
---|
[123] | 66 | |
---|
| 67 | for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i) |
---|
| 68 | for (uint32_t j=0; j<_param->_nb_inst_issue_queue[i]; ++j) |
---|
| 69 | ISSUE_OOO_ENGINE_ACK [i][j] = 0; |
---|
| 70 | for (uint32_t i=0; i<_param->_nb_execute_loop; ++i) |
---|
| 71 | for (uint32_t j=0; j<_param->_nb_read_unit[i]; ++j) |
---|
| 72 | ISSUE_EXECUTE_LOOP_VAL [i][j] = 0; |
---|
| 73 | |
---|
| 74 | if (PORT_READ(in_NRESET)) |
---|
| 75 | { |
---|
[117] | 76 | Tcontrol_t READ_UNIT_ENABLE [_param->_nb_execute_loop][_param->_max_nb_read_unit]; |
---|
| 77 | |
---|
[115] | 78 | // Init -> all at 0 |
---|
[88] | 79 | for (uint32_t i=0; i<_param->_nb_execute_loop; ++i) |
---|
| 80 | for (uint32_t j=0; j<_param->_nb_read_unit[i]; ++j) |
---|
| 81 | { |
---|
| 82 | // Read unit is enable is signal ack is set |
---|
| 83 | READ_UNIT_ENABLE [i][j] = (PORT_READ(in_ISSUE_EXECUTE_LOOP_ACK [i][j]) == 1); |
---|
[117] | 84 | log_printf(TRACE,Core_Glue,FUNCTION," * Read_unit [%d][%d].enable : %d",i,j,READ_UNIT_ENABLE[i][j]); |
---|
[88] | 85 | } |
---|
| 86 | |
---|
[120] | 87 | std::list<generic::priority::select_t> * select_ooo_engine = _priority_ooo_engine->select(); |
---|
| 88 | for (std::list<generic::priority::select_t>::iterator it_ooo_engine=select_ooo_engine->begin(); |
---|
| 89 | it_ooo_engine!=select_ooo_engine->end(); |
---|
| 90 | ++it_ooo_engine) |
---|
| 91 | { |
---|
[138] | 92 | // select the most priotary |
---|
| 93 | uint32_t num_ooo_engine = it_ooo_engine->grp; |
---|
[88] | 94 | |
---|
[120] | 95 | for (uint32_t num_inst_issue_queue=0; num_inst_issue_queue<_param->_nb_inst_issue_queue[num_ooo_engine]; ++num_inst_issue_queue) |
---|
| 96 | { |
---|
[138] | 97 | // init stop condition |
---|
[120] | 98 | bool find = false; |
---|
| 99 | |
---|
[138] | 100 | // Read request information from issue_queue |
---|
| 101 | Tcontrol_t val = PORT_READ(in_ISSUE_OOO_ENGINE_VAL [num_ooo_engine][num_inst_issue_queue]); |
---|
| 102 | Ttype_t type = PORT_READ(in_ISSUE_OOO_ENGINE_TYPE [num_ooo_engine][num_inst_issue_queue]); |
---|
| 103 | Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_ISSUE_OOO_ENGINE_CONTEXT_ID [num_ooo_engine][num_inst_issue_queue]):0; |
---|
| 104 | Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_ISSUE_OOO_ENGINE_FRONT_END_ID [num_ooo_engine][num_inst_issue_queue]):0; |
---|
| 105 | uint32_t num_thread = _param->_translate_num_context_to_num_thread[num_ooo_engine][front_end_id][context_id]; |
---|
[120] | 106 | |
---|
| 107 | log_printf(TRACE,Core_Glue,FUNCTION," * num_ooo_engine : %d",num_ooo_engine ); |
---|
| 108 | log_printf(TRACE,Core_Glue,FUNCTION," * num_inst_issue_queue : %d",num_inst_issue_queue); |
---|
| 109 | log_printf(TRACE,Core_Glue,FUNCTION," * val : %d",val); |
---|
[138] | 110 | log_printf(TRACE,Core_Glue,FUNCTION," * type : %d",type); |
---|
| 111 | log_printf(TRACE,Core_Glue,FUNCTION," * context_id : %d",context_id); |
---|
| 112 | log_printf(TRACE,Core_Glue,FUNCTION," * front_end_id : %d",front_end_id); |
---|
| 113 | log_printf(TRACE,Core_Glue,FUNCTION," * num_thread : %d",num_thread); |
---|
| 114 | |
---|
[120] | 115 | if (val) |
---|
[138] | 116 | // for each execute_loop |
---|
| 117 | for (uint32_t num_execute_loop=0; num_execute_loop<_param->_nb_execute_loop; ++num_execute_loop) |
---|
[120] | 118 | { |
---|
[138] | 119 | // for each read_unit |
---|
| 120 | std::list<generic::priority::select_t> * select_read_unit = _priority_read_unit[num_execute_loop]->select(); |
---|
| 121 | for (std::list<generic::priority::select_t>::iterator it_read_unit=select_read_unit->begin(); |
---|
| 122 | it_read_unit!=select_read_unit->end(); |
---|
| 123 | ++it_read_unit) |
---|
| 124 | { |
---|
| 125 | // get the most priotary ... |
---|
| 126 | uint32_t num_read_unit = it_read_unit->grp; |
---|
| 127 | Tcontrol_t ack = READ_UNIT_ENABLE [num_execute_loop][num_read_unit]; |
---|
| 128 | |
---|
| 129 | log_printf(TRACE,Core_Glue,FUNCTION," * num_execute_loop : %d",num_execute_loop); |
---|
| 130 | log_printf(TRACE,Core_Glue,FUNCTION," * num_read_unit : %d",num_read_unit ); |
---|
| 131 | log_printf(TRACE,Core_Glue,FUNCTION," * read_unit_enable : %d",ack ); |
---|
| 132 | |
---|
| 133 | // test if : |
---|
| 134 | // * read_unit can accept an instruction (valid and no previous instruction) |
---|
| 135 | // * read_unit can accept this type |
---|
| 136 | if (ack and |
---|
| 137 | _param->_table_issue_type [num_execute_loop][num_read_unit][type] and |
---|
| 138 | _param->_table_issue_thread [num_execute_loop][num_read_unit][num_thread]) |
---|
| 139 | { |
---|
| 140 | log_printf(TRACE,Core_Glue,FUNCTION," * find !!!"); |
---|
| 141 | |
---|
| 142 | // find ! |
---|
| 143 | // Transaction |
---|
| 144 | find = true; |
---|
| 145 | |
---|
| 146 | READ_UNIT_ENABLE [num_execute_loop][num_read_unit] = false; // now, this read_unit is busy |
---|
| 147 | ISSUE_EXECUTE_LOOP_VAL [num_execute_loop][num_read_unit] = 1; // = val |
---|
| 148 | ISSUE_OOO_ENGINE_ACK [num_ooo_engine][num_inst_issue_queue] = 1; // = ack |
---|
| 149 | |
---|
| 150 | if (_param->_have_port_context_id) |
---|
| 151 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_CONTEXT_ID [num_execute_loop][num_read_unit],context_id); |
---|
| 152 | if (_param->_have_port_front_end_id) |
---|
| 153 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_FRONT_END_ID [num_execute_loop][num_read_unit],front_end_id); |
---|
| 154 | if (_param->_have_port_ooo_engine_id) |
---|
| 155 | { |
---|
| 156 | Tcontext_t ooo_engine_id = _param->_translate_num_ooo_engine_to_execute_loop_ooo_engine_id [num_ooo_engine][num_execute_loop]; |
---|
| 157 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_OOO_ENGINE_ID [num_execute_loop][num_read_unit],ooo_engine_id); |
---|
| 158 | } |
---|
| 159 | if (_param->_have_port_rob_ptr) |
---|
| 160 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_PACKET_ID [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_PACKET_ID [num_ooo_engine][num_inst_issue_queue])); |
---|
| 161 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_OPERATION [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_OPERATION [num_ooo_engine][num_inst_issue_queue])); |
---|
| 162 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_TYPE [num_execute_loop][num_read_unit],type); |
---|
| 163 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_CANCEL [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_CANCEL [num_ooo_engine][num_inst_issue_queue])); |
---|
| 164 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_STORE_QUEUE_PTR_WRITE [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_WRITE [num_ooo_engine][num_inst_issue_queue])); |
---|
| 165 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_STORE_QUEUE_PTR_READ [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_STORE_QUEUE_PTR_READ [num_ooo_engine][num_inst_issue_queue])); |
---|
| 166 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_STORE_QUEUE_EMPTY [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_STORE_QUEUE_EMPTY [num_ooo_engine][num_inst_issue_queue])); |
---|
| 167 | if (_param->_have_port_load_queue_ptr) |
---|
| 168 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_LOAD_QUEUE_PTR_WRITE [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_LOAD_QUEUE_PTR_WRITE [num_ooo_engine][num_inst_issue_queue])); |
---|
| 169 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_HAS_IMMEDIAT [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_HAS_IMMEDIAT [num_ooo_engine][num_inst_issue_queue])); |
---|
| 170 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_IMMEDIAT [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_IMMEDIAT [num_ooo_engine][num_inst_issue_queue])); |
---|
| 171 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_READ_RA [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_READ_RA [num_ooo_engine][num_inst_issue_queue])); |
---|
| 172 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RA [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RA [num_ooo_engine][num_inst_issue_queue])); |
---|
| 173 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_READ_RB [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_READ_RB [num_ooo_engine][num_inst_issue_queue])); |
---|
| 174 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RB [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RB [num_ooo_engine][num_inst_issue_queue])); |
---|
| 175 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_READ_RC [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_READ_RC [num_ooo_engine][num_inst_issue_queue])); |
---|
| 176 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RC [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RC [num_ooo_engine][num_inst_issue_queue])); |
---|
| 177 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_WRITE_RD [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_WRITE_RD [num_ooo_engine][num_inst_issue_queue])); |
---|
| 178 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RD [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RD [num_ooo_engine][num_inst_issue_queue])); |
---|
| 179 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_WRITE_RE [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_WRITE_RE [num_ooo_engine][num_inst_issue_queue])); |
---|
| 180 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_NUM_REG_RE [num_execute_loop][num_read_unit],PORT_READ(in_ISSUE_OOO_ENGINE_NUM_REG_RE [num_ooo_engine][num_inst_issue_queue])); |
---|
[120] | 181 | break; |
---|
[138] | 182 | } |
---|
| 183 | //if (find) |
---|
| 184 | // break; |
---|
| 185 | } |
---|
[120] | 186 | if (find) |
---|
| 187 | break; |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | if (_param->_issue_queue_in_order [num_ooo_engine] and |
---|
| 191 | not find and |
---|
| 192 | (num_inst_issue_queue >= _param->_nb_inst_reexecute [num_ooo_engine])) |
---|
[117] | 193 | { |
---|
[120] | 194 | log_printf(TRACE,Core_Glue,FUNCTION," * stop scan !!!"); |
---|
[117] | 195 | |
---|
[120] | 196 | break; // stop scan |
---|
[88] | 197 | } |
---|
[120] | 198 | } |
---|
| 199 | } |
---|
[138] | 200 | |
---|
[123] | 201 | } |
---|
| 202 | |
---|
[88] | 203 | // Write output |
---|
| 204 | for (uint32_t i=0; i<_param->_nb_ooo_engine; ++i) |
---|
[117] | 205 | for (uint32_t j=0; j<_param->_nb_inst_issue_queue[i]; ++j) |
---|
[88] | 206 | PORT_WRITE(out_ISSUE_OOO_ENGINE_ACK [i][j], ISSUE_OOO_ENGINE_ACK [i][j]); |
---|
| 207 | for (uint32_t i=0; i<_param->_nb_execute_loop; ++i) |
---|
| 208 | for (uint32_t j=0; j<_param->_nb_read_unit[i]; ++j) |
---|
| 209 | PORT_WRITE(out_ISSUE_EXECUTE_LOOP_VAL [i][j], ISSUE_EXECUTE_LOOP_VAL [i][j]); |
---|
| 210 | |
---|
| 211 | log_end(Core_Glue,FUNCTION); |
---|
| 212 | }; |
---|
| 213 | |
---|
| 214 | }; // end namespace core_glue |
---|
| 215 | }; // end namespace core |
---|
| 216 | |
---|
| 217 | }; // end namespace behavioural |
---|
| 218 | }; // end namespace morpheo |
---|
| 219 | #endif |
---|