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