[2] | 1 | /* |
---|
| 2 | * $Id: Counter.cpp 82 2008-05-01 16:48:45Z rosiere $ |
---|
| 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 | |
---|
[82] | 16 | Counter::Counter |
---|
| 17 | ( |
---|
[2] | 18 | #ifdef SYSTEMC |
---|
[82] | 19 | sc_module_name name, |
---|
[2] | 20 | #else |
---|
[82] | 21 | std::string name, |
---|
[2] | 22 | #endif |
---|
| 23 | #ifdef STATISTICS |
---|
[82] | 24 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
[2] | 25 | #endif |
---|
[82] | 26 | morpheo::behavioural::generic::counter::Parameters param, |
---|
| 27 | Tusage_t usage): |
---|
| 28 | _name (name), |
---|
| 29 | _param (param), |
---|
| 30 | _usage (usage) |
---|
[2] | 31 | { |
---|
| 32 | log_printf(FUNC,Counter,"Counter","Begin"); |
---|
| 33 | |
---|
[42] | 34 | #ifdef SYSTEMC |
---|
| 35 | allocation (); |
---|
| 36 | #endif |
---|
| 37 | |
---|
[2] | 38 | #ifdef STATISTICS |
---|
| 39 | // Allocation of statistics |
---|
[71] | 40 | statistics_declaration(param_statistics); |
---|
[2] | 41 | #endif |
---|
| 42 | |
---|
| 43 | #ifdef VHDL |
---|
| 44 | // generate the vhdl |
---|
| 45 | vhdl(); |
---|
| 46 | #endif |
---|
| 47 | |
---|
| 48 | #ifdef SYSTEMC |
---|
[53] | 49 | |
---|
| 50 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
[2] | 51 | SC_METHOD (transition); |
---|
| 52 | dont_initialize (); |
---|
[67] | 53 | sensitive << (*(in_CLOCK)).pos(); |
---|
[53] | 54 | #endif |
---|
[2] | 55 | |
---|
| 56 | SC_METHOD (genMealy); |
---|
| 57 | dont_initialize (); |
---|
| 58 | for (uint32_t i=0; i<_param._nb_port; i++) |
---|
| 59 | sensitive << *(in_COUNTER_DATA [i]) |
---|
| 60 | << *(in_COUNTER_ADDSUB [i]); |
---|
| 61 | |
---|
| 62 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 63 | // List dependency information |
---|
| 64 | for (uint32_t i=0; i<_param._nb_port; i++) |
---|
| 65 | { |
---|
| 66 | (*(out_COUNTER_DATA [i])) (*(in_COUNTER_DATA [i])); |
---|
| 67 | (*(out_COUNTER_DATA [i])) (*(in_COUNTER_ADDSUB [i])); |
---|
| 68 | } |
---|
| 69 | #endif |
---|
| 70 | |
---|
| 71 | #endif |
---|
| 72 | log_printf(FUNC,Counter,"Counter","End"); |
---|
| 73 | }; |
---|
| 74 | |
---|
| 75 | Counter::~Counter (void) |
---|
| 76 | { |
---|
| 77 | log_printf(FUNC,Counter,"~Counter","Begin"); |
---|
| 78 | #ifdef SYSTEMC |
---|
| 79 | deallocation (); |
---|
| 80 | #endif |
---|
| 81 | |
---|
| 82 | #ifdef STATISTICS |
---|
| 83 | delete _stat; |
---|
| 84 | #endif |
---|
| 85 | log_printf(FUNC,Counter,"~Counter","End"); |
---|
| 86 | }; |
---|
| 87 | |
---|
| 88 | }; // end namespace counter |
---|
| 89 | }; // end namespace generic |
---|
| 90 | |
---|
| 91 | }; // end namespace behavioural |
---|
| 92 | }; // end namespace morpheo |
---|