1 | /* |
---|
2 | * $Id: Commit_unit.cpp 145 2010-10-13 18:15:51Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h" |
---|
9 | #include "Behavioural/include/Simulation.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_ooo_engine { |
---|
15 | namespace ooo_engine { |
---|
16 | namespace commit_unit { |
---|
17 | |
---|
18 | |
---|
19 | #undef FUNCTION |
---|
20 | #define FUNCTION "Commit_unit::Commit_unit" |
---|
21 | Commit_unit::Commit_unit |
---|
22 | ( |
---|
23 | #ifdef SYSTEMC |
---|
24 | sc_module_name name, |
---|
25 | #else |
---|
26 | string name, |
---|
27 | #endif |
---|
28 | #ifdef STATISTICS |
---|
29 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
30 | #endif |
---|
31 | morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::Parameters * param, |
---|
32 | morpheo::behavioural::Tusage_t usage |
---|
33 | ): |
---|
34 | _name (name) |
---|
35 | ,_param (param) |
---|
36 | ,_usage (usage) |
---|
37 | { |
---|
38 | log_begin(Commit_unit,FUNCTION); |
---|
39 | |
---|
40 | usage_environment(_usage); |
---|
41 | |
---|
42 | // #if DEBUG_Commit_unit == true |
---|
43 | // log_printf(TRACE,Commit_unit,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
44 | |
---|
45 | // std::cout << *param << std::endl; |
---|
46 | // #endif |
---|
47 | |
---|
48 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Allocation"),_name.c_str()); |
---|
49 | |
---|
50 | allocation ( |
---|
51 | #ifdef STATISTICS |
---|
52 | param_statistics |
---|
53 | #endif |
---|
54 | ); |
---|
55 | |
---|
56 | #ifdef STATISTICS |
---|
57 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
58 | { |
---|
59 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Allocation of statistics"),_name.c_str()); |
---|
60 | |
---|
61 | statistics_allocation(param_statistics); |
---|
62 | } |
---|
63 | #endif |
---|
64 | |
---|
65 | #ifdef VHDL |
---|
66 | if (usage_is_set(_usage,USE_VHDL)) |
---|
67 | { |
---|
68 | // generate the vhdl |
---|
69 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Generate the vhdl"),_name.c_str()); |
---|
70 | |
---|
71 | vhdl(); |
---|
72 | } |
---|
73 | #endif |
---|
74 | |
---|
75 | #ifdef SYSTEMC |
---|
76 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
77 | { |
---|
78 | #ifdef SYSTEMCASS_SPECIFIC |
---|
79 | constant(); |
---|
80 | #else |
---|
81 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - constant"),_name.c_str()); |
---|
82 | |
---|
83 | SC_METHOD (constant); |
---|
84 | // dont_initialize (); |
---|
85 | |
---|
86 | # ifdef SYSTEMCASS_SPECIFIC |
---|
87 | // List dependency information |
---|
88 | # endif |
---|
89 | #endif |
---|
90 | |
---|
91 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - transition"),_name.c_str()); |
---|
92 | |
---|
93 | SC_METHOD (transition); |
---|
94 | dont_initialize (); |
---|
95 | sensitive << (*(in_CLOCK)).pos(); |
---|
96 | |
---|
97 | # ifdef SYSTEMCASS_SPECIFIC |
---|
98 | // List dependency information |
---|
99 | # endif |
---|
100 | |
---|
101 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMoore"),_name.c_str()); |
---|
102 | |
---|
103 | SC_METHOD (genMoore); |
---|
104 | dont_initialize (); |
---|
105 | sensitive << (*(in_CLOCK)).neg(); // need internal register |
---|
106 | |
---|
107 | # ifdef SYSTEMCASS_SPECIFIC |
---|
108 | // List dependency information |
---|
109 | # endif |
---|
110 | |
---|
111 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMealy_insert"),_name.c_str()); |
---|
112 | |
---|
113 | SC_METHOD (genMealy_insert); |
---|
114 | dont_initialize (); |
---|
115 | sensitive << (*(in_CLOCK)).neg() // need internal register |
---|
116 | << (*(in_NRESET)); |
---|
117 | |
---|
118 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
119 | if (_param->_rat_scheme[i] == RAT_DEPTH_SAVE) |
---|
120 | for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++) |
---|
121 | { |
---|
122 | if (_param->_have_port_front_end_id ) |
---|
123 | sensitive << (*(in_INSERT_FRONT_END_ID [i][j])); |
---|
124 | if (_param->_have_port_context_id ) |
---|
125 | sensitive << (*(in_INSERT_CONTEXT_ID [i][j])); |
---|
126 | if (_param->_have_port_depth) |
---|
127 | sensitive << (*(in_INSERT_DEPTH [i][j])); |
---|
128 | sensitive << (*(in_INSERT_SAVE_RAT [i][j])); |
---|
129 | } |
---|
130 | |
---|
131 | |
---|
132 | // for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
133 | // for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++) |
---|
134 | // sensitive << (*(in_INSERT_VAL [i][j])); |
---|
135 | |
---|
136 | # ifdef SYSTEMCASS_SPECIFIC |
---|
137 | // List dependency information |
---|
138 | // for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
139 | // for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++) |
---|
140 | // for (uint32_t x=0; x<_param->_nb_rename_unit; x++) |
---|
141 | // for (uint32_t y=0; y<_param->_nb_inst_insert[x]; y++) |
---|
142 | // { |
---|
143 | // (*(out_INSERT_ACK [i][j])) (*(in_INSERT_VAL [x][y])); |
---|
144 | // if (_param->_have_port_rob_ptr) |
---|
145 | // (*(out_INSERT_PACKET_ID [i][j])) (*(in_INSERT_VAL [x][y])); |
---|
146 | // } |
---|
147 | # endif |
---|
148 | |
---|
149 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMealy_retire"),_name.c_str()); |
---|
150 | |
---|
151 | SC_METHOD (genMealy_retire); |
---|
152 | dont_initialize (); |
---|
153 | sensitive << (*(in_CLOCK)).neg() // need internal register |
---|
154 | << (*(in_NRESET)); |
---|
155 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
156 | for (uint32_t j=0; j<_param->_nb_inst_retire[i]; j++) |
---|
157 | sensitive << (*(in_RETIRE_ACK [i][j])); |
---|
158 | |
---|
159 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
160 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
161 | sensitive << (*(in_SPR_WRITE_ACK [i][j])); |
---|
162 | |
---|
163 | # ifdef SYSTEMCASS_SPECIFIC |
---|
164 | // List dependency information |
---|
165 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
166 | for (uint32_t j=0; j<_param->_nb_inst_retire[i]; j++) |
---|
167 | { |
---|
168 | for (uint32_t x=0; x<_param->_nb_rename_unit; x++) |
---|
169 | for (uint32_t y=0; y<_param->_nb_inst_retire[x]; y++) |
---|
170 | { |
---|
171 | (*(out_RETIRE_VAL [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
172 | if (_param->_have_port_front_end_id) |
---|
173 | (*(out_RETIRE_FRONT_END_ID [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
174 | if (_param->_have_port_context_id) |
---|
175 | (*(out_RETIRE_CONTEXT_ID [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
176 | // (*(out_RETIRE_RENAME_UNIT_ID [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
177 | (*(out_RETIRE_USE_STORE_QUEUE [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
178 | (*(out_RETIRE_USE_LOAD_QUEUE [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
179 | (*(out_RETIRE_STORE_QUEUE_PTR_WRITE [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
180 | if (_param->_have_port_load_queue_ptr) |
---|
181 | (*(out_RETIRE_LOAD_QUEUE_PTR_WRITE [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
182 | // (*(out_RETIRE_READ_RA [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
183 | // (*(out_RETIRE_NUM_REG_RA_PHY [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
184 | // (*(out_RETIRE_READ_RB [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
185 | // (*(out_RETIRE_NUM_REG_RB_PHY [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
186 | // (*(out_RETIRE_READ_RC [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
187 | // (*(out_RETIRE_NUM_REG_RC_PHY [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
188 | (*(out_RETIRE_WRITE_RD [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
189 | (*(out_RETIRE_NUM_REG_RD_LOG [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
190 | (*(out_RETIRE_NUM_REG_RD_PHY_OLD [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
191 | (*(out_RETIRE_NUM_REG_RD_PHY_NEW [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
192 | (*(out_RETIRE_WRITE_RE [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
193 | (*(out_RETIRE_NUM_REG_RE_LOG [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
194 | (*(out_RETIRE_NUM_REG_RE_PHY_OLD [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
195 | (*(out_RETIRE_NUM_REG_RE_PHY_NEW [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
196 | } |
---|
197 | |
---|
198 | for (uint32_t x=0; x<_param->_nb_front_end; ++x) |
---|
199 | for (uint32_t y=0; y<_param->_nb_context[x]; ++y) |
---|
200 | { |
---|
201 | (*(out_RETIRE_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
202 | if (_param->_have_port_front_end_id) |
---|
203 | (*(out_RETIRE_FRONT_END_ID [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
204 | if (_param->_have_port_context_id) |
---|
205 | (*(out_RETIRE_CONTEXT_ID [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
206 | // (*(out_RETIRE_RENAME_UNIT_ID [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
207 | (*(out_RETIRE_USE_STORE_QUEUE [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
208 | (*(out_RETIRE_USE_LOAD_QUEUE [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
209 | (*(out_RETIRE_STORE_QUEUE_PTR_WRITE [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
210 | if (_param->_have_port_load_queue_ptr) |
---|
211 | (*(out_RETIRE_LOAD_QUEUE_PTR_WRITE [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
212 | // (*(out_RETIRE_READ_RA [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
213 | // (*(out_RETIRE_NUM_REG_RA_PHY [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
214 | // (*(out_RETIRE_READ_RB [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
215 | // (*(out_RETIRE_NUM_REG_RB_PHY [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
216 | // (*(out_RETIRE_READ_RC [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
217 | // (*(out_RETIRE_NUM_REG_RC_PHY [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
218 | (*(out_RETIRE_WRITE_RD [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
219 | (*(out_RETIRE_NUM_REG_RD_LOG [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
220 | (*(out_RETIRE_NUM_REG_RD_PHY_OLD [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
221 | (*(out_RETIRE_NUM_REG_RD_PHY_NEW [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
222 | (*(out_RETIRE_WRITE_RE [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
223 | (*(out_RETIRE_NUM_REG_RE_LOG [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
224 | (*(out_RETIRE_NUM_REG_RE_PHY_OLD [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
225 | (*(out_RETIRE_NUM_REG_RE_PHY_NEW [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
226 | } |
---|
227 | } |
---|
228 | |
---|
229 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
230 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
231 | { |
---|
232 | for (uint32_t x=0; x<_param->_nb_rename_unit; x++) |
---|
233 | for (uint32_t y=0; y<_param->_nb_inst_retire[x]; y++) |
---|
234 | { |
---|
235 | (*(out_SPR_WRITE_VAL [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
236 | (*(out_SPR_WRITE_SR_F_VAL [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
237 | (*(out_SPR_WRITE_SR_F [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
238 | (*(out_SPR_WRITE_SR_CY_VAL [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
239 | (*(out_SPR_WRITE_SR_CY [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
240 | (*(out_SPR_WRITE_SR_OV_VAL [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
241 | (*(out_SPR_WRITE_SR_OV [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
242 | } |
---|
243 | |
---|
244 | for (uint32_t x=0; x<_param->_nb_front_end; ++x) |
---|
245 | for (uint32_t y=0; y<_param->_nb_context[x]; ++y) |
---|
246 | { |
---|
247 | (*(out_SPR_WRITE_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
248 | (*(out_SPR_WRITE_SR_F_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
249 | (*(out_SPR_WRITE_SR_F [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
250 | (*(out_SPR_WRITE_SR_CY_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
251 | (*(out_SPR_WRITE_SR_CY [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
252 | (*(out_SPR_WRITE_SR_OV_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
253 | (*(out_SPR_WRITE_SR_OV [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
254 | } |
---|
255 | } |
---|
256 | # endif |
---|
257 | |
---|
258 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMealy_commit"),_name.c_str()); |
---|
259 | |
---|
260 | SC_METHOD (genMealy_commit); |
---|
261 | dont_initialize (); |
---|
262 | sensitive << (*(in_CLOCK)).neg() // need internal register |
---|
263 | << (*(in_NRESET)); |
---|
264 | for (uint32_t j=0; j<_param->_nb_inst_commit; j++) |
---|
265 | { |
---|
266 | sensitive << (*(in_COMMIT_VAL [j])); |
---|
267 | if (_param->_have_port_rob_ptr) |
---|
268 | sensitive << (*(in_COMMIT_PACKET_ID [j])); |
---|
269 | } |
---|
270 | |
---|
271 | # ifdef SYSTEMCASS_SPECIFIC |
---|
272 | // List dependency information |
---|
273 | for (uint32_t j=0; j<_param->_nb_inst_commit; j++) |
---|
274 | for (uint32_t y=0; y<_param->_nb_inst_commit; y++) |
---|
275 | { |
---|
276 | (*(out_COMMIT_ACK [j])) (*(in_COMMIT_VAL [y])); |
---|
277 | if (_param->_have_port_rob_ptr) |
---|
278 | (*(out_COMMIT_ACK [j])) (*(in_COMMIT_PACKET_ID [y])); |
---|
279 | } |
---|
280 | # endif |
---|
281 | |
---|
282 | #endif |
---|
283 | |
---|
284 | // Init stop condition |
---|
285 | while (_simulation_nb_instruction_commited.size() < _param->_nb_thread) |
---|
286 | _simulation_nb_instruction_commited.push_back(0); |
---|
287 | } |
---|
288 | log_end(Commit_unit,FUNCTION); |
---|
289 | }; |
---|
290 | |
---|
291 | #undef FUNCTION |
---|
292 | #define FUNCTION "Commit_unit::~Commit_unit" |
---|
293 | Commit_unit::~Commit_unit (void) |
---|
294 | { |
---|
295 | log_begin(Commit_unit,FUNCTION); |
---|
296 | |
---|
297 | #ifdef STATISTICS |
---|
298 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
299 | { |
---|
300 | statistics_deallocation(); |
---|
301 | } |
---|
302 | #endif |
---|
303 | |
---|
304 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Deallocation"),_name.c_str()); |
---|
305 | deallocation (); |
---|
306 | |
---|
307 | log_end(Commit_unit,FUNCTION); |
---|
308 | }; |
---|
309 | |
---|
310 | }; // end namespace commit_unit |
---|
311 | }; // end namespace ooo_engine |
---|
312 | }; // end namespace multi_ooo_engine |
---|
313 | }; // end namespace core |
---|
314 | |
---|
315 | }; // end namespace behavioural |
---|
316 | }; // end namespace morpheo |
---|