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 SYSTEMC |
---|
34 | allocation (); |
---|
35 | #endif |
---|
36 | |
---|
37 | #ifdef STATISTICS |
---|
38 | // Allocation of statistics |
---|
39 | _stat = new Statistics (static_cast<string>(_name), |
---|
40 | param_statistics , |
---|
41 | param); |
---|
42 | #endif |
---|
43 | |
---|
44 | #ifdef VHDL |
---|
45 | // generate the vhdl |
---|
46 | vhdl(); |
---|
47 | #endif |
---|
48 | |
---|
49 | #ifdef SYSTEMC |
---|
50 | |
---|
51 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
52 | SC_METHOD (transition); |
---|
53 | dont_initialize (); |
---|
54 | sensitive << (*(in_CLOCK)).pos(); |
---|
55 | #endif |
---|
56 | |
---|
57 | SC_METHOD (genMealy); |
---|
58 | dont_initialize (); |
---|
59 | for (uint32_t i=0; i<_param._nb_port; i++) |
---|
60 | sensitive << *(in_COUNTER_DATA [i]) |
---|
61 | << *(in_COUNTER_ADDSUB [i]); |
---|
62 | |
---|
63 | #ifdef SYSTEMCASS_SPECIFIC |
---|
64 | // List dependency information |
---|
65 | for (uint32_t i=0; i<_param._nb_port; i++) |
---|
66 | { |
---|
67 | (*(out_COUNTER_DATA [i])) (*(in_COUNTER_DATA [i])); |
---|
68 | (*(out_COUNTER_DATA [i])) (*(in_COUNTER_ADDSUB [i])); |
---|
69 | } |
---|
70 | #endif |
---|
71 | |
---|
72 | #endif |
---|
73 | log_printf(FUNC,Counter,"Counter","End"); |
---|
74 | }; |
---|
75 | |
---|
76 | Counter::~Counter (void) |
---|
77 | { |
---|
78 | log_printf(FUNC,Counter,"~Counter","Begin"); |
---|
79 | #ifdef SYSTEMC |
---|
80 | deallocation (); |
---|
81 | #endif |
---|
82 | |
---|
83 | #ifdef STATISTICS |
---|
84 | _stat->generate_file(statistics(0)); |
---|
85 | |
---|
86 | delete _stat; |
---|
87 | #endif |
---|
88 | log_printf(FUNC,Counter,"~Counter","End"); |
---|
89 | }; |
---|
90 | |
---|
91 | }; // end namespace counter |
---|
92 | }; // end namespace generic |
---|
93 | |
---|
94 | }; // end namespace behavioural |
---|
95 | }; // end namespace morpheo |
---|