[88] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Issue_queue_transition.cpp 110 2009-02-19 16:31:47Z 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::transition" |
---|
| 21 | void Issue_queue::transition (void) |
---|
| 22 | { |
---|
| 23 | log_begin(Issue_queue,FUNCTION); |
---|
| 24 | log_function(Issue_queue,FUNCTION,_name.c_str()); |
---|
| 25 | |
---|
| 26 | if (PORT_READ(in_NRESET) == 0) |
---|
| 27 | { |
---|
| 28 | _priority_in ->reset(); |
---|
| 29 | _priority_out->reset(); |
---|
| 30 | _priority_reg->reset(); |
---|
| 31 | |
---|
| 32 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 33 | _issue_queue [i].clear(); |
---|
[110] | 34 | _reexecute_queue.clear(); |
---|
[88] | 35 | } |
---|
| 36 | else |
---|
| 37 | { |
---|
| 38 | _priority_in ->transition(); |
---|
| 39 | _priority_out->transition(); |
---|
| 40 | _priority_reg->transition(); |
---|
| 41 | |
---|
| 42 | // =================================================================== |
---|
| 43 | // =====[ ISSUE_IN ]================================================== |
---|
| 44 | // =================================================================== |
---|
[110] | 45 | |
---|
[88] | 46 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 47 | if (internal_BANK_IN_ACK [i]) |
---|
| 48 | { |
---|
[110] | 49 | uint32_t x = internal_BANK_IN_NUM_RENAME_UNIT [i]; |
---|
| 50 | uint32_t y = internal_BANK_IN_NUM_INST [i]; |
---|
| 51 | |
---|
| 52 | if (PORT_READ(in_ISSUE_IN_VAL[x][y])) |
---|
| 53 | { |
---|
| 54 | log_printf(TRACE,Issue_queue,FUNCTION," * ISSUE_IN [%d] - Transaction with ISSUE_IN [%d][%d]",i,x,y); |
---|
[88] | 55 | |
---|
| 56 | #ifdef STATISTICS |
---|
[110] | 57 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 58 | (*_stat_nb_inst_issue_in [x]) ++; |
---|
[88] | 59 | #endif |
---|
[110] | 60 | entry_t * entry = new entry_t |
---|
| 61 | ( |
---|
| 62 | (_param->_have_port_context_id )?PORT_READ(in_ISSUE_IN_CONTEXT_ID [x][y]):0, |
---|
| 63 | (_param->_have_port_front_end_id )?PORT_READ(in_ISSUE_IN_FRONT_END_ID [x][y]):0, |
---|
| 64 | (_param->_have_port_rob_ptr )?PORT_READ(in_ISSUE_IN_PACKET_ID [x][y]):0, |
---|
| 65 | PORT_READ(in_ISSUE_IN_OPERATION [x][y]), |
---|
| 66 | PORT_READ(in_ISSUE_IN_TYPE [x][y]), |
---|
| 67 | PORT_READ(in_ISSUE_IN_STORE_QUEUE_PTR_WRITE [x][y]), |
---|
| 68 | (_param->_have_port_load_queue_ptr)?PORT_READ(in_ISSUE_IN_LOAD_QUEUE_PTR_WRITE [x][y]):0, |
---|
| 69 | PORT_READ(in_ISSUE_IN_HAS_IMMEDIAT [x][y]), |
---|
| 70 | PORT_READ(in_ISSUE_IN_IMMEDIAT [x][y]), |
---|
| 71 | PORT_READ(in_ISSUE_IN_READ_RA [x][y]), |
---|
| 72 | PORT_READ(in_ISSUE_IN_NUM_REG_RA [x][y]), |
---|
| 73 | PORT_READ(in_ISSUE_IN_READ_RB [x][y]), |
---|
| 74 | PORT_READ(in_ISSUE_IN_NUM_REG_RB [x][y]), |
---|
| 75 | PORT_READ(in_ISSUE_IN_READ_RC [x][y]), |
---|
| 76 | PORT_READ(in_ISSUE_IN_NUM_REG_RC [x][y]), |
---|
| 77 | PORT_READ(in_ISSUE_IN_WRITE_RD [x][y]), |
---|
| 78 | PORT_READ(in_ISSUE_IN_NUM_REG_RD [x][y]), |
---|
| 79 | PORT_READ(in_ISSUE_IN_WRITE_RE [x][y]), |
---|
| 80 | PORT_READ(in_ISSUE_IN_NUM_REG_RE [x][y]) |
---|
| 81 | ); |
---|
[88] | 82 | |
---|
[110] | 83 | _issue_queue [i].push_back(entry); |
---|
| 84 | } |
---|
| 85 | } |
---|
[109] | 86 | |
---|
[110] | 87 | // =================================================================== |
---|
| 88 | // =====[ REEXECUTE_UNIT ]============================================ |
---|
| 89 | // =================================================================== |
---|
| 90 | |
---|
| 91 | for (uint32_t i=0; i<_param->_nb_inst_reexecute; ++i) |
---|
| 92 | if (PORT_READ(in_REEXECUTE_VAL [i]) and internal_REEXECUTE_ACK [i]) |
---|
| 93 | { |
---|
| 94 | log_printf(TRACE,Issue_queue,FUNCTION," * REEXECUTE [%d]",i); |
---|
[88] | 95 | #ifdef STATISTICS |
---|
[110] | 96 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 97 | (*_stat_nb_inst_reexecute) ++; |
---|
[88] | 98 | #endif |
---|
[110] | 99 | entry_t * entry = new entry_t |
---|
| 100 | ( |
---|
| 101 | (_param->_have_port_context_id )?PORT_READ(in_REEXECUTE_CONTEXT_ID [i]):0, |
---|
| 102 | (_param->_have_port_front_end_id )?PORT_READ(in_REEXECUTE_FRONT_END_ID [i]):0, |
---|
| 103 | (_param->_have_port_rob_ptr )?PORT_READ(in_REEXECUTE_PACKET_ID [i]):0, |
---|
| 104 | PORT_READ(in_REEXECUTE_OPERATION [i]), |
---|
| 105 | PORT_READ(in_REEXECUTE_TYPE [i]), |
---|
| 106 | PORT_READ(in_REEXECUTE_STORE_QUEUE_PTR_WRITE [i]), |
---|
| 107 | (_param->_have_port_load_queue_ptr)?PORT_READ(in_REEXECUTE_LOAD_QUEUE_PTR_WRITE [i]):0, |
---|
| 108 | PORT_READ(in_REEXECUTE_HAS_IMMEDIAT [i]), |
---|
| 109 | PORT_READ(in_REEXECUTE_IMMEDIAT [i]), |
---|
| 110 | PORT_READ(in_REEXECUTE_READ_RA [i]), |
---|
| 111 | PORT_READ(in_REEXECUTE_NUM_REG_RA [i]), |
---|
| 112 | PORT_READ(in_REEXECUTE_READ_RB [i]), |
---|
| 113 | PORT_READ(in_REEXECUTE_NUM_REG_RB [i]), |
---|
| 114 | PORT_READ(in_REEXECUTE_READ_RC [i]), |
---|
| 115 | PORT_READ(in_REEXECUTE_NUM_REG_RC [i]), |
---|
| 116 | PORT_READ(in_REEXECUTE_WRITE_RD [i]), |
---|
| 117 | PORT_READ(in_REEXECUTE_NUM_REG_RD [i]), |
---|
| 118 | PORT_READ(in_REEXECUTE_WRITE_RE [i]), |
---|
| 119 | PORT_READ(in_REEXECUTE_NUM_REG_RE [i]) |
---|
| 120 | ); |
---|
[88] | 121 | |
---|
[110] | 122 | _reexecute_queue.push_back(entry); |
---|
| 123 | } |
---|
[88] | 124 | |
---|
| 125 | // =================================================================== |
---|
| 126 | // =====[ ISSUE_OUT ]================================================= |
---|
| 127 | // =================================================================== |
---|
| 128 | |
---|
[110] | 129 | for (uint32_t i=0; i<_param->_nb_inst_issue; ++i) |
---|
| 130 | if (internal_ISSUE_OUT_VAL [i] and PORT_READ(in_ISSUE_OUT_ACK [i])) |
---|
| 131 | { |
---|
| 132 | entry_t * entry = internal_ISSUE_OUT_ENTRY [i]; |
---|
[88] | 133 | |
---|
[110] | 134 | if (internal_ISSUE_OUT_FROM_REEXECUTE [i]) |
---|
| 135 | { |
---|
| 136 | log_printf(TRACE,Issue_queue,FUNCTION," * ISSUE_OUT [%d] - From Reexecute_queue",i); |
---|
| 137 | |
---|
| 138 | _reexecute_queue.remove(entry); |
---|
| 139 | } |
---|
| 140 | else |
---|
| 141 | { |
---|
| 142 | // front ... |
---|
| 143 | uint32_t num_bank = internal_ISSUE_OUT_NUM_BANK [i]; |
---|
[109] | 144 | |
---|
[110] | 145 | log_printf(TRACE,Issue_queue,FUNCTION," * ISSUE_OUT [%d] - From issue_queue [%d]",i,num_bank); |
---|
[109] | 146 | |
---|
[110] | 147 | _issue_queue [num_bank].remove(entry); |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | delete entry; |
---|
| 151 | } |
---|
[88] | 152 | } |
---|
| 153 | |
---|
[110] | 154 | #if defined(DEBUG) and defined(DEBUG_Issue_queue) and (DEBUG >= DEBUG_TRACE) |
---|
[109] | 155 | log_printf(TRACE,Issue_queue,FUNCTION," * Dump Issue_queue"); |
---|
[110] | 156 | |
---|
[88] | 157 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 158 | { |
---|
[109] | 159 | log_printf(TRACE,Issue_queue,FUNCTION," * Bank [%d] size : %d",i,(int)_issue_queue[i].size()); |
---|
| 160 | |
---|
| 161 | uint32_t j = 0; |
---|
| 162 | for (std::list<entry_t*>::iterator it=_issue_queue[i].begin();it!=_issue_queue[i].end(); ++it) |
---|
| 163 | { |
---|
| 164 | log_printf(TRACE,Issue_queue,FUNCTION," [%.4d] %.2d %.2d %.4d, %.2d %.3d, %.2d %.2d, %.1d %.8x, %.1d %.4d, %.1d %.4d, %.1d %.4d, %.1d %.4d, %.1d %.4d", |
---|
| 165 | j, |
---|
| 166 | |
---|
| 167 | (*it)->_context_id , |
---|
| 168 | (*it)->_front_end_id , |
---|
| 169 | (*it)->_packet_id , |
---|
| 170 | |
---|
| 171 | (*it)->_type , |
---|
| 172 | (*it)->_operation , |
---|
| 173 | |
---|
| 174 | (*it)->_store_queue_ptr_write, |
---|
| 175 | (*it)->_load_queue_ptr_write , |
---|
| 176 | |
---|
| 177 | (*it)->_has_immediat , |
---|
| 178 | (*it)->_immediat , |
---|
| 179 | |
---|
| 180 | (*it)->_read_ra , |
---|
| 181 | (*it)->_num_reg_ra , |
---|
| 182 | |
---|
| 183 | (*it)->_read_rb , |
---|
| 184 | (*it)->_num_reg_rb , |
---|
| 185 | |
---|
| 186 | (*it)->_read_rc , |
---|
| 187 | (*it)->_num_reg_rc , |
---|
| 188 | |
---|
| 189 | (*it)->_write_rd , |
---|
| 190 | (*it)->_num_reg_rd , |
---|
| 191 | |
---|
| 192 | (*it)->_write_re , |
---|
| 193 | (*it)->_num_reg_re ); |
---|
| 194 | |
---|
| 195 | ++j; |
---|
| 196 | } |
---|
[88] | 197 | } |
---|
| 198 | |
---|
[110] | 199 | { |
---|
| 200 | log_printf(TRACE,Issue_queue,FUNCTION," * Reexecute_queue - size : %d",(int)_reexecute_queue.size()); |
---|
| 201 | |
---|
| 202 | uint32_t i = 0; |
---|
| 203 | |
---|
| 204 | for (std::list<entry_t*>::iterator it=_reexecute_queue.begin();it!=_reexecute_queue.end(); ++it) |
---|
| 205 | { |
---|
| 206 | log_printf(TRACE,Issue_queue,FUNCTION," [%.4d] %.2d %.2d %.4d, %.2d %.3d, %.2d %.2d, %.1d %.8x, %.1d %.4d, %.1d %.4d, %.1d %.4d, %.1d %.4d, %.1d %.4d", |
---|
| 207 | i, |
---|
| 208 | |
---|
| 209 | (*it)->_context_id , |
---|
| 210 | (*it)->_front_end_id , |
---|
| 211 | (*it)->_packet_id , |
---|
| 212 | |
---|
| 213 | (*it)->_type , |
---|
| 214 | (*it)->_operation , |
---|
| 215 | |
---|
| 216 | (*it)->_store_queue_ptr_write, |
---|
| 217 | (*it)->_load_queue_ptr_write , |
---|
| 218 | |
---|
| 219 | (*it)->_has_immediat , |
---|
| 220 | (*it)->_immediat , |
---|
| 221 | |
---|
| 222 | (*it)->_read_ra , |
---|
| 223 | (*it)->_num_reg_ra , |
---|
| 224 | |
---|
| 225 | (*it)->_read_rb , |
---|
| 226 | (*it)->_num_reg_rb , |
---|
| 227 | |
---|
| 228 | (*it)->_read_rc , |
---|
| 229 | (*it)->_num_reg_rc , |
---|
| 230 | |
---|
| 231 | (*it)->_write_rd , |
---|
| 232 | (*it)->_num_reg_rd , |
---|
| 233 | |
---|
| 234 | (*it)->_write_re , |
---|
| 235 | (*it)->_num_reg_re ); |
---|
| 236 | ++i; |
---|
| 237 | } |
---|
| 238 | } |
---|
| 239 | #endif |
---|
| 240 | |
---|
| 241 | #ifdef STATISTICS |
---|
| 242 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 243 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 244 | *(_stat_bank_nb_inst [i]) += _issue_queue[i].size(); |
---|
| 245 | #endif |
---|
| 246 | |
---|
[88] | 247 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 248 | end_cycle (); |
---|
| 249 | #endif |
---|
| 250 | |
---|
| 251 | log_end(Issue_queue,FUNCTION); |
---|
| 252 | }; |
---|
| 253 | |
---|
| 254 | }; // end namespace issue_queue |
---|
| 255 | }; // end namespace ooo_engine |
---|
| 256 | }; // end namespace multi_ooo_engine |
---|
| 257 | }; // end namespace core |
---|
| 258 | |
---|
| 259 | }; // end namespace behavioural |
---|
| 260 | }; // end namespace morpheo |
---|
| 261 | #endif |
---|