Ignore:
Timestamp:
Jan 19, 2008, 12:09:01 PM (16 years ago)
Author:
rosiere
Message:

Modification of Statisctics
Add a new systemC component : Load_Store_Queue (tested with one benchmark and one configuration). Store don't supported the Data Buss Error (Load is supported)

Location:
trunk/IPs/systemC/processor/Morpheo/Common/include
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Common/include/BitManipulation.h

    r63 r71  
    1111#include <stdint.h>
    1212#include <iostream>
    13 using namespace std;
    1413
    1514namespace morpheo              {
    1615
     16  //............................................................................
    1717  // gen_mask ..................................................................
     18  //............................................................................
    1819 
    1920  template <typename T>
     
    2930  };
    3031
     32  template <typename T>
     33  T gen_mask       (uint32_t index_max, uint32_t index_min)
     34  {
     35    return  (gen_mask<T>(index_max-index_min+1)<<index_min);
     36  };
     37
     38  template <typename T>
     39  T gen_mask_not   (uint32_t index_max, uint32_t index_min)
     40  {
     41    return ~(gen_mask<T>(index_max-index_min+1)<<index_min);
     42  };
     43
     44  //............................................................................
    3145  // mask, mask_not ............................................................
    32   template <typename T>
    33   T mask           (uint32_t data, uint32_t index_max, uint32_t index_min) 
    34   {
    35     return     (gen_mask<T>(index_max-index_min+1)<<index_min) & data;
    36   }
    37 
    38   template <typename T>
    39   T mask_not       (uint32_t data, uint32_t index_max, uint32_t index_min) 
    40   {
    41     return (~(gen_mask<T>(index_max-index_min+1)<<index_min)) & data;
    42   }
    43 
     46  //............................................................................
     47  template <typename T>
     48  T mask           (T data, uint32_t index_max, uint32_t index_min) 
     49  {
     50    return gen_mask    <T>(index_max,index_min) & data;
     51  }
     52
     53  template <typename T>
     54  T mask_not       (T data, uint32_t index_max, uint32_t index_min) 
     55  {
     56    return gen_mask_not<T>(index_max,index_min) & data;
     57  }
     58
     59  //............................................................................
    4460  // shift_left_logic, shift_right_logic .......................................
    45   template <typename T>
    46   T shift_logic_left (uint32_t size, uint32_t data, uint32_t value) 
     61  //............................................................................
     62  template <typename T>
     63  T shift_logic_left (uint32_t size, T data, T value) 
    4764  {
    4865    T mask = gen_mask<T> (size);
     
    5269
    5370  template <typename T>
    54   T shift_logic_right (uint32_t size, uint32_t data, uint32_t value) 
     71  T shift_logic_right (uint32_t size, T data, T value) 
    5572  {
    5673    T mask = gen_mask<T> (size);
     
    5976  }
    6077
     78  //............................................................................
    6179  // shift_logic ...............................................................
    62   template <typename T>
    63   T shift_logic      (uint32_t size, uint32_t data, uint32_t value, bool is_direction_left)
     80  //............................................................................
     81  template <typename T>
     82  T shift_logic      (uint32_t size, T data, T value, bool is_direction_left)
    6483  {
    6584    if (is_direction_left == true)
     
    6988  }
    7089
     90  //............................................................................
    7191  // shift_left_arithmetic, shift_right_arithmetic .............................
    72   template <typename T>
    73   T shift_arithmetic_left (uint32_t size, uint32_t data, uint32_t value) 
     92  //............................................................................
     93  template <typename T>
     94  T shift_arithmetic_left (uint32_t size, T data, T value) 
    7495  {
    7596    bool carry = (data&1) != 0;
     
    89110
    90111  template <typename T>
    91   T shift_arithmetic_right (uint32_t size, uint32_t data, uint32_t value) 
     112  T shift_arithmetic_right (uint32_t size, T data, T value) 
    92113  {
    93114    bool carry = (data&(1<<(size-1))) != 0;
     
    105126  }
    106127
     128  //............................................................................
    107129  // shift_arithmetic ..........................................................
    108   template <typename T>
    109   T shift_arithmetic      (uint32_t size, uint32_t data, uint32_t value, bool is_direction_left)
     130  //............................................................................
     131  template <typename T>
     132  T shift_arithmetic      (uint32_t size, T data, T value, bool is_direction_left)
    110133  {
    111134    if (is_direction_left == true)
     
    115138  }
    116139
     140  //............................................................................
    117141  // shift .....................................................................
    118   template <typename T>
    119   T shift            (uint32_t size, uint32_t data, uint32_t value, bool is_direction_left, bool is_shift_arithmetic)
     142  //............................................................................
     143  template <typename T>
     144  T shift            (uint32_t size, T data, T value, bool is_direction_left, bool is_shift_arithmetic)
    120145  {
    121146    if (is_shift_arithmetic == true)
     
    125150  }
    126151
     152  //............................................................................
    127153  // rotate_left, rotate_right .................................................
    128 
    129   template <typename T>
    130   T rotate_left    (uint32_t size, uint32_t data, uint32_t value) 
     154  //............................................................................
     155  template <typename T>
     156  T rotate_left    (uint32_t size, T data, T value) 
    131157  {
    132158    T mask        = gen_mask<T> (size);
     
    137163
    138164  template <typename T>
    139   T rotate_right    (uint32_t size, uint32_t data, uint32_t value) 
     165  T rotate_right    (uint32_t size, T data, T value) 
    140166  {
    141167    T mask        = gen_mask<T> (size);
     
    145171  }
    146172
     173  //............................................................................
    147174  // rotate ....................................................................
    148   template <typename T>
    149   T rotate         (uint32_t size, uint32_t data, uint32_t value, bool is_direction_left) 
     175  //............................................................................
     176  template <typename T>
     177  T rotate         (uint32_t size, T data, T value, bool is_direction_left) 
    150178  {
    151179    if (is_direction_left == true)
     
    155183  }
    156184
     185  //............................................................................
    157186  // range .....................................................................
    158   template <typename T>
    159   T range          (uint32_t data, uint32_t index_max, uint32_t index_min) 
     187  //............................................................................
     188  template <typename T>
     189  T range          (T data, uint32_t index_max, uint32_t index_min) 
    160190  {
    161191    return gen_mask<T>(index_max-index_min+1) & (data << index_min);
     
    163193
    164194  template <typename T>
    165   T range          (uint32_t data, uint32_t nb_bits) 
     195  T range          (T data, uint32_t nb_bits) 
    166196  {
    167197    return gen_mask<T>(nb_bits) & data;
    168198  }
     199
     200  //............................................................................
     201  // insert ....................................................................
     202  //............................................................................
     203  template <typename T>
     204  T insert         (T data_old, T data_new, uint32_t index_max, uint32_t index_min) 
     205  {
     206    return (mask<T>(data_new,index_max,index_min) | mask_not<T>(data_old,index_max,index_min));
     207  }
     208
     209  //............................................................................
     210  // extend ....................................................................
     211  //............................................................................
     212  template <typename T>
     213  T extend         (uint32_t size, T data, bool extend_with_sign, uint32_t nb_bits_keep)
     214  {
     215    if (size < nb_bits_keep)
     216      return data;
     217
     218    if (extend_with_sign and ((data>>(nb_bits_keep-1))&1))
     219      return data | (mask<T>(gen_mask<T>(size),size-1, nb_bits_keep));
     220    else
     221      return data & (mask<T>(gen_mask<T>(size),nb_bits_keep-1, 0));
     222  }
     223
     224  //............................................................................
     225  // duplicate..................................................................
     226  //............................................................................
     227
     228  template <typename T>
     229  T duplicate (uint32_t size, T data_src, uint32_t nb_bits, uint32_t index_min)
     230  {
     231    T data_duplicate = mask<T>((data_src)>>index_min, nb_bits-1, 0);
     232    T data_dest      = 0;
     233   
     234    for (uint32_t i=0; i < size; i+=nb_bits)
     235      data_dest |= (data_duplicate<<i);
     236   
     237    return data_dest;
     238  }
     239
     240  template <typename T>
     241  T duplicate (uint32_t size, T data_src, uint32_t nb_bits)
     242  {
     243    return duplicate<T> (size,data_src,nb_bits,0);
     244  }
     245
     246
    169247}; // end namespace morpheo             
    170248
  • trunk/IPs/systemC/processor/Morpheo/Common/include/ChangeCase.h

    r63 r71  
    1212#include <stdint.h>
    1313
    14 using namespace std;
    15 
    1614namespace morpheo              {
    1715 
    18   inline void UpperCase(string& S)
     16  inline void UpperCase(std::string& S)
    1917  {
    2018    uint32_t n = S.size();
     
    2725  }
    2826 
    29   inline void LowerCase(string& S)
     27  inline void LowerCase(std::string& S)
    3028  {
    3129    uint32_t n = S.size();
  • trunk/IPs/systemC/processor/Morpheo/Common/include/Debug.h

    r63 r71  
    22#define DEBUG_H
    33
     4#include "Common/include/Message.h"
    45#include "Behavioural/include/Debug_component.h"
    56#include <stdio.h>
     
    89#include <sstream>
    910#include <string>
    10 using namespace std;
    1111
    1212// Debug's Level :
     
    2929//Debug
    3030#  define log_printf(level, component, func, str... )                   \
    31 do                                                                      \
    32 {                                                                       \
    33     if ( (DEBUG == DEBUG_ALL ) or                                       \
    34          (DEBUG_ ## level == DEBUG_NONE) or                             \
    35          (( DEBUG_ ## level     <= DEBUG) and                           \
    36           ( DEBUG_ ## component == true )) )                            \
    37       {                                                                 \
    38         if (DEBUG >= DEBUG_ALL )                                        \
    39           {                                                             \
    40             switch (DEBUG_ ## level)                                    \
    41             {                                                           \
    42             case DEBUG_NONE  : fprintf(stdout,"(none       ) "); break; \
    43             case DEBUG_INFO  : fprintf(stdout,"(information) "); break; \
    44             case DEBUG_TRACE : fprintf(stdout,"(trace      ) "); break; \
    45             case DEBUG_FUNC  : fprintf(stdout,"(function   ) "); break; \
    46             case DEBUG_ALL   : fprintf(stdout,"(all        ) "); break; \
    47             default          : fprintf(stdout,"(undefine   ) "); break; \
    48             }                                                           \
    49           }                                                             \
    50         fprintf(stdout,"<%s> ",func);                                   \
    51         if (DEBUG >= DEBUG_FUNC)                                        \
    52         {                                                               \
    53           fprintf(stdout,"In file %s, ",__FILE__);                      \
    54           fprintf(stdout,"at line %d, ",__LINE__);                      \
    55         }                                                               \
    56         fprintf(stdout,": ");                                           \
    57         fprintf(stdout,str);                                            \
    58         fprintf(stdout,"\n");                                           \
    59         fflush (stdout);                                                \
    60       }                                                                 \
    61 } while(0)
     31  do                                                                    \
     32    {                                                                   \
     33      if ((DEBUG == DEBUG_ALL ) or                                      \
     34          (DEBUG_ ## level == DEBUG_NONE) or                            \
     35          (( DEBUG_ ## level     <= DEBUG) and                          \
     36           ( DEBUG_ ## component == true )) )                           \
     37        {                                                               \
     38          if (DEBUG >= DEBUG_ALL )                                      \
     39            {                                                           \
     40              switch (DEBUG_ ## level)                                  \
     41                {                                                       \
     42                case DEBUG_NONE  : msg(_("(none       ) ")); break;     \
     43                case DEBUG_INFO  : msg(_("(information) ")); break;     \
     44                case DEBUG_TRACE : msg(_("(trace      ) ")); break;     \
     45                case DEBUG_FUNC  : msg(_("(function   ) ")); break;     \
     46                case DEBUG_ALL   : msg(_("(all        ) ")); break;     \
     47                default          : msg(_("(undefine   ) ")); break;     \
     48                }                                                       \
     49            }                                                           \
     50          msg(_("<%s> "),func);                                         \
     51          if (DEBUG >= DEBUG_FUNC)                                      \
     52            {                                                           \
     53              msg(_("In file %s, "),__FILE__);                          \
     54              msg(_("at line %d, "),__LINE__);                          \
     55            }                                                           \
     56          msg(_(": "));                                                 \
     57          msg(str);                                                     \
     58          msg(_("\n"));                                                 \
     59          fflush (stdout);                                              \
     60        }                                                               \
     61    } while(0)
    6262
    6363#else
  • trunk/IPs/systemC/processor/Morpheo/Common/include/ErrorMorpheo.h

    r43 r71  
    55 * $Id$
    66 *
    7  * [ Description ]
     7 * [ Description ]
    88 *
    99 */
    1010
     11#include "ToString.h"
    1112#include <iostream>
    1213#include <exception>
    1314
    14 using namespace std;
    15 
    1615namespace morpheo              {
    1716
    18   class ErrorMorpheo : public exception
     17#define ERRORMORPHEO(funcname,msg) ErrorMorpheo(funcname,msg,__LINE__,__FILE__)
     18
     19  class ErrorMorpheo : public std::exception
    1920  {
    2021    // -----[ fields ]----------------------------------------------------
    21   private : string _msg;
     22  private : std::string _msg;
    2223   
    2324    // -----[ methods ]---------------------------------------------------
    24   public  :             ErrorMorpheo  ()           throw() { _msg = "Exception detected ...";}
    25   public  :             ErrorMorpheo  (string msg) throw() { _msg = msg;}
     25  public  :             ErrorMorpheo  ()                throw() {_msg="Exception detected ...";}
     26  public  :             ErrorMorpheo  (std::string msg) throw() {_msg=msg;}
     27  public  :             ErrorMorpheo  (std::string funcname,
     28                                       std::string msg     ,
     29                                       int         line    ,
     30                                       std::string file    ) throw()
     31    {
     32      _msg = "<"+funcname+"> at line " + toString(line) + ", in file " + file + " : "+msg;
     33    }
    2634  public  :             ~ErrorMorpheo (void)       throw() {}
    2735  public  : const char* what          ()    const  throw() { return ( _msg.c_str() );}
     
    2937  };
    3038
    31   class TestMorpheo : public exception
     39  class TestMorpheo : public std::exception
    3240  {
    3341    // -----[ fields ]----------------------------------------------------
    34   private : string _msg;
     42  private : std::string _msg;
    3543   
    3644    // -----[ methods ]---------------------------------------------------
    37   public  :             TestMorpheo   ()           throw() { _msg = "Test error ...";}
    38   public  :             TestMorpheo   (string msg) throw() { _msg = msg;}
    39   public  :             ~TestMorpheo  (void)       throw() {}
    40   public  : const char* what          ()    const  throw() { return ( _msg.c_str() );}
     45  public  :             TestMorpheo   ()                throw() {_msg="Test error ...";}
     46  public  :             TestMorpheo   (std::string msg) throw() {_msg=msg;}
     47  public  :             ~TestMorpheo  (void)            throw() {}
     48  public  : const char* what          ()    const       throw() { return ( _msg.c_str() );}
    4149  };
    4250
  • trunk/IPs/systemC/processor/Morpheo/Common/include/Log2.h

    r67 r71  
    1111#include <stdint.h>
    1212#include <math.h>
    13 using namespace std;
    1413
    1514namespace morpheo              {
  • trunk/IPs/systemC/processor/Morpheo/Common/include/Message.h

    r2 r71  
     1#ifndef MESSAGE_H
     2#define MESSAGE_H
    13/*
    24 * $Id$
    35 *
    4  * [ Description ]
     6 * [ Description ]
    57 *
    68 * Routine of Test
    79 */
    810
    9 namespace morpheo    {
     11#include <stdio.h>
     12#include <string.h>
     13#include <libintl.h>
    1014
    11 #define cerr_msg   cerr << "<" << __FILE__ << "> line " << __LINE__ << " : "
    12  
     15namespace morpheo {
     16
     17#ifdef NO_TRANSLATION
     18# define _(String) (String)
     19#else
     20# define _(String) gettext (String)
     21#endif
     22
     23#define msg(arg...) fprintf(stdout,arg);
     24#define err(arg...) fprintf(stderr,arg);
     25
    1326}; // end namespace morpheo
     27#endif
  • trunk/IPs/systemC/processor/Morpheo/Common/include/Test.h

    r53 r71  
    55#include <sstream>
    66#include <stdint.h>
     7#include "Common/include/Message.h"
    78#include "Common/include/ErrorMorpheo.h"
    8 using namespace std;
     9#include "Common/include/ToString.h"
    910
    1011//-----[ Routine de test ]---------------------------------------
     
    1213static uint32_t num_test;
    1314
    14 void test_ko_error (void)
     15inline void test_ko_error (void)
    1516{
    16   string msg = "Test ko : error in test \""+toString(num_test)+"\"";
    17   throw (ErrorMorpheo (msg));
     17  string msg = "Test ko : error in test \""+morpheo::toString(num_test)+"\"";
     18  throw (morpheo::ErrorMorpheo (msg));
    1819}
    1920 
    2021template <class T>
    21 void test_ko (char * file, uint32_t line, T exp1, T exp2)
     22inline void test_ko (char * file, uint32_t line, T exp1, T exp2)
    2223{
    2324  cerr << "[" << num_test << "] : Test KO"
     
    2728       << "   - Line : " << line                      << endl
    2829       << " * Expression is different"                << endl
    29        << "   - exp1 : "+toString(exp1)               << endl
    30        << "   - exp2 : "+toString(exp2)               << endl;
     30       << "   - exp1 : "+morpheo::toString(exp1)               << endl
     31       << "   - exp2 : "+morpheo::toString(exp2)               << endl;
    3132
    3233  test_ko_error ();
    3334};
    3435
    35 void test_ko (char * file, uint32_t line)
     36inline void test_ko (char * file, uint32_t line)
    3637{
    3738  cerr << "[" << num_test << "] : Test KO"
     
    4445};
    4546
    46 void test_ok ()
     47inline void test_ok ()
    4748{
    48   cout << "[" << num_test << "] : Test OK"            << endl;
     49  msg (_("[%d] : Test OK\n"), num_test);
    4950
    5051  num_test ++;
    5152};
    5253
    53 void test_ok (char * file, uint32_t line)
     54inline void test_ok (char * file, uint32_t line)
    5455{
    55   cout << "[" << num_test << "] : Test OK"
    56        << "\tline " << line                           << endl
    57 //     << " * Localisation"                           << endl
    58 //     << "   - File : " << file                      << endl
    59 //     << "   - Line : " << line                      << endl
    60     ;
     56  msg (_("[%d] : Test OK\n"), num_test);
     57  msg (_("\tline %d\n"), line);
    6158
    6259  num_test ++;
     
    6461
    6562template <class T>
    66 void test_ok (char * file, uint32_t line, T exp)
     63inline void test_ok (char * file, uint32_t line, T exp)
    6764{
    68   cout << "[" << num_test << "] : Test OK"
    69        << "\tline " << line                           
    70        << "\tvalue : " << toString(exp)               << endl
    71 //     << " * Localisation"                           << endl
    72 //     << "   - File : " << file                      << endl
    73 //     << "   - Line : " << line                      << endl
    74 //     << " * Expression"                             << endl
    75 //     << "   - exp  : "+toString(exp)                << endl
    76     ;
     65  msg (_("[%d] : Test OK\n"), num_test);
     66  msg (_("\tline %d\n"), line);
     67  msg (_("\tvalue %s\n"), (morpheo::toString(exp)).c_str());
    7768
    7869  num_test ++;
     
    8071
    8172template <class T>
    82 void test(char * file, uint32_t line, T exp1, T exp2)
     73inline void test(char * file, uint32_t line, T exp1, T exp2)
    8374{
    8475  if (exp1 != exp2)
  • trunk/IPs/systemC/processor/Morpheo/Common/include/ToString.h

    r66 r71  
    1717#include <limits>
    1818
    19 using std::setprecision ;
    20 using std::ostringstream ;
    21 using std::boolalpha ;
    22 
    2319namespace morpheo              {
    2420 
    2521  template<typename T> inline std::string toString             (const T& x)
    2622  {
    27     ostringstream out("");
     23    std::ostringstream out("");
    2824    out << x;
    2925    return out.str();
     
    3228  template<>           inline std::string toString<bool>       (const bool& x)
    3329  {
    34     ostringstream out("");
     30    std::ostringstream out("");
    3531    //out << boolalpha << x;
    3632    out << x;
     
    4137  {
    4238    const int sigdigits = std::numeric_limits<float>::digits10;
    43     ostringstream out("");
    44     out << setprecision(sigdigits) << x;
     39    std::ostringstream out("");
     40    out << std::setprecision(sigdigits) << x;
    4541    return out.str();
    4642  }
     
    4945  {
    5046    const int sigdigits = std::numeric_limits<double>::digits10;
    51     ostringstream out("");
    52     out << setprecision(sigdigits) << x;
     47    std::ostringstream out("");
     48    out << std::setprecision(sigdigits) << x;
    5349    return out.str();
    5450  }
     
    5753  {
    5854    const int sigdigits = std::numeric_limits<long double>::digits10;
    59     ostringstream out("");
    60     out << setprecision(sigdigits) << x;
     55    std::ostringstream out("");
     56    out << std::setprecision(sigdigits) << x;
    6157    return out.str();
    6258  }
     
    6460//   template<>           inline std::string toString< int8_t>       (const int8_t& x)
    6561//   {
    66 //     ostringstream out("");
     62//     std::ostringstream out("");
    6763//     out << x;
    6864//     return out.str();
     
    7167//   template<>           inline std::string toString<uint8_t>       (const uint8_t& x)
    7268//   {
    73 //     ostringstream out("");
     69//     std::ostringstream out("");
    7470//     out << x;
    7571//     return out.str();
     
    7874//   template<>           inline std::string toString< int16_t>      (const int16_t& x)
    7975//   {
    80 //     ostringstream out("");
     76//     std::ostringstream out("");
    8177//     out << x;
    8278//     return out.str();
     
    8581//   template<>           inline std::string toString<uint16_t>      (const uint16_t& x)
    8682//   {
    87 //     ostringstream out("");
     83//     std::ostringstream out("");
    8884//     out << x;
    8985//     return out.str();
     
    9288//   template<>           inline std::string toString< int32_t>      (const int32_t& x)
    9389//   {
    94 //     ostringstream out("");
     90//     std::ostringstream out("");
    9591//     out << x;
    9692//     return out.str();
     
    9995//   template<>           inline std::string toString<uint32_t>      (const uint32_t& x)
    10096//   {
    101 //     ostringstream out("");
     97//     std::ostringstream out("");
    10298//     out << x;
    10399//     return out.str();
Note: See TracChangeset for help on using the changeset viewer.