source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.cpp @ 3

Last change on this file since 3 was 3, checked in by kane, 17 years ago

1) Ajout d'un "printer" XML pour la configuration de paramètres

2) Fin du composant "Two_Level_Branch_Predictor"

validation * systemc

  • vhdl
File size: 5.8 KB
Line 
1/*
2 * $Id$
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h"
9
10namespace morpheo {
11namespace behavioural {
12namespace stage_1_ifetch {
13namespace predictor {
14namespace meta_predictor {
15namespace two_level_branch_predictor {
16
17
18  Parameters::Parameters (bool     have_bht              ,
19                          uint32_t bht_size_shifter      ,
20                          uint32_t bht_nb_shifter        ,
21                          bool     have_pht              ,
22                          uint32_t pht_size_counter      ,
23                          uint32_t pht_nb_counter        ,
24                          uint32_t pht_size_address_share,
25                          uint32_t size_address          ,
26                          uint32_t nb_prediction         ,
27                          uint32_t nb_branch_complete    ) : 
28    _have_bht               (have_bht          ),
29    _bht_size_shifter       ((_have_bht == true)?bht_size_shifter:0),
30    _bht_nb_shifter         ((_have_bht == true)?bht_nb_shifter  :0),
31    _have_pht               (have_pht          ),
32    _pht_size_counter       ((_have_pht == true)?pht_size_counter:0),
33    _pht_nb_counter         ((_have_pht == true)?pht_nb_counter  :0),
34    _pht_size_address_share (((_have_bht and _have_pht) == true)?pht_size_address_share:0),
35    _size_address           (size_address      ),
36    _nb_prediction          (nb_prediction     ),
37    _nb_branch_complete     (nb_branch_complete),
38    _bht_size_address       (static_cast<uint32_t>(ceil(log2(bht_nb_shifter)))),
39    _pht_size_address       (static_cast<uint32_t>(ceil(log2(pht_nb_counter))))
40  {
41    log_printf(FUNC,Two_Level_Branch_Predictor,"Parameters","Begin");
42   
43    if (_have_bht)
44    _param_branch_history_table  = new morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::branch_history_table ::Parameters (_bht_size_shifter  ,
45                                                                                                                                                                       _bht_nb_shifter    ,
46                                                                                                                                                                       _nb_prediction     ,
47                                                                                                                                                                       _nb_branch_complete);
48    if (_have_pht)
49    _param_pattern_history_table = new morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::pattern_history_table::Parameters (_pht_size_counter  ,
50                                                                                                                                                                       _pht_nb_counter    ,
51                                                                                                                                                                       _nb_prediction     ,
52                                                                                                                                                                       _nb_branch_complete);
53   
54                                                     
55    _param_two_level_branch_predictor_glue = new morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::two_level_branch_predictor_glue::Parameters (_have_bht              ,
56                                                                                                                                                                                           _bht_size_shifter      ,
57                                                                                                                                                                                           _bht_size_address      ,
58                                                                                                                                                                                           _have_pht              ,
59                                                                                                                                                                                           _pht_size_address      ,
60                                                                                                                                                                                           _pht_size_address_share,
61                                                                                                                                                                                           _size_address          ,
62                                                                                                                                                                                           _nb_prediction         ,
63                                                                                                                                                                                           _nb_branch_complete    );
64
65    test();
66    log_printf(FUNC,Two_Level_Branch_Predictor,"Parameters","End");
67  };
68 
69  Parameters::Parameters (Parameters & param) :
70    _have_bht               (param._have_bht              ),
71    _bht_size_shifter       (param._bht_size_shifter      ),
72    _bht_nb_shifter         (param._bht_nb_shifter        ),
73    _have_pht               (param._have_pht              ),
74    _pht_size_counter       (param._pht_size_counter      ),
75    _pht_nb_counter         (param._pht_nb_counter        ),
76    _pht_size_address_share (param._pht_size_address_share),
77    _size_address           (param._size_address          ),
78    _nb_prediction          (param._nb_prediction         ),
79    _nb_branch_complete     (param._nb_branch_complete    ),
80    _bht_size_address       (param._bht_size_address      ),
81    _pht_size_address       (param._pht_size_address      )
82
83  {
84    log_printf(FUNC,Two_Level_Branch_Predictor,"Parameters","Begin");
85
86    if (_have_bht)
87    _param_branch_history_table  = new morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::branch_history_table ::Parameters (_bht_size_shifter  ,
88                                                                                                                                                                       _bht_nb_shifter    ,
89                                                                                                                                                                       _nb_prediction     ,
90                                                                                                                                                                       _nb_branch_complete);
91    if (_have_pht)
92    _param_pattern_history_table = new morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::pattern_history_table::Parameters (_pht_size_counter  ,
93                                                                                                                                                                       _pht_nb_counter    ,
94                                                                                                                                                                       _nb_prediction     ,
95                                                                                                                                                                       _nb_branch_complete);
96
97    _param_two_level_branch_predictor_glue = new morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::two_level_branch_predictor_glue::Parameters (_have_bht              ,
98                                                                                                                                                                                           _bht_size_shifter      ,
99                                                                                                                                                                                           _bht_size_address      ,
100                                                                                                                                                                                           _have_pht              ,
101                                                                                                                                                                                           _pht_size_address      ,
102                                                                                                                                                                                           _pht_size_address_share,
103                                                                                                                                                                                           _size_address          ,
104                                                                                                                                                                                           _nb_prediction         ,
105                                                                                                                                                                                           _nb_branch_complete    );
106
107    test();
108    log_printf(FUNC,Two_Level_Branch_Predictor,"Parameters","End");
109  };
110
111  Parameters::~Parameters () 
112  {
113    log_printf(FUNC,Two_Level_Branch_Predictor,"~Parameters","Begin");
114
115    if (_have_bht)
116    delete _param_branch_history_table;
117    if (_have_pht)
118    delete _param_pattern_history_table;
119    delete _param_two_level_branch_predictor_glue;
120    log_printf(FUNC,Two_Level_Branch_Predictor,"~Parameters","End");
121  };
122
123}; // end namespace two_level_branch_predictor
124}; // end namespace meta_predictor
125}; // end namespace predictor
126}; // end namespace stage_1_ifetch
127
128}; // end namespace behavioural
129}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.