#ifdef SYSTEMC
/*
 * $Id: Meta_Predictor_Glue_genMealy_predict_valack.cpp 123 2009-06-08 20:43:30Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_front_end {
namespace front_end {
namespace prediction_unit {
namespace direction {
namespace meta_predictor {
namespace meta_predictor_glue {


#undef  FUNCTION
#define FUNCTION "Meta_Predictor_Glue::genMealy_predict_valack"
  void Meta_Predictor_Glue::genMealy_predict_valack (void)
  {
    log_begin(Meta_Predictor_Glue,FUNCTION);
    log_function(Meta_Predictor_Glue,FUNCTION,_name.c_str());

    if (PORT_READ(in_NRESET))
      {
    for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
      {
        Tcontrol_t val = PORT_READ(in_PREDICT_VAL [i]);
        Tcontrol_t ack = true;

        for (uint32_t j=0; j<_param->_nb_predictor; ++j)
          {
            PORT_WRITE(out_PREDICT_PREDICTOR_VAL [j][i],val);

            ack &= PORT_READ(in_PREDICT_PREDICTOR_ACK [j][i]);
          }

        PORT_WRITE(out_PREDICT_ACK [i],ack);
      }
      }
    else
      {
        // Reset
        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
          {
            for (uint32_t j=0; j<_param->_nb_predictor; ++j)
              PORT_WRITE(out_PREDICT_PREDICTOR_VAL [j][i],0);
            PORT_WRITE(out_PREDICT_ACK [i],0);
          }
      }

    log_end(Meta_Predictor_Glue,FUNCTION);
  };

}; // end namespace meta_predictor_glue
}; // end namespace meta_predictor
}; // end namespace direction
}; // end namespace prediction_unit
}; // end namespace front_end
}; // end namespace multi_front_end
}; // end namespace core

}; // end namespace behavioural
}; // end namespace morpheo              
#endif
