/*
 * $Id$
 *
 * [ Description ]
 * 
 */

#include "Behavioural/@DIRECTORY/include/@COMPONENT.h"
#include "Behavioural/include/Allocation.h"
#include "Common/include/Max.h"

namespace morpheo {
namespace behavioural {
@NAMESPACE_BEGIN


#undef  FUNCTION
#define FUNCTION "@COMPONENT::allocation"
  void @COMPONENT::allocation (
#ifdef STATISTICS
			       morpheo::behavioural::Parameters_Statistics * param_statistics
#else
			       void
#endif
			       )
  {
    log_begin(@COMPONENT,FUNCTION);

    _component   = new Component (_usage);

    Entity * entity = _component->set_entity (_name       
					      ,_param->_type
#ifdef POSITION
					      ,COMBINATORY 
#endif
					      );

    _interfaces = entity->set_interfaces();

    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    {
      Interface * interface = _interfaces->set_interface(""
#ifdef POSITION
							 ,IN
							 ,SOUTH,
							 _("Generalist interface")
#endif
							 );
      
      in_CLOCK        = interface->set_signal_clk              ("clock" ,1, CLOCK_VHDL_YES);
      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
    }
    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    

#ifdef POSITION
    if (usage_is_set(_usage,USE_POSITION))
	_component->generate_file();
#endif

#ifdef MODELSIM_COSIMULATION
    if (usage_is_set(_usage,USE_COSIMULATION))
      {
        log_printf(INFO,Execute_queue,FUNCTION,_("<%s> : Create Wrapper"),_name.c_str());

        _wrapper = new Wrapper_@COMPONENT (_name.c_str(),"morpheo_behavioural","work");
      }
#endif

    log_end(@COMPONENT,FUNCTION);
  };

@NAMESPACE_END
}; // end namespace behavioural
}; // end namespace morpheo              
