source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/src/Meta_Predictor_vhdl_body.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: 13.9 KB
Line 
1#ifdef VHDL
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/include/Meta_Predictor.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace stage_1_ifetch {
14namespace predictor {
15namespace meta_predictor {
16
17
18  void Meta_Predictor::vhdl_body (Vhdl & vhdl)
19  {
20    log_printf(FUNC,Meta_Predictor,"vhdl_body","Begin");
21    vhdl.set_body ("");
22
23    list<string> list_port_map;
24
25    // =====[ component_Meta_Predictor_Glue ]=============================
26   
27    list_port_map.clear();
28    log_printf(INFO,Meta_Predictor,"vhdl_body","Instanciation : component_Meta_Predictor_Glue");
29   
30    // Instantiation
31
32    // Interface Predict
33    for (uint32_t i=0; i<_param._nb_prediction; i++)
34      {
35        if (_param._have_meta_predictor)
36          {
37        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_PREDICTOR_0_ACK_"+toString(i)+"               ", "signal_PREDICT_PREDICTOR_0_ACK_"+toString(i));
38        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_PREDICTOR_1_ACK_"+toString(i)+"               ", "signal_PREDICT_PREDICTOR_1_ACK_"+toString(i));
39          }                                                                                                                   
40        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_PREDICTOR_2_ACK_"+toString(i)+"               ", "signal_PREDICT_PREDICTOR_2_ACK_"+toString(i));
41        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_ACK_"+toString(i)+"                           ", "   out_PREDICT_ACK_"+toString(i));
42        if (_param._have_meta_predictor)
43          {                                                                                                                   
44        if (_param._predictor_0_have_bht)
45        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_PREDICTOR_0_BHT_HISTORY_"+toString(i)+"       ", "signal_PREDICT_PREDICTOR_0_BHT_HISTORY_"+toString(i));
46        if (_param._predictor_0_have_pht)
47        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_PREDICTOR_0_PHT_HISTORY_"+toString(i)+"       ", "signal_PREDICT_PREDICTOR_0_PHT_HISTORY_"+toString(i));
48        if (_param._predictor_1_have_bht)
49        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_PREDICTOR_1_BHT_HISTORY_"+toString(i)+"       ", "signal_PREDICT_PREDICTOR_1_BHT_HISTORY_"+toString(i));
50        if (_param._predictor_1_have_pht)
51        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_PREDICTOR_1_PHT_HISTORY_"+toString(i)+"       ", "signal_PREDICT_PREDICTOR_1_PHT_HISTORY_"+toString(i));
52          }                                                                                                                   
53        if (_param._predictor_2_have_bht)
54        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_PREDICTOR_2_BHT_HISTORY_"+toString(i)+"       ", "signal_PREDICT_PREDICTOR_2_BHT_HISTORY_"+toString(i));
55        if (_param._predictor_2_have_pht)
56        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_PREDICTOR_2_PHT_HISTORY_"+toString(i)+"       ", "signal_PREDICT_PREDICTOR_2_PHT_HISTORY_"+toString(i));
57        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_HISTORY_"+toString(i)+"                       ", "   out_PREDICT_HISTORY_"+toString(i));
58        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_DIRECTION_"+toString(i)+"                     ", "   out_PREDICT_DIRECTION_"+toString(i));
59      }
60
61    // Interface Branch_complete
62   
63    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
64      {
65        if (_param._have_meta_predictor)
66          {
67        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_VAL_"+toString(i)+"                    ", "    in_BRANCH_COMPLETE_VAL_"+toString(i));
68        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_PREDICTOR_2_VAL_"+toString(i)+"        ", "signal_BRANCH_COMPLETE_PREDICTOR_2_VAL_"+toString(i));
69
70        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_PREDICTOR_0_ACK_"+toString(i)+"        ", "signal_BRANCH_COMPLETE_PREDICTOR_0_ACK_"+toString(i));
71        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_PREDICTOR_1_ACK_"+toString(i)+"        ", "signal_BRANCH_COMPLETE_PREDICTOR_1_ACK_"+toString(i));
72          }                                     
73        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_PREDICTOR_2_ACK_"+toString(i)+"        ", "signal_BRANCH_COMPLETE_PREDICTOR_2_ACK_"+toString(i));
74        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_ACK_"+toString(i)+"                    ", "   out_BRANCH_COMPLETE_ACK_"+toString(i));
75                                               
76        if (_param._have_meta_predictor)       
77          {                                     
78        if (_param._predictor_0_have_bht)
79        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY_"+toString(i));
80        if (_param._predictor_0_have_pht)
81        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY_"+toString(i));
82        if (_param._predictor_1_have_bht)
83        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY_"+toString(i));
84        if (_param._predictor_1_have_pht)
85        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY_"+toString(i));
86          }                                     
87        if (_param._predictor_2_have_bht)
88        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY_"+toString(i));
89        if (_param._predictor_2_have_pht)
90        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY_"+toString(i));
91        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_HISTORY_"+toString(i)+"                ", "    in_BRANCH_COMPLETE_HISTORY_"+toString(i));
92        if (_param._have_meta_predictor)       
93          {
94        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+"              ", "    in_BRANCH_COMPLETE_DIRECTION_"+toString(i));
95        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION_"+toString(i)+"  ", "signal_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION_"+toString(i));
96          }
97      }
98
99    vhdl.set_body_component ("component_Meta_Predictor_Glue",_name+"_Meta_Predictor_Glue",list_port_map);
100
101    // =====[ component_Two_Level_Branch_Predictor_2 ]====================   
102
103    list_port_map.clear();
104    log_printf(INFO,Meta_Predictor,"vhdl_body","Instanciation : component_Two_Level_Branch_Predictor_2");
105   
106    // Instantiation
107    vhdl.set_body_component_port_map (list_port_map,"in_CLOCK","in_CLOCK");
108   
109    for (uint32_t i=0; i<_param._nb_prediction; i++)
110      {
111        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_VAL_"+toString(i)+"                ", "    in_PREDICT_VAL_"+toString(i));
112        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_ACK_"+toString(i)+"                ", "signal_PREDICT_PREDICTOR_2_ACK_"+toString(i));
113        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_ADDRESS_"+toString(i)+"            ", "    in_PREDICT_ADDRESS_"+toString(i));
114        if (_param._predictor_2_have_bht)                                                                                     
115        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_BHT_HISTORY_"+toString(i)+"        ", "signal_PREDICT_PREDICTOR_2_BHT_HISTORY_"+toString(i));
116        if (_param._predictor_2_have_pht)
117        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_PHT_HISTORY_"+toString(i)+"        ", "signal_PREDICT_PREDICTOR_2_PHT_HISTORY_"+toString(i));
118      }
119   
120    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
121      {
122        if (_param._have_meta_predictor)
123        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_VAL_"+toString(i)+"        ", "signal_BRANCH_COMPLETE_PREDICTOR_2_VAL_"+toString(i));
124        else
125        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_VAL_"+toString(i)+"        ", "    in_BRANCH_COMPLETE_VAL_"+toString(i));
126        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_ACK_"+toString(i)+"        ", "signal_BRANCH_COMPLETE_PREDICTOR_2_ACK_"+toString(i));
127        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_ADDRESS_"+toString(i)+"    ", "    in_BRANCH_COMPLETE_ADDRESS_"+toString(i));
128        if (_param._predictor_2_have_bht)                                                                                       
129        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_BHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY_"+toString(i));
130        if (_param._predictor_2_have_pht)                                                                                       
131        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_PHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY_"+toString(i));
132        if (_param._have_meta_predictor)
133        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+"  ", "signal_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION_"+toString(i));
134        else
135        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+"  ", "    in_BRANCH_COMPLETE_DIRECTION_"+toString(i));     
136      }
137
138    vhdl.set_body_component ("component_Two_Level_Branch_Predictor_2",_name+"_Two_Level_Branch_Predictor_2",list_port_map);
139
140    if (_param._have_meta_predictor)
141      {
142    // =====[ component_Two_Level_Branch_Predictor_1 ]====================   
143
144    list_port_map.clear();
145    log_printf(INFO,Meta_Predictor,"vhdl_body","Instanciation : component_Two_Level_Branch_Predictor_1");
146   
147    // Instantiation
148    vhdl.set_body_component_port_map (list_port_map,"in_CLOCK","in_CLOCK");
149   
150    for (uint32_t i=0; i<_param._nb_prediction; i++)
151      {
152        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_VAL_"+toString(i)+"                ", "    in_PREDICT_VAL_"+toString(i));
153        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_ACK_"+toString(i)+"                ", "signal_PREDICT_PREDICTOR_1_ACK_"+toString(i));
154        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_ADDRESS_"+toString(i)+"            ", "    in_PREDICT_ADDRESS_"+toString(i));
155        if (_param._predictor_1_have_bht)                                                                                     
156        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_BHT_HISTORY_"+toString(i)+"        ", "signal_PREDICT_PREDICTOR_1_BHT_HISTORY_"+toString(i));
157        if (_param._predictor_1_have_pht)
158        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_PHT_HISTORY_"+toString(i)+"        ", "signal_PREDICT_PREDICTOR_1_PHT_HISTORY_"+toString(i));
159      }
160   
161    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
162      {
163        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_VAL_"+toString(i)+"        ", "    in_BRANCH_COMPLETE_VAL_"+toString(i));
164        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_ACK_"+toString(i)+"        ", "signal_BRANCH_COMPLETE_PREDICTOR_1_ACK_"+toString(i));
165        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_ADDRESS_"+toString(i)+"    ", "    in_BRANCH_COMPLETE_ADDRESS_"+toString(i));
166        if (_param._predictor_1_have_bht)                                                                                       
167        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_BHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY_"+toString(i));
168        if (_param._predictor_1_have_pht)                                                                                       
169        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_PHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY_"+toString(i));
170        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+"  ", "    in_BRANCH_COMPLETE_DIRECTION_"+toString(i));     
171      }
172
173    vhdl.set_body_component ("component_Two_Level_Branch_Predictor_1",_name+"_Two_Level_Branch_Predictor_1",list_port_map);
174
175    // =====[ component_Two_Level_Branch_Predictor_0 ]====================   
176
177    list_port_map.clear();
178    log_printf(INFO,Meta_Predictor,"vhdl_body","Instanciation : component_Two_Level_Branch_Predictor_0");
179   
180    // Instantiation
181    vhdl.set_body_component_port_map (list_port_map,"in_CLOCK","in_CLOCK");
182   
183    for (uint32_t i=0; i<_param._nb_prediction; i++)
184      {
185        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_VAL_"+toString(i)+"                ", "    in_PREDICT_VAL_"+toString(i));
186        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_ACK_"+toString(i)+"                ", "signal_PREDICT_PREDICTOR_0_ACK_"+toString(i));
187        vhdl.set_body_component_port_map (list_port_map," in_PREDICT_ADDRESS_"+toString(i)+"            ", "    in_PREDICT_ADDRESS_"+toString(i));
188        if (_param._predictor_0_have_bht)                                                                                     
189        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_BHT_HISTORY_"+toString(i)+"        ", "signal_PREDICT_PREDICTOR_0_BHT_HISTORY_"+toString(i));
190        if (_param._predictor_0_have_pht)
191        vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_PHT_HISTORY_"+toString(i)+"        ", "signal_PREDICT_PREDICTOR_0_PHT_HISTORY_"+toString(i));
192      }
193   
194    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
195      {
196        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_VAL_"+toString(i)+"        ", "    in_BRANCH_COMPLETE_VAL_"+toString(i));
197        vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_ACK_"+toString(i)+"        ", "signal_BRANCH_COMPLETE_PREDICTOR_0_ACK_"+toString(i));
198        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_ADDRESS_"+toString(i)+"    ", "    in_BRANCH_COMPLETE_ADDRESS_"+toString(i));
199        if (_param._predictor_0_have_bht)                                                                                       
200        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_BHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY_"+toString(i));
201        if (_param._predictor_0_have_pht)                                                                                       
202        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_PHT_HISTORY_"+toString(i)+"", "signal_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY_"+toString(i));
203        vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+"  ", "    in_BRANCH_COMPLETE_DIRECTION_"+toString(i));     
204      }
205
206    vhdl.set_body_component ("component_Two_Level_Branch_Predictor_0",_name+"_Two_Level_Branch_Predictor_0",list_port_map);
207      }
208
209    log_printf(FUNC,Meta_Predictor,"vhdl_body","End");
210  };
211
212}; // end namespace meta_predictor
213}; // end namespace predictor
214}; // end namespace stage_1_ifetch
215
216}; // end namespace behavioural
217}; // end namespace morpheo             
218#endif
Note: See TracBrowser for help on using the repository browser.