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_except.h - Exception classes to be handled by SystemC.
2312027Sjungma@eit.uni-kl.de
2412027Sjungma@eit.uni-kl.de  Original Author: Stan Y. Liao, Synopsys, Inc.
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
3012027Sjungma@eit.uni-kl.de#ifndef SC_EXCEPT_H
3112027Sjungma@eit.uni-kl.de#define SC_EXCEPT_H
3212027Sjungma@eit.uni-kl.de
3312027Sjungma@eit.uni-kl.de#include <exception>
3412027Sjungma@eit.uni-kl.de
3512027Sjungma@eit.uni-kl.denamespace sc_core {
3612027Sjungma@eit.uni-kl.de
3712027Sjungma@eit.uni-kl.declass sc_simcontext;
3812027Sjungma@eit.uni-kl.declass sc_process_b;
3912027Sjungma@eit.uni-kl.declass sc_method_process;
4012027Sjungma@eit.uni-kl.declass sc_thread_process;
4112027Sjungma@eit.uni-kl.devoid sc_thread_cor_fn( void* arg );
4212027Sjungma@eit.uni-kl.de
4312027Sjungma@eit.uni-kl.de/*
4412027Sjungma@eit.uni-kl.de *  These classes are intentionally empty. Their raison d'etre is for
4512027Sjungma@eit.uni-kl.de *  the implementation of various SystemC throws.
4612027Sjungma@eit.uni-kl.de */
4712027Sjungma@eit.uni-kl.de
4812027Sjungma@eit.uni-kl.declass sc_user
4912027Sjungma@eit.uni-kl.de{
5012027Sjungma@eit.uni-kl.de    /*EMPTY*/
5112027Sjungma@eit.uni-kl.depublic:
5212027Sjungma@eit.uni-kl.de    sc_user() {}
5312027Sjungma@eit.uni-kl.de    sc_user( const sc_user& ) {}
5412027Sjungma@eit.uni-kl.de};
5512027Sjungma@eit.uni-kl.de
5612027Sjungma@eit.uni-kl.declass sc_halt
5712027Sjungma@eit.uni-kl.de{
5812027Sjungma@eit.uni-kl.depublic:
5912027Sjungma@eit.uni-kl.de    sc_halt() {}
6012027Sjungma@eit.uni-kl.de    sc_halt( const sc_halt& ) {}
6112027Sjungma@eit.uni-kl.de};
6212027Sjungma@eit.uni-kl.de
6312027Sjungma@eit.uni-kl.declass sc_kill
6412027Sjungma@eit.uni-kl.de{
6512027Sjungma@eit.uni-kl.depublic:
6612027Sjungma@eit.uni-kl.de    sc_kill() {}
6712027Sjungma@eit.uni-kl.de    sc_kill( const sc_kill& ) {}
6812027Sjungma@eit.uni-kl.de};
6912027Sjungma@eit.uni-kl.de
7012027Sjungma@eit.uni-kl.declass sc_unwind_exception : public std::exception
7112027Sjungma@eit.uni-kl.de{
7212027Sjungma@eit.uni-kl.de    friend class sc_simcontext;
7312027Sjungma@eit.uni-kl.de    friend class sc_process_b;
7412027Sjungma@eit.uni-kl.de    friend class sc_method_process;
7512027Sjungma@eit.uni-kl.de    friend class sc_thread_process;
7612027Sjungma@eit.uni-kl.de    friend void sc_thread_cor_fn( void* arg );
7712027Sjungma@eit.uni-kl.de
7812027Sjungma@eit.uni-kl.de  public:
7912027Sjungma@eit.uni-kl.de    virtual bool is_reset() const { return m_is_reset; }
8012027Sjungma@eit.uni-kl.de    virtual const char* what() const throw();
8112027Sjungma@eit.uni-kl.de
8212027Sjungma@eit.uni-kl.de  public:
8312027Sjungma@eit.uni-kl.de
8412027Sjungma@eit.uni-kl.de    // enable catch by value
8512027Sjungma@eit.uni-kl.de    sc_unwind_exception( const sc_unwind_exception& );
8612027Sjungma@eit.uni-kl.de    virtual ~sc_unwind_exception() throw();
8712027Sjungma@eit.uni-kl.de
8812027Sjungma@eit.uni-kl.de  protected:
8912027Sjungma@eit.uni-kl.de    explicit
9012027Sjungma@eit.uni-kl.de    sc_unwind_exception( sc_process_b* target_p, bool is_reset = false );
9112027Sjungma@eit.uni-kl.de
9212027Sjungma@eit.uni-kl.de    bool active() const;
9312027Sjungma@eit.uni-kl.de    void clear()  const;
9412027Sjungma@eit.uni-kl.de
9512027Sjungma@eit.uni-kl.de  private:
9612027Sjungma@eit.uni-kl.de    // disabled
9712027Sjungma@eit.uni-kl.de    sc_unwind_exception& operator=( const sc_unwind_exception& );
9812027Sjungma@eit.uni-kl.de
9912027Sjungma@eit.uni-kl.de    mutable sc_process_b* m_proc_p;   // used to check, if caught by the kernel
10012027Sjungma@eit.uni-kl.de    const   bool          m_is_reset; // true if this is an unwind of a reset
10112027Sjungma@eit.uni-kl.de
10212027Sjungma@eit.uni-kl.de};
10312027Sjungma@eit.uni-kl.de
10412027Sjungma@eit.uni-kl.deinline
10512027Sjungma@eit.uni-kl.desc_unwind_exception::sc_unwind_exception( const sc_unwind_exception& that )
10612027Sjungma@eit.uni-kl.de  : std::exception( that )
10712027Sjungma@eit.uni-kl.de  , m_proc_p( that.m_proc_p )
10812027Sjungma@eit.uni-kl.de  , m_is_reset( that.m_is_reset )
10912027Sjungma@eit.uni-kl.de{
11012027Sjungma@eit.uni-kl.de    that.m_proc_p = 0; // move to new instance
11112027Sjungma@eit.uni-kl.de}
11212027Sjungma@eit.uni-kl.de
11312027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
11412027Sjungma@eit.uni-kl.de// global exception handling
11512027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
11612027Sjungma@eit.uni-kl.de
11712027Sjungma@eit.uni-kl.declass sc_report;
11812027Sjungma@eit.uni-kl.desc_report* sc_handle_exception();
11912027Sjungma@eit.uni-kl.de
12012027Sjungma@eit.uni-kl.de} // namespace sc_core
12112027Sjungma@eit.uni-kl.de
12212027Sjungma@eit.uni-kl.de/*****************************************************************************
12312027Sjungma@eit.uni-kl.de
12412027Sjungma@eit.uni-kl.de  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
12512027Sjungma@eit.uni-kl.de  changes you are making here.
12612027Sjungma@eit.uni-kl.de
12712027Sjungma@eit.uni-kl.de      Name, Affiliation, Date: Gene Bushuyev. Synopsys, Inc.
12812027Sjungma@eit.uni-kl.de  Description of Modification: - Had to add empty public default and copy
12912027Sjungma@eit.uni-kl.de                                 constructors to satisfy VC6.0.
13012027Sjungma@eit.uni-kl.de
13112027Sjungma@eit.uni-kl.de      Name, Affiliation, Date:
13212027Sjungma@eit.uni-kl.de  Description of Modification:
13312027Sjungma@eit.uni-kl.de
13412027Sjungma@eit.uni-kl.de *****************************************************************************/
13512027Sjungma@eit.uni-kl.de
13612027Sjungma@eit.uni-kl.de// $Log: sc_except.h,v $
13712027Sjungma@eit.uni-kl.de// Revision 1.11  2011/08/26 21:40:26  acg
13812027Sjungma@eit.uni-kl.de//  Philipp A. Hartmann: fix up sc_unwind_exception copy-ctor.
13912027Sjungma@eit.uni-kl.de//
14012027Sjungma@eit.uni-kl.de// Revision 1.10  2011/08/26 20:46:09  acg
14112027Sjungma@eit.uni-kl.de//  Andy Goodrich: moved the modification log to the end of the file to
14212027Sjungma@eit.uni-kl.de//  eliminate source line number skew when check-ins are done.
14312027Sjungma@eit.uni-kl.de//
14412027Sjungma@eit.uni-kl.de// Revision 1.9  2011/08/24 22:05:50  acg
14512027Sjungma@eit.uni-kl.de//  Torsten Maehne: initialization changes to remove warnings.
14612027Sjungma@eit.uni-kl.de//
14712027Sjungma@eit.uni-kl.de// Revision 1.8  2011/05/09 04:07:48  acg
14812027Sjungma@eit.uni-kl.de//  Philipp A. Hartmann:
14912027Sjungma@eit.uni-kl.de//    (1) Restore hierarchy in all phase callbacks.
15012027Sjungma@eit.uni-kl.de//    (2) Ensure calls to before_end_of_elaboration.
15112027Sjungma@eit.uni-kl.de//
15212027Sjungma@eit.uni-kl.de// Revision 1.7  2011/02/18 20:27:14  acg
15312027Sjungma@eit.uni-kl.de//  Andy Goodrich: Updated Copyrights.
15412027Sjungma@eit.uni-kl.de//
15512027Sjungma@eit.uni-kl.de// Revision 1.6  2011/02/13 21:47:37  acg
15612027Sjungma@eit.uni-kl.de//  Andy Goodrich: update copyright notice.
15712027Sjungma@eit.uni-kl.de//
15812027Sjungma@eit.uni-kl.de// Revision 1.5  2011/02/11 13:25:24  acg
15912027Sjungma@eit.uni-kl.de//  Andy Goodrich: Philipp A. Hartmann's changes:
16012027Sjungma@eit.uni-kl.de//    (1) Removal of SC_CTHREAD method overloads.
16112027Sjungma@eit.uni-kl.de//    (2) New exception processing code.
16212027Sjungma@eit.uni-kl.de//
16312027Sjungma@eit.uni-kl.de// Revision 1.4  2011/01/18 20:10:44  acg
16412027Sjungma@eit.uni-kl.de//  Andy Goodrich: changes for IEEE1666_2011 semantics.
16512027Sjungma@eit.uni-kl.de//
16612027Sjungma@eit.uni-kl.de// Revision 1.3  2009/05/22 16:06:29  acg
16712027Sjungma@eit.uni-kl.de//  Andy Goodrich: process control updates.
16812027Sjungma@eit.uni-kl.de//
16912027Sjungma@eit.uni-kl.de// Revision 1.2  2008/05/22 17:06:25  acg
17012027Sjungma@eit.uni-kl.de//  Andy Goodrich: updated copyright notice to include 2008.
17112027Sjungma@eit.uni-kl.de//
17212027Sjungma@eit.uni-kl.de// Revision 1.1.1.1  2006/12/15 20:20:05  acg
17312027Sjungma@eit.uni-kl.de// SystemC 2.3
17412027Sjungma@eit.uni-kl.de//
17512027Sjungma@eit.uni-kl.de// Revision 1.3  2006/01/13 18:44:29  acg
17612027Sjungma@eit.uni-kl.de// Added $Log to record CVS changes into the source.
17712027Sjungma@eit.uni-kl.de
17812027Sjungma@eit.uni-kl.de#endif
179