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

Last change on this file since 146 was 146, checked in by rosiere, 13 years ago

1) Integration of RegisterFile_Internal_Banked in RegisterFile?
2) Erase "read_write" interface in RegisterFile_Monolithic component
3) Add smith predictor parameters in Load_store_pointer_unit.
4) Fix not statistics flags

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