1 | /* |
---|
2 | * $Id: Front_end_Glue.cpp 108 2009-02-12 11:55:06Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Front_end_Glue/include/Front_end_Glue.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace core { |
---|
13 | namespace multi_front_end { |
---|
14 | namespace front_end { |
---|
15 | namespace front_end_glue { |
---|
16 | |
---|
17 | |
---|
18 | #undef FUNCTION |
---|
19 | #define FUNCTION "Front_end_Glue::Front_end_Glue" |
---|
20 | Front_end_Glue::Front_end_Glue |
---|
21 | ( |
---|
22 | #ifdef SYSTEMC |
---|
23 | sc_module_name name, |
---|
24 | #else |
---|
25 | string name, |
---|
26 | #endif |
---|
27 | #ifdef STATISTICS |
---|
28 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
29 | #endif |
---|
30 | morpheo::behavioural::core::multi_front_end::front_end::front_end_glue::Parameters * param, |
---|
31 | morpheo::behavioural::Tusage_t usage |
---|
32 | ): |
---|
33 | _name (name) |
---|
34 | ,_param (param) |
---|
35 | ,_usage (usage) |
---|
36 | { |
---|
37 | log_begin(Front_end_Glue,FUNCTION); |
---|
38 | |
---|
39 | usage_environment(_usage); |
---|
40 | |
---|
41 | #if DEBUG_Front_end_Glue == true |
---|
42 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
43 | |
---|
44 | std::cout << *param << std::endl; |
---|
45 | #endif |
---|
46 | |
---|
47 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Allocation"),_name.c_str()); |
---|
48 | |
---|
49 | allocation ( |
---|
50 | #ifdef STATISTICS |
---|
51 | param_statistics |
---|
52 | #endif |
---|
53 | ); |
---|
54 | |
---|
55 | #ifdef STATISTICS |
---|
56 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
57 | { |
---|
58 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Allocation of statistics"),_name.c_str()); |
---|
59 | |
---|
60 | statistics_allocation(param_statistics); |
---|
61 | } |
---|
62 | #endif |
---|
63 | |
---|
64 | #ifdef VHDL |
---|
65 | if (usage_is_set(_usage,USE_VHDL)) |
---|
66 | { |
---|
67 | // generate the vhdl |
---|
68 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Generate the vhdl"),_name.c_str()); |
---|
69 | |
---|
70 | vhdl(); |
---|
71 | } |
---|
72 | #endif |
---|
73 | |
---|
74 | #ifdef SYSTEMC |
---|
75 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
76 | { |
---|
77 | // Constant |
---|
78 | if (_param->_have_port_context_id) |
---|
79 | for (uint32_t i=0; i<_param->_nb_decod_unit; ++i) |
---|
80 | for (uint32_t j=0; j<_param->_decod_unit_nb_context[i]; ++j) |
---|
81 | PORT_WRITE(out_IFETCH_DECOD_UNIT_CONTEXT_ID [i][j],j); |
---|
82 | |
---|
83 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - transition"),_name.c_str()); |
---|
84 | |
---|
85 | SC_METHOD (transition); |
---|
86 | dont_initialize (); |
---|
87 | sensitive << (*(in_CLOCK)).pos(); |
---|
88 | |
---|
89 | # ifdef SYSTEMCASS_SPECIFIC |
---|
90 | // List dependency information |
---|
91 | # endif |
---|
92 | |
---|
93 | // log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str()); |
---|
94 | |
---|
95 | // SC_METHOD (genMoore); |
---|
96 | // dont_initialize (); |
---|
97 | // sensitive << (*(in_CLOCK)).neg(); // need internal register |
---|
98 | |
---|
99 | // # ifdef SYSTEMCASS_SPECIFIC |
---|
100 | // // List dependency information |
---|
101 | // # endif |
---|
102 | |
---|
103 | if (_param->_have_port_context_id) |
---|
104 | { |
---|
105 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMealy_decod"),_name.c_str()); |
---|
106 | |
---|
107 | SC_METHOD (genMealy_decod); |
---|
108 | dont_initialize (); |
---|
109 | // sensitive << (*(in_CLOCK)).neg(); // don't need internal register |
---|
110 | for (uint32_t i=0; i<_param->_nb_decod_unit; ++i) |
---|
111 | for (uint32_t j=0; j<_param->_nb_inst_decod[i]; ++j) |
---|
112 | sensitive << (*( in_DECOD_DECOD_UNIT_CONTEXT_ID [i][j])); |
---|
113 | |
---|
114 | # ifdef SYSTEMCASS_SPECIFIC |
---|
115 | // List dependency information |
---|
116 | # endif |
---|
117 | } |
---|
118 | |
---|
119 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMealy_branch_complete"),_name.c_str()); |
---|
120 | |
---|
121 | SC_METHOD (genMealy_branch_complete); |
---|
122 | dont_initialize (); |
---|
123 | // sensitive << (*(in_CLOCK)).neg(); // don't need internal register |
---|
124 | for (uint32_t i=0; i<_param->_nb_inst_branch_complete; ++i) |
---|
125 | sensitive << (*( in_BRANCH_COMPLETE_VAL [i])) |
---|
126 | << (*( in_BRANCH_COMPLETE_PREDICTION_UNIT_ACK [i])) |
---|
127 | << (*( in_BRANCH_COMPLETE_PREDICTION_UNIT_MISS_PREDICTION [i])) |
---|
128 | << (*( in_BRANCH_COMPLETE_CONTEXT_STATE_ACK [i])); |
---|
129 | |
---|
130 | # ifdef SYSTEMCASS_SPECIFIC |
---|
131 | // List dependency information |
---|
132 | # endif |
---|
133 | |
---|
134 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMealy_event"),_name.c_str()); |
---|
135 | |
---|
136 | SC_METHOD (genMealy_event); |
---|
137 | dont_initialize (); |
---|
138 | // sensitive << (*(in_CLOCK)).neg(); // don't need internal register |
---|
139 | for (uint32_t i=0; i<_param->_nb_context; ++i) |
---|
140 | { |
---|
141 | sensitive << (*( in_EVENT_ACK [i])) |
---|
142 | << (*( in_EVENT_IFETCH_UNIT_ACK [i])) |
---|
143 | << (*( in_EVENT_PREDICTION_UNIT_ACK [i])) |
---|
144 | << (*( in_EVENT_CONTEXT_STATE_VAL [i])) |
---|
145 | << (*( in_EVENT_CONTEXT_STATE_ADDRESS [i])) |
---|
146 | << (*( in_EVENT_CONTEXT_STATE_ADDRESS_NEXT [i])) |
---|
147 | << (*( in_EVENT_CONTEXT_STATE_ADDRESS_NEXT_VAL [i])) |
---|
148 | << (*( in_EVENT_CONTEXT_STATE_IS_DS_TAKE [i])) |
---|
149 | << (*( in_EVENT_CONTEXT_STATE_TYPE [i])); |
---|
150 | if (_param->_have_port_depth) |
---|
151 | sensitive << (*( in_EVENT_CONTEXT_STATE_DEPTH [i])); |
---|
152 | } |
---|
153 | |
---|
154 | # ifdef SYSTEMCASS_SPECIFIC |
---|
155 | // List dependency information |
---|
156 | # endif |
---|
157 | |
---|
158 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMealy_depth"),_name.c_str()); |
---|
159 | |
---|
160 | SC_METHOD (genMealy_depth); |
---|
161 | dont_initialize (); |
---|
162 | // sensitive << (*(in_CLOCK)).neg(); // don't need internal register |
---|
163 | for (uint32_t i=0; i<_param->_nb_context; ++i) |
---|
164 | { |
---|
165 | if (_param->_have_port_depth) |
---|
166 | sensitive << (*( in_DEPTH_PREDICTION_UNIT_CURRENT [i])) |
---|
167 | << (*( in_DEPTH_PREDICTION_UNIT_MIN [i])) |
---|
168 | << (*( in_DEPTH_PREDICTION_UNIT_MAX [i])); |
---|
169 | |
---|
170 | sensitive << (*( in_DEPTH_PREDICTION_UNIT_VAL [i])) |
---|
171 | << (*( in_DEPTH_PREDICTION_UNIT_FULL [i])); |
---|
172 | } |
---|
173 | |
---|
174 | # ifdef SYSTEMCASS_SPECIFIC |
---|
175 | // List dependency information |
---|
176 | # endif |
---|
177 | |
---|
178 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Method - genMealy_nb_inst"),_name.c_str()); |
---|
179 | |
---|
180 | SC_METHOD (genMealy_nb_inst); |
---|
181 | dont_initialize (); |
---|
182 | // sensitive << (*(in_CLOCK)).neg(); // don't need internal register |
---|
183 | for (uint32_t i=0; i<_param->_nb_context; ++i) |
---|
184 | sensitive << (*( in_NB_INST_DECOD_UNIT_DECOD_ALL [i])); |
---|
185 | |
---|
186 | # ifdef SYSTEMCASS_SPECIFIC |
---|
187 | // List dependency information |
---|
188 | # endif |
---|
189 | |
---|
190 | #endif |
---|
191 | } |
---|
192 | log_end(Front_end_Glue,FUNCTION); |
---|
193 | }; |
---|
194 | |
---|
195 | #undef FUNCTION |
---|
196 | #define FUNCTION "Front_end_Glue::~Front_end_Glue" |
---|
197 | Front_end_Glue::~Front_end_Glue (void) |
---|
198 | { |
---|
199 | log_begin(Front_end_Glue,FUNCTION); |
---|
200 | |
---|
201 | #ifdef STATISTICS |
---|
202 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
203 | { |
---|
204 | statistics_deallocation(); |
---|
205 | } |
---|
206 | #endif |
---|
207 | |
---|
208 | log_printf(INFO,Front_end_Glue,FUNCTION,_("<%s> : Deallocation"),_name.c_str()); |
---|
209 | deallocation (); |
---|
210 | |
---|
211 | log_end(Front_end_Glue,FUNCTION); |
---|
212 | }; |
---|
213 | |
---|
214 | }; // end namespace front_end_glue |
---|
215 | }; // end namespace front_end |
---|
216 | }; // end namespace multi_front_end |
---|
217 | }; // end namespace core |
---|
218 | |
---|
219 | }; // end namespace behavioural |
---|
220 | }; // end namespace morpheo |
---|