[2] | 1 | /* |
---|
| 2 | * $Id$ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Generic/Counter/include/Counter.h" |
---|
| 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace generic { |
---|
| 13 | namespace counter { |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | #ifdef SYSTEMC |
---|
| 17 | Counter::Counter (sc_module_name name, |
---|
| 18 | #else |
---|
| 19 | Counter::Counter (string name, |
---|
| 20 | #endif |
---|
| 21 | #ifdef STATISTICS |
---|
| 22 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
| 23 | #endif |
---|
| 24 | morpheo::behavioural::generic::counter::Parameters param ): |
---|
| 25 | _name (name) |
---|
| 26 | ,_param (param) |
---|
| 27 | // #ifdef STATISTICS |
---|
| 28 | // ,_param_statistics (param_statistics) |
---|
| 29 | // #endif |
---|
| 30 | { |
---|
| 31 | log_printf(FUNC,Counter,"Counter","Begin"); |
---|
| 32 | |
---|
| 33 | #ifdef STATISTICS |
---|
| 34 | // Allocation of statistics |
---|
| 35 | _stat = new Statistics (static_cast<string>(_name), |
---|
| 36 | param_statistics , |
---|
| 37 | param); |
---|
| 38 | #endif |
---|
| 39 | |
---|
| 40 | #ifdef VHDL_TESTBENCH |
---|
| 41 | // Creation of a testbench |
---|
| 42 | // -> port |
---|
| 43 | // -> clock's signals |
---|
| 44 | _vhdl_testbench = new Vhdl_Testbench (_name); |
---|
| 45 | vhdl_testbench_port (); |
---|
| 46 | _vhdl_testbench->set_clock ("in_CLOCK",false); |
---|
| 47 | #endif |
---|
| 48 | |
---|
| 49 | #ifdef VHDL |
---|
| 50 | // generate the vhdl |
---|
| 51 | vhdl(); |
---|
| 52 | #endif |
---|
| 53 | |
---|
| 54 | #ifdef SYSTEMC |
---|
| 55 | allocation (); |
---|
| 56 | |
---|
| 57 | SC_METHOD (transition); |
---|
| 58 | dont_initialize (); |
---|
| 59 | sensitive_pos << *(in_CLOCK); |
---|
| 60 | |
---|
| 61 | SC_METHOD (genMealy); |
---|
| 62 | dont_initialize (); |
---|
| 63 | for (uint32_t i=0; i<_param._nb_port; i++) |
---|
| 64 | sensitive << *(in_COUNTER_DATA [i]) |
---|
| 65 | << *(in_COUNTER_ADDSUB [i]); |
---|
| 66 | |
---|
| 67 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 68 | // List dependency information |
---|
| 69 | for (uint32_t i=0; i<_param._nb_port; i++) |
---|
| 70 | { |
---|
| 71 | (*(out_COUNTER_DATA [i])) (*(in_COUNTER_DATA [i])); |
---|
| 72 | (*(out_COUNTER_DATA [i])) (*(in_COUNTER_ADDSUB [i])); |
---|
| 73 | } |
---|
| 74 | #endif |
---|
| 75 | |
---|
| 76 | #endif |
---|
| 77 | log_printf(FUNC,Counter,"Counter","End"); |
---|
| 78 | }; |
---|
| 79 | |
---|
| 80 | Counter::~Counter (void) |
---|
| 81 | { |
---|
| 82 | log_printf(FUNC,Counter,"~Counter","Begin"); |
---|
| 83 | #ifdef SYSTEMC |
---|
| 84 | deallocation (); |
---|
| 85 | #endif |
---|
| 86 | |
---|
| 87 | #ifdef VHDL_TESTBENCH |
---|
| 88 | // generate the test bench |
---|
| 89 | _vhdl_testbench->generate_file(); |
---|
| 90 | delete _vhdl_testbench; |
---|
| 91 | #endif |
---|
| 92 | |
---|
| 93 | #ifdef STATISTICS |
---|
| 94 | _stat->generate_file(statistics(0)); |
---|
| 95 | |
---|
| 96 | delete _stat; |
---|
| 97 | #endif |
---|
| 98 | log_printf(FUNC,Counter,"~Counter","End"); |
---|
| 99 | }; |
---|
| 100 | |
---|
| 101 | }; // end namespace counter |
---|
| 102 | }; // end namespace generic |
---|
| 103 | |
---|
| 104 | }; // end namespace behavioural |
---|
| 105 | }; // end namespace morpheo |
---|