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

#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_translation_unit_Glue/include/Register_translation_unit_Glue.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_ooo_engine {
namespace ooo_engine {
namespace rename_unit {
namespace register_translation_unit {
namespace register_translation_unit_glue {


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

    if (PORT_READ(in_NRESET))
      {
    for (uint32_t i=0; i<_param->_nb_inst_retire; i++)
      {
	Tcontrol_t val           = PORT_READ(in_RETIRE_VAL           [i]);
	Tcontrol_t rat_ack       = PORT_READ(in_RETIRE_RAT_ACK       [i]);
	Tcontrol_t stat_list_ack = PORT_READ(in_RETIRE_STAT_LIST_ACK [i]);

	Tcontrol_t ack           = (true
//                                     and val
                                    and rat_ack
                                    and stat_list_ack
                                    );
	Tcontrol_t rat_val       = (true
                                    and val
//                                     and rat_ack
                                    and stat_list_ack
                                    );
	Tcontrol_t stat_list_val = (true
                                    and val
                                    and rat_ack
//                                     and stat_list_ack
                                    );

	PORT_WRITE(out_RETIRE_ACK           [i], ack          );
	PORT_WRITE(out_RETIRE_RAT_VAL       [i], rat_val      );
	PORT_WRITE(out_RETIRE_STAT_LIST_VAL [i], stat_list_val);

        log_printf(TRACE,Register_translation_unit_Glue,FUNCTION,"  * inst_insert [%d]",i);
        log_printf(TRACE,Register_translation_unit_Glue,FUNCTION,"    * val            (r): %d",val           );
        log_printf(TRACE,Register_translation_unit_Glue,FUNCTION,"    * ack            (w): %d",ack           );
        log_printf(TRACE,Register_translation_unit_Glue,FUNCTION,"    * rat_val        (w): %d",rat_val       );
        log_printf(TRACE,Register_translation_unit_Glue,FUNCTION,"    * rat_ack        (r): %d",rat_ack       );
        log_printf(TRACE,Register_translation_unit_Glue,FUNCTION,"    * stat_list_val  (w): %d",stat_list_val );
        log_printf(TRACE,Register_translation_unit_Glue,FUNCTION,"    * stat_list_ack  (r): %d",stat_list_ack );
      }
      }
    else
      {
        for (uint32_t i=0; i<_param->_nb_inst_retire; i++)
          {
            PORT_WRITE(out_RETIRE_ACK           [i], 0);
            PORT_WRITE(out_RETIRE_RAT_VAL       [i], 0);
            PORT_WRITE(out_RETIRE_STAT_LIST_VAL [i], 0);
          }
      }

    log_end(Register_translation_unit_Glue,FUNCTION);
  };

}; // end namespace register_translation_unit_glue
}; // end namespace register_translation_unit
}; // end namespace rename_unit
}; // end namespace ooo_engine
}; // end namespace multi_ooo_engine
}; // end namespace core

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