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 @ 72

Last change on this file since 72 was 72, checked in by rosiere, 16 years ago
  • SystemC de l'unite fonctionnelle.
  • gestion des groupes / instructions custom
File size: 13.2 KB
Line 
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
10namespace morpheo                    {
11namespace behavioural {
12namespace core {
13namespace multi_execute_loop {
14namespace execute_loop {
15namespace multi_execute_unit {
16namespace execute_unit {
17namespace 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 = 0;
136
137                 _execute_register [i][j][k] = new execute_register_t;
138                 
139                 if (_param->_have_groupe_MAC)
140                   _execute_register[i][j][k]->implement_group(GROUP_MAC);
141
142                 for (uint32_t x=GROUP_CUSTOM_1; x<GROUP_CUSTOM_8; x++)
143                   if ((_param->_get_custom_information(num_thread))._get_valid_group(x) == true)
144                     {
145                       uint32_t nb_reg = (_param->_get_custom_information(num_thread))._get_nb_register(x);
146                       _execute_register[i][j][k]->implement_group(x,nb_reg);
147
148                       for (uint32_t y=0; y<nb_reg; y++)
149                         _execute_register[i][j][k]->_spr_access_mode->change_mode(x,y,(_param->_get_custom_information(num_thread))._get_access_mode(x,y));
150                     }
151               }
152           }
153       }
154
155     _function_execute = new function_execute_t * [MAX_OPERATION];
156     
157     // Initialisation
158     for (uint32_t i=0; i<MAX_OPERATION; i++)
159       _function_execute [i] = &(operation_unimplemented);
160
161     if (_param->_timing[OPERATION_ALU_L_ADD     ]._latence > 0) _function_execute[OPERATION_ALU_L_ADD     ] = &(operation_l_add     );
162     if (_param->_timing[OPERATION_ALU_L_ADDC    ]._latence > 0) _function_execute[OPERATION_ALU_L_ADDC    ] = &(operation_l_addc    );
163     if (_param->_timing[OPERATION_ALU_L_SUB     ]._latence > 0) _function_execute[OPERATION_ALU_L_SUB     ] = &(operation_l_sub     );
164//      if (_param->_timing[OPERATION_ALU_L_MUL     ]._latence > 0) _function_execute[OPERATION_ALU_L_MUL     ] = &(operation_l_mul     );
165//      if (_param->_timing[OPERATION_ALU_L_MULU    ]._latence > 0) _function_execute[OPERATION_ALU_L_MULU    ] = &(operation_l_mulu    );
166//      if (_param->_timing[OPERATION_ALU_L_DIV     ]._latence > 0) _function_execute[OPERATION_ALU_L_DIV     ] = &(operation_l_div     );
167//      if (_param->_timing[OPERATION_ALU_L_DIVU    ]._latence > 0) _function_execute[OPERATION_ALU_L_DIVU    ] = &(operation_l_divu    );
168     if (_param->_timing[OPERATION_ALU_L_AND     ]._latence > 0) _function_execute[OPERATION_ALU_L_AND     ] = &(operation_l_and     );
169     if (_param->_timing[OPERATION_ALU_L_OR      ]._latence > 0) _function_execute[OPERATION_ALU_L_OR      ] = &(operation_l_or      );
170     if (_param->_timing[OPERATION_ALU_L_XOR     ]._latence > 0) _function_execute[OPERATION_ALU_L_XOR     ] = &(operation_l_xor     );
171     if (_param->_timing[OPERATION_ALU_L_TEST_F  ]._latence > 0) _function_execute[OPERATION_ALU_L_TEST_F  ] = &(operation_l_test_f  );
172     if (_param->_timing[OPERATION_ALU_L_TEST_NF ]._latence > 0) _function_execute[OPERATION_ALU_L_TEST_NF ] = &(operation_l_test_nf );
173     if (_param->_timing[OPERATION_ALU_L_JALR    ]._latence > 0) _function_execute[OPERATION_ALU_L_JALR    ] = &(operation_l_jalr    );
174     if (_param->_timing[OPERATION_ALU_L_SLL     ]._latence > 0) _function_execute[OPERATION_ALU_L_SLL     ] = &(operation_l_sll     );
175     if (_param->_timing[OPERATION_ALU_L_SRA     ]._latence > 0) _function_execute[OPERATION_ALU_L_SRA     ] = &(operation_l_sra     );
176     if (_param->_timing[OPERATION_ALU_L_SRL     ]._latence > 0) _function_execute[OPERATION_ALU_L_SRL     ] = &(operation_l_srl     );
177     if (_param->_timing[OPERATION_ALU_L_ROR     ]._latence > 0) _function_execute[OPERATION_ALU_L_ROR     ] = &(operation_l_ror     );
178     if (_param->_timing[OPERATION_ALU_L_MOVHI   ]._latence > 0) _function_execute[OPERATION_ALU_L_MOVHI   ] = &(operation_l_movhi   );
179     if (_param->_timing[OPERATION_ALU_L_EXTEND_S]._latence > 0) _function_execute[OPERATION_ALU_L_EXTEND_S] = &(operation_l_extend_s);
180     if (_param->_timing[OPERATION_ALU_L_EXTEND_Z]._latence > 0) _function_execute[OPERATION_ALU_L_EXTEND_Z] = &(operation_l_extend_z);
181     if (_param->_timing[OPERATION_ALU_L_CMOV    ]._latence > 0) _function_execute[OPERATION_ALU_L_CMOV    ] = &(operation_l_cmov    ); 
182     if (_param->_timing[OPERATION_ALU_L_FF1     ]._latence > 0) _function_execute[OPERATION_ALU_L_FF1     ] = &(operation_l_ff1     ); 
183     if (_param->_timing[OPERATION_ALU_L_FL1     ]._latence > 0) _function_execute[OPERATION_ALU_L_FL1     ] = &(operation_l_fl1     ); 
184     if (_param->_timing[OPERATION_ALU_L_MFSPR   ]._latence > 0) _function_execute[OPERATION_ALU_L_MFSPR   ] = &(operation_l_mfspr   ); 
185     if (_param->_timing[OPERATION_ALU_L_MTSPR   ]._latence > 0) _function_execute[OPERATION_ALU_L_MTSPR   ] = &(operation_l_mtspr   ); 
186     if (_param->_timing[OPERATION_ALU_L_SFEQ    ]._latence > 0) _function_execute[OPERATION_ALU_L_SFEQ    ] = &(operation_l_sfeq    );
187     if (_param->_timing[OPERATION_ALU_L_SFNE    ]._latence > 0) _function_execute[OPERATION_ALU_L_SFNE    ] = &(operation_l_sfne    );
188     if (_param->_timing[OPERATION_ALU_L_SFGEU   ]._latence > 0) _function_execute[OPERATION_ALU_L_SFGEU   ] = &(operation_l_sfgeu   );
189     if (_param->_timing[OPERATION_ALU_L_SFGTU   ]._latence > 0) _function_execute[OPERATION_ALU_L_SFGTU   ] = &(operation_l_sfgtu   );
190     if (_param->_timing[OPERATION_ALU_L_SFLEU   ]._latence > 0) _function_execute[OPERATION_ALU_L_SFLEU   ] = &(operation_l_sfleu   );
191     if (_param->_timing[OPERATION_ALU_L_SFLTU   ]._latence > 0) _function_execute[OPERATION_ALU_L_SFLTU   ] = &(operation_l_sfltu   );
192     if (_param->_timing[OPERATION_ALU_L_SFGES   ]._latence > 0) _function_execute[OPERATION_ALU_L_SFGES   ] = &(operation_l_sfges   );
193     if (_param->_timing[OPERATION_ALU_L_SFGTS   ]._latence > 0) _function_execute[OPERATION_ALU_L_SFGTS   ] = &(operation_l_sfgts   );
194     if (_param->_timing[OPERATION_ALU_L_SFLES   ]._latence > 0) _function_execute[OPERATION_ALU_L_SFLES   ] = &(operation_l_sfles   );
195     if (_param->_timing[OPERATION_ALU_L_SFLTS   ]._latence > 0) _function_execute[OPERATION_ALU_L_SFLTS   ] = &(operation_l_sflts   );
196     if (_param->_timing[OPERATION_ALU_L_MAC     ]._latence > 0) _function_execute[OPERATION_ALU_L_MAC     ] = &(operation_l_mac     ); 
197     if (_param->_timing[OPERATION_ALU_L_MACRC   ]._latence > 0) _function_execute[OPERATION_ALU_L_MACRC   ] = &(operation_l_macrc   ); 
198     if (_param->_timing[OPERATION_ALU_L_MSB     ]._latence > 0) _function_execute[OPERATION_ALU_L_MSB     ] = &(operation_l_msb     ); 
199
200
201#ifdef POSITION
202    _component->generate_file();
203#endif
204
205    log_printf(FUNC,Functionnal_unit,FUNCTION,"End");
206  };
207
208}; // end namespace functionnal_unit
209}; // end namespace execute_unit
210}; // end namespace multi_execute_unit
211}; // end namespace execute_loop
212}; // end namespace multi_execute_loop
213}; // end namespace core
214
215}; // end namespace behavioural
216}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.