1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Free_List_unit_transition.cpp 110 2009-02-19 16:31:47Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Free_List_unit/include/Free_List_unit.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_ooo_engine { |
---|
15 | namespace ooo_engine { |
---|
16 | namespace rename_unit { |
---|
17 | namespace register_translation_unit { |
---|
18 | namespace free_list_unit { |
---|
19 | |
---|
20 | |
---|
21 | #undef FUNCTION |
---|
22 | #define FUNCTION "Free_List_unit::transition" |
---|
23 | void Free_List_unit::transition (void) |
---|
24 | { |
---|
25 | log_begin(Free_List_unit,FUNCTION); |
---|
26 | log_function(Free_List_unit,FUNCTION,_name.c_str()); |
---|
27 | |
---|
28 | if (PORT_READ(in_NRESET) == 0) |
---|
29 | { |
---|
30 | _priority_gpr->reset(); |
---|
31 | _priority_spr->reset(); |
---|
32 | |
---|
33 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
34 | { |
---|
35 | _gpr_list[i].clear(); |
---|
36 | _spr_list[i].clear(); |
---|
37 | } |
---|
38 | } |
---|
39 | else |
---|
40 | { |
---|
41 | _priority_gpr->transition(); |
---|
42 | _priority_spr->transition(); |
---|
43 | |
---|
44 | // ================================================== |
---|
45 | // =====[ POP ]====================================== |
---|
46 | // ================================================== |
---|
47 | for (uint32_t i=0; i<_param->_nb_pop; i++) |
---|
48 | if (PORT_READ(in_POP_VAL[i]) and internal_POP_ACK [i]) |
---|
49 | { |
---|
50 | log_printf(TRACE,Free_List_unit,FUNCTION," * POP [%d]",i); |
---|
51 | |
---|
52 | #ifdef STATISTICS |
---|
53 | (*_stat_nb_inst_pop) ++; |
---|
54 | #endif |
---|
55 | |
---|
56 | if (PORT_READ(in_POP_GPR_VAL [i])) |
---|
57 | { |
---|
58 | #ifdef STATISTICS |
---|
59 | (*_stat_nb_inst_pop_gpr) ++; |
---|
60 | #endif |
---|
61 | _gpr_list [internal_POP_GPR_BANK[i]].pop_front(); |
---|
62 | } |
---|
63 | |
---|
64 | if (PORT_READ(in_POP_SPR_VAL [i])) |
---|
65 | { |
---|
66 | #ifdef STATISTICS |
---|
67 | (*_stat_nb_inst_pop_spr) ++; |
---|
68 | #endif |
---|
69 | _spr_list [internal_POP_SPR_BANK[i]].pop_front(); |
---|
70 | } |
---|
71 | } |
---|
72 | |
---|
73 | // ================================================== |
---|
74 | // =====[ PUSH_GPR ]================================= |
---|
75 | // ================================================== |
---|
76 | for (uint32_t i=0; i<_param->_nb_push; i++) |
---|
77 | if (PORT_READ(in_PUSH_GPR_VAL[i]) and internal_PUSH_GPR_ACK [i]) |
---|
78 | { |
---|
79 | log_printf(TRACE,Free_List_unit,FUNCTION," * PUSH_GPR[%d]",i); |
---|
80 | log_printf(TRACE,Free_List_unit,FUNCTION," * bank : %d",internal_PUSH_GPR_BANK[i]); |
---|
81 | log_printf(TRACE,Free_List_unit,FUNCTION," * num_reg : %d",PORT_READ(in_PUSH_GPR_NUM_REG [i])); |
---|
82 | |
---|
83 | #ifdef STATISTICS |
---|
84 | (*_stat_nb_inst_push_gpr) ++; |
---|
85 | #endif |
---|
86 | |
---|
87 | _gpr_list [internal_PUSH_GPR_BANK[i]].push_back(PORT_READ(in_PUSH_GPR_NUM_REG [i])); |
---|
88 | } |
---|
89 | // ================================================== |
---|
90 | // =====[ PUSH_SPR ]================================= |
---|
91 | // ================================================== |
---|
92 | for (uint32_t i=0; i<_param->_nb_push; i++) |
---|
93 | if (PORT_READ(in_PUSH_SPR_VAL[i]) and internal_PUSH_SPR_ACK [i]) |
---|
94 | { |
---|
95 | log_printf(TRACE,Free_List_unit,FUNCTION," * PUSH_SPR[%d]",i); |
---|
96 | log_printf(TRACE,Free_List_unit,FUNCTION," * bank : %d",internal_PUSH_SPR_BANK[i]); |
---|
97 | log_printf(TRACE,Free_List_unit,FUNCTION," * num_reg : %d",PORT_READ(in_PUSH_SPR_NUM_REG [i])); |
---|
98 | |
---|
99 | #ifdef STATISTICS |
---|
100 | (*_stat_nb_inst_push_spr) ++; |
---|
101 | #endif |
---|
102 | |
---|
103 | _spr_list [internal_PUSH_SPR_BANK[i]].push_back(PORT_READ(in_PUSH_SPR_NUM_REG [i])); |
---|
104 | } |
---|
105 | |
---|
106 | #ifdef STATISTICS |
---|
107 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
108 | { |
---|
109 | (*(_stat_bank_gpr_nb_elt [i])) += _gpr_list[i].size(); |
---|
110 | (*(_stat_bank_spr_nb_elt [i])) += _spr_list[i].size(); |
---|
111 | } |
---|
112 | #endif |
---|
113 | |
---|
114 | #if (DEBUG >= DEBUG_TRACE) and (DEBUG_Free_List_unit == true) |
---|
115 | { |
---|
116 | uint32_t limit = 4; |
---|
117 | |
---|
118 | log_printf(TRACE,Free_List_unit,FUNCTION," * Dump Free List"); |
---|
119 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
120 | { |
---|
121 | log_printf(TRACE,Free_List_unit,FUNCTION," * GPR [%d] - NB_ELT : %d",i,_gpr_list[i].size()); |
---|
122 | |
---|
123 | uint32_t j=0; |
---|
124 | for (std::list<Tgeneral_address_t>::iterator it=_gpr_list[i].begin(); |
---|
125 | it!=_gpr_list[i].end(); |
---|
126 | ) |
---|
127 | { |
---|
128 | std::string str = ""; |
---|
129 | |
---|
130 | for (uint32_t x=0; x<limit; x++) |
---|
131 | { |
---|
132 | if (it==_gpr_list[i].end()) |
---|
133 | break; |
---|
134 | else |
---|
135 | str+=toString("GPR[%.4d][%.4d] : %.5d | ",i,j,*it); |
---|
136 | ++it; |
---|
137 | ++j; |
---|
138 | } |
---|
139 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * %s",str.c_str()); |
---|
140 | } |
---|
141 | } |
---|
142 | |
---|
143 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
144 | { |
---|
145 | log_printf(TRACE,Free_List_unit,FUNCTION," * SPR [%d] - NB_ELT : %d",i,_spr_list[i].size()); |
---|
146 | |
---|
147 | uint32_t j=0; |
---|
148 | for (std::list<Tspecial_address_t>::iterator it=_spr_list[i].begin(); |
---|
149 | it!=_spr_list[i].end(); |
---|
150 | ) |
---|
151 | { |
---|
152 | std::string str = ""; |
---|
153 | |
---|
154 | for (uint32_t x=0; x<limit; x++) |
---|
155 | { |
---|
156 | if (it==_spr_list[i].end()) |
---|
157 | break; |
---|
158 | else |
---|
159 | str+=toString("SPR[%.4d][%.4d] : %.5d | ",i,j,*it); |
---|
160 | ++it; |
---|
161 | ++j; |
---|
162 | } |
---|
163 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * %s",str.c_str()); |
---|
164 | } |
---|
165 | } |
---|
166 | } |
---|
167 | #endif |
---|
168 | |
---|
169 | #ifdef DEBUG_TEST |
---|
170 | if (1) |
---|
171 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
172 | { |
---|
173 | for (std::list<Tgeneral_address_t>::iterator it1=_gpr_list[i].begin(); |
---|
174 | it1!=_gpr_list[i].end(); |
---|
175 | ++it1 |
---|
176 | ) |
---|
177 | { |
---|
178 | std::list<Tgeneral_address_t>::iterator it2 = it1; |
---|
179 | |
---|
180 | it2 ++; |
---|
181 | while (it2 != _gpr_list[i].end()) |
---|
182 | { |
---|
183 | if (*it1 == *it2) |
---|
184 | throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same GPR (%d)"),*it1)); |
---|
185 | it2 ++; |
---|
186 | } |
---|
187 | } |
---|
188 | |
---|
189 | for (std::list<Tspecial_address_t>::iterator it1=_spr_list[i].begin(); |
---|
190 | it1!=_spr_list[i].end(); |
---|
191 | ++it1 |
---|
192 | ) |
---|
193 | { |
---|
194 | std::list<Tspecial_address_t>::iterator it2 = it1; |
---|
195 | |
---|
196 | it2 ++; |
---|
197 | while (it2 != _spr_list[i].end()) |
---|
198 | { |
---|
199 | if (*it1 == *it2) |
---|
200 | throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same SPR (%d)"),*it1)); |
---|
201 | it2 ++; |
---|
202 | } |
---|
203 | } |
---|
204 | } |
---|
205 | #endif |
---|
206 | |
---|
207 | } |
---|
208 | |
---|
209 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
210 | end_cycle (); |
---|
211 | #endif |
---|
212 | |
---|
213 | log_end(Free_List_unit,FUNCTION); |
---|
214 | }; |
---|
215 | |
---|
216 | }; // end namespace free_list_unit |
---|
217 | }; // end namespace register_translation_unit |
---|
218 | }; // end namespace rename_unit |
---|
219 | }; // end namespace ooo_engine |
---|
220 | }; // end namespace multi_ooo_engine |
---|
221 | }; // end namespace core |
---|
222 | |
---|
223 | }; // end namespace behavioural |
---|
224 | }; // end namespace morpheo |
---|
225 | #endif |
---|