1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Select_Priority_Fixed_genMealy_entity.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Generic/Select/Select_Priority_Fixed/include/Select_Priority_Fixed.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace generic { |
---|
14 | namespace select { |
---|
15 | namespace select_priority_fixed { |
---|
16 | |
---|
17 | |
---|
18 | void Select_Priority_Fixed::genMealy_entity (void) |
---|
19 | { |
---|
20 | log_printf(FUNC,Select_Priority_Fixed,"genMealy_entity","Begin"); |
---|
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 | |
---|
32 | log_printf(TRACE,Select_Priority_Fixed,"genMealy_entity","Scearch..."); |
---|
33 | for (entity=0; entity<_param->_nb_entity; entity++) |
---|
34 | { |
---|
35 | if (PORT_READ(in_VAL [entity]) == 1) |
---|
36 | { |
---|
37 | log_printf(TRACE,Select_Priority_Fixed,"genMealy_entity","Find! entity %d",entity); |
---|
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 | } |
---|
55 | log_printf(FUNC,Select_Priority_Fixed,"genMealy_entity","End"); |
---|
56 | }; |
---|
57 | |
---|
58 | }; // end namespace select_priority_fixed |
---|
59 | }; // end namespace select |
---|
60 | }; // end namespace generic |
---|
61 | |
---|
62 | }; // end namespace behavioural |
---|
63 | }; // end namespace morpheo |
---|
64 | #endif |
---|