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