Ignore:
Timestamp:
Dec 19, 2008, 4:34:00 PM (16 years ago)
Author:
rosiere
Message:

1) Update Prediction Table : statistics
2) Size instruction address on 30 bits
3) Change Log File
4) Add debug_level in simulation configuration file

File:
1 edited

Legend:

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

    r88 r97  
    99 * function to help the debugging :
    1010 *
    11  *  - debug_tab
    1211 *  - log_printf
    1312 *  - log_begin
     
    2625
    2726#include "Common/include/Message.h"
     27#include "Common/include/FromString.h"
     28#include "Common/include/ChangeCase.h"
    2829#include "Behavioural/include/Debug_component.h"
    2930#include <systemc.h>
     
    3637namespace morpheo {
    3738
    38 enum _debug_verbosity
     39typedef enum
    3940  {
    4041    DEBUG_NONE ,
     
    4344    DEBUG_FUNC ,
    4445    DEBUG_ALL
    45   };
    46 
    47 std::string debug_tab     (void);
    48 void        debug_tab_inc (void);
    49 void        debug_tab_dec (void);
    50 
     46  } debug_verbosity_t;
     47
     48  extern debug_verbosity_t debug;
     49
     50void        debug_init    (void);
     51void        debug_init    (debug_verbosity_t level);
    5152#ifdef DEBUG
     53
    5254# define log_printf(level, component, func, str... )                    \
    5355  do                                                                    \
    5456    {                                                                   \
    55       if ((DEBUG == DEBUG_ALL ) or                                      \
     57      debug_init();                                                     \
     58                                                                        \
     59      if ((debug == DEBUG_ALL ) or                                      \
    5660          (DEBUG_ ## level == DEBUG_NONE) or                            \
    57           (( DEBUG_ ## level     <= DEBUG) and                          \
     61          (( DEBUG_ ## level     <= debug) and                          \
    5862           ( DEBUG_ ## component == true )) )                           \
    5963        {                                                               \
     
    6771            }                                                           \
    6872                                                                        \
    69           if (DEBUG >= DEBUG_FUNC)                                      \
    70             {                                                           \
    71               msg("%s",debug_tab().c_str());                            \
    72             }                                                           \
    73           if (DEBUG >= DEBUG_ALL )                                      \
     73          if (debug >= DEBUG_ALL )                                      \
    7474            {                                                           \
    7575              switch (DEBUG_ ## level)                                  \
     
    8383                }                                                       \
    8484            }                                                           \
    85           if (DEBUG >= DEBUG_FUNC)                                      \
     85          if (debug >= DEBUG_FUNC)                                      \
    8686            {                                                           \
    8787              msg(  "<%s> " ,func);                                     \
     
    9898  do                                                                    \
    9999    {                                                                   \
    100       debug_tab_inc ();                                                 \
    101100      log_printf(FUNC,component,func,_("Begin"));                       \
    102101    } while(0)
     
    106105    {                                                                   \
    107106      log_printf(FUNC,component,func,_("End"));                         \
    108       debug_tab_dec ();                                                 \
    109107    } while(0)
    110108
     
    172170#endif
    173171
     172
     173  template<> inline debug_verbosity_t fromString<debug_verbosity_t> (const std::string& x)
     174  {
     175    std::string y=x;
     176    LowerCase(y);
     177
     178    if ( (y.compare("0")     == 0) or
     179         (y.compare("none")  == 0))
     180      return DEBUG_NONE ;
     181    if ( (y.compare("1")     == 0) or
     182         (y.compare("info")  == 0))
     183      return DEBUG_INFO ;
     184    if ( (y.compare("2")     == 0) or
     185         (y.compare("trace") == 0))
     186      return DEBUG_TRACE;
     187    if ( (y.compare("3")     == 0) or
     188         (y.compare("func")  == 0))
     189      return DEBUG_FUNC ;
     190    if ( (y.compare("4")     == 0) or
     191         (y.compare("all")   == 0))
     192      return DEBUG_ALL  ;
     193
     194#ifdef DEBUG
     195    return DEBUG;
     196#else
     197    return DEBUG_NONE ;
     198#endif
     199  }
     200
    174201}; // end namespace morpheo
    175202#endif // !DEBUG_H
Note: See TracChangeset for help on using the changeset viewer.