source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_allocation.cpp @ 5

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

Ajout du composant Meta_Predictor

File size: 10.0 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace stage_1_ifetch {
14namespace predictor {
15namespace meta_predictor {
16namespace meta_predictor_glue {
17
18
19  void Meta_Predictor_Glue::allocation (void)
20  {
21    string rename;
22
23    log_printf(FUNC,Meta_Predictor_Glue,"allocation","Begin");
24
25#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
26    in_CLOCK  = new SC_CLOCK           ("in_CLOCK");
27#endif
28
29    // Interface Predict
30
31    if (_param._have_meta_predictor)
32      {
33     in_PREDICT_PREDICTOR_0_ACK         = new SC_IN (Tcontrol_t)     * [_param._nb_prediction     ];
34     in_PREDICT_PREDICTOR_1_ACK         = new SC_IN (Tcontrol_t)     * [_param._nb_prediction     ];
35      }                           
36     in_PREDICT_PREDICTOR_2_ACK         = new SC_IN (Tcontrol_t)     * [_param._nb_prediction     ];
37    out_PREDICT_ACK                     = new SC_OUT(Tcontrol_t)     * [_param._nb_prediction     ];
38    if (_param._have_meta_predictor)
39      {
40    if (_param._predictor_0_have_bht)
41     in_PREDICT_PREDICTOR_0_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_prediction     ];
42    if (_param._predictor_0_have_pht)
43     in_PREDICT_PREDICTOR_0_PHT_HISTORY = new SC_IN (Tpht_history_t) * [_param._nb_prediction     ];
44    if (_param._predictor_1_have_bht)
45     in_PREDICT_PREDICTOR_1_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_prediction     ];
46    if (_param._predictor_1_have_pht)
47     in_PREDICT_PREDICTOR_1_PHT_HISTORY = new SC_IN (Tpht_history_t) * [_param._nb_prediction     ];
48      }
49    if (_param._predictor_2_have_bht)
50     in_PREDICT_PREDICTOR_2_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_prediction     ];
51    if (_param._predictor_2_have_pht)
52     in_PREDICT_PREDICTOR_2_PHT_HISTORY = new SC_IN (Tpht_history_t) * [_param._nb_prediction     ];
53    out_PREDICT_HISTORY                 = new SC_OUT(Thistory_t)     * [_param._nb_prediction     ];
54    out_PREDICT_DIRECTION               = new SC_OUT(Tcontrol_t)     * [_param._nb_prediction     ];
55
56    for (uint32_t i=0; i<_param._nb_prediction; i++)
57      {
58        if (_param._have_meta_predictor)
59          {
60        rename = " in_PREDICT_PREDICTOR_0_ACK_"          +toString(i);
61         in_PREDICT_PREDICTOR_0_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
62       
63        rename = " in_PREDICT_PREDICTOR_1_ACK_"          +toString(i);
64         in_PREDICT_PREDICTOR_1_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
65          }
66        rename = " in_PREDICT_PREDICTOR_2_ACK_"          +toString(i);
67         in_PREDICT_PREDICTOR_2_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
68       
69        rename = "out_PREDICT_ACK_"                    +toString(i);
70        out_PREDICT_ACK                               [i] = new SC_OUT(Tcontrol_t)     (rename.c_str());
71
72        if (_param._have_meta_predictor)
73          {
74        if (_param._predictor_0_have_bht)
75          {
76        rename = " in_PREDICT_PREDICTOR_0_BHT_HISTORY_"+toString(i);
77         in_PREDICT_PREDICTOR_0_BHT_HISTORY           [i] = new SC_IN (Tbht_history_t) (rename.c_str());
78          }
79        if (_param._predictor_0_have_pht)
80          {
81        rename = " in_PREDICT_PREDICTOR_0_PHT_HISTORY_"+toString(i);
82         in_PREDICT_PREDICTOR_0_PHT_HISTORY           [i] = new SC_IN (Tpht_history_t) (rename.c_str());
83          }
84        if (_param._predictor_1_have_bht)
85          {
86        rename = " in_PREDICT_PREDICTOR_1_BHT_HISTORY_"+toString(i);
87         in_PREDICT_PREDICTOR_1_BHT_HISTORY           [i] = new SC_IN (Tbht_history_t) (rename.c_str());
88          }
89        if (_param._predictor_1_have_pht)
90          {
91        rename = " in_PREDICT_PREDICTOR_1_PHT_HISTORY_"+toString(i);
92         in_PREDICT_PREDICTOR_1_PHT_HISTORY           [i] = new SC_IN (Tpht_history_t) (rename.c_str());
93          }
94          }
95        if (_param._predictor_2_have_bht)
96          {
97        rename = " in_PREDICT_PREDICTOR_2_BHT_HISTORY_"+toString(i);
98         in_PREDICT_PREDICTOR_2_BHT_HISTORY           [i] = new SC_IN (Tbht_history_t) (rename.c_str());
99          }
100        if (_param._predictor_2_have_pht)
101          {
102        rename = " in_PREDICT_PREDICTOR_2_PHT_HISTORY_"+toString(i);
103         in_PREDICT_PREDICTOR_2_PHT_HISTORY           [i] = new SC_IN (Tpht_history_t) (rename.c_str());
104          }
105        rename = "out_PREDICT_HISTORY_"                +toString(i);
106        out_PREDICT_HISTORY                           [i] = new SC_OUT(Thistory_t)     (rename.c_str());
107
108        rename = "out_PREDICT_DIRECTION_"              +toString(i);
109        out_PREDICT_DIRECTION                         [i] = new SC_OUT(Tcontrol_t)     (rename.c_str());
110      }
111
112    // Interface Branch_complete
113   
114    if (_param._have_meta_predictor)
115      {
116     in_BRANCH_COMPLETE_VAL                     = new SC_IN (Tcontrol_t)     * [_param._nb_branch_complete     ];
117    out_BRANCH_COMPLETE_PREDICTOR_2_VAL         = new SC_OUT(Tcontrol_t)     * [_param._nb_branch_complete     ];
118
119     in_BRANCH_COMPLETE_PREDICTOR_0_ACK         = new SC_IN (Tcontrol_t)     * [_param._nb_branch_complete     ];
120     in_BRANCH_COMPLETE_PREDICTOR_1_ACK         = new SC_IN (Tcontrol_t)     * [_param._nb_branch_complete     ];
121      }                           
122     in_BRANCH_COMPLETE_PREDICTOR_2_ACK         = new SC_IN (Tcontrol_t)     * [_param._nb_branch_complete     ];
123    out_BRANCH_COMPLETE_ACK                     = new SC_OUT(Tcontrol_t)     * [_param._nb_branch_complete     ];
124    if (_param._have_meta_predictor)
125      {
126    if (_param._predictor_0_have_bht)
127    out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY = new SC_OUT(Tbht_history_t) * [_param._nb_branch_complete     ];
128    if (_param._predictor_0_have_pht)
129    out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY = new SC_OUT(Tpht_history_t) * [_param._nb_branch_complete     ];
130    if (_param._predictor_1_have_bht)
131    out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY = new SC_OUT(Tbht_history_t) * [_param._nb_branch_complete     ];
132    if (_param._predictor_1_have_pht)
133    out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY = new SC_OUT(Tpht_history_t) * [_param._nb_branch_complete     ];
134      }
135    if (_param._predictor_2_have_bht)
136    out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY = new SC_OUT(Tbht_history_t) * [_param._nb_branch_complete     ];
137    if (_param._predictor_2_have_pht)
138    out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY = new SC_OUT(Tpht_history_t) * [_param._nb_branch_complete     ];
139     in_BRANCH_COMPLETE_HISTORY                 = new SC_IN (Thistory_t)     * [_param._nb_branch_complete     ];
140    if (_param._have_meta_predictor)
141      {
142     in_BRANCH_COMPLETE_DIRECTION               = new SC_IN (Tcontrol_t)     * [_param._nb_branch_complete     ];
143    out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION   = new SC_OUT(Tcontrol_t)     * [_param._nb_branch_complete     ];
144      }
145    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
146      {
147        if (_param._have_meta_predictor)
148          {
149        rename = " in_BRANCH_COMPLETE_VAL_"                      +toString(i);
150         in_BRANCH_COMPLETE_VAL                               [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
151       
152        rename = "out_BRANCH_COMPLETE_PREDICTOR_2_VAL_"          +toString(i);
153        out_BRANCH_COMPLETE_PREDICTOR_2_VAL                   [i] = new SC_OUT(Tcontrol_t)     (rename.c_str());
154
155        rename = " in_BRANCH_COMPLETE_PREDICTOR_0_ACK_"          +toString(i);
156         in_BRANCH_COMPLETE_PREDICTOR_0_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
157       
158        rename = " in_BRANCH_COMPLETE_PREDICTOR_1_ACK_"          +toString(i);
159         in_BRANCH_COMPLETE_PREDICTOR_1_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
160          }
161        rename = " in_BRANCH_COMPLETE_PREDICTOR_2_ACK_"          +toString(i);
162         in_BRANCH_COMPLETE_PREDICTOR_2_ACK                   [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
163       
164        rename = "out_BRANCH_COMPLETE_ACK_"                    +toString(i);
165        out_BRANCH_COMPLETE_ACK                               [i] = new SC_OUT(Tcontrol_t)     (rename.c_str());
166
167        if (_param._have_meta_predictor)
168          {
169        if (_param._predictor_0_have_bht)
170          {
171        rename = "out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY_"+toString(i);
172        out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY           [i] = new SC_OUT(Tbht_history_t) (rename.c_str());
173          }
174        if (_param._predictor_0_have_pht)
175          {
176        rename = "out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY_"+toString(i);
177        out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY           [i] = new SC_OUT(Tpht_history_t) (rename.c_str());
178          }
179        if (_param._predictor_1_have_bht)
180          {
181        rename = "out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY_"+toString(i);
182        out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY           [i] = new SC_OUT(Tbht_history_t) (rename.c_str());
183          }
184        if (_param._predictor_1_have_pht)
185          {
186        rename = "out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY_"+toString(i);
187        out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY           [i] = new SC_OUT(Tpht_history_t) (rename.c_str());
188          }
189          }
190        if (_param._predictor_2_have_bht)
191          {
192        rename = "out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY_"+toString(i);
193        out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY           [i] = new SC_OUT(Tbht_history_t) (rename.c_str());
194          }
195        if (_param._predictor_2_have_pht)
196          {
197        rename = "out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY_"+toString(i);
198        out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY           [i] = new SC_OUT(Tpht_history_t) (rename.c_str());
199          }
200        rename = " in_BRANCH_COMPLETE_HISTORY_"                +toString(i);
201         in_BRANCH_COMPLETE_HISTORY                           [i] = new SC_IN (Thistory_t)     (rename.c_str());
202
203        if (_param._have_meta_predictor)
204          {
205        rename = " in_BRANCH_COMPLETE_DIRECTION_"              +toString(i);
206         in_BRANCH_COMPLETE_DIRECTION                         [i] = new SC_IN (Tcontrol_t)     (rename.c_str());
207
208        rename = "out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION_"  +toString(i);
209        out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION             [i] = new SC_OUT(Tcontrol_t)     (rename.c_str());
210          }
211      }
212    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
213
214    log_printf(FUNC,Meta_Predictor_Glue,"allocation","End");
215  };
216
217}; // end namespace meta_predictor_glue
218}; // end namespace meta_predictor
219}; // end namespace predictor
220}; // end namespace stage_1_ifetch
221
222}; // end namespace behavioural
223}; // end namespace morpheo             
224#endif
Note: See TracBrowser for help on using the repository browser.