1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Two_Level_Branch_Predictor_Glue/include/Two_Level_Branch_Predictor_Glue.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace stage_1_ifetch { |
---|
13 | namespace predictor { |
---|
14 | namespace meta_predictor { |
---|
15 | namespace two_level_branch_predictor { |
---|
16 | namespace two_level_branch_predictor_glue { |
---|
17 | |
---|
18 | |
---|
19 | #ifdef SYSTEMC |
---|
20 | Two_Level_Branch_Predictor_Glue::Two_Level_Branch_Predictor_Glue (sc_module_name name, |
---|
21 | #else |
---|
22 | Two_Level_Branch_Predictor_Glue::Two_Level_Branch_Predictor_Glue (string name, |
---|
23 | #endif |
---|
24 | #ifdef STATISTICS |
---|
25 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
26 | #endif |
---|
27 | morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::two_level_branch_predictor_glue::Parameters param ): |
---|
28 | _name (name) |
---|
29 | ,_param (param) |
---|
30 | // #ifdef STATISTICS |
---|
31 | // ,_param_statistics (param_statistics) |
---|
32 | // #endif |
---|
33 | { |
---|
34 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"Two_Level_Branch_Predictor_Glue","Begin"); |
---|
35 | |
---|
36 | allocation (); |
---|
37 | |
---|
38 | #ifdef STATISTICS |
---|
39 | // Allocation of statistics |
---|
40 | _stat = new Statistics (static_cast<string>(_name), |
---|
41 | param_statistics , |
---|
42 | param); |
---|
43 | #endif |
---|
44 | |
---|
45 | #ifdef VHDL |
---|
46 | // generate the vhdl |
---|
47 | vhdl(); |
---|
48 | #endif |
---|
49 | |
---|
50 | #ifdef SYSTEMC |
---|
51 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
52 | SC_METHOD (transition); |
---|
53 | dont_initialize (); |
---|
54 | sensitive_pos << *(in_CLOCK); |
---|
55 | #endif |
---|
56 | |
---|
57 | SC_METHOD (genMealy_predict_ack); |
---|
58 | dont_initialize (); |
---|
59 | sensitive_neg << *(in_CLOCK); |
---|
60 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
61 | { |
---|
62 | if (_param._have_bht) |
---|
63 | sensitive << (*(in_PREDICT_BHT_ACK [i])); |
---|
64 | if (_param._have_pht) |
---|
65 | sensitive << (*(in_PREDICT_PHT_ACK [i])); |
---|
66 | } |
---|
67 | |
---|
68 | #ifdef SYSTEMCASS_SPECIFIC |
---|
69 | // List dependency information |
---|
70 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
71 | { |
---|
72 | if (_param._have_bht) |
---|
73 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_BHT_ACK [i])); |
---|
74 | if (_param._have_pht) |
---|
75 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_PHT_ACK [i])); |
---|
76 | } |
---|
77 | #endif |
---|
78 | |
---|
79 | if (_param._have_bht) |
---|
80 | { |
---|
81 | SC_METHOD (genMealy_predict_bht_address); |
---|
82 | dont_initialize (); |
---|
83 | sensitive_neg << *(in_CLOCK); |
---|
84 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
85 | sensitive << (*(in_PREDICT_ADDRESS [i])); |
---|
86 | |
---|
87 | #ifdef SYSTEMCASS_SPECIFIC |
---|
88 | // List dependency information |
---|
89 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
90 | (*(out_PREDICT_BHT_ADDRESS [i])) (*(in_PREDICT_ADDRESS [i])); |
---|
91 | #endif |
---|
92 | } |
---|
93 | |
---|
94 | if (_param._have_pht) |
---|
95 | { |
---|
96 | SC_METHOD (genMealy_predict_pht_address); |
---|
97 | dont_initialize (); |
---|
98 | sensitive_neg << *(in_CLOCK); |
---|
99 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
100 | { |
---|
101 | if (_param._have_bht) |
---|
102 | sensitive << (*(in_PREDICT_BHT_HISTORY [i])); |
---|
103 | sensitive << (*(in_PREDICT_ADDRESS [i])); |
---|
104 | } |
---|
105 | |
---|
106 | #ifdef SYSTEMCASS_SPECIFIC |
---|
107 | // List dependency information |
---|
108 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
109 | { |
---|
110 | (*(out_PREDICT_PHT_ADDRESS [i])) (*(in_PREDICT_ADDRESS [i])); |
---|
111 | if (_param._have_bht) |
---|
112 | (*(out_PREDICT_PHT_ADDRESS [i])) (*(in_PREDICT_BHT_HISTORY [i])); |
---|
113 | } |
---|
114 | #endif |
---|
115 | } |
---|
116 | |
---|
117 | SC_METHOD (genMealy_branch_complete_ack); |
---|
118 | dont_initialize (); |
---|
119 | sensitive_neg << *(in_CLOCK); |
---|
120 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
121 | { |
---|
122 | if (_param._have_bht) |
---|
123 | sensitive << (*(in_BRANCH_COMPLETE_BHT_ACK [i])); |
---|
124 | if (_param._have_pht) |
---|
125 | sensitive << (*(in_BRANCH_COMPLETE_PHT_ACK [i])); |
---|
126 | } |
---|
127 | |
---|
128 | #ifdef SYSTEMCASS_SPECIFIC |
---|
129 | // List dependency information |
---|
130 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
131 | { |
---|
132 | if (_param._have_bht) |
---|
133 | (*(out_BRANCH_COMPLETE_ACK [i])) (*(in_BRANCH_COMPLETE_BHT_ACK [i])); |
---|
134 | if (_param._have_pht) |
---|
135 | (*(out_BRANCH_COMPLETE_ACK [i])) (*(in_BRANCH_COMPLETE_PHT_ACK [i])); |
---|
136 | } |
---|
137 | #endif |
---|
138 | |
---|
139 | if (_param._have_bht) |
---|
140 | { |
---|
141 | SC_METHOD (genMealy_branch_complete_bht_address); |
---|
142 | dont_initialize (); |
---|
143 | sensitive_neg << *(in_CLOCK); |
---|
144 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
145 | sensitive << (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
146 | |
---|
147 | #ifdef SYSTEMCASS_SPECIFIC |
---|
148 | // List dependency information |
---|
149 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
150 | (*(out_BRANCH_COMPLETE_BHT_ADDRESS [i])) (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
151 | #endif |
---|
152 | } |
---|
153 | |
---|
154 | if (_param._have_pht) |
---|
155 | { |
---|
156 | SC_METHOD (genMealy_branch_complete_pht_address); |
---|
157 | dont_initialize (); |
---|
158 | sensitive_neg << *(in_CLOCK); |
---|
159 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
160 | { |
---|
161 | if (_param._have_bht) |
---|
162 | sensitive << (*(in_BRANCH_COMPLETE_BHT_HISTORY [i])); |
---|
163 | sensitive << (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
164 | } |
---|
165 | |
---|
166 | #ifdef SYSTEMCASS_SPECIFIC |
---|
167 | // List dependency information |
---|
168 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
169 | { |
---|
170 | (*(out_BRANCH_COMPLETE_PHT_ADDRESS [i])) (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
171 | if (_param._have_bht) |
---|
172 | (*(out_BRANCH_COMPLETE_PHT_ADDRESS [i])) (*(in_BRANCH_COMPLETE_BHT_HISTORY [i])); |
---|
173 | } |
---|
174 | #endif |
---|
175 | } |
---|
176 | |
---|
177 | #endif |
---|
178 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"Two_Level_Branch_Predictor_Glue","End"); |
---|
179 | }; |
---|
180 | |
---|
181 | Two_Level_Branch_Predictor_Glue::~Two_Level_Branch_Predictor_Glue (void) |
---|
182 | { |
---|
183 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"~Two_Level_Branch_Predictor_Glue","Begin"); |
---|
184 | |
---|
185 | #ifdef STATISTICS |
---|
186 | _stat->generate_file(statistics(0)); |
---|
187 | |
---|
188 | delete _stat; |
---|
189 | #endif |
---|
190 | |
---|
191 | #ifdef SYSTEMC |
---|
192 | deallocation (); |
---|
193 | #endif |
---|
194 | |
---|
195 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"~Two_Level_Branch_Predictor_Glue","End"); |
---|
196 | }; |
---|
197 | |
---|
198 | }; // end namespace two_level_branch_predictor_glue |
---|
199 | }; // end namespace two_level_branch_predictor |
---|
200 | }; // end namespace meta_predictor |
---|
201 | }; // end namespace predictor |
---|
202 | }; // end namespace stage_1_ifetch |
---|
203 | |
---|
204 | }; // end namespace behavioural |
---|
205 | }; // end namespace morpheo |
---|