[54] | 1 | #ifdef SYSTEMC |
---|
| 2 | //#if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 3 | /* |
---|
| 4 | * $Id: Read_queue_transition.cpp 122 2009-06-03 08:15:51Z rosiere $ |
---|
| 5 | * |
---|
| 6 | * [ Description ] |
---|
| 7 | * |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Read_queue/include/Read_queue.h" |
---|
| 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | namespace core { |
---|
| 15 | namespace multi_execute_loop { |
---|
| 16 | namespace execute_loop { |
---|
| 17 | namespace multi_read_unit { |
---|
| 18 | namespace read_unit { |
---|
| 19 | namespace read_queue { |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | #undef FUNCTION |
---|
| 23 | #define FUNCTION "Read_queue::transition" |
---|
| 24 | void Read_queue::transition (void) |
---|
| 25 | { |
---|
[88] | 26 | log_begin(Read_queue,FUNCTION); |
---|
| 27 | log_function(Read_queue,FUNCTION,_name.c_str()); |
---|
[54] | 28 | |
---|
| 29 | if (PORT_READ(in_NRESET) == 0) |
---|
| 30 | { |
---|
| 31 | // Flush queue |
---|
| 32 | // FIXME "queue reset" |
---|
| 33 | // > 1) flush one slot by cycle |
---|
| 34 | // > 2) flush all slot in one cycle |
---|
| 35 | |
---|
[112] | 36 | while (_queue->empty() == false) |
---|
| 37 | { |
---|
| 38 | delete _queue->front(); |
---|
| 39 | _queue->pop_front(); |
---|
| 40 | } |
---|
| 41 | // _queue->clear(); |
---|
[88] | 42 | |
---|
| 43 | // Init, else error in registerfile |
---|
| 44 | _queue_head->_ooo_engine_id = 0; |
---|
[54] | 45 | } |
---|
| 46 | else |
---|
| 47 | { |
---|
| 48 | // cout << "Transition Begin : Print queue_head" << endl; |
---|
| 49 | // if (_queue->empty ()) |
---|
| 50 | // cout << "queue is empty !!!" << endl; |
---|
| 51 | // else |
---|
| 52 | // cout << (*_queue_head) << endl; |
---|
| 53 | |
---|
[88] | 54 | log_printf(TRACE,Read_queue,FUNCTION," * Read_queue size (begin) : %d",(int)_queue->size()); |
---|
[54] | 55 | // Write to read_queue |
---|
| 56 | |
---|
[55] | 57 | bool not_full = not (_queue->size() == _param->_size_queue); |
---|
[54] | 58 | bool empty = _queue->empty(); |
---|
[68] | 59 | bool need_new_head = false; |
---|
[54] | 60 | |
---|
[88] | 61 | log_printf(TRACE,Read_queue,FUNCTION," * test transaction READ_QUEUE_IN : %d,%d",PORT_READ(in_READ_QUEUE_IN_VAL), not_full); |
---|
[54] | 62 | if ((PORT_READ(in_READ_QUEUE_IN_VAL) == 1) and not_full) |
---|
| 63 | { |
---|
| 64 | Tread_queue_entry_t * entry = new Tread_queue_entry_t; |
---|
| 65 | |
---|
[68] | 66 | if(_param->_have_port_context_id ) |
---|
[117] | 67 | entry->_context_id = PORT_READ(in_READ_QUEUE_IN_CONTEXT_ID ); |
---|
[68] | 68 | if(_param->_have_port_front_end_id ) |
---|
[117] | 69 | entry->_front_end_id = PORT_READ(in_READ_QUEUE_IN_FRONT_END_ID); |
---|
[68] | 70 | if(_param->_have_port_ooo_engine_id) |
---|
[117] | 71 | entry->_ooo_engine_id= PORT_READ(in_READ_QUEUE_IN_OOO_ENGINE_ID); |
---|
[88] | 72 | if(_param->_have_port_rob_ptr ) |
---|
[117] | 73 | entry->_rob_id = PORT_READ(in_READ_QUEUE_IN_ROB_ID ); |
---|
[54] | 74 | entry->_operation = PORT_READ(in_READ_QUEUE_IN_OPERATION ); |
---|
| 75 | entry->_type = PORT_READ(in_READ_QUEUE_IN_TYPE ); |
---|
[76] | 76 | entry->_store_queue_ptr_write = PORT_READ(in_READ_QUEUE_IN_STORE_QUEUE_PTR_WRITE); |
---|
[122] | 77 | entry->_store_queue_ptr_read = PORT_READ(in_READ_QUEUE_IN_STORE_QUEUE_PTR_READ ); |
---|
| 78 | entry->_store_queue_empty = PORT_READ(in_READ_QUEUE_IN_STORE_QUEUE_EMPTY ); |
---|
[78] | 79 | if (_param->_have_port_load_queue_ptr) |
---|
[76] | 80 | entry->_load_queue_ptr_write = PORT_READ(in_READ_QUEUE_IN_LOAD_QUEUE_PTR_WRITE ); |
---|
[54] | 81 | entry->_has_immediat = PORT_READ(in_READ_QUEUE_IN_HAS_IMMEDIAT); |
---|
| 82 | entry->_immediat = PORT_READ(in_READ_QUEUE_IN_IMMEDIAT ); |
---|
| 83 | entry->_read_ra = PORT_READ(in_READ_QUEUE_IN_READ_RA ); |
---|
| 84 | entry->_num_reg_ra = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RA ); |
---|
| 85 | entry->_read_rb = PORT_READ(in_READ_QUEUE_IN_READ_RB ); |
---|
| 86 | entry->_num_reg_rb = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RB ); |
---|
| 87 | entry->_read_rc = PORT_READ(in_READ_QUEUE_IN_READ_RC ); |
---|
| 88 | entry->_num_reg_rc = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RC ); |
---|
| 89 | entry->_write_rd = PORT_READ(in_READ_QUEUE_IN_WRITE_RD ); |
---|
| 90 | entry->_num_reg_rd = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RD ); |
---|
| 91 | entry->_write_re = PORT_READ(in_READ_QUEUE_IN_WRITE_RE ); |
---|
| 92 | entry->_num_reg_re = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RE ); |
---|
| 93 | |
---|
[88] | 94 | log_printf(TRACE,Read_queue,FUNCTION," * push (id : %d-%d)",entry->_context_id, entry->_rob_id); |
---|
| 95 | _queue->push_back(entry); |
---|
[54] | 96 | |
---|
| 97 | // read next new head |
---|
| 98 | if (empty) |
---|
| 99 | { |
---|
[88] | 100 | log_printf(TRACE,Read_queue,FUNCTION," * queue was empty"); |
---|
[68] | 101 | need_new_head = true; |
---|
[54] | 102 | } |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | // Read from read_queue |
---|
[88] | 106 | log_printf(TRACE,Read_queue,FUNCTION," * test transaction READ_QUEUE_OUT : %d,%d",internal_READ_QUEUE_OUT_VAL, PORT_READ(in_READ_QUEUE_OUT_ACK)); |
---|
[54] | 107 | if (( internal_READ_QUEUE_OUT_VAL == 1) and |
---|
| 108 | (PORT_READ(in_READ_QUEUE_OUT_ACK) == 1)) |
---|
| 109 | { |
---|
| 110 | // Pop the entry |
---|
[88] | 111 | log_printf(TRACE,Read_queue,FUNCTION," * pop (id : %d-%d)",_queue->front()->_context_id, _queue->front()->_rob_id); |
---|
| 112 | _queue->pop_front(); |
---|
[54] | 113 | |
---|
| 114 | // read next new head |
---|
| 115 | if (_queue->empty() == false) |
---|
| 116 | { |
---|
[88] | 117 | log_printf(TRACE,Read_queue,FUNCTION," * queue was not empty"); |
---|
[68] | 118 | need_new_head = true; |
---|
[54] | 119 | } |
---|
| 120 | } |
---|
| 121 | else |
---|
| 122 | { |
---|
| 123 | // no transaction, update queue_head |
---|
| 124 | _queue_head->_read_ra_val = internal_READ_QUEUE_OUT_READ_RA_VAL ; |
---|
| 125 | _queue_head->_data_ra_val = internal_READ_QUEUE_OUT_DATA_RA_VAL ; |
---|
| 126 | _queue_head->_data_ra = internal_READ_QUEUE_OUT_DATA_RA ; |
---|
| 127 | |
---|
| 128 | _queue_head->_read_rb_val = internal_READ_QUEUE_OUT_READ_RB_VAL ; |
---|
| 129 | _queue_head->_data_rb_val = internal_READ_QUEUE_OUT_DATA_RB_VAL ; |
---|
| 130 | _queue_head->_data_rb = internal_READ_QUEUE_OUT_DATA_RB ; |
---|
| 131 | |
---|
| 132 | _queue_head->_read_rc_val = internal_READ_QUEUE_OUT_READ_RC_VAL ; |
---|
| 133 | _queue_head->_data_rc_val = internal_READ_QUEUE_OUT_DATA_RC_VAL ; |
---|
| 134 | _queue_head->_data_rc = internal_READ_QUEUE_OUT_DATA_RC ; |
---|
| 135 | } |
---|
| 136 | |
---|
[68] | 137 | if (need_new_head == true) |
---|
[54] | 138 | { |
---|
[88] | 139 | log_printf(TRACE,Read_queue,FUNCTION," * new head"); |
---|
[54] | 140 | (*_queue_head) = (*_queue->front()); |
---|
| 141 | } |
---|
| 142 | |
---|
| 143 | // cout << "Transition End : Print queue_head" << endl; |
---|
| 144 | // if (_queue->empty ()) |
---|
| 145 | // cout << "queue is empty !!!" << endl; |
---|
| 146 | // else |
---|
| 147 | // cout << (*_queue_head) << endl; |
---|
| 148 | |
---|
[88] | 149 | #if (DEBUG >= DEBUG_TRACE) and (DEBUG_Read_queue == true) |
---|
| 150 | log_printf(TRACE,Read_queue,FUNCTION," * Dump Read_queue"); |
---|
[111] | 151 | log_printf(TRACE,Read_queue,FUNCTION," * size : %d / %d",(int)_queue->size(),_param->_size_queue); |
---|
[88] | 152 | |
---|
| 153 | if (_queue->size()>0) |
---|
| 154 | { |
---|
[122] | 155 | log_printf(TRACE,Read_queue,FUNCTION," * [%.4d] %.2d %.2d %.2d %.4d, %.2d %.3d, %.2d %.2d %.1d %.2d, %.1d %.8x, %.1d %.1d %.4d %.1d %.8x, %.1d %.1d %.4d %.1d %.8x, %.1d %.1d %.4d %.1d %.2x, %.1d %.4d, %.1d %.4d (%s)", |
---|
[88] | 156 | 0, |
---|
| 157 | |
---|
| 158 | _queue_head->_context_id , |
---|
| 159 | _queue_head->_front_end_id , |
---|
| 160 | _queue_head->_ooo_engine_id , |
---|
| 161 | _queue_head->_rob_id , |
---|
| 162 | |
---|
| 163 | _queue_head->_type , |
---|
| 164 | _queue_head->_operation , |
---|
| 165 | |
---|
| 166 | _queue_head->_store_queue_ptr_write, |
---|
[122] | 167 | _queue_head->_store_queue_ptr_read , |
---|
| 168 | _queue_head->_store_queue_empty , |
---|
[88] | 169 | _queue_head->_load_queue_ptr_write , |
---|
| 170 | |
---|
| 171 | _queue_head->_has_immediat , |
---|
| 172 | _queue_head->_immediat , |
---|
| 173 | |
---|
| 174 | _queue_head->_read_ra , |
---|
| 175 | _queue_head->_read_ra_val , |
---|
| 176 | _queue_head->_num_reg_ra , |
---|
| 177 | _queue_head->_data_ra_val , |
---|
| 178 | _queue_head->_data_ra , |
---|
| 179 | |
---|
| 180 | _queue_head->_read_rb , |
---|
| 181 | _queue_head->_read_rb_val , |
---|
| 182 | _queue_head->_num_reg_rb , |
---|
| 183 | _queue_head->_data_rb_val , |
---|
| 184 | _queue_head->_data_rb , |
---|
| 185 | |
---|
| 186 | _queue_head->_read_rc , |
---|
| 187 | _queue_head->_read_rc_val , |
---|
| 188 | _queue_head->_num_reg_rc , |
---|
| 189 | _queue_head->_data_rc_val , |
---|
| 190 | _queue_head->_data_rc , |
---|
| 191 | |
---|
| 192 | _queue_head->_write_rd , |
---|
| 193 | _queue_head->_num_reg_rd , |
---|
| 194 | |
---|
| 195 | _queue_head->_write_re , |
---|
| 196 | _queue_head->_num_reg_re , |
---|
| 197 | |
---|
[97] | 198 | toString(_queue_head->_type).c_str()); |
---|
[88] | 199 | |
---|
| 200 | |
---|
| 201 | std::list<Tread_queue_entry_t *>::iterator it=_queue->begin(); |
---|
| 202 | ++it; // first is already printed |
---|
| 203 | uint32_t i=1; |
---|
| 204 | |
---|
| 205 | for (;it!=_queue->end(); ++it) |
---|
| 206 | { |
---|
[122] | 207 | log_printf(TRACE,Read_queue,FUNCTION," * [%.4d] %.2d %.2d %.2d %.4d, %.2d %.3d, %.2d %.2d %.1d %.2d, %.1d %.8x, %.1d %.4d , %.1d %.4d , %.1d %.4d , %.1d %.4d, %.1d %.4d (%s)", |
---|
[88] | 208 | i, |
---|
| 209 | |
---|
| 210 | (*it)->_context_id , |
---|
| 211 | (*it)->_front_end_id , |
---|
| 212 | (*it)->_ooo_engine_id , |
---|
| 213 | (*it)->_rob_id , |
---|
| 214 | |
---|
| 215 | (*it)->_type , |
---|
| 216 | (*it)->_operation , |
---|
| 217 | |
---|
| 218 | (*it)->_store_queue_ptr_write, |
---|
[122] | 219 | (*it)->_store_queue_ptr_read , |
---|
| 220 | (*it)->_store_queue_empty , |
---|
[88] | 221 | (*it)->_load_queue_ptr_write , |
---|
| 222 | |
---|
| 223 | (*it)->_has_immediat , |
---|
| 224 | (*it)->_immediat , |
---|
| 225 | |
---|
| 226 | (*it)->_read_ra , |
---|
| 227 | // (*it)->_read_ra_val , |
---|
| 228 | (*it)->_num_reg_ra , |
---|
| 229 | // (*it)->_data_ra_val , |
---|
| 230 | // (*it)->_data_ra , |
---|
| 231 | |
---|
| 232 | (*it)->_read_rb , |
---|
| 233 | // (*it)->_read_rb_val , |
---|
| 234 | (*it)->_num_reg_rb , |
---|
| 235 | // (*it)->_data_rb_val , |
---|
| 236 | // (*it)->_data_rb , |
---|
| 237 | |
---|
| 238 | (*it)->_read_rc , |
---|
| 239 | // (*it)->_read_rc_val , |
---|
| 240 | (*it)->_num_reg_rc , |
---|
| 241 | // (*it)->_data_rc_val , |
---|
| 242 | // (*it)->_data_rc , |
---|
| 243 | |
---|
| 244 | (*it)->_write_rd , |
---|
| 245 | (*it)->_num_reg_rd , |
---|
| 246 | |
---|
| 247 | (*it)->_write_re , |
---|
| 248 | (*it)->_num_reg_re , |
---|
| 249 | |
---|
[97] | 250 | toString((*it)->_type).c_str()); |
---|
[88] | 251 | |
---|
| 252 | ++i; |
---|
| 253 | } |
---|
| 254 | } |
---|
| 255 | #endif |
---|
[54] | 256 | } |
---|
| 257 | |
---|
[75] | 258 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
[88] | 259 | end_cycle (); |
---|
[54] | 260 | #endif |
---|
| 261 | |
---|
[88] | 262 | log_end(Read_queue,FUNCTION); |
---|
[54] | 263 | }; |
---|
| 264 | |
---|
| 265 | }; // end namespace read_queue |
---|
| 266 | }; // end namespace read_unit |
---|
| 267 | }; // end namespace multi_read_unit |
---|
| 268 | }; // end namespace execute_loop |
---|
| 269 | }; // end namespace multi_execute_loop |
---|
| 270 | }; // end namespace core |
---|
| 271 | |
---|
| 272 | }; // end namespace behavioural |
---|
| 273 | }; // end namespace morpheo |
---|
| 274 | #endif |
---|
| 275 | //#endif |
---|