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

#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/include/Reservation_station.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_execute_loop {
namespace execute_loop {
namespace multi_read_unit {
namespace read_unit {
namespace reservation_station {


#undef  FUNCTION
#define FUNCTION "Reservation_station::Reservation_station"
#ifdef SYSTEMC
  Reservation_station::Reservation_station (sc_module_name name,
#else
  Reservation_station::Reservation_station (string name,
#endif
#ifdef STATISTICS
			  morpheo::behavioural::Parameters_Statistics * param_statistics,
#endif
			  morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit::read_unit::reservation_station::Parameters * param ):
			      _name              (name)
			      ,_param            (param)
// #ifdef STATISTICS
// 			      ,_param_statistics (param_statistics)
// #endif
  {
    log_printf(FUNC,Reservation_station,FUNCTION,"Begin");

#ifdef SYSTEMC
    log_printf(INFO,Reservation_station,FUNCTION,"Allocation");

    allocation ();
#endif

#ifdef STATISTICS
    log_printf(INFO,Reservation_station,FUNCTION,"Allocation of statistics");

    // Allocation of statistics
    _stat = new Statistics (static_cast<string>(_name),
			    param_statistics          ,
			    param);
#endif

#ifdef VHDL
    // generate the vhdl
    log_printf(INFO,Reservation_station,FUNCTION,"Generate the vhdl");

    vhdl();
#endif

#ifdef SYSTEMC
//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
    log_printf(INFO,Reservation_station,FUNCTION,"Method - transition");

    SC_METHOD (transition);
    dont_initialize ();
    sensitive_pos << *(in_CLOCK);
//#endif

#ifdef SYSTEMCASS_SPECIFIC
    // List dependency information
#endif    

    log_printf(INFO,Reservation_station,FUNCTION,"Method - genMoore");

    SC_METHOD (genMoore);
    dont_initialize ();
    sensitive_neg << *(in_CLOCK);

#ifdef SYSTEMCASS_SPECIFIC
    // List dependency information
#endif    

#endif
    log_printf(FUNC,Reservation_station,FUNCTION,"End");
  };
  
#undef  FUNCTION
#define FUNCTION "Reservation_station::~Reservation_station"
  Reservation_station::~Reservation_station (void)
  {
    log_printf(FUNC,Reservation_station,FUNCTION,"Begin");

#ifdef STATISTICS
    log_printf(INFO,Reservation_station,FUNCTION,"Generate Statistics file");

    _stat->generate_file(statistics(0));
    
    delete _stat;
#endif

#ifdef SYSTEMC
    log_printf(INFO,Reservation_station,FUNCTION,"Deallocation");

    deallocation ();
#endif

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

}; // end namespace reservation_station
}; // end namespace read_unit
}; // end namespace multi_read_unit
}; // end namespace execute_loop
}; // end namespace multi_execute_loop
}; // end namespace core

}; // end namespace behavioural
}; // end namespace morpheo              
