#ifdef SYSTEMC
/*
 * $Id: Rename_unit_Glue_genMealy_insert_valack.cpp 88 2008-12-10 18:31:39Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Rename_unit_Glue/include/Rename_unit_Glue.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_ooo_engine {
namespace ooo_engine {
namespace rename_unit {
namespace rename_unit_glue {


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

//     // Transaction must be in-order
//     Tcontrol_t previous_transaction = true;
    
    for (uint32_t i=0; i<_param->_nb_inst_insert; i++)
      {
      //Tcontrol_t ACK                          = PORT_READ(in_INSERT_ACK                          [i]);
	Tcontrol_t RENAME_SELECT_VAL            = PORT_READ(in_INSERT_RENAME_SELECT_VAL            [i]);
	Tcontrol_t REGISTER_TRANSLATION_ACK     = PORT_READ(in_INSERT_REGISTER_TRANSLATION_ACK     [i]);
	Tcontrol_t LOAD_STORE_QUEUE_POINTER_ACK = PORT_READ(in_INSERT_LOAD_STORE_QUEUE_POINTER_ACK [i]);

// 	Tcontrol_t VAL                          = (
// 						   previous_transaction         and
// 						   RENAME_SELECT_VAL            and
// 						   REGISTER_TRANSLATION_ACK     and
// 						   LOAD_STORE_QUEUE_POINTER_ACK );
	Tcontrol_t RENAME_SELECT_ACK            = (
//                                                 previous_transaction         and
// 						   ACK                          and
						   REGISTER_TRANSLATION_ACK     and
						   LOAD_STORE_QUEUE_POINTER_ACK );
	Tcontrol_t REGISTER_TRANSLATION_VAL     = (
//                                                 previous_transaction         and
// 						   ACK                          and
						   RENAME_SELECT_VAL            and
						   LOAD_STORE_QUEUE_POINTER_ACK );
	Tcontrol_t LOAD_STORE_QUEUE_POINTER_VAL = (
//                                                 previous_transaction         and
// 						   ACK                          and
						   RENAME_SELECT_VAL            and
						   REGISTER_TRANSLATION_ACK     );

        log_printf(TRACE,Rename_unit_Glue,FUNCTION,"  * insert [%d]",i);
        log_printf(TRACE,Rename_unit_Glue,FUNCTION,"    * rename_select_val            (r) : %d",RENAME_SELECT_VAL           );
        log_printf(TRACE,Rename_unit_Glue,FUNCTION,"    * rename_select_ack            (w) : %d",RENAME_SELECT_ACK           );
        log_printf(TRACE,Rename_unit_Glue,FUNCTION,"    * register_translation_val     (w) : %d",REGISTER_TRANSLATION_VAL    );
        log_printf(TRACE,Rename_unit_Glue,FUNCTION,"    * register_translation_ack     (r) : %d",REGISTER_TRANSLATION_ACK    );
        log_printf(TRACE,Rename_unit_Glue,FUNCTION,"    * load_store_queue_pointer_val (w) : %d",LOAD_STORE_QUEUE_POINTER_VAL);
        log_printf(TRACE,Rename_unit_Glue,FUNCTION,"    * load_store_queue_pointer_ack (r) : %d",LOAD_STORE_QUEUE_POINTER_ACK);
	
// 	PORT_WRITE(out_INSERT_VAL                          [i], VAL                         );
	PORT_WRITE(out_INSERT_RENAME_SELECT_ACK            [i], RENAME_SELECT_ACK           );
	PORT_WRITE(out_INSERT_REGISTER_TRANSLATION_VAL     [i], REGISTER_TRANSLATION_VAL    );
	PORT_WRITE(out_INSERT_LOAD_STORE_QUEUE_POINTER_VAL [i], LOAD_STORE_QUEUE_POINTER_VAL);

// 	previous_transaction = RENAME_SELECT_VAL and RENAME_SELECT_ACK;
      }

    log_end(Rename_unit_Glue,FUNCTION);
  };

}; // end namespace rename_unit_glue
}; // end namespace rename_unit
}; // end namespace ooo_engine
}; // end namespace multi_ooo_engine
}; // end namespace core

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