source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/src/Meta_Predictor_Glue_vhdl_body.cpp @ 48

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

Modification des Makefile : pas de creation inutile de shell

File size: 6.4 KB
Line 
1#ifdef VHDL
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17namespace direction {
18
19namespace meta_predictor {
20namespace meta_predictor_glue {
21
22
23  void Meta_Predictor_Glue::vhdl_body (Vhdl * & vhdl)
24  {
25    log_printf(FUNC,Meta_Predictor_Glue,"vhdl_body","Begin");
26    vhdl->set_body ("");
27    vhdl->set_body (" -- predict");
28   
29    for (uint32_t i=0; i<_param._nb_prediction; i++)
30      {
31        string meta_predictor_ack =  (_param._have_meta_predictor==true)?("in_PREDICT_"+toString(i)+"_PREDICTOR_0_ACK and in_PREDICT_"+toString(i)+"_PREDICTOR_1_ACK"):"'1'";
32
33        vhdl->set_body ("out_PREDICT_"+toString(i)+"_ACK         <= "+meta_predictor_ack+" and "+"in_PREDICT_"+toString(i)+"_PREDICTOR_2_ACK;");
34
35        uint32_t index=_param._size_history;
36
37
38        if (_param._predictor_2_have_pht)
39          {
40        vhdl->set_body ("out_PREDICT_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_2_pht_size_counter)+" <= in_PREDICT_"+toString(i)+"_PREDICTOR_2_PHT_HISTORY;");
41        index-= _param._predictor_2_pht_size_counter;
42          }
43        if (_param._predictor_2_have_bht)
44          {
45        vhdl->set_body ("out_PREDICT_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_2_bht_size_shifter)+" <= in_PREDICT_"+toString(i)+"_PREDICTOR_2_BHT_HISTORY;");
46        index-= _param._predictor_2_bht_size_shifter;
47          }
48
49        if (_param._have_meta_predictor)
50          {
51        if (_param._predictor_1_have_pht)
52          {
53        vhdl->set_body ("out_PREDICT_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_1_pht_size_counter)+" <= in_PREDICT_"+toString(i)+"_PREDICTOR_1_PHT_HISTORY;");
54        index-= _param._predictor_1_pht_size_counter;
55          }
56        if (_param._predictor_1_have_bht)
57          {
58        vhdl->set_body ("out_PREDICT_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_1_bht_size_shifter)+" <= in_PREDICT_"+toString(i)+"_PREDICTOR_1_BHT_HISTORY;");
59        index-= _param._predictor_1_bht_size_shifter;
60          }
61
62        if (_param._predictor_0_have_pht)
63          {
64        vhdl->set_body ("out_PREDICT_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_0_pht_size_counter)+" <= in_PREDICT_"+toString(i)+"_PREDICTOR_0_PHT_HISTORY;");
65        index-= _param._predictor_0_pht_size_counter;
66          }
67        if (_param._predictor_0_have_bht)
68          {
69        vhdl->set_body ("out_PREDICT_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_0_bht_size_shifter)+" <= in_PREDICT_"+toString(i)+"_PREDICTOR_0_BHT_HISTORY;");
70        index-= _param._predictor_0_bht_size_shifter;
71          }
72          }
73
74        // direction of prediction
75        vhdl->set_body ("");
76        if (_param._have_meta_predictor)
77          vhdl->set_body ("out_PREDICT_"+toString(i)+"_DIRECTION   <= predict_"+toString(i)+"_predictor_0_direction when predict_"+toString(i)+"_predictor_2_direction='0' else predict_"+toString(i)+"_predictor_1_direction;");
78        else
79          vhdl->set_body ("out_PREDICT_"+toString(i)+"_DIRECTION   <= predict_"+toString(i)+"_predictor_2_direction;");
80      }
81
82    // Interface - branch_complete
83
84    vhdl->set_body ("");
85    vhdl->set_body (" -- branch_complete");
86    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
87      {
88        // branch_complete_predictor_2 val and directionn
89        if (_param._have_meta_predictor)
90          {
91        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_2_VAL       <= (branch_complete_"+toString(i)+"_predictor_0_direction xor branch_complete_"+toString(i)+"_predictor_1_direction) and "+"in_BRANCH_COMPLETE_"+toString(i)+"_VAL;");
92        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_2_DIRECTION <= (branch_complete_"+toString(i)+"_predictor_0_direction and not in_BRANCH_COMPLETE_"+toString(i)+"_DIRECTION) or (branch_complete_"+toString(i)+"_predictor_1_direction and in_BRANCH_COMPLETE_"+toString(i)+"_DIRECTION);");
93          }
94
95        string meta_predictor_ack =  (_param._have_meta_predictor==true)?("in_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_0_ACK and in_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_1_ACK"):"'1'";
96
97        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_ACK                   <= "+meta_predictor_ack+" and "+"in_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_2_ACK;");
98
99        uint32_t index=_param._size_history;
100
101        if (_param._predictor_2_have_pht)
102          {
103        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_2_PHT_HISTORY <= in_BRANCH_COMPLETE_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_2_pht_size_counter)+";");
104        index-= _param._predictor_2_pht_size_counter;
105          }
106        if (_param._predictor_2_have_bht)
107          {
108        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_2_BHT_HISTORY <= in_BRANCH_COMPLETE_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_2_bht_size_shifter)+";");
109        index-= _param._predictor_2_bht_size_shifter;
110          }
111
112        if (_param._have_meta_predictor)
113          {
114        if (_param._predictor_1_have_pht)
115          {
116        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_1_PHT_HISTORY <= in_BRANCH_COMPLETE_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_1_pht_size_counter)+";");
117        index-= _param._predictor_1_pht_size_counter;
118          }
119        if (_param._predictor_1_have_bht)
120          {
121        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_1_BHT_HISTORY <= in_BRANCH_COMPLETE_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_1_bht_size_shifter)+";");
122        index-= _param._predictor_1_bht_size_shifter;
123          }
124
125        if (_param._predictor_0_have_pht)
126          {
127        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_0_PHT_HISTORY <= in_BRANCH_COMPLETE_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_0_pht_size_counter)+";");
128        index-= _param._predictor_0_pht_size_counter;
129          }
130        if (_param._predictor_0_have_bht)
131          {
132        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_0_BHT_HISTORY <= in_BRANCH_COMPLETE_"+toString(i)+"_HISTORY"+std_logic_range(index-1,index-_param._predictor_0_bht_size_shifter)+";");
133        index-= _param._predictor_0_bht_size_shifter;
134          }
135          }
136      }
137
138    log_printf(FUNC,Meta_Predictor_Glue,"vhdl_body","End");
139  };
140
141}; // end namespace meta_predictor_glue
142}; // end namespace meta_predictor
143
144}; // end namespace core
145}; // end namespace multi_front_end
146}; // end namespace front_end
147}; // end namespace prediction_unit
148}; // end namespace direction
149
150
151}; // end namespace behavioural
152}; // end namespace morpheo             
153#endif
Note: See TracBrowser for help on using the repository browser.