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.cpp @ 123

Last change on this file since 123 was 123, checked in by rosiere, 15 years ago

1) Fix performance
2) add auto generation to SPECINT2000
3) add reset in genMoore and genMealy

  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Meta_Predictor_Glue_genMealy_predict.cpp 123 2009-06-08 20:43:30Z rosiere $
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 {
18namespace meta_predictor {
19namespace meta_predictor_glue {
20
21
22#undef  FUNCTION
23#define FUNCTION "Meta_Predictor_Glue::genMealy_predict"
24  void Meta_Predictor_Glue::genMealy_predict (void)
25  {
26    log_begin(Meta_Predictor_Glue,FUNCTION);
27    log_function(Meta_Predictor_Glue,FUNCTION,_name.c_str());
28
29    if (PORT_READ(in_NRESET))
30      {
31    for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
32      {
33        Thistory_t history  ;
34        Tcontrol_t direction;
35
36        switch (_param->_nb_predictor)
37          {
38          case 1 :
39            {
40              history   = PORT_READ(in_PREDICT_PREDICTOR_HISTORY   [0][i]);
41              direction = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [0][i]);
42
43              if (_param->_predictor_update_on_prediction [0])
44                {
45                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [0][i],true     );
46                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION     [0][i],direction);
47                }
48              break;
49            }
50          case 3 :
51            {
52              Thistory_t history_0   = PORT_READ(in_PREDICT_PREDICTOR_HISTORY   [0][i]);
53              Thistory_t history_1   = PORT_READ(in_PREDICT_PREDICTOR_HISTORY   [1][i]);
54              Thistory_t history_2   = PORT_READ(in_PREDICT_PREDICTOR_HISTORY   [2][i]);
55              Tcontrol_t direction_0 = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [0][i]);
56              Tcontrol_t direction_1 = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [1][i]);
57              Tcontrol_t direction_2 = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [2][i]);
58
59              history   = ((history_0 <<_param->_predictor_history_shift [0]) |
60                           (history_1 <<_param->_predictor_history_shift [1]) |
61                           (history_2 <<_param->_predictor_history_shift [2]));
62
63              direction = ((    direction_2 and direction_1) or
64                           (not direction_2 and direction_0));
65             
66              if (_param->_predictor_update_on_prediction [0])
67                {
68                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [0][i],direction_2 == 0);
69                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION     [0][i],direction);
70                }
71              if (_param->_predictor_update_on_prediction [1])
72                {
73                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [1][i],direction_2 == 1);
74                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION     [1][i],direction);
75                }
76              if (_param->_predictor_update_on_prediction [2])
77                {
78                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [2][i],true);
79                  PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION     [2][i],direction_2);
80                }
81             
82              break;
83            }
84          default :
85            { 
86              break;
87            }
88          }
89
90        PORT_WRITE(out_PREDICT_HISTORY   [i],history  );
91        PORT_WRITE(out_PREDICT_DIRECTION [i],direction);
92      }
93      }
94//     else
95//       {
96//       }
97
98    log_end(Meta_Predictor_Glue,FUNCTION);
99  };
100
101}; // end namespace meta_predictor_glue
102}; // end namespace meta_predictor
103}; // end namespace direction
104}; // end namespace prediction_unit
105}; // end namespace front_end
106}; // end namespace multi_front_end
107}; // end namespace core
108
109}; // end namespace behavioural
110}; // end namespace morpheo             
111#endif
Note: See TracBrowser for help on using the repository browser.