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 @ 75

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

Modification des Makefile : pas de creation inutile de shell

File size: 6.4 KB
RevLine 
[4]1#ifdef VHDL
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
[48]9#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h"
[4]10
11namespace morpheo                    {
12namespace behavioural {
[48]13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17namespace direction {
18
[4]19namespace meta_predictor {
20namespace meta_predictor_glue {
21
22
[44]23  void Meta_Predictor_Glue::vhdl_body (Vhdl * & vhdl)
[4]24  {
25    log_printf(FUNC,Meta_Predictor_Glue,"vhdl_body","Begin");
[44]26    vhdl->set_body ("");
27    vhdl->set_body (" -- predict");
[4]28   
29    for (uint32_t i=0; i<_param._nb_prediction; i++)
30      {
[44]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'";
[4]32
[44]33        vhdl->set_body ("out_PREDICT_"+toString(i)+"_ACK         <= "+meta_predictor_ack+" and "+"in_PREDICT_"+toString(i)+"_PREDICTOR_2_ACK;");
[4]34
35        uint32_t index=_param._size_history;
36
37
38        if (_param._predictor_2_have_pht)
39          {
[44]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;");
[4]41        index-= _param._predictor_2_pht_size_counter;
42          }
43        if (_param._predictor_2_have_bht)
44          {
[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;");
[4]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          {
[44]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;");
[4]54        index-= _param._predictor_1_pht_size_counter;
55          }
56        if (_param._predictor_1_have_bht)
57          {
[44]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;");
[4]59        index-= _param._predictor_1_bht_size_shifter;
60          }
61
62        if (_param._predictor_0_have_pht)
63          {
[44]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;");
[4]65        index-= _param._predictor_0_pht_size_counter;
66          }
67        if (_param._predictor_0_have_bht)
68          {
[44]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;");
[4]70        index-= _param._predictor_0_bht_size_shifter;
71          }
72          }
73
74        // direction of prediction
[44]75        vhdl->set_body ("");
[4]76        if (_param._have_meta_predictor)
[44]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;");
[4]78        else
[44]79          vhdl->set_body ("out_PREDICT_"+toString(i)+"_DIRECTION   <= predict_"+toString(i)+"_predictor_2_direction;");
[4]80      }
81
82    // Interface - branch_complete
83
[44]84    vhdl->set_body ("");
85    vhdl->set_body (" -- branch_complete");
[4]86    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
87      {
[5]88        // branch_complete_predictor_2 val and directionn
89        if (_param._have_meta_predictor)
90          {
[44]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);");
[5]93          }
94
[44]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'";
[4]96
[44]97        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_ACK                   <= "+meta_predictor_ack+" and "+"in_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_2_ACK;");
[4]98
99        uint32_t index=_param._size_history;
100
101        if (_param._predictor_2_have_pht)
102          {
[44]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)+";");
[4]104        index-= _param._predictor_2_pht_size_counter;
105          }
106        if (_param._predictor_2_have_bht)
107          {
[44]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)+";");
[4]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          {
[44]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)+";");
[4]117        index-= _param._predictor_1_pht_size_counter;
118          }
119        if (_param._predictor_1_have_bht)
120          {
[44]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)+";");
[4]122        index-= _param._predictor_1_bht_size_shifter;
123          }
124
125        if (_param._predictor_0_have_pht)
126          {
[44]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)+";");
[4]128        index-= _param._predictor_0_pht_size_counter;
129          }
130        if (_param._predictor_0_have_bht)
131          {
[44]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)+";");
[4]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
[48]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
[4]151}; // end namespace behavioural
152}; // end namespace morpheo             
153#endif
Note: See TracBrowser for help on using the repository browser.