1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Generic/Sort/include/Sort.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace generic { |
---|
13 | namespace sort { |
---|
14 | |
---|
15 | |
---|
16 | #undef FUNCTION |
---|
17 | #define FUNCTION "Sort::Sort" |
---|
18 | Sort::Sort |
---|
19 | ( |
---|
20 | #ifdef SYSTEMC |
---|
21 | sc_module_name name, |
---|
22 | #else |
---|
23 | string name, |
---|
24 | #endif |
---|
25 | #ifdef STATISTICS |
---|
26 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
27 | #endif |
---|
28 | morpheo::behavioural::generic::sort::Parameters * param, |
---|
29 | morpheo::behavioural::Tusage_t usage |
---|
30 | ): |
---|
31 | _name (name) |
---|
32 | ,_param (param) |
---|
33 | ,_usage (usage) |
---|
34 | { |
---|
35 | log_printf(FUNC,Sort,FUNCTION,"Begin"); |
---|
36 | |
---|
37 | log_printf(INFO,Sort,FUNCTION,"Allocation"); |
---|
38 | |
---|
39 | allocation ( |
---|
40 | #ifdef STATISTICS |
---|
41 | param_statistics |
---|
42 | #endif |
---|
43 | ); |
---|
44 | |
---|
45 | #ifdef STATISTICS |
---|
46 | if (_usage & USE_STATISTICS) |
---|
47 | { |
---|
48 | log_printf(INFO,Sort,FUNCTION,"Allocation of statistics"); |
---|
49 | |
---|
50 | statistics_allocation(param_statistics); |
---|
51 | } |
---|
52 | #endif |
---|
53 | |
---|
54 | #ifdef VHDL |
---|
55 | if (_usage & USE_VHDL) |
---|
56 | { |
---|
57 | // generate the vhdl |
---|
58 | log_printf(INFO,Sort,FUNCTION,"Generate the vhdl"); |
---|
59 | |
---|
60 | vhdl(); |
---|
61 | } |
---|
62 | #endif |
---|
63 | |
---|
64 | #ifdef SYSTEMC |
---|
65 | if (_usage & USE_SYSTEMC) |
---|
66 | { |
---|
67 | log_printf(INFO,Sort,FUNCTION,"Method - transition"); |
---|
68 | |
---|
69 | SC_METHOD (transition); |
---|
70 | dont_initialize (); |
---|
71 | sensitive << (*(in_CLOCK)).pos(); |
---|
72 | |
---|
73 | # ifdef SYSTEMCASS_SPECIFIC |
---|
74 | // List dependency information |
---|
75 | # endif |
---|
76 | |
---|
77 | log_printf(INFO,Sort,FUNCTION,"Method - genMealy"); |
---|
78 | |
---|
79 | SC_METHOD (genMealy); |
---|
80 | dont_initialize (); |
---|
81 | // sensitive << (*(in_CLOCK)).neg(); // don't use internal register |
---|
82 | for (uint32_t i=0; i<_param->_nb_input; i++) |
---|
83 | sensitive << (*(in_INPUT_VAL [i])) |
---|
84 | << (*(in_INPUT_DATA [i])); |
---|
85 | |
---|
86 | # ifdef SYSTEMCASS_SPECIFIC |
---|
87 | // List dependency information |
---|
88 | for (uint32_t i=0; i<_param->_nb_output; i++) |
---|
89 | for (uint32_t j=0; j<_param->_nb_input; j++) |
---|
90 | { |
---|
91 | (*(out_OUTPUT_VAL [i])) (*(in_INPUT_VAL [j])); |
---|
92 | (*(out_OUTPUT_VAL [i])) (*(in_INPUT_DATA [j])); |
---|
93 | |
---|
94 | if (_param->_have_port_index_out) |
---|
95 | { |
---|
96 | (*(out_OUTPUT_INDEX [i])) (*(in_INPUT_VAL [j])); |
---|
97 | (*(out_OUTPUT_INDEX [i])) (*(in_INPUT_DATA [j])); |
---|
98 | } |
---|
99 | if (_param->_have_port_data_out) |
---|
100 | { |
---|
101 | (*(out_OUTPUT_DATA [i])) (*(in_INPUT_VAL [j])); |
---|
102 | (*(out_OUTPUT_DATA [i])) (*(in_INPUT_DATA [j])); |
---|
103 | } |
---|
104 | } |
---|
105 | # endif |
---|
106 | |
---|
107 | #endif |
---|
108 | } |
---|
109 | log_printf(FUNC,Sort,FUNCTION,"End"); |
---|
110 | }; |
---|
111 | |
---|
112 | #undef FUNCTION |
---|
113 | #define FUNCTION "Sort::~Sort" |
---|
114 | Sort::~Sort (void) |
---|
115 | { |
---|
116 | log_printf(FUNC,Sort,FUNCTION,"Begin"); |
---|
117 | |
---|
118 | #ifdef STATISTICS |
---|
119 | if (_usage & USE_STATISTICS) |
---|
120 | { |
---|
121 | statistics_deallocation(); |
---|
122 | } |
---|
123 | #endif |
---|
124 | |
---|
125 | log_printf(INFO,Sort,FUNCTION,"Deallocation"); |
---|
126 | deallocation (); |
---|
127 | |
---|
128 | log_printf(FUNC,Sort,FUNCTION,"End"); |
---|
129 | }; |
---|
130 | |
---|
131 | }; // end namespace sort |
---|
132 | }; // end namespace generic |
---|
133 | |
---|
134 | }; // end namespace behavioural |
---|
135 | }; // end namespace morpheo |
---|