#ifndef morpheo_behavioural_constant_Constant_h

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

using namespace std;

namespace morpheo {
namespace behavioural {
namespace constant {
#define                 _size_instruction             32
#define                 _size_instruction_log2        5

  //------------------------------------------------------[ Control ]-----
  typedef bool          Tcontrol_t;

  //----------------------------------------------------[ Operation ]-----
  typedef uint8_t       Toperation_t;
// #define                 _nb_operation                 32
// #define                 _size_operation               5

#define                 _operation_none               0x0
#define                 _operation_l_adds             0x1
#define                 _operation_l_addu             0x2
#define                 _operation_l_subs             0x3
#define                 _operation_l_and              0x4
#define                 _operation_l_or               0x5
#define                 _operation_l_xor              0x6
#define                 _operation_l_cmove            0x7
#define                 _operation_l_read_imm         0x8
#define                 _operation_l_movhi            0x9
#define                 _operation_l_muls             0xa
#define                 _operation_l_mulu             0xb
#define                 _operation_l_divs             0xc
#define                 _operation_l_divu             0xd
#define                 _operation_l_exts             0xe
#define                 _operation_l_extz             0xf
#define                 _operation_l_ff1              0x10
#define                 _operation_l_fl1              0x11
#define                 _operation_l_sll              0x12
#define                 _operation_l_sla              0x13
#define                 _operation_l_srl              0x14
#define                 _operation_l_ror              0x15
#define                 _operation_l_cmp_eq           0x16
#define                 _operation_l_cmp_ne           0x17
#define                 _operation_l_cmp_ges          0x18
#define                 _operation_l_cmp_geu          0x19
#define                 _operation_l_cmp_gts          0x1a
#define                 _operation_l_cmp_gtu          0x1b
#define                 _operation_l_cmp_les          0x1c
#define                 _operation_l_cmp_leu          0x1d
#define                 _operation_l_cmp_lts          0x1e
#define                 _operation_l_cmp_ltu          0x1f

  //--------------------------------------------------[ destination ]-----
  typedef uint8_t       Tdestination1_t;
#define                 _size_destination1            4

#define                  cst_DESTINATION1_NONE        0x0
#define                 mask_DESTINATION1_GPR         0x1
#define                 mask_DESTINATION1_MEMORY      0x2
#define                 mask_DESTINATION1_SPR         0x4
#define                 mask_DESTINATION1_MAC_UNIT    0x8
  
  typedef uint8_t       Tdestination2_t;
#define                 _size_destination2  3

#define                  cst_DESTINATION2_NONE        0x0
#define                 mask_DESTINATION2_COMMIT      0x1
#define                 mask_DESTINATION2_MEMORY      0x2
#define                 mask_DESTINATION2_SPR         0x4
  
  //----------------------------------------------------[ exec_flag ]-----
  typedef uint8_t       Texec_flag_t;
#define                 _size_exec_flag               2

#define                 mask_EXEC_FLAG_NONE           0x1
#define                 mask_EXEC_FLAG_CARRY          0x1
#define                 mask_EXEC_FLAG_FLAG           0x1
#define                 mask_EXEC_FLAG_OVERFLOW       0x2

  //---------------------------------------------------[ exec_excep ]-----
  typedef bool          Texec_excep_t;
#define                  _size_exec_excep             1

#define                 mask_EXEC_EXCEP_NONE          0x0
#define                 mask_EXEC_EXCEP_RANGE         0x1
  
  //----------------------------------------------------[ Condition ]-----
  typedef uint8_t       Tcondition_t;
#define                 _size_condition               3
    
#define                  cst_CONDITION_UNCONDITIONAL  0x0           // None condition (jump)
#define                 mask_CONDITION_CONDITIONAL    0x2           
#define                 mask_CONDITION_CONDITIONAL_NF 0x0           // Branch if Flag is clear 
#define                 mask_CONDITION_CONDITIONAL_F  0x1           // Branch if Flag is set   
#define                 mask_CONDITION_REG            0x4           // Branch if a register is read
#define                 mask_CONDITION_STACK          0x8           // Branch with pop  in stack pointer

  //-------------------------------------------------[ branch_state ]-----
  typedef uint8_t       Tbranch_state_t;

#define                 cst_BRANCH_STATE_NONE         0x0           // 0 0
#define                 cst_BRANCH_STATE_NSPEC_TAKE   0x1           // 0 1  -> incondionnal
#define                 cst_BRANCH_STATE_SPEC_NTAKE   0x2           // 1 0
#define                 cst_BRANCH_STATE_SPEC_TAKE    0x3           // 1 1

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

#endif
