00001 /***************************************************************************** 00002 00003 The following code is derived, directly or indirectly, from the SystemC 00004 source code Copyright (c) 1996-2014 by all Contributors. 00005 All Rights reserved. 00006 00007 The contents of this file are subject to the restrictions and limitations 00008 set forth in the SystemC Open Source License (the "License"); 00009 You may not use this file except in compliance with such restrictions and 00010 limitations. You may obtain instructions on how to receive a copy of the 00011 License at http://www.accellera.org/. Software distributed by Contributors 00012 under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 00013 ANY KIND, either express or implied. See the License for the specific 00014 language governing rights and limitations under the License. 00015 00016 *****************************************************************************/ 00017 00018 /***************************************************************************** 00019 00020 sc_reset.h -- Process reset support. 00021 00022 Original Author: Andy Goodrich, Forte Design Systems, 17 June 2003 00023 00024 CHANGE LOG AT THE END OF THE FILE 00025 *****************************************************************************/ 00026 00027 #if !defined(sc_reset_h_INCLUDED) 00028 #define sc_reset_h_INCLUDED 00029 00030 #include "sysc/communication/sc_writer_policy.h" 00031 00032 namespace sc_core { 00033 00034 // FORWARD CLASS REFERENCES: 00035 00036 template<typename DATA> class sc_signal_in_if; 00037 template<typename IF, sc_writer_policy POL> class sc_signal; 00038 template<typename DATA> class sc_in; 00039 template<typename DATA> class sc_inout; 00040 template<typename DATA> class sc_out; 00041 template<typename SOURCE> class sc_spawn_reset; 00042 class sc_reset; 00043 class sc_process_b; 00044 00045 //============================================================================== 00046 // CLASS sc_reset_target - RESET ENTRY FOR AN sc_process_b TARGET 00047 // 00048 // This class describes a reset condition associated with an sc_process_b 00049 // instance. 00050 //============================================================================== 00051 class sc_reset_target { 00052 public: 00053 bool m_async; // true asynchronous reset, false synchronous. 00054 bool m_level; // level for reset. 00055 sc_process_b* m_process_p; // process this reset entry is for. 00056 }; 00057 00058 inline std::ostream& operator << ( std::ostream& os, 00059 const sc_reset_target& target ) 00060 { 00061 os << "["; 00062 os << target.m_async << ","; 00063 os << target.m_level << ","; 00064 os << target.m_process_p << ","; 00065 return os; 00066 } 00067 00068 //============================================================================== 00069 // CLASS sc_reset - RESET INFORMATION FOR A RESET SIGNAL 00070 // 00071 // See the top of sc_reset.cpp for an explaination of how the reset mechanism 00072 // is implemented. 00073 //============================================================================== 00074 class sc_reset { 00075 friend class sc_cthread_process; 00076 friend class sc_method_process; 00077 friend class sc_module; 00078 friend class sc_channel; // 04/07/2015 GL: a new sc_channel class is derived from sc_module 00079 friend class sc_process_b; 00080 friend class sc_signal<bool, SC_ONE_WRITER>; 00081 friend class sc_signal<bool, SC_MANY_WRITERS>; 00082 friend class sc_signal<bool, SC_UNCHECKED_WRITERS>; 00083 friend class sc_simcontext; 00084 template<typename SOURCE> friend class sc_spawn_reset; 00085 friend class sc_thread_process; 00086 00087 protected: 00088 static void reconcile_resets(); 00089 static void 00090 reset_signal_is(bool async, const sc_signal_in_if<bool>& iface, 00091 bool level); 00092 static void 00093 reset_signal_is( bool async, const sc_in<bool>& iface, bool level); 00094 static void 00095 reset_signal_is( bool async, const sc_inout<bool>& iface, bool level); 00096 static void 00097 reset_signal_is( bool async, const sc_out<bool>& iface, bool level); 00098 00099 protected: 00100 sc_reset( const sc_signal_in_if<bool>* iface_p ) : 00101 m_iface_p(iface_p), m_targets() {} 00102 void notify_processes(); 00103 void remove_process( sc_process_b* ); 00104 00105 protected: 00106 const sc_signal_in_if<bool>* m_iface_p; // Interface to read. 00107 std::vector<sc_reset_target> m_targets; // List of processes to reset. 00108 00109 private: // disabled 00110 sc_reset( const sc_reset& ); 00111 const sc_reset& operator = ( const sc_reset& ); 00112 }; 00113 00114 // $Log: sc_reset.h,v $ 00115 // Revision 1.11 2011/08/26 20:46:10 acg 00116 // Andy Goodrich: moved the modification log to the end of the file to 00117 // eliminate source line number skew when check-ins are done. 00118 // 00119 // Revision 1.10 2011/08/24 22:05:51 acg 00120 // Torsten Maehne: initialization changes to remove warnings. 00121 // 00122 // Revision 1.9 2011/04/08 22:38:30 acg 00123 // Andy Goodrich: added comment pointing to the description of how the 00124 // reset mechanism works that is in sc_reset.cpp. 00125 // 00126 // Revision 1.8 2011/02/18 20:27:14 acg 00127 // Andy Goodrich: Updated Copyrights. 00128 // 00129 // Revision 1.7 2011/02/13 21:47:37 acg 00130 // Andy Goodrich: update copyright notice. 00131 // 00132 // Revision 1.6 2011/01/06 18:00:32 acg 00133 // Andy Goodrich: Removed commented out code. 00134 // 00135 // Revision 1.5 2010/12/07 20:09:14 acg 00136 // Andy Goodrich: removed sc_signal signatures since already have sc_signal_in_if signatures. 00137 // 00138 // Revision 1.4 2010/11/20 17:10:57 acg 00139 // Andy Goodrich: reset processing changes for new IEEE 1666 standard. 00140 // 00141 // Revision 1.3 2009/05/22 16:06:29 acg 00142 // Andy Goodrich: process control updates. 00143 // 00144 // Revision 1.2 2008/05/22 17:06:26 acg 00145 // Andy Goodrich: updated copyright notice to include 2008. 00146 // 00147 // Revision 1.1.1.1 2006/12/15 20:20:05 acg 00148 // SystemC 2.3 00149 // 00150 // Revision 1.6 2006/12/02 20:58:19 acg 00151 // Andy Goodrich: updates from 2.2 for IEEE 1666 support. 00152 // 00153 // Revision 1.4 2006/04/11 23:13:21 acg 00154 // Andy Goodrich: Changes for reduced reset support that only includes 00155 // sc_cthread, but has preliminary hooks for expanding to method and thread 00156 // processes also. 00157 // 00158 // Revision 1.3 2006/01/13 18:44:30 acg 00159 // Added $Log to record CVS changes into the source. 00160 00161 } // namespace sc_core 00162 00163 #endif // !defined(sc_reset_h_INCLUDED)