source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_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

File size: 3.2 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/Update_Prediction_Table/include/Update_Prediction_Table.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17namespace update_prediction_table {
18
19
20#undef  FUNCTION
21#define FUNCTION "Update_Prediction_Table::genMealy_predict"
22  void Update_Prediction_Table::genMealy_predict (void)
23  {
24    log_begin(Update_Prediction_Table,FUNCTION);
25    log_function(Update_Prediction_Table,FUNCTION,_name.c_str());
26
27    if (PORT_READ(in_NRESET) != 0)
28      {
29    // For each prediction
30    for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
31      {
32        // Read information
33        Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_PREDICT_CONTEXT_ID [i]):0;
34        uint32_t   top     = reg_UFPT_TOP[context]; // not multi branch prediction
35
36        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"PREDICT [%d] (genMealy)",i);
37        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * context     : %d",context);
38        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * top         : %d",top);
39        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * state       : %s",toString(reg_UPDATE_FETCH_PREDICTION_TABLE [context][top]._state).c_str());
40        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * is accurate : %d",PORT_READ(in_PREDICT_BTB_IS_ACCURATE [i]));
41//      log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * need update : %d",reg_NB_ELT_NEED_UPDATE [context]);
42
43        bool is_accurate = (_param->_always_accurate_predict or
44                            (_param->_can_accurate_predict and reg_IS_ACCURATE [context]));
45
46        // Ack if :
47        //  * no previous event (ufpt and upt is ok)
48        //  * top slot is empty
49        //  * is_accurate
50        internal_PREDICT_ACK [i] = ((reg_UFPT_EVENT_STATE [context] == UFPT_EVENT_STATE_OK) and
51                                    (reg_UPT_EVENT_STATE  [context] == UPT_EVENT_STATE_OK ) and
52                                    (reg_UPDATE_FETCH_PREDICTION_TABLE [context][top]._state == UPDATE_FETCH_PREDICTION_STATE_EMPTY) and
53                                    is_accurate);
54
55        internal_PREDICT_UPDATE_PREDICTION_ID [i] = top;
56
57        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * ACK         : %d",internal_PREDICT_ACK [i]);
58
59        if (_param->_have_port_depth)
60        PORT_WRITE(out_PREDICT_UPDATE_PREDICTION_ID [i], internal_PREDICT_UPDATE_PREDICTION_ID [i]);
61      }
62
63      }//don't reset
64    else
65      {
66        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
67          {
68            internal_PREDICT_ACK [i] = 0;
69//          internal_PREDICT_UPDATE_PREDICTION_ID [i] = top;
70          }
71      }
72
73    for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
74      PORT_WRITE(out_PREDICT_ACK [i], internal_PREDICT_ACK [i]);
75
76    log_end(Update_Prediction_Table,FUNCTION);
77  };
78
79}; // end namespace update_prediction_table
80}; // end namespace prediction_unit
81}; // end namespace front_end
82}; // end namespace multi_front_end
83}; // end namespace core
84
85}; // end namespace behavioural
86}; // end namespace morpheo             
87#endif
Note: See TracBrowser for help on using the repository browser.