source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/src/Functionnal_unit_allocation.cpp @ 122

Last change on this file since 122 was 122, checked in by rosiere, 15 years ago

Modif for performance :
1) Load Store Unit : store send request to valid exeception
2) Commit_unit : retire can bypass store
3) Commit_unit : add stat to manage store instruction
4) Load Store Unit and Load Store Pointer Manager : add store_queue_ptr_read
5) Fix lot of bug

  • Property svn:keywords set to Id
File size: 15.1 KB
Line 
1/*
2 * $Id: Functionnal_unit_allocation.cpp 122 2009-06-03 08:15:51Z 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
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_execute_loop {
15namespace execute_loop {
16namespace multi_execute_unit {
17namespace execute_unit {
18namespace 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_STORE_QUEUE_PTR_WRITE ,"store_queue_ptr_write",Tlsq_ptr_t        ,_param->_size_store_queue_ptr);
65      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_STORE_QUEUE_PTR_READ  ,"store_queue_ptr_read" ,Tlsq_ptr_t        ,_param->_size_store_queue_ptr);
66      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_STORE_QUEUE_EMPTY     ,"store_queue_empty"    ,Tcontrol_t        , 1);
67      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_LOAD_QUEUE_PTR_WRITE  ,"load_queue_ptr_write" ,Tlsq_ptr_t        ,_param->_size_load_queue_ptr);
68      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_HAS_IMMEDIAT          ,"has_immediat"         ,Tcontrol_t        , 1);
69      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_IMMEDIAT              ,"immediat"             ,Tgeneral_data_t   , _param->_size_general_data);
70      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_DATA_RA               ,"data_ra"              ,Tgeneral_data_t   , _param->_size_general_data);
71      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_DATA_RB               ,"data_rb"              ,Tgeneral_data_t   , _param->_size_general_data);
72      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_DATA_RC               ,"data_rc"              ,Tspecial_data_t   , _param->_size_special_data);
73      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_WRITE_RD              ,"write_rd"             ,Tcontrol_t        , 1);
74      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_NUM_REG_RD            ,"num_reg_rd"           ,Tgeneral_address_t, _param->_size_general_register);
75      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_WRITE_RE              ,"write_re"             ,Tcontrol_t        , 1);
76      ALLOC0_SIGNAL_IN ( in_EXECUTE_IN_NUM_REG_RE            ,"num_reg_re"           ,Tspecial_address_t, _param->_size_special_register);
77
78      ALLOC0_INTERFACE_END();
79     }
80    // ~~~~~[ Interface : "execute_out" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     
81     {
82       ALLOC0_INTERFACE_BEGIN("execute_out",IN,EAST,"Output of Functionnal Unit");
83
84       ALLOC0_VALACK_OUT(out_EXECUTE_OUT_VAL            ,VAL);
85       ALLOC0_VALACK_IN ( in_EXECUTE_OUT_ACK            ,ACK);
86       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_CONTEXT_ID     ,"context_id"   ,Tcontext_t        ,_param->_size_context_id   );
87       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_FRONT_END_ID   ,"front_end_id" ,Tcontext_t        ,_param->_size_front_end_id );
88       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_OOO_ENGINE_ID  ,"ooo_engine_id",Tcontext_t        ,_param->_size_ooo_engine_id);
89       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_PACKET_ID      ,"packet_id"    ,Tpacket_t         ,_param->_size_rob_ptr    );
90     //ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_OPERATION      ,"operation"    ,Toperation_t      ,_param->_size_operation    );
91     //ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_TYPE           ,"type"         ,Ttype_t           ,_param->_size_type         );
92       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_WRITE_RD       ,"write_rd"     ,Tcontrol_t        ,1);
93       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_NUM_REG_RD     ,"num_reg_rd"   ,Tgeneral_address_t,_param->_size_general_register);
94       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_DATA_RD        ,"data_rd"      ,Tgeneral_data_t   ,_param->_size_general_data);
95       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_WRITE_RE       ,"write_re"     ,Tcontrol_t        ,1);
96       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_NUM_REG_RE     ,"num_reg_re"   ,Tspecial_address_t,_param->_size_special_register);
97       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_DATA_RE        ,"data_re"      ,Tspecial_data_t   ,_param->_size_special_data);
98       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_EXCEPTION      ,"exception"    ,Texception_t      ,_param->_size_exception);
99       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_NO_SEQUENCE    ,"no_sequence"  ,Tcontrol_t        ,1);
100       ALLOC0_SIGNAL_OUT(out_EXECUTE_OUT_ADDRESS        ,"address"      ,Taddress_t        ,_param->_size_instruction_address);
101
102       ALLOC0_INTERFACE_END();
103     }
104
105     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106     if (usage_is_set(_usage,USE_SYSTEMC))
107       {
108     if (_param->_have_pipeline_in)
109     _execute_operation_in  = new execute_operation_t;
110     _execute_operation_out = new execute_operation_t;
111     _execute_param         = new execute_param_t(_param->_size_general_data,
112                                                  _param->_timing);
113
114     _execute_register = new execute_register_t *** [_param->_nb_context];
115
116     for (uint32_t i=0; i<_param->_nb_context; i++)
117       {
118         _execute_register [i] = new execute_register_t ** [_param->_nb_front_end];
119         
120         for (uint32_t j=0; j<_param->_nb_front_end; j++)
121           {
122             _execute_register [i][j] = new execute_register_t * [_param->_nb_ooo_engine];
123             
124             for (uint32_t k=0; k<_param->_nb_ooo_engine; k++)
125               {
126//               uint32_t num_thread = get_num_thread(i,_param->_size_context_id,
127//                                                    j,_param->_size_front_end_id,
128//                                                    k,_param->_size_ooo_engine_id);
129
130                 _execute_register [i][j][k] = new execute_register_t;
131                 
132                 if (_param->_have_groupe_MAC)
133                   _execute_register[i][j][k]->implement_group(GROUP_MAC);
134
135                 for (uint32_t x=GROUP_CUSTOM_1; x<GROUP_CUSTOM_8; x++)
136                   if ((_param->_get_custom_information())._get_valid_group(x) == true)
137                     {
138                       uint32_t nb_reg = (_param->_get_custom_information())._get_nb_register(x);
139                       _execute_register[i][j][k]->implement_group(x,nb_reg);
140
141                       for (uint32_t y=0; y<nb_reg; y++)
142                         _execute_register[i][j][k]->_spr_access_mode->change_mode(x,y,(_param->_get_custom_information())._get_access_mode(x,y));
143                     }
144               }
145           }
146       }
147
148     _function_execute = new function_execute_t ** [_param->_nb_type];
149     
150     // Initialisation
151     for (uint32_t i=0; i<_param->_nb_type; i++)
152       {
153         _function_execute [i] = new function_execute_t * [_param->_nb_operation];
154         
155         for (uint32_t j=0; j<_param->_nb_operation; j++)
156           _function_execute [i][j] = &(operation_unimplemented);
157       }
158
159     if (_param->_timing[TYPE_ALU    ][OPERATION_ALU_L_ADD         ]._latence > 0)
160       _function_execute[TYPE_ALU    ][OPERATION_ALU_L_ADD         ] = &(operation_l_add     );
161     if (_param->_timing[TYPE_ALU    ][OPERATION_ALU_L_ADDC        ]._latence > 0) 
162       _function_execute[TYPE_ALU    ][OPERATION_ALU_L_ADDC        ] = &(operation_l_addc    );
163     if (_param->_timing[TYPE_ALU    ][OPERATION_ALU_L_SUB         ]._latence > 0) 
164       _function_execute[TYPE_ALU    ][OPERATION_ALU_L_SUB         ] = &(operation_l_sub     );
165     if (_param->_timing[TYPE_ALU    ][OPERATION_ALU_L_AND         ]._latence > 0) 
166       _function_execute[TYPE_ALU    ][OPERATION_ALU_L_AND         ] = &(operation_l_and     );
167     if (_param->_timing[TYPE_ALU    ][OPERATION_ALU_L_OR          ]._latence > 0) 
168       _function_execute[TYPE_ALU    ][OPERATION_ALU_L_OR          ] = &(operation_l_or      );
169     if (_param->_timing[TYPE_ALU    ][OPERATION_ALU_L_XOR         ]._latence > 0) 
170       _function_execute[TYPE_ALU    ][OPERATION_ALU_L_XOR         ] = &(operation_l_xor     );
171     if (_param->_timing[TYPE_SHIFT  ][OPERATION_SHIFT_L_SLL       ]._latence > 0) 
172       _function_execute[TYPE_SHIFT  ][OPERATION_SHIFT_L_SLL       ] = &(operation_l_sll     );
173     if (_param->_timing[TYPE_SHIFT  ][OPERATION_SHIFT_L_SRA       ]._latence > 0) 
174       _function_execute[TYPE_SHIFT  ][OPERATION_SHIFT_L_SRA       ] = &(operation_l_sra     );
175     if (_param->_timing[TYPE_SHIFT  ][OPERATION_SHIFT_L_SRL       ]._latence > 0) 
176       _function_execute[TYPE_SHIFT  ][OPERATION_SHIFT_L_SRL       ] = &(operation_l_srl     );
177     if (_param->_timing[TYPE_SHIFT  ][OPERATION_SHIFT_L_ROR       ]._latence > 0) 
178       _function_execute[TYPE_SHIFT  ][OPERATION_SHIFT_L_ROR       ] = &(operation_l_ror     );
179     if (_param->_timing[TYPE_MOVE   ][OPERATION_MOVE_L_MOVHI      ]._latence > 0) 
180       _function_execute[TYPE_MOVE   ][OPERATION_MOVE_L_MOVHI      ] = &(operation_l_movhi   );
181     if (_param->_timing[TYPE_MOVE   ][OPERATION_MOVE_L_CMOV       ]._latence > 0) 
182       _function_execute[TYPE_MOVE   ][OPERATION_MOVE_L_CMOV       ] = &(operation_l_cmov    ); 
183     if (_param->_timing[TYPE_TEST   ][OPERATION_TEST_L_SFGEU      ]._latence > 0) 
184       _function_execute[TYPE_TEST   ][OPERATION_TEST_L_SFGEU      ] = &(operation_l_sfgeu   );
185     if (_param->_timing[TYPE_TEST   ][OPERATION_TEST_L_SFGTU      ]._latence > 0) 
186       _function_execute[TYPE_TEST   ][OPERATION_TEST_L_SFGTU      ] = &(operation_l_sfgtu   );
187     if (_param->_timing[TYPE_TEST   ][OPERATION_TEST_L_SFLEU      ]._latence > 0) 
188       _function_execute[TYPE_TEST   ][OPERATION_TEST_L_SFLEU      ] = &(operation_l_sfleu   );
189     if (_param->_timing[TYPE_TEST   ][OPERATION_TEST_L_SFLTU      ]._latence > 0) 
190       _function_execute[TYPE_TEST   ][OPERATION_TEST_L_SFLTU      ] = &(operation_l_sfltu   );
191     if (_param->_timing[TYPE_TEST   ][OPERATION_TEST_L_SFGES      ]._latence > 0) 
192       _function_execute[TYPE_TEST   ][OPERATION_TEST_L_SFGES      ] = &(operation_l_sfges   );
193     if (_param->_timing[TYPE_TEST   ][OPERATION_TEST_L_SFGTS      ]._latence > 0) 
194       _function_execute[TYPE_TEST   ][OPERATION_TEST_L_SFGTS      ] = &(operation_l_sfgts   );
195     if (_param->_timing[TYPE_TEST   ][OPERATION_TEST_L_SFLES      ]._latence > 0) 
196       _function_execute[TYPE_TEST   ][OPERATION_TEST_L_SFLES      ] = &(operation_l_sfles   );
197     if (_param->_timing[TYPE_TEST   ][OPERATION_TEST_L_SFLTS      ]._latence > 0) 
198       _function_execute[TYPE_TEST   ][OPERATION_TEST_L_SFLTS      ] = &(operation_l_sflts   );
199     if (_param->_timing[TYPE_TEST   ][OPERATION_TEST_L_SFEQ       ]._latence > 0) 
200       _function_execute[TYPE_TEST   ][OPERATION_TEST_L_SFEQ       ] = &(operation_l_sfeq    );
201     if (_param->_timing[TYPE_TEST   ][OPERATION_TEST_L_SFNE       ]._latence > 0) 
202       _function_execute[TYPE_TEST   ][OPERATION_TEST_L_SFNE       ] = &(operation_l_sfne    );
203     if (_param->_timing[TYPE_MUL    ][OPERATION_MUL_L_MUL         ]._latence > 0) 
204       _function_execute[TYPE_MUL    ][OPERATION_MUL_L_MUL         ] = &(operation_l_mul     );
205     if (_param->_timing[TYPE_MUL    ][OPERATION_MUL_L_MULU        ]._latence > 0) 
206       _function_execute[TYPE_MUL    ][OPERATION_MUL_L_MULU        ] = &(operation_l_mulu    );
207     if (_param->_timing[TYPE_DIV    ][OPERATION_DIV_L_DIV         ]._latence > 0) 
208       _function_execute[TYPE_DIV    ][OPERATION_DIV_L_DIV         ] = &(operation_l_div     );
209     if (_param->_timing[TYPE_DIV    ][OPERATION_DIV_L_DIVU        ]._latence > 0) 
210       _function_execute[TYPE_DIV    ][OPERATION_DIV_L_DIVU        ] = &(operation_l_divu    );
211     if (_param->_timing[TYPE_EXTEND ][OPERATION_EXTEND_L_EXTEND_S ]._latence > 0) 
212       _function_execute[TYPE_EXTEND ][OPERATION_EXTEND_L_EXTEND_S ] = &(operation_l_extend_s);
213     if (_param->_timing[TYPE_EXTEND ][OPERATION_EXTEND_L_EXTEND_Z ]._latence > 0) 
214       _function_execute[TYPE_EXTEND ][OPERATION_EXTEND_L_EXTEND_Z ] = &(operation_l_extend_z);
215     if (_param->_timing[TYPE_FIND   ][OPERATION_FIND_L_FF1        ]._latence > 0) 
216       _function_execute[TYPE_FIND   ][OPERATION_FIND_L_FF1        ] = &(operation_l_ff1     ); 
217     if (_param->_timing[TYPE_FIND   ][OPERATION_FIND_L_FL1        ]._latence > 0) 
218       _function_execute[TYPE_FIND   ][OPERATION_FIND_L_FL1        ] = &(operation_l_fl1     ); 
219     if (_param->_timing[TYPE_SPECIAL][OPERATION_SPECIAL_L_MFSPR   ]._latence > 0) 
220       _function_execute[TYPE_SPECIAL][OPERATION_SPECIAL_L_MFSPR   ] = &(operation_l_mfspr   ); 
221     if (_param->_timing[TYPE_SPECIAL][OPERATION_SPECIAL_L_MTSPR   ]._latence > 0) 
222       _function_execute[TYPE_SPECIAL][OPERATION_SPECIAL_L_MTSPR   ] = &(operation_l_mtspr   ); 
223     if (_param->_timing[TYPE_SPECIAL][OPERATION_SPECIAL_L_MAC     ]._latence > 0) 
224       _function_execute[TYPE_SPECIAL][OPERATION_SPECIAL_L_MAC     ] = &(operation_l_mac     ); 
225     if (_param->_timing[TYPE_SPECIAL][OPERATION_SPECIAL_L_MACRC   ]._latence > 0) 
226       _function_execute[TYPE_SPECIAL][OPERATION_SPECIAL_L_MACRC   ] = &(operation_l_macrc   ); 
227     if (_param->_timing[TYPE_SPECIAL][OPERATION_SPECIAL_L_MSB     ]._latence > 0) 
228       _function_execute[TYPE_SPECIAL][OPERATION_SPECIAL_L_MSB     ] = &(operation_l_msb     ); 
229     if (_param->_timing[TYPE_BRANCH ][OPERATION_BRANCH_L_TEST_F   ]._latence > 0) 
230       _function_execute[TYPE_BRANCH ][OPERATION_BRANCH_L_TEST_F   ] = &(operation_l_test_f  );
231     if (_param->_timing[TYPE_BRANCH ][OPERATION_BRANCH_L_TEST_NF  ]._latence > 0) 
232       _function_execute[TYPE_BRANCH ][OPERATION_BRANCH_L_TEST_NF  ] = &(operation_l_test_nf );
233     if (_param->_timing[TYPE_BRANCH ][OPERATION_BRANCH_L_JALR     ]._latence > 0) 
234       _function_execute[TYPE_BRANCH ][OPERATION_BRANCH_L_JALR     ] = &(operation_l_jalr    );
235       }
236
237#ifdef POSITION
238     if (usage_is_set(_usage,USE_POSITION))
239       _component->generate_file();
240#endif
241
242    log_printf(FUNC,Functionnal_unit,FUNCTION,"End");
243  };
244
245}; // end namespace functionnal_unit
246}; // end namespace execute_unit
247}; // end namespace multi_execute_unit
248}; // end namespace execute_loop
249}; // end namespace multi_execute_loop
250}; // end namespace core
251
252}; // end namespace behavioural
253}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.