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

Last change on this file since 42 was 42, checked in by rosiere, 17 years ago

Modification des classes d'encapsulation des interfaces :

  • gère les signaux à écrire dans le vhdl
  • les traces pour le testbench
  • la génération des vhdl structurelles

-> test sur la Pattern History Table

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