source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/src/Decod_unit_allocation.cpp @ 137

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

Various modif (add test, and vhdl)

  • Property svn:keywords set to Id
File size: 30.9 KB
RevLine 
[83]1/*
2 * $Id: Decod_unit_allocation.cpp 137 2010-02-16 12:35:48Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/include/Decod_unit.h"
9#include "Behavioural/include/Allocation.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace decod_unit {
17
18#undef  FUNCTION
19#define FUNCTION "Decod_unit::allocation"
20  void Decod_unit::allocation
21  (
22#ifdef STATISTICS
23   morpheo::behavioural::Parameters_Statistics * param_statistics
24#else
25   void
26#endif
27   )
28  {
29    log_begin(Decod_unit,FUNCTION);
30
31    _component   = new Component (_usage);
32
33    Entity * entity = _component->set_entity (_name       
34                                              ,"Decod_unit"
35#ifdef POSITION
36                                              ,COMBINATORY
37#endif
38                                              );
39
40    _interfaces = entity->set_interfaces();
41   
42    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43    {
44      Interface * interface = _interfaces->set_interface(""
45#ifdef POSITION
46                                                         ,IN
47                                                         ,SOUTH,
48                                                         "Generalist interface"
49#endif
50                                                         );
51     
52      in_CLOCK        = interface->set_signal_clk              ("clock" ,1, CLOCK_VHDL_YES);
53      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
54    }
55
56    // ~~~~~[ Interface : "ifetch" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57    {
[112]58      ALLOC2_INTERFACE_BEGIN("ifetch", IN, WEST, _("Instruction's bundle"), _param->_nb_context, _param->_nb_inst_fetch[it1]);
[83]59     
[136]60      _ALLOC2_VALACK_IN ( in_IFETCH_VAL                       ,VAL, _param->_nb_context, _param->_nb_inst_fetch[it1]);
61      _ALLOC2_VALACK_OUT(out_IFETCH_ACK                       ,ACK, _param->_nb_context, _param->_nb_inst_fetch[it1]);
62      _ALLOC2_SIGNAL_IN ( in_IFETCH_INSTRUCTION               ,"instruction"                ,Tinstruction_t     ,_param->_size_instruction        ,_param->_nb_context, _param->_nb_inst_fetch[it1]);
63      _ALLOC2_SIGNAL_IN (in_IFETCH_CONTEXT_ID                 ,"context_id"                 ,Tcontext_t         ,_param->_size_context_id         ,_param->_nb_context, _param->_nb_inst_fetch[it1]);
64      _ALLOC2_SIGNAL_IN (in_IFETCH_ADDRESS                    ,"address"                    ,Tgeneral_address_t ,_param->_size_instruction_address,_param->_nb_context, _param->_nb_inst_fetch[it1]);
65//    _ALLOC2_SIGNAL_IN (in_IFETCH_ADDRESS_NEXT               ,"address_next"               ,Tgeneral_address_t ,_param->_size_instruction_address,_param->_nb_context, _param->_nb_inst_fetch[it1]);
66//    _ALLOC2_SIGNAL_IN (in_IFETCH_INST_IFETCH_PTR            ,"inst_ifetch_ptr"            ,Tinst_ifetch_ptr_t ,_param->_size_inst_ifetch_ptr    ,_param->_nb_context, _param->_nb_inst_fetch[it1]);
67      _ALLOC2_SIGNAL_IN (in_IFETCH_BRANCH_STATE               ,"branch_state"               ,Tbranch_state_t    ,_param->_size_branch_state       ,_param->_nb_context, _param->_nb_inst_fetch[it1]);
68      _ALLOC2_SIGNAL_IN (in_IFETCH_BRANCH_UPDATE_PREDICTION_ID,"branch_update_prediction_id",Tprediction_ptr_t  ,_param->_size_depth              ,_param->_nb_context, _param->_nb_inst_fetch[it1]);
69      _ALLOC2_SIGNAL_IN (in_IFETCH_EXCEPTION                  ,"exception"                  ,Texception_t       ,_param->_size_exception_ifetch   ,_param->_nb_context, _param->_nb_inst_fetch[it1]);
[112]70
71      ALLOC2_INTERFACE_END(_param->_nb_context, _param->_nb_inst_fetch[it1]);
[83]72    }
[112]73
[83]74    // ~~~~~[ Interface : "decod" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           
75    {
[112]76      ALLOC1_INTERFACE_BEGIN("decod", OUT, EAST, _("Instruction decoded"), _param->_nb_inst_decod);
[83]77
78      ALLOC1_VALACK_OUT(out_DECOD_VAL          ,VAL);
79      ALLOC1_VALACK_IN ( in_DECOD_ACK          ,ACK);
80      ALLOC1_SIGNAL_OUT(out_DECOD_CONTEXT_ID   ,"context_id"   ,Tcontext_t        ,_param->_size_context_id            );
81      ALLOC1_SIGNAL_OUT(out_DECOD_DEPTH        ,"depth"        ,Tdepth_t          ,_param->_size_depth                 );
[137]82#ifdef STATISTICS
83      ALLOC1_SIGNAL_OUT(out_DECOD_INSTRUCTION  ,"instruction"  ,uint32_t          ,32);
84#endif
[83]85      ALLOC1_SIGNAL_OUT(out_DECOD_TYPE         ,"type"         ,Ttype_t           ,_param->_size_type                  );
86      ALLOC1_SIGNAL_OUT(out_DECOD_OPERATION    ,"operation"    ,Toperation_t      ,_param->_size_operation             );
[88]87      ALLOC1_SIGNAL_OUT(out_DECOD_NO_EXECUTE   ,"no_execute"   ,Tcontrol_t        ,1                                   );
[123]88//    ALLOC1_SIGNAL_OUT(out_DECOD_HAVE_EVENT   ,"have_event"   ,Tcontrol_t        ,1                                   );
89      ALLOC1_SIGNAL_OUT(out_DECOD_LAST_EVENT   ,"last_event"   ,Tcontrol_t        ,1                                   );
[83]90      ALLOC1_SIGNAL_OUT(out_DECOD_IS_DELAY_SLOT,"is_delay_slot",Tcontrol_t        ,1                                   );
[108]91#ifdef DEBUG
92      ALLOC1_SIGNAL_OUT(out_DECOD_ADDRESS      ,"address"      ,Tgeneral_data_t   ,_param->_size_instruction_address   );
93#endif
[105]94      ALLOC1_SIGNAL_OUT(out_DECOD_ADDRESS_NEXT ,"address_next" ,Tgeneral_data_t   ,_param->_size_instruction_address   );
[83]95      ALLOC1_SIGNAL_OUT(out_DECOD_HAS_IMMEDIAT ,"has_immediat" ,Tcontrol_t        ,1                                   );
96      ALLOC1_SIGNAL_OUT(out_DECOD_IMMEDIAT     ,"immediat"     ,Tgeneral_data_t   ,_param->_size_general_data          );
97      ALLOC1_SIGNAL_OUT(out_DECOD_READ_RA      ,"read_ra"      ,Tcontrol_t        ,1                                   );
98      ALLOC1_SIGNAL_OUT(out_DECOD_NUM_REG_RA   ,"num_reg_ra"   ,Tgeneral_address_t,_param->_size_general_register_logic);
99      ALLOC1_SIGNAL_OUT(out_DECOD_READ_RB      ,"read_rb"      ,Tcontrol_t        ,1                                   );
100      ALLOC1_SIGNAL_OUT(out_DECOD_NUM_REG_RB   ,"num_reg_rb"   ,Tgeneral_address_t,_param->_size_general_register_logic);
101      ALLOC1_SIGNAL_OUT(out_DECOD_READ_RC      ,"read_rc"      ,Tcontrol_t        ,1                                   );
102      ALLOC1_SIGNAL_OUT(out_DECOD_NUM_REG_RC   ,"num_reg_rc"   ,Tspecial_address_t,_param->_size_special_register_logic);
103      ALLOC1_SIGNAL_OUT(out_DECOD_WRITE_RD     ,"write_rd"     ,Tcontrol_t        ,1                                   );
104      ALLOC1_SIGNAL_OUT(out_DECOD_NUM_REG_RD   ,"num_reg_rd"   ,Tgeneral_address_t,_param->_size_general_register_logic);
105      ALLOC1_SIGNAL_OUT(out_DECOD_WRITE_RE     ,"write_re"     ,Tcontrol_t        ,1                                   );
106      ALLOC1_SIGNAL_OUT(out_DECOD_NUM_REG_RE   ,"num_reg_re"   ,Tspecial_address_t,_param->_size_special_register_logic);
107      ALLOC1_SIGNAL_OUT(out_DECOD_EXCEPTION_USE,"exception_use",Texception_t      ,_param->_size_exception_use         );
[88]108      ALLOC1_SIGNAL_OUT(out_DECOD_EXCEPTION    ,"exception"    ,Texception_t      ,_param->_size_exception_decod       );
[112]109   
110      ALLOC1_INTERFACE_END(_param->_nb_inst_decod);
[83]111    }
112
113    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
114    {
[112]115      ALLOC1_INTERFACE_BEGIN("predict",OUT,NORTH,_("Decod a branch -> inform the branch predictor."),_param->_nb_inst_decod);
[83]116
117      ALLOC1_VALACK_OUT(out_PREDICT_VAL                        ,VAL);
118      ALLOC1_VALACK_IN ( in_PREDICT_ACK                        ,ACK);
[88]119      ALLOC1_SIGNAL_OUT(out_PREDICT_CONTEXT_ID                 ,"context_id"                 ,Tcontext_t         ,_param->_size_context_id      );
120      ALLOC1_SIGNAL_OUT(out_PREDICT_MATCH_INST_IFETCH_PTR      ,"match_inst_ifetch_ptr"      ,Tcontrol_t         ,1                             );
121      ALLOC1_SIGNAL_OUT(out_PREDICT_BRANCH_STATE               ,"branch_state"               ,Tbranch_state_t    ,_param->_size_branch_state    );
122      ALLOC1_SIGNAL_OUT(out_PREDICT_BRANCH_UPDATE_PREDICTION_ID,"branch_update_prediction_id",Tprediction_ptr_t  ,_param->_size_depth           );
123      ALLOC1_SIGNAL_OUT(out_PREDICT_BRANCH_CONDITION           ,"branch_condition"           ,Tbranch_condition_t,_param->_size_branch_condition);
124//    ALLOC1_SIGNAL_OUT(out_PREDICT_BRANCH_STACK_WRITE         ,"branch_stack_write"         ,Tcontrol_t         ,1                             );
125      ALLOC1_SIGNAL_OUT(out_PREDICT_BRANCH_DIRECTION           ,"branch_direction"           ,Tcontrol_t         ,1                             );
126      ALLOC1_SIGNAL_OUT(out_PREDICT_ADDRESS_SRC                ,"address_src"                ,Tgeneral_data_t    ,_param->_size_instruction_address    );
127      ALLOC1_SIGNAL_OUT(out_PREDICT_ADDRESS_DEST               ,"address_dest"               ,Tgeneral_data_t    ,_param->_size_instruction_address    );
[110]128      ALLOC1_SIGNAL_IN ( in_PREDICT_CAN_CONTINUE               ,"can_continue"               ,Tcontrol_t         ,1                             );
[112]129   
130      ALLOC1_INTERFACE_END(_param->_nb_inst_decod);
[83]131    }
[112]132   
[83]133    // ~~~~~[ Interface : "depth" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           
134    {
[112]135      ALLOC1_INTERFACE_BEGIN("depth",IN ,NORTH,_("Depth"), _param->_nb_context);
[83]136
[101]137      ALLOC1_SIGNAL_IN ( in_DEPTH_MIN      ,"min"      ,Tdepth_t           ,_param->_size_depth);
138      ALLOC1_SIGNAL_IN ( in_DEPTH_MAX      ,"max"      ,Tdepth_t           ,_param->_size_depth);
139      ALLOC1_SIGNAL_IN ( in_DEPTH_FULL     ,"full"     ,Tcontrol_t         ,1);
[112]140
141      ALLOC1_INTERFACE_END(_param->_nb_context);
[83]142    }
143
[88]144    // ~~~~~[ Interface : "nb_inst" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           
[83]145    {
[112]146      ALLOC1_INTERFACE_BEGIN("nb_inst",OUT,NORTH,_("Instruction's number"), _param->_nb_context);
[83]147
[118]148      ALLOC1_SIGNAL_OUT(out_NB_INST_DECOD_ALL  ,"decod_all"   ,Tcounter_t         ,_param->_size_nb_inst_decod);
[112]149
150      ALLOC1_INTERFACE_END(_param->_nb_context);
[83]151    }
152   
153    // ~~~~~[ Interface : "context" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154    {
[112]155      ALLOC1_INTERFACE_BEGIN("context", IN, NORTH, _("context's information"), _param->_nb_context);
[83]156
157      ALLOC1_SIGNAL_IN (in_CONTEXT_DECOD_ENABLE,"decod_enable",Tcontrol_t,1);
[123]158      ALLOC1_SIGNAL_IN (in_CONTEXT_EVENT       ,"event"       ,Tcontrol_t,1);
[101]159      ALLOC1_SIGNAL_IN (in_CONTEXT_DEPTH_VAL   ,"depth_val"   ,Tcontrol_t,1);
[83]160      ALLOC1_SIGNAL_IN (in_CONTEXT_DEPTH       ,"depth"       ,Tdepth_t  ,_param->_size_depth);
[112]161
162      ALLOC1_INTERFACE_END(_param->_nb_context);
[83]163    }
164
165    // ~~~~~[ Interface : "context_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           
166    {
[112]167      ALLOC0_INTERFACE_BEGIN("context_event", OUT, NORTH, _("context's evenement"));
[83]168
[112]169      ALLOC0_VALACK_OUT(out_CONTEXT_EVENT_VAL          ,VAL);
170      ALLOC0_VALACK_IN ( in_CONTEXT_EVENT_ACK          ,ACK);
171      ALLOC0_SIGNAL_OUT(out_CONTEXT_EVENT_CONTEXT_ID   ,"context_id"   ,Tcontext_t     ,_param->_size_context_id  );
172      ALLOC0_SIGNAL_OUT(out_CONTEXT_EVENT_DEPTH        ,"depth"        ,Tdepth_t       ,_param->_size_depth       );
173      ALLOC0_SIGNAL_OUT(out_CONTEXT_EVENT_TYPE         ,"type"         ,Tevent_type_t  ,_param->_size_event_type  );
174      ALLOC0_SIGNAL_OUT(out_CONTEXT_EVENT_IS_DELAY_SLOT,"is_delay_slot",Tcontrol_t     ,1                         );
175      ALLOC0_SIGNAL_OUT(out_CONTEXT_EVENT_ADDRESS      ,"address"      ,Tgeneral_data_t,_param->_size_instruction_address);
176      ALLOC0_SIGNAL_OUT(out_CONTEXT_EVENT_ADDRESS_EPCR ,"address_epcr" ,Tgeneral_data_t,_param->_size_instruction_address);
177
178      ALLOC0_INTERFACE_END();
[83]179    }
180   
181    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
182    std::string src,dest;
183   
184    {
185      src = _name+"_decod";
[87]186      log_printf(INFO,Decod_unit,FUNCTION,_("Create   : %s"),src.c_str());
[83]187     
188      _component_decod = new morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod::Decod
189        (src.c_str()
190#ifdef STATISTICS
191         ,param_statistics
192#endif
193         ,_param->_param_decod
194         ,_usage);
195     
196      _component->set_component (_component_decod->_component
197#ifdef POSITION
198                                 , 50, 50, 10, 10
199#endif
200                                 );
201    }
202   
203    {
204      src = _name+"_decod_queue";
[87]205      log_printf(INFO,Decod_unit,FUNCTION,_("Create   : %s"),src.c_str());
[83]206     
207      _component_decod_queue = new morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod_queue::Decod_queue
208        (src.c_str()
209#ifdef STATISTICS
210         ,param_statistics
211#endif
212         ,_param->_param_decod_queue
213         ,_usage);
214     
215      _component->set_component (_component_decod_queue->_component
216#ifdef POSITION
217                                 , 50, 50, 10, 10
218#endif
219                                 );
220    }
221   
222    // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
223
224    // ===================================================================
225    // =====[ decod ]=====================================================
226    // ===================================================================
227    {
228      src = _name+"_decod";
[87]229      log_printf(INFO,Decod_unit,FUNCTION,_("Instance : %s"),src.c_str());
[83]230           
231      {
232        dest = _name;
233#ifdef POSITION
234        _component->interface_map (src ,"",
235                                   dest,"");
236#endif
237        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
238        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
239      }
240
241      for (uint32_t i=0; i<_param->_nb_context; i++)
242        {
243          dest = _name;
244       
245          for (uint32_t j=0; j<_param->_nb_inst_fetch [i]; j++)
246            {
247#ifdef POSITION
248              _component->interface_map (src ,"ifetch_"+toString(i)+"_"+toString(j),
249                                         dest,"ifetch_"+toString(i)+"_"+toString(j));
250#endif
251             
252              PORT_MAP(_component,src , "in_IFETCH_"+toString(i)+"_"+toString(j)+"_VAL"        ,
253                                  dest, "in_IFETCH_"+toString(i)+"_"+toString(j)+"_VAL"        );
254              PORT_MAP(_component,src ,"out_IFETCH_"+toString(i)+"_"+toString(j)+"_ACK"        ,
255                                  dest,"out_IFETCH_"+toString(i)+"_"+toString(j)+"_ACK"        );
256              PORT_MAP(_component,src , "in_IFETCH_"+toString(i)+"_"+toString(j)+"_INSTRUCTION",
257                                  dest, "in_IFETCH_"+toString(i)+"_"+toString(j)+"_INSTRUCTION");
[136]258              if (_param->_have_port_context_id)
259              PORT_MAP(_component,src , "in_IFETCH_"+toString(i)+"_"+toString(j)+"_CONTEXT_ID"                 ,
260                                  dest, "in_IFETCH_"+toString(i)+"_"+toString(j)+"_CONTEXT_ID"                 );
261              PORT_MAP(_component,src , "in_IFETCH_"+toString(i)+"_"+toString(j)+"_ADDRESS"                    ,
262                                  dest, "in_IFETCH_"+toString(i)+"_"+toString(j)+"_ADDRESS"                    );
263//            PORT_MAP(_component,src , "in_IFETCH_"+toString(i)+"_"+toString(j)+"_ADDRESS_NEXT"               ,
264//                                dest, "in_IFETCH_"+toString(i)+"_"+toString(j)+"_ADDRESS_NEXT"               );
265//            if (_param->_have_port_inst_ifetch_ptr)
266//            PORT_MAP(_component,src , "in_IFETCH_"+toString(i)+"_"+toString(j)+"_INST_IFETCH_PTR"            ,
267//                                dest, "in_IFETCH_"+toString(i)+"_"+toString(j)+"_INST_IFETCH_PTR"            );
268              PORT_MAP(_component,src , "in_IFETCH_"+toString(i)+"_"+toString(j)+"_BRANCH_STATE"               ,
269                                  dest, "in_IFETCH_"+toString(i)+"_"+toString(j)+"_BRANCH_STATE"               );
270              if (_param->_have_port_depth)
271              PORT_MAP(_component,src , "in_IFETCH_"+toString(i)+"_"+toString(j)+"_BRANCH_UPDATE_PREDICTION_ID",
272                                  dest, "in_IFETCH_"+toString(i)+"_"+toString(j)+"_BRANCH_UPDATE_PREDICTION_ID");
273              PORT_MAP(_component,src , "in_IFETCH_"+toString(i)+"_"+toString(j)+"_EXCEPTION"                  ,
274                                  dest, "in_IFETCH_"+toString(i)+"_"+toString(j)+"_EXCEPTION"                  );
[83]275            }
[136]276 
[83]277        }
278       
279      for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
280        {
281          dest = _name+"_decod_queue";
282
283#ifdef POSITION
284          _component->interface_map (src ,"decod_"   +toString(i),
285                                     dest,"decod_in_"+toString(i));
286#endif
287
288          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_VAL"          ,
289                                   dest, "in_DECOD_IN_"+toString(i)+"_VAL"          );
290          COMPONENT_MAP(_component,src , "in_DECOD_"   +toString(i)+"_ACK"          ,
291                                   dest,"out_DECOD_IN_"+toString(i)+"_ACK"          );
292          if (_param->_have_port_context_id)
293          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_CONTEXT_ID"   ,
294                                   dest, "in_DECOD_IN_"+toString(i)+"_CONTEXT_ID"   );
295          if (_param->_have_port_depth)
296          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_DEPTH"        ,
297                                   dest, "in_DECOD_IN_"+toString(i)+"_DEPTH"        );
[137]298#ifdef STATISTICS
299          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_INSTRUCTION"  ,
300                                   dest, "in_DECOD_IN_"+toString(i)+"_INSTRUCTION"  );
301#endif
[83]302          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_TYPE"         ,
303                                   dest, "in_DECOD_IN_"+toString(i)+"_TYPE"         );
304          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_OPERATION"    ,
305                                   dest, "in_DECOD_IN_"+toString(i)+"_OPERATION"    );
[88]306          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_NO_EXECUTE"   ,
307                                   dest, "in_DECOD_IN_"+toString(i)+"_NO_EXECUTE"   );
[83]308          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_IS_DELAY_SLOT",
309                                   dest, "in_DECOD_IN_"+toString(i)+"_IS_DELAY_SLOT");
[108]310#ifdef DEBUG
311          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_ADDRESS"      ,
312                                   dest, "in_DECOD_IN_"+toString(i)+"_ADDRESS"      );
313#endif
[105]314          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_ADDRESS_NEXT" ,
315                                   dest, "in_DECOD_IN_"+toString(i)+"_ADDRESS_NEXT" );
[83]316          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_HAS_IMMEDIAT" ,
317                                   dest, "in_DECOD_IN_"+toString(i)+"_HAS_IMMEDIAT" );
318          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_IMMEDIAT"     ,
319                                   dest, "in_DECOD_IN_"+toString(i)+"_IMMEDIAT"     );
320          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_READ_RA"      ,
321                                   dest, "in_DECOD_IN_"+toString(i)+"_READ_RA"      );
322          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_NUM_REG_RA"   ,
323                                   dest, "in_DECOD_IN_"+toString(i)+"_NUM_REG_RA"   );
324          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_READ_RB"      ,
325                                   dest, "in_DECOD_IN_"+toString(i)+"_READ_RB"      );
326          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_NUM_REG_RB"   ,
327                                   dest, "in_DECOD_IN_"+toString(i)+"_NUM_REG_RB"   );
328          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_READ_RC"      ,
329                                   dest, "in_DECOD_IN_"+toString(i)+"_READ_RC"      );
330          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_NUM_REG_RC"   ,
331                                   dest, "in_DECOD_IN_"+toString(i)+"_NUM_REG_RC"   );
332          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_WRITE_RD"     ,
333                                   dest, "in_DECOD_IN_"+toString(i)+"_WRITE_RD"     );
334          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_NUM_REG_RD"   ,
335                                   dest, "in_DECOD_IN_"+toString(i)+"_NUM_REG_RD"   );
336          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_WRITE_RE"     ,
337                                   dest, "in_DECOD_IN_"+toString(i)+"_WRITE_RE"     );
338          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_NUM_REG_RE"   ,
339                                   dest, "in_DECOD_IN_"+toString(i)+"_NUM_REG_RE"   );
340          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_EXCEPTION_USE",
341                                   dest, "in_DECOD_IN_"+toString(i)+"_EXCEPTION_USE");
[88]342          COMPONENT_MAP(_component,src ,"out_DECOD_"   +toString(i)+"_EXCEPTION"    ,
343                                   dest, "in_DECOD_IN_"+toString(i)+"_EXCEPTION"    );
[83]344        }
345
346      for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
347        {
348          dest = _name;
349
350#ifdef POSITION
351          _component->interface_map (src ,"predict"+toString(i),
352                                     dest,"predict"+toString(i));
353#endif
354
355          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_VAL"                        ,
356                              dest,"out_PREDICT_"+toString(i)+"_VAL"                        );
357          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_ACK"                        ,
358                              dest, "in_PREDICT_"+toString(i)+"_ACK"                        );
359          if (_param->_have_port_context_id)
360          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_CONTEXT_ID"                 ,
361                              dest,"out_PREDICT_"+toString(i)+"_CONTEXT_ID"                 );
362          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_MATCH_INST_IFETCH_PTR"      ,
363                              dest,"out_PREDICT_"+toString(i)+"_MATCH_INST_IFETCH_PTR"      );
364          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_BRANCH_STATE"               ,
365                              dest,"out_PREDICT_"+toString(i)+"_BRANCH_STATE"               );
[88]366          if (_param->_have_port_depth)
[83]367          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_BRANCH_UPDATE_PREDICTION_ID",
368                              dest,"out_PREDICT_"+toString(i)+"_BRANCH_UPDATE_PREDICTION_ID");
369          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_BRANCH_CONDITION"           ,
370                              dest,"out_PREDICT_"+toString(i)+"_BRANCH_CONDITION"           );
371//        PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_BRANCH_STACK_WRITE"         ,
372//                            dest,"out_PREDICT_"+toString(i)+"_BRANCH_STACK_WRITE"         );
373          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_BRANCH_DIRECTION"           ,
374                              dest,"out_PREDICT_"+toString(i)+"_BRANCH_DIRECTION"           );
375          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ADDRESS_SRC"                ,
376                              dest,"out_PREDICT_"+toString(i)+"_ADDRESS_SRC"                );
377          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ADDRESS_DEST"               ,
378                              dest,"out_PREDICT_"+toString(i)+"_ADDRESS_DEST"               );
[110]379          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_CAN_CONTINUE"               ,
380                              dest, "in_PREDICT_"+toString(i)+"_CAN_CONTINUE"               );
[83]381        }
382
383      for (uint32_t i=0; i<_param->_nb_context; i++)
384        {
385          dest = _name;
386
387#ifdef POSITION
[101]388          _component->interface_map (src ,"context_"+toString(i),
389                                     dest,"context_"+toString(i));
[83]390#endif
391         
392          PORT_MAP(_component,src , "in_CONTEXT_"+toString(i)+"_DECOD_ENABLE",
393                              dest, "in_CONTEXT_"+toString(i)+"_DECOD_ENABLE");
[101]394          PORT_MAP(_component,src , "in_CONTEXT_"+toString(i)+"_DEPTH_VAL"   ,
395                              dest, "in_CONTEXT_"+toString(i)+"_DEPTH_VAL"   );
[83]396          if (_param->_have_port_depth)
397          PORT_MAP(_component,src , "in_CONTEXT_"+toString(i)+"_DEPTH"       ,
398                              dest, "in_CONTEXT_"+toString(i)+"_DEPTH"       );
399        }
400
401      {
402        dest = _name;
403       
404#ifdef POSITION
405        _component->interface_map (src ,"context_event",
406                                   dest,"context_event");
407#endif
408
409        PORT_MAP(_component,src ,"out_CONTEXT_EVENT_VAL"          ,
410                            dest,"out_CONTEXT_EVENT_VAL"          );
411        PORT_MAP(_component,src , "in_CONTEXT_EVENT_ACK"          ,
412                            dest, "in_CONTEXT_EVENT_ACK"          );
413        if (_param->_have_port_context_id)
414        PORT_MAP(_component,src ,"out_CONTEXT_EVENT_CONTEXT_ID"   ,
415                            dest,"out_CONTEXT_EVENT_CONTEXT_ID"   );
[88]416        if (_param->_have_port_depth)
417        PORT_MAP(_component,src ,"out_CONTEXT_EVENT_DEPTH"        ,
418                            dest,"out_CONTEXT_EVENT_DEPTH"        );
[83]419        PORT_MAP(_component,src ,"out_CONTEXT_EVENT_TYPE"         ,
420                            dest,"out_CONTEXT_EVENT_TYPE"         );
421        PORT_MAP(_component,src ,"out_CONTEXT_EVENT_IS_DELAY_SLOT",
422                            dest,"out_CONTEXT_EVENT_IS_DELAY_SLOT");
423        PORT_MAP(_component,src ,"out_CONTEXT_EVENT_ADDRESS"      ,
424                            dest,"out_CONTEXT_EVENT_ADDRESS"      );
425        PORT_MAP(_component,src ,"out_CONTEXT_EVENT_ADDRESS_EPCR" ,
426                            dest,"out_CONTEXT_EVENT_ADDRESS_EPCR" );
427
428      }
429    }
430
431    // ===================================================================
432    // =====[ decod_queue ]===============================================
433    // ===================================================================
434    {
435      src = _name+"_decod_queue";
[87]436      log_printf(INFO,Decod_unit,FUNCTION,_("Instance : %s"),src.c_str());
[83]437           
438      {
439        dest = _name;
440#ifdef POSITION
441        _component->interface_map (src ,"",
442                                   dest,"");
443#endif
444        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
445        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
446      }
447
448      // in_DECOD_IN_VAL            - component decod
449      //out_DECOD_IN_ACK            - component decod
450      // in_DECOD_IN_CONTEXT_ID     - component decod
451      // in_DECOD_IN_DEPTH          - component decod
452      // in_DECOD_IN_TYPE           - component decod
453      // in_DECOD_IN_OPERATION      - component decod
[88]454      // in_DECOD_IN_NO_EXECUTE     - component decod
[83]455      // in_DECOD_IN_IS_DELAY_SLOT  - component decod
[108]456      // in_DECOD_IN_ADDRESS        - component decod
[105]457      // in_DECOD_IN_ADDRESS_NEXT   - component decod
[83]458      // in_DECOD_IN_HAS_IMMEDIAT   - component decod
459      // in_DECOD_IN_IMMEDIAT       - component decod
460      // in_DECOD_IN_READ_RA        - component decod
461      // in_DECOD_IN_NUM_REG_RA     - component decod
462      // in_DECOD_IN_READ_RB        - component decod
463      // in_DECOD_IN_NUM_REG_RB     - component decod
464      // in_DECOD_IN_READ_RC        - component decod
465      // in_DECOD_IN_NUM_REG_RC     - component decod
466      // in_DECOD_IN_WRITE_RD       - component decod
467      // in_DECOD_IN_NUM_REG_RD     - component decod
468      // in_DECOD_IN_WRITE_RE       - component decod
469      // in_DECOD_IN_NUM_REG_RE     - component decod
470      // in_DECOD_IN_EXCEPTION_USE  - component decod
[88]471      // in_DECOD_IN_EXCEPTION      - component decod
[83]472
473      for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
474        {
475          dest = _name;
476
477#ifdef POSITION
478          _component->interface_map (src ,"decod_out_"+toString(i),
479                                     dest,"decod"     +toString(i));
480#endif
481
482          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_VAL"          ,
483                              dest,"out_DECOD_"    +toString(i)+"_VAL"          );
484          PORT_MAP(_component,src , "in_DECOD_OUT_"+toString(i)+"_ACK"          ,
485                              dest, "in_DECOD_"    +toString(i)+"_ACK"          );
486          if (_param->_have_port_context_id)
487          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_CONTEXT_ID"   ,
488                              dest,"out_DECOD_"    +toString(i)+"_CONTEXT_ID"   );
489          if (_param->_have_port_depth)
490          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_DEPTH"        ,
491                              dest,"out_DECOD_"    +toString(i)+"_DEPTH"        );
[137]492#ifdef STATISTICS
493          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_INSTRUCTION"  ,
494                              dest,"out_DECOD_"    +toString(i)+"_INSTRUCTION"  );
495#endif
[83]496          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_TYPE"         ,
497                              dest,"out_DECOD_"    +toString(i)+"_TYPE"         );
498          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_OPERATION"    ,
499                              dest,"out_DECOD_"    +toString(i)+"_OPERATION"    );
[88]500          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_NO_EXECUTE"   ,
501                              dest,"out_DECOD_"    +toString(i)+"_NO_EXECUTE"   );
[123]502//        PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_HAVE_EVENT"   ,
503//                            dest,"out_DECOD_"    +toString(i)+"_HAVE_EVENT"   );
504          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_LAST_EVENT"   ,
505                              dest,"out_DECOD_"    +toString(i)+"_LAST_EVENT"   );
[83]506          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_IS_DELAY_SLOT",
507                              dest,"out_DECOD_"    +toString(i)+"_IS_DELAY_SLOT");
[108]508#ifdef DEBUG
509          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_ADDRESS"      ,
510                              dest,"out_DECOD_"    +toString(i)+"_ADDRESS"      );
511#endif
[105]512          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_ADDRESS_NEXT" ,
513                              dest,"out_DECOD_"    +toString(i)+"_ADDRESS_NEXT" );
[83]514          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_HAS_IMMEDIAT" ,
515                              dest,"out_DECOD_"    +toString(i)+"_HAS_IMMEDIAT" );
516          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_IMMEDIAT"     ,
517                              dest,"out_DECOD_"    +toString(i)+"_IMMEDIAT"     );
518          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_READ_RA"      ,
519                              dest,"out_DECOD_"    +toString(i)+"_READ_RA"      );
520          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_NUM_REG_RA"   ,
521                              dest,"out_DECOD_"    +toString(i)+"_NUM_REG_RA"   );
522          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_READ_RB"      ,
523                              dest,"out_DECOD_"    +toString(i)+"_READ_RB"      );
524          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_NUM_REG_RB"   ,
525                              dest,"out_DECOD_"    +toString(i)+"_NUM_REG_RB"   );
526          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_READ_RC"      ,
527                              dest,"out_DECOD_"    +toString(i)+"_READ_RC"      );
528          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_NUM_REG_RC"   ,
529                              dest,"out_DECOD_"    +toString(i)+"_NUM_REG_RC"   );
530          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_WRITE_RD"     ,
531                              dest,"out_DECOD_"    +toString(i)+"_WRITE_RD"     );
532          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_NUM_REG_RD"   ,
533                              dest,"out_DECOD_"    +toString(i)+"_NUM_REG_RD"   );
534          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_WRITE_RE"     ,
535                              dest,"out_DECOD_"    +toString(i)+"_WRITE_RE"     );
536          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_NUM_REG_RE"   ,
537                              dest,"out_DECOD_"    +toString(i)+"_NUM_REG_RE"   );
538          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_EXCEPTION_USE",
539                              dest,"out_DECOD_"    +toString(i)+"_EXCEPTION_USE");
[88]540          PORT_MAP(_component,src ,"out_DECOD_OUT_"+toString(i)+"_EXCEPTION"    ,
541                              dest,"out_DECOD_"    +toString(i)+"_EXCEPTION"    );
[83]542        }
543
544      for (uint32_t i=0; i<_param->_nb_context; i++)
545        {
546          dest = _name;
547
548#ifdef POSITION
549          _component->interface_map (src ,"depth"+toString(i),
550                                     dest,"depth"+toString(i));
551#endif
552
[88]553          if (_param->_have_port_depth)
[101]554            {
[88]555          PORT_MAP(_component,src , "in_DEPTH_"+toString(i)+"_MIN",
556                              dest, "in_DEPTH_"+toString(i)+"_MIN");
557          PORT_MAP(_component,src , "in_DEPTH_"+toString(i)+"_MAX",
558                              dest, "in_DEPTH_"+toString(i)+"_MAX");
[101]559            }
560          PORT_MAP(_component,src , "in_DEPTH_"+toString(i)+"_FULL",
561                              dest, "in_DEPTH_"+toString(i)+"_FULL");
[83]562        }
563
564      for (uint32_t i=0; i<_param->_nb_context; i++)
565        {
566          dest = _name;
567
568#ifdef POSITION
569          _component->interface_map (src ,"nb_inst"+toString(i),
570                                     dest,"nb_inst"+toString(i));
571#endif
572
573          PORT_MAP(_component,src ,"out_NB_INST_"+toString(i)+      "_ALL",
574                              dest,"out_NB_INST_"+toString(i)+"_DECOD_ALL");
575        }
[123]576
577
578
579      for (uint32_t i=0; i<_param->_nb_context; i++)
580        {
581          dest = _name;
582
583#ifdef POSITION
584          _component->interface_map (src ,"context_"+toString(i),
585                                     dest,"context_"+toString(i));
586#endif
587         
588          PORT_MAP(_component,src , "in_CONTEXT_"+toString(i)+"_EVENT"       ,
589                              dest, "in_CONTEXT_"+toString(i)+"_EVENT"       );
590
591        }
[83]592    }
593    // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[88]594#if DEBUG_Decod_unit == true
[87]595      _component->test_map();
[88]596#endif
597
[83]598#ifdef POSITION
[87]599    if (usage_is_set(_usage,USE_POSITION))
600      _component->generate_file();
[83]601#endif
[87]602   
603    log_end(Decod_unit,FUNCTION);
[83]604  };
605
606}; // end namespace decod_unit
607}; // end namespace front_end
608}; // end namespace multi_front_end
609}; // end namespace core
610
611}; // end namespace behavioural
612}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.