SystemC  Recoding Infrastructure for SystemC v0.6.2 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
sc_except.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  sc_except.h - Exception classes to be handled by SystemC.
21 
22  Original Author: Stan Y. Liao, Synopsys, Inc.
23 
24  CHANGE LOG AT THE END OF THE FILE
25  *****************************************************************************/
26 
27 
28 #ifndef SC_EXCEPT_H
29 #define SC_EXCEPT_H
30 
31 #include <exception>
32 
33 namespace sc_core {
34 
35 class sc_simcontext;
36 class sc_process_b;
37 class sc_method_process;
38 class sc_thread_process;
39 void sc_thread_cor_fn( void* arg );
40 
41 /*
42  * These classes are intentionally empty. Their raison d'etre is for
43  * the implementation of various SystemC throws.
44  */
45 
46 class sc_user
47 {
48  /*EMPTY*/
49 public:
50  sc_user() {}
51  sc_user( const sc_user& ) {}
52 };
53 
54 class sc_halt
55 {
56 public:
57  sc_halt() {}
58  sc_halt( const sc_halt& ) {}
59 };
60 
61 class sc_kill
62 {
63 public:
64  sc_kill() {}
65  sc_kill( const sc_kill& ) {}
66 };
67 
68 class sc_unwind_exception : public std::exception
69 {
70  friend class sc_simcontext;
71  friend class sc_process_b;
72  friend class sc_method_process;
73  friend class sc_thread_process;
74  friend void sc_thread_cor_fn( void* arg );
75  friend void sc_method_cor_fn( void* arg );
76 
77  public:
78  virtual bool is_reset() const { return m_is_reset; }
79  virtual const char* what() const throw();
80 
81  public:
82 
83  // enable catch by value
85  virtual ~sc_unwind_exception() throw();
86 
87  protected:
88  explicit
89  sc_unwind_exception( sc_process_b* target_p, bool is_reset = false );
90 
91  bool active() const;
92  void clear() const;
93 
94  private:
95  // disabled
96  sc_unwind_exception& operator=( const sc_unwind_exception& );
97 
98  mutable sc_process_b* m_proc_p; // used to check, if caught by the kernel
99  const bool m_is_reset; // true if this is an unwind of a reset
100 
101 };
102 
103 inline
104 sc_unwind_exception::sc_unwind_exception( const sc_unwind_exception& that )
105  : std::exception( that )
106  , m_proc_p( that.m_proc_p )
107  , m_is_reset( that.m_is_reset )
108 {
109  that.m_proc_p = 0; // move to new instance
110 }
111 
112 //------------------------------------------------------------------------------
113 // global exception handling
114 //------------------------------------------------------------------------------
115 
116 class sc_report;
118 
119 } // namespace sc_core
120 
121 /*****************************************************************************
122 
123  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
124  changes you are making here.
125 
126  Name, Affiliation, Date: Gene Bushuyev. Synopsys, Inc.
127  Description of Modification: - Had to add empty public default and copy
128  constructors to satisfy VC6.0.
129 
130  Name, Affiliation, Date:
131  Description of Modification:
132 
133  *****************************************************************************/
134 
135 // $Log: sc_except.h,v $
136 // Revision 1.11 2011/08/26 21:40:26 acg
137 // Philipp A. Hartmann: fix up sc_unwind_exception copy-ctor.
138 //
139 // Revision 1.10 2011/08/26 20:46:09 acg
140 // Andy Goodrich: moved the modification log to the end of the file to
141 // eliminate source line number skew when check-ins are done.
142 //
143 // Revision 1.9 2011/08/24 22:05:50 acg
144 // Torsten Maehne: initialization changes to remove warnings.
145 //
146 // Revision 1.8 2011/05/09 04:07:48 acg
147 // Philipp A. Hartmann:
148 // (1) Restore hierarchy in all phase callbacks.
149 // (2) Ensure calls to before_end_of_elaboration.
150 //
151 // Revision 1.7 2011/02/18 20:27:14 acg
152 // Andy Goodrich: Updated Copyrights.
153 //
154 // Revision 1.6 2011/02/13 21:47:37 acg
155 // Andy Goodrich: update copyright notice.
156 //
157 // Revision 1.5 2011/02/11 13:25:24 acg
158 // Andy Goodrich: Philipp A. Hartmann's changes:
159 // (1) Removal of SC_CTHREAD method overloads.
160 // (2) New exception processing code.
161 //
162 // Revision 1.4 2011/01/18 20:10:44 acg
163 // Andy Goodrich: changes for IEEE1666_2011 semantics.
164 //
165 // Revision 1.3 2009/05/22 16:06:29 acg
166 // Andy Goodrich: process control updates.
167 //
168 // Revision 1.2 2008/05/22 17:06:25 acg
169 // Andy Goodrich: updated copyright notice to include 2008.
170 //
171 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
172 // SystemC 2.3
173 //
174 // Revision 1.3 2006/01/13 18:44:29 acg
175 // Added $Log to record CVS changes into the source.
176 
177 #endif
friend void sc_method_cor_fn(void *arg)
virtual bool is_reset() const
Definition: sc_except.h:78
sc_process_b sc_process_b
Definition: sc_process.h:977
sc_kill(const sc_kill &)
Definition: sc_except.h:65
void sc_thread_cor_fn(void *arg)
User initiated dynamic process support.
Definition: sc_process.h:558
The simulation context.
sc_halt(const sc_halt &)
Definition: sc_except.h:58
friend void sc_thread_cor_fn(void *arg)
virtual const char * what() const
sc_report * sc_handle_exception()
sc_user(const sc_user &)
Definition: sc_except.h:51