/*
 * $Id: Custom_default.cpp 81 2008-04-15 18:40:01Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Custom/include/Custom_default.h"

namespace morpheo {
namespace behavioural {
namespace custom {

#undef  FUNCTION
#define FUNCTION "custom::default_get_valid_group"
  bool default_get_valid_group (uint32_t group)
  {
    switch (group)
      {
      case 24 : // CUSTOM_1
      case 25 : // CUSTOM_2
      case 26 : // CUSTOM_3
      case 27 : // CUSTOM_4
      case 28 : // CUSTOM_5
      case 29 : // CUSTOM_6
      case 30 : // CUSTOM_7
      case 31 : // CUSTOM_8
	{
	  break;
	}
      default :
	{
	  throw ERRORMORPHEO(FUNCTION, "Invalid custom group number");
	}
      }
    
    return false; // default return
  }

#undef  FUNCTION
#define FUNCTION "custom::default_get_nb_register"
  uint32_t default_get_nb_register (uint32_t group)
  {
    switch (group)
      {
      case 24 : // CUSTOM_1
      case 25 : // CUSTOM_2
      case 26 : // CUSTOM_3
      case 27 : // CUSTOM_4
      case 28 : // CUSTOM_5
      case 29 : // CUSTOM_6
      case 30 : // CUSTOM_7
      case 31 : // CUSTOM_8
	{
	  break;
	}
      default :
	{
	  throw ERRORMORPHEO(FUNCTION, "Invalid custom group number");
	}
      }

    return 0; // default return
  }

#undef  FUNCTION
#define FUNCTION "custom::default_get_access_mode"
  access_mode_t default_get_access_mode (uint32_t group, uint32_t reg)
  {
    if (reg < default_get_nb_register (group))
      switch (group)
	{
	case 24 : // CUSTOM_1
	case 25 : // CUSTOM_2
	case 26 : // CUSTOM_3
	case 27 : // CUSTOM_4
	case 28 : // CUSTOM_5
	case 29 : // CUSTOM_6
	case 30 : // CUSTOM_7
	case 31 : // CUSTOM_8
	  {
	    break;
	  }
	default :
	  {
	    throw ERRORMORPHEO(FUNCTION, "Invalid custom group number");
	  }
	}

    return access_mode_t (SPR_ACCESS_MODE_NONE, SPR_ACCESS_MODE_NONE); // default return
  }

#undef  FUNCTION
#define FUNCTION "custom::default_get_custom_decod"
  custom_decod_t *  default_get_custom_decod (Toperation_t operation)
  {
    switch (operation)
      {
      case OPERATION_CUSTOM_L_1    :
      case OPERATION_CUSTOM_L_2    :
      case OPERATION_CUSTOM_L_3    :
      case OPERATION_CUSTOM_L_4    :
      case OPERATION_CUSTOM_L_5    :
      case OPERATION_CUSTOM_L_6    :
      case OPERATION_CUSTOM_L_7    :
      case OPERATION_CUSTOM_L_8    :
      case OPERATION_CUSTOM_LF_1_D :
      case OPERATION_CUSTOM_LF_1_S :
      case OPERATION_CUSTOM_LV_1   :
      case OPERATION_CUSTOM_LV_2   :
      case OPERATION_CUSTOM_LV_3   :
      case OPERATION_CUSTOM_LV_4   :
	{
	  break;
	}
      default :
	{
	  throw ERRORMORPHEO(FUNCTION, "Invalid custom operation");
	}
      }

    return &(morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod::instruction_illegal); // unimplemented function
  }

#undef  FUNCTION
#define FUNCTION "custom::default_get_custom_execute_genMoore"
  custom_execute_genMoore_t * default_get_custom_execute_genMoore (Toperation_t operation)
  {
    switch (operation)
      {
      case OPERATION_CUSTOM_L_1    :
      case OPERATION_CUSTOM_L_2    :
      case OPERATION_CUSTOM_L_3    :
      case OPERATION_CUSTOM_L_4    :
      case OPERATION_CUSTOM_L_5    :
      case OPERATION_CUSTOM_L_6    :
      case OPERATION_CUSTOM_L_7    :
      case OPERATION_CUSTOM_L_8    :
      case OPERATION_CUSTOM_LF_1_D :
      case OPERATION_CUSTOM_LF_1_S :
      case OPERATION_CUSTOM_LV_1   :
      case OPERATION_CUSTOM_LV_2   :
      case OPERATION_CUSTOM_LV_3   :
      case OPERATION_CUSTOM_LV_4   :
	{
	  break;
	}
      default :
	{
	  throw ERRORMORPHEO(FUNCTION, "Invalid custom operation");
	}
      }

    return &(morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::functionnal_unit::operation_unimplemented); // unimplemented function
  }

#undef  FUNCTION
#define FUNCTION "custom::default_get_custom_execute_transition"
  custom_execute_transition_t * default_get_custom_execute_transition (uint32_t group)
  {
    switch (group)
      {
      case 24 : // CUSTOM_1
      case 25 : // CUSTOM_2
      case 26 : // CUSTOM_3
      case 27 : // CUSTOM_4
      case 28 : // CUSTOM_5
      case 29 : // CUSTOM_6
      case 30 : // CUSTOM_7
      case 31 : // CUSTOM_8
	{
	  break;
	}
      default :
	{
	  throw ERRORMORPHEO(FUNCTION, "Invalid custom group number");
	}
      }
    
    return NULL; // unimplemented function
  }

#undef  FUNCTION
#define FUNCTION "custom::default_get_custom_execute_reset"
  custom_execute_transition_t * default_get_custom_execute_reset (uint32_t group)
  {
    switch (group)
      {
      case 24 : // CUSTOM_1
      case 25 : // CUSTOM_2
      case 26 : // CUSTOM_3
      case 27 : // CUSTOM_4
      case 28 : // CUSTOM_5
      case 29 : // CUSTOM_6
      case 30 : // CUSTOM_7
      case 31 : // CUSTOM_8
	{
	  break;
	}
      default :
	{
	  throw ERRORMORPHEO(FUNCTION, "Invalid custom group number");
	}
      }
    
    return NULL; // unimplemented function
  }

#undef  FUNCTION
#define FUNCTION "custom::default_get_vhdl_decod"
  custom_vhdl_t * default_get_vhdl_decod (void)
  {
    return NULL; // unimplemented function
  }

#undef  FUNCTION
#define FUNCTION "custom::default_get_vhdl_execute"
  custom_vhdl_t * default_get_vhdl_execute (void)
  {
    return NULL; // unimplemented function
  }

#undef  FUNCTION
#define FUNCTION "custom::default_get_custom_information"
  custom_information_t default_get_custom_information (uint32_t context)
  {
    custom_information_t info;
    
    info._get_valid_group               = &morpheo::behavioural::custom::default_get_valid_group              ;
    info._get_nb_register               = &morpheo::behavioural::custom::default_get_nb_register              ;
    info._get_access_mode               = &morpheo::behavioural::custom::default_get_access_mode              ;
    info._get_custom_decod              = &morpheo::behavioural::custom::default_get_custom_decod             ;
    info._get_custom_execute_genMoore   = &morpheo::behavioural::custom::default_get_custom_execute_genMoore  ;
    info._get_custom_execute_transition = &morpheo::behavioural::custom::default_get_custom_execute_transition;
    info._get_custom_execute_reset      = &morpheo::behavioural::custom::default_get_custom_execute_reset     ;
    info._get_vhdl_decod                = &morpheo::behavioural::custom::default_get_vhdl_decod               ;
    info._get_vhdl_execute              = &morpheo::behavioural::custom::default_get_vhdl_execute             ;
    return info;
  }
  
}; // end namespace custom
}; // end namespace behavioural
}; // end namespace morpheo              
