#ifdef SYSTEMC
//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
/*
 * $Id: Register_unit_Glue_genMealy_gpr_read.cpp 88 2008-12-10 18:31:39Z 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_gpr_read"
  void Register_unit_Glue::genMealy_gpr_read (void)
  {
    log_begin(Register_unit_Glue,FUNCTION);
    log_function(Register_unit_Glue,FUNCTION,_name.c_str());

//     if (not PORT_READ(in_NRESET))
//       {
// 	for (uint32_t j=0; j<_param->_nb_gpr_read; j++)
// 	  PORT_WRITE(out_GPR_READ_ACK      [j], 0);
//       }
//     else
      {
	for (uint32_t j=0; j<_param->_nb_gpr_read; j++)
	  {
	    Tcontext_t ooo_engine_id    = (_param->_have_port_ooo_engine_id == true)?PORT_READ(in_GPR_READ_OOO_ENGINE_ID[j]):0;
	    Tcontrol_t registerfile_ack = PORT_READ(in_GPR_READ_REGISTERFILE_ACK [ooo_engine_id][j]);
	    Tcontrol_t status_ack       = PORT_READ(in_GPR_READ_STATUS_ACK       [ooo_engine_id][j]);
	    
	    // multiplexor
	    PORT_WRITE(out_GPR_READ_ACK      [j], registerfile_ack and status_ack);
	    PORT_WRITE(out_GPR_READ_DATA     [j], PORT_READ(in_GPR_READ_REGISTERFILE_DATA[ooo_engine_id][j]));
	    PORT_WRITE(out_GPR_READ_DATA_VAL [j], PORT_READ(in_GPR_READ_STATUS_DATA_VAL  [ooo_engine_id][j]));
	  }
      }

    log_end(Register_unit_Glue,FUNCTION);
  };

}; // 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
