Ignore:
Timestamp:
Mar 27, 2008, 11:04:49 AM (16 years ago)
Author:
rosiere
Message:

Add :

  • Execute_loop (must be test systemC)
  • Prediction
    • Direction : predifined scheme
    • Branch Target Buffer
  • iFetch_unit
    • ifetch_queue
    • pc management
  • Decod_unit
    • coming soon : support for custom operation
  • Rename_unit
    • RAT
    • Free_list
    • Dependence RAW check
    • Load store unit pointer
  • New Environnement (hierarchy_memory will remove in a next version)


Modif :

  • Manage Custom Operation
  • All component in execute_loop to use the new statistics management

Not Finish :

  • Return Address Stack
  • Environnement
Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/include
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Allocation.h

    r76 r78  
    77// -----[ NO ITERATION ]-------------------------------------------------
    88// ----------------------------------------------------------------------
     9
     10#define __ALLOC_SIGNAL(sig, name, type)         \
     11  {                                             \
     12    sig = new type (name);                      \
     13  }
    914
    1015#ifdef POSITION
     
    1621#endif
    1722
    18 #define ALLOC_VALACK_IN(  sig, name, type)                              \
     23#define ALLOC_VAL_ACK_IN(  sig, name, type)                             \
    1924  {                                                                     \
    2025    sig = interface->set_signal_valack_in (name, type);                 \
    2126  }                                                                     
    22 #define ALLOC_VALACK_OUT( sig, name, type)                              \
     27#define ALLOC_VAL_ACK_OUT( sig, name, type)                             \
    2328  {                                                                     \
    2429    sig = interface->set_signal_valack_out(name, type);                 \
    2530  }                                                                     
    26 #define ALLOC_VAL_IN(     sig)                                          \
    27   {                                                                     \
    28     sig = interface->set_signal_valack_in (VAL);                        \
     31#define ALLOC_VALACK_IN(     sig, type)                                 \
     32  {                                                                     \
     33    sig = interface->set_signal_valack_in (type);                       \
    2934  }                                                                     
    30 #define ALLOC_VAL_OUT(    sig)                                          \
    31   {                                                                     \
    32     sig = interface->set_signal_valack_out(VAL);                        \
    33   }                                                                     
    34 #define ALLOC_ACK_IN(     sig)                                          \
    35   {                                                                     \
    36     sig = interface->set_signal_valack_in (ACK);                        \
    37   }                                                                     
    38 #define ALLOC_ACK_OUT(    sig)                                          \
    39   {                                                                     \
    40     sig = interface->set_signal_valack_out(ACK);                        \
     35#define ALLOC_VALACK_OUT(    sig, type)                                 \
     36  {                                                                     \
     37    sig = interface->set_signal_valack_out(type);                       \
    4138  }                                                                     
    4239#define ALLOC_SIGNAL_IN(  sig, name, type, size)                        \
     
    6057// -----[ ITERATION 1 ]--------------------------------------------------
    6158// ----------------------------------------------------------------------
     59
     60#define __ALLOC1_INTERFACE(name, it1)           \
     61  const std::string interface_name = name;      \
     62  const uint32_t iterator_1 = it1;
     63
     64#define __ALLOC1_SIGNAL_IN( sig, name, type)            \
     65  {                                                                     \
     66    sig = new SC_IN(type) * [iterator_1];                               \
     67    std::string separator="_";                                          \
     68    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
     69      {                                                                 \
     70        std::string str = "in_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \
     71        sig [alloc_signal_it1] = new SC_IN(type) (str.c_str());         \
     72      }                                                                 \
     73  }
     74
     75#define __ALLOC1_SIGNAL_OUT( sig, name, type)           \
     76  {                                                                     \
     77    sig = new SC_OUT(type) * [iterator_1];                              \
     78    std::string separator="_";                                          \
     79    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
     80      {                                                                 \
     81        std::string str = "out_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \
     82        sig [alloc_signal_it1] = new SC_OUT(type) (str.c_str());                \
     83      }                                                                 \
     84  }
    6285
    6386#ifdef POSITION
     
    6689  Interface_fifo * interface [iterator_1];                              \
    6790  {                                                                     \
    68     std::string      separator="_";                                     \
    69     for (uint32_t i=0; i<iterator_1; i++)                               \
    70       {                                                                 \
    71         interface [i] = _interfaces->set_interface( name+separator+toString(i), direction, localisation, str); \
     91    std::string separator="_";                                          \
     92    for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \
     93      {                                                                 \
     94        interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1), direction, localisation, str); \
    7295      }                                                                 \
    7396  }
     
    77100  Interface_fifo * interface [iterator_1];                              \
    78101  {                                                                     \
    79     std::string      separator="_";                                     \
    80     for (uint32_t i=0; i<iterator_1; i++)                               \
    81       {                                                                 \
    82         interface [i] = _interfaces->set_interface( name+separator+toString(i)); \
     102    std::string separator="_";                                          \
     103    for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \
     104      {                                                                 \
     105        interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)); \
    83106      }                                                                 \
    84107  }
    85108#endif
    86109
    87 
    88 #define ALLOC1_VALACK_IN( sig, name, type)                              \
     110#define ALLOC1_VAL_ACK_IN( sig, name, type)                             \
    89111  {                                                                     \
    90112    sig = new SC_IN (Tcontrol_t) * [iterator_1];                        \
    91     for (uint32_t i=0; i<iterator_1; i++)                               \
    92       {                                                                 \
    93         sig [i] = interface[i]->set_signal_valack_in (name, type);      \
    94       }                                                                 \
    95   }
    96 #define ALLOC1_VALACK_OUT(sig, name, type)                              \
     113    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
     114      {                                                                 \
     115        sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (name, type); \
     116      }                                                                 \
     117  }
     118#define ALLOC1_VAL_ACK_OUT(sig, name, type)                             \
    97119  {                                                                     \
    98120    sig = new SC_OUT(Tcontrol_t) * [iterator_1];                        \
    99     for (uint32_t i=0; i<iterator_1; i++)                               \
    100       {                                                                 \
    101         sig [i] = interface[i]->set_signal_valack_out(name, type);      \
    102       }                                                                 \
    103   }
    104 #define ALLOC1_VAL_IN(    sig)                                          \
     121    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
     122      {                                                                 \
     123        sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(name, type); \
     124      }                                                                 \
     125  }
     126#define ALLOC1_VALACK_IN(    sig, type)                                 \
    105127  {                                                                     \
    106128    sig = new SC_IN (Tcontrol_t) * [iterator_1];                        \
    107     for (uint32_t i=0; i<iterator_1; i++)                               \
    108       {                                                                 \
    109         sig [i] = interface[i]->set_signal_valack_in (VAL);             \
    110       }                                                                 \
    111   }
    112 #define ALLOC1_VAL_OUT(   sig)                                          \
     129    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
     130      {                                                                 \
     131        sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (type); \
     132      }                                                                 \
     133  }
     134#define ALLOC1_VALACK_OUT(   sig, type)                                 \
    113135  {                                                                     \
    114136    sig = new SC_OUT(Tcontrol_t) * [iterator_1];                        \
    115     for (uint32_t i=0; i<iterator_1; i++)                               \
    116       {                                                                 \
    117         sig [i] = interface[i]->set_signal_valack_out(VAL);             \
    118       }                                                                 \
    119   }
    120 #define ALLOC1_ACK_IN(    sig)                                          \
    121   {                                                                     \
    122     sig = new SC_IN (Tcontrol_t) * [iterator_1];                        \
    123     for (uint32_t i=0; i<iterator_1; i++)                               \
    124       {                                                                 \
    125         sig [i] = interface[i]->set_signal_valack_in (ACK);             \
    126       }                                                                 \
    127   }
    128 #define ALLOC1_ACK_OUT(   sig)                                          \
    129   {                                                                     \
    130     sig = new SC_OUT(Tcontrol_t) * [iterator_1];                        \
    131     for (uint32_t i=0; i<iterator_1; i++)                               \
    132       {                                                                 \
    133         sig [i] = interface[i]->set_signal_valack_out(ACK);             \
     137    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
     138      {                                                                 \
     139        sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(type); \
    134140      }                                                                 \
    135141  }
     
    138144    {                                                                   \
    139145      sig = new SC_IN (type) * [iterator_1];                            \
    140       for (uint32_t i=0; i<iterator_1; i++)                             \
     146      for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
    141147        {                                                               \
    142           sig [i] = interface[i]->set_signal_in <type> (name, size);    \
     148          sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_in <type> (name, size); \
    143149        }                                                               \
    144150    }
     
    148154    {                                                                   \
    149155      sig = new SC_OUT(type) * [iterator_1];                            \
    150       for (uint32_t i=0; i<iterator_1; i++)                             \
     156      for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
    151157        {                                                               \
    152           sig [i] = interface[i]->set_signal_out<type> (name, size);    \
     158          sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_out<type> (name, size); \
    153159        }                                                               \
    154160    }
     
    159165    std::string separator="_";                                          \
    160166    std::string str;                                                    \
    161     for (uint32_t i=0; i<it1; i++)                                      \
    162       {                                                                 \
    163         str = name+separator+toString(i);                               \
    164         sig [i] = new sc_signal<type> (str.c_str());                    \
    165       }                                                                 \
    166   }
    167 
    168 #define INSTANCE1_SC_SIGNAL(component, sig, it1)        \
    169   for (uint32_t i=0; i<it1; i++)                        \
    170     {                                                   \
    171       (*(component->sig[i])) (*(sig[i]));               \
    172     }
    173 
     167    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
     168      {                                                                 \
     169        str = name+separator+toString(alloc_signal_it1);                \
     170        sig [alloc_signal_it1] = new sc_signal<type> (str.c_str());     \
     171      }                                                                 \
     172  }
     173
     174#define INSTANCE1_SC_SIGNAL(component, sig, it1)                        \
     175  for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
     176    {                                                                   \
     177      (*(component->sig[alloc_signal_it1])) (*(sig[alloc_signal_it1])); \
     178    }
     179
     180// ----------------------------------------------------------------------
     181// -----[ ITERATION 2 ]--------------------------------------------------
     182// ----------------------------------------------------------------------
     183
     184#ifdef POSITION
     185#define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2) \
     186  uint32_t iterator_1 = 0;                                              \
     187  uint32_t iterator_2 = 0;                                              \
     188  Interface_fifo *** interface;                                         \
     189  {                                                                     \
     190    std::string separator="_";                                          \
     191    iterator_1 = it1;                                                   \
     192    interface = new Interface_fifo ** [iterator_1];                     \
     193    for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \
     194      {                                                                 \
     195        iterator_2 = it2;                                               \
     196        interface [alloc_interface_it1] = new Interface_fifo * [iterator_2]; \
     197        for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++) \
     198          {                                                             \
     199            interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2), direction, localisation, str); \
     200          }                                                             \
     201      }                                                                 \
     202  }
     203#else
     204#define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2) \
     205  uint32_t iterator_1 = 0;                                              \
     206  uint32_t iterator_2 = 0;                                              \
     207  Interface_fifo *** interface;                                         \
     208  {                                                                     \
     209    std::string separator="_";                                          \
     210    iterator_1 = it1;                                                   \
     211    interface = new Interface_fifo ** [iterator_1];                     \
     212    for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \
     213      {                                                                 \
     214        iterator_2 = it2;                                               \
     215        interface [alloc_interface_it1] = new Interface_fifo * [iterator_2]; \
     216        for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++) \
     217          {                                                             \
     218            interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2)); \
     219          }                                                             \
     220      }                                                                 \
     221  }
    174222#endif
     223
     224#define _ALLOC2_VAL_ACK_IN( sig, name, type, it1, it2)                  \
     225  {                                                                     \
     226    sig = new SC_IN (Tcontrol_t) ** [it1];                              \
     227    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
     228      {                                                                 \
     229        sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2];        \
     230        for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
     231          {                                                             \
     232            sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (name, type); \
     233          }                                                             \
     234      }                                                                 \
     235  }
     236
     237#define _ALLOC2_VAL_ACK_OUT( sig, name, type, it1, it2)                 \
     238  {                                                                     \
     239    sig = new SC_OUT (Tcontrol_t) ** [it1];                             \
     240    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
     241      {                                                                 \
     242        sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2];       \
     243        for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
     244          {                                                             \
     245            sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (name, type); \
     246          }                                                             \
     247      }                                                                 \
     248  }
     249
     250#define _ALLOC2_VALACK_IN(    sig,type, it1, it2)                       \
     251  {                                                                     \
     252    sig = new SC_IN (Tcontrol_t) ** [it1];                              \
     253    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
     254      {                                                                 \
     255        sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2];        \
     256        for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
     257          {                                                             \
     258            sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (type); \
     259          }                                                             \
     260      }                                                                 \
     261  }
     262
     263#define _ALLOC2_VALACK_OUT(    sig,type, it1, it2)                      \
     264  {                                                                     \
     265    sig = new SC_OUT (Tcontrol_t) ** [it1];                             \
     266    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
     267      {                                                                 \
     268        sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2];       \
     269        for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
     270          {                                                             \
     271            sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (type); \
     272          }                                                             \
     273      }                                                                 \
     274  }
     275
     276#define _ALLOC2_SIGNAL_IN( sig, name, type, size, it1, it2)             \
     277  if (size > 0)                                                         \
     278    {                                                                   \
     279      sig = new SC_IN (type) ** [it1];                                  \
     280      for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
     281        {                                                               \
     282          sig [alloc_signal_it1] = new SC_IN (type) * [it2];            \
     283          for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
     284            {                                                           \
     285              sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_in <type> (name, size); \
     286            }                                                           \
     287        }                                                               \
     288    }
     289
     290#define _ALLOC2_SIGNAL_OUT( sig, name, type, size, it1, it2)            \
     291  if (size > 0)                                                         \
     292    {                                                                   \
     293      sig = new SC_OUT (type) ** [it1];                                 \
     294      for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
     295        {                                                               \
     296          sig [alloc_signal_it1] = new SC_OUT (type) * [it2];           \
     297          for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
     298            {                                                           \
     299              sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_out <type> (name, size); \
     300            }                                                           \
     301        }                                                               \
     302    }
     303
     304#define ALLOC2_VAL_ACK_IN( sig, name, type      ) _ALLOC2_VAL_ACK_IN( sig, name, type      , iterator_1, iterator_2)
     305#define ALLOC2_VAL_ACK_OUT(sig, name, type      ) _ALLOC2_VAL_ACK_OUT(sig, name, type      , iterator_1, iterator_2)
     306#define ALLOC2_VALACK_IN(  sig,       type      ) _ALLOC2_VALACK_IN(  sig,       type      , iterator_1, iterator_2)
     307#define ALLOC2_VALACK_OUT( sig,       type      ) _ALLOC2_VALACK_OUT( sig,       type      , iterator_1, iterator_2)
     308#define ALLOC2_SIGNAL_IN(  sig, name, type, size) _ALLOC2_SIGNAL_IN(  sig, name, type, size, iterator_1, iterator_2)
     309#define ALLOC2_SIGNAL_OUT( sig, name, type, size) _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2)
     310
     311#define ALLOC2_SC_SIGNAL( sig, name, type, it1, it2)                    \
     312  sc_signal<type> *** sig = new sc_signal<type> ** [it1];               \
     313  {                                                                     \
     314    std::string separator="_";                                          \
     315    std::string str;                                                    \
     316    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
     317      {                                                                 \
     318        sig [alloc_signal_it1] = new sc_signal<type> * [it2];           \
     319        for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
     320          {                                                             \
     321            str = name+separator+toString(alloc_signal_it1)+separator+toString(alloc_signal_it2); \
     322            sig [alloc_signal_it1][alloc_signal_it2] = new sc_signal<type> (str.c_str()); \
     323          }                                                             \
     324      }                                                                 \
     325  }
     326
     327#define INSTANCE2_SC_SIGNAL(component, sig, it1, it2)                   \
     328  for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
     329    for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
     330      {                                                                 \
     331        (*(component->sig[alloc_signal_it1][alloc_signal_it2])) (*(sig[alloc_signal_it1][alloc_signal_it2])); \
     332      }
     333#endif
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Component.h

    r75 r78  
    2525namespace behavioural          {
    2626
     27#ifdef DEBUG
     28# define PORT_MAP(x,a,b,c,d)                                            \
     29  do                                                                    \
     30    {                                                                   \
     31      try                                                               \
     32        {                                                               \
     33          x->port_map(a,b,c,d);                                         \
     34        }                                                               \
     35      catch (morpheo::ErrorMorpheo & error)                             \
     36        {                                                               \
     37          throw (ErrorMorpheo ("In file "+toString(__FILE__)+", at line "+toString(__LINE__)+"\n"+error.what ())); \
     38        }                                                               \
     39    }                                                                   \
     40  while (0)
     41#else
     42# define PORT_MAP(x,a,b,c,d)                                            \
     43  do                                                                    \
     44    {                                                                   \
     45      x->port_map(a,b,c,d);                                             \
     46    }                                                                   \
     47  while (0)
     48#endif
     49
     50#define COMPONENT_MAP(x,a,b,c,d)                                        \
     51  do                                                                    \
     52    {                                                                   \
     53      PORT_MAP(x,a,b,c,d);                                              \
     54      PORT_MAP(x,c,d,a,b);                                              \
     55    }                                                                   \
     56  while (0)
     57 
     58
    2759  typedef uint8_t Tinstance_t;
    2860
     
    3567  typedef struct
    3668  {
    37     public : Tinstance_t _instance;
    38     public : Entity    * _entity  ;
     69//public : Component * _component;
     70  public : Entity    * _entity   ;
     71  public : Tinstance_t _instance ;
    3972  } Tcomponent_t;   
    4073 
     
    4275  {
    4376    // -----[ fields ]----------------------------------------------------
    44   private   : const Tusage_t        _usage;
    45   private   : Entity              * _entity        ;
     77  private   : const Tusage_t             _usage;
     78  private   : Entity                   * _entity        ;
    4679  private   : std::list<Tcomponent_t*> * _list_component;
    4780
     
    5790#endif
    5891                                                       );
    59   private   : std::string                get_entity        (void);
     92  private   : std::string           get_entity        (void);
    6093
    6194  public    : void                  set_component     (Component * component
     
    69102                                                       );
    70103
    71   private   : std::string                get_component     (void);
     104  private   : std::string           get_component     (void);
    72105
    73106  private   : Entity *              find_entity       (std::string name);
     
    87120                                                       std::string component_dest,
    88121                                                       std::string port_dest    );
    89   public    : void                  port_map          (std::string component_src ,
    90                                                        std::string port_src      );
    91122
    92   public    : bool                  test_map          (void);
     123  public    : bool                  test_map          (bool recursive=true);
     124  private   : bool                  test_map          (uint32_t depth, bool recursive);
    93125
    94126#ifdef POSITION
     
    102134  public    : void                  generate_file     (void);
    103135#endif   
    104   public    : friend std::ostream&       operator<<        (std::ostream& output_stream,
    105                                                             morpheo::behavioural::Component & x);
     136  public    : friend std::ostream&  operator<<        (std::ostream& output_stream,
     137                                                       morpheo::behavioural::Component & x);
    106138  };
    107139
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Constants.h

    r77 r78  
    161161#  define OPERATION_FIND_L_FL1                     0x2        // 000_0000 l.fl1
    162162
    163 #  define OPERATION_SPECIAL_L_MFSPR                0x1        // 000_0000 l.mfspr
    164 #  define OPERATION_SPECIAL_L_MTSPR                0x2        // 000_0000 l.mtspr
    165 #  define OPERATION_SPECIAL_L_MAC                  0x4        // 000_0000 l.mac   , l.maci
    166 #  define OPERATION_SPECIAL_L_MACRC                0x8        // 000_0000 l.macrc
    167 #  define OPERATION_SPECIAL_L_MSB                  0x10       // 000_0000 l.msb
    168 
    169 #  define OPERATION_BRANCH_L_TEST_NF               0x1        // 000_0000 l.bnf
    170 #  define OPERATION_BRANCH_L_TEST_F                0x2        // 000_0000 l.bf
    171 #  define OPERATION_BRANCH_L_JALR                  0x4        // 000_0000 l.jal   , l.jalr , l.jr
     163#  define OPERATION_SPECIAL_L_NOP                  0xff       // 000_0000 l.nop   
     164#  define OPERATION_SPECIAL_L_MFSPR                0x1        // 000_0001 l.mfspr
     165#  define OPERATION_SPECIAL_L_MTSPR                0x2        // 000_0010 l.mtspr
     166#  define OPERATION_SPECIAL_L_RFE                  0x4        // 000_0100 l.rfe 
     167#  define OPERATION_SPECIAL_L_MAC                  0x11       // 001_0001 l.mac   , l.maci
     168#  define OPERATION_SPECIAL_L_MACRC                0x12       // 001_0010 l.macrc
     169#  define OPERATION_SPECIAL_L_MSB                  0x14       // 001_0100 l.msb
     170#  define OPERATION_SPECIAL_L_MSYNC                0x21       // 010_0001 l.msync
     171#  define OPERATION_SPECIAL_L_PSYNC                0x22       // 010_0010 l.psync
     172#  define OPERATION_SPECIAL_L_CSYNC                0x24       // 010_0100 l.csync
     173#  define OPERATION_SPECIAL_L_SYS                  0x41       // 100_0001 l.sys 
     174#  define OPERATION_SPECIAL_L_TRAP                 0x42       // 100_0010 l.trap
     175
     176
     177#  define OPERATION_BRANCH_NONE                    0x1        // 000_0000 l.j
     178#  define OPERATION_BRANCH_L_TEST_NF               0x2        // 000_0000 l.bnf
     179#  define OPERATION_BRANCH_L_TEST_F                0x4        // 000_0000 l.bf
     180#  define OPERATION_BRANCH_L_JALR                  0x8        // 000_0000 l.jal   , l.jalr , l.jr
    172181
    173182  //-------------------------------------------------------[ Custom ]-----
     
    195204
    196205#  define SIZE_EXCEPTION                           5
     206#  define SIZE_EXCEPTION_USE                       4
     207#  define SIZE_EXCEPTION_MEMORY                    3
     208#  define SIZE_EXCEPTION_CUSTOM                    3
     209#  define SIZE_EXCEPTION_ALU                       2
     210#  define SIZE_EXCEPTION_DECOD                     2
     211#  define SIZE_EXCEPTION_IFETCH                    2
    197212
    198213#  define EXCEPTION_NONE                           0x00       // none exception
     
    229244#  define EXCEPTION_CUSTOM_6                       0x1f       // Reserved for custom exceptions
    230245
     246
    231247#define exception_to_address(x) (x<<8)
    232248
     
    253269#  define EXCEPTION_ALU_SPR_ACCESS_INVALID         0x2        // SPR     present in ALU but not compatible privilege
    254270#  define EXCEPTION_ALU_SPR_ACCESS_NOT_COMPLETE    0x3        // SPR not present in ALU
     271
     272#  define EXCEPTION_DECOD_NONE                     0x0        // none exception
     273#  define EXCEPTION_DECOD_ILLEGAL_INSTRUCTION      0x1        // Instruction is illegal (no implemented)
     274#  define EXCEPTION_DECOD_SYSCALL                  0x2        // System Call
     275//#define EXCEPTION_DECOD_TRAP                     0x4        // L.trap or debug unit (note : must read SR !)
     276
     277#  define EXCEPTION_IFETCH_NONE                    0x0        // Fetch Unit generate none exception
     278#  define EXCEPTION_IFETCH_INSTRUCTION_TLB         0x1        // ITLB miss
     279#  define EXCEPTION_IFETCH_INSTRUCTION_PAGE        0x2        // No matching or page violation protection in pages tables
     280#  define EXCEPTION_IFETCH_BUS_ERROR               0x3        // Access at a invalid physical address
     281
     282#  define EXCEPTION_USE_NONE                       0x0        //
     283#  define EXCEPTION_USE_ILLEGAL_INSTRUCTION        0x1        // illegal_instruction
     284#  define EXCEPTION_USE_RANGE                      0x2        // range
     285#  define EXCEPTION_USE_MEMORY_WITH_ALIGNMENT      0x3        // TLB miss, page fault, bus error, alignment
     286#  define EXCEPTION_USE_MEMORY_WITHOUT_ALIGNMENT   0x4        // TLB miss, page fault, bus error
     287#  define EXCEPTION_USE_SYSCALL                    0x5        // syscall
     288#  define EXCEPTION_USE_TRAP                       0x6        // trap
     289#  define EXCEPTION_USE_CUSTOM_0                   0x7        //
     290#  define EXCEPTION_USE_CUSTOM_1                   0x8        //
     291#  define EXCEPTION_USE_CUSTOM_2                   0x9        //
     292#  define EXCEPTION_USE_CUSTOM_3                   0xa        //
     293#  define EXCEPTION_USE_CUSTOM_4                   0xb        //
     294#  define EXCEPTION_USE_CUSTOM_5                   0xc        //
     295#  define EXCEPTION_USE_CUSTOM_6                   0xd        //
     296
     297  //=======================================================[ icache ]=====
     298
     299  //--------------------------------------------------[ icache_type ]-----
     300
     301#  define SIZE_ICACHE_TYPE                              2
     302
     303#  define ICACHE_TYPE_LOAD                              0x0        // 0000
     304#  define ICACHE_TYPE_LOCK                              0x1        // 0001
     305#  define ICACHE_TYPE_INVALIDATE                        0x2        // 0010
     306#  define ICACHE_TYPE_PREFETCH                          0x3        // 0011
     307
     308// just take the 2 less significative bits.
     309#define operation_to_icache_type(x) (x&0x3)
     310
     311  //-------------------------------------------------[ icache_error ]-----
     312
     313#  define SIZE_ICACHE_ERROR                             1
     314
     315#  define ICACHE_ERROR_NONE                             0x0
     316#  define ICACHE_ERROR_BUS_ERROR                        0x1
    255317
    256318  //=======================================================[ dcache ]=====
     
    377439#  define SPR_MACHI                                2          // MAC High
    378440
     441#  define NB_SPR_LOGIC                             2
     442#  define LOG2_NB_SPR_LOGIC                        1
     443  // SPR_LOGIC[0] = F
     444  // SPR_LOGIC[1] = Carry, Overflow
     445#  define SPR_LOGIC_SR_F                           0x0        // Status register bit F                   (size = 1)
     446#  define SPR_LOGIC_SR_CY_OV                       0x1        // Status register bit overflow and carry  (size = 2)
     447
    379448  //----------------------------------------------[ spr_mode_access ]-----
    380449
     
    385454#  define SPR_ACCESS_MODE_READ_ONLY_COND           0x5        // 101 special read
    386455
     456  //--------------------------------------------------------[ event ]-----
     457#  define SIZE_EVENT_STATE                         2
     458
     459#  define EVENT_STATE_NO_EVENT                     0          // no event : current case
     460#  define EVENT_STATE_EVENT                        1          // Have a event : make necessary to manage the event
     461#  define EVENT_STATE_WAITEND                      2          // Wait end of manage event (restaure a good context)
     462#  define EVENT_STATE_END                          3          // CPU can continue
     463
     464#  define SIZE_EVENT_TYPE                          3
     465
     466#  define EVENT_TYPE_NONE                          0          // no event
     467#  define EVENT_TYPE_MISS_SPECULATION              1          // miss of speculation (load or branch miss speculation)
     468#  define EVENT_TYPE_EXCEPTION                     2          // exception or interruption occure
     469#  define EVENT_TYPE_BRANCH_NO_ACCURATE            3          // branch is no accurate (old speculation is a miss)
     470#  define EVENT_TYPE_SPR_ACCESS                    4          // decod a mtspr or mfspr instruction
     471#  define EVENT_TYPE_MSYNC                         5          // decod a memory   synchronization
     472#  define EVENT_TYPE_PSYNC                         6          // decod a pipeline synchronization
     473#  define EVENT_TYPE_CSYNC                         7          // decod a context  synchronization
     474
     475  //-------------------------------------------------[ branch_state ]-----
     476#  define SIZE_BRANCH_STATE                        2
     477
     478#  define BRANCH_STATE_NONE                        0x0        // 0 0
     479#  define BRANCH_STATE_NSPEC_TAKE                  0x1        // 0 1  -> incondionnal
     480#  define BRANCH_STATE_SPEC_NTAKE                  0x2        // 1 0
     481#  define BRANCH_STATE_SPEC_TAKE                   0x3        // 1 1
     482
     483  //---------------------------------------------[ branch_condition ]-----
     484
     485#  define SIZE_BRANCH_CONDITION                    4
     486
     487#  define BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK          0x0        // None condition (jump)
     488#  define BRANCH_CONDITION_NONE_WITH_WRITE_STACK             0x8        // None condition (jump)
     489#  define BRANCH_CONDITION_FLAG_UNSET                        0x2        // Branch if Flag is clear
     490#  define BRANCH_CONDITION_FLAG_SET                          0x3        // Branch if Flag is set
     491#  define BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK 0x4        // Branch if a register is read
     492#  define BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK    0xc        // Branch if a register is read
     493#  define BRANCH_CONDITION_READ_STACK                        0xf        // Branch with pop  in stack pointer
     494
     495  //--------------------------------------------------[ instruction ]-----
     496#  define NB_INSTRUCTION                           213        // 92 ORBIS, 30 ORFPX (15 simple, 15 double), 91 ORVDX (38 on byte, 41 on half, 12 independant format)
     497
     498  enum
     499    {
     500      // ORBIS
     501      INSTRUCTION_L_ADD,
     502      INSTRUCTION_L_ADDC,
     503      INSTRUCTION_L_ADDI,
     504      INSTRUCTION_L_ADDIC,
     505      INSTRUCTION_L_AND,
     506      INSTRUCTION_L_ANDI,
     507      INSTRUCTION_L_BF,
     508      INSTRUCTION_L_BNF,
     509      INSTRUCTION_L_CMOV,
     510      INSTRUCTION_L_CSYNC,
     511      INSTRUCTION_L_CUST1,
     512      INSTRUCTION_L_CUST2,
     513      INSTRUCTION_L_CUST3,
     514      INSTRUCTION_L_CUST4,
     515      INSTRUCTION_L_CUST5,
     516      INSTRUCTION_L_CUST6,
     517      INSTRUCTION_L_CUST7,
     518      INSTRUCTION_L_CUST8,
     519      INSTRUCTION_L_DIV,
     520      INSTRUCTION_L_DIVU,
     521      INSTRUCTION_L_EXTBS,
     522      INSTRUCTION_L_EXTBZ,
     523      INSTRUCTION_L_EXTHS,
     524      INSTRUCTION_L_EXTHZ,
     525      INSTRUCTION_L_EXTWS,
     526      INSTRUCTION_L_EXTWZ,
     527      INSTRUCTION_L_FF1,
     528      INSTRUCTION_L_FL1,
     529      INSTRUCTION_L_J,
     530      INSTRUCTION_L_JAL,
     531      INSTRUCTION_L_JALR,
     532      INSTRUCTION_L_JR,
     533      INSTRUCTION_L_LBS,
     534      INSTRUCTION_L_LBZ,
     535      INSTRUCTION_L_LD,
     536      INSTRUCTION_L_LHS,
     537      INSTRUCTION_L_LHZ,
     538      INSTRUCTION_L_LWS,
     539      INSTRUCTION_L_LWZ,
     540      INSTRUCTION_L_MAC,
     541      INSTRUCTION_L_MACI,
     542      INSTRUCTION_L_MACRC,
     543      INSTRUCTION_L_MFSPR,
     544      INSTRUCTION_L_MOVHI,
     545      INSTRUCTION_L_MSB,
     546      INSTRUCTION_L_MSYNC,
     547      INSTRUCTION_L_MTSPR,
     548      INSTRUCTION_L_MUL,
     549      INSTRUCTION_L_MULI,
     550      INSTRUCTION_L_MULU,
     551      INSTRUCTION_L_NOP,
     552      INSTRUCTION_L_OR,
     553      INSTRUCTION_L_ORI,
     554      INSTRUCTION_L_PSYNC,
     555      INSTRUCTION_L_RFE,
     556      INSTRUCTION_L_ROR,
     557      INSTRUCTION_L_RORI,
     558      INSTRUCTION_L_SB,
     559      INSTRUCTION_L_SD,
     560      INSTRUCTION_L_SFEQ,
     561      INSTRUCTION_L_SFEQI,
     562      INSTRUCTION_L_SFGES,
     563      INSTRUCTION_L_SFGESI,
     564      INSTRUCTION_L_SFGEU,
     565      INSTRUCTION_L_SFGEUI,
     566      INSTRUCTION_L_SFGTS,
     567      INSTRUCTION_L_SFGTSI,
     568      INSTRUCTION_L_SFGTU,
     569      INSTRUCTION_L_SFGTUI,
     570      INSTRUCTION_L_SFLES,
     571      INSTRUCTION_L_SFLESI,
     572      INSTRUCTION_L_SFLEU,
     573      INSTRUCTION_L_SFLEUI,
     574      INSTRUCTION_L_SFLTS,
     575      INSTRUCTION_L_SFLTSI,
     576      INSTRUCTION_L_SFLTU,
     577      INSTRUCTION_L_SFLTUI,
     578      INSTRUCTION_L_SFNE,
     579      INSTRUCTION_L_SFNEI,
     580      INSTRUCTION_L_SH,
     581      INSTRUCTION_L_SLL,
     582      INSTRUCTION_L_SLLI,
     583      INSTRUCTION_L_SRA,
     584      INSTRUCTION_L_SRAI,
     585      INSTRUCTION_L_SRL,
     586      INSTRUCTION_L_SRLI,
     587      INSTRUCTION_L_SUB,
     588      INSTRUCTION_L_SW,
     589      INSTRUCTION_L_SYS,
     590      INSTRUCTION_L_TRAP,
     591      INSTRUCTION_L_XOR,
     592      INSTRUCTION_L_XORI,
     593      // ORFPX
     594      INSTRUCTION_LF_ADD_D,
     595      INSTRUCTION_LF_ADD_S,
     596      INSTRUCTION_LF_CUST1_D,
     597      INSTRUCTION_LF_CUST1_S,
     598      INSTRUCTION_LF_DIV_D,
     599      INSTRUCTION_LF_DIV_S,
     600      INSTRUCTION_LF_FTOI_D,
     601      INSTRUCTION_LF_FTOI_S,
     602      INSTRUCTION_LF_ITOF_D,
     603      INSTRUCTION_LF_ITOF_S,
     604      INSTRUCTION_LF_MADD_D,
     605      INSTRUCTION_LF_MADD_S,
     606      INSTRUCTION_LF_MUL_D,
     607      INSTRUCTION_LF_MUL_S,
     608      INSTRUCTION_LF_REM_D,
     609      INSTRUCTION_LF_REM_S,
     610      INSTRUCTION_LF_SFEQ_D,
     611      INSTRUCTION_LF_SFEQ_S,
     612      INSTRUCTION_LF_SFGE_D,
     613      INSTRUCTION_LF_SFGE_S,
     614      INSTRUCTION_LF_SFGT_D,
     615      INSTRUCTION_LF_SFGT_S,
     616      INSTRUCTION_LF_SFLE_D,
     617      INSTRUCTION_LF_SFLE_S,
     618      INSTRUCTION_LF_SFLT_D,
     619      INSTRUCTION_LF_SFLT_S,
     620      INSTRUCTION_LF_SFNE_D,
     621      INSTRUCTION_LF_SFNE_S,
     622      INSTRUCTION_LF_SUB_D,
     623      INSTRUCTION_LF_SUB_S,
     624      // ORVDX
     625      INSTRUCTION_LV_ADD_B,
     626      INSTRUCTION_LV_ADD_H,
     627      INSTRUCTION_LV_ADDS_B,
     628      INSTRUCTION_LV_ADDS_H,
     629      INSTRUCTION_LV_ADDU_B,
     630      INSTRUCTION_LV_ADDU_H,
     631      INSTRUCTION_LV_ADDUS_B,
     632      INSTRUCTION_LV_ADDUS_H,
     633      INSTRUCTION_LV_ALL_EQ_B,
     634      INSTRUCTION_LV_ALL_EQ_H,
     635      INSTRUCTION_LV_ALL_GE_B,
     636      INSTRUCTION_LV_ALL_GE_H,
     637      INSTRUCTION_LV_ALL_GT_B,
     638      INSTRUCTION_LV_ALL_GT_H,
     639      INSTRUCTION_LV_ALL_LE_B,
     640      INSTRUCTION_LV_ALL_LE_H,
     641      INSTRUCTION_LV_ALL_LT_B,
     642      INSTRUCTION_LV_ALL_LT_H,
     643      INSTRUCTION_LV_ALL_NE_B,
     644      INSTRUCTION_LV_ALL_NE_H,
     645      INSTRUCTION_LV_AND,
     646      INSTRUCTION_LV_ANY_EQ_B,
     647      INSTRUCTION_LV_ANY_EQ_H,
     648      INSTRUCTION_LV_ANY_GE_B,
     649      INSTRUCTION_LV_ANY_GE_H,
     650      INSTRUCTION_LV_ANY_GT_B,
     651      INSTRUCTION_LV_ANY_GT_H,
     652      INSTRUCTION_LV_ANY_LE_B,
     653      INSTRUCTION_LV_ANY_LE_H,
     654      INSTRUCTION_LV_ANY_LT_B,
     655      INSTRUCTION_LV_ANY_LT_H,
     656      INSTRUCTION_LV_ANY_NE_B,
     657      INSTRUCTION_LV_ANY_NE_H,
     658      INSTRUCTION_LV_AVG_B,
     659      INSTRUCTION_LV_AVG_H,
     660      INSTRUCTION_LV_CMP_EQ_B,
     661      INSTRUCTION_LV_CMP_EQ_H,
     662      INSTRUCTION_LV_CMP_GE_B,
     663      INSTRUCTION_LV_CMP_GE_H,
     664      INSTRUCTION_LV_CMP_GT_B,
     665      INSTRUCTION_LV_CMP_GT_H,
     666      INSTRUCTION_LV_CMP_LE_B,
     667      INSTRUCTION_LV_CMP_LE_H,
     668      INSTRUCTION_LV_CMP_LT_B,
     669      INSTRUCTION_LV_CMP_LT_H,
     670      INSTRUCTION_LV_CMP_NE_B,
     671      INSTRUCTION_LV_CMP_NE_H,
     672      INSTRUCTION_LV_CUST1,
     673      INSTRUCTION_LV_CUST2,
     674      INSTRUCTION_LV_CUST3,
     675      INSTRUCTION_LV_CUST4,
     676      INSTRUCTION_LV_MADDS_H,
     677      INSTRUCTION_LV_MAX_B,
     678      INSTRUCTION_LV_MAX_H,
     679      INSTRUCTION_LV_MERGE_B,
     680      INSTRUCTION_LV_MERGE_H,
     681      INSTRUCTION_LV_MIN_B,
     682      INSTRUCTION_LV_MIN_H,
     683      INSTRUCTION_LV_MSUBS_H,
     684      INSTRUCTION_LV_MULS_H,
     685      INSTRUCTION_LV_NAND,
     686      INSTRUCTION_LV_NOR,
     687      INSTRUCTION_LV_OR,
     688      INSTRUCTION_LV_PACK_B,
     689      INSTRUCTION_LV_PACK_H,
     690      INSTRUCTION_LV_PACKS_B,
     691      INSTRUCTION_LV_PACKS_H,
     692      INSTRUCTION_LV_PACKUS_B,
     693      INSTRUCTION_LV_PACKUS_H,
     694      INSTRUCTION_LV_PERM_N,
     695      INSTRUCTION_LV_RL_B,
     696      INSTRUCTION_LV_RL_H,
     697      INSTRUCTION_LV_SLL,
     698      INSTRUCTION_LV_SLL_B,
     699      INSTRUCTION_LV_SLL_H,
     700      INSTRUCTION_LV_SRA_B,
     701      INSTRUCTION_LV_SRA_H,
     702      INSTRUCTION_LV_SRL,
     703      INSTRUCTION_LV_SRL_B,
     704      INSTRUCTION_LV_SRL_H,
     705      INSTRUCTION_LV_SUB_B,
     706      INSTRUCTION_LV_SUB_H,
     707      INSTRUCTION_LV_SUBS_B,
     708      INSTRUCTION_LV_SUBS_H,
     709      INSTRUCTION_LV_SUBU_B,
     710      INSTRUCTION_LV_SUBU_H,
     711      INSTRUCTION_LV_SUBUS_B,
     712      INSTRUCTION_LV_SUBUS_H,
     713      INSTRUCTION_LV_UNPACK_B,
     714      INSTRUCTION_LV_UNPACK_H,
     715      INSTRUCTION_LV_XOR
     716    };
     717
     718  //-----------------------------------------------[ Code Operation ]-----
     719
     720#  define MAX_OPCOD_0                              64            // Instructions with immediat
     721#  define MAX_OPCOD_1                              64            // Instruction ORFPX32/64                 
     722#  define MAX_OPCOD_2                              256           // Instruction ORVDX64
     723#  define MAX_OPCOD_3                              256           // Instructions Register-Register
     724#  define MAX_OPCOD_4                              32            // Instructions "set flag" with register
     725#  define MAX_OPCOD_5                              32            // Instructions "set flag" with immediat
     726#  define MAX_OPCOD_6                              4             // Instruction Shift/Rotate with immediat
     727#  define MAX_OPCOD_7                              16            // Instructions multiply with HI-LO
     728#  define MAX_OPCOD_8                              2             // Instructions acces at HI-LO
     729#  define MAX_OPCOD_9                              8             // Instructions special       
     730#  define MAX_OPCOD_10                             4             // Instructions no operation
     731#  define MAX_OPCOD_11                             4             // Instruction Shift/Rotate with register
     732#  define MAX_OPCOD_12                             4             // Instructions extend
     733#  define MAX_OPCOD_13                             4             // Instructions extend (64b)
     734
     735// OPCOD_0                                         - [31:26]      Instructions with immediat
     736#  define OPCOD_L_J                                0x00          // 000_000
     737#  define OPCOD_L_JAL                              0x01          // 000_001
     738#  define OPCOD_L_BNF                              0x03          // 000_011
     739#  define OPCOD_L_BF                               0x04          // 000_100
     740#  define OPCOD_L_RFE                              0x09          // 001_001
     741#  define OPCOD_L_JR                               0x11          // 010_001
     742#  define OPCOD_L_JALR                             0x12          // 010_010
     743#  define OPCOD_L_MACI                             0x13          // 010_011
     744#  define OPCOD_L_CUST1                            0x1c          // 011_100
     745#  define OPCOD_L_CUST2                            0x1d          // 011_101
     746#  define OPCOD_L_CUST3                            0x1e          // 011_110
     747#  define OPCOD_L_CUST4                            0x1f          // 011_111
     748#  define OPCOD_L_CUST5                            0x3c          // 111_100
     749#  define OPCOD_L_CUST6                            0x3d          // 111_101
     750#  define OPCOD_L_CUST7                            0x3e          // 111_110
     751#  define OPCOD_L_CUST8                            0x3f          // 111_111
     752#  define OPCOD_L_LD                               0x20          // 100_000
     753#  define OPCOD_L_LWZ                              0x21          // 100_001
     754#  define OPCOD_L_LWS                              0x22          // 100_010
     755#  define OPCOD_L_LBZ                              0x23          // 100_011
     756#  define OPCOD_L_LBS                              0x24          // 100_100
     757#  define OPCOD_L_LHZ                              0x25          // 100_101
     758#  define OPCOD_L_LHS                              0x26          // 100_110
     759#  define OPCOD_L_ADDI                             0x27          // 100_111
     760#  define OPCOD_L_ADDIC                            0x28          // 101_000
     761#  define OPCOD_L_ANDI                             0x29          // 101_001
     762#  define OPCOD_L_ORI                              0x2a          // 101_010
     763#  define OPCOD_L_XORI                             0x2b          // 101_011
     764#  define OPCOD_L_MULI                             0x2c          // 101_100
     765#  define OPCOD_L_MFSPR                            0x2d          // 101_101
     766#  define OPCOD_L_MTSPR                            0x30          // 110_000
     767#  define OPCOD_L_SD                               0x34          // 110_100
     768#  define OPCOD_L_SW                               0x35          // 110_101
     769#  define OPCOD_L_SB                               0x36          // 110_110
     770#  define OPCOD_L_SH                               0x37          // 110_111
     771                                                   
     772#  define OPCOD_1                                  0x33          // 110_011         // Instruction ORFPX32/64
     773#  define OPCOD_2                                  0x0a          // 001_010         // Instruction ORVDX64
     774#  define OPCOD_3                                  0x38          // 111_000         // Instructions Register-Register
     775#  define OPCOD_4                                  0x39          // 111_001         // Instructions "set flag" with register
     776#  define OPCOD_5                                  0x2f          // 101_111         // Instructions "set flag" with immediat
     777#  define OPCOD_6                                  0x2e          // 101_110         // Instruction Shift/Rotate with immediat
     778#  define OPCOD_7                                  0x31          // 110_001         // Instructions multiply with HI-LO
     779#  define OPCOD_8                                  0x06          // 000_110         // Instructions acces at HI-LO
     780#  define OPCOD_9                                  0x08          // 001_000         // Instructions special
     781#  define OPCOD_10                                 0x05          // 000_101         // Instructions no operation
     782                                                   
     783// OPCOD_3         instructions                    - [9:8] [3:0]  Instructions Register-Register
     784#  define OPCOD_L_ADD                              0x00          // 00_0000
     785#  define OPCOD_L_ADDC                             0x01          // 00_0001
     786#  define OPCOD_L_SUB                              0x02          // 00_0010
     787#  define OPCOD_L_AND                              0x03          // 00_0011
     788#  define OPCOD_L_OR                               0x04          // 00_0100
     789#  define OPCOD_L_XOR                              0x05          // 00_0101
     790#  define OPCOD_L_CMOV                             0x0e          // 00_1110
     791#  define OPCOD_L_FF1                              0x0f          // 00_1111
     792#  define OPCOD_L_FL1                              0x1f          // 01_1111
     793#  define OPCOD_L_MUL                              0x36          // 11_0110
     794#  define OPCOD_L_DIV                              0x39          // 11_1001
     795#  define OPCOD_L_DIVU                             0x3a          // 11_1010
     796#  define OPCOD_L_MULU                             0x3b          // 11_1011
     797                                                   
     798#  define OPCOD_11                                 0x8           // 1000          // Instruction Shift/Rotate with register
     799#  define OPCOD_12                                 0xc           // 1100          // Instructions extend
     800#  define OPCOD_13                                 0xd           // 1101          // Instructions extend (64b)
     801                                                   
     802// OPCOD_4         instructions                    - [25:21]      Instructions "set flag" with register
     803#  define OPCOD_L_SFEQ                             0x00          // 00000
     804#  define OPCOD_L_SFNE                             0x01          // 00001
     805#  define OPCOD_L_SFGTU                            0x02          // 00010
     806#  define OPCOD_L_SFGEU                            0x03          // 00011
     807#  define OPCOD_L_SFLTU                            0x04          // 00100
     808#  define OPCOD_L_SFLEU                            0x05          // 00101
     809#  define OPCOD_L_SFGTS                            0x0a          // 01010
     810#  define OPCOD_L_SFGES                            0x0b          // 01011
     811#  define OPCOD_L_SFLTS                            0x0c          // 01100
     812#  define OPCOD_L_SFLES                            0x0d          // 01101
     813                                                   
     814// OPCOD_5         instructions                    - [25:21]      Instructions "set flag" with immediat
     815#  define OPCOD_L_SFEQI                            0x00          // 00000
     816#  define OPCOD_L_SFNEI                            0x01          // 00001
     817#  define OPCOD_L_SFGTUI                           0x02          // 00010
     818#  define OPCOD_L_SFGEUI                           0x03          // 00011
     819#  define OPCOD_L_SFLTUI                           0x04          // 00100
     820#  define OPCOD_L_SFLEUI                           0x05          // 00101
     821#  define OPCOD_L_SFGTSI                           0x0a          // 01010
     822#  define OPCOD_L_SFGESI                           0x0b          // 01011
     823#  define OPCOD_L_SFLTSI                           0x0c          // 01100
     824#  define OPCOD_L_SFLESI                           0x0d          // 01101
     825                                                   
     826// OPCOD_6         instructions                    - [7:6]        Instruction Shift/Rotate with immediat
     827#  define OPCOD_L_SLLI                             0x0           // 00
     828#  define OPCOD_L_SRLI                             0x1           // 01
     829#  define OPCOD_L_SRAI                             0x2           // 10
     830#  define OPCOD_L_RORI                             0x3           // 11
     831                                                   
     832// OPCOD_7         instructions                    - [3:0]        Instructions multiply with HI-LO
     833#  define OPCOD_L_MAC                              0x1           // 0001
     834#  define OPCOD_L_MSB                              0x2           // 0010
     835                                                   
     836// OPCOD_8         instructions                    - [17]         Instructions acces at HI-LO
     837#  define OPCOD_L_MOVHI                            0x0           // 0
     838#  define OPCOD_L_MACRC                            0x1           // 1
     839
     840// OPCOD_9         instructions                    - [25:23]      Instruction special
     841#  define OPCOD_L_SYS                              0x0           // 000
     842#  define OPCOD_L_TRAP                             0x2           // 010
     843#  define OPCOD_L_MSYNC                            0x4           // 100
     844#  define OPCOD_L_PSYNC                            0x5           // 101
     845#  define OPCOD_L_CSYNC                            0x6           // 110
     846
     847// OPCOD_10        instructions                    - [25:24]      Instruction no operation
     848#  define OPCOD_L_NOP                              0x1           // 01
     849                                                   
     850// OPCOD_11        instructions                    - [7:6]        Instruction Shift/Rotate with register
     851#  define OPCOD_L_SLL                              0x0           // 00
     852#  define OPCOD_L_SRL                              0x1           // 01
     853#  define OPCOD_L_SRA                              0x2           // 10
     854#  define OPCOD_L_ROR                              0x3           // 11
     855                                                   
     856// OPCOD_12        instructions                    - [9:6]          Instructions extend
     857#  define OPCOD_L_EXTHS                            0x0           // 0000
     858#  define OPCOD_L_EXTHZ                            0x2           // 0010
     859#  define OPCOD_L_EXTBS                            0x1           // 0001
     860#  define OPCOD_L_EXTBZ                            0x3           // 0011
     861                                                   
     862// OPCOD_13        instructions                    - [9:6]        Instructions extend (64b)
     863#  define OPCOD_L_EXTWS                            0x0           // 0000
     864#  define OPCOD_L_EXTWZ                            0x1           // 0001
     865
    387866  /*
    388 #define                 _size_instruction             32
    389 #define                 _size_instruction_log2        5
    390 
    391   //----------------------------------------------------[ Operation ]-----
    392 // #define                 _nb_operation                 32
    393 // #define                 _size_operation               5
    394 
    395 #define                 _operation_none               0x0
    396 #define                 _operation_l_adds             0x1
    397 #define                 _operation_l_addu             0x2
    398 #define                 _operation_l_subs             0x3
    399 #define                 _operation_l_and              0x4
    400 #define                 _operation_l_or               0x5
    401 #define                 _operation_l_xor              0x6
    402 #define                 _operation_l_cmove            0x7
    403 #define                 _operation_l_read_imm         0x8
    404 #define                 _operation_l_movhi            0x9
    405 #define                 _operation_l_muls             0xa
    406 #define                 _operation_l_mulu             0xb
    407 #define                 _operation_l_divs             0xc
    408 #define                 _operation_l_divu             0xd
    409 #define                 _operation_l_exts             0xe
    410 #define                 _operation_l_extz             0xf
    411 #define                 _operation_l_ff1              0x10
    412 #define                 _operation_l_fl1              0x11
    413 #define                 _operation_l_sll              0x12
    414 #define                 _operation_l_sla              0x13
    415 #define                 _operation_l_srl              0x14
    416 #define                 _operation_l_ror              0x15
    417 #define                 _operation_l_cmp_eq           0x16
    418 #define                 _operation_l_cmp_ne           0x17
    419 #define                 _operation_l_cmp_ges          0x18
    420 #define                 _operation_l_cmp_geu          0x19
    421 #define                 _operation_l_cmp_gts          0x1a
    422 #define                 _operation_l_cmp_gtu          0x1b
    423 #define                 _operation_l_cmp_les          0x1c
    424 #define                 _operation_l_cmp_leu          0x1d
    425 #define                 _operation_l_cmp_lts          0x1e
    426 #define                 _operation_l_cmp_ltu          0x1f
    427867
    428868  //--------------------------------------------------[ destination ]-----
     
    466906#define                 mask_CONDITION_STACK          0x8           // Branch with pop  in stack pointer
    467907
    468   //-------------------------------------------------[ branch_state ]-----
    469 #define                 cst_BRANCH_STATE_NONE         0x0           // 0 0
    470 #define                 cst_BRANCH_STATE_NSPEC_TAKE   0x1           // 0 1  -> incondionnal
    471 #define                 cst_BRANCH_STATE_SPEC_NTAKE   0x2           // 1 0
    472 #define                 cst_BRANCH_STATE_SPEC_TAKE    0x3           // 1 1
    473908  */
    474909
     
    6201055
    6211056  /*
    622 //----------------------------------------------------
    623 // Code Operation (before decode)
    624 //----------------------------------------------------
    625 
    626 // Codop                        - [31:26]      Instructions with immediat
    627 #define OPCOD_L_J             0x00          // 000_000
    628 #define OPCOD_L_JAL           0x01          // 000_001
    629 #define OPCOD_L_BNF           0x03          // 000_011
    630 #define OPCOD_L_BF            0x04          // 000_100
    631 #define OPCOD_L_RFE           0x09          // 001_001
    632 #define OPCOD_L_JR            0x11          // 010_001
    633 #define OPCOD_L_JALR          0x12          // 010_010
    634 #define OPCOD_L_MACI          0x13          // 010_011
    635 #define OPCOD_L_CUST1         0x1c          // 011_100
    636 #define OPCOD_L_CUST2         0x1d          // 011_101
    637 #define OPCOD_L_CUST3         0x1e          // 011_110
    638 #define OPCOD_L_CUST4         0x1f          // 011_111
    639 #define OPCOD_L_CUST5         0x3c          // 111_100
    640 #define OPCOD_L_CUST6         0x3d          // 111_101
    641 #define OPCOD_L_CUST7         0x3e          // 111_110
    642 #define OPCOD_L_CUST8         0x3f          // 111_111
    643 #define OPCOD_L_LD            0x20          // 100_000
    644 #define OPCOD_L_LWZ           0x21          // 100_001
    645 #define OPCOD_L_LWS           0x22          // 100_010
    646 #define OPCOD_L_LBZ           0x23          // 100_011
    647 #define OPCOD_L_LBS           0x24          // 100_100
    648 #define OPCOD_L_LHZ           0x25          // 100_101
    649 #define OPCOD_L_LHS           0x26          // 100_110
    650 #define OPCOD_L_ADDI          0x27          // 100_111
    651 #define OPCOD_L_ADDIC         0x28          // 101_000
    652 #define OPCOD_L_ANDI          0x29          // 101_001
    653 #define OPCOD_L_ORI           0x2a          // 101_010
    654 #define OPCOD_L_XORI          0x2b          // 101_011
    655 #define OPCOD_L_MULI          0x2c          // 101_100
    656 #define OPCOD_L_MFSPR         0x2d          // 101_101
    657 #define OPCOD_L_MTSPR         0x30          // 110_000
    658 #define OPCOD_L_SD            0x32          // 110_010
    659 #define OPCOD_L_SW            0x35          // 110_101
    660 #define OPCOD_L_SB            0x36          // 110_110
    661 #define OPCOD_L_SH            0x37          // 110_111
    662 
    663 #define OPCOD_INST_LV         0x0a          // 001_010         // Instruction ORVDX64
    664 #define OPCOD_INST_LF         0x33          // 110_011         // Instruction ORFPX32/64
    665 
    666 #define OPCOD_SPECIAL         0x38          // 111_000         // Instructions Register-Register
    667 #define OPCOD_SPECIAL_1       0x39          // 111_001         // Instructions "set flag" with register
    668 #define OPCOD_SPECIAL_2       0x2f          // 101_111         // Instructions "set flag" with immediat
    669 #define OPCOD_SPECIAL_6       0x2e          // 101_110         // Instruction Shift/Rotate with immediat
    670 #define OPCOD_SPECIAL_7       0x31          // 110_001         // Instructions multiply with HI-LO
    671 #define OPCOD_SPECIAL_8       0x06          // 000_110         // Instructions acces at HI-LO
    672 
    673 // OPCOD_SPECIAL   instructions - [9:8] [3:0]  Instructions Register-Register
    674 #define OPCOD_L_ADD           0x00          // 00_0000
    675 #define OPCOD_L_ADDC          0x01          // 00_0001
    676 #define OPCOD_L_SUB           0x02          // 00_0010
    677 #define OPCOD_L_AND           0x03          // 00_0011
    678 #define OPCOD_L_OR            0x04          // 00_0100
    679 #define OPCOD_L_XOR           0x05          // 00_0101
    680 #define OPCOD_L_CMOV          0x0e          // 00_1110
    681 #define OPCOD_L_FF1           0x0f          // 00_1111
    682 #define OPCOD_L_FL1           0x1f          // 01_1111
    683 #define OPCOD_L_MUL           0x36          // 11_0110
    684 #define OPCOD_L_DIV           0x39          // 11_1001
    685 #define OPCOD_L_DIVU          0x3a          // 11_1010
    686 #define OPCOD_L_MULU          0x3b          // 11_1011
    687 
    688 #define OPCOD_SPECIAL_3       0xc           // 1100          // Instructions extend
    689 #define OPCOD_SPECIAL_4       0xd           // 1101          // Instructions extend (64b)
    690 #define OPCOD_SPECIAL_5       0x8           // 1000          // Instruction Shift/Rotate with register
    691 
    692 // OPCOD_SPECIAL_1 instructions - [25:21]      Instructions "set flag" with register
    693 #define OPCOD_L_SFEQ          0x00          // 00000
    694 #define OPCOD_L_SFNE          0x01          // 00001
    695 #define OPCOD_L_SFGTU         0x02          // 00010
    696 #define OPCOD_L_SFGEU         0x03          // 00011
    697 #define OPCOD_L_SFLTU         0x04          // 00100
    698 #define OPCOD_L_SFLEU         0x05          // 00101
    699 #define OPCOD_L_SFGTS         0x0a          // 01010
    700 #define OPCOD_L_SFGES         0x0b          // 01011
    701 #define OPCOD_L_SFLTS         0x0c          // 01100
    702 #define OPCOD_L_SFLES         0x0d          // 01101
    703 
    704 // OPCOD_SPECIAL_2 instructions - [25:21]      Instructions "set flag" with immediat
    705 #define OPCOD_L_SFEQI         0x00          // 00000
    706 #define OPCOD_L_SFNEI         0x01          // 00001
    707 #define OPCOD_L_SFGTUI        0x02          // 00010
    708 #define OPCOD_L_SFGEUI        0x03          // 00011
    709 #define OPCOD_L_SFLTUI        0x04          // 00100
    710 #define OPCOD_L_SFLEUI        0x05          // 00101
    711 #define OPCOD_L_SFGTSI        0x0a          // 01010
    712 #define OPCOD_L_SFGESI        0x0b          // 01011
    713 #define OPCOD_L_SFLTSI        0x0c          // 01100
    714 #define OPCOD_L_SFLESI        0x0d          // 01101
    715 
    716 // OPCOD_SPECIAL_3 instructions - [9:6]          Instructions extend
    717 #define OPCOD_L_EXTHS         0x0           // 0000
    718 #define OPCOD_L_EXTHZ         0x2           // 0010
    719 #define OPCOD_L_EXTBS         0x1           // 0001
    720 #define OPCOD_L_EXTBZ         0x3           // 0011
    721 
    722 // OPCOD_SPECIAL_4 instructions - [9:6]        Instructions extend (64b)
    723 #define OPCOD_L_EXTWS         0x0           // 0000
    724 #define OPCOD_L_EXTWZ         0x1           // 0001
    725 
    726 // OPCOD_SPECIAL_5 instructions - [7:6]        Instruction Shift/Rotate with register
    727 #define OPCOD_L_SLL           0x0           // 00
    728 #define OPCOD_L_SRL           0x1           // 01
    729 #define OPCOD_L_SRA           0x2           // 10
    730 #define OPCOD_L_ROR           0x3           // 11
    731 
    732 // OPCOD_SPECIAL_6 instructions - [7:6]        Instruction Shift/Rotate with immediat
    733 #define OPCOD_L_SLLI          0x0           // 00
    734 #define OPCOD_L_SRLI          0x1           // 01
    735 #define OPCOD_L_SRAI          0x2           // 10
    736 #define OPCOD_L_RORI          0x3           // 11
    737 
    738 // OPCOD_SPECIAL_7 instructions - [3:0]        Instructions multiply with HI-LO
    739 #define OPCOD_L_MAC           0x1           // 0001
    740 #define OPCOD_L_MSB           0x2           // 0010
    741 
    742 // OPCOD_SPECIAL_8 instructions - [17]         Instructions acces at HI-LO
    743 #define OPCOD_L_MOVHI         0x0           // 0
    744 #define OPCOD_L_MACRC         0x1           // 1
    745 
    746 // Particular case                             Instructions systems
    747 #define OPCOD_L_MSYNC         0x22000000
    748 #define OPCOD_L_CSYNC         0x23000000
    749 #define OPCOD_L_PSYNC         0x22800000
    750 #define OPCOD_L_NOP           0x1500
    751 #define OPCOD_L_SYS           0x2000
    752 #define OPCOD_L_TRAP          0x2100
    753 
    754 //----------------------------------------------------
    755 // Code Operation (after decode)
    756 //----------------------------------------------------
    757 
    758 typedef enum
    759   {
    760     // ##### WARNING : This opcode must be the first#####
    761     INST_L_NO_IMPLEMENTED ,         // Operation is not implemented
    762 
    763     INST_L_ADD            ,         // L.ADD    , L.ADDI   , L.ADDC   , L.ADDIC
    764     INST_L_AND            ,         // L.AND    , L.ANDI
    765     INST_L_OR             ,         // L.OR     , L.ORI
    766     INST_L_XOR            ,         // L.XOR    , L.XORI
    767     INST_L_CMOV           ,         // L.CMOV
    768     INST_L_SUB            ,         // L.SUB
    769     INST_L_FF1            ,         // L.FF1
    770     INST_L_EXTBS          ,         // L.EXTBS
    771     INST_L_EXTBZ          ,         // L.EXTBZ
    772     INST_L_EXTHS          ,         // L.EXTHS
    773     INST_L_EXTHZ          ,         // L.EXTHZ
    774     INST_L_EXTWS          ,         // L.EXTWS
    775     INST_L_EXTWZ          ,         // L.EXTWZ
    776     INST_L_e              ,         //
    777     INST_L_f              ,         //
    778     INST_L_MUL            ,         // L.MUL    , L.MULI
    779     INST_L_MULU           ,         // L.MULU
    780     INST_L_DIV            ,         // L.DIV
    781     INST_L_DIVU           ,         // L.DIVU
    782     INST_L_SLL            ,         // L.SLL    , L.SLLI
    783     INST_L_SRL            ,         // L.SRL    , L.SRLI
    784     INST_L_SRA            ,         // L.SRA    , L.SRAI
    785     INST_L_ROR            ,         // L.ROR    , L.RORI
    786     INST_L_SFGES          ,         // L.SFGES  , L.SFGESI
    787     INST_L_SFGEU          ,         // L.SFGEU  , L.SFGEUI
    788     INST_L_SFGTS          ,         // L.SFGTS  , L.SFGTSI
    789     INST_L_SFGTU          ,         // L.SFGTU  , L.SFGTUI
    790     INST_L_SFLES          ,         // L.SFLES  , L.SFLESI
    791     INST_L_SFLEU          ,         // L.SFLEU  , L.SFLEUI
    792     INST_L_SFLTS          ,         // L.SFLTS  , L.SFLTSI
    793     INST_L_SFLTU          ,         // L.SFLTU  , L.SFLTUI
    794     INST_L_SFEQ           ,         // L.SFEQ   , L.SFEQI
    795     INST_L_SFNE           ,         // L.SFNE   , L.SFNEI
    796     INST_L_READ           ,         // L.BNF    , L.BF     , L.JR
    797     INST_L_MOVHI          ,         // L.MOVI
    798     INST_L_CSYNC          ,         // L.CSYNC
    799     INST_L_MSYNC          ,         // L.MSYNC
    800     INST_L_PSYNC          ,         // L.PSYNC
    801     INST_L_RFE            ,         // L.RFE
    802     INST_L_MAC            ,         // L.MAC    , L.MACI
    803     INST_L_MSB            ,         // L.MSB
    804     INST_L_MACRC          ,         // L.MACRC
    805     INST_L_2b             ,         //
    806     INST_L_MEMB           ,         // L.LBS    , L.LBZ    , L.SB 
    807     INST_L_MEMH           ,         // L.LHS    , L.LHZ    , L.SH
    808     INST_L_MEMW           ,         // L.LWS    , L.LWZ    , L.SW 
    809     INST_L_MEMD           ,         // L.LD                , L.SD 
    810     INST_L_CUST1          ,         // L.CUST1
    811     INST_L_CUST2          ,         // L.CUST2
    812     INST_L_CUST3          ,         // L.CUST3
    813     INST_L_CUST4          ,         // L.CUST4
    814     INST_L_CUST5          ,         // L.CUST5
    815     INST_L_CUST6          ,         // L.CUST6
    816     INST_L_CUST7          ,         // L.CUST7
    817     INST_L_CUST8          ,         // L.CUST8
    818     INST_L_38             ,         //
    819     INST_L_39             ,         //
    820     INST_L_3a             ,         //
    821     INST_L_3b             ,         //
    822     INST_L_3c             ,         // 
    823     INST_L_3d             ,         // 
    824     INST_L_3e             ,         // 
    825     INST_NOP                        // L.NOP
    826   } opcod_t;
    827 
    828 #define LOG2_NB_INST_L        6
    829 #define      NB_INST_L        64 // +1 -> INST_L_NO_IMPLEMENTED
    830 //#define      NB_INST_L        (INST_L_NO_IMPLEMENTED+1)
    8311057  */
    8321058
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Debug_component.h

    r77 r78  
    22#define Debug_component_H
    33
    4 #define DEBUG_Behavioural                                         false
    5 #define   DEBUG_Generic                                           false
    6 #define     DEBUG_Counter                                         false
    7 #define     DEBUG_Group                                           false
    8 #define     DEBUG_Queue                                           false
    9 #define     DEBUG_Queue_Control                                   false
    10 #define     DEBUG_Shifter                                         false
    11 #define     DEBUG_RegisterFile                                    false
    12 #define       DEBUG_RegisterFile_Monolithic                       false
    13 #define       DEBUG_RegisterFile_Multi_Banked                     false
    14 #define     DEBUG_Select                                          false
    15 #define       DEBUG_Select_Priority_Fixed                         false
    16 #define     Debug_Victim                                          false
    17 #define       DEBUG_Victim_Pseudo_LRU                             false
    18 #define   DEBUG_Core                                              false
    19 #define     DEBUG_Multi_Execute_loop                              false
    20 #define       DEBUG_Execute_loop                                  false
    21 #define         DEBUG_Multi_Execute_unit                          false
    22 #define           DEBUG_Execute_unit                              false
    23 #define             DEBUG_Functionnal_unit                        false
    24 #define             DEBUG_Load_store_unit                         false
    25 #define         DEBUG_Multi_Read_unit                             false
    26 #define           DEBUG_Read_unit                                 false
    27 #define             DEBUG_Read_queue                              false
    28 #define             DEBUG_Reservation_station                     false
    29 #define         DEBUG_Multi_Write_unit                            false
    30 #define           DEBUG_Write_unit                                false
    31 #define             DEBUG_Execute_queue                           false
    32 #define             DEBUG_Write_queue                             false
    33 #define         DEBUG_Network                                     true
    34 #define           DEBUG_Execution_unit_to_Write_unit              true
    35 #define           DEBUG_Read_unit_to_Execution_unit               true
    36 #define         DEBUG_Register_unit                               false
    37 #define           DEBUG_Register_unit_Glue                        false
    38 #define     DEBUG_Multi_Front_end                                 false
    39 #define       DEBUG_Front_end                                     false
    40 #define         DEBUG_Prediction_unit                             false
    41 #define           DEBUG_Direction                                 false
    42 #define             DEBUG_Meta_Predictor                          false
    43 #define               DEBUG_Meta_Predictor_Glue                   false
    44 #define                 DEBUG_Two_Level_Branch_Predictor          false
    45 #define                   DEBUG_Two_Level_Branch_Predictor_Glue   false
    46 #define                   DEBUG_Branch_History_Table              false
    47 #define                   DEBUG_Pattern_History_Table             false
     4#  define DEBUG_true                                                true
     5#  define DEBUG_false                                               false
    486
     7#  define DEBUG_Behavioural                                         false
     8#  define   DEBUG_Generic                                           false
     9#  define     DEBUG_Counter                                         false
     10#  define     DEBUG_Queue                                           false
     11#  define     DEBUG_Queue_Control                                   false
     12#  define     DEBUG_RegisterFile                                    false
     13#  define       DEBUG_RegisterFile_Monolithic                       false
     14#  define       DEBUG_RegisterFile_Multi_Banked                     false
     15#  define     DEBUG_Select                                          false
     16#  define       DEBUG_Select_Priority_Fixed                         false
     17#  define     DEBUG_Shifter                                         false
     18#  define     DEBUG_Sort                                            false
     19#  define     DEBUG_Victim                                          false
     20#  define       DEBUG_Victim_Pseudo_LRU                             false
     21#  define   DEBUG_Core                                              false
     22#  define     DEBUG_Multi_Execute_loop                              false
     23#  define       DEBUG_Execute_loop                                  false
     24#  define         DEBUG_Multi_Execute_unit                          false
     25#  define           DEBUG_Execute_unit                              false
     26#  define             DEBUG_Functionnal_unit                        false
     27#  define             DEBUG_Load_store_unit                         false
     28#  define         DEBUG_Multi_Read_unit                             false
     29#  define           DEBUG_Read_unit                                 false
     30#  define             DEBUG_Read_queue                              false
     31#  define             DEBUG_Reservation_station                     false
     32#  define         DEBUG_Multi_Write_unit                            false
     33#  define           DEBUG_Write_unit                                false
     34#  define             DEBUG_Execute_queue                           false
     35#  define             DEBUG_Write_queue                             false
     36#  define         DEBUG_Network                                     false
     37#  define           DEBUG_Execution_unit_to_Write_unit              false
     38#  define           DEBUG_Read_unit_to_Execution_unit               false
     39#  define         DEBUG_Register_unit                               false
     40#  define           DEBUG_Register_unit_Glue                        false
     41#  define     DEBUG_Multi_Front_end                                 false
     42#  define       DEBUG_Front_end                                     false
     43#  define         DEBUG_Decod_unit                                  false
     44#  define           DEBUG_Decod                                     false
     45#  define         DEBUG_Ifetch_unit                                 false
     46#  define           DEBUG_Address_management                        false
     47#  define           DEBUG_Ifetch_queue                              false
     48#  define           DEBUG_Ifetch_unit_Glue                          false
     49#  define         DEBUG_Prediction_unit                             false
     50#  define           DEBUG_Branch_Target_Buffer                      false
     51#  define             DEBUG_Branch_Target_Buffer_Glue               false
     52#  define             DEBUG_Branch_Target_Buffer_Register           false
     53#  define           DEBUG_Direction                                 false
     54#  define             DEBUG_Direction_Glue                          false
     55#  define             DEBUG_Meta_Predictor                          false
     56#  define               DEBUG_Meta_Predictor_Glue                   false
     57#  define                 DEBUG_Two_Level_Branch_Predictor          false
     58#  define                   DEBUG_Two_Level_Branch_Predictor_Glue   false
     59#  define                   DEBUG_Branch_History_Table              false
     60#  define                   DEBUG_Pattern_History_Table             false
     61#  define           DEBUG_Return_Address_Stack                      true
     62#  define           DEBUG_Update_Prediction_Table                   true
     63#  define     DEBUG_Multi_OOO_Engine                                false
     64#  define       DEBUG_OOO_Engine                                    false
     65#  define         DEBUG_Rename_unit                                 false
     66#  define           DEBUG_Load_Store_pointer_unit                   false
     67#  define           DEBUG_Register_translation_unit                 false
     68#  define             DEBUG_Dependency_checking_unit                false
     69#  define             DEBUG_Free_List_unit                          false
     70#  define             DEBUG_Register_Address_Translation_unit       false
     71#  define             DEBUG_Register_translation_unit_Glue          false
     72#  define             DEBUG_Stat_List_unit                          false
     73//#define           DEBUG_Rename_queue                              true
     74#  define           DEBUG_Rename_select                             false
    4975#endif
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Entity.h

    r75 r78  
    7878#endif
    7979
    80   public    : bool                  test_map          (bool top_level);
     80  public    : bool                  test_map          (uint32_t depth,bool top_level);
    8181
    8282#ifdef POSITION
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Environnement.h

    r71 r78  
    2222#  define DEBUG_TEST
    2323#endif
     24
     25#define MORPHEO_HOME "MORPHEO_HOME"
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interface.h

    r75 r78  
    229229#endif
    230230
    231   public    : bool                  test_map             (bool top_level);
     231  public    : bool                  test_map             (uint32_t depth, bool top_level);
    232232
    233233#ifdef POSITION
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interfaces.h

    r75 r78  
    8080#endif
    8181
    82   public    : bool                  test_map              (bool top_level);
     82  public    : bool                  test_map              (uint32_t depth, bool top_level);
    8383
    8484  public    : friend std::ostream&       operator<<            (std::ostream& output_stream,
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Parameters.h

    r77 r78  
    1414#include "Behavioural/include/Environnement.h"
    1515#include "Behavioural/include/Constants.h"
     16#include "Behavioural/include/Test.h"
    1617#include "Common/include/ErrorMorpheo.h"
    1718#include "Common/include/ToString.h"
     
    2223namespace behavioural {
    2324
     25  class Parameters_test
     26  {
     27  private   : std::string _component;
     28  protected : std::string _error;
     29  protected : std::string _warning;
     30  protected : std::string _information;
     31
     32  public    : Parameters_test (std::string component)
     33    {
     34      _component = component;
     35      _error     = "";
     36      _warning   = "";
     37    };
     38  public    : ~Parameters_test (void) {};
     39
     40  public    : bool        have_error  (void)            { return (_error.length() != 0);};
     41  public    : void        error       (std::string str) { _error       += "[   ERROR   ] <" + _component + "> " + str + "\n";}
     42  public    : void        warning     (std::string str) { _warning     += "[  WARNING  ] <" + _component + "> " + str + "\n";}
     43  public    : void        information (std::string str) { _information += "[INFORMATION] <" + _component + "> " + str + "\n";}
     44  public    : std::string print       (void)            { return _error + _warning + _information;};
     45  };
     46
    2447  // Virtual Class - Interface of each component
    2548  class Parameters
    2649  {
    2750    // -----[ fields ]----------------------------------------------------
    28   public   : static const uint32_t   _nb_operation        = MAX_OPERATION;
    29   public   : static const uint32_t   _nb_type             = MAX_TYPE;
    30   public   : static const uint32_t   _size_operation      = SIZE_OPERATION;
    31   public   : static const uint32_t   _size_type           = SIZE_TYPE;     
    32   public   : static const uint32_t   _size_exception      = SIZE_EXCEPTION;
    33   public   : static const uint32_t   _size_dcache_type    = SIZE_DCACHE_TYPE;
    34   public   : static const uint32_t   _size_dcache_error   = SIZE_DCACHE_ERROR;
     51  public   : static const uint32_t   _size_instruction            = 32;
     52  public   : static const uint32_t   _nb_operation                = MAX_OPERATION;
     53  public   : static const uint32_t   _nb_type                     = MAX_TYPE;
     54  public   : static const uint32_t   _size_operation              = SIZE_OPERATION;
     55  public   : static const uint32_t   _size_type                   = SIZE_TYPE;     
     56  public   : static const uint32_t   _size_exception              = SIZE_EXCEPTION;
     57  public   : static const uint32_t   _size_exception_use          = SIZE_EXCEPTION_USE;
     58  public   : static const uint32_t   _size_exception_memory       = SIZE_EXCEPTION_MEMORY;
     59  public   : static const uint32_t   _size_exception_custom       = SIZE_EXCEPTION_CUSTOM;
     60  public   : static const uint32_t   _size_exception_alu          = SIZE_EXCEPTION_ALU   ;
     61  public   : static const uint32_t   _size_exception_decod        = SIZE_EXCEPTION_DECOD ;
     62  public   : static const uint32_t   _size_exception_ifetch       = SIZE_EXCEPTION_IFETCH;
     63  public   : static const uint32_t   _size_icache_type            = SIZE_ICACHE_TYPE;
     64  public   : static const uint32_t   _size_icache_error           = SIZE_ICACHE_ERROR;
     65  public   : static const uint32_t   _size_dcache_type            = SIZE_DCACHE_TYPE;
     66  public   : static const uint32_t   _size_dcache_error           = SIZE_DCACHE_ERROR;
     67  public   : static const uint32_t   _nb_general_register_logic   = 32;
     68  public   : static const uint32_t   _nb_special_register_logic   = NB_SPR_LOGIC;
     69  public   : static const uint32_t   _size_general_register_logic = 5;
     70  public   : static const uint32_t   _size_special_register_logic = LOG2_NB_SPR_LOGIC;
     71  public   : static const uint32_t   _size_event_state            = SIZE_EVENT_STATE;
     72  public   : static const uint32_t   _size_event_type             = SIZE_EVENT_TYPE;
     73  public   : static const uint32_t   _size_branch_state           = SIZE_BRANCH_STATE;
     74  public   : static const uint32_t   _size_branch_condition       = SIZE_BRANCH_CONDITION;
    3575
    3676    // -----[ methods ]---------------------------------------------------
    37   public   :                  Parameters            (void);
    38   public   : virtual          ~Parameters           ();
     77  public   :                          Parameters           (void);
     78  public   : virtual                 ~Parameters           ();
    3979       
    4080    // methods to print and test parameters
    41   public   : virtual std::string   print                 (uint32_t depth) = 0;
    42   public   : virtual std::string  msg_error             (void) = 0;
     81  public   : virtual std::string     print                 (uint32_t depth) = 0;
     82  public   : virtual Parameters_test msg_error             (void) = 0;
    4383
    4484    // methods to generate configuration file
    45 
    4685   
    4786    // methods to test
    48   public   :         void     test                  (void);
    49   public   :         bool     is_natural            (double  val );
    50   public   :         bool     is_positive           (double  val );
    51   public   :         bool     is_multiple           (uint32_t val1,
    52                                                      uint32_t val2);
    53   public   :         bool     is_between_inclusive  (uint32_t val,
    54                                                      uint32_t min,
    55                                                      uint32_t max);
    56   public   :         bool     is_between_exclusive  (uint32_t val,
    57                                                      uint32_t min,
    58                                                      uint32_t max);
     87  public   :         void            test                  (void);
    5988  };
    60 
    6189}; // end namespace behavioural         
    6290}; // end namespace morpheo             
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Signal.h

    r75 r78  
    5151
    5252    // -----[ fields ]----------------------------------------------------
    53   private   : const std::string          _name          ;
     53  private   : const std::string     _name          ;
    5454  private   : const direction_t     _direction     ;
    5555  private   : const presence_port_t _presence_port ;
    5656  private   :       uint32_t        _size          ;
    5757
    58   private   : Signal *              _connect_to_signal;   // the actual implementaion, this signal link with one signal (but if signal is an output, it can be connect with many signal ...)
    59   private   : Signal *              _connect_from_signal; // producter of signal. If NULL, then producteur is the current entity
    60   private   : bool                  _is_allocate   ; // Have allocate a sc_in or sc_out port
    61   private   : void *                _sc_signal     ; // sc_in or sc_out associated at this signal
    62   private   : void *                _sc_signal_map ; // sc_out generated this signal
    63   private   : bool                  _is_map_as_src ;
    64   private   : bool                  _is_map_as_dest;
    65   private   : type_info_t           _type_info     ;
     58  private   : Signal *              _connect_to_signal       ;   // the actual implementaion, this signal link with one signal (but if signal is an output, it can be connect with many signal ...)
     59  private   : Signal *              _connect_from_signal     ; // producter of signal. If NULL, then producteur is the current entity
     60  private   : bool                  _is_allocate             ; // Have allocate a sc_in or sc_out port
     61  private   : void *                _sc_signal               ; // sc_in or sc_out associated at this signal
     62  private   : void *                _sc_signal_map           ; // sc_out generated this signal
     63  private   : bool                  _is_map_as_toplevel_dest ;
     64  private   : bool                  _is_map_as_component_src ;
     65  private   : bool                  _is_map_as_component_dest;
     66  private   : type_info_t           _type_info               ;
    6667
    6768#ifdef VHDL_TESTBENCH
     
    9091  public    : bool              presence_testbench      (void);
    9192
    92   public    : bool              test_map                (bool top_level);
     93  public    : bool              test_map                (uint32_t depth, bool top_level);
    9394
    9495  public    : void              link                    (Signal * signal_dest,
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat.h

    r75 r78  
    6060      bool                           _generate_file;
    6161
    62     public :                     Stat            (std::string name_instance,
    63                                                   std::string name_component,
    64                                                   Parameters_Statistics * param);
     62    public :                     Stat                         (std::string name_instance,
     63                                                               std::string name_component,
     64                                                               Parameters_Statistics * param);
     65    public :                     Stat                         (std::string name_instance,
     66                                                               std::string name_component,
     67                                                               cycle_t nb_cycle_before_begin=0,
     68                                                               cycle_t period=0);
     69    public :                    ~Stat                         (void);
    6570
    66     public :                     Stat            (std::string name_instance,
    67                                                   std::string name_component,
    68                                                   cycle_t nb_cycle_before_begin=0,
    69                                                   cycle_t period=0);
    70     public :                    ~Stat            (void);
    71      
    72     public  : counter_t *        create_variable (std::string varname);
    73     public  : counter_t *        create_counter  (std::string varname,
    74                                                   std::string unit,
    75                                                   std::string description);
    76     private : counter_t *        alloc_operand   (counter_type_t type,
    77                                                   std::string varname,
    78                                                   std::string unit,
    79                                                   std::string description);
    80     public  : void               create_expr     (std::string varname,
    81                                                   std::string expr,
    82                                                   bool each_cycle=true);
     71    public  : counter_t *        create_variable              (std::string varname);
     72    public  : counter_t *        create_counter               (std::string varname,
     73                                                               std::string unit,
     74                                                               std::string description);
     75    private : counter_t *        alloc_operand                (counter_type_t type,
     76                                                               std::string varname,
     77                                                               std::string unit,
     78                                                               std::string description);
    8379
    84     private : Stat_binary_tree * string2tree     (std::string expr);
     80    public  : void               create_expr                  (std::string varname,
     81                                                               std::string expr,
     82                                                               bool each_cycle=false);
     83    public  : void               create_expr_average          (std::string varname,
     84                                                               std::string expr_sum,
     85                                                               std::string expr_deps,
     86                                                               std::string unit,
     87                                                               std::string description);
    8588
    86     public  : void               end_cycle       (void);
    87     private : void               end_simulation  (void);
    88     private : void               test_and_save   (bool force_save=false);
    89     private : void               eval_exprs      (bool only_each_cycle=true);
    90     private : void               eval_expr       (expr_t expr);
    91      
    92     private : bool               is_valid_var    (std::string expr);
     89    public  : void               create_expr_average_by_cycle (std::string varname,
     90                                                               std::string expr_sum,
     91                                                               std::string unit,
     92                                                               std::string description);
    9393
    94     private : void               generate_file   (void);
     94    public  : void               create_expr_percent          (std::string varname,
     95                                                               std::string expr_sum,
     96                                                               std::string expr_max,
     97                                                               std::string description);
    9598
    96     private : bool               have_counter    (void);
     99    private : Stat_binary_tree * string2tree                  (std::string expr);
    97100
    98     public  : void               add_stat        (Stat * stat);
     101    public  : void               end_cycle                    (void);
     102    private : void               end_simulation               (void);
    99103
    100     public  : std::string        print           (uint32_t depth=0);
     104    private : void               test_and_save                (bool force_save=false);
     105
     106    private : void               eval_exprs                   (bool only_each_cycle=true);
     107    private : void               eval_expr                    (expr_t expr);
     108
     109    private : bool               is_valid_var                 (std::string expr);
     110
     111    private : void               generate_file                (void);
     112
     113    private : bool               have_counter                 (void);
     114
     115    public  : void               add_stat                     (Stat * stat);
     116
     117    public  : std::string        print                        (uint32_t depth=0);
    101118    };
    102119
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Types.h

    r77 r78  
    44#include "Common/include/Types.h"
    55#include "Common/include/ToString.h"
     6#include "Common/include/FromString.h"
     7#include "Common/include/ErrorMorpheo.h"
    68#include "Behavioural/include/Constants.h"
    79
     
    1416
    1517  // ***** general
    16   typedef bool          Tcontrol_t;
    17   typedef uint32_t      Toperation_t;
    18 //typedef uint32_t      Tdestination1_t;
    19 //typedef uint32_t      Tdestination2_t;
    20 //typedef uint32_t      Texec_flag_t;
    21 //typedef bool          Texec_excep_t;
    22 //typedef uint32_t      Tcondition_t;
    23 //typedef uint32_t      Tbranch_state_t;
    24 
    25   typedef uint32_t      Texception_t;
    26   typedef uint32_t      Tcontext_t;
    27   typedef uint32_t      Tpacket_t;
    28   typedef uint32_t      Ttype_t;
    29 
    30   // ***** Register
    31   typedef uint32_t      Tgeneral_address_t;
    32   typedef uint32_t      Tgeneral_data_t;
    33   typedef uint32_t      Tspecial_address_t;
    34   typedef uint32_t      Tspecial_data_t;
     18  typedef uint32_t        Tinstruction_t;
     19  typedef bool            Tcontrol_t;
     20  typedef uint8_t         Toperation_t;
     21//typedef uint32_t        Tdestination1_t;
     22//typedef uint32_t        Tdestination2_t;
     23//typedef uint32_t        Texec_flag_t;
     24//typedef bool            Texec_excep_t;
     25                         
     26  typedef uint8_t         Texception_t;
     27  typedef uint8_t         Tcontext_t;
     28  typedef uint8_t         Tpacket_t;
     29  typedef uint8_t         Ttype_t;
     30  typedef uint8_t         Tevent_state_t;
     31  typedef uint8_t         Tevent_type_t;
     32  typedef uint8_t         Tcounter_t; // universal counter
     33  typedef uint8_t         Tptr_t;     // universal pointer
     34                         
     35  // ***** Register       
     36  typedef uint32_t        Tgeneral_address_t;
     37  typedef uint32_t        Tgeneral_data_t;
     38  typedef uint32_t        Tspecial_address_t;
     39  typedef uint32_t        Tspecial_data_t;
    3540
    3641  // ***** component dependant
    37   // ~~~~~ load store queue
    38   typedef uint32_t      Taccess_t;
    39   typedef uint32_t      Tlsq_ptr_t;
    40   typedef uint32_t      Tdcache_address_t;
    41   typedef uint32_t      Tdcache_data_t;
    42   typedef bool          Tdcache_error_t;
    43   typedef uint32_t      Tdcache_type_t;
     42  // ~~~~~ load store queue
     43  typedef uint8_t         Taccess_t;
     44  typedef uint8_t         Tlsq_ptr_t;
     45  typedef uint32_t        Tdcache_address_t;
     46  typedef uint32_t        Tdcache_data_t;
     47  typedef bool            Tdcache_error_t;
     48  typedef uint8_t         Tdcache_type_t;
     49
     50  // ~~~~~ prediction_unit
     51  typedef uint8_t         Thistory_t;
     52  typedef uint8_t         Tprediction_ptr_t;
     53  typedef uint8_t         Tbranch_state_t;
     54  typedef uint8_t         Tbranch_condition_t;
     55  typedef uint8_t         Tdepth_t;     
     56  typedef Tgeneral_data_t Taddress_t;
     57
     58
     59  // ~~~~~ ifetch
     60  typedef uint8_t         Tinst_ifetch_ptr_t;
     61  typedef uint8_t         Tifetch_queue_ptr_t;
     62  typedef uint32_t        Ticache_address_t;
     63  typedef uint32_t        Ticache_instruction_t;
     64  typedef bool            Ticache_error_t;
     65  typedef uint8_t         Ticache_type_t;
     66
     67  typedef enum
     68    {
     69      PRIORITY_STATIC,
     70      PRIORITY_ROUND_ROBIN
     71    } Tpriority_t;
     72
     73  typedef enum
     74    {
     75      LOAD_BALANCING_BALANCE,
     76      LOAD_BALANCING_MAXIMUM_FOR_PRIORITY
     77    } Tload_balancing_t;
     78
     79  typedef enum
     80    {
     81      VICTIM_RANDOM     , // Random
     82      VICTIM_ROUND_ROBIN, // Round Robin
     83      VICTIM_NLU        , // Not Last Used
     84      VICTIM_PSEUDO_LRU , // Pseudo Least Recently Used
     85      VICTIM_LRU        , // Least Recently Used
     86      VICTIM_FIFO         // First IN First OUT
     87    } Tvictim_t;
     88
     89  typedef enum
     90    {
     91      PREDICTOR_NEVER_TAKE      , // Branch is never  Take
     92      PREDICTOR_ALWAYS_TAKE     , // Branch is always Take
     93      PREDICTOR_STATIC          , // If the adress of destination is previous, then the branch is take
     94      PREDICTOR_LAST_TAKE       , // The direction is as the last time (if is the first time : static)
     95      PREDICTOR_COUNTER         , // Counter table
     96      PREDICTOR_LOCAL           , // Counter bank indexed with history bank
     97      PREDICTOR_GLOBAL          , // Counter bank indexed with history table
     98      PREDICTOR_META            , // A meta_predictor choose between 2 predictor : the local or the global
     99      PREDICTOR_CUSTOM            // Note predefined scheme
     100    } Tpredictor_t;
    44101
    45102  //----------------------------------------------[ spr_mode_access ]-----
     
    56113    }
    57114  };
    58 
    59   inline Tcontext_t get_num_thread (Tcontext_t num_context_id   , uint32_t size_context_id   ,
    60                                     Tcontext_t num_front_end_id , uint32_t size_front_end_id ,
    61                                     Tcontext_t num_ooo_engine_id, uint32_t size_ooo_engine_id)
    62   {
    63     return ((num_ooo_engine_id << (size_context_id + size_front_end_id)) |
    64             (num_front_end_id  << (size_context_id)) |
    65             (num_context_id));
    66   }
    67 
    68   inline uint32_t get_nb_thread (uint32_t nb_context ,
    69                                  uint32_t nb_front_end ,
    70                                  uint32_t nb_ooo_engine )
    71   {
    72     return (nb_ooo_engine *
    73             nb_front_end  *
    74             nb_context) ;
    75   }
    76115
    77116}; // end namespace behavioural
     
    96135  };
    97136
     137  template<> inline std::string toString<morpheo::behavioural::Tpriority_t>(const morpheo::behavioural::Tpriority_t& x)
     138  {
     139    switch (x)
     140      {
     141      case morpheo::behavioural::PRIORITY_STATIC      : return "priority_static"; break;
     142      case morpheo::behavioural::PRIORITY_ROUND_ROBIN : return "priority_round_robin"; break;
     143      default    : return ""      ; break;
     144      }
     145  };
     146
     147  template<> inline morpheo::behavioural::Tpriority_t fromString<morpheo::behavioural::Tpriority_t>(const std::string& x)
     148  {
     149    if ( (x.compare("0")                    == 0) or
     150         (x.compare("priority_static")      == 0))
     151      return morpheo::behavioural::PRIORITY_STATIC;
     152    if ( (x.compare("1")                    == 0) or
     153         (x.compare("priority_round_robin") == 0))
     154      return morpheo::behavioural::PRIORITY_ROUND_ROBIN;
     155    throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\""));
     156  };
     157
     158  template<> inline std::string toString<morpheo::behavioural::Tload_balancing_t>(const morpheo::behavioural::Tload_balancing_t& x)
     159  {
     160    switch (x)
     161      {
     162      case morpheo::behavioural::LOAD_BALANCING_BALANCE              : return "load_balancing_balance"; break;
     163      case morpheo::behavioural::LOAD_BALANCING_MAXIMUM_FOR_PRIORITY : return "load_balancing_maximum_for_priority"; break;
     164      default    : return ""      ; break;
     165      }
     166  };
     167
     168  template<> inline morpheo::behavioural::Tload_balancing_t fromString<morpheo::behavioural::Tload_balancing_t>(const std::string& x)
     169  {
     170    if ( (x.compare("0")                      == 0) or
     171         (x.compare("load_balancing_balance") == 0))
     172      return morpheo::behavioural::LOAD_BALANCING_BALANCE;
     173    if ( (x.compare("1")                                   == 0) or
     174         (x.compare("load_balancing_maximum_for_priority") == 0))
     175      return morpheo::behavioural::LOAD_BALANCING_MAXIMUM_FOR_PRIORITY;
     176    throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\""));
     177  };
     178
     179  template<> inline std::string toString<morpheo::behavioural::Tvictim_t>(const morpheo::behavioural::Tvictim_t& x)
     180  {
     181    switch (x)
     182      {
     183      case morpheo::behavioural::VICTIM_RANDOM      : return "victim_random"     ; break;
     184      case morpheo::behavioural::VICTIM_ROUND_ROBIN : return "victim_round_robin"; break;
     185      case morpheo::behavioural::VICTIM_NLU         : return "victim_nlu"        ; break;
     186      case morpheo::behavioural::VICTIM_PSEUDO_LRU  : return "victim_pseudo_lru" ; break;
     187      case morpheo::behavioural::VICTIM_LRU         : return "victim_lru"        ; break;
     188      case morpheo::behavioural::VICTIM_FIFO        : return "victim_fifo"       ; break;
     189      default    : return ""      ; break;
     190      }
     191  };
     192
     193  template<> inline morpheo::behavioural::Tvictim_t fromString<morpheo::behavioural::Tvictim_t>(const std::string& x)
     194  {
     195    if ( (x.compare("0")                  == 0) or
     196         (x.compare("victim_random")      == 0))
     197      return morpheo::behavioural::VICTIM_RANDOM;
     198    if ( (x.compare("1")                  == 0) or
     199         (x.compare("victim_round_robin") == 0))
     200      return morpheo::behavioural::VICTIM_ROUND_ROBIN;
     201    if ( (x.compare("2")                  == 0) or
     202         (x.compare("victim_nlu")         == 0))
     203      return morpheo::behavioural::VICTIM_NLU;
     204    if ( (x.compare("3")                  == 0) or
     205         (x.compare("victim_pseudo_lru")  == 0))
     206      return morpheo::behavioural::VICTIM_PSEUDO_LRU;
     207    if ( (x.compare("4")                  == 0) or
     208         (x.compare("victim_lru")         == 0))
     209      return morpheo::behavioural::VICTIM_LRU;
     210    if ( (x.compare("5")                  == 0) or
     211         (x.compare("victim_fifo")        == 0))
     212      return morpheo::behavioural::VICTIM_FIFO;
     213    throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\""));
     214  };
     215
     216  template<> inline std::string toString<morpheo::behavioural::Tpredictor_t>(const morpheo::behavioural::Tpredictor_t& x)
     217  {
     218    switch (x)
     219      {
     220      case morpheo::behavioural::PREDICTOR_NEVER_TAKE  : return "predictor_never_take" ; break;
     221      case morpheo::behavioural::PREDICTOR_ALWAYS_TAKE : return "predictor_always_take"; break;
     222      case morpheo::behavioural::PREDICTOR_STATIC      : return "predictor_static"     ; break;
     223      case morpheo::behavioural::PREDICTOR_LAST_TAKE   : return "predictor_last_take"  ; break;
     224      case morpheo::behavioural::PREDICTOR_COUNTER     : return "predictor_counter"    ; break;
     225      case morpheo::behavioural::PREDICTOR_LOCAL       : return "predictor_local"      ; break;
     226      case morpheo::behavioural::PREDICTOR_GLOBAL      : return "predictor_global"     ; break;
     227      case morpheo::behavioural::PREDICTOR_META        : return "predictor_meta"       ; break;
     228      case morpheo::behavioural::PREDICTOR_CUSTOM      : return "predictor_custom"     ; break;
     229      default    : return ""      ; break;
     230      }
     231  };
     232
     233  template<> inline morpheo::behavioural::Tpredictor_t fromString<morpheo::behavioural::Tpredictor_t>(const std::string& x)
     234  {
     235    if ( (x.compare("0")                     == 0) or
     236         (x.compare("predictor_never_take")  == 0))
     237      return morpheo::behavioural::PREDICTOR_NEVER_TAKE;
     238    if ( (x.compare("1")                     == 0) or
     239         (x.compare("predictor_always_take") == 0))
     240      return morpheo::behavioural::PREDICTOR_ALWAYS_TAKE;
     241    if ( (x.compare("2")                     == 0) or
     242         (x.compare("predictor_static")      == 0))
     243      return morpheo::behavioural::PREDICTOR_STATIC;
     244    if ( (x.compare("3")                     == 0) or
     245         (x.compare("predictor_last_take")   == 0))
     246      return morpheo::behavioural::PREDICTOR_LAST_TAKE;
     247    if ( (x.compare("4")                     == 0) or
     248         (x.compare("predictor_counter")     == 0))
     249      return morpheo::behavioural::PREDICTOR_COUNTER;
     250    if ( (x.compare("5")                     == 0) or
     251         (x.compare("predictor_local")       == 0))
     252      return morpheo::behavioural::PREDICTOR_LOCAL;
     253    if ( (x.compare("6")                     == 0) or
     254         (x.compare("predictor_global")      == 0))
     255      return morpheo::behavioural::PREDICTOR_GLOBAL;
     256    if ( (x.compare("7")                     == 0) or
     257         (x.compare("predictor_meta")        == 0))
     258      return morpheo::behavioural::PREDICTOR_META;
     259    if ( (x.compare("8")                     == 0) or
     260         (x.compare("predictor_custom")      == 0))
     261      return morpheo::behavioural::PREDICTOR_CUSTOM;
     262    throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\""));
     263  };
     264
    98265}; // end namespace morpheo             
    99 
    100266#endif
Note: See TracChangeset for help on using the changeset viewer.