sc_event_finder.cpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003   The following code is derived, directly or indirectly, from the SystemC
00004   source code Copyright (c) 1996-2006 by all Contributors.
00005   All Rights reserved.
00006 
00007   The contents of this file are subject to the restrictions and limitations
00008   set forth in the SystemC Open Source License Version 2.4 (the "License");
00009   You may not use this file except in compliance with such restrictions and
00010   limitations. You may obtain instructions on how to receive a copy of the
00011   License at http://www.systemc.org/. Software distributed by Contributors
00012   under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
00013   ANY KIND, either express or implied. See the License for the specific
00014   language governing rights and limitations under the License.
00015 
00016  *****************************************************************************/
00017 
00018 /*****************************************************************************
00019 
00020   sc_event_finder.cpp --
00021 
00022   Original Author: Martin Janssen, Synopsys, Inc.
00023                    Stan Y. Liao, Synopsys, Inc., 2001-05-21
00024 
00025  *****************************************************************************/
00026 
00027 /*****************************************************************************
00028 
00029   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00030   changes you are making here.
00031 
00032       Name, Affiliation, Date:
00033   Description of Modification:
00034     
00035  *****************************************************************************/
00036 
00037 
00038 // $Log: sc_event_finder.cpp,v $
00039 // Revision 1.1.1.1  2006/12/15 20:31:35  acg
00040 // SystemC 2.2
00041 //
00042 // Revision 1.7  2006/02/02 23:42:37  acg
00043 //  Andy Goodrich: implemented a much better fix to the sc_event_finder
00044 //  proliferation problem. This new version allocates only a single event
00045 //  finder for each port for each type of event, e.g., pos(), neg(), and
00046 //  value_change(). The event finder persists as long as the port does,
00047 //  which is what the LRM dictates. Because only a single instance is
00048 //  allocated for each event type per port there is not a potential
00049 //  explosion of storage as was true in the 2.0.1/2.1 versions.
00050 //
00051 // Revision 1.6  2006/02/02 21:26:34  acg
00052 //  Andy Goodrich: pulled out the check I just stuck into the
00053 //  sc_event_finder::free_instances() method. It turns out the LRM says that
00054 //  sc_event_finder instances are valid as long as the sc_module hierarchy is
00055 //  valid, so we can't give the user a call to free the instances.
00056 //
00057 // Revision 1.5  2006/02/02 21:10:52  acg
00058 //  Andy Goodrich: added check for end of elaboration to the static method
00059 //  sc_event_finder::free_instances(). This will allow the method to be
00060 //  made public if that is desired.
00061 //
00062 // Revision 1.4  2006/02/02 20:43:09  acg
00063 //  Andy Goodrich: Added an existence linked list to sc_event_finder so that
00064 //  the dynamically allocated instances can be freed after port binding
00065 //  completes. This replaces the individual deletions in ~sc_bind_ef, as these
00066 //  caused an exception if an sc_event_finder instance was used more than
00067 //  once, due to a double freeing of the instance.
00068 //
00069 // Revision 1.3  2006/01/13 18:47:41  acg
00070 // Added $Log command so that CVS comments are reproduced in the source.
00071 //
00072 
00073 #include "sysc/communication/sc_event_finder.h"
00074 
00075 namespace sc_core {
00076 
00077 // ----------------------------------------------------------------------------
00078 //  CLASS : sc_event_finder
00079 //
00080 //  Event finder base class.
00081 // ----------------------------------------------------------------------------
00082 
00083 // error reporting
00084 
00085 void
00086 sc_event_finder::report_error( const char* id, const char* add_msg ) const
00087 {
00088     char msg[BUFSIZ];
00089     if( add_msg != 0 ) {
00090     std::sprintf( msg, "%s: port '%s' (%s)",
00091          add_msg, m_port.name(), m_port.kind() );
00092     } else {
00093     std::sprintf( msg, "port '%s' (%s)", m_port.name(), m_port.kind() );
00094     }
00095     SC_REPORT_ERROR( id, msg );
00096 }
00097 
00098 
00099 // constructor
00100 
00101 sc_event_finder::sc_event_finder( const sc_port_base& port_ )
00102 : m_port( port_ )
00103 {
00104 }
00105 
00106 
00107 // destructor (does nothing)
00108 
00109 sc_event_finder::~sc_event_finder()
00110 {}
00111 
00112 } // namespace sc_core
00113 
00114 // Taf!

Generated on Wed Jan 21 15:32:06 2009 for SystemC by  doxygen 1.5.5