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 | #ifdef STATISTICS |
---|
37 | // Allocation of statistics |
---|
38 | _stat = new Statistics (static_cast<string>(_name), |
---|
39 | param_statistics , |
---|
40 | param); |
---|
41 | #endif |
---|
42 | |
---|
43 | #ifdef VHDL_TESTBENCH |
---|
44 | // Creation of a testbench |
---|
45 | // -> port |
---|
46 | // -> clock's signals |
---|
47 | _vhdl_testbench = new Vhdl_Testbench (_name); |
---|
48 | vhdl_testbench_port (); |
---|
49 | _vhdl_testbench->set_clock ("in_CLOCK",false); |
---|
50 | #endif |
---|
51 | |
---|
52 | #ifdef VHDL |
---|
53 | // generate the vhdl |
---|
54 | vhdl(); |
---|
55 | #endif |
---|
56 | |
---|
57 | #ifdef SYSTEMC |
---|
58 | allocation (); |
---|
59 | |
---|
60 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
61 | SC_METHOD (transition); |
---|
62 | dont_initialize (); |
---|
63 | sensitive_pos << *(in_CLOCK); |
---|
64 | #endif |
---|
65 | |
---|
66 | SC_METHOD (genMealy_predict_ack); |
---|
67 | dont_initialize (); |
---|
68 | sensitive_neg << *(in_CLOCK); |
---|
69 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
70 | { |
---|
71 | if (_param._have_bht) |
---|
72 | sensitive << (*(in_PREDICT_BHT_ACK [i])); |
---|
73 | if (_param._have_pht) |
---|
74 | sensitive << (*(in_PREDICT_PHT_ACK [i])); |
---|
75 | } |
---|
76 | |
---|
77 | #ifdef SYSTEMCASS_SPECIFIC |
---|
78 | // List dependency information |
---|
79 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
80 | { |
---|
81 | if (_param._have_bht) |
---|
82 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_BHT_ACK [i])); |
---|
83 | if (_param._have_pht) |
---|
84 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_PHT_ACK [i])); |
---|
85 | } |
---|
86 | #endif |
---|
87 | |
---|
88 | if (_param._have_bht) |
---|
89 | { |
---|
90 | SC_METHOD (genMealy_predict_bht_address); |
---|
91 | dont_initialize (); |
---|
92 | sensitive_neg << *(in_CLOCK); |
---|
93 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
94 | sensitive << (*(in_PREDICT_ADDRESS [i])); |
---|
95 | |
---|
96 | #ifdef SYSTEMCASS_SPECIFIC |
---|
97 | // List dependency information |
---|
98 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
99 | (*(out_PREDICT_BHT_ADDRESS [i])) (*(in_PREDICT_ADDRESS [i])); |
---|
100 | #endif |
---|
101 | } |
---|
102 | |
---|
103 | if (_param._have_pht) |
---|
104 | { |
---|
105 | SC_METHOD (genMealy_predict_pht_address); |
---|
106 | dont_initialize (); |
---|
107 | sensitive_neg << *(in_CLOCK); |
---|
108 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
109 | { |
---|
110 | if (_param._have_bht) |
---|
111 | sensitive << (*(in_PREDICT_BHT_HISTORY [i])); |
---|
112 | sensitive << (*(in_PREDICT_ADDRESS [i])); |
---|
113 | } |
---|
114 | |
---|
115 | #ifdef SYSTEMCASS_SPECIFIC |
---|
116 | // List dependency information |
---|
117 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
118 | { |
---|
119 | (*(out_PREDICT_PHT_ADDRESS [i])) (*(in_PREDICT_ADDRESS [i])); |
---|
120 | if (_param._have_bht) |
---|
121 | (*(out_PREDICT_PHT_ADDRESS [i])) (*(in_PREDICT_BHT_HISTORY [i])); |
---|
122 | } |
---|
123 | #endif |
---|
124 | } |
---|
125 | |
---|
126 | SC_METHOD (genMealy_branch_complete_ack); |
---|
127 | dont_initialize (); |
---|
128 | sensitive_neg << *(in_CLOCK); |
---|
129 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
130 | { |
---|
131 | if (_param._have_bht) |
---|
132 | sensitive << (*(in_BRANCH_COMPLETE_BHT_ACK [i])); |
---|
133 | if (_param._have_pht) |
---|
134 | sensitive << (*(in_BRANCH_COMPLETE_PHT_ACK [i])); |
---|
135 | } |
---|
136 | |
---|
137 | #ifdef SYSTEMCASS_SPECIFIC |
---|
138 | // List dependency information |
---|
139 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
140 | { |
---|
141 | if (_param._have_bht) |
---|
142 | (*(out_BRANCH_COMPLETE_ACK [i])) (*(in_BRANCH_COMPLETE_BHT_ACK [i])); |
---|
143 | if (_param._have_pht) |
---|
144 | (*(out_BRANCH_COMPLETE_ACK [i])) (*(in_BRANCH_COMPLETE_PHT_ACK [i])); |
---|
145 | } |
---|
146 | #endif |
---|
147 | |
---|
148 | if (_param._have_bht) |
---|
149 | { |
---|
150 | SC_METHOD (genMealy_branch_complete_bht_address); |
---|
151 | dont_initialize (); |
---|
152 | sensitive_neg << *(in_CLOCK); |
---|
153 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
154 | sensitive << (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
155 | |
---|
156 | #ifdef SYSTEMCASS_SPECIFIC |
---|
157 | // List dependency information |
---|
158 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
159 | (*(out_BRANCH_COMPLETE_BHT_ADDRESS [i])) (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
160 | #endif |
---|
161 | } |
---|
162 | |
---|
163 | if (_param._have_pht) |
---|
164 | { |
---|
165 | SC_METHOD (genMealy_branch_complete_pht_address); |
---|
166 | dont_initialize (); |
---|
167 | sensitive_neg << *(in_CLOCK); |
---|
168 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
169 | { |
---|
170 | if (_param._have_bht) |
---|
171 | sensitive << (*(in_BRANCH_COMPLETE_BHT_HISTORY [i])); |
---|
172 | sensitive << (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
173 | } |
---|
174 | |
---|
175 | #ifdef SYSTEMCASS_SPECIFIC |
---|
176 | // List dependency information |
---|
177 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
178 | { |
---|
179 | (*(out_BRANCH_COMPLETE_PHT_ADDRESS [i])) (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
180 | if (_param._have_bht) |
---|
181 | (*(out_BRANCH_COMPLETE_PHT_ADDRESS [i])) (*(in_BRANCH_COMPLETE_BHT_HISTORY [i])); |
---|
182 | } |
---|
183 | #endif |
---|
184 | } |
---|
185 | |
---|
186 | #endif |
---|
187 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"Two_Level_Branch_Predictor_Glue","End"); |
---|
188 | }; |
---|
189 | |
---|
190 | Two_Level_Branch_Predictor_Glue::~Two_Level_Branch_Predictor_Glue (void) |
---|
191 | { |
---|
192 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"~Two_Level_Branch_Predictor_Glue","Begin"); |
---|
193 | |
---|
194 | #ifdef VHDL_TESTBENCH |
---|
195 | // generate the test bench |
---|
196 | _vhdl_testbench->generate_file(); |
---|
197 | delete _vhdl_testbench; |
---|
198 | #endif |
---|
199 | |
---|
200 | #ifdef STATISTICS |
---|
201 | _stat->generate_file(statistics(0)); |
---|
202 | |
---|
203 | delete _stat; |
---|
204 | #endif |
---|
205 | |
---|
206 | #ifdef SYSTEMC |
---|
207 | deallocation (); |
---|
208 | #endif |
---|
209 | |
---|
210 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"~Two_Level_Branch_Predictor_Glue","End"); |
---|
211 | }; |
---|
212 | |
---|
213 | }; // end namespace two_level_branch_predictor_glue |
---|
214 | }; // end namespace two_level_branch_predictor |
---|
215 | }; // end namespace meta_predictor |
---|
216 | }; // end namespace predictor |
---|
217 | }; // end namespace stage_1_ifetch |
---|
218 | |
---|
219 | }; // end namespace behavioural |
---|
220 | }; // end namespace morpheo |
---|