| 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Execute_queue_transition.cpp 136 2009-10-20 18:52:15Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 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 | { |
---|
| 25 | log_begin(Execute_queue,FUNCTION); |
---|
| 26 | log_function(Execute_queue,FUNCTION,_name.c_str()); |
---|
| 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 | |
---|
| 35 | _queue->clear(); |
---|
| 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, |
---|
| 46 | (_param->_have_port_rob_ptr )?PORT_READ(in_EXECUTE_QUEUE_IN_PACKET_ID ):0, |
---|
| 47 | //PORT_READ(in_EXECUTE_QUEUE_IN_OPERATION ), |
---|
| 48 | //PORT_READ(in_EXECUTE_QUEUE_IN_TYPE ), |
---|
| 49 | PORT_READ(in_EXECUTE_QUEUE_IN_CANCEL ), |
---|
| 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 ), |
---|
| 53 | PORT_READ(in_EXECUTE_QUEUE_IN_ADDRESS ), |
---|
| 54 | PORT_READ(in_EXECUTE_QUEUE_IN_DATA )); |
---|
| 55 | |
---|
| 56 | _queue->push_back(entry); |
---|
| 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(); |
---|
| 63 | _queue->pop_front(); |
---|
| 64 | } |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | #ifdef STATISTICS |
---|
| 68 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 69 | *(_stat_use_queue) += _queue->size(); |
---|
| 70 | #endif |
---|
| 71 | |
---|
| 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 | { |
---|
| 80 | log_printf(TRACE,Execute_queue,FUNCTION," [%d] %.2d %.2d %.2d, %.1d, %.4d, %.1d, %.2d %.1d, %.8x %.8x", |
---|
| 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 , |
---|
| 88 | (*it)->_cancel , |
---|
| 89 | (*it)->_flags , |
---|
| 90 | (*it)->_exception , |
---|
| 91 | (*it)->_no_sequence , |
---|
| 92 | (*it)->_address , |
---|
| 93 | (*it)->_data |
---|
| 94 | ); |
---|
| 95 | i++; |
---|
| 96 | } |
---|
| 97 | } |
---|
| 98 | #endif |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 102 | end_cycle (); |
---|
| 103 | #endif |
---|
| 104 | |
---|
| 105 | log_end(Execute_queue,FUNCTION); |
---|
| 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 |
---|