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

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

1) Decod_queue : multi implementation (one_fifo, multi_fifo)
2) Issue_queue : multi implementation (in_order, out_of_order)
3) Direction : Add Meta predictor
4) Context_State : re add Branch_complete, More priority to Load miss (is not speculative)
5) Return_Address_Stack : update reg_PREDICT pointer on decod miss prediction
6) UPT : Fix bug in multi event
7) Prediction_glue : in read_stack case, insert in UPT pc_next
8) Rename select : when rob have an event (need flush), read_r{a,b,c} and write_r{d,e} is set at 0

  • Property svn:keywords set to Id
File size: 11.2 KB
Line 
1/*
2 * $Id: Direction_allocation.cpp 111 2009-02-27 18:37:40Z 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("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
72    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73    {
74      ALLOC1_INTERFACE("update", IN, SOUTH, "Interface update",_param->_nb_inst_update);
75
76      ALLOC1_VALACK_IN ( in_UPDATE_VAL      ,VAL);
77      ALLOC1_VALACK_OUT(out_UPDATE_ACK      ,ACK);
78      ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS  ,"address"  ,Taddress_t,_param->_size_instruction_address);
79      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY  ,"history"  ,Thistory_t,_param->_size_history);
80      ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION,"direction",Tcontrol_t,1);
81    }
82
83    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84    std::string name;
85
86    if (_param->_have_component_meta_predictor)
87    {
88      name = _name+"_meta_predictor";
89      log_printf(INFO,Prediction_unit,FUNCTION,_("Create   : %s"),name.c_str());
90     
91      _component_meta_predictor = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Meta_Predictor
92        (name.c_str()
93#ifdef STATISTICS
94         ,param_statistics
95#endif
96         ,_param->_param_meta_predictor
97         ,_usage);
98     
99      _component->set_component (_component_meta_predictor->_component
100#ifdef POSITION
101                                 , 50, 50, 10, 10
102#endif
103                                 );
104    }
105
106    {
107      name = _name+"_glue";
108      log_printf(INFO,Prediction_unit,FUNCTION,_("Create   : %s"),name.c_str());
109     
110      _component_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::direction_glue::Direction_Glue
111        (name.c_str()
112#ifdef STATISTICS
113         ,param_statistics
114#endif
115         ,_param->_param_glue
116         ,_usage);
117     
118      _component->set_component (_component_glue->_component
119#ifdef POSITION
120                                 , 50, 50, 10, 10
121#endif
122                                 );
123    }
124   
125    // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
126    std::string src,dest;
127
128    // ===================================================================   
129    // =====[ Meta_Predictor ]============================================   
130    // ===================================================================   
131    if (_param->_have_component_meta_predictor)
132    {
133      src = _name+"_meta_predictor";
134      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
135     
136      {
137        dest = _name;
138#ifdef POSITION
139        _component->interface_map (src ,"",
140                                   dest,"");
141#endif
142
143        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
144        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
145      }
146
147      for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
148        {
149          dest = _name+"_glue";
150#ifdef POSITION
151          _component->interface_map (src ,"predict_"          +toString(i),
152                                     dest,"predict_predictor_"+toString(i));
153#endif
154         
155          COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+          "_VAL"        ,
156                                   dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL"        );
157          COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+          "_ACK"        ,
158                                   dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK"        );
159          COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+          "_ADDRESS"    ,
160                                   dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC");
161          COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+          "_DIRECTION"  ,
162                                   dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION"  );
163          COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+          "_HISTORY"    ,
164                                   dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY"    );
165        }
166
167      for (uint32_t i=0; i<_param->_nb_inst_update; i++)
168        {
169          dest = _name+"_glue";
170#ifdef POSITION
171          _component->interface_map (src ,"update_"          +toString(i),
172                                     dest,"update_predictor_"+toString(i));
173#endif
174         
175          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_VAL"        ,
176                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL"        );
177          COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+          "_ACK"        ,
178                                   dest, "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK"        );
179          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_ADDRESS"    ,
180                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS"    );
181          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_DIRECTION"  ,
182                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION"  );
183          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+          "_HISTORY"    ,
184                                   dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY"    );
185        }
186    }
187   
188    // ===================================================================   
189    // =====[ Glue ]======================================================   
190    // ===================================================================   
191    {
192      src = _name+"_glue";
193      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
194     
195      {
196        dest = _name;
197#ifdef POSITION
198        _component->interface_map (src ,"",
199                                   dest,"");
200#endif
201
202        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
203        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
204      }
205
206      for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
207        {
208          dest = _name;
209#ifdef POSITION
210          _component->interface_map (src ,"predict_"+toString(i),
211                                     dest,"predict_"+toString(i));
212#endif
213         
214          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VAL"        ,
215                              dest, "in_PREDICT_"+toString(i)+"_VAL"        );
216          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ACK"        ,
217                              dest,"out_PREDICT_"+toString(i)+"_ACK"        );
218          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_ADDRESS_SRC",
219                              dest, "in_PREDICT_"+toString(i)+"_ADDRESS_SRC");
220          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_STATIC"     ,
221                              dest, "in_PREDICT_"+toString(i)+"_STATIC"     );
222          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_LAST_TAKE"  ,
223                              dest, "in_PREDICT_"+toString(i)+"_LAST_TAKE"  );
224          if (_param->_have_port_history)
225          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_HISTORY"    ,
226                              dest,"out_PREDICT_"+toString(i)+"_HISTORY"    );
227          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_DIRECTION"  ,
228                              dest,"out_PREDICT_"+toString(i)+"_DIRECTION"  );
229
230//        PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL"        ,dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_VAL"        );
231//        PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK"        ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_ACK"        );
232//        PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC",dest,"out_PREDICT_"+toString(i)+"_PREDICTOR_ADDRESS_SRC");
233//        PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY"    ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_HISTORY"    );
234//        PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION"  ,dest, "in_PREDICT_"+toString(i)+"_PREDICTOR_DIRECTION"  );
235        }
236     
237      for (uint32_t i=0; i<_param->_nb_inst_update; i++)
238        {
239          dest = _name;
240#ifdef POSITION
241          _component->interface_map (src ,"update_"+toString(i),
242                                     dest,"update_"+toString(i));
243#endif
244
245          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VAL"      ,
246                              dest, "in_UPDATE_"+toString(i)+"_VAL"      );
247          PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_ACK"      ,
248                              dest,"out_UPDATE_"+toString(i)+"_ACK"      );
249          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_ADDRESS"  ,
250                              dest, "in_UPDATE_"+toString(i)+"_ADDRESS"  );
251          if (_param->_have_port_history)
252          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_HISTORY"  ,
253                              dest, "in_UPDATE_"+toString(i)+"_HISTORY"  );
254          PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_DIRECTION",
255                              dest, "in_UPDATE_"+toString(i)+"_DIRECTION");
256//        PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL"      ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_VAL"      );
257//        PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK"      ,dest, "in_UPDATE_"+toString(i)+"_PREDICTOR_ACK"      );
258//        PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS"  ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_ADDRESS"  );
259//        PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY"  ,dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_HISTORY"  );
260//        PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION",dest,"out_UPDATE_"+toString(i)+"_PREDICTOR_DIRECTION");
261      }
262    }
263    // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
264    if (DEBUG_Direction == true)
265      _component->test_map();
266
267#ifdef POSITION
268    if (usage_is_set(_usage,USE_POSITION))
269      _component->generate_file();
270#endif
271
272    log_printf(FUNC,Direction,FUNCTION,"End");
273  };
274
275}; // end namespace direction
276}; // end namespace prediction_unit
277}; // end namespace front_end
278}; // end namespace multi_front_end
279}; // end namespace core
280
281}; // end namespace behavioural
282}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.