source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/src/Parameters.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: 5.9 KB
Line 
1/*
2 * $Id: Parameters.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/Parameters.h"
9
10namespace morpheo {
11namespace behavioural {
12namespace core {
13namespace multi_front_end {
14namespace front_end {
15namespace prediction_unit {
16namespace direction {
17
18
19#undef  FUNCTION
20#define FUNCTION "Direction::Parameters"
21  Parameters::Parameters (Tpredictor_t predictor_scheme          ,
22                          uint32_t     nb_inst_predict           ,
23                          uint32_t     nb_inst_update            ,
24                          uint32_t     size_address              ,
25                          bool         have_bht               [3],
26                          uint32_t     bht_size_shifter       [3],
27                          uint32_t     bht_nb_shifter         [3],
28                          bool         have_pht               [3],
29                          uint32_t     pht_size_counter       [3],
30                          uint32_t     pht_nb_counter         [3],
31                          uint32_t     pht_size_address_share [3],
32                          bool         is_toplevel)
33  {
34    log_printf(FUNC,Direction,FUNCTION,"Begin");
35
36    _predictor_scheme       = predictor_scheme      ;
37    _nb_inst_predict        = nb_inst_predict       ;
38    _nb_inst_update         = nb_inst_update        ;
39//  _size_address           = size_address          ;
40   
41    for (uint32_t i=0; i<3; i++)
42      {
43        _have_bht               [i] = have_bht               [i];
44        _bht_size_shifter       [i] = bht_size_shifter       [i];
45        _bht_nb_shifter         [i] = bht_nb_shifter         [i];
46        _have_pht               [i] = have_pht               [i];
47        _pht_size_counter       [i] = pht_size_counter       [i];
48        _pht_nb_counter         [i] = pht_nb_counter         [i];
49        _pht_size_address_share [i] = pht_size_address_share [i];
50      }
51
52    switch (predictor_scheme)
53      {
54      case PREDICTOR_NEVER_TAKE  :
55      case PREDICTOR_ALWAYS_TAKE :
56      case PREDICTOR_STATIC      :
57      case PREDICTOR_LAST_TAKE   : 
58        {
59          _have_component_meta_predictor = false;
60
61          for (uint32_t i=0; i<3; i++)
62            {
63              _have_bht [i] = false;
64              _have_pht [i] = false;
65            }
66
67          break;
68        }
69      case PREDICTOR_COUNTER     :
70        {
71          _have_bht [0] = false;
72          _have_pht [0] = true ;
73          for (uint32_t i=1; i<3; i++)
74            {
75              _have_bht [i] = false;
76              _have_pht [i] = false;
77            }
78
79          _have_component_meta_predictor = true;
80          break;
81        }
82      case PREDICTOR_LOCAL       :
83        {
84          _have_bht       [0] = true;
85          _have_pht       [0] = true;
86          _bht_nb_shifter [0] = (_bht_nb_shifter [0]<2)?2:_bht_nb_shifter [0]; // min : 2
87          for (uint32_t i=1; i<3; i++)
88            {
89              _have_bht [i] = false;
90              _have_pht [i] = false;
91            }
92
93          _have_component_meta_predictor = true;
94          break;
95        }
96      case PREDICTOR_GLOBAL      :
97        {
98         
99          _have_bht       [0] = true;
100          _have_pht       [0] = true;
101          _bht_nb_shifter [0] = 1; // one global shifter
102          for (uint32_t i=1; i<3; i++)
103            {
104              _have_bht [i] = false;
105              _have_pht [i] = false;
106            }
107
108          _have_component_meta_predictor = true;
109          break;
110        }
111      case PREDICTOR_META        :
112        {
113          // predictor_0 = global
114          // predictor_1 = local
115          // predictor_2 = counter : select between predictor_0 and predictor_1
116          _have_bht       [0] = true;
117          _have_pht       [0] = true;
118          _bht_nb_shifter [0] = (_bht_nb_shifter [0]<2)?2:_bht_nb_shifter [0]; // min : 2
119          _have_bht       [1] = true;
120          _have_pht       [1] = true;
121          _bht_nb_shifter [1] = 1; // one global shifter
122          _have_bht       [2] = false;
123          _have_pht       [2] = true;
124
125          _have_component_meta_predictor = true;
126          break;
127        }
128      case PREDICTOR_CUSTOM      :
129        {
130          // keep user define
131          _have_component_meta_predictor = true;
132          break;
133        }
134      }
135
136    test();
137
138    if (_have_component_meta_predictor)
139      _param_meta_predictor = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Parameters
140        (
141         _nb_inst_predict       ,
142         _nb_inst_update        ,
143          size_address          ,
144         _have_bht              ,
145         _bht_size_shifter      ,
146         _bht_nb_shifter        ,
147         _have_pht              ,
148         _pht_size_counter      ,
149         _pht_nb_counter        ,
150         _pht_size_address_share
151         );
152   
153    _size_history = (_have_component_meta_predictor)?_param_meta_predictor->_size_history:0;
154
155    log_printf(TRACE,Direction,FUNCTION,"  * size_history : %d",_size_history);
156
157//     _size_history = 0;
158//     for (uint32_t i=0; i<3; i++)
159//       _size_history += (((_have_bht [i])?_bht_size_shifter [i]:0) +
160//                         ((_have_pht [i])?_pht_size_counter [i]:0));
161   
162     _have_port_history = (_size_history > 0);
163
164    _param_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::direction_glue::Parameters
165      (_predictor_scheme,
166       _nb_inst_predict ,
167       _nb_inst_update  ,
168        size_address    ,
169       _size_history    );
170
171    if (is_toplevel)
172      {
173        _size_instruction_address = size_address;
174
175        copy ();
176      }
177   
178    log_printf(FUNC,Direction,FUNCTION,"End");
179  };
180 
181// #undef  FUNCTION
182// #define FUNCTION "Direction::Parameters (copy)"
183//   Parameters::Parameters (Parameters & param)
184//   {
185//     log_printf(FUNC,Direction,FUNCTION,"Begin");
186//     test();
187//     log_printf(FUNC,Direction,FUNCTION,"End");
188//   };
189
190#undef  FUNCTION
191#define FUNCTION "Direction::~Parameters"
192  Parameters::~Parameters () 
193  {
194    log_printf(FUNC,Direction,FUNCTION,"Begin");
195
196    delete _param_glue;
197    if (_have_component_meta_predictor)
198    delete _param_meta_predictor;
199
200    log_printf(FUNC,Direction,FUNCTION,"End");
201  };
202
203#undef  FUNCTION
204#define FUNCTION "Direction::copy"
205  void Parameters::copy (void) 
206  {
207    log_printf(FUNC,Direction,FUNCTION,"Begin");
208
209    COPY(_param_glue);
210
211    log_printf(FUNC,Direction,FUNCTION,"End");
212  };
213
214}; // end namespace direction
215}; // end namespace prediction_unit
216}; // end namespace front_end
217}; // end namespace multi_front_end
218}; // end namespace core
219
220}; // end namespace behavioural
221}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.