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_event_finder.cpp --
2312027Sjungma@eit.uni-kl.de
2412027Sjungma@eit.uni-kl.de  Original Author: Martin Janssen, Synopsys, Inc.
2512027Sjungma@eit.uni-kl.de                   Stan Y. Liao, Synopsys, Inc., 2001-05-21
2612027Sjungma@eit.uni-kl.de
2712027Sjungma@eit.uni-kl.de  CHANGE LOG IS AT THE END OF THE FILE
2812027Sjungma@eit.uni-kl.de *****************************************************************************/
2912027Sjungma@eit.uni-kl.de
3012027Sjungma@eit.uni-kl.de#include "sysc/communication/sc_event_finder.h"
3112027Sjungma@eit.uni-kl.de
3212027Sjungma@eit.uni-kl.denamespace sc_core {
3312027Sjungma@eit.uni-kl.de
3412027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
3512027Sjungma@eit.uni-kl.de//  CLASS : sc_event_finder
3612027Sjungma@eit.uni-kl.de//
3712027Sjungma@eit.uni-kl.de//  Event finder base class.
3812027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
3912027Sjungma@eit.uni-kl.de
4012027Sjungma@eit.uni-kl.de// error reporting
4112027Sjungma@eit.uni-kl.de
4212027Sjungma@eit.uni-kl.devoid
4312027Sjungma@eit.uni-kl.desc_event_finder::report_error( const char* id, const char* add_msg ) const
4412027Sjungma@eit.uni-kl.de{
4512027Sjungma@eit.uni-kl.de    char msg[BUFSIZ];
4612027Sjungma@eit.uni-kl.de    if( add_msg != 0 ) {
4712027Sjungma@eit.uni-kl.de	std::sprintf( msg, "%s: port '%s' (%s)",
4812027Sjungma@eit.uni-kl.de		 add_msg, m_port.name(), m_port.kind() );
4912027Sjungma@eit.uni-kl.de    } else {
5012027Sjungma@eit.uni-kl.de	std::sprintf( msg, "port '%s' (%s)", m_port.name(), m_port.kind() );
5112027Sjungma@eit.uni-kl.de    }
5212027Sjungma@eit.uni-kl.de    SC_REPORT_ERROR( id, msg );
5312027Sjungma@eit.uni-kl.de}
5412027Sjungma@eit.uni-kl.de
5512027Sjungma@eit.uni-kl.de
5612027Sjungma@eit.uni-kl.de// constructor
5712027Sjungma@eit.uni-kl.de
5812027Sjungma@eit.uni-kl.desc_event_finder::sc_event_finder( const sc_port_base& port_ )
5912027Sjungma@eit.uni-kl.de: m_port( port_ )
6012027Sjungma@eit.uni-kl.de{
6112027Sjungma@eit.uni-kl.de}
6212027Sjungma@eit.uni-kl.de
6312027Sjungma@eit.uni-kl.de
6412027Sjungma@eit.uni-kl.de// destructor (does nothing)
6512027Sjungma@eit.uni-kl.de
6612027Sjungma@eit.uni-kl.desc_event_finder::~sc_event_finder()
6712027Sjungma@eit.uni-kl.de{}
6812027Sjungma@eit.uni-kl.de
6912027Sjungma@eit.uni-kl.de} // namespace sc_core
7012027Sjungma@eit.uni-kl.de
7112027Sjungma@eit.uni-kl.de// $Log: sc_event_finder.cpp,v $
7212027Sjungma@eit.uni-kl.de// Revision 1.3  2011/08/26 20:45:39  acg
7312027Sjungma@eit.uni-kl.de//  Andy Goodrich: moved the modification log to the end of the file to
7412027Sjungma@eit.uni-kl.de//  eliminate source line number skew when check-ins are done.
7512027Sjungma@eit.uni-kl.de//
7612027Sjungma@eit.uni-kl.de// Revision 1.2  2011/02/18 20:23:45  acg
7712027Sjungma@eit.uni-kl.de//  Andy Goodrich: Copyright update.
7812027Sjungma@eit.uni-kl.de//
7912027Sjungma@eit.uni-kl.de// Revision 1.1.1.1  2006/12/15 20:20:04  acg
8012027Sjungma@eit.uni-kl.de// SystemC 2.3
8112027Sjungma@eit.uni-kl.de//
8212027Sjungma@eit.uni-kl.de// Revision 1.7  2006/02/02 23:42:37  acg
8312027Sjungma@eit.uni-kl.de//  Andy Goodrich: implemented a much better fix to the sc_event_finder
8412027Sjungma@eit.uni-kl.de//  proliferation problem. This new version allocates only a single event
8512027Sjungma@eit.uni-kl.de//  finder for each port for each type of event, e.g., pos(), neg(), and
8612027Sjungma@eit.uni-kl.de//  value_change(). The event finder persists as long as the port does,
8712027Sjungma@eit.uni-kl.de//  which is what the LRM dictates. Because only a single instance is
8812027Sjungma@eit.uni-kl.de//  allocated for each event type per port there is not a potential
8912027Sjungma@eit.uni-kl.de//  explosion of storage as was true in the 2.0.1/2.1 versions.
9012027Sjungma@eit.uni-kl.de//
9112027Sjungma@eit.uni-kl.de// Revision 1.6  2006/02/02 21:26:34  acg
9212027Sjungma@eit.uni-kl.de//  Andy Goodrich: pulled out the check I just stuck into the
9312027Sjungma@eit.uni-kl.de//  sc_event_finder::free_instances() method. It turns out the LRM says that
9412027Sjungma@eit.uni-kl.de//  sc_event_finder instances are valid as long as the sc_module hierarchy is
9512027Sjungma@eit.uni-kl.de//  valid, so we can't give the user a call to free the instances.
9612027Sjungma@eit.uni-kl.de//
9712027Sjungma@eit.uni-kl.de// Revision 1.5  2006/02/02 21:10:52  acg
9812027Sjungma@eit.uni-kl.de//  Andy Goodrich: added check for end of elaboration to the static method
9912027Sjungma@eit.uni-kl.de//  sc_event_finder::free_instances(). This will allow the method to be
10012027Sjungma@eit.uni-kl.de//  made public if that is desired.
10112027Sjungma@eit.uni-kl.de//
10212027Sjungma@eit.uni-kl.de// Revision 1.4  2006/02/02 20:43:09  acg
10312027Sjungma@eit.uni-kl.de//  Andy Goodrich: Added an existence linked list to sc_event_finder so that
10412027Sjungma@eit.uni-kl.de//  the dynamically allocated instances can be freed after port binding
10512027Sjungma@eit.uni-kl.de//  completes. This replaces the individual deletions in ~sc_bind_ef, as these
10612027Sjungma@eit.uni-kl.de//  caused an exception if an sc_event_finder instance was used more than
10712027Sjungma@eit.uni-kl.de//  once, due to a double freeing of the instance.
10812027Sjungma@eit.uni-kl.de//
10912027Sjungma@eit.uni-kl.de// Revision 1.3  2006/01/13 18:47:41  acg
11012027Sjungma@eit.uni-kl.de// Added $Log command so that CVS comments are reproduced in the source.
11112027Sjungma@eit.uni-kl.de//
11212027Sjungma@eit.uni-kl.de
11312027Sjungma@eit.uni-kl.de// Taf!
114