[111] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Issue_queue_function_out_of_order_genMoore.cpp 138 2010-05-12 17:34:01Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Issue_queue/include/Issue_queue.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_ooo_engine { |
---|
| 15 | namespace ooo_engine { |
---|
| 16 | namespace issue_queue { |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | #undef FUNCTION |
---|
| 20 | #define FUNCTION "Issue_queue::function_out_of_order_genMoore" |
---|
| 21 | void Issue_queue::function_out_of_order_genMoore (void) |
---|
| 22 | { |
---|
| 23 | log_begin(Issue_queue,FUNCTION); |
---|
| 24 | log_function(Issue_queue,FUNCTION,_name.c_str()); |
---|
| 25 | |
---|
[123] | 26 | if (PORT_READ(in_NRESET)) |
---|
| 27 | { |
---|
[111] | 28 | // =================================================================== |
---|
| 29 | // =====[ REEXECUTE_UNIT ]============================================ |
---|
| 30 | // =================================================================== |
---|
| 31 | // Same implementation in in-order and out-of-order |
---|
| 32 | |
---|
| 33 | // =================================================================== |
---|
| 34 | // =====[ ISSUE_IN ]================================================== |
---|
| 35 | // =================================================================== |
---|
| 36 | { |
---|
| 37 | Tcontrol_t ack [_param->_nb_rename_unit][_param->_max_nb_inst_rename]; |
---|
| 38 | |
---|
| 39 | // Initialisation |
---|
| 40 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 41 | internal_BANK_IN_ACK [i] = false; |
---|
| 42 | |
---|
| 43 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
| 44 | for (uint32_t j=0; j<_param->_nb_inst_rename[i]; j++) |
---|
| 45 | ack [i][j] = false; |
---|
| 46 | |
---|
[138] | 47 | // std::list<generic::priority::select_t> * select_reg = _priority_reg->select(); // same select for all issue |
---|
[111] | 48 | |
---|
| 49 | // issue_in interface |
---|
| 50 | std::list<generic::priority::select_t> * select_in = _priority_in ->select(); // same select for all issue |
---|
| 51 | for (std::list<generic::priority::select_t>::iterator it=select_in ->begin(); |
---|
| 52 | it!=select_in ->end(); |
---|
| 53 | it++) |
---|
| 54 | { |
---|
| 55 | // Get num interface |
---|
| 56 | uint32_t num_rename_unit = it->grp; |
---|
| 57 | uint32_t num_inst_rename = it->elt; |
---|
| 58 | |
---|
| 59 | log_printf(TRACE,Issue_queue,FUNCTION," * ISSUE_IN [%d][%d]",num_rename_unit,num_inst_rename); |
---|
| 60 | |
---|
| 61 | // scan all bank |
---|
[138] | 62 | // for (std::list<generic::priority::select_t>::iterator it=select_reg->begin(); |
---|
| 63 | // it!=select_reg->end(); |
---|
| 64 | // it++) |
---|
| 65 | for (uint32_t num_bank=0; |
---|
| 66 | num_bank<_param->_nb_bank; |
---|
| 67 | ++num_bank) |
---|
[111] | 68 | { |
---|
[138] | 69 | // uint32_t num_bank = it->grp; |
---|
[111] | 70 | |
---|
| 71 | log_printf(TRACE,Issue_queue,FUNCTION," * BANK [%d]",num_bank); |
---|
| 72 | |
---|
| 73 | // test if bank is not busy (full or previous access) |
---|
| 74 | if (not internal_BANK_IN_ACK [num_bank] and (_issue_queue[num_bank].size() < _param->_size_bank)) |
---|
| 75 | { |
---|
| 76 | log_printf(TRACE,Issue_queue,FUNCTION," * find"); |
---|
| 77 | |
---|
| 78 | // find |
---|
| 79 | ack [num_rename_unit][num_inst_rename] = true; |
---|
| 80 | internal_BANK_IN_ACK [num_bank] = true; |
---|
| 81 | internal_BANK_IN_NUM_RENAME_UNIT [num_bank] = num_rename_unit; |
---|
| 82 | internal_BANK_IN_NUM_INST [num_bank] = num_inst_rename; |
---|
| 83 | |
---|
| 84 | break; // Stop scan |
---|
| 85 | } |
---|
| 86 | else |
---|
| 87 | log_printf(TRACE,Issue_queue,FUNCTION," * not find"); |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
| 92 | for (uint32_t j=0; j<_param->_nb_inst_rename[i]; j++) |
---|
| 93 | PORT_WRITE(out_ISSUE_IN_ACK [i][j],ack [i][j]); |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | // =================================================================== |
---|
| 97 | // =====[ ISSUE_OUT ]================================================= |
---|
| 98 | // =================================================================== |
---|
| 99 | { |
---|
| 100 | Tcontrol_t val [_param->_nb_inst_issue]; |
---|
| 101 | |
---|
| 102 | for (uint32_t i=0; i<_param->_nb_inst_issue; i++) |
---|
| 103 | val [i] = 0; |
---|
| 104 | |
---|
| 105 | // From Reexecute_queue |
---|
| 106 | |
---|
| 107 | // uint32_t num_reexecute_entry = 0; |
---|
| 108 | for (std::list<entry_t*>::iterator it=_reexecute_queue.begin(); |
---|
| 109 | it!=_reexecute_queue.end(); |
---|
| 110 | ++it) |
---|
| 111 | { |
---|
| 112 | entry_t* entry = (*it); |
---|
| 113 | |
---|
| 114 | for (uint32_t i=0; i<_param->_nb_inst_issue; i++) |
---|
| 115 | // test if no previous transaction and can accept this type |
---|
[117] | 116 | if ((val[i] == 0) |
---|
| 117 | // and _param->_table_issue_type [i][entry->_type] |
---|
| 118 | ) |
---|
[111] | 119 | { |
---|
| 120 | // find a issue port |
---|
| 121 | val [i] = 1; |
---|
| 122 | |
---|
| 123 | if (_param->_have_port_context_id) |
---|
| 124 | PORT_WRITE(out_ISSUE_OUT_CONTEXT_ID [i], entry->_context_id ); |
---|
| 125 | if (_param->_have_port_front_end_id) |
---|
| 126 | PORT_WRITE(out_ISSUE_OUT_FRONT_END_ID [i], entry->_front_end_id ); |
---|
| 127 | if (_param->_have_port_rob_ptr ) |
---|
| 128 | PORT_WRITE(out_ISSUE_OUT_PACKET_ID [i], entry->_packet_id ); |
---|
| 129 | PORT_WRITE(out_ISSUE_OUT_OPERATION [i], entry->_operation ); |
---|
| 130 | PORT_WRITE(out_ISSUE_OUT_TYPE [i], entry->_type ); |
---|
[136] | 131 | PORT_WRITE(out_ISSUE_OUT_CANCEL [i], 0 ); |
---|
[111] | 132 | PORT_WRITE(out_ISSUE_OUT_STORE_QUEUE_PTR_WRITE [i], entry->_store_queue_ptr_write); |
---|
[122] | 133 | PORT_WRITE(out_ISSUE_OUT_STORE_QUEUE_PTR_READ [i], entry->_store_queue_ptr_read ); |
---|
| 134 | PORT_WRITE(out_ISSUE_OUT_STORE_QUEUE_EMPTY [i], entry->_store_queue_empty ); |
---|
[111] | 135 | if (_param->_have_port_load_queue_ptr) |
---|
| 136 | PORT_WRITE(out_ISSUE_OUT_LOAD_QUEUE_PTR_WRITE [i], entry->_load_queue_ptr_write ); |
---|
| 137 | PORT_WRITE(out_ISSUE_OUT_HAS_IMMEDIAT [i], entry->_has_immediat ); |
---|
| 138 | PORT_WRITE(out_ISSUE_OUT_IMMEDIAT [i], entry->_immediat ); |
---|
| 139 | PORT_WRITE(out_ISSUE_OUT_READ_RA [i], entry->_read_ra ); |
---|
| 140 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RA [i], entry->_num_reg_ra ); |
---|
| 141 | PORT_WRITE(out_ISSUE_OUT_READ_RB [i], entry->_read_rb ); |
---|
| 142 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RB [i], entry->_num_reg_rb ); |
---|
| 143 | PORT_WRITE(out_ISSUE_OUT_READ_RC [i], entry->_read_rc ); |
---|
| 144 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RC [i], entry->_num_reg_rc ); |
---|
| 145 | PORT_WRITE(out_ISSUE_OUT_WRITE_RD [i], entry->_write_rd ); |
---|
| 146 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RD [i], entry->_num_reg_rd ); |
---|
| 147 | PORT_WRITE(out_ISSUE_OUT_WRITE_RE [i], entry->_write_re ); |
---|
| 148 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RE [i], entry->_num_reg_re ); |
---|
| 149 | |
---|
| 150 | internal_ISSUE_OUT_FROM_REEXECUTE [i] = true; |
---|
| 151 | // internal_ISSUE_OUT_NUM_BANK [i] = num_reexecute_entry; |
---|
| 152 | internal_ISSUE_OUT_ENTRY [i] = entry; |
---|
| 153 | |
---|
| 154 | break; // stop scan |
---|
| 155 | } |
---|
| 156 | // num_reexecute_entry ++; |
---|
| 157 | } |
---|
| 158 | |
---|
| 159 | // From Issue_queue |
---|
| 160 | |
---|
| 161 | std::list<generic::priority::select_t> * select = _priority_out->select(); // same select for all issue |
---|
| 162 | |
---|
| 163 | for (std::list<generic::priority::select_t>::iterator it=select->begin(); |
---|
| 164 | it!=select->end(); |
---|
| 165 | it++) |
---|
| 166 | { |
---|
| 167 | uint32_t num_bank=it->grp; |
---|
| 168 | |
---|
| 169 | // log_printf(TRACE,Issue_queue,Issue_queue,FUNCTION," * Bank [%d]",num_bank); |
---|
| 170 | |
---|
| 171 | // Have instruction ? |
---|
| 172 | if (not _issue_queue [num_bank].empty()) |
---|
| 173 | { |
---|
| 174 | // log_printf(TRACE,Issue_queue,Issue_queue,FUNCTION," * Not Empty !!!"); |
---|
| 175 | |
---|
| 176 | entry_t* entry = _issue_queue [num_bank].front(); |
---|
| 177 | |
---|
| 178 | for (uint32_t i=0; i<_param->_nb_inst_issue; i++) |
---|
| 179 | // test if no previous transaction and can accept this type |
---|
[117] | 180 | if ((val[i] == 0) |
---|
| 181 | // and _param->_table_issue_type [i][entry->_type] |
---|
| 182 | ) |
---|
[111] | 183 | { |
---|
| 184 | // find a issue port |
---|
| 185 | val [i] = 1; |
---|
| 186 | |
---|
| 187 | if (_param->_have_port_context_id) |
---|
| 188 | PORT_WRITE(out_ISSUE_OUT_CONTEXT_ID [i], entry->_context_id ); |
---|
| 189 | if (_param->_have_port_front_end_id) |
---|
| 190 | PORT_WRITE(out_ISSUE_OUT_FRONT_END_ID [i], entry->_front_end_id ); |
---|
| 191 | if (_param->_have_port_rob_ptr ) |
---|
| 192 | PORT_WRITE(out_ISSUE_OUT_PACKET_ID [i], entry->_packet_id ); |
---|
| 193 | PORT_WRITE(out_ISSUE_OUT_OPERATION [i], entry->_operation ); |
---|
| 194 | PORT_WRITE(out_ISSUE_OUT_TYPE [i], entry->_type ); |
---|
[136] | 195 | PORT_WRITE(out_ISSUE_OUT_CANCEL [i], 0 ); |
---|
[111] | 196 | PORT_WRITE(out_ISSUE_OUT_STORE_QUEUE_PTR_WRITE [i], entry->_store_queue_ptr_write); |
---|
[122] | 197 | PORT_WRITE(out_ISSUE_OUT_STORE_QUEUE_PTR_READ [i], entry->_store_queue_ptr_read ); |
---|
| 198 | PORT_WRITE(out_ISSUE_OUT_STORE_QUEUE_EMPTY [i], entry->_store_queue_empty ); |
---|
[111] | 199 | if (_param->_have_port_load_queue_ptr) |
---|
| 200 | PORT_WRITE(out_ISSUE_OUT_LOAD_QUEUE_PTR_WRITE [i], entry->_load_queue_ptr_write ); |
---|
| 201 | PORT_WRITE(out_ISSUE_OUT_HAS_IMMEDIAT [i], entry->_has_immediat ); |
---|
| 202 | PORT_WRITE(out_ISSUE_OUT_IMMEDIAT [i], entry->_immediat ); |
---|
| 203 | PORT_WRITE(out_ISSUE_OUT_READ_RA [i], entry->_read_ra ); |
---|
| 204 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RA [i], entry->_num_reg_ra ); |
---|
| 205 | PORT_WRITE(out_ISSUE_OUT_READ_RB [i], entry->_read_rb ); |
---|
| 206 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RB [i], entry->_num_reg_rb ); |
---|
| 207 | PORT_WRITE(out_ISSUE_OUT_READ_RC [i], entry->_read_rc ); |
---|
| 208 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RC [i], entry->_num_reg_rc ); |
---|
| 209 | PORT_WRITE(out_ISSUE_OUT_WRITE_RD [i], entry->_write_rd ); |
---|
| 210 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RD [i], entry->_num_reg_rd ); |
---|
| 211 | PORT_WRITE(out_ISSUE_OUT_WRITE_RE [i], entry->_write_re ); |
---|
| 212 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RE [i], entry->_num_reg_re ); |
---|
| 213 | |
---|
| 214 | internal_ISSUE_OUT_FROM_REEXECUTE [i] = false; |
---|
| 215 | internal_ISSUE_OUT_NUM_BANK [i] = num_bank; |
---|
| 216 | internal_ISSUE_OUT_ENTRY [i] = entry; |
---|
| 217 | |
---|
| 218 | break; // stop scan |
---|
| 219 | } |
---|
| 220 | } |
---|
| 221 | } |
---|
| 222 | |
---|
| 223 | for (uint32_t i=0; i<_param->_nb_inst_issue; i++) |
---|
| 224 | { |
---|
| 225 | internal_ISSUE_OUT_VAL [i] = val [i]; |
---|
| 226 | } |
---|
| 227 | } |
---|
[123] | 228 | } |
---|
| 229 | else |
---|
| 230 | { |
---|
| 231 | // Reset |
---|
| 232 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 233 | { |
---|
| 234 | internal_BANK_IN_ACK [i] = 0; |
---|
| 235 | // internal_BANK_IN_NUM_RENAME_UNIT [num_bank] = num_rename_unit; |
---|
| 236 | // internal_BANK_IN_NUM_INST [num_bank] = num_inst_rename; |
---|
| 237 | } |
---|
| 238 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
| 239 | for (uint32_t j=0; j<_param->_nb_inst_rename[i]; j++) |
---|
| 240 | PORT_WRITE(out_ISSUE_IN_ACK [i][j],0); |
---|
[111] | 241 | |
---|
[123] | 242 | for (uint32_t i=0; i<_param->_nb_inst_issue; i++) |
---|
| 243 | { |
---|
| 244 | internal_ISSUE_OUT_VAL [i] = 0; |
---|
| 245 | // internal_ISSUE_OUT_FROM_REEXECUTE [i] = true; |
---|
| 246 | // internal_ISSUE_OUT_NUM_BANK [i] = num_bank; |
---|
| 247 | // internal_ISSUE_OUT_ENTRY [i] = entry; |
---|
| 248 | } |
---|
| 249 | } |
---|
| 250 | |
---|
| 251 | // Write output |
---|
| 252 | for (uint32_t i=0; i<_param->_nb_inst_issue; i++) |
---|
| 253 | { |
---|
| 254 | PORT_WRITE(out_ISSUE_OUT_VAL [i], internal_ISSUE_OUT_VAL [i]); |
---|
| 255 | } |
---|
| 256 | |
---|
[111] | 257 | log_end(Issue_queue,FUNCTION); |
---|
| 258 | }; |
---|
| 259 | |
---|
| 260 | }; // end namespace issue_queue |
---|
| 261 | }; // end namespace ooo_engine |
---|
| 262 | }; // end namespace multi_ooo_engine |
---|
| 263 | }; // end namespace core |
---|
| 264 | |
---|
| 265 | }; // end namespace behavioural |
---|
| 266 | }; // end namespace morpheo |
---|
| 267 | #endif |
---|