[10] | 1 | /* |
---|
| 2 | * $Id$ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
[15] | 8 | #include "Behavioural/Generic/Select/Select_Priority_Fixed/include/Select_Priority_Fixed.h" |
---|
[10] | 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace generic { |
---|
| 13 | namespace select { |
---|
[15] | 14 | namespace select_priority_fixed { |
---|
[10] | 15 | |
---|
| 16 | |
---|
| 17 | #ifdef SYSTEMC |
---|
[15] | 18 | Select_Priority_Fixed::Select_Priority_Fixed (sc_module_name name, |
---|
[10] | 19 | #else |
---|
[15] | 20 | Select_Priority_Fixed::Select_Priority_Fixed (string name, |
---|
[10] | 21 | #endif |
---|
| 22 | #ifdef STATISTICS |
---|
| 23 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
| 24 | #endif |
---|
[15] | 25 | morpheo::behavioural::generic::select::select_priority_fixed::Parameters param ): |
---|
[10] | 26 | _name (name) |
---|
| 27 | ,_param (param) |
---|
| 28 | // #ifdef STATISTICS |
---|
| 29 | // ,_param_statistics (param_statistics) |
---|
| 30 | // #endif |
---|
| 31 | { |
---|
[15] | 32 | log_printf(FUNC,Select_Priority_Fixed,"Select_Priority_Fixed","Begin"); |
---|
[10] | 33 | |
---|
[29] | 34 | #ifdef SYSTEMC |
---|
| 35 | log_printf(INFO,Select_Priority_Fixed,"Select_Priority_Fixed","Allocation"); |
---|
| 36 | |
---|
| 37 | allocation (); |
---|
| 38 | #endif |
---|
| 39 | |
---|
| 40 | #ifdef POSITION |
---|
| 41 | log_printf(INFO,Select_Priority_Fixed,"Select_Priority_Fixed","Position"); |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | #endif |
---|
| 45 | |
---|
[10] | 46 | #ifdef STATISTICS |
---|
[15] | 47 | log_printf(INFO,Select_Priority_Fixed,"Select_Priority_Fixed","Allocation of statistics"); |
---|
[10] | 48 | |
---|
| 49 | // Allocation of statistics |
---|
| 50 | _stat = new Statistics (static_cast<string>(_name), |
---|
| 51 | param_statistics , |
---|
| 52 | param); |
---|
| 53 | #endif |
---|
| 54 | |
---|
| 55 | #ifdef VHDL_TESTBENCH |
---|
[15] | 56 | log_printf(INFO,Select_Priority_Fixed,"Select_Priority_Fixed","Creation of a testbench"); |
---|
[10] | 57 | |
---|
| 58 | // Creation of a testbench |
---|
| 59 | // -> port |
---|
| 60 | // -> clock's signals |
---|
| 61 | _vhdl_testbench = new Vhdl_Testbench (_name); |
---|
| 62 | #endif |
---|
| 63 | |
---|
| 64 | #ifdef VHDL |
---|
| 65 | // generate the vhdl |
---|
[15] | 66 | log_printf(INFO,Select_Priority_Fixed,"Select_Priority_Fixed","Generate the vhdl"); |
---|
[10] | 67 | |
---|
| 68 | vhdl(); |
---|
| 69 | #endif |
---|
| 70 | |
---|
| 71 | #ifdef SYSTEMC |
---|
| 72 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
[15] | 73 | log_printf(INFO,Select_Priority_Fixed,"Select_Priority_Fixed","Method - transition"); |
---|
[10] | 74 | |
---|
| 75 | SC_METHOD (transition); |
---|
| 76 | dont_initialize (); |
---|
| 77 | sensitive_pos << *(in_CLOCK); |
---|
| 78 | #endif |
---|
| 79 | |
---|
[15] | 80 | log_printf(INFO,Select_Priority_Fixed,"Select_Priority_Fixed","Method - genMealy_entity"); |
---|
[10] | 81 | |
---|
| 82 | SC_METHOD (genMealy_entity); |
---|
| 83 | dont_initialize (); |
---|
| 84 | //sensitive_pos << *(in_CLOCK); |
---|
| 85 | for (uint32_t i=0; i<_param._nb_entity; i++) |
---|
| 86 | sensitive << *(in_VAL [i]); |
---|
| 87 | |
---|
| 88 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 89 | // List dependency information |
---|
| 90 | |
---|
| 91 | for (uint32_t i=0; i<_param._nb_entity; i++) |
---|
| 92 | { |
---|
| 93 | if (_param._encoding_one_hot) |
---|
| 94 | (*(out_ACK [i])) (*(in_VAL [i])); |
---|
| 95 | if (_param._encoding_compact) |
---|
| 96 | { |
---|
| 97 | (*(out_ENTITY )) (*(in_VAL [i])); |
---|
| 98 | (*(out_ENTITY_ACK)) (*(in_VAL [i])); |
---|
| 99 | } |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | #endif |
---|
| 103 | #endif |
---|
[15] | 104 | log_printf(FUNC,Select_Priority_Fixed,"Select_Priority_Fixed","End"); |
---|
[10] | 105 | }; |
---|
| 106 | |
---|
[15] | 107 | Select_Priority_Fixed::~Select_Priority_Fixed (void) |
---|
[10] | 108 | { |
---|
[15] | 109 | log_printf(FUNC,Select_Priority_Fixed,"~Select_Priority_Fixed","Begin"); |
---|
[10] | 110 | |
---|
| 111 | #ifdef VHDL_TESTBENCH |
---|
[15] | 112 | log_printf(INFO,Select_Priority_Fixed,"~Select_Priority_Fixed","Generate Testbench file"); |
---|
[10] | 113 | |
---|
| 114 | // generate the test bench |
---|
| 115 | _vhdl_testbench->generate_file(); |
---|
| 116 | delete _vhdl_testbench; |
---|
| 117 | #endif |
---|
| 118 | |
---|
| 119 | #ifdef STATISTICS |
---|
[15] | 120 | log_printf(INFO,Select_Priority_Fixed,"~Select_Priority_Fixed","Generate Statistics file"); |
---|
[10] | 121 | |
---|
| 122 | _stat->generate_file(statistics(0)); |
---|
| 123 | |
---|
| 124 | delete _stat; |
---|
| 125 | #endif |
---|
| 126 | |
---|
| 127 | #ifdef SYSTEMC |
---|
[15] | 128 | log_printf(INFO,Select_Priority_Fixed,"~Select_Priority_Fixed","Deallocation"); |
---|
[10] | 129 | |
---|
| 130 | deallocation (); |
---|
| 131 | #endif |
---|
| 132 | |
---|
[15] | 133 | log_printf(FUNC,Select_Priority_Fixed,"~Select_Priority_Fixed","End"); |
---|
[10] | 134 | }; |
---|
| 135 | |
---|
[15] | 136 | }; // end namespace select_priority_fixed |
---|
[10] | 137 | }; // end namespace select |
---|
| 138 | }; // end namespace generic |
---|
| 139 | |
---|
| 140 | }; // end namespace behavioural |
---|
| 141 | }; // end namespace morpheo |
---|