#ifdef SYSTEMC
//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
/*
 * $Id$
 *
 * [ 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_insert"
  void Register_unit_Glue::genMealy_insert (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_insert_rob [i];

	for (uint32_t j=0; j<x; j++)
	  {
	    Tcontrol_t val = PORT_READ(in_INSERT_ROB_VAL [i][j]);
	    Tcontrol_t gpr_use = PORT_READ(in_INSERT_ROB_RD_USE [i][j]);
	    Tcontrol_t spr_use = PORT_READ(in_INSERT_ROB_RE_USE [i][j]);
	    Tcontrol_t gpr_ack = PORT_READ(in_INSERT_ROB_GPR_STATUS_ACK [i][j]);
	    Tcontrol_t spr_ack = PORT_READ(in_INSERT_ROB_SPR_STATUS_ACK [i][j]);
	    
	    PORT_WRITE(out_INSERT_ROB_ACK [i][j], gpr_ack and spr_ack);	    
	    PORT_WRITE(out_INSERT_ROB_GPR_STATUS_VAL [i][j], val and gpr_use and spr_ack);
	    PORT_WRITE(out_INSERT_ROB_SPR_STATUS_VAL [i][j], val and spr_use and gpr_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
