1 | /* |
---|
2 | * $Id$ |
---|
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 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace core { |
---|
13 | namespace multi_execute_loop { |
---|
14 | namespace execute_loop { |
---|
15 | namespace multi_execute_unit { |
---|
16 | namespace execute_unit { |
---|
17 | namespace functionnal_unit { |
---|
18 | |
---|
19 | #undef FUNCTION |
---|
20 | #define FUNCTION "Functionnal_unit::allocation" |
---|
21 | void Functionnal_unit::allocation (void) |
---|
22 | { |
---|
23 | string rename; |
---|
24 | |
---|
25 | log_printf(FUNC,Functionnal_unit,FUNCTION,"Begin"); |
---|
26 | |
---|
27 | _component = new Component (_usage); |
---|
28 | |
---|
29 | Entity * entity = _component->set_entity (_name |
---|
30 | ,"Functionnal_unit" |
---|
31 | #ifdef POSITION |
---|
32 | ,COMBINATORY |
---|
33 | #endif |
---|
34 | ); |
---|
35 | |
---|
36 | _interfaces = entity->set_interfaces(); |
---|
37 | |
---|
38 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
39 | |
---|
40 | { |
---|
41 | Interface * interface = _interfaces->set_interface("" |
---|
42 | #ifdef POSITION |
---|
43 | ,IN |
---|
44 | ,SOUTH, |
---|
45 | "Generalist interface" |
---|
46 | #endif |
---|
47 | ); |
---|
48 | |
---|
49 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
50 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
51 | } |
---|
52 | // ~~~~~[ Interface : "execute_in" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
53 | |
---|
54 | { |
---|
55 | Interface_fifo * interface = _interfaces->set_interface("execute_in" |
---|
56 | #ifdef POSITION |
---|
57 | ,IN |
---|
58 | ,WEST, |
---|
59 | "Input of Functionnal Unit" |
---|
60 | #endif |
---|
61 | ); |
---|
62 | |
---|
63 | in_EXECUTE_IN_VAL = interface->set_signal_valack_in (VAL); |
---|
64 | out_EXECUTE_IN_ACK = interface->set_signal_valack_out (ACK); |
---|
65 | if (_param->_have_port_context_id) |
---|
66 | in_EXECUTE_IN_CONTEXT_ID = interface->set_signal_in <Tcontext_t > ("context_id" , _param->_size_context_id ); |
---|
67 | if (_param->_have_port_front_end_id) |
---|
68 | in_EXECUTE_IN_FRONT_END_ID = interface->set_signal_in <Tcontext_t > ("front_end_id" , _param->_size_front_end_id ); |
---|
69 | if (_param->_have_port_ooo_engine_id) |
---|
70 | in_EXECUTE_IN_OOO_ENGINE_ID = interface->set_signal_in <Tcontext_t > ("ooo_engine_id", _param->_size_ooo_engine_id); |
---|
71 | if (_param->_have_port_packet_id) |
---|
72 | in_EXECUTE_IN_PACKET_ID = interface->set_signal_in <Tpacket_t > ("packet_id" , _param->_size_packet_id ); |
---|
73 | in_EXECUTE_IN_OPERATION = interface->set_signal_in <Toperation_t > ("operation" , _param->_size_operation ); |
---|
74 | in_EXECUTE_IN_TYPE = interface->set_signal_in <Ttype_t > ("type" , _param->_size_type ); |
---|
75 | in_EXECUTE_IN_HAS_IMMEDIAT = interface->set_signal_in <Tcontrol_t > ("has_immediat" , 1); |
---|
76 | in_EXECUTE_IN_IMMEDIAT = interface->set_signal_in <Tgeneral_data_t > ("immediat" , _param->_size_general_data); |
---|
77 | in_EXECUTE_IN_DATA_RA = interface->set_signal_in <Tgeneral_data_t > ("data_ra" , _param->_size_general_data); |
---|
78 | in_EXECUTE_IN_DATA_RB = interface->set_signal_in <Tgeneral_data_t > ("data_rb" , _param->_size_general_data); |
---|
79 | in_EXECUTE_IN_DATA_RC = interface->set_signal_in <Tspecial_data_t > ("data_rc" , _param->_size_special_data); |
---|
80 | in_EXECUTE_IN_WRITE_RD = interface->set_signal_in <Tcontrol_t > ("write_rd" , 1); |
---|
81 | in_EXECUTE_IN_NUM_REG_RD = interface->set_signal_in <Tgeneral_address_t> ("num_reg_rd" , _param->_size_general_register); |
---|
82 | in_EXECUTE_IN_WRITE_RE = interface->set_signal_in <Tcontrol_t > ("write_re" , 1); |
---|
83 | in_EXECUTE_IN_NUM_REG_RE = interface->set_signal_in <Tspecial_address_t> ("num_reg_re" , _param->_size_special_register); |
---|
84 | } |
---|
85 | // ~~~~~[ Interface : "execute_out" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
86 | { |
---|
87 | Interface_fifo * interface = _interfaces->set_interface("execute_out" |
---|
88 | #ifdef POSITION |
---|
89 | ,IN |
---|
90 | ,EAST, |
---|
91 | "Output of Functionnal Unit" |
---|
92 | #endif |
---|
93 | ); |
---|
94 | |
---|
95 | out_EXECUTE_OUT_VAL = interface->set_signal_valack_out (VAL); |
---|
96 | in_EXECUTE_OUT_ACK = interface->set_signal_valack_in (ACK); |
---|
97 | if (_param->_have_port_context_id) |
---|
98 | out_EXECUTE_OUT_CONTEXT_ID = interface->set_signal_out<Tcontext_t > ("context_id" ,_param->_size_context_id ); |
---|
99 | if (_param->_have_port_front_end_id) |
---|
100 | out_EXECUTE_OUT_FRONT_END_ID = interface->set_signal_out<Tcontext_t > ("front_end_id" ,_param->_size_front_end_id ); |
---|
101 | if (_param->_have_port_ooo_engine_id) |
---|
102 | out_EXECUTE_OUT_OOO_ENGINE_ID = interface->set_signal_out<Tcontext_t > ("ooo_engine_id",_param->_size_ooo_engine_id); |
---|
103 | if (_param->_have_port_packet_id) |
---|
104 | out_EXECUTE_OUT_PACKET_ID = interface->set_signal_out<Tpacket_t > ("packet_id" ,_param->_size_packet_id ); |
---|
105 | //out_EXECUTE_OUT_OPERATION = interface->set_signal_out<Toperation_t > ("operation" ,_param->_size_operation ); |
---|
106 | //out_EXECUTE_OUT_TYPE = interface->set_signal_out<Ttype_t > ("type" ,_param->_size_type ); |
---|
107 | out_EXECUTE_OUT_WRITE_RD = interface->set_signal_out<Tcontrol_t > ("write_rd" ,1); |
---|
108 | out_EXECUTE_OUT_NUM_REG_RD = interface->set_signal_out<Tgeneral_address_t> ("num_reg_rd" ,_param->_size_general_register); |
---|
109 | out_EXECUTE_OUT_DATA_RD = interface->set_signal_out<Tgeneral_data_t > ("data_rd" ,_param->_size_general_data); |
---|
110 | out_EXECUTE_OUT_WRITE_RE = interface->set_signal_out<Tcontrol_t > ("write_re" ,1); |
---|
111 | out_EXECUTE_OUT_NUM_REG_RE = interface->set_signal_out<Tspecial_address_t> ("num_reg_re" ,_param->_size_special_register); |
---|
112 | out_EXECUTE_OUT_DATA_RE = interface->set_signal_out<Tspecial_data_t > ("data_re" ,_param->_size_special_data); |
---|
113 | out_EXECUTE_OUT_EXCEPTION = interface->set_signal_out<Texception_t > ("exception" ,_param->_size_exception); |
---|
114 | out_EXECUTE_OUT_NO_SEQUENCE = interface->set_signal_out<Tcontrol_t > ("no_sequence" ,1); |
---|
115 | out_EXECUTE_OUT_ADDRESS = interface->set_signal_out<Tgeneral_data_t > ("address " ,_param->_size_general_data); |
---|
116 | } |
---|
117 | |
---|
118 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
119 | _execute_operation = new execute_operation_t; |
---|
120 | _execute_param = new execute_param_t(_param->_size_general_data, |
---|
121 | _param->_timing); |
---|
122 | |
---|
123 | _execute_register = new execute_register_t *** [_param->_nb_context]; |
---|
124 | |
---|
125 | for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
126 | { |
---|
127 | _execute_register [i] = new execute_register_t ** [_param->_nb_front_end]; |
---|
128 | |
---|
129 | for (uint32_t j=0; j<_param->_nb_front_end; j++) |
---|
130 | { |
---|
131 | _execute_register [i][j] = new execute_register_t * [_param->_nb_ooo_engine]; |
---|
132 | |
---|
133 | for (uint32_t k=0; k<_param->_nb_ooo_engine; k++) |
---|
134 | { |
---|
135 | uint32_t num_thread = get_num_thread(i,_param->_size_context_id, |
---|
136 | j,_param->_size_front_end_id, |
---|
137 | k,_param->_size_ooo_engine_id); |
---|
138 | |
---|
139 | _execute_register [i][j][k] = new execute_register_t; |
---|
140 | |
---|
141 | if (_param->_have_groupe_MAC) |
---|
142 | _execute_register[i][j][k]->implement_group(GROUP_MAC); |
---|
143 | |
---|
144 | for (uint32_t x=GROUP_CUSTOM_1; x<GROUP_CUSTOM_8; x++) |
---|
145 | if ((_param->_get_custom_information(num_thread))._get_valid_group(x) == true) |
---|
146 | { |
---|
147 | uint32_t nb_reg = (_param->_get_custom_information(num_thread))._get_nb_register(x); |
---|
148 | _execute_register[i][j][k]->implement_group(x,nb_reg); |
---|
149 | |
---|
150 | for (uint32_t y=0; y<nb_reg; y++) |
---|
151 | _execute_register[i][j][k]->_spr_access_mode->change_mode(x,y,(_param->_get_custom_information(num_thread))._get_access_mode(x,y)); |
---|
152 | } |
---|
153 | } |
---|
154 | } |
---|
155 | } |
---|
156 | |
---|
157 | _function_execute = new function_execute_t * [MAX_OPERATION]; |
---|
158 | |
---|
159 | // Initialisation |
---|
160 | for (uint32_t i=0; i<MAX_OPERATION; i++) |
---|
161 | _function_execute [i] = &(operation_unimplemented); |
---|
162 | |
---|
163 | if (_param->_timing[OPERATION_ALU_L_ADD ]._latence > 0) _function_execute[OPERATION_ALU_L_ADD ] = &(operation_l_add ); |
---|
164 | if (_param->_timing[OPERATION_ALU_L_ADDC ]._latence > 0) _function_execute[OPERATION_ALU_L_ADDC ] = &(operation_l_addc ); |
---|
165 | if (_param->_timing[OPERATION_ALU_L_SUB ]._latence > 0) _function_execute[OPERATION_ALU_L_SUB ] = &(operation_l_sub ); |
---|
166 | // if (_param->_timing[OPERATION_ALU_L_MUL ]._latence > 0) _function_execute[OPERATION_ALU_L_MUL ] = &(operation_l_mul ); |
---|
167 | // if (_param->_timing[OPERATION_ALU_L_MULU ]._latence > 0) _function_execute[OPERATION_ALU_L_MULU ] = &(operation_l_mulu ); |
---|
168 | // if (_param->_timing[OPERATION_ALU_L_DIV ]._latence > 0) _function_execute[OPERATION_ALU_L_DIV ] = &(operation_l_div ); |
---|
169 | // if (_param->_timing[OPERATION_ALU_L_DIVU ]._latence > 0) _function_execute[OPERATION_ALU_L_DIVU ] = &(operation_l_divu ); |
---|
170 | if (_param->_timing[OPERATION_ALU_L_AND ]._latence > 0) _function_execute[OPERATION_ALU_L_AND ] = &(operation_l_and ); |
---|
171 | if (_param->_timing[OPERATION_ALU_L_OR ]._latence > 0) _function_execute[OPERATION_ALU_L_OR ] = &(operation_l_or ); |
---|
172 | if (_param->_timing[OPERATION_ALU_L_XOR ]._latence > 0) _function_execute[OPERATION_ALU_L_XOR ] = &(operation_l_xor ); |
---|
173 | if (_param->_timing[OPERATION_ALU_L_TEST_F ]._latence > 0) _function_execute[OPERATION_ALU_L_TEST_F ] = &(operation_l_test_f ); |
---|
174 | if (_param->_timing[OPERATION_ALU_L_TEST_NF ]._latence > 0) _function_execute[OPERATION_ALU_L_TEST_NF ] = &(operation_l_test_nf ); |
---|
175 | if (_param->_timing[OPERATION_ALU_L_JALR ]._latence > 0) _function_execute[OPERATION_ALU_L_JALR ] = &(operation_l_jalr ); |
---|
176 | if (_param->_timing[OPERATION_ALU_L_SLL ]._latence > 0) _function_execute[OPERATION_ALU_L_SLL ] = &(operation_l_sll ); |
---|
177 | if (_param->_timing[OPERATION_ALU_L_SRA ]._latence > 0) _function_execute[OPERATION_ALU_L_SRA ] = &(operation_l_sra ); |
---|
178 | if (_param->_timing[OPERATION_ALU_L_SRL ]._latence > 0) _function_execute[OPERATION_ALU_L_SRL ] = &(operation_l_srl ); |
---|
179 | if (_param->_timing[OPERATION_ALU_L_ROR ]._latence > 0) _function_execute[OPERATION_ALU_L_ROR ] = &(operation_l_ror ); |
---|
180 | if (_param->_timing[OPERATION_ALU_L_MOVHI ]._latence > 0) _function_execute[OPERATION_ALU_L_MOVHI ] = &(operation_l_movhi ); |
---|
181 | if (_param->_timing[OPERATION_ALU_L_EXTEND_S]._latence > 0) _function_execute[OPERATION_ALU_L_EXTEND_S] = &(operation_l_extend_s); |
---|
182 | if (_param->_timing[OPERATION_ALU_L_EXTEND_Z]._latence > 0) _function_execute[OPERATION_ALU_L_EXTEND_Z] = &(operation_l_extend_z); |
---|
183 | if (_param->_timing[OPERATION_ALU_L_CMOV ]._latence > 0) _function_execute[OPERATION_ALU_L_CMOV ] = &(operation_l_cmov ); |
---|
184 | if (_param->_timing[OPERATION_ALU_L_FF1 ]._latence > 0) _function_execute[OPERATION_ALU_L_FF1 ] = &(operation_l_ff1 ); |
---|
185 | if (_param->_timing[OPERATION_ALU_L_FL1 ]._latence > 0) _function_execute[OPERATION_ALU_L_FL1 ] = &(operation_l_fl1 ); |
---|
186 | if (_param->_timing[OPERATION_ALU_L_MFSPR ]._latence > 0) _function_execute[OPERATION_ALU_L_MFSPR ] = &(operation_l_mfspr ); |
---|
187 | if (_param->_timing[OPERATION_ALU_L_MTSPR ]._latence > 0) _function_execute[OPERATION_ALU_L_MTSPR ] = &(operation_l_mtspr ); |
---|
188 | if (_param->_timing[OPERATION_ALU_L_SFEQ ]._latence > 0) _function_execute[OPERATION_ALU_L_SFEQ ] = &(operation_l_sfeq ); |
---|
189 | if (_param->_timing[OPERATION_ALU_L_SFNE ]._latence > 0) _function_execute[OPERATION_ALU_L_SFNE ] = &(operation_l_sfne ); |
---|
190 | if (_param->_timing[OPERATION_ALU_L_SFGEU ]._latence > 0) _function_execute[OPERATION_ALU_L_SFGEU ] = &(operation_l_sfgeu ); |
---|
191 | if (_param->_timing[OPERATION_ALU_L_SFGTU ]._latence > 0) _function_execute[OPERATION_ALU_L_SFGTU ] = &(operation_l_sfgtu ); |
---|
192 | if (_param->_timing[OPERATION_ALU_L_SFLEU ]._latence > 0) _function_execute[OPERATION_ALU_L_SFLEU ] = &(operation_l_sfleu ); |
---|
193 | if (_param->_timing[OPERATION_ALU_L_SFLTU ]._latence > 0) _function_execute[OPERATION_ALU_L_SFLTU ] = &(operation_l_sfltu ); |
---|
194 | if (_param->_timing[OPERATION_ALU_L_SFGES ]._latence > 0) _function_execute[OPERATION_ALU_L_SFGES ] = &(operation_l_sfges ); |
---|
195 | if (_param->_timing[OPERATION_ALU_L_SFGTS ]._latence > 0) _function_execute[OPERATION_ALU_L_SFGTS ] = &(operation_l_sfgts ); |
---|
196 | if (_param->_timing[OPERATION_ALU_L_SFLES ]._latence > 0) _function_execute[OPERATION_ALU_L_SFLES ] = &(operation_l_sfles ); |
---|
197 | if (_param->_timing[OPERATION_ALU_L_SFLTS ]._latence > 0) _function_execute[OPERATION_ALU_L_SFLTS ] = &(operation_l_sflts ); |
---|
198 | if (_param->_timing[OPERATION_ALU_L_MAC ]._latence > 0) _function_execute[OPERATION_ALU_L_MAC ] = &(operation_l_mac ); |
---|
199 | if (_param->_timing[OPERATION_ALU_L_MACRC ]._latence > 0) _function_execute[OPERATION_ALU_L_MACRC ] = &(operation_l_macrc ); |
---|
200 | if (_param->_timing[OPERATION_ALU_L_MSB ]._latence > 0) _function_execute[OPERATION_ALU_L_MSB ] = &(operation_l_msb ); |
---|
201 | |
---|
202 | |
---|
203 | #ifdef POSITION |
---|
204 | _component->generate_file(); |
---|
205 | #endif |
---|
206 | |
---|
207 | log_printf(FUNC,Functionnal_unit,FUNCTION,"End"); |
---|
208 | }; |
---|
209 | |
---|
210 | }; // end namespace functionnal_unit |
---|
211 | }; // end namespace execute_unit |
---|
212 | }; // end namespace multi_execute_unit |
---|
213 | }; // end namespace execute_loop |
---|
214 | }; // end namespace multi_execute_loop |
---|
215 | }; // end namespace core |
---|
216 | |
---|
217 | }; // end namespace behavioural |
---|
218 | }; // end namespace morpheo |
---|