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

Last change on this file since 45 was 45, checked in by rosiere, 17 years ago
  • Documentation : specification d'un cache de donnée non bloquant
  • Modification de l'aborescence
File size: 6.2 KB
RevLine 
[4]1#ifdef VHDL
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
[44]19  void Meta_Predictor_Glue::vhdl_body (Vhdl * & vhdl)
[4]20  {
21    log_printf(FUNC,Meta_Predictor_Glue,"vhdl_body","Begin");
[44]22    vhdl->set_body ("");
23    vhdl->set_body (" -- predict");
[4]24   
25    for (uint32_t i=0; i<_param._nb_prediction; i++)
26      {
[44]27        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]28
[44]29        vhdl->set_body ("out_PREDICT_"+toString(i)+"_ACK         <= "+meta_predictor_ack+" and "+"in_PREDICT_"+toString(i)+"_PREDICTOR_2_ACK;");
[4]30
31        uint32_t index=_param._size_history;
32
33
34        if (_param._predictor_2_have_pht)
35          {
[44]36        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]37        index-= _param._predictor_2_pht_size_counter;
38          }
39        if (_param._predictor_2_have_bht)
40          {
[44]41        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]42        index-= _param._predictor_2_bht_size_shifter;
43          }
44
45        if (_param._have_meta_predictor)
46          {
47        if (_param._predictor_1_have_pht)
48          {
[44]49        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]50        index-= _param._predictor_1_pht_size_counter;
51          }
52        if (_param._predictor_1_have_bht)
53          {
[44]54        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]55        index-= _param._predictor_1_bht_size_shifter;
56          }
57
58        if (_param._predictor_0_have_pht)
59          {
[44]60        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]61        index-= _param._predictor_0_pht_size_counter;
62          }
63        if (_param._predictor_0_have_bht)
64          {
[44]65        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]66        index-= _param._predictor_0_bht_size_shifter;
67          }
68          }
69
70        // direction of prediction
[44]71        vhdl->set_body ("");
[4]72        if (_param._have_meta_predictor)
[44]73          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]74        else
[44]75          vhdl->set_body ("out_PREDICT_"+toString(i)+"_DIRECTION   <= predict_"+toString(i)+"_predictor_2_direction;");
[4]76      }
77
78    // Interface - branch_complete
79
[44]80    vhdl->set_body ("");
81    vhdl->set_body (" -- branch_complete");
[4]82    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
83      {
[5]84        // branch_complete_predictor_2 val and directionn
85        if (_param._have_meta_predictor)
86          {
[44]87        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;");
88        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]89          }
90
[44]91        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]92
[44]93        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_ACK                   <= "+meta_predictor_ack+" and "+"in_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_2_ACK;");
[4]94
95        uint32_t index=_param._size_history;
96
97        if (_param._predictor_2_have_pht)
98          {
[44]99        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]100        index-= _param._predictor_2_pht_size_counter;
101          }
102        if (_param._predictor_2_have_bht)
103          {
[44]104        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]105        index-= _param._predictor_2_bht_size_shifter;
106          }
107
108        if (_param._have_meta_predictor)
109          {
110        if (_param._predictor_1_have_pht)
111          {
[44]112        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]113        index-= _param._predictor_1_pht_size_counter;
114          }
115        if (_param._predictor_1_have_bht)
116          {
[44]117        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]118        index-= _param._predictor_1_bht_size_shifter;
119          }
120
121        if (_param._predictor_0_have_pht)
122          {
[44]123        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]124        index-= _param._predictor_0_pht_size_counter;
125          }
126        if (_param._predictor_0_have_bht)
127          {
[44]128        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]129        index-= _param._predictor_0_bht_size_shifter;
130          }
131          }
132      }
133
134    log_printf(FUNC,Meta_Predictor_Glue,"vhdl_body","End");
135  };
136
137}; // end namespace meta_predictor_glue
138}; // end namespace meta_predictor
139}; // end namespace predictor
140}; // end namespace stage_1_ifetch
141
142}; // end namespace behavioural
143}; // end namespace morpheo             
144#endif
Note: See TracBrowser for help on using the repository browser.