1 | /* |
---|
2 | * $Id: Parameters.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/include/Parameters.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace core { |
---|
13 | namespace multi_front_end { |
---|
14 | namespace front_end { |
---|
15 | namespace prediction_unit { |
---|
16 | namespace 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 | { |
---|
33 | log_printf(FUNC,Direction,FUNCTION,"Begin"); |
---|
34 | |
---|
35 | _predictor_scheme = predictor_scheme ; |
---|
36 | _nb_inst_predict = nb_inst_predict ; |
---|
37 | _nb_inst_update = nb_inst_update ; |
---|
38 | _size_address = size_address ; |
---|
39 | |
---|
40 | for (uint32_t i=0; i<3; i++) |
---|
41 | { |
---|
42 | _have_bht [i] = have_bht [i]; |
---|
43 | _bht_size_shifter [i] = bht_size_shifter [i]; |
---|
44 | _bht_nb_shifter [i] = bht_nb_shifter [i]; |
---|
45 | _have_pht [i] = have_pht [i]; |
---|
46 | _pht_size_counter [i] = pht_size_counter [i]; |
---|
47 | _pht_nb_counter [i] = pht_nb_counter [i]; |
---|
48 | _pht_size_address_share [i] = pht_size_address_share [i]; |
---|
49 | } |
---|
50 | |
---|
51 | switch (predictor_scheme) |
---|
52 | { |
---|
53 | case PREDICTOR_NEVER_TAKE : |
---|
54 | case PREDICTOR_ALWAYS_TAKE : |
---|
55 | case PREDICTOR_STATIC : |
---|
56 | case PREDICTOR_LAST_TAKE : |
---|
57 | { |
---|
58 | _have_component_meta_predictor = false; |
---|
59 | |
---|
60 | for (uint32_t i=0; i<3; i++) |
---|
61 | { |
---|
62 | _have_bht [i] = false; |
---|
63 | _have_pht [i] = false; |
---|
64 | } |
---|
65 | |
---|
66 | break; |
---|
67 | } |
---|
68 | case PREDICTOR_COUNTER : |
---|
69 | { |
---|
70 | _have_bht [0] = false; |
---|
71 | _have_pht [0] = true ; |
---|
72 | for (uint32_t i=1; i<3; i++) |
---|
73 | { |
---|
74 | _have_bht [i] = false; |
---|
75 | _have_pht [i] = false; |
---|
76 | } |
---|
77 | |
---|
78 | _have_component_meta_predictor = true; |
---|
79 | break; |
---|
80 | } |
---|
81 | case PREDICTOR_LOCAL : |
---|
82 | { |
---|
83 | _have_bht [0] = true; |
---|
84 | _have_pht [0] = true; |
---|
85 | _bht_nb_shifter [0] = (_bht_nb_shifter [0]<2)?2:_bht_nb_shifter [0]; // min : 2 |
---|
86 | for (uint32_t i=1; i<3; i++) |
---|
87 | { |
---|
88 | _have_bht [i] = false; |
---|
89 | _have_pht [i] = false; |
---|
90 | } |
---|
91 | |
---|
92 | _have_component_meta_predictor = true; |
---|
93 | break; |
---|
94 | } |
---|
95 | case PREDICTOR_GLOBAL : |
---|
96 | { |
---|
97 | |
---|
98 | _have_bht [0] = true; |
---|
99 | _have_pht [0] = true; |
---|
100 | _bht_nb_shifter [0] = 1; // one global shifter |
---|
101 | for (uint32_t i=1; i<3; i++) |
---|
102 | { |
---|
103 | _have_bht [i] = false; |
---|
104 | _have_pht [i] = false; |
---|
105 | } |
---|
106 | |
---|
107 | _have_component_meta_predictor = true; |
---|
108 | break; |
---|
109 | } |
---|
110 | case PREDICTOR_META : |
---|
111 | { |
---|
112 | // predictor_0 = global |
---|
113 | // predictor_1 = local |
---|
114 | // predictor_2 = counter : select between predictor_0 and predictor_1 |
---|
115 | _have_bht [0] = true; |
---|
116 | _have_pht [0] = true; |
---|
117 | _bht_nb_shifter [0] = (_bht_nb_shifter [0]<2)?2:_bht_nb_shifter [0]; // min : 2 |
---|
118 | _have_bht [1] = true; |
---|
119 | _have_pht [1] = true; |
---|
120 | _bht_nb_shifter [1] = 1; // one global shifter |
---|
121 | _have_bht [2] = false; |
---|
122 | _have_pht [2] = true; |
---|
123 | |
---|
124 | _have_component_meta_predictor = true; |
---|
125 | break; |
---|
126 | } |
---|
127 | case PREDICTOR_CUSTOM : |
---|
128 | { |
---|
129 | // keep user define |
---|
130 | _have_component_meta_predictor = true; |
---|
131 | break; |
---|
132 | } |
---|
133 | } |
---|
134 | |
---|
135 | _size_history = 0; |
---|
136 | |
---|
137 | for (uint32_t i=0; i<3; i++) |
---|
138 | _size_history += (((_have_bht [i])?_bht_size_shifter [i]:0) + |
---|
139 | ((_have_pht [i])?_pht_size_counter [i]:0)); |
---|
140 | |
---|
141 | _have_port_history = (_size_history > 0); |
---|
142 | |
---|
143 | _param_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::direction_glue::Parameters |
---|
144 | (_predictor_scheme, |
---|
145 | _nb_inst_predict , |
---|
146 | _nb_inst_update , |
---|
147 | _size_address , |
---|
148 | _size_history ); |
---|
149 | |
---|
150 | test(); |
---|
151 | |
---|
152 | log_printf(FUNC,Direction,FUNCTION,"End"); |
---|
153 | }; |
---|
154 | |
---|
155 | // #undef FUNCTION |
---|
156 | // #define FUNCTION "Direction::Parameters (copy)" |
---|
157 | // Parameters::Parameters (Parameters & param) |
---|
158 | // { |
---|
159 | // log_printf(FUNC,Direction,FUNCTION,"Begin"); |
---|
160 | // test(); |
---|
161 | // log_printf(FUNC,Direction,FUNCTION,"End"); |
---|
162 | // }; |
---|
163 | |
---|
164 | #undef FUNCTION |
---|
165 | #define FUNCTION "Direction::~Parameters" |
---|
166 | Parameters::~Parameters () |
---|
167 | { |
---|
168 | log_printf(FUNC,Direction,FUNCTION,"Begin"); |
---|
169 | |
---|
170 | delete _param_glue; |
---|
171 | log_printf(FUNC,Direction,FUNCTION,"End"); |
---|
172 | }; |
---|
173 | |
---|
174 | }; // end namespace direction |
---|
175 | }; // end namespace prediction_unit |
---|
176 | }; // end namespace front_end |
---|
177 | }; // end namespace multi_front_end |
---|
178 | }; // end namespace core |
---|
179 | |
---|
180 | }; // end namespace behavioural |
---|
181 | }; // end namespace morpheo |
---|