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 @ 88

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

Almost complete design
with Test and test platform

File size: 2.6 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
30    for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
31      {
32        Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_PREDICT_CONTEXT_ID [i]):0;
33        uint32_t   top     = reg_UFPT_TOP[context];
34
35        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"PREDICT [%d] (genMealy)",i);
36        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * context     : %d",context);
37        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * top         : %d",top);
38        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * state       : %s",toString(reg_UPDATE_FETCH_PREDICTION_TABLE [context][top]._state).c_str());
39        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * is accurate : %d",PORT_READ(in_PREDICT_BTB_IS_ACCURATE [i]));
40//      log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * need update : %d",reg_NB_ELT_NEED_UPDATE [context]);
41
42        internal_PREDICT_UPDATE_PREDICTION_ID [i] = top;
43
44        if (_param->_have_port_depth)
45        PORT_WRITE(out_PREDICT_UPDATE_PREDICTION_ID [i], internal_PREDICT_UPDATE_PREDICTION_ID [i]);
46
47        bool is_accurate = not _param->_not_accurate_block_predict or reg_IS_ACCURATE[context];
48
49        // Ack if :
50        //  * slot is empty
51        //  * no previous miss
52        //  * is_accurate
53        internal_PREDICT_ACK [i] = ((reg_UPDATE_FETCH_PREDICTION_TABLE [context][top]._state == UPDATE_FETCH_PREDICTION_STATE_EMPTY) and
54//                                  PORT_READ(in_PREDICT_BTB_IS_ACCURATE [i]) and
55                                    (reg_EVENT_STATE [context] == EVENT_STATE_OK) and
56                                    is_accurate);
57
58
59        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * ACK         : %d",internal_PREDICT_ACK [i]);
60        PORT_WRITE(out_PREDICT_ACK [i], internal_PREDICT_ACK [i]);
61      }
62
63      }//don't reset
64
65    log_end(Update_Prediction_Table,FUNCTION);
66  };
67
68}; // end namespace update_prediction_table
69}; // end namespace prediction_unit
70}; // end namespace front_end
71}; // end namespace multi_front_end
72}; // end namespace core
73
74}; // end namespace behavioural
75}; // end namespace morpheo             
76#endif
Note: See TracBrowser for help on using the repository browser.