[67] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Queue_genMoore.cpp 123 2009-06-08 20:43:30Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Generic/Queue/include/Queue.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace generic { |
---|
| 14 | namespace queue { |
---|
| 15 | |
---|
| 16 | #undef FUNCTION |
---|
| 17 | #define FUNCTION "Queue::genMoore" |
---|
| 18 | void Queue::genMoore (void) |
---|
| 19 | { |
---|
| 20 | log_printf(FUNC,Queue,FUNCTION,"Begin"); |
---|
[100] | 21 | |
---|
[123] | 22 | if (PORT_READ(in_NRESET)) |
---|
| 23 | { |
---|
[101] | 24 | //--------------------------------------------- |
---|
[100] | 25 | // Output |
---|
[101] | 26 | //--------------------------------------------- |
---|
[67] | 27 | internal_INSERT_ACK = not _queue_control->full(); |
---|
| 28 | internal_RETIRE_VAL = not _queue_control->empty(); |
---|
| 29 | |
---|
| 30 | PORT_WRITE(out_RETIRE_DATA,_queue_data[(*_queue_control)[0]]); |
---|
| 31 | |
---|
[101] | 32 | //--------------------------------------------- |
---|
[100] | 33 | // Slot |
---|
[101] | 34 | //--------------------------------------------- |
---|
[100] | 35 | // Note : Slot 0 is the same slot as retire interface. |
---|
| 36 | uint32_t nb_elt = _queue_control->nb_elt(); |
---|
| 37 | |
---|
| 38 | for (uint32_t i=0; i<_param->_nb_port_slot; ++i) |
---|
| 39 | { |
---|
| 40 | PORT_WRITE(out_SLOT_VAL [i], i<nb_elt); |
---|
| 41 | PORT_WRITE(out_SLOT_DATA [i],_queue_data[(*_queue_control)[i]]); |
---|
| 42 | } |
---|
| 43 | |
---|
[101] | 44 | //--------------------------------------------- |
---|
| 45 | // Pointer |
---|
| 46 | //--------------------------------------------- |
---|
| 47 | if (_param->_have_port_ptr_write) |
---|
| 48 | PORT_WRITE(out_PTR_WRITE, _queue_control->ptr_push()); |
---|
| 49 | if (_param->_have_port_ptr_read ) |
---|
| 50 | PORT_WRITE(out_PTR_READ , _queue_control->ptr_pop ()); |
---|
[123] | 51 | } |
---|
| 52 | else |
---|
| 53 | { |
---|
| 54 | // Reset |
---|
| 55 | internal_INSERT_ACK = 0; |
---|
| 56 | internal_RETIRE_VAL = 0; |
---|
[101] | 57 | |
---|
[123] | 58 | for (uint32_t i=0; i<_param->_nb_port_slot; ++i) |
---|
| 59 | PORT_WRITE(out_SLOT_VAL [i], 0); |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | // Write output |
---|
| 63 | PORT_WRITE(out_INSERT_ACK , internal_INSERT_ACK); |
---|
| 64 | PORT_WRITE(out_RETIRE_VAL , internal_RETIRE_VAL); |
---|
| 65 | |
---|
| 66 | |
---|
[67] | 67 | log_printf(FUNC,Queue,FUNCTION,"End"); |
---|
| 68 | }; |
---|
| 69 | |
---|
| 70 | }; // end namespace queue |
---|
| 71 | }; // end namespace generic |
---|
| 72 | |
---|
| 73 | }; // end namespace behavioural |
---|
| 74 | }; // end namespace morpheo |
---|
| 75 | #endif |
---|