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_genMealy_predict_history.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: 4.4 KB
Line 
1#ifdef SYSTEMC
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::genMealy_predict_history (void)
24  {
25    log_printf(FUNC,Meta_Predictor_Glue,"genMealy_predict_history","Begin");
26   
27    for (uint32_t i=0; i<_param._nb_prediction; i++)
28      {
29        Thistory_t     history = 0;
30        Tpht_history_t predictor_0_pht_history  =0, predictor_1_pht_history  =0, predictor_2_pht_history  =0;
31        Tbht_history_t predictor_0_bht_history  =0, predictor_1_bht_history  =0, predictor_2_bht_history  =0;
32        Tcontrol_t     predictor_0_pht_direction=0, predictor_1_pht_direction=0, predictor_2_pht_direction=0;
33        Tcontrol_t     predictor_0_bht_direction=0, predictor_1_bht_direction=0, predictor_2_bht_direction=0;
34        Tcontrol_t     predictor_0_direction,     predictor_1_direction,     predictor_2_direction;
35        Tcontrol_t     predictor_direction;
36
37        if (_param._predictor_2_have_pht)
38          {
39        predictor_2_pht_history   = PORT_READ(in_PREDICT_PREDICTOR_2_PHT_HISTORY [i]);
40        predictor_2_pht_direction = predictor_2_pht_history >> (_param._predictor_2_pht_size_counter-1);
41        history                  |= (predictor_2_pht_history << _param._shift_5);
42          }
43        if (_param._predictor_2_have_bht)
44          {
45        predictor_2_bht_history   = PORT_READ(in_PREDICT_PREDICTOR_2_BHT_HISTORY [i]);
46        predictor_2_bht_direction = predictor_2_bht_history >> (_param._predictor_2_bht_size_shifter-1);
47        history                  |= (predictor_2_bht_history << _param._shift_4);
48          }
49
50        predictor_2_direction = (_param._predictor_2_have_pht==true)?predictor_2_pht_direction:predictor_2_bht_direction;
51
52        if (_param._have_meta_predictor)
53          {
54        if (_param._predictor_1_have_pht)
55          {
56        predictor_1_pht_history   = PORT_READ(in_PREDICT_PREDICTOR_1_PHT_HISTORY [i]);
57        predictor_1_pht_direction = predictor_1_pht_history >> (_param._predictor_1_pht_size_counter-1);
58        history                  |= (predictor_1_pht_history << _param._shift_3);
59          }
60        if (_param._predictor_1_have_bht)
61          {
62        predictor_1_bht_history   = PORT_READ(in_PREDICT_PREDICTOR_1_BHT_HISTORY [i]);
63        predictor_1_bht_direction = predictor_1_bht_history >> (_param._predictor_1_bht_size_shifter-1);
64        history                  |= (predictor_1_bht_history << _param._shift_2) ;
65          }
66        if (_param._predictor_0_have_pht)
67          {
68        predictor_0_pht_history   = PORT_READ(in_PREDICT_PREDICTOR_0_PHT_HISTORY [i]);
69        predictor_0_pht_direction = predictor_0_pht_history >> (_param._predictor_0_pht_size_counter-1);
70        history                  |= (predictor_0_pht_history << _param._shift_1);
71          }
72        if (_param._predictor_0_have_bht)
73          {
74        predictor_0_bht_history   = PORT_READ(in_PREDICT_PREDICTOR_0_BHT_HISTORY [i]);
75        predictor_0_bht_direction = predictor_0_bht_history >> (_param._predictor_0_bht_size_shifter-1);
76        history                  |= (predictor_0_bht_history << _param._shift_0);
77          }
78
79        predictor_0_direction = (_param._predictor_0_have_pht==true)?predictor_0_pht_direction:predictor_0_bht_direction;
80        predictor_1_direction = (_param._predictor_1_have_pht==true)?predictor_1_pht_direction:predictor_1_bht_direction;
81
82        // Meta predictor : take direction of prediction_2 and select the good predictor.
83        predictor_direction   = (predictor_2_direction==0)?predictor_0_direction:predictor_1_direction;
84       
85        log_printf(TRACE,Meta_Predictor_Glue,"genMealy_predict_history","predict_direction = %d - predictor(_0 %d, _1 %d, _2 %d)",predictor_direction,predictor_0_direction,predictor_1_direction,predictor_2_direction);
86          }
87        else
88          {
89        predictor_direction   =  predictor_2_direction;
90        log_printf(TRACE,Meta_Predictor_Glue,"genMealy_predict_history","predict_direction = %d - predictor_2 %d",predictor_direction,predictor_2_direction);
91          }
92
93        PORT_WRITE(out_PREDICT_DIRECTION [i], predictor_direction);
94        PORT_WRITE(out_PREDICT_HISTORY   [i], history            );
95      }
96
97    log_printf(FUNC,Meta_Predictor_Glue,"genMealy_predict_history","End");
98  };
99
100}; // end namespace meta_predictor_glue
101}; // end namespace meta_predictor
102
103}; // end namespace core
104}; // end namespace multi_front_end
105}; // end namespace front_end
106}; // end namespace prediction_unit
107}; // end namespace direction
108
109}; // end namespace behavioural
110}; // end namespace morpheo             
111#endif
Note: See TracBrowser for help on using the repository browser.