1 | /* |
---|
2 | * $Id: Sort.cpp 128 2009-06-26 08:43:23Z rosiere $ |
---|
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 | // #if DEBUG_Sort == true |
---|
38 | // log_printf(INFO,Sort,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
39 | |
---|
40 | // std::cout << *param << std::endl; |
---|
41 | // #endif |
---|
42 | |
---|
43 | log_printf(INFO,Sort,FUNCTION,"Allocation"); |
---|
44 | |
---|
45 | allocation ( |
---|
46 | #ifdef STATISTICS |
---|
47 | param_statistics |
---|
48 | #endif |
---|
49 | ); |
---|
50 | |
---|
51 | #ifdef STATISTICS |
---|
52 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
53 | { |
---|
54 | log_printf(INFO,Sort,FUNCTION,"Allocation of statistics"); |
---|
55 | |
---|
56 | statistics_allocation(param_statistics); |
---|
57 | } |
---|
58 | #endif |
---|
59 | |
---|
60 | #ifdef VHDL |
---|
61 | if (usage_is_set(_usage,USE_VHDL)) |
---|
62 | { |
---|
63 | // generate the vhdl |
---|
64 | log_printf(INFO,Sort,FUNCTION,"Generate the vhdl"); |
---|
65 | |
---|
66 | vhdl(); |
---|
67 | } |
---|
68 | #endif |
---|
69 | |
---|
70 | #ifdef SYSTEMC |
---|
71 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
72 | { |
---|
73 | # if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
74 | log_printf(INFO,Sort,FUNCTION,"Method - transition"); |
---|
75 | |
---|
76 | SC_METHOD (transition); |
---|
77 | dont_initialize (); |
---|
78 | sensitive << (*(in_CLOCK)).pos(); |
---|
79 | |
---|
80 | # ifdef SYSTEMCASS_SPECIFIC |
---|
81 | // List dependency information |
---|
82 | # endif |
---|
83 | # endif |
---|
84 | |
---|
85 | log_printf(INFO,Sort,FUNCTION,"Method - genMealy"); |
---|
86 | |
---|
87 | SC_METHOD (genMealy); |
---|
88 | dont_initialize (); |
---|
89 | // sensitive << (*(in_CLOCK)).neg(); // don't use internal register |
---|
90 | for (uint32_t i=0; i<_param->_nb_input; i++) |
---|
91 | sensitive << (*(in_INPUT_VAL [i])) |
---|
92 | << (*(in_INPUT_DATA [i])); |
---|
93 | |
---|
94 | # ifdef SYSTEMCASS_SPECIFIC |
---|
95 | // List dependency information |
---|
96 | for (uint32_t i=0; i<_param->_nb_output; i++) |
---|
97 | for (uint32_t j=0; j<_param->_nb_input; j++) |
---|
98 | { |
---|
99 | (*(out_OUTPUT_VAL [i])) (*(in_INPUT_VAL [j])); |
---|
100 | (*(out_OUTPUT_VAL [i])) (*(in_INPUT_DATA [j])); |
---|
101 | |
---|
102 | if (_param->_have_port_index_out) |
---|
103 | { |
---|
104 | (*(out_OUTPUT_INDEX [i])) (*(in_INPUT_VAL [j])); |
---|
105 | (*(out_OUTPUT_INDEX [i])) (*(in_INPUT_DATA [j])); |
---|
106 | } |
---|
107 | if (_param->_have_port_data_out) |
---|
108 | { |
---|
109 | (*(out_OUTPUT_DATA [i])) (*(in_INPUT_VAL [j])); |
---|
110 | (*(out_OUTPUT_DATA [i])) (*(in_INPUT_DATA [j])); |
---|
111 | } |
---|
112 | } |
---|
113 | # endif |
---|
114 | |
---|
115 | #endif |
---|
116 | } |
---|
117 | log_printf(FUNC,Sort,FUNCTION,"End"); |
---|
118 | }; |
---|
119 | |
---|
120 | #undef FUNCTION |
---|
121 | #define FUNCTION "Sort::~Sort" |
---|
122 | Sort::~Sort (void) |
---|
123 | { |
---|
124 | log_printf(FUNC,Sort,FUNCTION,"Begin"); |
---|
125 | |
---|
126 | #ifdef STATISTICS |
---|
127 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
128 | { |
---|
129 | statistics_deallocation(); |
---|
130 | } |
---|
131 | #endif |
---|
132 | |
---|
133 | log_printf(INFO,Sort,FUNCTION,"Deallocation"); |
---|
134 | deallocation (); |
---|
135 | |
---|
136 | log_printf(FUNC,Sort,FUNCTION,"End"); |
---|
137 | }; |
---|
138 | |
---|
139 | }; // end namespace sort |
---|
140 | }; // end namespace generic |
---|
141 | |
---|
142 | }; // end namespace behavioural |
---|
143 | }; // end namespace morpheo |
---|