#ifndef morpheo_behavioural_core_multi_ooo_engine_ooo_engine_commit_unit_Types_h
#define morpheo_behavioural_core_multi_ooo_engine_ooo_engine_commit_unit_Types_h

/*
 * $Id: Types.h 100 2009-01-08 13:06:27Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/include/Types.h"

namespace morpheo {
namespace behavioural {
namespace core {
namespace multi_ooo_engine {
namespace ooo_engine {
namespace commit_unit {

  typedef enum
    {
      RETIRE_IN_ORDER       ,
      RETIRE_OOO_RENAME_UNIT,
      RETIRE_OOO_CONTEXT
    } retire_ooo_t;

  typedef enum
    {
      ROB_EMPTY                      , // 
      ROB_BRANCH_WAIT_END            , // 
      ROB_BRANCH_COMPLETE            , // 
      ROB_STORE_WAIT_HEAD_OK         , // 
//    ROB_STORE_WAIT_HEAD_KO         , // 
      ROB_STORE_HEAD_OK              , // 
      ROB_STORE_HEAD_KO              , // 
      ROB_OTHER_WAIT_END             , // 
      ROB_MISS_WAIT_END              , // 
      ROB_END_OK_SPECULATIVE         , // 
      ROB_END_OK                     , // 
      ROB_END_KO_SPECULATIVE         , // 
      ROB_END_KO                     , // 
      ROB_END_BRANCH_MISS_SPECULATIVE, // 
      ROB_END_BRANCH_MISS            , // 
      ROB_END_MISS                   , // 
      ROB_END_EXCEPTION_WAIT_HEAD    , // 
      ROB_END_EXCEPTION               // 
    } rob_state_t;

  class entry_t 
  {
  public  : rob_state_t        state                   ;
  public  : uint32_t           ptr                     ;
  public  : Tcontext_t         front_end_id            ;
  public  : Tcontext_t         context_id              ;
  public  : uint32_t           rename_unit_id          ;
  public  : Tdepth_t           depth                   ;
  public  : Ttype_t            type                    ;
  public  : Toperation_t       operation               ;
  public  : Tcontrol_t         is_delay_slot           ;
  public  : Tgeneral_data_t    address                 ;
  public  : Tcontrol_t         use_store_queue         ;
  public  : Tcontrol_t         use_load_queue          ;
  public  : Tlsq_ptr_t         store_queue_ptr_write   ;
  public  : Tlsq_ptr_t         load_queue_ptr_write    ;
  public  : Tcontrol_t         read_ra                 ;
  public  : Tgeneral_address_t num_reg_ra_log          ;
  public  : Tgeneral_address_t num_reg_ra_phy          ;
  public  : Tcontrol_t         read_rb                 ;
  public  : Tgeneral_address_t num_reg_rb_log          ;
  public  : Tgeneral_address_t num_reg_rb_phy          ;
  public  : Tcontrol_t         read_rc                 ;
  public  : Tspecial_address_t num_reg_rc_log          ;
  public  : Tspecial_address_t num_reg_rc_phy          ;
  public  : Tcontrol_t         write_rd                ;
  public  : Tgeneral_address_t num_reg_rd_log          ;
  public  : Tgeneral_address_t num_reg_rd_phy_old      ;
  public  : Tgeneral_address_t num_reg_rd_phy_new      ;
  public  : Tcontrol_t         write_re                ;
  public  : Tspecial_address_t num_reg_re_log          ;
  public  : Tspecial_address_t num_reg_re_phy_old      ;
  public  : Tspecial_address_t num_reg_re_phy_new      ;

  public  : Texception_t       exception               ;
  public  : Texception_t       exception_use           ;

  public  : Tspecial_data_t    flags                   ;
  public  : Tcontrol_t         no_sequence             ;
  public  : Tgeneral_data_t    data_commit             ; // branch's destination

//   public  : entry_t (uint32_t           ptr                     ,
// 		     Tcontext_t         front_end_id            ,
// 		     Tcontext_t         context_id              ,
// 		     Tcontext_t         rename_unit_id          ,
// 		     Tdepth_t           depth                   ,
// 		     Ttype_t            type                    ,
// 		     Toperation_t       operation               ,
// 		     Tcontrol_t         is_delay_slot           ,
// 		     Tgeneral_data_t    address                 ,
// 		     Texception_t       exception               ,
// 		     Texception_t       exception_use           ,
// 		     Tlsq_ptr_t         store_queue_ptr_write   ,
// 		     Tlsq_ptr_t         load_queue_ptr_write    ,
// 		     Tcontrol_t         read_ra                 ,
// 		     Tgeneral_address_t num_reg_ra_log          ,
// 		     Tgeneral_address_t num_reg_ra_phy          ,
// 		     Tcontrol_t         read_rb                 ,
// 		     Tgeneral_address_t num_reg_rb_log          ,
// 		     Tgeneral_address_t num_reg_rb_phy          ,
// 		     Tcontrol_t         read_rc                 ,
// 		     Tspecial_address_t num_reg_rc_log          ,
// 		     Tspecial_address_t num_reg_rc_phy          ,
// 		     Tcontrol_t         write_rd                ,
// 		     Tgeneral_address_t num_reg_rd_log          ,
// 		     Tgeneral_address_t num_reg_rd_phy_old      ,
// 		     Tgeneral_address_t num_reg_rd_phy_new      ,
// 		     Tcontrol_t         write_re                ,
// 		     Tspecial_address_t num_reg_re_log          ,
// 		     Tspecial_address_t num_reg_re_phy_old      ,
// 		     Tspecial_address_t num_reg_re_phy_new      )
//     {
//       this->ptr                     = ptr                   ;
//       this->front_end_id            = front_end_id          ;
//       this->context_id              = context_id            ;
//       this->rename_unit_id          = rename_unit_id        ;
//       this->depth                   = depth                 ;
//       this->type                    = type                  ;
//       this->operation               = operation             ;
//       this->is_delay_slot           = is_delay_slot         ;
//       this->address                 = address               ;
//       this->exception               = exception             ;
//       this->exception_use           = exception_use         ;
//       this->store_queue_ptr_write   = store_queue_ptr_write ;
//       this->load_queue_ptr_write    = load_queue_ptr_write  ;
//       this->read_ra                 = read_ra               ;
//       this->num_reg_ra_log          = num_reg_ra_log        ;
//       this->num_reg_ra_phy          = num_reg_ra_phy        ;
//       this->read_rb                 = read_rb               ;
//       this->num_reg_rb_log          = num_reg_rb_log        ;
//       this->num_reg_rb_phy          = num_reg_rb_phy        ;
//       this->read_rc                 = read_rc               ;
//       this->num_reg_rc_log          = num_reg_rc_log        ;
//       this->num_reg_rc_phy          = num_reg_rc_phy        ;
//       this->write_rd                = write_rd              ;
//       this->num_reg_rd_log          = num_reg_rd_log        ;
//       this->num_reg_rd_phy_old      = num_reg_rd_phy_old    ;
//       this->num_reg_rd_phy_new      = num_reg_rd_phy_new    ;
//       this->write_re                = write_re              ;
//       this->num_reg_re_log          = num_reg_re_log        ;
//       this->num_reg_re_phy_old      = num_reg_re_phy_old    ;
//       this->num_reg_re_phy_new      = num_reg_re_phy_new    ;
//     }
  };

}; // end namespace commit_unit
}; // end namespace ooo_engine
}; // end namespace multi_ooo_engine
}; // end namespace core
}; // end namespace behavioural

 template<> inline std::string toString<morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::rob_state_t>(const morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::rob_state_t& x)
  {
    switch (x)
      {
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_EMPTY                      : return "ROB_EMPTY"                       ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_BRANCH_WAIT_END            : return "ROB_BRANCH_WAIT_END"             ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_BRANCH_COMPLETE            : return "ROB_BRANCH_COMPLETE"             ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_WAIT_HEAD_OK         : return "ROB_STORE_WAIT_HEAD_OK"          ; break;
//    case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_WAIT_HEAD_KO         : return "ROB_STORE_WAIT_HEAD_KO"          ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_HEAD_OK              : return "ROB_STORE_HEAD_OK"               ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_STORE_HEAD_KO              : return "ROB_STORE_HEAD_KO"               ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_OTHER_WAIT_END             : return "ROB_OTHER_WAIT_END"              ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_MISS_WAIT_END              : return "ROB_MISS_WAIT_END"               ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_OK_SPECULATIVE         : return "ROB_END_OK_SPECULATIVE"          ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_OK                     : return "ROB_END_OK"                      ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_KO_SPECULATIVE         : return "ROB_END_KO_SPECULATIVE"          ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_KO                     : return "ROB_END_KO"                      ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_BRANCH_MISS_SPECULATIVE: return "ROB_END_BRANCH_MISS_SPECULATIVE" ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_BRANCH_MISS            : return "ROB_END_BRANCH_MISS"             ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_MISS                   : return "ROB_END_MISS"                    ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_EXCEPTION_WAIT_HEAD    : return "ROB_END_EXCEPTION_WAIT_HEAD"     ; break;
      case morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::ROB_END_EXCEPTION              : return "ROB_END_EXCEPTION"               ; break;

      default    : return ""      ; break;
      }
  };

}; // end namespace morpheo              

#endif
