[10] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
[15] | 9 | #include "Behavioural/Generic/Select/Select_Priority_Fixed/include/Select_Priority_Fixed.h" |
---|
[10] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace generic { |
---|
| 14 | namespace select { |
---|
[15] | 15 | namespace select_priority_fixed { |
---|
[10] | 16 | |
---|
| 17 | |
---|
[15] | 18 | void Select_Priority_Fixed::genMealy_entity (void) |
---|
[10] | 19 | { |
---|
[15] | 20 | log_printf(FUNC,Select_Priority_Fixed,"genMealy_entity","Begin"); |
---|
[10] | 21 | |
---|
| 22 | // init |
---|
| 23 | |
---|
| 24 | Tcontrol_t ack [_param._nb_entity]; |
---|
| 25 | bool find = false; |
---|
| 26 | Tentity_t entity; |
---|
| 27 | |
---|
| 28 | if (_param._encoding_one_hot) |
---|
| 29 | for (uint32_t i=0; i<_param._nb_entity; i++) |
---|
| 30 | ack [i] = 0; |
---|
| 31 | |
---|
[15] | 32 | log_printf(TRACE,Select_Priority_Fixed,"genMealy_entity","Scearch..."); |
---|
[10] | 33 | for (entity=0; entity<_param._nb_entity; entity++) |
---|
| 34 | { |
---|
| 35 | if (PORT_READ(in_VAL [entity]) == 1) |
---|
| 36 | { |
---|
[15] | 37 | log_printf(TRACE,Select_Priority_Fixed,"genMealy_entity","Find! entity %d",entity); |
---|
[10] | 38 | if (_param._encoding_one_hot) |
---|
| 39 | ack [entity] = 1; |
---|
| 40 | find = true; |
---|
| 41 | break; |
---|
| 42 | } |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | // Write port |
---|
| 46 | if (_param._encoding_one_hot) |
---|
| 47 | for (uint32_t i=0; i<_param._nb_entity; i++) |
---|
| 48 | PORT_WRITE(out_ACK [i], ack [i]); |
---|
| 49 | |
---|
| 50 | if (_param._encoding_compact) |
---|
| 51 | { |
---|
| 52 | PORT_WRITE(out_ENTITY , (find==true)?entity:0); |
---|
| 53 | PORT_WRITE(out_ENTITY_ACK, find ); |
---|
| 54 | } |
---|
[15] | 55 | log_printf(FUNC,Select_Priority_Fixed,"genMealy_entity","End"); |
---|
[10] | 56 | }; |
---|
| 57 | |
---|
[15] | 58 | }; // end namespace select_priority_fixed |
---|
[10] | 59 | }; // end namespace select |
---|
| 60 | }; // end namespace generic |
---|
| 61 | |
---|
| 62 | }; // end namespace behavioural |
---|
| 63 | }; // end namespace morpheo |
---|
| 64 | #endif |
---|