Ignore:
Timestamp:
Dec 10, 2008, 7:31:39 PM (15 years ago)
Author:
rosiere
Message:

Almost complete design
with Test and test platform

File:
1 edited

Legend:

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

    r83 r88  
    1 #ifndef DEBUG_H
    2 #define DEBUG_H
     1#ifndef Morpheo_Debug_h
     2#define Morpheo_Debug_h
    33
    44/*
     
    1313 *  - log_begin
    1414 *  - log_end
     15 *  - log_function
     16 *  - msg_print
    1517 *  - breakpoint
    1618 *
     
    2527#include "Common/include/Message.h"
    2628#include "Behavioural/include/Debug_component.h"
    27 #include "Behavioural/include/Environment.h"
     29#include <systemc.h>
    2830#include <stdio.h>
    2931#include <string.h>
     
    3133#include <sstream>
    3234#include <string>
     35
     36namespace morpheo {
    3337
    3438enum _debug_verbosity
     
    5458           ( DEBUG_ ## component == true )) )                           \
    5559        {                                                               \
     60          if (DEBUG_ ## level <= DEBUG_INFO)                            \
     61            {                                                           \
     62              msg("%s ",MSG_INFORMATION);                               \
     63            }                                                           \
     64          else                                                          \
     65            {                                                           \
     66              msg("%s ",MSG_DEBUG);                                     \
     67            }                                                           \
     68                                                                        \
    5669          if (DEBUG >= DEBUG_FUNC)                                      \
    5770            {                                                           \
    58               msg(_("%s"),debug_tab().c_str());                         \
     71              msg("%s",debug_tab().c_str());                            \
    5972            }                                                           \
    6073          if (DEBUG >= DEBUG_ALL )                                      \
     
    7285          if (DEBUG >= DEBUG_FUNC)                                      \
    7386            {                                                           \
    74               msg(_("<%s> "),func);                                     \
    75               msg(_("In file %s, "),__FILE__);                          \
    76               msg(_("at line %d " ),__LINE__);                          \
    77               msg(_(": "));                                             \
    78             }                                                           \
    79           msg(str);                                                     \
    80           msg(_("\n"));                                                 \
    81           fflush (stdout);                                              \
     87              msg(  "<%s> " ,func);                                     \
     88              msg(_("In file %s, "),__FILE__);                          \
     89              msg(_("at line %d " ),__LINE__);                          \
     90              msg(  ": " );                                             \
     91            }                                                           \
     92          msg(str);                                                     \
     93          msg("\n");                                                    \
    8294        }                                                               \
    8395    } while(0)
     
    8799    {                                                                   \
    88100      debug_tab_inc ();                                                 \
    89       log_printf(FUNC,component,func,"Begin");                          \
     101      log_printf(FUNC,component,func,_("Begin"));                       \
    90102    } while(0)
    91103
     
    93105  do                                                                    \
    94106    {                                                                   \
    95       log_printf(FUNC,component,func,"End");                            \
     107      log_printf(FUNC,component,func,_("End"));                         \
    96108      debug_tab_dec ();                                                 \
    97109    } while(0)
     
    115127#endif // DEBUG
    116128
     129# define log_function(component,func,name)                              \
     130  do                                                                    \
     131    {                                                                   \
     132      log_printf(TRACE,component,func,_("[%d] %s.%s"),static_cast<uint32_t>(sc_simulation_time()),name,func); \
     133    } while(0)
     134
     135
     136#define msg_printf(type,str...)                                         \
     137  do                                                                    \
     138    {                                                                   \
     139      msg("%s ",MSG_ ## type);                                          \
     140      msg(str);                                                         \
     141      msg("\n");                                                        \
     142    } while(0)
     143
     144
    117145#define breakpoint(str...)                                              \
    118146  do                                                                    \
    119147    {                                                                   \
    120       msg(_("Breakpoint : file %s, line %d. Enter Any key to continue\n"),__FILE__,__LINE__); \
    121       msg(str);                                                         \
     148      fprintf(stdout,_("%s "),MSG_BREAKPOINT);                                     \
     149      fprintf(stdout,_("Breakpoint in file %s, line %d.\n"),__FILE__,__LINE__);    \
     150      fprintf(stdout,_("%s "),MSG_NONE);                                           \
     151      fprintf(stdout,str);                                                              \
     152      fprintf(stdout,_("\n"));                                                     \
     153      fprintf(stdout,_("%s "),MSG_NONE);                                           \
     154      fprintf(stdout,_("Enter any key to continue\n"));                            \
    122155      getchar();                                                        \
    123156    } while(0)
     
    128161    {                                                                   \
    129162      if (x == NULL)                                                    \
    130         err(_("%s File %s, Line %d, this pointeur is null\n"),MSG_ERROR,__FILE__,__LINE__); \
     163        err(_("File %s, Line %d, this pointeur is null\n"),__FILE__,__LINE__); \
    131164    }                                                                   \
    132165  while (0)
     
    139172#endif
    140173
    141 
     174}; // end namespace morpheo
    142175#endif // !DEBUG_H
Note: See TracChangeset for help on using the changeset viewer.