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_reset.h -- Process reset support. 23 24 Original Author: Andy Goodrich, Forte Design Systems, 17 June 2003 25 26 CHANGE LOG AT THE END OF THE FILE 27 *****************************************************************************/ 28 29#if !defined(sc_reset_h_INCLUDED) 30#define sc_reset_h_INCLUDED 31 32#include "sysc/communication/sc_writer_policy.h" 33 34namespace sc_core { 35 36// FORWARD CLASS REFERENCES: 37 38template<typename DATA> class sc_signal_in_if; 39template<typename IF, sc_writer_policy POL> class sc_signal; 40template<typename DATA> class sc_in; 41template<typename DATA> class sc_inout; 42template<typename DATA> class sc_out; 43template<typename SOURCE> class sc_spawn_reset; 44class sc_reset; 45class sc_process_b; 46 47//============================================================================== 48// CLASS sc_reset_target - RESET ENTRY FOR AN sc_process_b TARGET 49// 50// This class describes a reset condition associated with an sc_process_b 51// instance. 52//============================================================================== 53class sc_reset_target { 54 public: 55 bool m_async; // true asynchronous reset, false synchronous. 56 bool m_level; // level for reset. 57 sc_process_b* m_process_p; // process this reset entry is for. 58}; 59 60inline std::ostream& operator << ( std::ostream& os, 61 const sc_reset_target& target ) 62{ 63 os << "["; 64 os << target.m_async << ","; 65 os << target.m_level << ","; 66 os << target.m_process_p << ","; 67 return os; 68} 69 70//============================================================================== 71// CLASS sc_reset - RESET INFORMATION FOR A RESET SIGNAL 72// 73// See the top of sc_reset.cpp for an explaination of how the reset mechanism 74// is implemented. 75//============================================================================== 76class sc_reset { 77 friend class sc_cthread_process; 78 friend class sc_method_process; 79 friend class sc_module; 80 friend class sc_process_b; 81 friend class sc_signal<bool, SC_ONE_WRITER>; 82 friend class sc_signal<bool, SC_MANY_WRITERS>; 83 friend class sc_signal<bool, SC_UNCHECKED_WRITERS>; 84 friend class sc_simcontext; 85 template<typename SOURCE> friend class sc_spawn_reset; 86 friend class sc_thread_process; 87 88 protected: 89 static void reconcile_resets(); 90 static void 91 reset_signal_is(bool async, const sc_signal_in_if<bool>& iface, 92 bool level); 93 static void 94 reset_signal_is( bool async, const sc_in<bool>& iface, bool level); 95 static void 96 reset_signal_is( bool async, const sc_inout<bool>& iface, bool level); 97 static void 98 reset_signal_is( bool async, const sc_out<bool>& iface, bool level); 99 100 protected: 101 sc_reset( const sc_signal_in_if<bool>* iface_p ) : 102 m_iface_p(iface_p), m_targets() {} 103 void notify_processes(); 104 void remove_process( sc_process_b* ); 105 106 protected: 107 const sc_signal_in_if<bool>* m_iface_p; // Interface to read. 108 std::vector<sc_reset_target> m_targets; // List of processes to reset. 109 110 private: // disabled 111 sc_reset( const sc_reset& ); 112 const sc_reset& operator = ( const sc_reset& ); 113}; 114 115// $Log: sc_reset.h,v $ 116// Revision 1.11 2011/08/26 20:46:10 acg 117// Andy Goodrich: moved the modification log to the end of the file to 118// eliminate source line number skew when check-ins are done. 119// 120// Revision 1.10 2011/08/24 22:05:51 acg 121// Torsten Maehne: initialization changes to remove warnings. 122// 123// Revision 1.9 2011/04/08 22:38:30 acg 124// Andy Goodrich: added comment pointing to the description of how the 125// reset mechanism works that is in sc_reset.cpp. 126// 127// Revision 1.8 2011/02/18 20:27:14 acg 128// Andy Goodrich: Updated Copyrights. 129// 130// Revision 1.7 2011/02/13 21:47:37 acg 131// Andy Goodrich: update copyright notice. 132// 133// Revision 1.6 2011/01/06 18:00:32 acg 134// Andy Goodrich: Removed commented out code. 135// 136// Revision 1.5 2010/12/07 20:09:14 acg 137// Andy Goodrich: removed sc_signal signatures since already have sc_signal_in_if signatures. 138// 139// Revision 1.4 2010/11/20 17:10:57 acg 140// Andy Goodrich: reset processing changes for new IEEE 1666 standard. 141// 142// Revision 1.3 2009/05/22 16:06:29 acg 143// Andy Goodrich: process control updates. 144// 145// Revision 1.2 2008/05/22 17:06:26 acg 146// Andy Goodrich: updated copyright notice to include 2008. 147// 148// Revision 1.1.1.1 2006/12/15 20:20:05 acg 149// SystemC 2.3 150// 151// Revision 1.6 2006/12/02 20:58:19 acg 152// Andy Goodrich: updates from 2.2 for IEEE 1666 support. 153// 154// Revision 1.4 2006/04/11 23:13:21 acg 155// Andy Goodrich: Changes for reduced reset support that only includes 156// sc_cthread, but has preliminary hooks for expanding to method and thread 157// processes also. 158// 159// Revision 1.3 2006/01/13 18:44:30 acg 160// Added $Log to record CVS changes into the source. 161 162} // namespace sc_core 163 164#endif // !defined(sc_reset_h_INCLUDED) 165