112027Sjungma@eit.uni-kl.de/*****************************************************************************
212027Sjungma@eit.uni-kl.de
312027Sjungma@eit.uni-kl.de  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412027Sjungma@eit.uni-kl.de  more contributor license agreements.  See the NOTICE file distributed
512027Sjungma@eit.uni-kl.de  with this work for additional information regarding copyright ownership.
612027Sjungma@eit.uni-kl.de  Accellera licenses this file to you under the Apache License, Version 2.0
712027Sjungma@eit.uni-kl.de  (the "License"); you may not use this file except in compliance with the
812027Sjungma@eit.uni-kl.de  License.  You may obtain a copy of the License at
912027Sjungma@eit.uni-kl.de
1012027Sjungma@eit.uni-kl.de    http://www.apache.org/licenses/LICENSE-2.0
1112027Sjungma@eit.uni-kl.de
1212027Sjungma@eit.uni-kl.de  Unless required by applicable law or agreed to in writing, software
1312027Sjungma@eit.uni-kl.de  distributed under the License is distributed on an "AS IS" BASIS,
1412027Sjungma@eit.uni-kl.de  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512027Sjungma@eit.uni-kl.de  implied.  See the License for the specific language governing
1612027Sjungma@eit.uni-kl.de  permissions and limitations under the License.
1712027Sjungma@eit.uni-kl.de
1812027Sjungma@eit.uni-kl.de *****************************************************************************/
1912027Sjungma@eit.uni-kl.de
2012027Sjungma@eit.uni-kl.de/*****************************************************************************
2112027Sjungma@eit.uni-kl.de
2212027Sjungma@eit.uni-kl.de  sc_reset.h -- Process reset support.
2312027Sjungma@eit.uni-kl.de
2412027Sjungma@eit.uni-kl.de  Original Author: Andy Goodrich, Forte Design Systems, 17 June 2003
2512027Sjungma@eit.uni-kl.de
2612027Sjungma@eit.uni-kl.de  CHANGE LOG AT THE END OF THE FILE
2712027Sjungma@eit.uni-kl.de *****************************************************************************/
2812027Sjungma@eit.uni-kl.de
2912027Sjungma@eit.uni-kl.de#if !defined(sc_reset_h_INCLUDED)
3012027Sjungma@eit.uni-kl.de#define sc_reset_h_INCLUDED
3112027Sjungma@eit.uni-kl.de
3212027Sjungma@eit.uni-kl.de#include "sysc/communication/sc_writer_policy.h"
3312027Sjungma@eit.uni-kl.de
3412027Sjungma@eit.uni-kl.denamespace sc_core {
3512027Sjungma@eit.uni-kl.de
3612027Sjungma@eit.uni-kl.de// FORWARD CLASS REFERENCES:
3712027Sjungma@eit.uni-kl.de
3812027Sjungma@eit.uni-kl.detemplate<typename DATA> class sc_signal_in_if;
3912027Sjungma@eit.uni-kl.detemplate<typename IF, sc_writer_policy POL> class sc_signal;
4012027Sjungma@eit.uni-kl.detemplate<typename DATA> class sc_in;
4112027Sjungma@eit.uni-kl.detemplate<typename DATA> class sc_inout;
4212027Sjungma@eit.uni-kl.detemplate<typename DATA> class sc_out;
4312027Sjungma@eit.uni-kl.detemplate<typename SOURCE> class sc_spawn_reset;
4412027Sjungma@eit.uni-kl.declass sc_reset;
4512027Sjungma@eit.uni-kl.declass sc_process_b;
4612027Sjungma@eit.uni-kl.de
4712027Sjungma@eit.uni-kl.de//==============================================================================
4812027Sjungma@eit.uni-kl.de// CLASS sc_reset_target - RESET ENTRY FOR AN sc_process_b TARGET
4912027Sjungma@eit.uni-kl.de//
5012027Sjungma@eit.uni-kl.de// This class describes a reset condition associated with an sc_process_b
5112027Sjungma@eit.uni-kl.de// instance.
5212027Sjungma@eit.uni-kl.de//==============================================================================
5312027Sjungma@eit.uni-kl.declass sc_reset_target {
5412027Sjungma@eit.uni-kl.de  public:
5512027Sjungma@eit.uni-kl.de    bool          m_async;     // true asynchronous reset, false synchronous.
5612027Sjungma@eit.uni-kl.de    bool          m_level;     // level for reset.
5712027Sjungma@eit.uni-kl.de    sc_process_b* m_process_p; // process this reset entry is for.
5812027Sjungma@eit.uni-kl.de};
5912027Sjungma@eit.uni-kl.de
6012027Sjungma@eit.uni-kl.deinline std::ostream& operator << ( std::ostream& os,
6112027Sjungma@eit.uni-kl.de                                   const sc_reset_target& target )
6212027Sjungma@eit.uni-kl.de{
6312027Sjungma@eit.uni-kl.de    os << "[";
6412027Sjungma@eit.uni-kl.de    os << target.m_async << ",";
6512027Sjungma@eit.uni-kl.de    os << target.m_level << ",";
6612027Sjungma@eit.uni-kl.de    os << target.m_process_p << ",";
6712027Sjungma@eit.uni-kl.de    return os;
6812027Sjungma@eit.uni-kl.de}
6912027Sjungma@eit.uni-kl.de
7012027Sjungma@eit.uni-kl.de//==============================================================================
7112027Sjungma@eit.uni-kl.de// CLASS sc_reset - RESET INFORMATION FOR A RESET SIGNAL
7212027Sjungma@eit.uni-kl.de//
7312027Sjungma@eit.uni-kl.de// See the top of sc_reset.cpp for an explaination of how the reset mechanism
7412027Sjungma@eit.uni-kl.de// is implemented.
7512027Sjungma@eit.uni-kl.de//==============================================================================
7612027Sjungma@eit.uni-kl.declass sc_reset {
7712027Sjungma@eit.uni-kl.de    friend class sc_cthread_process;
7812027Sjungma@eit.uni-kl.de    friend class sc_method_process;
7912027Sjungma@eit.uni-kl.de    friend class sc_module;
8012027Sjungma@eit.uni-kl.de    friend class sc_process_b;
8112027Sjungma@eit.uni-kl.de    friend class sc_signal<bool, SC_ONE_WRITER>;
8212027Sjungma@eit.uni-kl.de    friend class sc_signal<bool, SC_MANY_WRITERS>;
8312027Sjungma@eit.uni-kl.de    friend class sc_signal<bool, SC_UNCHECKED_WRITERS>;
8412027Sjungma@eit.uni-kl.de    friend class sc_simcontext;
8512027Sjungma@eit.uni-kl.de    template<typename SOURCE> friend class sc_spawn_reset;
8612027Sjungma@eit.uni-kl.de    friend class sc_thread_process;
8712027Sjungma@eit.uni-kl.de
8812027Sjungma@eit.uni-kl.de  protected:
8912027Sjungma@eit.uni-kl.de    static void reconcile_resets();
9012027Sjungma@eit.uni-kl.de    static void
9112027Sjungma@eit.uni-kl.de	reset_signal_is(bool async, const sc_signal_in_if<bool>& iface,
9212027Sjungma@eit.uni-kl.de	                bool level);
9312027Sjungma@eit.uni-kl.de    static void
9412027Sjungma@eit.uni-kl.de	reset_signal_is( bool async, const sc_in<bool>& iface, bool level);
9512027Sjungma@eit.uni-kl.de    static void
9612027Sjungma@eit.uni-kl.de	reset_signal_is( bool async, const sc_inout<bool>& iface, bool level);
9712027Sjungma@eit.uni-kl.de    static void
9812027Sjungma@eit.uni-kl.de	reset_signal_is( bool async, const sc_out<bool>& iface, bool level);
9912027Sjungma@eit.uni-kl.de
10012027Sjungma@eit.uni-kl.de  protected:
10112027Sjungma@eit.uni-kl.de    sc_reset( const sc_signal_in_if<bool>* iface_p ) :
10212027Sjungma@eit.uni-kl.de        m_iface_p(iface_p), m_targets() {}
10312027Sjungma@eit.uni-kl.de    void notify_processes();
10412027Sjungma@eit.uni-kl.de    void remove_process( sc_process_b* );
10512027Sjungma@eit.uni-kl.de
10612027Sjungma@eit.uni-kl.de  protected:
10712027Sjungma@eit.uni-kl.de    const sc_signal_in_if<bool>*  m_iface_p;  // Interface to read.
10812027Sjungma@eit.uni-kl.de    std::vector<sc_reset_target>  m_targets;  // List of processes to reset.
10912027Sjungma@eit.uni-kl.de
11012027Sjungma@eit.uni-kl.de  private: // disabled
11112027Sjungma@eit.uni-kl.de    sc_reset( const sc_reset& );
11212027Sjungma@eit.uni-kl.de    const sc_reset& operator = ( const sc_reset& );
11312027Sjungma@eit.uni-kl.de};
11412027Sjungma@eit.uni-kl.de
11512027Sjungma@eit.uni-kl.de// $Log: sc_reset.h,v $
11612027Sjungma@eit.uni-kl.de// Revision 1.11  2011/08/26 20:46:10  acg
11712027Sjungma@eit.uni-kl.de//  Andy Goodrich: moved the modification log to the end of the file to
11812027Sjungma@eit.uni-kl.de//  eliminate source line number skew when check-ins are done.
11912027Sjungma@eit.uni-kl.de//
12012027Sjungma@eit.uni-kl.de// Revision 1.10  2011/08/24 22:05:51  acg
12112027Sjungma@eit.uni-kl.de//  Torsten Maehne: initialization changes to remove warnings.
12212027Sjungma@eit.uni-kl.de//
12312027Sjungma@eit.uni-kl.de// Revision 1.9  2011/04/08 22:38:30  acg
12412027Sjungma@eit.uni-kl.de//  Andy Goodrich: added comment pointing to the description of how the
12512027Sjungma@eit.uni-kl.de//  reset mechanism works that is in sc_reset.cpp.
12612027Sjungma@eit.uni-kl.de//
12712027Sjungma@eit.uni-kl.de// Revision 1.8  2011/02/18 20:27:14  acg
12812027Sjungma@eit.uni-kl.de//  Andy Goodrich: Updated Copyrights.
12912027Sjungma@eit.uni-kl.de//
13012027Sjungma@eit.uni-kl.de// Revision 1.7  2011/02/13 21:47:37  acg
13112027Sjungma@eit.uni-kl.de//  Andy Goodrich: update copyright notice.
13212027Sjungma@eit.uni-kl.de//
13312027Sjungma@eit.uni-kl.de// Revision 1.6  2011/01/06 18:00:32  acg
13412027Sjungma@eit.uni-kl.de//  Andy Goodrich: Removed commented out code.
13512027Sjungma@eit.uni-kl.de//
13612027Sjungma@eit.uni-kl.de// Revision 1.5  2010/12/07 20:09:14  acg
13712027Sjungma@eit.uni-kl.de// Andy Goodrich: removed sc_signal signatures since already have sc_signal_in_if signatures.
13812027Sjungma@eit.uni-kl.de//
13912027Sjungma@eit.uni-kl.de// Revision 1.4  2010/11/20 17:10:57  acg
14012027Sjungma@eit.uni-kl.de//  Andy Goodrich: reset processing changes for new IEEE 1666 standard.
14112027Sjungma@eit.uni-kl.de//
14212027Sjungma@eit.uni-kl.de// Revision 1.3  2009/05/22 16:06:29  acg
14312027Sjungma@eit.uni-kl.de//  Andy Goodrich: process control updates.
14412027Sjungma@eit.uni-kl.de//
14512027Sjungma@eit.uni-kl.de// Revision 1.2  2008/05/22 17:06:26  acg
14612027Sjungma@eit.uni-kl.de//  Andy Goodrich: updated copyright notice to include 2008.
14712027Sjungma@eit.uni-kl.de//
14812027Sjungma@eit.uni-kl.de// Revision 1.1.1.1  2006/12/15 20:20:05  acg
14912027Sjungma@eit.uni-kl.de// SystemC 2.3
15012027Sjungma@eit.uni-kl.de//
15112027Sjungma@eit.uni-kl.de// Revision 1.6  2006/12/02 20:58:19  acg
15212027Sjungma@eit.uni-kl.de//  Andy Goodrich: updates from 2.2 for IEEE 1666 support.
15312027Sjungma@eit.uni-kl.de//
15412027Sjungma@eit.uni-kl.de// Revision 1.4  2006/04/11 23:13:21  acg
15512027Sjungma@eit.uni-kl.de//   Andy Goodrich: Changes for reduced reset support that only includes
15612027Sjungma@eit.uni-kl.de//   sc_cthread, but has preliminary hooks for expanding to method and thread
15712027Sjungma@eit.uni-kl.de//   processes also.
15812027Sjungma@eit.uni-kl.de//
15912027Sjungma@eit.uni-kl.de// Revision 1.3  2006/01/13 18:44:30  acg
16012027Sjungma@eit.uni-kl.de// Added $Log to record CVS changes into the source.
16112027Sjungma@eit.uni-kl.de
16212027Sjungma@eit.uni-kl.de} // namespace sc_core
16312027Sjungma@eit.uni-kl.de
16412027Sjungma@eit.uni-kl.de#endif // !defined(sc_reset_h_INCLUDED)
165