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