[73] | 1 | #ifdef SYSTEMC |
---|
| 2 | //#if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 3 | /* |
---|
| 4 | * $Id$ |
---|
| 5 | * |
---|
| 6 | * [ Description ] |
---|
| 7 | * |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Write_queue/include/Write_queue.h" |
---|
| 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | namespace core { |
---|
| 15 | namespace multi_execute_loop { |
---|
| 16 | namespace execute_loop { |
---|
| 17 | namespace multi_write_unit { |
---|
| 18 | namespace write_unit { |
---|
| 19 | namespace write_queue { |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | #undef FUNCTION |
---|
| 23 | #define FUNCTION "Write_queue::transition" |
---|
| 24 | void Write_queue::transition (void) |
---|
| 25 | { |
---|
| 26 | log_printf(FUNC,Write_queue,FUNCTION,"Begin"); |
---|
| 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 | while (_queue->empty() == false) |
---|
| 36 | _queue->pop_front(); |
---|
| 37 | } |
---|
| 38 | else |
---|
| 39 | { |
---|
| 40 | // Test access at gpr and spr |
---|
| 41 | if (internal_GPR_WRITE_VAL and PORT_READ(in_GPR_WRITE_ACK[0])) |
---|
| 42 | _queue->front()->_write_rd = 0; |
---|
| 43 | if (internal_SPR_WRITE_VAL and PORT_READ(in_SPR_WRITE_ACK[0])) |
---|
| 44 | _queue->front()->_write_re = 0; |
---|
| 45 | |
---|
| 46 | // Test if push |
---|
| 47 | if (PORT_READ(in_WRITE_QUEUE_IN_VAL) and internal_WRITE_QUEUE_IN_ACK) |
---|
| 48 | { |
---|
| 49 | write_queue_entry_t * entry = new write_queue_entry_t |
---|
| 50 | ((_param->_have_port_context_id )?PORT_READ(in_WRITE_QUEUE_IN_CONTEXT_ID ):0, |
---|
| 51 | (_param->_have_port_front_end_id )?PORT_READ(in_WRITE_QUEUE_IN_FRONT_END_ID ):0, |
---|
| 52 | (_param->_have_port_ooo_engine_id)?PORT_READ(in_WRITE_QUEUE_IN_OOO_ENGINE_ID):0, |
---|
| 53 | (_param->_have_port_packet_id )?PORT_READ(in_WRITE_QUEUE_IN_PACKET_ID ):0, |
---|
| 54 | //PORT_READ(in_WRITE_QUEUE_IN_OPERATION ), |
---|
| 55 | //PORT_READ(in_WRITE_QUEUE_IN_TYPE ), |
---|
| 56 | PORT_READ(in_WRITE_QUEUE_IN_WRITE_RD ), |
---|
| 57 | PORT_READ(in_WRITE_QUEUE_IN_NUM_REG_RD ), |
---|
| 58 | PORT_READ(in_WRITE_QUEUE_IN_DATA_RD ), |
---|
| 59 | PORT_READ(in_WRITE_QUEUE_IN_WRITE_RE ), |
---|
| 60 | PORT_READ(in_WRITE_QUEUE_IN_NUM_REG_RE ), |
---|
| 61 | PORT_READ(in_WRITE_QUEUE_IN_DATA_RE ), |
---|
| 62 | PORT_READ(in_WRITE_QUEUE_IN_EXCEPTION ), |
---|
| 63 | PORT_READ(in_WRITE_QUEUE_IN_NO_SEQUENCE ), |
---|
| 64 | PORT_READ(in_WRITE_QUEUE_IN_ADDRESS )); |
---|
| 65 | |
---|
| 66 | _queue->push_back(entry); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | // Test if pop |
---|
| 70 | if (internal_WRITE_QUEUE_OUT_VAL and PORT_READ(in_WRITE_QUEUE_OUT_ACK)) |
---|
| 71 | { |
---|
| 72 | delete _queue->front(); |
---|
| 73 | _queue->pop_front(); |
---|
| 74 | } |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | #ifdef STATISTICS |
---|
[74] | 78 | *(_stat_use_queue) += _queue->size(); |
---|
[73] | 79 | #endif |
---|
| 80 | |
---|
| 81 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 82 | end_cycle (); |
---|
| 83 | #endif |
---|
| 84 | |
---|
| 85 | log_printf(FUNC,Write_queue,FUNCTION,"End"); |
---|
| 86 | }; |
---|
| 87 | |
---|
| 88 | }; // end namespace write_queue |
---|
| 89 | }; // end namespace write_unit |
---|
| 90 | }; // end namespace multi_write_unit |
---|
| 91 | }; // end namespace execute_loop |
---|
| 92 | }; // end namespace multi_execute_loop |
---|
| 93 | }; // end namespace core |
---|
| 94 | |
---|
| 95 | }; // end namespace behavioural |
---|
| 96 | }; // end namespace morpheo |
---|
| 97 | #endif |
---|
| 98 | //#endif |
---|