[73] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Execute_queue_transition.cpp 136 2009-10-20 18:52:15Z rosiere $ |
---|
| 4 | * |
---|
[96] | 5 | * [ Description ] |
---|
[73] | 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue/include/Execute_queue.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_execute_loop { |
---|
| 15 | namespace execute_loop { |
---|
| 16 | namespace multi_write_unit { |
---|
| 17 | namespace write_unit { |
---|
| 18 | namespace execute_queue { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Execute_queue::transition" |
---|
| 23 | void Execute_queue::transition (void) |
---|
| 24 | { |
---|
[101] | 25 | log_begin(Execute_queue,FUNCTION); |
---|
| 26 | log_function(Execute_queue,FUNCTION,_name.c_str()); |
---|
[73] | 27 | |
---|
| 28 | if (PORT_READ(in_NRESET) == 0) |
---|
| 29 | { |
---|
| 30 | // Flush queue |
---|
| 31 | // FIXME "queue reset" |
---|
| 32 | // > 1) flush one slot by cycle |
---|
| 33 | // > 2) flush all slot in one cycle |
---|
| 34 | |
---|
[101] | 35 | _queue->clear(); |
---|
[73] | 36 | } |
---|
| 37 | else |
---|
| 38 | { |
---|
| 39 | // Test if push |
---|
| 40 | if (PORT_READ(in_EXECUTE_QUEUE_IN_VAL) and internal_EXECUTE_QUEUE_IN_ACK) |
---|
| 41 | { |
---|
| 42 | execute_queue_entry_t * entry = new execute_queue_entry_t |
---|
| 43 | ((_param->_have_port_context_id )?PORT_READ(in_EXECUTE_QUEUE_IN_CONTEXT_ID ):0, |
---|
| 44 | (_param->_have_port_front_end_id )?PORT_READ(in_EXECUTE_QUEUE_IN_FRONT_END_ID ):0, |
---|
| 45 | (_param->_have_port_ooo_engine_id)?PORT_READ(in_EXECUTE_QUEUE_IN_OOO_ENGINE_ID):0, |
---|
[88] | 46 | (_param->_have_port_rob_ptr )?PORT_READ(in_EXECUTE_QUEUE_IN_PACKET_ID ):0, |
---|
[73] | 47 | //PORT_READ(in_EXECUTE_QUEUE_IN_OPERATION ), |
---|
| 48 | //PORT_READ(in_EXECUTE_QUEUE_IN_TYPE ), |
---|
[136] | 49 | PORT_READ(in_EXECUTE_QUEUE_IN_CANCEL ), |
---|
[73] | 50 | PORT_READ(in_EXECUTE_QUEUE_IN_FLAGS ), |
---|
| 51 | PORT_READ(in_EXECUTE_QUEUE_IN_EXCEPTION ), |
---|
| 52 | PORT_READ(in_EXECUTE_QUEUE_IN_NO_SEQUENCE ), |
---|
[88] | 53 | PORT_READ(in_EXECUTE_QUEUE_IN_ADDRESS ), |
---|
| 54 | PORT_READ(in_EXECUTE_QUEUE_IN_DATA )); |
---|
[73] | 55 | |
---|
[101] | 56 | _queue->push_back(entry); |
---|
[73] | 57 | } |
---|
| 58 | |
---|
| 59 | // Test if pop |
---|
| 60 | if (internal_EXECUTE_QUEUE_OUT_VAL and PORT_READ(in_EXECUTE_QUEUE_OUT_ACK)) |
---|
| 61 | { |
---|
| 62 | delete _queue->front(); |
---|
[101] | 63 | _queue->pop_front(); |
---|
[73] | 64 | } |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | #ifdef STATISTICS |
---|
[88] | 68 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 69 | *(_stat_use_queue) += _queue->size(); |
---|
[73] | 70 | #endif |
---|
| 71 | |
---|
[101] | 72 | #if DEBUG_Execute_queue and (DEBUG >= DEBUG_TRACE) |
---|
| 73 | log_printf(TRACE,Execute_queue,FUNCTION," * Dump Execute_queue"); |
---|
| 74 | { |
---|
| 75 | uint32_t i=0; |
---|
| 76 | for (std::list<execute_queue_entry_t *>::iterator it=_queue->begin(); |
---|
| 77 | it!=_queue->end(); |
---|
| 78 | ++it) |
---|
| 79 | { |
---|
[136] | 80 | log_printf(TRACE,Execute_queue,FUNCTION," [%d] %.2d %.2d %.2d, %.1d, %.4d, %.1d, %.2d %.1d, %.8x %.8x", |
---|
[101] | 81 | i, |
---|
| 82 | (*it)->_context_id , |
---|
| 83 | (*it)->_front_end_id , |
---|
| 84 | (*it)->_ooo_engine_id, |
---|
| 85 | (*it)->_packet_id , |
---|
| 86 | //(*it)->_operation , |
---|
| 87 | //(*it)->_type , |
---|
[136] | 88 | (*it)->_cancel , |
---|
[101] | 89 | (*it)->_flags , |
---|
| 90 | (*it)->_exception , |
---|
| 91 | (*it)->_no_sequence , |
---|
| 92 | (*it)->_address , |
---|
| 93 | (*it)->_data |
---|
| 94 | ); |
---|
| 95 | i++; |
---|
| 96 | } |
---|
| 97 | } |
---|
| 98 | #endif |
---|
[73] | 99 | |
---|
[101] | 100 | |
---|
[73] | 101 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 102 | end_cycle (); |
---|
| 103 | #endif |
---|
| 104 | |
---|
[101] | 105 | log_end(Execute_queue,FUNCTION); |
---|
[73] | 106 | }; |
---|
| 107 | |
---|
| 108 | }; // end namespace execute_queue |
---|
| 109 | }; // end namespace write_unit |
---|
| 110 | }; // end namespace multi_write_unit |
---|
| 111 | }; // end namespace execute_loop |
---|
| 112 | }; // end namespace multi_execute_loop |
---|
| 113 | }; // end namespace core |
---|
| 114 | |
---|
| 115 | }; // end namespace behavioural |
---|
| 116 | }; // end namespace morpheo |
---|
| 117 | #endif |
---|