source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/src/Direction_allocation.cpp

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

1) Stat_list : fix retire old and new register bug
2) Stat_list : remove read_counter and valid flag, because validation of destination is in retire step (not in commit step)
3) Model : add class Model (cf Morpheo.sim)
4) Allocation : alloc_interface_begin and alloc_interface_end to delete temporary array.
5) Script : add distexe.sh
6) Add Comparator, Multiplier, Divider. But this component are not implemented
7) Software : add Dhrystone

  • Property svn:keywords set to Id
File size: 12.3 KB
Line 
1/*
2 * $Id: Direction_allocation.cpp 112 2009-03-18 22:36:26Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/include/Direction.h"
9#include "Behavioural/include/Allocation.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17namespace direction {
18
19
20
21#undef  FUNCTION
22#define FUNCTION "Direction::allocation"
23  void Direction::allocation
24  (
25#ifdef STATISTICS
26   morpheo::behavioural::Parameters_Statistics * param_statistics
27#else
28   void
29#endif
30   )
31  {
32    log_printf(FUNC,Direction,FUNCTION,"Begin");
33
34    _component   = new Component (_usage);
35
36    Entity * entity = _component->set_entity (_name       
37                                              ,"Direction"
38#ifdef POSITION
39                                              ,COMBINATORY
40#endif
41                                              );
42
43    _interfaces = entity->set_interfaces();
44   
45    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46    {
47      Interface * interface = _interfaces->set_interface(""
48#ifdef POSITION
49                                                         ,IN
50                                                         ,SOUTH,
51                                                         _("Generalist interface")
52#endif
53                                                         );
54     
55      in_CLOCK        = interface->set_signal_clk              ("clock" ,1, CLOCK_VHDL_YES);
56      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
57    }
58
59    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60    {
61      ALLOC1_INTERFACE_BEGIN("predict", IN, SOUTH, _("Interface predict"),_param->_nb_inst_predict);
62
63      ALLOC1_VALACK_IN ( in_PREDICT_VAL        ,VAL);
64      ALLOC1_VALACK_OUT(out_PREDICT_ACK        ,ACK);
65      ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS_SRC,"address_src",Taddress_t,_param->_size_instruction_address);
66      ALLOC1_SIGNAL_IN ( in_PREDICT_STATIC     ,"static"     ,Tcontrol_t,1);
67      ALLOC1_SIGNAL_IN ( in_PREDICT_LAST_TAKE  ,"last_take"  ,Tcontrol_t,1);
68      ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY    ,"history"    ,Thistory_t,_param->_size_history);
69      ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION  ,"direction"  ,Tcontrol_t,1);
70
71      ALLOC1_INTERFACE_END(_param->_nb_inst_predict);
72    }
73
74    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75    {
76      ALLOC1_INTERFACE_BEGIN("update", IN, SOUTH, _("Interface update"),_param->_nb_inst_update);
77
78      ALLOC1_VALACK_IN ( in_UPDATE_VAL              ,VAL);
79      ALLOC1_VALACK_OUT(out_UPDATE_ACK              ,ACK);
80      ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS          ,"address"          ,Taddress_t,_param->_size_instruction_address);
81      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY          ,"history"          ,Thistory_t,_param->_size_history);
82      ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION        ,"direction"        ,Tcontrol_t,1);
83      ALLOC1_SIGNAL_IN ( in_UPDATE_PREDICTION_IFETCH,"prediction_ifetch",Tcontrol_t,1);
84
85      ALLOC1_INTERFACE_END(_param->_nb_inst_update);
86    }
87
88    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89    std::string name;
90
91    if (_param->_have_component_meta_predictor)
92    {
93      name = _name+"_meta_predictor";
94      log_printf(INFO,Prediction_unit,FUNCTION,_("Create   : %s"),name.c_str());
95     
96      _component_meta_predictor = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Meta_Predictor
97        (name.c_str()
98#ifdef STATISTICS
99         ,param_statistics
100#endif
101         ,_param->_param_meta_predictor
102         ,_usage);
103     
104      _component->set_component (_component_meta_predictor->_component
105#ifdef POSITION
106                                 , 50, 50, 10, 10
107#endif
108                                 );
109    }
110
111    {
112      name = _name+"_glue";
113      log_printf(INFO,Prediction_unit,FUNCTION,_("Create   : %s"),name.c_str());
114     
115      _component_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::direction_glue::Direction_Glue
116        (name.c_str()
117#ifdef STATISTICS
118         ,param_statistics
119#endif
120         ,_param->_param_glue
121         ,_usage);
122     
123      _component->set_component (_component_glue->_component
124#ifdef POSITION
125                                 , 50, 50, 10, 10
126#endif
127                                 );
128    }
129   
130    // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
131    std::string src,dest;
132
133    // ===================================================================   
134    // =====[ Meta_Predictor ]============================================   
135    // ===================================================================   
136    if (_param->_have_component_meta_predictor)
137    {
138      src = _name+"_meta_predictor";
139      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
140     
141      {
142        dest = _name;
143#ifdef POSITION
144        _component->interface_map (src ,"",
145                                   dest,"");
146#endif
147
148        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
149        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
150      }
151
152      for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
153        {
154          dest = _name+"_glue";
155#ifdef POSITION
156          _component->interface_map (src ,"predict_"          +toString(i),
157                                     dest,"predict_predictor_"+toString(i));
158#endif
159         
160          COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+          "_VAL"        ,
161                                   dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL"        );
162          COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+          "_ACK"        ,
163                                   dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK"        );
164          COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+          "_ADDRESS"    ,
165                                   dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC");
166          COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+          "_DIRECTION"  ,
167                                   dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION"  );
168          COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+          "_HISTORY"    ,
169                                   dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY"    );
170        }
171
172      for (uint32_t i=0; i<_param->_nb_inst_update; i++)
173        {
174          dest = _name+"_glue";
175#ifdef POSITION
176          _component->interface_map (src ,"update_"          +toString(i),
177                                     dest,"update_predictor_"+toString(i));
178#endif
179         
180          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_VAL"        ,
181                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL"        );
182          COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+          "_ACK"        ,
183                                   dest, "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK"        );
184          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_ADDRESS"    ,
185                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS"    );
186          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_DIRECTION"  ,
187                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION"  );
188          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_HISTORY"    ,
189                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY"    );
190          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_HISTORY_VAL"      ,
191                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_PREDICTION_IFETCH");
192        }
193    }
194   
195    // ===================================================================   
196    // =====[ Glue ]======================================================   
197    // ===================================================================   
198    {
199      src = _name+"_glue";
200      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
201     
202      {
203        dest = _name;
204#ifdef POSITION
205        _component->interface_map (src ,"",
206                                   dest,"");
207#endif
208
209        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
210        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
211      }
212
213      for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
214        {
215          dest = _name;
216#ifdef POSITION
217          _component->interface_map (src ,"predict_"+toString(i),
218                                     dest,"predict_"+toString(i));
219#endif
220         
221          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VAL"              ,
222                              dest, "in_PREDICT_"+toString(i)+"_VAL"              );
223          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ACK"              ,
224                              dest,"out_PREDICT_"+toString(i)+"_ACK"              );
225          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_ADDRESS_SRC"      ,
226                              dest, "in_PREDICT_"+toString(i)+"_ADDRESS_SRC"      );
227          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_STATIC"           ,
228                              dest, "in_PREDICT_"+toString(i)+"_STATIC"           );
229          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_LAST_TAKE"        ,
230                              dest, "in_PREDICT_"+toString(i)+"_LAST_TAKE"        );
231          if (_param->_have_port_history)                                         
232          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_HISTORY"          ,
233                              dest,"out_PREDICT_"+toString(i)+"_HISTORY"          );
234          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_DIRECTION"        ,
235                              dest,"out_PREDICT_"+toString(i)+"_DIRECTION"        );
236
237//        PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL"              ,dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL"              );
238//        PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK"              ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK"              );
239//        PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC"      ,dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC"      );
240//        PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY"          ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY"          );
241//        PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION"        ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION"        );
242        }
243     
244      for (uint32_t i=0; i<_param->_nb_inst_update; i++)
245        {
246          dest = _name;
247#ifdef POSITION
248          _component->interface_map (src ,"update_"+toString(i),
249                                     dest,"update_"+toString(i));
250#endif
251
252          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VAL"              ,
253                              dest, "in_UPDATE_"+toString(i)+"_VAL"              );
254          PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_ACK"              ,
255                              dest,"out_UPDATE_"+toString(i)+"_ACK"              );
256          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_ADDRESS"          ,
257                              dest, "in_UPDATE_"+toString(i)+"_ADDRESS"          );
258          if (_param->_have_port_history)
259          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_HISTORY"          ,
260                              dest, "in_UPDATE_"+toString(i)+"_HISTORY"          );
261          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_DIRECTION"        ,
262                              dest, "in_UPDATE_"+toString(i)+"_DIRECTION"        );
263          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_PREDICTION_IFETCH",
264                              dest, "in_UPDATE_"+toString(i)+"_PREDICTION_IFETCH");
265
266//        PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL"              ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL"              );
267//        PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK"              ,dest, "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK"              );
268//        PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS"          ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS"          );
269//        PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY"          ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY"          );
270//        PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION"        ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION"        );
271//        PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_PREDICTION_IFETCH",dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_PREDICTION_IFETCH");
272
273      }
274    }
275    // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
276    if (DEBUG_Direction == true)
277      _component->test_map();
278
279#ifdef POSITION
280    if (usage_is_set(_usage,USE_POSITION))
281      _component->generate_file();
282#endif
283
284    log_printf(FUNC,Direction,FUNCTION,"End");
285  };
286
287}; // end namespace direction
288}; // end namespace prediction_unit
289}; // end namespace front_end
290}; // end namespace multi_front_end
291}; // end namespace core
292
293}; // end namespace behavioural
294}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.