1 | /* |
---|
2 | * $Id: Functionnal_unit_allocation.cpp 136 2009-10-20 18:52:15Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/include/Functionnal_unit.h" |
---|
9 | #include "Behavioural/include/Allocation.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_execute_loop { |
---|
15 | namespace execute_loop { |
---|
16 | namespace multi_execute_unit { |
---|
17 | namespace execute_unit { |
---|
18 | namespace functionnal_unit { |
---|
19 | |
---|
20 | #undef FUNCTION |
---|
21 | #define FUNCTION "Functionnal_unit::allocation" |
---|
22 | void Functionnal_unit::allocation (void) |
---|
23 | { |
---|
24 | log_printf(FUNC,Functionnal_unit,FUNCTION,"Begin"); |
---|
25 | |
---|
26 | _component = new Component (_usage); |
---|
27 | |
---|
28 | Entity * entity = _component->set_entity (_name |
---|
29 | ,"Functionnal_unit" |
---|
30 | #ifdef POSITION |
---|
31 | ,COMBINATORY |
---|
32 | #endif |
---|
33 | ); |
---|
34 | |
---|
35 | _interfaces = entity->set_interfaces(); |
---|
36 | |
---|
37 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
38 | |
---|
39 | { |
---|
40 | Interface * interface = _interfaces->set_interface("" |
---|
41 | #ifdef POSITION |
---|
42 | ,IN |
---|
43 | ,SOUTH, |
---|
44 | "Generalist interface" |
---|
45 | #endif |
---|
46 | ); |
---|
47 | |
---|
48 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
49 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
50 | } |
---|
51 | // ~~~~~[ Interface : "execute_in" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
52 | |
---|
53 | { |
---|
54 | ALLOC0_INTERFACE_BEGIN("execute_in",IN,WEST,"Input of Functionnal Unit"); |
---|
55 | |
---|
56 | ALLOC0_VALACK_IN ( in_EXECUTE_IN_VAL ,VAL); |
---|
57 | ALLOC0_VALACK_OUT(out_EXECUTE_IN_ACK ,ACK); |
---|
58 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_CONTEXT_ID ,"context_id" ,Tcontext_t , _param->_size_context_id ); |
---|
59 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_FRONT_END_ID ,"front_end_id" ,Tcontext_t , _param->_size_front_end_id ); |
---|
60 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_OOO_ENGINE_ID ,"ooo_engine_id" ,Tcontext_t , _param->_size_ooo_engine_id); |
---|
61 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_PACKET_ID ,"packet_id" ,Tpacket_t , _param->_size_rob_ptr ); |
---|
62 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_OPERATION ,"operation" ,Toperation_t , _param->_size_operation ); |
---|
63 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_TYPE ,"type" ,Ttype_t , _param->_size_type ); |
---|
64 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_CANCEL ,"cancel" ,Tcontrol_t , 1); |
---|
65 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_STORE_QUEUE_PTR_WRITE ,"store_queue_ptr_write",Tlsq_ptr_t ,_param->_size_store_queue_ptr); |
---|
66 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_STORE_QUEUE_PTR_READ ,"store_queue_ptr_read" ,Tlsq_ptr_t ,_param->_size_store_queue_ptr); |
---|
67 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_STORE_QUEUE_EMPTY ,"store_queue_empty" ,Tcontrol_t , 1); |
---|
68 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_LOAD_QUEUE_PTR_WRITE ,"load_queue_ptr_write" ,Tlsq_ptr_t ,_param->_size_load_queue_ptr); |
---|
69 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_HAS_IMMEDIAT ,"has_immediat" ,Tcontrol_t , 1); |
---|
70 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_IMMEDIAT ,"immediat" ,Tgeneral_data_t , _param->_size_general_data); |
---|
71 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_DATA_RA ,"data_ra" ,Tgeneral_data_t , _param->_size_general_data); |
---|
72 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_DATA_RB ,"data_rb" ,Tgeneral_data_t , _param->_size_general_data); |
---|
73 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_DATA_RC ,"data_rc" ,Tspecial_data_t , _param->_size_special_data); |
---|
74 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_WRITE_RD ,"write_rd" ,Tcontrol_t , 1); |
---|
75 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_NUM_REG_RD ,"num_reg_rd" ,Tgeneral_address_t, _param->_size_general_register); |
---|
76 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_WRITE_RE ,"write_re" ,Tcontrol_t , 1); |
---|
77 | ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_NUM_REG_RE ,"num_reg_re" ,Tspecial_address_t, _param->_size_special_register); |
---|
78 | |
---|
79 | ALLOC0_INTERFACE_END(); |
---|
80 | } |
---|
81 | // ~~~~~[ Interface : "execute_out" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
82 | { |
---|
83 | ALLOC0_INTERFACE_BEGIN("execute_out",IN,EAST,"Output of Functionnal Unit"); |
---|
84 | |
---|
85 | ALLOC0_VALACK_OUT(out_EXECUTE_OUT_VAL ,VAL); |
---|
86 | ALLOC0_VALACK_IN ( in_EXECUTE_OUT_ACK ,ACK); |
---|
87 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_CONTEXT_ID ,"context_id" ,Tcontext_t ,_param->_size_context_id ); |
---|
88 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_FRONT_END_ID ,"front_end_id" ,Tcontext_t ,_param->_size_front_end_id ); |
---|
89 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_OOO_ENGINE_ID ,"ooo_engine_id",Tcontext_t ,_param->_size_ooo_engine_id); |
---|
90 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_PACKET_ID ,"packet_id" ,Tpacket_t ,_param->_size_rob_ptr ); |
---|
91 | //ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_OPERATION ,"operation" ,Toperation_t ,_param->_size_operation ); |
---|
92 | //ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_TYPE ,"type" ,Ttype_t ,_param->_size_type ); |
---|
93 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_CANCEL ,"cancel" ,Tcontrol_t ,1); |
---|
94 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_WRITE_RD ,"write_rd" ,Tcontrol_t ,1); |
---|
95 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_NUM_REG_RD ,"num_reg_rd" ,Tgeneral_address_t,_param->_size_general_register); |
---|
96 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_DATA_RD ,"data_rd" ,Tgeneral_data_t ,_param->_size_general_data); |
---|
97 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_WRITE_RE ,"write_re" ,Tcontrol_t ,1); |
---|
98 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_NUM_REG_RE ,"num_reg_re" ,Tspecial_address_t,_param->_size_special_register); |
---|
99 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_DATA_RE ,"data_re" ,Tspecial_data_t ,_param->_size_special_data); |
---|
100 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_EXCEPTION ,"exception" ,Texception_t ,_param->_size_exception); |
---|
101 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_NO_SEQUENCE ,"no_sequence" ,Tcontrol_t ,1); |
---|
102 | ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_ADDRESS ,"address" ,Taddress_t ,_param->_size_instruction_address); |
---|
103 | |
---|
104 | ALLOC0_INTERFACE_END(); |
---|
105 | } |
---|
106 | |
---|
107 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
108 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
109 | { |
---|
110 | if (_param->_have_pipeline_in) |
---|
111 | _execute_operation_in = new execute_operation_t; |
---|
112 | _execute_operation_out = new execute_operation_t; |
---|
113 | _execute_param = new execute_param_t(_param->_size_general_data, |
---|
114 | _param->_timing); |
---|
115 | |
---|
116 | _execute_register = new execute_register_t *** [_param->_nb_context]; |
---|
117 | |
---|
118 | for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
119 | { |
---|
120 | _execute_register [i] = new execute_register_t ** [_param->_nb_front_end]; |
---|
121 | |
---|
122 | for (uint32_t j=0; j<_param->_nb_front_end; j++) |
---|
123 | { |
---|
124 | _execute_register [i][j] = new execute_register_t * [_param->_nb_ooo_engine]; |
---|
125 | |
---|
126 | for (uint32_t k=0; k<_param->_nb_ooo_engine; k++) |
---|
127 | { |
---|
128 | // uint32_t num_thread = get_num_thread(i,_param->_size_context_id, |
---|
129 | // j,_param->_size_front_end_id, |
---|
130 | // k,_param->_size_ooo_engine_id); |
---|
131 | |
---|
132 | _execute_register [i][j][k] = new execute_register_t; |
---|
133 | |
---|
134 | if (_param->_have_groupe_MAC) |
---|
135 | _execute_register[i][j][k]->implement_group(GROUP_MAC); |
---|
136 | |
---|
137 | for (uint32_t x=GROUP_CUSTOM_1; x<GROUP_CUSTOM_8; x++) |
---|
138 | if ((_param->_get_custom_information())._get_valid_group(x) == true) |
---|
139 | { |
---|
140 | uint32_t nb_reg = (_param->_get_custom_information())._get_nb_register(x); |
---|
141 | _execute_register[i][j][k]->implement_group(x,nb_reg); |
---|
142 | |
---|
143 | for (uint32_t y=0; y<nb_reg; y++) |
---|
144 | _execute_register[i][j][k]->_spr_access_mode->change_mode(x,y,(_param->_get_custom_information())._get_access_mode(x,y)); |
---|
145 | } |
---|
146 | } |
---|
147 | } |
---|
148 | } |
---|
149 | |
---|
150 | _function_execute = new function_execute_t ** [_param->_nb_type]; |
---|
151 | |
---|
152 | // Initialisation |
---|
153 | for (uint32_t i=0; i<_param->_nb_type; i++) |
---|
154 | { |
---|
155 | _function_execute [i] = new function_execute_t * [_param->_nb_operation]; |
---|
156 | |
---|
157 | for (uint32_t j=0; j<_param->_nb_operation; j++) |
---|
158 | _function_execute [i][j] = &(operation_unimplemented); |
---|
159 | } |
---|
160 | |
---|
161 | if (_param->_timing[TYPE_ALU ][OPERATION_ALU_L_ADD ]._latence > 0) |
---|
162 | _function_execute[TYPE_ALU ][OPERATION_ALU_L_ADD ] = &(operation_l_add ); |
---|
163 | if (_param->_timing[TYPE_ALU ][OPERATION_ALU_L_ADDC ]._latence > 0) |
---|
164 | _function_execute[TYPE_ALU ][OPERATION_ALU_L_ADDC ] = &(operation_l_addc ); |
---|
165 | if (_param->_timing[TYPE_ALU ][OPERATION_ALU_L_SUB ]._latence > 0) |
---|
166 | _function_execute[TYPE_ALU ][OPERATION_ALU_L_SUB ] = &(operation_l_sub ); |
---|
167 | if (_param->_timing[TYPE_ALU ][OPERATION_ALU_L_AND ]._latence > 0) |
---|
168 | _function_execute[TYPE_ALU ][OPERATION_ALU_L_AND ] = &(operation_l_and ); |
---|
169 | if (_param->_timing[TYPE_ALU ][OPERATION_ALU_L_OR ]._latence > 0) |
---|
170 | _function_execute[TYPE_ALU ][OPERATION_ALU_L_OR ] = &(operation_l_or ); |
---|
171 | if (_param->_timing[TYPE_ALU ][OPERATION_ALU_L_XOR ]._latence > 0) |
---|
172 | _function_execute[TYPE_ALU ][OPERATION_ALU_L_XOR ] = &(operation_l_xor ); |
---|
173 | if (_param->_timing[TYPE_SHIFT ][OPERATION_SHIFT_L_SLL ]._latence > 0) |
---|
174 | _function_execute[TYPE_SHIFT ][OPERATION_SHIFT_L_SLL ] = &(operation_l_sll ); |
---|
175 | if (_param->_timing[TYPE_SHIFT ][OPERATION_SHIFT_L_SRA ]._latence > 0) |
---|
176 | _function_execute[TYPE_SHIFT ][OPERATION_SHIFT_L_SRA ] = &(operation_l_sra ); |
---|
177 | if (_param->_timing[TYPE_SHIFT ][OPERATION_SHIFT_L_SRL ]._latence > 0) |
---|
178 | _function_execute[TYPE_SHIFT ][OPERATION_SHIFT_L_SRL ] = &(operation_l_srl ); |
---|
179 | if (_param->_timing[TYPE_SHIFT ][OPERATION_SHIFT_L_ROR ]._latence > 0) |
---|
180 | _function_execute[TYPE_SHIFT ][OPERATION_SHIFT_L_ROR ] = &(operation_l_ror ); |
---|
181 | if (_param->_timing[TYPE_MOVE ][OPERATION_MOVE_L_MOVHI ]._latence > 0) |
---|
182 | _function_execute[TYPE_MOVE ][OPERATION_MOVE_L_MOVHI ] = &(operation_l_movhi ); |
---|
183 | if (_param->_timing[TYPE_MOVE ][OPERATION_MOVE_L_CMOV ]._latence > 0) |
---|
184 | _function_execute[TYPE_MOVE ][OPERATION_MOVE_L_CMOV ] = &(operation_l_cmov ); |
---|
185 | if (_param->_timing[TYPE_TEST ][OPERATION_TEST_L_SFGEU ]._latence > 0) |
---|
186 | _function_execute[TYPE_TEST ][OPERATION_TEST_L_SFGEU ] = &(operation_l_sfgeu ); |
---|
187 | if (_param->_timing[TYPE_TEST ][OPERATION_TEST_L_SFGTU ]._latence > 0) |
---|
188 | _function_execute[TYPE_TEST ][OPERATION_TEST_L_SFGTU ] = &(operation_l_sfgtu ); |
---|
189 | if (_param->_timing[TYPE_TEST ][OPERATION_TEST_L_SFLEU ]._latence > 0) |
---|
190 | _function_execute[TYPE_TEST ][OPERATION_TEST_L_SFLEU ] = &(operation_l_sfleu ); |
---|
191 | if (_param->_timing[TYPE_TEST ][OPERATION_TEST_L_SFLTU ]._latence > 0) |
---|
192 | _function_execute[TYPE_TEST ][OPERATION_TEST_L_SFLTU ] = &(operation_l_sfltu ); |
---|
193 | if (_param->_timing[TYPE_TEST ][OPERATION_TEST_L_SFGES ]._latence > 0) |
---|
194 | _function_execute[TYPE_TEST ][OPERATION_TEST_L_SFGES ] = &(operation_l_sfges ); |
---|
195 | if (_param->_timing[TYPE_TEST ][OPERATION_TEST_L_SFGTS ]._latence > 0) |
---|
196 | _function_execute[TYPE_TEST ][OPERATION_TEST_L_SFGTS ] = &(operation_l_sfgts ); |
---|
197 | if (_param->_timing[TYPE_TEST ][OPERATION_TEST_L_SFLES ]._latence > 0) |
---|
198 | _function_execute[TYPE_TEST ][OPERATION_TEST_L_SFLES ] = &(operation_l_sfles ); |
---|
199 | if (_param->_timing[TYPE_TEST ][OPERATION_TEST_L_SFLTS ]._latence > 0) |
---|
200 | _function_execute[TYPE_TEST ][OPERATION_TEST_L_SFLTS ] = &(operation_l_sflts ); |
---|
201 | if (_param->_timing[TYPE_TEST ][OPERATION_TEST_L_SFEQ ]._latence > 0) |
---|
202 | _function_execute[TYPE_TEST ][OPERATION_TEST_L_SFEQ ] = &(operation_l_sfeq ); |
---|
203 | if (_param->_timing[TYPE_TEST ][OPERATION_TEST_L_SFNE ]._latence > 0) |
---|
204 | _function_execute[TYPE_TEST ][OPERATION_TEST_L_SFNE ] = &(operation_l_sfne ); |
---|
205 | if (_param->_timing[TYPE_MUL ][OPERATION_MUL_L_MUL ]._latence > 0) |
---|
206 | _function_execute[TYPE_MUL ][OPERATION_MUL_L_MUL ] = &(operation_l_mul ); |
---|
207 | if (_param->_timing[TYPE_MUL ][OPERATION_MUL_L_MULU ]._latence > 0) |
---|
208 | _function_execute[TYPE_MUL ][OPERATION_MUL_L_MULU ] = &(operation_l_mulu ); |
---|
209 | if (_param->_timing[TYPE_DIV ][OPERATION_DIV_L_DIV ]._latence > 0) |
---|
210 | _function_execute[TYPE_DIV ][OPERATION_DIV_L_DIV ] = &(operation_l_div ); |
---|
211 | if (_param->_timing[TYPE_DIV ][OPERATION_DIV_L_DIVU ]._latence > 0) |
---|
212 | _function_execute[TYPE_DIV ][OPERATION_DIV_L_DIVU ] = &(operation_l_divu ); |
---|
213 | if (_param->_timing[TYPE_EXTEND ][OPERATION_EXTEND_L_EXTEND_S ]._latence > 0) |
---|
214 | _function_execute[TYPE_EXTEND ][OPERATION_EXTEND_L_EXTEND_S ] = &(operation_l_extend_s); |
---|
215 | if (_param->_timing[TYPE_EXTEND ][OPERATION_EXTEND_L_EXTEND_Z ]._latence > 0) |
---|
216 | _function_execute[TYPE_EXTEND ][OPERATION_EXTEND_L_EXTEND_Z ] = &(operation_l_extend_z); |
---|
217 | if (_param->_timing[TYPE_FIND ][OPERATION_FIND_L_FF1 ]._latence > 0) |
---|
218 | _function_execute[TYPE_FIND ][OPERATION_FIND_L_FF1 ] = &(operation_l_ff1 ); |
---|
219 | if (_param->_timing[TYPE_FIND ][OPERATION_FIND_L_FL1 ]._latence > 0) |
---|
220 | _function_execute[TYPE_FIND ][OPERATION_FIND_L_FL1 ] = &(operation_l_fl1 ); |
---|
221 | if (_param->_timing[TYPE_SPECIAL][OPERATION_SPECIAL_L_MFSPR ]._latence > 0) |
---|
222 | _function_execute[TYPE_SPECIAL][OPERATION_SPECIAL_L_MFSPR ] = &(operation_l_mfspr ); |
---|
223 | if (_param->_timing[TYPE_SPECIAL][OPERATION_SPECIAL_L_MTSPR ]._latence > 0) |
---|
224 | _function_execute[TYPE_SPECIAL][OPERATION_SPECIAL_L_MTSPR ] = &(operation_l_mtspr ); |
---|
225 | if (_param->_timing[TYPE_SPECIAL][OPERATION_SPECIAL_L_MAC ]._latence > 0) |
---|
226 | _function_execute[TYPE_SPECIAL][OPERATION_SPECIAL_L_MAC ] = &(operation_l_mac ); |
---|
227 | if (_param->_timing[TYPE_SPECIAL][OPERATION_SPECIAL_L_MACRC ]._latence > 0) |
---|
228 | _function_execute[TYPE_SPECIAL][OPERATION_SPECIAL_L_MACRC ] = &(operation_l_macrc ); |
---|
229 | if (_param->_timing[TYPE_SPECIAL][OPERATION_SPECIAL_L_MSB ]._latence > 0) |
---|
230 | _function_execute[TYPE_SPECIAL][OPERATION_SPECIAL_L_MSB ] = &(operation_l_msb ); |
---|
231 | if (_param->_timing[TYPE_BRANCH ][OPERATION_BRANCH_L_TEST_F ]._latence > 0) |
---|
232 | _function_execute[TYPE_BRANCH ][OPERATION_BRANCH_L_TEST_F ] = &(operation_l_test_f ); |
---|
233 | if (_param->_timing[TYPE_BRANCH ][OPERATION_BRANCH_L_TEST_NF ]._latence > 0) |
---|
234 | _function_execute[TYPE_BRANCH ][OPERATION_BRANCH_L_TEST_NF ] = &(operation_l_test_nf ); |
---|
235 | if (_param->_timing[TYPE_BRANCH ][OPERATION_BRANCH_L_JALR ]._latence > 0) |
---|
236 | _function_execute[TYPE_BRANCH ][OPERATION_BRANCH_L_JALR ] = &(operation_l_jalr ); |
---|
237 | } |
---|
238 | |
---|
239 | #ifdef POSITION |
---|
240 | if (usage_is_set(_usage,USE_POSITION)) |
---|
241 | _component->generate_file(); |
---|
242 | #endif |
---|
243 | |
---|
244 | log_printf(FUNC,Functionnal_unit,FUNCTION,"End"); |
---|
245 | }; |
---|
246 | |
---|
247 | }; // end namespace functionnal_unit |
---|
248 | }; // end namespace execute_unit |
---|
249 | }; // end namespace multi_execute_unit |
---|
250 | }; // end namespace execute_loop |
---|
251 | }; // end namespace multi_execute_loop |
---|
252 | }; // end namespace core |
---|
253 | |
---|
254 | }; // end namespace behavioural |
---|
255 | }; // end namespace morpheo |
---|