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_module.cpp -- Base class of all sequential and combinational processes.
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#include <cassert>
3112027Sjungma@eit.uni-kl.de#include <math.h>
3212027Sjungma@eit.uni-kl.de#include <stddef.h>
3312027Sjungma@eit.uni-kl.de#include <stdio.h>
3412027Sjungma@eit.uni-kl.de
3512027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_event.h"
3612027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_kernel_ids.h"
3712027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_module.h"
3812027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_module_registry.h"
3912027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_name_gen.h"
4012027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_object_manager.h"
4112027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_process.h"
4212027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_process_handle.h"
4312027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_simcontext.h"
4412027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_simcontext_int.h"
4512027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_object_int.h"
4612027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_reset.h"
4712027Sjungma@eit.uni-kl.de#include "sysc/communication/sc_communication_ids.h"
4812027Sjungma@eit.uni-kl.de#include "sysc/communication/sc_interface.h"
4912027Sjungma@eit.uni-kl.de#include "sysc/communication/sc_port.h"
5012027Sjungma@eit.uni-kl.de#include "sysc/communication/sc_signal.h"
5112027Sjungma@eit.uni-kl.de#include "sysc/communication/sc_signal_ports.h"
5212027Sjungma@eit.uni-kl.de#include "sysc/utils/sc_utils_ids.h"
5312027Sjungma@eit.uni-kl.de#include "sysc/utils/sc_iostream.h"
5412027Sjungma@eit.uni-kl.de
5512027Sjungma@eit.uni-kl.denamespace sc_core {
5612027Sjungma@eit.uni-kl.de
5712027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
5812027Sjungma@eit.uni-kl.de//  CLASS : sc_module_dynalloc_list
5912027Sjungma@eit.uni-kl.de//
6012027Sjungma@eit.uni-kl.de//  Garbage collection for modules dynamically allocated with SC_NEW.
6112027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
6212027Sjungma@eit.uni-kl.de
6312027Sjungma@eit.uni-kl.declass sc_module_dynalloc_list
6412027Sjungma@eit.uni-kl.de{
6512027Sjungma@eit.uni-kl.depublic:
6612027Sjungma@eit.uni-kl.de
6712027Sjungma@eit.uni-kl.de    sc_module_dynalloc_list() : m_list()
6812027Sjungma@eit.uni-kl.de        {}
6912027Sjungma@eit.uni-kl.de
7012027Sjungma@eit.uni-kl.de    ~sc_module_dynalloc_list();
7112027Sjungma@eit.uni-kl.de
7212027Sjungma@eit.uni-kl.de    void add( sc_module* p )
7312027Sjungma@eit.uni-kl.de        { m_list.push_back( p ); }
7412027Sjungma@eit.uni-kl.de
7512027Sjungma@eit.uni-kl.deprivate:
7612027Sjungma@eit.uni-kl.de
7712027Sjungma@eit.uni-kl.de    sc_plist<sc_module*> m_list;
7812027Sjungma@eit.uni-kl.de};
7912027Sjungma@eit.uni-kl.de
8012027Sjungma@eit.uni-kl.de
8112027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
8212027Sjungma@eit.uni-kl.de//"~sc_module_dynalloc_list"
8312027Sjungma@eit.uni-kl.de//
8412027Sjungma@eit.uni-kl.de// Note we clear the m_parent field for the module being deleted. This because
8512027Sjungma@eit.uni-kl.de// we process the list front to back so the parent has already been deleted,
8612027Sjungma@eit.uni-kl.de// and we don't want ~sc_object() to try to access the parent which may
8712027Sjungma@eit.uni-kl.de// contain garbage.
8812027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
8912027Sjungma@eit.uni-kl.desc_module_dynalloc_list::~sc_module_dynalloc_list()
9012027Sjungma@eit.uni-kl.de{
9112027Sjungma@eit.uni-kl.de    sc_plist<sc_module*>::iterator it( m_list );
9212027Sjungma@eit.uni-kl.de    while( ! it.empty() ) {
9312027Sjungma@eit.uni-kl.de        (*it)->m_parent = 0;
9412027Sjungma@eit.uni-kl.de        delete *it;
9512027Sjungma@eit.uni-kl.de        it ++;
9612027Sjungma@eit.uni-kl.de    }
9712027Sjungma@eit.uni-kl.de}
9812027Sjungma@eit.uni-kl.de
9912027Sjungma@eit.uni-kl.de
10012027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
10112027Sjungma@eit.uni-kl.de
10212027Sjungma@eit.uni-kl.desc_module*
10312027Sjungma@eit.uni-kl.desc_module_dynalloc( sc_module* module_ )
10412027Sjungma@eit.uni-kl.de{
10512027Sjungma@eit.uni-kl.de    static sc_module_dynalloc_list dynalloc_list;
10612027Sjungma@eit.uni-kl.de    dynalloc_list.add( module_ );
10712027Sjungma@eit.uni-kl.de    return module_;
10812027Sjungma@eit.uni-kl.de}
10912027Sjungma@eit.uni-kl.de
11012027Sjungma@eit.uni-kl.de
11112027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
11212027Sjungma@eit.uni-kl.de//  STRUCT : sc_bind_proxy
11312027Sjungma@eit.uni-kl.de//
11412027Sjungma@eit.uni-kl.de//  Struct for temporarily storing a pointer to an interface or port.
11512027Sjungma@eit.uni-kl.de//  Used for positional binding.
11612027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
11712027Sjungma@eit.uni-kl.de
11812027Sjungma@eit.uni-kl.desc_bind_proxy::sc_bind_proxy()
11912027Sjungma@eit.uni-kl.de: iface( 0 ),
12012027Sjungma@eit.uni-kl.de  port( 0 )
12112027Sjungma@eit.uni-kl.de{}
12212027Sjungma@eit.uni-kl.de
12312027Sjungma@eit.uni-kl.desc_bind_proxy::sc_bind_proxy( sc_interface& iface_ )
12412027Sjungma@eit.uni-kl.de: iface( &iface_ ),
12512027Sjungma@eit.uni-kl.de  port( 0 )
12612027Sjungma@eit.uni-kl.de{}
12712027Sjungma@eit.uni-kl.de
12812027Sjungma@eit.uni-kl.desc_bind_proxy::sc_bind_proxy( sc_port_base& port_ )
12912027Sjungma@eit.uni-kl.de: iface( 0 ),
13012027Sjungma@eit.uni-kl.de  port( &port_ )
13112027Sjungma@eit.uni-kl.de{}
13212027Sjungma@eit.uni-kl.de
13312027Sjungma@eit.uni-kl.de
13412027Sjungma@eit.uni-kl.deconst sc_bind_proxy SC_BIND_PROXY_NIL;
13512027Sjungma@eit.uni-kl.de
13612027Sjungma@eit.uni-kl.de
13712027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
13812027Sjungma@eit.uni-kl.de//  CLASS : sc_module
13912027Sjungma@eit.uni-kl.de//
14012027Sjungma@eit.uni-kl.de//  Base class for all structural entities.
14112027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
14212027Sjungma@eit.uni-kl.de
14312027Sjungma@eit.uni-kl.devoid
14412027Sjungma@eit.uni-kl.desc_module::sc_module_init()
14512027Sjungma@eit.uni-kl.de{
14612027Sjungma@eit.uni-kl.de    simcontext()->get_module_registry()->insert( *this );
14712027Sjungma@eit.uni-kl.de    simcontext()->hierarchy_push( this );
14812027Sjungma@eit.uni-kl.de    m_end_module_called = false;
14912027Sjungma@eit.uni-kl.de    m_module_name_p = 0;
15012027Sjungma@eit.uni-kl.de    m_port_vec = new std::vector<sc_port_base*>;
15112027Sjungma@eit.uni-kl.de    m_port_index = 0;
15212027Sjungma@eit.uni-kl.de    m_name_gen = new sc_name_gen;
15312027Sjungma@eit.uni-kl.de}
15412027Sjungma@eit.uni-kl.de
15512027Sjungma@eit.uni-kl.de/*
15612027Sjungma@eit.uni-kl.de *  This form of the constructor assumes that the user has
15712027Sjungma@eit.uni-kl.de *  used an sc_module_name parameter for his/her constructor.
15812027Sjungma@eit.uni-kl.de *  That parameter object has been pushed onto the stack,
15912027Sjungma@eit.uni-kl.de *  and can be looked up by calling the
16012027Sjungma@eit.uni-kl.de *  top_of_module_name_stack() function of the object manager.
16112027Sjungma@eit.uni-kl.de *  This technique has two advantages:
16212027Sjungma@eit.uni-kl.de *
16312027Sjungma@eit.uni-kl.de *  1) The user no longer has to write sc_module(name) in the
16412027Sjungma@eit.uni-kl.de *     constructor initializer.
16512027Sjungma@eit.uni-kl.de *  2) The user no longer has to call end_module() at the end
16612027Sjungma@eit.uni-kl.de *     of the constructor -- a common negligence.
16712027Sjungma@eit.uni-kl.de *
16812027Sjungma@eit.uni-kl.de *  But it is important to note that sc_module_name may be used
16912027Sjungma@eit.uni-kl.de *  in the user's constructor's parameter. If it is used anywhere
17012027Sjungma@eit.uni-kl.de *  else, unexpected things will happen. The error-checking
17112027Sjungma@eit.uni-kl.de *  mechanism builtin here cannot hope to catch all misuses.
17212027Sjungma@eit.uni-kl.de *
17312027Sjungma@eit.uni-kl.de */
17412027Sjungma@eit.uni-kl.de
17512027Sjungma@eit.uni-kl.desc_module::sc_module()
17612027Sjungma@eit.uni-kl.de: sc_object(::sc_core::sc_get_curr_simcontext()
17712027Sjungma@eit.uni-kl.de                  ->get_object_manager()
17812027Sjungma@eit.uni-kl.de                  ->top_of_module_name_stack()
17912027Sjungma@eit.uni-kl.de                  ->operator const char*()),
18012027Sjungma@eit.uni-kl.de  sensitive(this),
18112027Sjungma@eit.uni-kl.de  sensitive_pos(this),
18212027Sjungma@eit.uni-kl.de  sensitive_neg(this),
18312027Sjungma@eit.uni-kl.de  m_end_module_called(false),
18412027Sjungma@eit.uni-kl.de  m_port_vec(),
18512027Sjungma@eit.uni-kl.de  m_port_index(0),
18612027Sjungma@eit.uni-kl.de  m_name_gen(0),
18712027Sjungma@eit.uni-kl.de  m_module_name_p(0)
18812027Sjungma@eit.uni-kl.de{
18912027Sjungma@eit.uni-kl.de    /* When this form is used, we better have a fresh sc_module_name
19012027Sjungma@eit.uni-kl.de       on the top of the stack */
19112027Sjungma@eit.uni-kl.de    sc_module_name* mod_name =
19212027Sjungma@eit.uni-kl.de        simcontext()->get_object_manager()->top_of_module_name_stack();
19312027Sjungma@eit.uni-kl.de    if (0 == mod_name || 0 != mod_name->m_module_p)
19412027Sjungma@eit.uni-kl.de        SC_REPORT_ERROR( SC_ID_SC_MODULE_NAME_REQUIRED_, 0 );
19512027Sjungma@eit.uni-kl.de    sc_module_init();
19612027Sjungma@eit.uni-kl.de    mod_name->set_module( this );
19712027Sjungma@eit.uni-kl.de    m_module_name_p = mod_name; // must come after sc_module_init call.
19812027Sjungma@eit.uni-kl.de}
19912027Sjungma@eit.uni-kl.de
20012027Sjungma@eit.uni-kl.desc_module::sc_module( const sc_module_name& )
20112027Sjungma@eit.uni-kl.de: sc_object(::sc_core::sc_get_curr_simcontext()
20212027Sjungma@eit.uni-kl.de                  ->get_object_manager()
20312027Sjungma@eit.uni-kl.de                  ->top_of_module_name_stack()
20412027Sjungma@eit.uni-kl.de                  ->operator const char*()),
20512027Sjungma@eit.uni-kl.de  sensitive(this),
20612027Sjungma@eit.uni-kl.de  sensitive_pos(this),
20712027Sjungma@eit.uni-kl.de  sensitive_neg(this),
20812027Sjungma@eit.uni-kl.de  m_end_module_called(false),
20912027Sjungma@eit.uni-kl.de  m_port_vec(),
21012027Sjungma@eit.uni-kl.de  m_port_index(0),
21112027Sjungma@eit.uni-kl.de  m_name_gen(0),
21212027Sjungma@eit.uni-kl.de  m_module_name_p(0)
21312027Sjungma@eit.uni-kl.de{
21412027Sjungma@eit.uni-kl.de    /* For those used to the old style of passing a name to sc_module,
21512027Sjungma@eit.uni-kl.de       this constructor will reduce the chance of making a mistake */
21612027Sjungma@eit.uni-kl.de
21712027Sjungma@eit.uni-kl.de    /* When this form is used, we better have a fresh sc_module_name
21812027Sjungma@eit.uni-kl.de       on the top of the stack */
21912027Sjungma@eit.uni-kl.de    sc_module_name* mod_name =
22012027Sjungma@eit.uni-kl.de        simcontext()->get_object_manager()->top_of_module_name_stack();
22112027Sjungma@eit.uni-kl.de    if (0 == mod_name || 0 != mod_name->m_module_p)
22212027Sjungma@eit.uni-kl.de      SC_REPORT_ERROR( SC_ID_SC_MODULE_NAME_REQUIRED_, 0 );
22312027Sjungma@eit.uni-kl.de    sc_module_init();
22412027Sjungma@eit.uni-kl.de    mod_name->set_module( this );
22512027Sjungma@eit.uni-kl.de    m_module_name_p = mod_name; // must come after sc_module_init call.
22612027Sjungma@eit.uni-kl.de}
22712027Sjungma@eit.uni-kl.de
22812027Sjungma@eit.uni-kl.de/* --------------------------------------------------------------------
22912027Sjungma@eit.uni-kl.de *
23012027Sjungma@eit.uni-kl.de * Deprecated constructors:
23112027Sjungma@eit.uni-kl.de *   sc_module( const char* )
23212027Sjungma@eit.uni-kl.de *   sc_module( const std::string& )
23312027Sjungma@eit.uni-kl.de */
23412027Sjungma@eit.uni-kl.desc_module::sc_module( const char* nm )
23512027Sjungma@eit.uni-kl.de: sc_object(nm),
23612027Sjungma@eit.uni-kl.de  sensitive(this),
23712027Sjungma@eit.uni-kl.de  sensitive_pos(this),
23812027Sjungma@eit.uni-kl.de  sensitive_neg(this),
23912027Sjungma@eit.uni-kl.de  m_end_module_called(false),
24012027Sjungma@eit.uni-kl.de  m_port_vec(),
24112027Sjungma@eit.uni-kl.de  m_port_index(0),
24212027Sjungma@eit.uni-kl.de  m_name_gen(0),
24312027Sjungma@eit.uni-kl.de  m_module_name_p(0)
24412027Sjungma@eit.uni-kl.de{
24512027Sjungma@eit.uni-kl.de    SC_REPORT_WARNING( SC_ID_BAD_SC_MODULE_CONSTRUCTOR_, nm );
24612027Sjungma@eit.uni-kl.de    sc_module_init();
24712027Sjungma@eit.uni-kl.de}
24812027Sjungma@eit.uni-kl.de
24912027Sjungma@eit.uni-kl.desc_module::sc_module( const std::string& s )
25012027Sjungma@eit.uni-kl.de: sc_object( s.c_str() ),
25112027Sjungma@eit.uni-kl.de  sensitive(this),
25212027Sjungma@eit.uni-kl.de  sensitive_pos(this),
25312027Sjungma@eit.uni-kl.de  sensitive_neg(this),
25412027Sjungma@eit.uni-kl.de  m_end_module_called(false),
25512027Sjungma@eit.uni-kl.de  m_port_vec(),
25612027Sjungma@eit.uni-kl.de  m_port_index(0),
25712027Sjungma@eit.uni-kl.de  m_name_gen(0),
25812027Sjungma@eit.uni-kl.de  m_module_name_p(0)
25912027Sjungma@eit.uni-kl.de{
26012027Sjungma@eit.uni-kl.de    SC_REPORT_WARNING( SC_ID_BAD_SC_MODULE_CONSTRUCTOR_, s.c_str() );
26112027Sjungma@eit.uni-kl.de    sc_module_init();
26212027Sjungma@eit.uni-kl.de}
26312027Sjungma@eit.uni-kl.de
26412027Sjungma@eit.uni-kl.de/* -------------------------------------------------------------------- */
26512027Sjungma@eit.uni-kl.de
26612027Sjungma@eit.uni-kl.desc_module::~sc_module()
26712027Sjungma@eit.uni-kl.de{
26812027Sjungma@eit.uni-kl.de    delete m_port_vec;
26912027Sjungma@eit.uni-kl.de    delete m_name_gen;
27012027Sjungma@eit.uni-kl.de    orphan_child_objects();
27112027Sjungma@eit.uni-kl.de    if ( m_module_name_p )
27212027Sjungma@eit.uni-kl.de    {
27312027Sjungma@eit.uni-kl.de	m_module_name_p->clear_module( this ); // must be before end_module()
27412027Sjungma@eit.uni-kl.de    	end_module();
27512027Sjungma@eit.uni-kl.de    }
27612027Sjungma@eit.uni-kl.de    simcontext()->get_module_registry()->remove( *this );
27712027Sjungma@eit.uni-kl.de}
27812027Sjungma@eit.uni-kl.de
27912027Sjungma@eit.uni-kl.de
28012027Sjungma@eit.uni-kl.deconst ::std::vector<sc_object*>&
28112027Sjungma@eit.uni-kl.desc_module::get_child_objects() const
28212027Sjungma@eit.uni-kl.de{
28312027Sjungma@eit.uni-kl.de    return m_child_objects;
28412027Sjungma@eit.uni-kl.de}
28512027Sjungma@eit.uni-kl.de
28612027Sjungma@eit.uni-kl.de// set SC_THREAD asynchronous reset sensitivity
28712027Sjungma@eit.uni-kl.de
28812027Sjungma@eit.uni-kl.devoid
28912027Sjungma@eit.uni-kl.desc_module::async_reset_signal_is( const sc_in<bool>& port, bool level )
29012027Sjungma@eit.uni-kl.de{
29112027Sjungma@eit.uni-kl.de	sc_reset::reset_signal_is(true, port, level);
29212027Sjungma@eit.uni-kl.de}
29312027Sjungma@eit.uni-kl.de
29412027Sjungma@eit.uni-kl.devoid
29512027Sjungma@eit.uni-kl.desc_module::async_reset_signal_is( const sc_inout<bool>& port, bool level )
29612027Sjungma@eit.uni-kl.de{
29712027Sjungma@eit.uni-kl.de	sc_reset::reset_signal_is(true, port, level);
29812027Sjungma@eit.uni-kl.de}
29912027Sjungma@eit.uni-kl.de
30012027Sjungma@eit.uni-kl.devoid
30112027Sjungma@eit.uni-kl.desc_module::async_reset_signal_is( const sc_out<bool>& port, bool level )
30212027Sjungma@eit.uni-kl.de{
30312027Sjungma@eit.uni-kl.de	sc_reset::reset_signal_is(true, port, level);
30412027Sjungma@eit.uni-kl.de}
30512027Sjungma@eit.uni-kl.de
30612027Sjungma@eit.uni-kl.devoid
30712027Sjungma@eit.uni-kl.desc_module::async_reset_signal_is(const sc_signal_in_if<bool>& iface, bool level)
30812027Sjungma@eit.uni-kl.de{
30912027Sjungma@eit.uni-kl.de	sc_reset::reset_signal_is(true, iface, level);
31012027Sjungma@eit.uni-kl.de}
31112027Sjungma@eit.uni-kl.de
31212027Sjungma@eit.uni-kl.devoid
31312027Sjungma@eit.uni-kl.desc_module::end_module()
31412027Sjungma@eit.uni-kl.de{
31512027Sjungma@eit.uni-kl.de    if( ! m_end_module_called ) {
31612027Sjungma@eit.uni-kl.de	/* TBD: Can check here to alert the user that end_module
31712027Sjungma@eit.uni-kl.de                was not called for a previous module. */
31812027Sjungma@eit.uni-kl.de	(void)sc_get_curr_simcontext()->hierarchy_pop();
31912027Sjungma@eit.uni-kl.de	sc_get_curr_simcontext()->reset_curr_proc();
32012027Sjungma@eit.uni-kl.de	sensitive.reset();
32112027Sjungma@eit.uni-kl.de	sensitive_pos.reset();
32212027Sjungma@eit.uni-kl.de	sensitive_neg.reset();
32312027Sjungma@eit.uni-kl.de	m_end_module_called = true;
32412027Sjungma@eit.uni-kl.de	m_module_name_p = 0; // make sure we are not called in ~sc_module().
32512027Sjungma@eit.uni-kl.de    }
32612027Sjungma@eit.uni-kl.de}
32712027Sjungma@eit.uni-kl.de
32812027Sjungma@eit.uni-kl.de
32912027Sjungma@eit.uni-kl.de// to prevent initialization for SC_METHODs and SC_THREADs
33012027Sjungma@eit.uni-kl.de
33112027Sjungma@eit.uni-kl.devoid
33212027Sjungma@eit.uni-kl.desc_module::dont_initialize()
33312027Sjungma@eit.uni-kl.de{
33412027Sjungma@eit.uni-kl.de    sc_process_handle last_proc = sc_get_last_created_process_handle();
33512027Sjungma@eit.uni-kl.de    last_proc.dont_initialize( true );
33612027Sjungma@eit.uni-kl.de}
33712027Sjungma@eit.uni-kl.de
33812027Sjungma@eit.uni-kl.de// set SC_THREAD synchronous reset sensitivity
33912027Sjungma@eit.uni-kl.de
34012027Sjungma@eit.uni-kl.devoid
34112027Sjungma@eit.uni-kl.desc_module::reset_signal_is( const sc_in<bool>& port, bool level )
34212027Sjungma@eit.uni-kl.de{
34312027Sjungma@eit.uni-kl.de	sc_reset::reset_signal_is(false, port, level);
34412027Sjungma@eit.uni-kl.de}
34512027Sjungma@eit.uni-kl.de
34612027Sjungma@eit.uni-kl.devoid
34712027Sjungma@eit.uni-kl.desc_module::reset_signal_is( const sc_inout<bool>& port, bool level )
34812027Sjungma@eit.uni-kl.de{
34912027Sjungma@eit.uni-kl.de	sc_reset::reset_signal_is(false, port, level);
35012027Sjungma@eit.uni-kl.de}
35112027Sjungma@eit.uni-kl.de
35212027Sjungma@eit.uni-kl.devoid
35312027Sjungma@eit.uni-kl.desc_module::reset_signal_is( const sc_out<bool>& port, bool level )
35412027Sjungma@eit.uni-kl.de{
35512027Sjungma@eit.uni-kl.de	sc_reset::reset_signal_is(false, port, level);
35612027Sjungma@eit.uni-kl.de}
35712027Sjungma@eit.uni-kl.de
35812027Sjungma@eit.uni-kl.devoid
35912027Sjungma@eit.uni-kl.desc_module::reset_signal_is( const sc_signal_in_if<bool>& iface, bool level )
36012027Sjungma@eit.uni-kl.de{
36112027Sjungma@eit.uni-kl.de	sc_reset::reset_signal_is(false, iface, level);
36212027Sjungma@eit.uni-kl.de}
36312027Sjungma@eit.uni-kl.de
36412027Sjungma@eit.uni-kl.de// to generate unique names for objects in an MT-Safe way
36512027Sjungma@eit.uni-kl.de
36612027Sjungma@eit.uni-kl.deconst char*
36712027Sjungma@eit.uni-kl.desc_module::gen_unique_name( const char* basename_, bool preserve_first )
36812027Sjungma@eit.uni-kl.de{
36912027Sjungma@eit.uni-kl.de    return m_name_gen->gen_unique_name( basename_, preserve_first );
37012027Sjungma@eit.uni-kl.de}
37112027Sjungma@eit.uni-kl.de
37212027Sjungma@eit.uni-kl.de
37312027Sjungma@eit.uni-kl.de// called by construction_done
37412027Sjungma@eit.uni-kl.de
37512027Sjungma@eit.uni-kl.devoid
37612027Sjungma@eit.uni-kl.desc_module::before_end_of_elaboration()
37712027Sjungma@eit.uni-kl.de{}
37812027Sjungma@eit.uni-kl.de
37912027Sjungma@eit.uni-kl.de// We push the sc_module instance onto the stack of open objects so
38012027Sjungma@eit.uni-kl.de// that any objects that are created in before_end_of_elaboration have
38112027Sjungma@eit.uni-kl.de// the proper parent. After the call we pop the hierarchy.
38212027Sjungma@eit.uni-kl.devoid
38312027Sjungma@eit.uni-kl.desc_module::construction_done()
38412027Sjungma@eit.uni-kl.de{
38512027Sjungma@eit.uni-kl.de    hierarchy_scope scope(this);
38612027Sjungma@eit.uni-kl.de    before_end_of_elaboration();
38712027Sjungma@eit.uni-kl.de}
38812027Sjungma@eit.uni-kl.de
38912027Sjungma@eit.uni-kl.de// called by elaboration_done (does nothing by default)
39012027Sjungma@eit.uni-kl.de
39112027Sjungma@eit.uni-kl.devoid
39212027Sjungma@eit.uni-kl.desc_module::end_of_elaboration()
39312027Sjungma@eit.uni-kl.de{}
39412027Sjungma@eit.uni-kl.de
39512027Sjungma@eit.uni-kl.de
39612027Sjungma@eit.uni-kl.de// We push the sc_module instance onto the stack of open objects so
39712027Sjungma@eit.uni-kl.de// that any objects that are created in end_of_elaboration have
39812027Sjungma@eit.uni-kl.de// the proper parent. After the call we pop the hierarchy.
39912027Sjungma@eit.uni-kl.devoid
40012027Sjungma@eit.uni-kl.desc_module::elaboration_done( bool& error_ )
40112027Sjungma@eit.uni-kl.de{
40212027Sjungma@eit.uni-kl.de    if( ! m_end_module_called ) {
40312027Sjungma@eit.uni-kl.de	char msg[BUFSIZ];
40412027Sjungma@eit.uni-kl.de	std::sprintf( msg, "module '%s'", name() );
40512027Sjungma@eit.uni-kl.de	SC_REPORT_WARNING( SC_ID_END_MODULE_NOT_CALLED_, msg );
40612027Sjungma@eit.uni-kl.de	if( error_ ) {
40712027Sjungma@eit.uni-kl.de	    SC_REPORT_WARNING( SC_ID_HIER_NAME_INCORRECT_, 0 );
40812027Sjungma@eit.uni-kl.de	}
40912027Sjungma@eit.uni-kl.de	error_ = true;
41012027Sjungma@eit.uni-kl.de    }
41112027Sjungma@eit.uni-kl.de    hierarchy_scope scope(this);
41212027Sjungma@eit.uni-kl.de    end_of_elaboration();
41312027Sjungma@eit.uni-kl.de}
41412027Sjungma@eit.uni-kl.de
41512027Sjungma@eit.uni-kl.de// called by start_simulation (does nothing by default)
41612027Sjungma@eit.uni-kl.de
41712027Sjungma@eit.uni-kl.devoid
41812027Sjungma@eit.uni-kl.desc_module::start_of_simulation()
41912027Sjungma@eit.uni-kl.de{}
42012027Sjungma@eit.uni-kl.de
42112027Sjungma@eit.uni-kl.devoid
42212027Sjungma@eit.uni-kl.desc_module::start_simulation()
42312027Sjungma@eit.uni-kl.de{
42412027Sjungma@eit.uni-kl.de    hierarchy_scope scope(this);
42512027Sjungma@eit.uni-kl.de    start_of_simulation();
42612027Sjungma@eit.uni-kl.de}
42712027Sjungma@eit.uni-kl.de
42812027Sjungma@eit.uni-kl.de// called by simulation_done (does nothing by default)
42912027Sjungma@eit.uni-kl.de
43012027Sjungma@eit.uni-kl.devoid
43112027Sjungma@eit.uni-kl.desc_module::end_of_simulation()
43212027Sjungma@eit.uni-kl.de{}
43312027Sjungma@eit.uni-kl.de
43412027Sjungma@eit.uni-kl.devoid
43512027Sjungma@eit.uni-kl.desc_module::simulation_done()
43612027Sjungma@eit.uni-kl.de{
43712027Sjungma@eit.uni-kl.de    hierarchy_scope scope(this);
43812027Sjungma@eit.uni-kl.de    end_of_simulation();
43912027Sjungma@eit.uni-kl.de}
44012027Sjungma@eit.uni-kl.de
44112027Sjungma@eit.uni-kl.devoid
44212027Sjungma@eit.uni-kl.desc_module::set_stack_size( std::size_t size )
44312027Sjungma@eit.uni-kl.de{
44412027Sjungma@eit.uni-kl.de    sc_process_handle  proc_h(
44512027Sjungma@eit.uni-kl.de    	sc_is_running() ?
44612027Sjungma@eit.uni-kl.de	sc_get_current_process_handle() :
44712027Sjungma@eit.uni-kl.de	sc_get_last_created_process_handle()
44812027Sjungma@eit.uni-kl.de    );
44912027Sjungma@eit.uni-kl.de    sc_thread_handle thread_h;  // Current process as thread.
45012027Sjungma@eit.uni-kl.de
45112027Sjungma@eit.uni-kl.de
45212027Sjungma@eit.uni-kl.de    thread_h = (sc_thread_handle)proc_h;
45312027Sjungma@eit.uni-kl.de    if ( thread_h )
45412027Sjungma@eit.uni-kl.de    {
45512027Sjungma@eit.uni-kl.de	thread_h->set_stack_size( size );
45612027Sjungma@eit.uni-kl.de    }
45712027Sjungma@eit.uni-kl.de    else
45812027Sjungma@eit.uni-kl.de    {
45912027Sjungma@eit.uni-kl.de	SC_REPORT_WARNING( SC_ID_SET_STACK_SIZE_, 0 );
46012027Sjungma@eit.uni-kl.de    }
46112027Sjungma@eit.uni-kl.de}
46212027Sjungma@eit.uni-kl.de
46312027Sjungma@eit.uni-kl.de
46412027Sjungma@eit.uni-kl.deint
46512027Sjungma@eit.uni-kl.desc_module::append_port( sc_port_base* port_ )
46612027Sjungma@eit.uni-kl.de{
46712027Sjungma@eit.uni-kl.de    int index = m_port_vec->size();
46812027Sjungma@eit.uni-kl.de    m_port_vec->push_back( port_ );
46912027Sjungma@eit.uni-kl.de    return index;
47012027Sjungma@eit.uni-kl.de}
47112027Sjungma@eit.uni-kl.de
47212027Sjungma@eit.uni-kl.de
47312027Sjungma@eit.uni-kl.de// positional binding methods
47412027Sjungma@eit.uni-kl.de
47512027Sjungma@eit.uni-kl.destatic void sc_warn_arrow_arrow_bind()
47612027Sjungma@eit.uni-kl.de{
47712027Sjungma@eit.uni-kl.de    static bool warn_arrow_arrow_bind=true;
47812027Sjungma@eit.uni-kl.de    if ( warn_arrow_arrow_bind )
47912027Sjungma@eit.uni-kl.de    {
48012027Sjungma@eit.uni-kl.de    	warn_arrow_arrow_bind = false;
48112027Sjungma@eit.uni-kl.de	SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_,
48212027Sjungma@eit.uni-kl.de	    "positional binding using << or , is deprecated, use () instead.");
48312027Sjungma@eit.uni-kl.de    }
48412027Sjungma@eit.uni-kl.de}
48512027Sjungma@eit.uni-kl.de
48612027Sjungma@eit.uni-kl.desc_module&
48712027Sjungma@eit.uni-kl.desc_module::operator << ( sc_interface& interface_ )
48812027Sjungma@eit.uni-kl.de{
48912027Sjungma@eit.uni-kl.de    sc_warn_arrow_arrow_bind();
49012027Sjungma@eit.uni-kl.de    positional_bind(interface_);
49112027Sjungma@eit.uni-kl.de    return *this;
49212027Sjungma@eit.uni-kl.de}
49312027Sjungma@eit.uni-kl.de
49412027Sjungma@eit.uni-kl.desc_module&
49512027Sjungma@eit.uni-kl.desc_module::operator << ( sc_port_base& port_ )
49612027Sjungma@eit.uni-kl.de{
49712027Sjungma@eit.uni-kl.de    sc_warn_arrow_arrow_bind();
49812027Sjungma@eit.uni-kl.de    positional_bind(port_);
49912027Sjungma@eit.uni-kl.de    return *this;
50012027Sjungma@eit.uni-kl.de}
50112027Sjungma@eit.uni-kl.de
50212027Sjungma@eit.uni-kl.de
50312027Sjungma@eit.uni-kl.devoid
50412027Sjungma@eit.uni-kl.desc_module::positional_bind( sc_interface& interface_ )
50512027Sjungma@eit.uni-kl.de{
50612027Sjungma@eit.uni-kl.de    if( m_port_index == (int)m_port_vec->size() ) {
50712027Sjungma@eit.uni-kl.de	char msg[BUFSIZ];
50812027Sjungma@eit.uni-kl.de	if( m_port_index == 0 ) {
50912027Sjungma@eit.uni-kl.de	    std::sprintf( msg, "module `%s' has no ports", name() );
51012027Sjungma@eit.uni-kl.de	} else {
51112027Sjungma@eit.uni-kl.de	    std::sprintf( msg, "all ports of module `%s' are bound", name() );
51212027Sjungma@eit.uni-kl.de	}
51312027Sjungma@eit.uni-kl.de	SC_REPORT_ERROR( SC_ID_BIND_IF_TO_PORT_, msg );
51412027Sjungma@eit.uni-kl.de    }
51512027Sjungma@eit.uni-kl.de    int status = (*m_port_vec)[m_port_index]->pbind( interface_ );
51612027Sjungma@eit.uni-kl.de    if( status != 0 ) {
51712027Sjungma@eit.uni-kl.de	char msg[BUFSIZ];
51812027Sjungma@eit.uni-kl.de	switch( status ) {
51912027Sjungma@eit.uni-kl.de	case 1:
52012027Sjungma@eit.uni-kl.de	    std::sprintf( msg, "port %d of module `%s' is already bound",
52112027Sjungma@eit.uni-kl.de		     m_port_index, name() );
52212027Sjungma@eit.uni-kl.de	    break;
52312027Sjungma@eit.uni-kl.de	case 2:
52412027Sjungma@eit.uni-kl.de	    std::sprintf( msg, "type mismatch on port %d of module `%s'",
52512027Sjungma@eit.uni-kl.de		     m_port_index, name() );
52612027Sjungma@eit.uni-kl.de	    break;
52712027Sjungma@eit.uni-kl.de	default:
52812027Sjungma@eit.uni-kl.de	    std::sprintf( msg, "unknown error" );
52912027Sjungma@eit.uni-kl.de	    break;
53012027Sjungma@eit.uni-kl.de	}
53112027Sjungma@eit.uni-kl.de	SC_REPORT_ERROR( SC_ID_BIND_IF_TO_PORT_, msg );
53212027Sjungma@eit.uni-kl.de    }
53312027Sjungma@eit.uni-kl.de    ++ m_port_index;
53412027Sjungma@eit.uni-kl.de}
53512027Sjungma@eit.uni-kl.de
53612027Sjungma@eit.uni-kl.devoid
53712027Sjungma@eit.uni-kl.desc_module::positional_bind( sc_port_base& port_ )
53812027Sjungma@eit.uni-kl.de{
53912027Sjungma@eit.uni-kl.de    if( m_port_index == (int)m_port_vec->size() ) {
54012027Sjungma@eit.uni-kl.de	char msg[BUFSIZ];
54112027Sjungma@eit.uni-kl.de	if( m_port_index == 0 ) {
54212027Sjungma@eit.uni-kl.de	    std::sprintf( msg, "module `%s' has no ports", name() );
54312027Sjungma@eit.uni-kl.de	} else {
54412027Sjungma@eit.uni-kl.de	    std::sprintf( msg, "all ports of module `%s' are bound", name() );
54512027Sjungma@eit.uni-kl.de	}
54612027Sjungma@eit.uni-kl.de	SC_REPORT_ERROR( SC_ID_BIND_PORT_TO_PORT_, msg );
54712027Sjungma@eit.uni-kl.de    }
54812027Sjungma@eit.uni-kl.de    int status = (*m_port_vec)[m_port_index]->pbind( port_ );
54912027Sjungma@eit.uni-kl.de    if( status != 0 ) {
55012027Sjungma@eit.uni-kl.de	char msg[BUFSIZ];
55112027Sjungma@eit.uni-kl.de	switch( status ) {
55212027Sjungma@eit.uni-kl.de	case 1:
55312027Sjungma@eit.uni-kl.de	    std::sprintf( msg, "port %d of module `%s' is already bound",
55412027Sjungma@eit.uni-kl.de		     m_port_index, name() );
55512027Sjungma@eit.uni-kl.de	    break;
55612027Sjungma@eit.uni-kl.de	case 2:
55712027Sjungma@eit.uni-kl.de	    std::sprintf( msg, "type mismatch on port %d of module `%s'",
55812027Sjungma@eit.uni-kl.de		     m_port_index, name() );
55912027Sjungma@eit.uni-kl.de	    break;
56012027Sjungma@eit.uni-kl.de	default:
56112027Sjungma@eit.uni-kl.de	    std::sprintf( msg, "unknown error" );
56212027Sjungma@eit.uni-kl.de	    break;
56312027Sjungma@eit.uni-kl.de	}
56412027Sjungma@eit.uni-kl.de	SC_REPORT_ERROR( SC_ID_BIND_PORT_TO_PORT_, msg );
56512027Sjungma@eit.uni-kl.de    }
56612027Sjungma@eit.uni-kl.de    ++ m_port_index;
56712027Sjungma@eit.uni-kl.de}
56812027Sjungma@eit.uni-kl.de
56912027Sjungma@eit.uni-kl.de
57012027Sjungma@eit.uni-kl.de#define TRY_BIND( p )                                                         \
57112027Sjungma@eit.uni-kl.de    if( (p).iface != 0 ) {                                                    \
57212027Sjungma@eit.uni-kl.de        positional_bind( *(p).iface );                                        \
57312027Sjungma@eit.uni-kl.de    } else if( (p).port != 0 ) {                                              \
57412027Sjungma@eit.uni-kl.de        positional_bind( *(p).port );                                         \
57512027Sjungma@eit.uni-kl.de    } else {                                                                  \
57612027Sjungma@eit.uni-kl.de        return;                                                               \
57712027Sjungma@eit.uni-kl.de    }
57812027Sjungma@eit.uni-kl.de
57912027Sjungma@eit.uni-kl.de
58012027Sjungma@eit.uni-kl.devoid
58112027Sjungma@eit.uni-kl.desc_module::operator () ( const sc_bind_proxy& p001,
58212027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p002,
58312027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p003,
58412027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p004,
58512027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p005,
58612027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p006,
58712027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p007,
58812027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p008,
58912027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p009,
59012027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p010,
59112027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p011,
59212027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p012,
59312027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p013,
59412027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p014,
59512027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p015,
59612027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p016,
59712027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p017,
59812027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p018,
59912027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p019,
60012027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p020,
60112027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p021,
60212027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p022,
60312027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p023,
60412027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p024,
60512027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p025,
60612027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p026,
60712027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p027,
60812027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p028,
60912027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p029,
61012027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p030,
61112027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p031,
61212027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p032,
61312027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p033,
61412027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p034,
61512027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p035,
61612027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p036,
61712027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p037,
61812027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p038,
61912027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p039,
62012027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p040,
62112027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p041,
62212027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p042,
62312027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p043,
62412027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p044,
62512027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p045,
62612027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p046,
62712027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p047,
62812027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p048,
62912027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p049,
63012027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p050,
63112027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p051,
63212027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p052,
63312027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p053,
63412027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p054,
63512027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p055,
63612027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p056,
63712027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p057,
63812027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p058,
63912027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p059,
64012027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p060,
64112027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p061,
64212027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p062,
64312027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p063,
64412027Sjungma@eit.uni-kl.de			 const sc_bind_proxy& p064 )
64512027Sjungma@eit.uni-kl.de{
64612027Sjungma@eit.uni-kl.de    static bool warn_only_once=true;
64712027Sjungma@eit.uni-kl.de    if ( m_port_index > 0 && warn_only_once )
64812027Sjungma@eit.uni-kl.de    {
64912027Sjungma@eit.uni-kl.de        warn_only_once = false;
65012027Sjungma@eit.uni-kl.de	SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_,
65112027Sjungma@eit.uni-kl.de	 "multiple () binding deprecated, use explicit port binding instead." );
65212027Sjungma@eit.uni-kl.de    }
65312027Sjungma@eit.uni-kl.de
65412027Sjungma@eit.uni-kl.de    TRY_BIND( p001 );
65512027Sjungma@eit.uni-kl.de    TRY_BIND( p002 );
65612027Sjungma@eit.uni-kl.de    TRY_BIND( p003 );
65712027Sjungma@eit.uni-kl.de    TRY_BIND( p004 );
65812027Sjungma@eit.uni-kl.de    TRY_BIND( p005 );
65912027Sjungma@eit.uni-kl.de    TRY_BIND( p006 );
66012027Sjungma@eit.uni-kl.de    TRY_BIND( p007 );
66112027Sjungma@eit.uni-kl.de    TRY_BIND( p008 );
66212027Sjungma@eit.uni-kl.de    TRY_BIND( p009 );
66312027Sjungma@eit.uni-kl.de    TRY_BIND( p010 );
66412027Sjungma@eit.uni-kl.de    TRY_BIND( p011 );
66512027Sjungma@eit.uni-kl.de    TRY_BIND( p012 );
66612027Sjungma@eit.uni-kl.de    TRY_BIND( p013 );
66712027Sjungma@eit.uni-kl.de    TRY_BIND( p014 );
66812027Sjungma@eit.uni-kl.de    TRY_BIND( p015 );
66912027Sjungma@eit.uni-kl.de    TRY_BIND( p016 );
67012027Sjungma@eit.uni-kl.de    TRY_BIND( p017 );
67112027Sjungma@eit.uni-kl.de    TRY_BIND( p018 );
67212027Sjungma@eit.uni-kl.de    TRY_BIND( p019 );
67312027Sjungma@eit.uni-kl.de    TRY_BIND( p020 );
67412027Sjungma@eit.uni-kl.de    TRY_BIND( p021 );
67512027Sjungma@eit.uni-kl.de    TRY_BIND( p022 );
67612027Sjungma@eit.uni-kl.de    TRY_BIND( p023 );
67712027Sjungma@eit.uni-kl.de    TRY_BIND( p024 );
67812027Sjungma@eit.uni-kl.de    TRY_BIND( p025 );
67912027Sjungma@eit.uni-kl.de    TRY_BIND( p026 );
68012027Sjungma@eit.uni-kl.de    TRY_BIND( p027 );
68112027Sjungma@eit.uni-kl.de    TRY_BIND( p028 );
68212027Sjungma@eit.uni-kl.de    TRY_BIND( p029 );
68312027Sjungma@eit.uni-kl.de    TRY_BIND( p030 );
68412027Sjungma@eit.uni-kl.de    TRY_BIND( p031 );
68512027Sjungma@eit.uni-kl.de    TRY_BIND( p032 );
68612027Sjungma@eit.uni-kl.de    TRY_BIND( p033 );
68712027Sjungma@eit.uni-kl.de    TRY_BIND( p034 );
68812027Sjungma@eit.uni-kl.de    TRY_BIND( p035 );
68912027Sjungma@eit.uni-kl.de    TRY_BIND( p036 );
69012027Sjungma@eit.uni-kl.de    TRY_BIND( p037 );
69112027Sjungma@eit.uni-kl.de    TRY_BIND( p038 );
69212027Sjungma@eit.uni-kl.de    TRY_BIND( p039 );
69312027Sjungma@eit.uni-kl.de    TRY_BIND( p040 );
69412027Sjungma@eit.uni-kl.de    TRY_BIND( p041 );
69512027Sjungma@eit.uni-kl.de    TRY_BIND( p042 );
69612027Sjungma@eit.uni-kl.de    TRY_BIND( p043 );
69712027Sjungma@eit.uni-kl.de    TRY_BIND( p044 );
69812027Sjungma@eit.uni-kl.de    TRY_BIND( p045 );
69912027Sjungma@eit.uni-kl.de    TRY_BIND( p046 );
70012027Sjungma@eit.uni-kl.de    TRY_BIND( p047 );
70112027Sjungma@eit.uni-kl.de    TRY_BIND( p048 );
70212027Sjungma@eit.uni-kl.de    TRY_BIND( p049 );
70312027Sjungma@eit.uni-kl.de    TRY_BIND( p050 );
70412027Sjungma@eit.uni-kl.de    TRY_BIND( p051 );
70512027Sjungma@eit.uni-kl.de    TRY_BIND( p052 );
70612027Sjungma@eit.uni-kl.de    TRY_BIND( p053 );
70712027Sjungma@eit.uni-kl.de    TRY_BIND( p054 );
70812027Sjungma@eit.uni-kl.de    TRY_BIND( p055 );
70912027Sjungma@eit.uni-kl.de    TRY_BIND( p056 );
71012027Sjungma@eit.uni-kl.de    TRY_BIND( p057 );
71112027Sjungma@eit.uni-kl.de    TRY_BIND( p058 );
71212027Sjungma@eit.uni-kl.de    TRY_BIND( p059 );
71312027Sjungma@eit.uni-kl.de    TRY_BIND( p060 );
71412027Sjungma@eit.uni-kl.de    TRY_BIND( p061 );
71512027Sjungma@eit.uni-kl.de    TRY_BIND( p062 );
71612027Sjungma@eit.uni-kl.de    TRY_BIND( p063 );
71712027Sjungma@eit.uni-kl.de    TRY_BIND( p064 );
71812027Sjungma@eit.uni-kl.de}
71912027Sjungma@eit.uni-kl.de
72012027Sjungma@eit.uni-kl.de} // namespace sc_core
72112027Sjungma@eit.uni-kl.de
72212027Sjungma@eit.uni-kl.de/*****************************************************************************
72312027Sjungma@eit.uni-kl.de
72412027Sjungma@eit.uni-kl.de  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
72512027Sjungma@eit.uni-kl.de  changes you are making here.
72612027Sjungma@eit.uni-kl.de
72712027Sjungma@eit.uni-kl.de      Name, Affiliation, Date: Ali Dasdan, Synopsys, Inc.
72812027Sjungma@eit.uni-kl.de  Description of Modification: - Implementation of operator() and operator,
72912027Sjungma@eit.uni-kl.de                                 positional connection method.
73012027Sjungma@eit.uni-kl.de                               - Implementation of error checking in
73112027Sjungma@eit.uni-kl.de                                 operator<<'s.
73212027Sjungma@eit.uni-kl.de                               - Implementation of the function test_module_prm.
73312027Sjungma@eit.uni-kl.de                               - Implementation of set_stack_size().
73412027Sjungma@eit.uni-kl.de
73512027Sjungma@eit.uni-kl.de      Name, Affiliation, Date: Andy Goodrich, Forte Design Systems 20 May 2003
73612027Sjungma@eit.uni-kl.de  Description of Modification: Inherit from sc_process_host
73712027Sjungma@eit.uni-kl.de
73812027Sjungma@eit.uni-kl.de      Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
73912027Sjungma@eit.uni-kl.de                               25 August, 2003
74012027Sjungma@eit.uni-kl.de  Description of Modification: dont_initialize() uses
74112027Sjungma@eit.uni-kl.de                               sc_get_last_created_process_handle() instead of
74212027Sjungma@eit.uni-kl.de                               sc_get_current_process_b()
74312027Sjungma@eit.uni-kl.de
74412027Sjungma@eit.uni-kl.de      Name, Affiliation, Date: Andy Goodrich, Forte Design Systems 25 Mar 2003
74512027Sjungma@eit.uni-kl.de  Description of Modification: Fixed bug in SC_NEW, see comments on
74612027Sjungma@eit.uni-kl.de                               ~sc_module_dynalloc_list below.
74712027Sjungma@eit.uni-kl.de
74812027Sjungma@eit.uni-kl.de
74912027Sjungma@eit.uni-kl.de *****************************************************************************/
75012027Sjungma@eit.uni-kl.de
75112027Sjungma@eit.uni-kl.de
75212027Sjungma@eit.uni-kl.de// $Log: sc_module.cpp,v $
75312027Sjungma@eit.uni-kl.de// Revision 1.14  2011/08/29 18:04:32  acg
75412027Sjungma@eit.uni-kl.de//  Philipp A. Hartmann: miscellaneous clean ups.
75512027Sjungma@eit.uni-kl.de//
75612027Sjungma@eit.uni-kl.de// Revision 1.13  2011/08/26 20:46:10  acg
75712027Sjungma@eit.uni-kl.de//  Andy Goodrich: moved the modification log to the end of the file to
75812027Sjungma@eit.uni-kl.de//  eliminate source line number skew when check-ins are done.
75912027Sjungma@eit.uni-kl.de//
76012027Sjungma@eit.uni-kl.de// Revision 1.12  2011/08/24 22:05:51  acg
76112027Sjungma@eit.uni-kl.de//  Torsten Maehne: initialization changes to remove warnings.
76212027Sjungma@eit.uni-kl.de//
76312027Sjungma@eit.uni-kl.de// Revision 1.11  2011/03/05 19:44:20  acg
76412027Sjungma@eit.uni-kl.de//  Andy Goodrich: changes for object and event naming and structures.
76512027Sjungma@eit.uni-kl.de//
76612027Sjungma@eit.uni-kl.de// Revision 1.10  2011/02/18 20:27:14  acg
76712027Sjungma@eit.uni-kl.de//  Andy Goodrich: Updated Copyrights.
76812027Sjungma@eit.uni-kl.de//
76912027Sjungma@eit.uni-kl.de// Revision 1.9  2011/02/16 22:37:30  acg
77012027Sjungma@eit.uni-kl.de//  Andy Goodrich: clean up to remove need for ps_disable_pending.
77112027Sjungma@eit.uni-kl.de//
77212027Sjungma@eit.uni-kl.de// Revision 1.8  2011/02/14 17:51:40  acg
77312027Sjungma@eit.uni-kl.de//  Andy Goodrich: proper pushing an poppping of the module hierarchy for
77412027Sjungma@eit.uni-kl.de//  start_of_simulation() and end_of_simulation.
77512027Sjungma@eit.uni-kl.de//
77612027Sjungma@eit.uni-kl.de// Revision 1.7  2011/02/13 21:47:37  acg
77712027Sjungma@eit.uni-kl.de//  Andy Goodrich: update copyright notice.
77812027Sjungma@eit.uni-kl.de//
77912027Sjungma@eit.uni-kl.de// Revision 1.6  2011/01/25 20:50:37  acg
78012027Sjungma@eit.uni-kl.de//  Andy Goodrich: changes for IEEE 1666 2011.
78112027Sjungma@eit.uni-kl.de//
78212027Sjungma@eit.uni-kl.de// Revision 1.5  2009/05/22 16:06:29  acg
78312027Sjungma@eit.uni-kl.de//  Andy Goodrich: process control updates.
78412027Sjungma@eit.uni-kl.de//
78512027Sjungma@eit.uni-kl.de// Revision 1.4  2008/11/17 15:57:15  acg
78612027Sjungma@eit.uni-kl.de//  Andy Goodrich: added deprecation message for sc_module(const char*)
78712027Sjungma@eit.uni-kl.de//
78812027Sjungma@eit.uni-kl.de// Revision 1.3  2008/05/22 17:06:25  acg
78912027Sjungma@eit.uni-kl.de//  Andy Goodrich: updated copyright notice to include 2008.
79012027Sjungma@eit.uni-kl.de//
79112027Sjungma@eit.uni-kl.de// Revision 1.2  2007/05/17 20:16:33  acg
79212027Sjungma@eit.uni-kl.de//  Andy Goodrich: changes for beta release to LWG.
79312027Sjungma@eit.uni-kl.de//
79412027Sjungma@eit.uni-kl.de// Revision 1.1.1.1  2006/12/15 20:20:05  acg
79512027Sjungma@eit.uni-kl.de// SystemC 2.3
79612027Sjungma@eit.uni-kl.de//
79712027Sjungma@eit.uni-kl.de// Revision 1.9  2006/12/02 20:58:18  acg
79812027Sjungma@eit.uni-kl.de//  Andy Goodrich: updates from 2.2 for IEEE 1666 support.
79912027Sjungma@eit.uni-kl.de//
80012027Sjungma@eit.uni-kl.de// Revision 1.8  2006/03/21 00:00:34  acg
80112027Sjungma@eit.uni-kl.de//   Andy Goodrich: changed name of sc_get_current_process_base() to be
80212027Sjungma@eit.uni-kl.de//   sc_get_current_process_b() since its returning an sc_process_b instance.
80312027Sjungma@eit.uni-kl.de//
80412027Sjungma@eit.uni-kl.de// Revision 1.7  2006/03/14 23:56:58  acg
80512027Sjungma@eit.uni-kl.de//   Andy Goodrich: This fixes a bug when an exception is thrown in
80612027Sjungma@eit.uni-kl.de//   sc_module::sc_module() for a dynamically allocated sc_module
80712027Sjungma@eit.uni-kl.de//   object. We are calling sc_module::end_module() on a module that has
80812027Sjungma@eit.uni-kl.de//   already been deleted. The scenario runs like this:
80912027Sjungma@eit.uni-kl.de//
81012027Sjungma@eit.uni-kl.de//   a) the sc_module constructor is entered
81112027Sjungma@eit.uni-kl.de//   b) the exception is thrown
81212027Sjungma@eit.uni-kl.de//   c) the exception processor deletes the storage for the sc_module
81312027Sjungma@eit.uni-kl.de//   d) the stack is unrolled causing the sc_module_name instance to be deleted
81412027Sjungma@eit.uni-kl.de//   e) ~sc_module_name() calls end_module() with its pointer to the sc_module
81512027Sjungma@eit.uni-kl.de//   f) because the sc_module has been deleted its storage is corrupted,
81612027Sjungma@eit.uni-kl.de//      either by linking it to a free space chain, or by reuse of some sort
81712027Sjungma@eit.uni-kl.de//   g) the m_simc field is garbage
81812027Sjungma@eit.uni-kl.de//   h) the m_object_manager field is also garbage
81912027Sjungma@eit.uni-kl.de//   i) an exception occurs
82012027Sjungma@eit.uni-kl.de//
82112027Sjungma@eit.uni-kl.de//   This does not happen for automatic sc_module instances since the
82212027Sjungma@eit.uni-kl.de//   storage for the module is not reclaimed its just part of the stack.
82312027Sjungma@eit.uni-kl.de//
82412027Sjungma@eit.uni-kl.de//   I am fixing this by having the destructor for sc_module clear the
82512027Sjungma@eit.uni-kl.de//   module pointer in its sc_module_name instance. That cuts things at
82612027Sjungma@eit.uni-kl.de//   step (e) above, since the pointer will be null if the module has
82712027Sjungma@eit.uni-kl.de//   already been deleted. To make sure the module stack is okay, I call
82812027Sjungma@eit.uni-kl.de//   end-module() in ~sc_module in the case where there is an
82912027Sjungma@eit.uni-kl.de//   sc_module_name pointer lying around.
83012027Sjungma@eit.uni-kl.de//
83112027Sjungma@eit.uni-kl.de// Revision 1.6  2006/01/26 21:04:54  acg
83212027Sjungma@eit.uni-kl.de//  Andy Goodrich: deprecation message changes and additional messages.
83312027Sjungma@eit.uni-kl.de//
83412027Sjungma@eit.uni-kl.de// Revision 1.5  2006/01/25 00:31:19  acg
83512027Sjungma@eit.uni-kl.de//  Andy Goodrich: Changed over to use a standard message id of
83612027Sjungma@eit.uni-kl.de//  SC_ID_IEEE_1666_DEPRECATION for all deprecation messages.
83712027Sjungma@eit.uni-kl.de//
83812027Sjungma@eit.uni-kl.de// Revision 1.4  2006/01/24 20:49:05  acg
83912027Sjungma@eit.uni-kl.de// Andy Goodrich: changes to remove the use of deprecated features within the
84012027Sjungma@eit.uni-kl.de// simulator, and to issue warning messages when deprecated features are used.
84112027Sjungma@eit.uni-kl.de//
84212027Sjungma@eit.uni-kl.de// Revision 1.3  2006/01/13 18:44:29  acg
84312027Sjungma@eit.uni-kl.de// Added $Log to record CVS changes into the source.
84412027Sjungma@eit.uni-kl.de//
84512027Sjungma@eit.uni-kl.de
84612027Sjungma@eit.uni-kl.de// Taf!
847