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
Line 
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
19  void Meta_Predictor_Glue::vhdl_body (Vhdl * & vhdl)
20  {
21    log_printf(FUNC,Meta_Predictor_Glue,"vhdl_body","Begin");
22    vhdl->set_body ("");
23    vhdl->set_body (" -- predict");
24   
25    for (uint32_t i=0; i<_param._nb_prediction; i++)
26      {
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'";
28
29        vhdl->set_body ("out_PREDICT_"+toString(i)+"_ACK         <= "+meta_predictor_ack+" and "+"in_PREDICT_"+toString(i)+"_PREDICTOR_2_ACK;");
30
31        uint32_t index=_param._size_history;
32
33
34        if (_param._predictor_2_have_pht)
35          {
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;");
37        index-= _param._predictor_2_pht_size_counter;
38          }
39        if (_param._predictor_2_have_bht)
40          {
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;");
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          {
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;");
50        index-= _param._predictor_1_pht_size_counter;
51          }
52        if (_param._predictor_1_have_bht)
53          {
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;");
55        index-= _param._predictor_1_bht_size_shifter;
56          }
57
58        if (_param._predictor_0_have_pht)
59          {
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;");
61        index-= _param._predictor_0_pht_size_counter;
62          }
63        if (_param._predictor_0_have_bht)
64          {
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;");
66        index-= _param._predictor_0_bht_size_shifter;
67          }
68          }
69
70        // direction of prediction
71        vhdl->set_body ("");
72        if (_param._have_meta_predictor)
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;");
74        else
75          vhdl->set_body ("out_PREDICT_"+toString(i)+"_DIRECTION   <= predict_"+toString(i)+"_predictor_2_direction;");
76      }
77
78    // Interface - branch_complete
79
80    vhdl->set_body ("");
81    vhdl->set_body (" -- branch_complete");
82    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
83      {
84        // branch_complete_predictor_2 val and directionn
85        if (_param._have_meta_predictor)
86          {
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);");
89          }
90
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'";
92
93        vhdl->set_body ("out_BRANCH_COMPLETE_"+toString(i)+"_ACK                   <= "+meta_predictor_ack+" and "+"in_BRANCH_COMPLETE_"+toString(i)+"_PREDICTOR_2_ACK;");
94
95        uint32_t index=_param._size_history;
96
97        if (_param._predictor_2_have_pht)
98          {
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)+";");
100        index-= _param._predictor_2_pht_size_counter;
101          }
102        if (_param._predictor_2_have_bht)
103          {
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)+";");
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          {
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)+";");
113        index-= _param._predictor_1_pht_size_counter;
114          }
115        if (_param._predictor_1_have_bht)
116          {
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)+";");
118        index-= _param._predictor_1_bht_size_shifter;
119          }
120
121        if (_param._predictor_0_have_pht)
122          {
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)+";");
124        index-= _param._predictor_0_pht_size_counter;
125          }
126        if (_param._predictor_0_have_bht)
127          {
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)+";");
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.