#ifdef SYSTEMC
//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
/*
 * $Id: Register_unit_Glue_genMealy_retire.cpp 81 2008-04-15 18:40:01Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Register_unit/Register_unit_Glue/include/Register_unit_Glue.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_execute_loop {
namespace execute_loop {
namespace register_unit {
namespace register_unit_glue {


#undef  FUNCTION
#define FUNCTION "Register_unit_Glue::genMealy_retire"
  void Register_unit_Glue::genMealy_retire (void)
  {
    log_printf(FUNC,Register_unit_Glue,FUNCTION,"Begin");

    for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
      {
	uint32_t x=_param->_nb_inst_retire_rob [i];

	for (uint32_t j=0; j<x; j++)
	  {
	    Tcontrol_t val         = PORT_READ(in_RETIRE_ROB_VAL        [i][j]);
	    Tcontrol_t gpr_old_use = PORT_READ(in_RETIRE_ROB_RD_OLD_USE [i][j]);
	    Tcontrol_t gpr_new_use = PORT_READ(in_RETIRE_ROB_RD_NEW_USE [i][j]);
	    Tcontrol_t spr_old_use = PORT_READ(in_RETIRE_ROB_RE_OLD_USE [i][j]);
	    Tcontrol_t spr_new_use = PORT_READ(in_RETIRE_ROB_RE_NEW_USE [i][j]);
	    Tcontrol_t gpr_old_ack = PORT_READ(in_RETIRE_ROB_GPR_STATUS_OLD_ACK [i][j]);
	    Tcontrol_t gpr_new_ack = PORT_READ(in_RETIRE_ROB_GPR_STATUS_NEW_ACK [i][j]);
	    Tcontrol_t spr_old_ack = PORT_READ(in_RETIRE_ROB_SPR_STATUS_OLD_ACK [i][j]);
	    Tcontrol_t spr_new_ack = PORT_READ(in_RETIRE_ROB_SPR_STATUS_NEW_ACK [i][j]);

	    PORT_WRITE(out_RETIRE_ROB_ACK [i][j], (gpr_old_ack and
						   gpr_new_ack and 
						   spr_old_ack and
						   spr_new_ack));

	    PORT_WRITE(out_RETIRE_ROB_GPR_STATUS_OLD_VAL [i][j],
		       val and gpr_old_use                 and gpr_new_ack and spr_old_ack and spr_new_ack);
	    PORT_WRITE(out_RETIRE_ROB_GPR_STATUS_NEW_VAL [i][j],
		       val and gpr_new_use and gpr_old_ack                 and spr_old_ack and spr_new_ack);
	    PORT_WRITE(out_RETIRE_ROB_SPR_STATUS_OLD_VAL [i][j],
		       val and spr_old_use and gpr_old_ack and gpr_new_ack                 and spr_new_ack);
	    PORT_WRITE(out_RETIRE_ROB_SPR_STATUS_NEW_VAL [i][j],
		       val and spr_new_use and gpr_old_ack and gpr_new_ack and spr_old_ack                );
	  }
      }

    log_printf(FUNC,Register_unit_Glue,FUNCTION,"End");
  };

}; // end namespace register_unit_glue
}; // end namespace register_unit
}; // end namespace execute_loop
}; // end namespace multi_execute_loop
}; // end namespace core

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