/*
 * $Id: Register_translation_unit.cpp 138 2010-05-12 17:34:01Z rosiere $
 *
 * [ Description ]
 * 
 */

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

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


#undef  FUNCTION
#define FUNCTION "Register_translation_unit::Register_translation_unit"
  Register_translation_unit::Register_translation_unit 
  (
#ifdef SYSTEMC
   sc_module_name name,
#else
   string name,
#endif
#ifdef STATISTICS
   morpheo::behavioural::Parameters_Statistics * param_statistics,
#endif
   morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::register_translation_unit::Parameters * param,
   morpheo::behavioural::Tusage_t usage
   ):
    _name              (name)
    ,_param            (param)
    ,_usage            (usage)
  {
    log_printf(FUNC,Register_translation_unit,FUNCTION,"Begin");

// #if DEBUG_Register_translation_unit == true
//     log_printf(INFO,Register_translation_unit,FUNCTION,_("<%s> Parameters"),_name.c_str());

//     std::cout << *param << std::endl;
// #endif    

    log_printf(INFO,Register_translation_unit,FUNCTION,"Allocation");

    allocation (
#ifdef STATISTICS
		param_statistics
#endif
		);

#ifdef STATISTICS
    if (usage_is_set(_usage,USE_STATISTICS))
      {	
	log_printf(INFO,Register_translation_unit,FUNCTION,"Allocation of statistics");

	statistics_declaration(param_statistics);
      }
#endif

#ifdef VHDL
    if (usage_is_set(_usage,USE_VHDL))
      {
	// generate the vhdl
	log_printf(INFO,Register_translation_unit,FUNCTION,"Generate the vhdl");
	
	vhdl();
      }
#endif

#if defined(SYSTEMC) and (defined(STATISTICS) or defined(VHDL_TESTBENCH))
    if (usage_is_set(_usage,USE_SYSTEMC))
      {
	log_printf(INFO,Register_translation_unit,FUNCTION,"Method - transition");

	SC_METHOD (transition);
	dont_initialize ();
	sensitive << (*(in_CLOCK)).pos();
	
# ifdef SYSTEMCASS_SPECIFIC
	// List dependency information
# endif    
      }
#endif
    log_printf(FUNC,Register_translation_unit,FUNCTION,"End");
  };
    
#undef  FUNCTION
#define FUNCTION "Register_translation_unit::~Register_translation_unit"
  Register_translation_unit::~Register_translation_unit (void)
  {
    log_printf(FUNC,Register_translation_unit,FUNCTION,"Begin");

#ifdef STATISTICS
    if (usage_is_set(_usage,USE_STATISTICS))
      {
	log_printf(INFO,Register_translation_unit,FUNCTION,"Generate Statistics file");
	
	delete _stat;
      }
#endif

    log_printf(INFO,Register_translation_unit,FUNCTION,"Deallocation");
    deallocation ();

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

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