1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Issue_queue_function_out_of_order_genMoore.cpp 117 2009-05-16 14:42:39Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Issue_queue/include/Issue_queue.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_ooo_engine { |
---|
15 | namespace ooo_engine { |
---|
16 | namespace issue_queue { |
---|
17 | |
---|
18 | |
---|
19 | #undef FUNCTION |
---|
20 | #define FUNCTION "Issue_queue::function_out_of_order_genMoore" |
---|
21 | void Issue_queue::function_out_of_order_genMoore (void) |
---|
22 | { |
---|
23 | log_begin(Issue_queue,FUNCTION); |
---|
24 | log_function(Issue_queue,FUNCTION,_name.c_str()); |
---|
25 | |
---|
26 | // =================================================================== |
---|
27 | // =====[ REEXECUTE_UNIT ]============================================ |
---|
28 | // =================================================================== |
---|
29 | // Same implementation in in-order and out-of-order |
---|
30 | |
---|
31 | // =================================================================== |
---|
32 | // =====[ ISSUE_IN ]================================================== |
---|
33 | // =================================================================== |
---|
34 | { |
---|
35 | Tcontrol_t ack [_param->_nb_rename_unit][_param->_max_nb_inst_rename]; |
---|
36 | |
---|
37 | // Initialisation |
---|
38 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
39 | internal_BANK_IN_ACK [i] = false; |
---|
40 | |
---|
41 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
42 | for (uint32_t j=0; j<_param->_nb_inst_rename[i]; j++) |
---|
43 | ack [i][j] = false; |
---|
44 | |
---|
45 | std::list<generic::priority::select_t> * select_reg = _priority_reg->select(); // same select for all issue |
---|
46 | |
---|
47 | // issue_in interface |
---|
48 | std::list<generic::priority::select_t> * select_in = _priority_in ->select(); // same select for all issue |
---|
49 | for (std::list<generic::priority::select_t>::iterator it=select_in ->begin(); |
---|
50 | it!=select_in ->end(); |
---|
51 | it++) |
---|
52 | { |
---|
53 | // Get num interface |
---|
54 | uint32_t num_rename_unit = it->grp; |
---|
55 | uint32_t num_inst_rename = it->elt; |
---|
56 | |
---|
57 | log_printf(TRACE,Issue_queue,FUNCTION," * ISSUE_IN [%d][%d]",num_rename_unit,num_inst_rename); |
---|
58 | |
---|
59 | // scan all bank |
---|
60 | for (std::list<generic::priority::select_t>::iterator it=select_reg->begin(); |
---|
61 | it!=select_reg->end(); |
---|
62 | it++) |
---|
63 | { |
---|
64 | uint32_t num_bank = it->grp; |
---|
65 | |
---|
66 | log_printf(TRACE,Issue_queue,FUNCTION," * BANK [%d]",num_bank); |
---|
67 | |
---|
68 | // test if bank is not busy (full or previous access) |
---|
69 | if (not internal_BANK_IN_ACK [num_bank] and (_issue_queue[num_bank].size() < _param->_size_bank)) |
---|
70 | { |
---|
71 | log_printf(TRACE,Issue_queue,FUNCTION," * find"); |
---|
72 | |
---|
73 | // find |
---|
74 | ack [num_rename_unit][num_inst_rename] = true; |
---|
75 | internal_BANK_IN_ACK [num_bank] = true; |
---|
76 | internal_BANK_IN_NUM_RENAME_UNIT [num_bank] = num_rename_unit; |
---|
77 | internal_BANK_IN_NUM_INST [num_bank] = num_inst_rename; |
---|
78 | |
---|
79 | break; // Stop scan |
---|
80 | } |
---|
81 | else |
---|
82 | log_printf(TRACE,Issue_queue,FUNCTION," * not find"); |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
87 | for (uint32_t j=0; j<_param->_nb_inst_rename[i]; j++) |
---|
88 | PORT_WRITE(out_ISSUE_IN_ACK [i][j],ack [i][j]); |
---|
89 | } |
---|
90 | |
---|
91 | // =================================================================== |
---|
92 | // =====[ ISSUE_OUT ]================================================= |
---|
93 | // =================================================================== |
---|
94 | { |
---|
95 | Tcontrol_t val [_param->_nb_inst_issue]; |
---|
96 | |
---|
97 | for (uint32_t i=0; i<_param->_nb_inst_issue; i++) |
---|
98 | val [i] = 0; |
---|
99 | |
---|
100 | // From Reexecute_queue |
---|
101 | |
---|
102 | // uint32_t num_reexecute_entry = 0; |
---|
103 | for (std::list<entry_t*>::iterator it=_reexecute_queue.begin(); |
---|
104 | it!=_reexecute_queue.end(); |
---|
105 | ++it) |
---|
106 | { |
---|
107 | entry_t* entry = (*it); |
---|
108 | |
---|
109 | for (uint32_t i=0; i<_param->_nb_inst_issue; i++) |
---|
110 | // test if no previous transaction and can accept this type |
---|
111 | if ((val[i] == 0) |
---|
112 | // and _param->_table_issue_type [i][entry->_type] |
---|
113 | ) |
---|
114 | { |
---|
115 | // find a issue port |
---|
116 | val [i] = 1; |
---|
117 | |
---|
118 | if (_param->_have_port_context_id) |
---|
119 | PORT_WRITE(out_ISSUE_OUT_CONTEXT_ID [i], entry->_context_id ); |
---|
120 | if (_param->_have_port_front_end_id) |
---|
121 | PORT_WRITE(out_ISSUE_OUT_FRONT_END_ID [i], entry->_front_end_id ); |
---|
122 | if (_param->_have_port_rob_ptr ) |
---|
123 | PORT_WRITE(out_ISSUE_OUT_PACKET_ID [i], entry->_packet_id ); |
---|
124 | PORT_WRITE(out_ISSUE_OUT_OPERATION [i], entry->_operation ); |
---|
125 | PORT_WRITE(out_ISSUE_OUT_TYPE [i], entry->_type ); |
---|
126 | PORT_WRITE(out_ISSUE_OUT_STORE_QUEUE_PTR_WRITE [i], entry->_store_queue_ptr_write); |
---|
127 | if (_param->_have_port_load_queue_ptr) |
---|
128 | PORT_WRITE(out_ISSUE_OUT_LOAD_QUEUE_PTR_WRITE [i], entry->_load_queue_ptr_write ); |
---|
129 | PORT_WRITE(out_ISSUE_OUT_HAS_IMMEDIAT [i], entry->_has_immediat ); |
---|
130 | PORT_WRITE(out_ISSUE_OUT_IMMEDIAT [i], entry->_immediat ); |
---|
131 | PORT_WRITE(out_ISSUE_OUT_READ_RA [i], entry->_read_ra ); |
---|
132 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RA [i], entry->_num_reg_ra ); |
---|
133 | PORT_WRITE(out_ISSUE_OUT_READ_RB [i], entry->_read_rb ); |
---|
134 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RB [i], entry->_num_reg_rb ); |
---|
135 | PORT_WRITE(out_ISSUE_OUT_READ_RC [i], entry->_read_rc ); |
---|
136 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RC [i], entry->_num_reg_rc ); |
---|
137 | PORT_WRITE(out_ISSUE_OUT_WRITE_RD [i], entry->_write_rd ); |
---|
138 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RD [i], entry->_num_reg_rd ); |
---|
139 | PORT_WRITE(out_ISSUE_OUT_WRITE_RE [i], entry->_write_re ); |
---|
140 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RE [i], entry->_num_reg_re ); |
---|
141 | |
---|
142 | internal_ISSUE_OUT_FROM_REEXECUTE [i] = true; |
---|
143 | // internal_ISSUE_OUT_NUM_BANK [i] = num_reexecute_entry; |
---|
144 | internal_ISSUE_OUT_ENTRY [i] = entry; |
---|
145 | |
---|
146 | break; // stop scan |
---|
147 | } |
---|
148 | // num_reexecute_entry ++; |
---|
149 | } |
---|
150 | |
---|
151 | // From Issue_queue |
---|
152 | |
---|
153 | std::list<generic::priority::select_t> * select = _priority_out->select(); // same select for all issue |
---|
154 | |
---|
155 | for (std::list<generic::priority::select_t>::iterator it=select->begin(); |
---|
156 | it!=select->end(); |
---|
157 | it++) |
---|
158 | { |
---|
159 | uint32_t num_bank=it->grp; |
---|
160 | |
---|
161 | // log_printf(TRACE,Issue_queue,Issue_queue,FUNCTION," * Bank [%d]",num_bank); |
---|
162 | |
---|
163 | // Have instruction ? |
---|
164 | if (not _issue_queue [num_bank].empty()) |
---|
165 | { |
---|
166 | // log_printf(TRACE,Issue_queue,Issue_queue,FUNCTION," * Not Empty !!!"); |
---|
167 | |
---|
168 | entry_t* entry = _issue_queue [num_bank].front(); |
---|
169 | |
---|
170 | for (uint32_t i=0; i<_param->_nb_inst_issue; i++) |
---|
171 | // test if no previous transaction and can accept this type |
---|
172 | if ((val[i] == 0) |
---|
173 | // and _param->_table_issue_type [i][entry->_type] |
---|
174 | ) |
---|
175 | { |
---|
176 | // find a issue port |
---|
177 | val [i] = 1; |
---|
178 | |
---|
179 | if (_param->_have_port_context_id) |
---|
180 | PORT_WRITE(out_ISSUE_OUT_CONTEXT_ID [i], entry->_context_id ); |
---|
181 | if (_param->_have_port_front_end_id) |
---|
182 | PORT_WRITE(out_ISSUE_OUT_FRONT_END_ID [i], entry->_front_end_id ); |
---|
183 | if (_param->_have_port_rob_ptr ) |
---|
184 | PORT_WRITE(out_ISSUE_OUT_PACKET_ID [i], entry->_packet_id ); |
---|
185 | PORT_WRITE(out_ISSUE_OUT_OPERATION [i], entry->_operation ); |
---|
186 | PORT_WRITE(out_ISSUE_OUT_TYPE [i], entry->_type ); |
---|
187 | PORT_WRITE(out_ISSUE_OUT_STORE_QUEUE_PTR_WRITE [i], entry->_store_queue_ptr_write); |
---|
188 | if (_param->_have_port_load_queue_ptr) |
---|
189 | PORT_WRITE(out_ISSUE_OUT_LOAD_QUEUE_PTR_WRITE [i], entry->_load_queue_ptr_write ); |
---|
190 | PORT_WRITE(out_ISSUE_OUT_HAS_IMMEDIAT [i], entry->_has_immediat ); |
---|
191 | PORT_WRITE(out_ISSUE_OUT_IMMEDIAT [i], entry->_immediat ); |
---|
192 | PORT_WRITE(out_ISSUE_OUT_READ_RA [i], entry->_read_ra ); |
---|
193 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RA [i], entry->_num_reg_ra ); |
---|
194 | PORT_WRITE(out_ISSUE_OUT_READ_RB [i], entry->_read_rb ); |
---|
195 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RB [i], entry->_num_reg_rb ); |
---|
196 | PORT_WRITE(out_ISSUE_OUT_READ_RC [i], entry->_read_rc ); |
---|
197 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RC [i], entry->_num_reg_rc ); |
---|
198 | PORT_WRITE(out_ISSUE_OUT_WRITE_RD [i], entry->_write_rd ); |
---|
199 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RD [i], entry->_num_reg_rd ); |
---|
200 | PORT_WRITE(out_ISSUE_OUT_WRITE_RE [i], entry->_write_re ); |
---|
201 | PORT_WRITE(out_ISSUE_OUT_NUM_REG_RE [i], entry->_num_reg_re ); |
---|
202 | |
---|
203 | internal_ISSUE_OUT_FROM_REEXECUTE [i] = false; |
---|
204 | internal_ISSUE_OUT_NUM_BANK [i] = num_bank; |
---|
205 | internal_ISSUE_OUT_ENTRY [i] = entry; |
---|
206 | |
---|
207 | break; // stop scan |
---|
208 | } |
---|
209 | } |
---|
210 | } |
---|
211 | |
---|
212 | for (uint32_t i=0; i<_param->_nb_inst_issue; i++) |
---|
213 | { |
---|
214 | internal_ISSUE_OUT_VAL [i] = val [i]; |
---|
215 | PORT_WRITE(out_ISSUE_OUT_VAL [i], internal_ISSUE_OUT_VAL [i]); |
---|
216 | } |
---|
217 | } |
---|
218 | |
---|
219 | log_end(Issue_queue,FUNCTION); |
---|
220 | }; |
---|
221 | |
---|
222 | }; // end namespace issue_queue |
---|
223 | }; // end namespace ooo_engine |
---|
224 | }; // end namespace multi_ooo_engine |
---|
225 | }; // end namespace core |
---|
226 | |
---|
227 | }; // end namespace behavioural |
---|
228 | }; // end namespace morpheo |
---|
229 | #endif |
---|