source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Direction_Glue/src/Direction_Glue_genMealy_predict.cpp

Last change on this file 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.6 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Direction_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/Direction_Glue/include/Direction_Glue.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17namespace direction {
18namespace direction_glue {
19
20
21#undef  FUNCTION
22#define FUNCTION "Direction_Glue::genMealy_predict"
23  void Direction_Glue::genMealy_predict (void)
24  {
25    log_begin(Direction_Glue,FUNCTION);
26    log_function(Direction_Glue,FUNCTION,_name.c_str());
27
28    if (PORT_READ(in_NRESET))
29      {
30//         std::cout << "Kane (before) " << std::endl;
31//         std::cout << _param << std::endl;
32//         std::cout << _param->_nb_inst_update << std::endl;
33//         std::cout << _param->_nb_inst_predict<< std::endl;
34//         std::cout << "Kane (end) " << std::endl;
35
36
37    // constant direction : never / always
38    for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
39      {
40        log_printf(TRACE,Direction_Glue,FUNCTION,"  * PREDICT [%d]",i);
41
42        Tcontrol_t direction = false;
43
44        switch (_param->_predictor_scheme)
45          {
46            // defined as constant in Direction_Glue.cpp
47//           case PREDICTOR_NEVER_TAKE  :
48//             {
49//               direction = 0;
50//               break;
51//             }
52//           case PREDICTOR_ALWAYS_TAKE :
53//             {
54//               direction = 1;
55//               break;
56//             }
57          case PREDICTOR_STATIC    :
58            {
59              direction = PORT_READ(in_PREDICT_STATIC [i]);
60              break;
61            }
62          case PREDICTOR_LAST_TAKE :
63            {
64              direction = PORT_READ(in_PREDICT_LAST_TAKE [i]);
65              break;
66            }
67          case PREDICTOR_COUNTER   :
68          case PREDICTOR_LOCAL     :
69          case PREDICTOR_GLOBAL    :
70          case PREDICTOR_META      :
71          case PREDICTOR_CUSTOM    :
72            {
73              // not use :
74              // in_PREDICT_LAST_TAKE       
75              // in_PREDICT_STATIC
76             
77              direction = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [i]);
78
79              PORT_WRITE(out_PREDICT_PREDICTOR_VAL         [i], PORT_READ(in_PREDICT_VAL                 [i]));
80              PORT_WRITE(out_PREDICT_ACK                   [i], PORT_READ(in_PREDICT_PREDICTOR_ACK       [i]));
81              PORT_WRITE(out_PREDICT_PREDICTOR_ADDRESS_SRC [i], PORT_READ(in_PREDICT_ADDRESS_SRC         [i]));
82              PORT_WRITE(out_PREDICT_HISTORY               [i], PORT_READ(in_PREDICT_PREDICTOR_HISTORY   [i]));
83             
84              break;
85            }
86          default :
87            {
88              ERRORMORPHEO(FUNCTION,"No valid predictor scheme");
89              break;
90            }
91          }
92     
93        log_printf(TRACE,Direction_Glue,FUNCTION,"    * direction     : %d",direction);
94
95        PORT_WRITE(out_PREDICT_DIRECTION   [i], direction);
96      }
97      }
98    else
99      {
100        //RESET
101        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
102          {
103            if (_param->_have_component_meta_predictor)
104              {
105            PORT_WRITE(out_PREDICT_PREDICTOR_VAL [i], 0);
106            PORT_WRITE(out_PREDICT_ACK           [i], 0);
107              }
108          }
109      }
110
111    log_end(Direction_Glue,FUNCTION);
112  };
113
114}; // end namespace direction_glue
115}; // end namespace direction
116}; // end namespace prediction_unit
117}; // end namespace front_end
118}; // end namespace multi_front_end
119}; // end namespace core
120}; // end namespace behavioural
121}; // end namespace morpheo             
122#endif
Note: See TracBrowser for help on using the repository browser.