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