[54] | 1 | #ifdef SYSTEMC |
---|
| 2 | //#if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 3 | /* |
---|
| 4 | * $Id: Read_queue_transition.cpp 112 2009-03-18 22:36:26Z 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 ) |
---|
| 67 | entry->_context_id = PORT_READ(in_READ_QUEUE_IN_CONTEXT_ID ); |
---|
| 68 | if(_param->_have_port_front_end_id ) |
---|
| 69 | entry->_front_end_id = PORT_READ(in_READ_QUEUE_IN_FRONT_END_ID); |
---|
| 70 | if(_param->_have_port_ooo_engine_id) |
---|
| 71 | entry->_ooo_engine_id= PORT_READ(in_READ_QUEUE_IN_OOO_ENGINE_ID); |
---|
[88] | 72 | if(_param->_have_port_rob_ptr ) |
---|
[68] | 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); |
---|
[78] | 77 | if (_param->_have_port_load_queue_ptr) |
---|
[76] | 78 | entry->_load_queue_ptr_write = PORT_READ(in_READ_QUEUE_IN_LOAD_QUEUE_PTR_WRITE ); |
---|
[54] | 79 | entry->_has_immediat = PORT_READ(in_READ_QUEUE_IN_HAS_IMMEDIAT); |
---|
| 80 | entry->_immediat = PORT_READ(in_READ_QUEUE_IN_IMMEDIAT ); |
---|
| 81 | entry->_read_ra = PORT_READ(in_READ_QUEUE_IN_READ_RA ); |
---|
| 82 | entry->_num_reg_ra = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RA ); |
---|
| 83 | entry->_read_rb = PORT_READ(in_READ_QUEUE_IN_READ_RB ); |
---|
| 84 | entry->_num_reg_rb = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RB ); |
---|
| 85 | entry->_read_rc = PORT_READ(in_READ_QUEUE_IN_READ_RC ); |
---|
| 86 | entry->_num_reg_rc = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RC ); |
---|
| 87 | entry->_write_rd = PORT_READ(in_READ_QUEUE_IN_WRITE_RD ); |
---|
| 88 | entry->_num_reg_rd = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RD ); |
---|
| 89 | entry->_write_re = PORT_READ(in_READ_QUEUE_IN_WRITE_RE ); |
---|
| 90 | entry->_num_reg_re = PORT_READ(in_READ_QUEUE_IN_NUM_REG_RE ); |
---|
| 91 | |
---|
[88] | 92 | log_printf(TRACE,Read_queue,FUNCTION," * push (id : %d-%d)",entry->_context_id, entry->_rob_id); |
---|
| 93 | _queue->push_back(entry); |
---|
[54] | 94 | |
---|
| 95 | // read next new head |
---|
| 96 | if (empty) |
---|
| 97 | { |
---|
[88] | 98 | log_printf(TRACE,Read_queue,FUNCTION," * queue was empty"); |
---|
[68] | 99 | need_new_head = true; |
---|
[54] | 100 | } |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | // Read from read_queue |
---|
[88] | 104 | 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] | 105 | if (( internal_READ_QUEUE_OUT_VAL == 1) and |
---|
| 106 | (PORT_READ(in_READ_QUEUE_OUT_ACK) == 1)) |
---|
| 107 | { |
---|
| 108 | // Pop the entry |
---|
[88] | 109 | log_printf(TRACE,Read_queue,FUNCTION," * pop (id : %d-%d)",_queue->front()->_context_id, _queue->front()->_rob_id); |
---|
| 110 | _queue->pop_front(); |
---|
[54] | 111 | |
---|
| 112 | // read next new head |
---|
| 113 | if (_queue->empty() == false) |
---|
| 114 | { |
---|
[88] | 115 | log_printf(TRACE,Read_queue,FUNCTION," * queue was not empty"); |
---|
[68] | 116 | need_new_head = true; |
---|
[54] | 117 | } |
---|
| 118 | } |
---|
| 119 | else |
---|
| 120 | { |
---|
| 121 | // no transaction, update queue_head |
---|
| 122 | _queue_head->_read_ra_val = internal_READ_QUEUE_OUT_READ_RA_VAL ; |
---|
| 123 | _queue_head->_data_ra_val = internal_READ_QUEUE_OUT_DATA_RA_VAL ; |
---|
| 124 | _queue_head->_data_ra = internal_READ_QUEUE_OUT_DATA_RA ; |
---|
| 125 | |
---|
| 126 | _queue_head->_read_rb_val = internal_READ_QUEUE_OUT_READ_RB_VAL ; |
---|
| 127 | _queue_head->_data_rb_val = internal_READ_QUEUE_OUT_DATA_RB_VAL ; |
---|
| 128 | _queue_head->_data_rb = internal_READ_QUEUE_OUT_DATA_RB ; |
---|
| 129 | |
---|
| 130 | _queue_head->_read_rc_val = internal_READ_QUEUE_OUT_READ_RC_VAL ; |
---|
| 131 | _queue_head->_data_rc_val = internal_READ_QUEUE_OUT_DATA_RC_VAL ; |
---|
| 132 | _queue_head->_data_rc = internal_READ_QUEUE_OUT_DATA_RC ; |
---|
| 133 | } |
---|
| 134 | |
---|
[68] | 135 | if (need_new_head == true) |
---|
[54] | 136 | { |
---|
[88] | 137 | log_printf(TRACE,Read_queue,FUNCTION," * new head"); |
---|
[54] | 138 | (*_queue_head) = (*_queue->front()); |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | // cout << "Transition End : Print queue_head" << endl; |
---|
| 142 | // if (_queue->empty ()) |
---|
| 143 | // cout << "queue is empty !!!" << endl; |
---|
| 144 | // else |
---|
| 145 | // cout << (*_queue_head) << endl; |
---|
| 146 | |
---|
[88] | 147 | #if (DEBUG >= DEBUG_TRACE) and (DEBUG_Read_queue == true) |
---|
| 148 | log_printf(TRACE,Read_queue,FUNCTION," * Dump Read_queue"); |
---|
[111] | 149 | log_printf(TRACE,Read_queue,FUNCTION," * size : %d / %d",(int)_queue->size(),_param->_size_queue); |
---|
[88] | 150 | |
---|
| 151 | if (_queue->size()>0) |
---|
| 152 | { |
---|
| 153 | log_printf(TRACE,Read_queue,FUNCTION," * [%.4d] %.2d %.2d %.2d %.4d, %.2d %.3d, %.2d %.2d, %.1d %.8x, %.1d %.1d %.4d %.1d %.8x, %.1d %.1d %.4d %.1d %.8x, %.1d %.1d %.4d %.1d %.2x, %.1d %.4d, %.1d %.4d (%s)", |
---|
| 154 | 0, |
---|
| 155 | |
---|
| 156 | _queue_head->_context_id , |
---|
| 157 | _queue_head->_front_end_id , |
---|
| 158 | _queue_head->_ooo_engine_id , |
---|
| 159 | _queue_head->_rob_id , |
---|
| 160 | |
---|
| 161 | _queue_head->_type , |
---|
| 162 | _queue_head->_operation , |
---|
| 163 | |
---|
| 164 | _queue_head->_store_queue_ptr_write, |
---|
| 165 | _queue_head->_load_queue_ptr_write , |
---|
| 166 | |
---|
| 167 | _queue_head->_has_immediat , |
---|
| 168 | _queue_head->_immediat , |
---|
| 169 | |
---|
| 170 | _queue_head->_read_ra , |
---|
| 171 | _queue_head->_read_ra_val , |
---|
| 172 | _queue_head->_num_reg_ra , |
---|
| 173 | _queue_head->_data_ra_val , |
---|
| 174 | _queue_head->_data_ra , |
---|
| 175 | |
---|
| 176 | _queue_head->_read_rb , |
---|
| 177 | _queue_head->_read_rb_val , |
---|
| 178 | _queue_head->_num_reg_rb , |
---|
| 179 | _queue_head->_data_rb_val , |
---|
| 180 | _queue_head->_data_rb , |
---|
| 181 | |
---|
| 182 | _queue_head->_read_rc , |
---|
| 183 | _queue_head->_read_rc_val , |
---|
| 184 | _queue_head->_num_reg_rc , |
---|
| 185 | _queue_head->_data_rc_val , |
---|
| 186 | _queue_head->_data_rc , |
---|
| 187 | |
---|
| 188 | _queue_head->_write_rd , |
---|
| 189 | _queue_head->_num_reg_rd , |
---|
| 190 | |
---|
| 191 | _queue_head->_write_re , |
---|
| 192 | _queue_head->_num_reg_re , |
---|
| 193 | |
---|
[97] | 194 | toString(_queue_head->_type).c_str()); |
---|
[88] | 195 | |
---|
| 196 | |
---|
| 197 | std::list<Tread_queue_entry_t *>::iterator it=_queue->begin(); |
---|
| 198 | ++it; // first is already printed |
---|
| 199 | uint32_t i=1; |
---|
| 200 | |
---|
| 201 | for (;it!=_queue->end(); ++it) |
---|
| 202 | { |
---|
| 203 | log_printf(TRACE,Read_queue,FUNCTION," * [%.4d] %.2d %.2d %.2d %.4d, %.2d %.3d, %.2d %.2d, %.1d %.8x, %.1d %.4d , %.1d %.4d , %.1d %.4d , %.1d %.4d, %.1d %.4d (%s)", |
---|
| 204 | i, |
---|
| 205 | |
---|
| 206 | (*it)->_context_id , |
---|
| 207 | (*it)->_front_end_id , |
---|
| 208 | (*it)->_ooo_engine_id , |
---|
| 209 | (*it)->_rob_id , |
---|
| 210 | |
---|
| 211 | (*it)->_type , |
---|
| 212 | (*it)->_operation , |
---|
| 213 | |
---|
| 214 | (*it)->_store_queue_ptr_write, |
---|
| 215 | (*it)->_load_queue_ptr_write , |
---|
| 216 | |
---|
| 217 | (*it)->_has_immediat , |
---|
| 218 | (*it)->_immediat , |
---|
| 219 | |
---|
| 220 | (*it)->_read_ra , |
---|
| 221 | // (*it)->_read_ra_val , |
---|
| 222 | (*it)->_num_reg_ra , |
---|
| 223 | // (*it)->_data_ra_val , |
---|
| 224 | // (*it)->_data_ra , |
---|
| 225 | |
---|
| 226 | (*it)->_read_rb , |
---|
| 227 | // (*it)->_read_rb_val , |
---|
| 228 | (*it)->_num_reg_rb , |
---|
| 229 | // (*it)->_data_rb_val , |
---|
| 230 | // (*it)->_data_rb , |
---|
| 231 | |
---|
| 232 | (*it)->_read_rc , |
---|
| 233 | // (*it)->_read_rc_val , |
---|
| 234 | (*it)->_num_reg_rc , |
---|
| 235 | // (*it)->_data_rc_val , |
---|
| 236 | // (*it)->_data_rc , |
---|
| 237 | |
---|
| 238 | (*it)->_write_rd , |
---|
| 239 | (*it)->_num_reg_rd , |
---|
| 240 | |
---|
| 241 | (*it)->_write_re , |
---|
| 242 | (*it)->_num_reg_re , |
---|
| 243 | |
---|
[97] | 244 | toString((*it)->_type).c_str()); |
---|
[88] | 245 | |
---|
| 246 | ++i; |
---|
| 247 | } |
---|
| 248 | } |
---|
| 249 | #endif |
---|
[54] | 250 | } |
---|
| 251 | |
---|
[75] | 252 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
[88] | 253 | end_cycle (); |
---|
[54] | 254 | #endif |
---|
| 255 | |
---|
[88] | 256 | log_end(Read_queue,FUNCTION); |
---|
[54] | 257 | }; |
---|
| 258 | |
---|
| 259 | }; // end namespace read_queue |
---|
| 260 | }; // end namespace read_unit |
---|
| 261 | }; // end namespace multi_read_unit |
---|
| 262 | }; // end namespace execute_loop |
---|
| 263 | }; // end namespace multi_execute_loop |
---|
| 264 | }; // end namespace core |
---|
| 265 | |
---|
| 266 | }; // end namespace behavioural |
---|
| 267 | }; // end namespace morpheo |
---|
| 268 | #endif |
---|
| 269 | //#endif |
---|