source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/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: 8.4 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/include/Parameters.h"
9#include "Common/include/Max.h"
10
11namespace morpheo {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17
18
19#undef  FUNCTION
20#define FUNCTION "Prediction_unit::Parameters"
21  Parameters::Parameters (uint32_t       nb_context                    ,
22                          uint32_t       nb_decod_unit                 ,
23                          uint32_t       size_address                  ,
24                          uint32_t *     nb_instruction                ,//[nb_context]
25                          uint32_t *     nb_inst_decod                 ,//[nb_decod_unit]
26                          uint32_t       nb_inst_branch_predict        ,
27                          uint32_t       nb_inst_branch_decod          ,
28                          uint32_t       nb_inst_branch_update         ,
29                          uint32_t       nb_inst_branch_complete       ,
30                          uint32_t       btb_size_queue                ,
31                          uint32_t       btb_associativity             ,
32                          uint32_t       btb_size_counter              ,
33                          Tvictim_t      btb_victim_scheme             ,
34                          Tpredictor_t   dir_predictor_scheme          ,
35                          bool           dir_have_bht               [3],
36                          uint32_t       dir_bht_size_shifter       [3],
37                          uint32_t       dir_bht_nb_shifter         [3],
38                          bool           dir_have_pht               [3],
39                          uint32_t       dir_pht_size_counter       [3],
40                          uint32_t       dir_pht_nb_counter         [3],
41                          uint32_t       dir_pht_size_address_share [3],
42                          Tpht_scheme_t  dir_pht_scheme             [3],
43                          uint32_t *     ras_size_queue                ,//[nb_context]
44                          uint32_t *     upt_size_queue                ,//[nb_context]
45                          uint32_t *     ufpt_size_queue               ,//[nb_context]
46                          uint32_t       nb_thread                           ,
47                          uint32_t *     translate_num_context_to_num_thread ,//[nb_context]                   
48                          bool           is_toplevel
49                          )
50  {
51    log_printf(FUNC,Prediction_unit,FUNCTION,"Begin");
52   
53    _nb_context                 = nb_context                ;
54    _nb_decod_unit              = nb_decod_unit             ;
55    _size_address               = size_address              ;
56    _nb_instruction             = nb_instruction            ;
57    _nb_inst_decod              = nb_inst_decod             ;
58    _nb_inst_branch_predict     = nb_inst_branch_predict    ;
59    _nb_inst_branch_decod       = nb_inst_branch_decod      ;
60    _nb_inst_branch_update      = nb_inst_branch_update     ;
61    _nb_inst_branch_complete    = nb_inst_branch_complete   ;
62    _btb_size_queue             = btb_size_queue            ;
63    _btb_associativity          = btb_associativity         ;
64    _btb_size_counter           = btb_size_counter          ;
65    _btb_victim_scheme          = btb_victim_scheme         ;
66    _dir_predictor_scheme       = dir_predictor_scheme      ;
67    for (uint32_t i=0; i<3; i++)
68      {
69        _dir_have_bht               [i] = dir_have_bht               [i];
70        _dir_bht_size_shifter       [i] = dir_bht_size_shifter       [i];
71        _dir_bht_nb_shifter         [i] = dir_bht_nb_shifter         [i];
72        _dir_have_pht               [i] = dir_have_pht               [i];
73        _dir_pht_size_counter       [i] = dir_pht_size_counter       [i];
74        _dir_pht_nb_counter         [i] = dir_pht_nb_counter         [i];
75        _dir_pht_size_address_share [i] = dir_pht_size_address_share [i];
76        _dir_pht_scheme             [i] = dir_pht_scheme             [i];
77      }
78    _ras_size_queue             = ras_size_queue            ;
79    _upt_size_queue             = upt_size_queue            ;
80    _ufpt_size_queue            = ufpt_size_queue           ;
81    _nb_thread                           = nb_thread                          ;
82    _translate_num_context_to_num_thread = translate_num_context_to_num_thread;
83   
84    _array_size_depth           = new uint32_t [_nb_context];
85    _size_ras_index             = new uint32_t [_nb_context];
86
87    for (uint32_t i=0; i<_nb_context; i++)
88      {
89        _array_size_depth [i] = log2(_upt_size_queue [i]);
90        _size_ras_index   [i] = log2(_ras_size_queue [i]);
91      }
92
93    _param_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::prediction_unit_glue   ::Parameters
94      (_nb_context            ,
95       _nb_decod_unit         ,
96       _size_address          ,
97       _nb_instruction        ,
98       _array_size_depth      ,
99       _nb_inst_decod         ,
100       _nb_inst_branch_predict,
101       _nb_inst_branch_decod  ,
102       _nb_inst_branch_update );
103
104    _param_btb  = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer   ::Parameters
105      (_nb_context            ,
106       _nb_instruction        ,
107       _btb_size_queue        ,
108       _btb_associativity     ,
109       _size_address          ,
110       _btb_size_counter      ,
111       _nb_inst_branch_predict,
112       _nb_inst_branch_decod  ,
113       _nb_inst_branch_update ,
114       _btb_victim_scheme     );
115   
116    _param_dir  = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction              ::Parameters
117      (_dir_predictor_scheme      ,
118       _nb_inst_branch_predict    ,
119       _nb_inst_branch_update     ,
120       _size_address              ,
121       _dir_have_bht              ,
122       _dir_bht_size_shifter      ,
123       _dir_bht_nb_shifter        ,
124       _dir_have_pht              ,
125       _dir_pht_size_counter      ,
126       _dir_pht_nb_counter        ,
127       _dir_pht_size_address_share,
128       _dir_pht_scheme
129       );
130
131    _size_history      = _param_dir->_size_history;
132    _have_port_history = (_size_history > 0);
133
134    _param_ras  = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::return_address_stack   ::Parameters
135      (_nb_context            ,
136       _ras_size_queue        ,
137       _size_address          ,
138       _nb_inst_branch_predict,
139       _nb_inst_branch_decod  ,
140       _nb_inst_branch_update );
141
142    _param_upt  = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::Parameters
143      (_nb_context             ,
144       _upt_size_queue         ,
145       _ufpt_size_queue        ,
146       _size_address           ,
147       _nb_inst_branch_predict ,
148       _nb_inst_branch_decod   ,
149       _nb_inst_branch_complete,
150       _nb_inst_branch_update  ,
151       _size_history           ,
152       _size_ras_index         ,
153       _nb_thread              ,
154       _translate_num_context_to_num_thread
155       );
156
157
158    if (is_toplevel)
159      {
160        _size_context_id           = log2(_nb_context);
161        _size_depth                = max<uint32_t>(_array_size_depth,_nb_context);
162        _size_inst_ifetch_ptr      = log2(max<uint32_t>(_nb_instruction,_nb_context));
163        _size_instruction_address  = size_address;
164//      _size_nb_inst_decod        = ;
165//      _size_nb_inst_commit       = ;
166//      _size_ifetch_queue_ptr     = ;
167   
168        _have_port_context_id      = (_size_context_id > 0);
169        _have_port_depth           = (_size_depth  > 0);
170        _have_port_inst_ifetch_ptr = _size_inst_ifetch_ptr > 0;
171//      _have_port_ifetch_queue_ptr= _size_ifetch_queue_ptr > 0;
172
173        copy ();
174      }
175
176    test();
177    log_printf(FUNC,Prediction_unit,FUNCTION,"End");
178  };
179 
180// #undef  FUNCTION
181// #define FUNCTION "Prediction_unit::Parameters (copy)"
182//   Parameters::Parameters (Parameters & param)
183//   {
184//     log_printf(FUNC,Prediction_unit,FUNCTION,"Begin");
185//     test();
186//     log_printf(FUNC,Prediction_unit,FUNCTION,"End");
187//   };
188
189#undef  FUNCTION
190#define FUNCTION "Prediction_unit::~Parameters"
191  Parameters::~Parameters () 
192  {
193    log_printf(FUNC,Prediction_unit,FUNCTION,"Begin");
194 
195    delete _param_btb;
196    delete _param_dir;
197    delete _param_ras;
198    delete _param_upt;
199    delete _param_glue;
200
201    delete [] _array_size_depth;
202    delete [] _size_ras_index;
203
204    log_printf(FUNC,Prediction_unit,FUNCTION,"End");
205  };
206
207#undef  FUNCTION
208#define FUNCTION "Prediction_unit::copy"
209  void Parameters::copy (void) 
210  {
211    log_printf(FUNC,Prediction_unit,FUNCTION,"Begin");
212 
213    COPY(_param_btb );
214    COPY(_param_dir );
215    COPY(_param_ras );
216    COPY(_param_upt );
217    COPY(_param_glue);
218
219    log_printf(FUNC,Prediction_unit,FUNCTION,"End");
220  };
221
222}; // end namespace prediction_unit
223}; // end namespace front_end
224}; // end namespace multi_front_end
225}; // end namespace core
226
227}; // end namespace behavioural
228}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.