#ifdef SYSTEMC
/*
 * $Id: Core_Glue_transition.cpp 118 2009-05-20 22:01:32Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Core/Core_Glue/include/Core_Glue.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace core_glue {


#undef  FUNCTION
#define FUNCTION "Core_Glue::transition"
  void Core_Glue::transition (void)
  {
    log_begin(Core_Glue,FUNCTION);

    if (PORT_READ(in_NRESET) == 0)
      {
        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
          {
//          _priority_ooo_engine [i]->reset();
            _priority_read_unit  [i]->reset();
          }
        _priority_ooo_engine->reset();

        reg_PRIORITY = 0;
      }
    else
      {
	// next priority
        for (uint32_t i=0; i<_param->_nb_execute_loop; ++i)
          {
//          _priority_ooo_engine [i]->transition();
            _priority_read_unit  [i]->transition();
          }
        _priority_ooo_engine->transition();

        reg_PRIORITY ++;
      }

#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
    end_cycle ();
#endif

    log_end(Core_Glue,FUNCTION);
  };

}; // end namespace core_glue
}; // end namespace core

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