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