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

Last change on this file since 112 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: 5.4 KB
Line 
1/*
2 * $Id: Parameters.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/Meta_Predictor/include/Parameters.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 {
18namespace meta_predictor {
19
20
21#undef  FUNCTION
22#define FUNCTION "Meta_Predictor::Parameters"
23  Parameters::Parameters (uint32_t nb_inst_predict           ,
24                          uint32_t nb_inst_update            ,
25                          uint32_t size_address              ,
26                          bool     have_bht               [3],
27                          uint32_t bht_size_shifter       [3],
28                          uint32_t bht_nb_shifter         [3],
29                          bool     have_pht               [3],
30                          uint32_t pht_size_counter       [3],
31                          uint32_t pht_nb_counter         [3],
32                          uint32_t pht_size_address_share [3],
33                          bool     is_toplevel)
34  {
35    log_begin(Meta_Predictor,FUNCTION);
36
37    _nb_inst_predict            = nb_inst_predict           ;
38    _nb_inst_update             = nb_inst_update            ;
39    _size_address               = size_address              ;
40    for (uint32_t i=0; i<3; ++i)
41      {
42    _have_bht               [i] =                 have_bht               [i];
43    _bht_size_shifter       [i] = (_have_bht [i])?bht_size_shifter       [i]:0;
44    _bht_nb_shifter         [i] = (_have_bht [i])?bht_nb_shifter         [i]:0;
45    _have_pht               [i] =                 have_pht               [i];
46    _pht_size_counter       [i] = (_have_pht [i])?pht_size_counter       [i]:0;
47    _pht_nb_counter         [i] = (_have_pht [i])?pht_nb_counter         [i]:0;
48    _pht_size_address_share [i] = (_have_bht[i] and _have_pht [i])?pht_size_address_share [i]:0;
49      }
50
51    test();
52
53    _have_meta_predictor        = (_have_bht [2] or _have_pht [2]);
54    _nb_predictor               = (_have_meta_predictor)?3:1;
55   
56    ALLOC1(_predictor_update_on_prediction,bool    , _nb_predictor);
57    ALLOC1(_predictor_size_history        ,uint32_t, _nb_predictor);
58   
59    // All predictor can update on prediction ....
60    for (uint32_t i=0; i<_nb_predictor; ++i)
61      _predictor_update_on_prediction [i] = true;
62
63    // ... But the selector prediction can't
64    if (_have_meta_predictor)
65      _predictor_update_on_prediction [_nb_predictor-1] = false;
66
67//     // All predictor can't update on prediction ....
68//     for (uint32_t i=0; i<_nb_predictor; ++i)
69//       _predictor_update_on_prediction [i] = false;
70
71    _param_two_level_branch_predictor = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters * [_nb_predictor];
72    for (uint32_t i=0; i<_nb_predictor; ++i)
73      {
74        _param_two_level_branch_predictor [i] = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters
75          (_nb_inst_predict                   ,
76           _nb_inst_update                    ,
77           _size_address                      ,
78           _have_bht                       [i],
79           _bht_size_shifter               [i],
80           _bht_nb_shifter                 [i],
81           _have_pht                       [i],
82           _pht_size_counter               [i],
83           _pht_nb_counter                 [i],
84           _pht_size_address_share         [i],
85           _predictor_update_on_prediction [i]
86           );
87
88        _predictor_size_history [i] = _param_two_level_branch_predictor [i]->_size_history;
89      }
90
91    _param_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue::Parameters 
92      (
93       _nb_inst_predict               ,
94       _nb_inst_update                ,
95       _nb_predictor                  ,
96       _predictor_size_history        ,
97       _predictor_update_on_prediction
98       );
99    _size_history = _param_glue->_size_history;
100   
101    if (is_toplevel)
102      {
103        copy();
104      }
105
106    log_end(Meta_Predictor,FUNCTION);
107  };
108 
109// #undef  FUNCTION
110// #define FUNCTION "Meta_Predictor::Parameters (copy)"
111//   Parameters::Parameters (Parameters & param)
112//   {
113//     log_begin(Meta_Predictor,FUNCTION);
114//     test();
115//     log_end(Meta_Predictor,FUNCTION);
116//   };
117
118#undef  FUNCTION
119#define FUNCTION "Meta_Predictor::~Parameters"
120  Parameters::~Parameters (void) 
121  {
122    log_begin(Meta_Predictor,FUNCTION);
123
124    DELETE1(_param_two_level_branch_predictor, _nb_predictor);
125
126    DELETE1(_predictor_size_history          , _nb_predictor);
127    DELETE1(_predictor_update_on_prediction  , _nb_predictor);
128
129    log_end(Meta_Predictor,FUNCTION);
130  };
131
132#undef  FUNCTION
133#define FUNCTION "Meta_Predictor::copy"
134  void Parameters::copy (void) 
135  {
136    log_begin(Meta_Predictor,FUNCTION);
137
138    COPY(_param_glue);
139    for (uint32_t i=0; i<_nb_predictor; ++i)
140      COPY(_param_two_level_branch_predictor [i]);
141
142    log_end(Meta_Predictor,FUNCTION);
143  };
144
145}; // end namespace meta_predictor
146}; // end namespace direction
147}; // end namespace prediction_unit
148}; // end namespace front_end
149}; // end namespace multi_front_end
150}; // end namespace core
151
152}; // end namespace behavioural
153}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.