source: trunk/IPs/systemC/processor/Morpheo/Common/include/ErrorMorpheo.h @ 146

Last change on this file since 146 was 146, checked in by rosiere, 13 years ago

1) Integration of RegisterFile_Internal_Banked in RegisterFile?
2) Erase "read_write" interface in RegisterFile_Monolithic component
3) Add smith predictor parameters in Load_store_pointer_unit.
4) Fix not statistics flags

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1#ifndef Morpheo_ErrorMorpheo_h
2#define Morpheo_ErrorMorpheo_h
3
4/*
5 * $Id: ErrorMorpheo.h 146 2011-02-01 20:57:54Z rosiere $
6 *
7 * [ Description ]
8 *
9 */
10
11#include "Common/include/ToString.h"
12#include "Common/include/Translation.h"
13#include "Common/include/Message.h"
14
15#include <iostream>
16#include <exception>
17
18namespace morpheo              {
19
20#define ERRORMORPHEO(funcname,msg)              \
21  ErrorMorpheo(funcname,msg,__LINE__,__FILE__)
22
23#define THROW_ERRORMORPHEO(cond,funcname,msg)   \
24  do                                            \
25    {                                           \
26      if (cond)                                 \
27        {                                       \
28          throw ERRORMORPHEO(funcname,msg);     \
29        }                                       \
30    }                                           \
31  while (0)
32 
33  class ErrorMorpheo : public std::exception
34  {
35    // -----[ fields ]----------------------------------------------------
36  private : std::string _msg;
37   
38    // -----[ methods ]---------------------------------------------------
39  public  :             ErrorMorpheo  ()                throw() {_msg = toString("%s ",MSG_ERROR); _msg+="Exception detected ...";}
40  public  :             ErrorMorpheo  (std::string msg) throw() {_msg = toString("%s ",MSG_ERROR); _msg+=msg;}
41  public  :             ErrorMorpheo  (std::string funcname,
42                                       std::string msg     ,
43                                       int         line    ,
44                                       std::string file    ) throw() 
45    { 
46#ifdef DEBUG
47      _msg = toString(_("%s at line %d, in file %s"),MSG_ERROR,line,file.c_str());
48      _msg = toString(_("%s <%s> %s"),MSG_ERROR,funcname.c_str(),msg.c_str());
49#else
50      _msg = toString(_("%s %s"),MSG_ERROR,msg.c_str());
51#endif
52//     msg("%s",_msg.c_str());
53    }
54  public  :             ~ErrorMorpheo (void)       throw() {}
55  public  : const char* what          ()    const  throw() { return ( _msg.c_str() );}
56
57  };
58
59}; // end namespace morpheo             
60
61#endif
Note: See TracBrowser for help on using the repository browser.