1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Free_List_unit_transition.cpp 109 2009-02-16 20:28:31Z 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 | if (PORT_READ(in_POP_GPR_VAL [i])) |
---|
53 | _gpr_list [internal_POP_GPR_BANK[i]].pop_front(); |
---|
54 | |
---|
55 | if (PORT_READ(in_POP_SPR_VAL [i])) |
---|
56 | _spr_list [internal_POP_SPR_BANK[i]].pop_front(); |
---|
57 | } |
---|
58 | |
---|
59 | // ================================================== |
---|
60 | // =====[ PUSH_GPR ]================================= |
---|
61 | // ================================================== |
---|
62 | for (uint32_t i=0; i<_param->_nb_push; i++) |
---|
63 | if (PORT_READ(in_PUSH_GPR_VAL[i]) and internal_PUSH_GPR_ACK [i]) |
---|
64 | { |
---|
65 | log_printf(TRACE,Free_List_unit,FUNCTION," * PUSH_GPR[%d]",i); |
---|
66 | log_printf(TRACE,Free_List_unit,FUNCTION," * bank : %d",internal_PUSH_GPR_BANK[i]); |
---|
67 | log_printf(TRACE,Free_List_unit,FUNCTION," * num_reg : %d",PORT_READ(in_PUSH_GPR_NUM_REG [i])); |
---|
68 | |
---|
69 | _gpr_list [internal_PUSH_GPR_BANK[i]].push_back(PORT_READ(in_PUSH_GPR_NUM_REG [i])); |
---|
70 | } |
---|
71 | // ================================================== |
---|
72 | // =====[ PUSH_SPR ]================================= |
---|
73 | // ================================================== |
---|
74 | for (uint32_t i=0; i<_param->_nb_push; i++) |
---|
75 | if (PORT_READ(in_PUSH_SPR_VAL[i]) and internal_PUSH_SPR_ACK [i]) |
---|
76 | { |
---|
77 | log_printf(TRACE,Free_List_unit,FUNCTION," * PUSH_SPR[%d]",i); |
---|
78 | log_printf(TRACE,Free_List_unit,FUNCTION," * bank : %d",internal_PUSH_SPR_BANK[i]); |
---|
79 | log_printf(TRACE,Free_List_unit,FUNCTION," * num_reg : %d",PORT_READ(in_PUSH_SPR_NUM_REG [i])); |
---|
80 | |
---|
81 | _spr_list [internal_PUSH_SPR_BANK[i]].push_back(PORT_READ(in_PUSH_SPR_NUM_REG [i])); |
---|
82 | } |
---|
83 | |
---|
84 | #if (DEBUG >= DEBUG_TRACE) and (DEBUG_Free_List_unit == true) |
---|
85 | { |
---|
86 | uint32_t limit = 4; |
---|
87 | |
---|
88 | log_printf(TRACE,Free_List_unit,FUNCTION," * Dump Free List"); |
---|
89 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
90 | { |
---|
91 | log_printf(TRACE,Free_List_unit,FUNCTION," * GPR [%d] - NB_ELT : %d",i,_gpr_list[i].size()); |
---|
92 | |
---|
93 | uint32_t j=0; |
---|
94 | for (std::list<Tgeneral_address_t>::iterator it=_gpr_list[i].begin(); |
---|
95 | it!=_gpr_list[i].end(); |
---|
96 | ) |
---|
97 | { |
---|
98 | std::string str = ""; |
---|
99 | |
---|
100 | for (uint32_t x=0; x<limit; x++) |
---|
101 | { |
---|
102 | if (it==_gpr_list[i].end()) |
---|
103 | break; |
---|
104 | else |
---|
105 | str+=toString("GPR[%.4d][%.4d] : %.5d | ",i,j,*it); |
---|
106 | ++it; |
---|
107 | ++j; |
---|
108 | } |
---|
109 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * %s",str.c_str()); |
---|
110 | } |
---|
111 | } |
---|
112 | |
---|
113 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
114 | { |
---|
115 | log_printf(TRACE,Free_List_unit,FUNCTION," * SPR [%d] - NB_ELT : %d",i,_spr_list[i].size()); |
---|
116 | |
---|
117 | uint32_t j=0; |
---|
118 | for (std::list<Tspecial_address_t>::iterator it=_spr_list[i].begin(); |
---|
119 | it!=_spr_list[i].end(); |
---|
120 | ) |
---|
121 | { |
---|
122 | std::string str = ""; |
---|
123 | |
---|
124 | for (uint32_t x=0; x<limit; x++) |
---|
125 | { |
---|
126 | if (it==_spr_list[i].end()) |
---|
127 | break; |
---|
128 | else |
---|
129 | str+=toString("SPR[%.4d][%.4d] : %.5d | ",i,j,*it); |
---|
130 | ++it; |
---|
131 | ++j; |
---|
132 | } |
---|
133 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * %s",str.c_str()); |
---|
134 | } |
---|
135 | } |
---|
136 | } |
---|
137 | #endif |
---|
138 | |
---|
139 | #ifdef DEBUG_TEST |
---|
140 | if (1) |
---|
141 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
142 | { |
---|
143 | for (std::list<Tgeneral_address_t>::iterator it1=_gpr_list[i].begin(); |
---|
144 | it1!=_gpr_list[i].end(); |
---|
145 | ++it1 |
---|
146 | ) |
---|
147 | { |
---|
148 | std::list<Tgeneral_address_t>::iterator it2 = it1; |
---|
149 | |
---|
150 | it2 ++; |
---|
151 | while (it2 != _gpr_list[i].end()) |
---|
152 | { |
---|
153 | if (*it1 == *it2) |
---|
154 | throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same GPR (%d)"),*it1)); |
---|
155 | it2 ++; |
---|
156 | } |
---|
157 | } |
---|
158 | |
---|
159 | for (std::list<Tspecial_address_t>::iterator it1=_spr_list[i].begin(); |
---|
160 | it1!=_spr_list[i].end(); |
---|
161 | ++it1 |
---|
162 | ) |
---|
163 | { |
---|
164 | std::list<Tspecial_address_t>::iterator it2 = it1; |
---|
165 | |
---|
166 | it2 ++; |
---|
167 | while (it2 != _spr_list[i].end()) |
---|
168 | { |
---|
169 | if (*it1 == *it2) |
---|
170 | throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same SPR (%d)"),*it1)); |
---|
171 | it2 ++; |
---|
172 | } |
---|
173 | } |
---|
174 | } |
---|
175 | #endif |
---|
176 | |
---|
177 | } |
---|
178 | |
---|
179 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
180 | end_cycle (); |
---|
181 | #endif |
---|
182 | |
---|
183 | log_end(Free_List_unit,FUNCTION); |
---|
184 | }; |
---|
185 | |
---|
186 | }; // end namespace free_list_unit |
---|
187 | }; // end namespace register_translation_unit |
---|
188 | }; // end namespace rename_unit |
---|
189 | }; // end namespace ooo_engine |
---|
190 | }; // end namespace multi_ooo_engine |
---|
191 | }; // end namespace core |
---|
192 | |
---|
193 | }; // end namespace behavioural |
---|
194 | }; // end namespace morpheo |
---|
195 | #endif |
---|