sc_method_process.cpp revision 12027
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_method_process.cpp -- Method process implementation
2312027Sjungma@eit.uni-kl.de
2412027Sjungma@eit.uni-kl.de  Original Author: Andy Goodrich, Forte Design Systems, 4 August 2005
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#include "sysc/kernel/sc_method_process.h"
3012027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_simcontext_int.h"
3112027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_module.h"
3212027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_spawn_options.h"
3312027Sjungma@eit.uni-kl.de
3412027Sjungma@eit.uni-kl.de// DEBUGGING MACROS:
3512027Sjungma@eit.uni-kl.de//
3612027Sjungma@eit.uni-kl.de// DEBUG_MSG(NAME,P,MSG)
3712027Sjungma@eit.uni-kl.de//     MSG  = message to print
3812027Sjungma@eit.uni-kl.de//     NAME = name that must match the process for the message to print, or
3912027Sjungma@eit.uni-kl.de//            null if the message should be printed unconditionally.
4012027Sjungma@eit.uni-kl.de//     P    = pointer to process message is for, or NULL in which case the
4112027Sjungma@eit.uni-kl.de//            message will not print.
4212027Sjungma@eit.uni-kl.de#if 0
4312027Sjungma@eit.uni-kl.de#   define DEBUG_NAME ""
4412027Sjungma@eit.uni-kl.de#   define DEBUG_MSG(NAME,P,MSG) \
4512027Sjungma@eit.uni-kl.de    { \
4612027Sjungma@eit.uni-kl.de        if ( P && ( (strlen(NAME)==0) || !strcmp(NAME,P->name())) ) \
4712027Sjungma@eit.uni-kl.de          std::cout << "**** " << sc_time_stamp() << " ("  \
4812027Sjungma@eit.uni-kl.de	            << sc_get_current_process_name() << "): " << MSG \
4912027Sjungma@eit.uni-kl.de		    << " - " << P->name() << std::endl; \
5012027Sjungma@eit.uni-kl.de    }
5112027Sjungma@eit.uni-kl.de#else
5212027Sjungma@eit.uni-kl.de#   define DEBUG_MSG(NAME,P,MSG)
5312027Sjungma@eit.uni-kl.de#endif
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// |"sc_method_process::check_for_throws"
5912027Sjungma@eit.uni-kl.de// |
6012027Sjungma@eit.uni-kl.de// | This method checks to see if this method process should throw an exception
6112027Sjungma@eit.uni-kl.de// | or not. It is called from sc_simcontext::preempt_with() to see if the
6212027Sjungma@eit.uni-kl.de// | thread that was executed during the preemption did a kill or other
6312027Sjungma@eit.uni-kl.de// | manipulation on this object instance that requires it to throw an
6412027Sjungma@eit.uni-kl.de// | exception.
6512027Sjungma@eit.uni-kl.de// +----------------------------------------------------------------------------
6612027Sjungma@eit.uni-kl.devoid sc_method_process::check_for_throws()
6712027Sjungma@eit.uni-kl.de{
6812027Sjungma@eit.uni-kl.de    if ( !m_unwinding )
6912027Sjungma@eit.uni-kl.de    {
7012027Sjungma@eit.uni-kl.de	switch( m_throw_status )
7112027Sjungma@eit.uni-kl.de	{
7212027Sjungma@eit.uni-kl.de	  case THROW_ASYNC_RESET:
7312027Sjungma@eit.uni-kl.de	    simcontext()->preempt_with(this);
7412027Sjungma@eit.uni-kl.de	    break;
7512027Sjungma@eit.uni-kl.de          case THROW_KILL:
7612027Sjungma@eit.uni-kl.de	    throw sc_unwind_exception( this, false );
7712027Sjungma@eit.uni-kl.de	  default:
7812027Sjungma@eit.uni-kl.de	    break;
7912027Sjungma@eit.uni-kl.de	}
8012027Sjungma@eit.uni-kl.de    }
8112027Sjungma@eit.uni-kl.de}
8212027Sjungma@eit.uni-kl.de
8312027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
8412027Sjungma@eit.uni-kl.de//"sc_method_process::clear_trigger"
8512027Sjungma@eit.uni-kl.de//
8612027Sjungma@eit.uni-kl.de// This method clears any pending trigger for this object instance.
8712027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
8812027Sjungma@eit.uni-kl.devoid sc_method_process::clear_trigger()
8912027Sjungma@eit.uni-kl.de{
9012027Sjungma@eit.uni-kl.de    switch( m_trigger_type ) {
9112027Sjungma@eit.uni-kl.de      case STATIC:
9212027Sjungma@eit.uni-kl.de        return;
9312027Sjungma@eit.uni-kl.de      case EVENT:
9412027Sjungma@eit.uni-kl.de        m_event_p->remove_dynamic( this );
9512027Sjungma@eit.uni-kl.de        m_event_p = 0;
9612027Sjungma@eit.uni-kl.de        break;
9712027Sjungma@eit.uni-kl.de      case OR_LIST:
9812027Sjungma@eit.uni-kl.de        m_event_list_p->remove_dynamic( this, 0 );
9912027Sjungma@eit.uni-kl.de        m_event_list_p->auto_delete();
10012027Sjungma@eit.uni-kl.de        m_event_list_p = 0;
10112027Sjungma@eit.uni-kl.de        break;
10212027Sjungma@eit.uni-kl.de      case AND_LIST:
10312027Sjungma@eit.uni-kl.de        m_event_list_p->remove_dynamic( this, 0 );
10412027Sjungma@eit.uni-kl.de        m_event_list_p->auto_delete();
10512027Sjungma@eit.uni-kl.de        m_event_list_p = 0;
10612027Sjungma@eit.uni-kl.de        m_event_count = 0;
10712027Sjungma@eit.uni-kl.de        break;
10812027Sjungma@eit.uni-kl.de      case TIMEOUT:
10912027Sjungma@eit.uni-kl.de        m_timeout_event_p->cancel();
11012027Sjungma@eit.uni-kl.de        m_timeout_event_p->reset();
11112027Sjungma@eit.uni-kl.de        break;
11212027Sjungma@eit.uni-kl.de      case EVENT_TIMEOUT:
11312027Sjungma@eit.uni-kl.de        m_timeout_event_p->cancel();
11412027Sjungma@eit.uni-kl.de        m_timeout_event_p->reset();
11512027Sjungma@eit.uni-kl.de        m_event_p->remove_dynamic( this );
11612027Sjungma@eit.uni-kl.de        m_event_p = 0;
11712027Sjungma@eit.uni-kl.de        break;
11812027Sjungma@eit.uni-kl.de      case OR_LIST_TIMEOUT:
11912027Sjungma@eit.uni-kl.de        m_timeout_event_p->cancel();
12012027Sjungma@eit.uni-kl.de        m_timeout_event_p->reset();
12112027Sjungma@eit.uni-kl.de        m_event_list_p->remove_dynamic( this, 0 );
12212027Sjungma@eit.uni-kl.de        m_event_list_p->auto_delete();
12312027Sjungma@eit.uni-kl.de        m_event_list_p = 0;
12412027Sjungma@eit.uni-kl.de      break;
12512027Sjungma@eit.uni-kl.de      case AND_LIST_TIMEOUT:
12612027Sjungma@eit.uni-kl.de        m_timeout_event_p->cancel();
12712027Sjungma@eit.uni-kl.de        m_timeout_event_p->reset();
12812027Sjungma@eit.uni-kl.de        m_event_list_p->remove_dynamic( this, 0 );
12912027Sjungma@eit.uni-kl.de        m_event_list_p->auto_delete();
13012027Sjungma@eit.uni-kl.de        m_event_list_p = 0;
13112027Sjungma@eit.uni-kl.de        m_event_count = 0;
13212027Sjungma@eit.uni-kl.de        break;
13312027Sjungma@eit.uni-kl.de    }
13412027Sjungma@eit.uni-kl.de    m_trigger_type = STATIC;
13512027Sjungma@eit.uni-kl.de}
13612027Sjungma@eit.uni-kl.de
13712027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
13812027Sjungma@eit.uni-kl.de//"sc_method_process::disable_process"
13912027Sjungma@eit.uni-kl.de//
14012027Sjungma@eit.uni-kl.de// This virtual method disables this process and its children if requested to.
14112027Sjungma@eit.uni-kl.de//     descendants = indicator of whether this process' children should also
14212027Sjungma@eit.uni-kl.de//                   be suspended
14312027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
14412027Sjungma@eit.uni-kl.devoid sc_method_process::disable_process(
14512027Sjungma@eit.uni-kl.de    sc_descendant_inclusion_info descendants )
14612027Sjungma@eit.uni-kl.de{
14712027Sjungma@eit.uni-kl.de
14812027Sjungma@eit.uni-kl.de    // IF NEEDED PROPOGATE THE SUSPEND REQUEST THROUGH OUR DESCENDANTS:
14912027Sjungma@eit.uni-kl.de
15012027Sjungma@eit.uni-kl.de    if ( descendants == SC_INCLUDE_DESCENDANTS )
15112027Sjungma@eit.uni-kl.de    {
15212027Sjungma@eit.uni-kl.de        const std::vector<sc_object*>& children = get_child_objects();
15312027Sjungma@eit.uni-kl.de        int                            child_n  = children.size();
15412027Sjungma@eit.uni-kl.de
15512027Sjungma@eit.uni-kl.de        for ( int child_i = 0; child_i < child_n; child_i++ )
15612027Sjungma@eit.uni-kl.de        {
15712027Sjungma@eit.uni-kl.de            sc_process_b* child_p = DCAST<sc_process_b*>(children[child_i]);
15812027Sjungma@eit.uni-kl.de            if ( child_p ) child_p->disable_process(descendants);
15912027Sjungma@eit.uni-kl.de        }
16012027Sjungma@eit.uni-kl.de    }
16112027Sjungma@eit.uni-kl.de
16212027Sjungma@eit.uni-kl.de    // DON'T ALLOW CORNER CASE BY DEFAULT:
16312027Sjungma@eit.uni-kl.de
16412027Sjungma@eit.uni-kl.de    if ( !sc_allow_process_control_corners )
16512027Sjungma@eit.uni-kl.de    {
16612027Sjungma@eit.uni-kl.de	switch( m_trigger_type )
16712027Sjungma@eit.uni-kl.de	{
16812027Sjungma@eit.uni-kl.de	  case AND_LIST_TIMEOUT:
16912027Sjungma@eit.uni-kl.de	  case EVENT_TIMEOUT:
17012027Sjungma@eit.uni-kl.de	  case OR_LIST_TIMEOUT:
17112027Sjungma@eit.uni-kl.de	  case TIMEOUT:
17212027Sjungma@eit.uni-kl.de	    report_error( SC_ID_PROCESS_CONTROL_CORNER_CASE_,
17312027Sjungma@eit.uni-kl.de	                  "attempt to disable a method with timeout wait" );
17412027Sjungma@eit.uni-kl.de	    break;
17512027Sjungma@eit.uni-kl.de	  default:
17612027Sjungma@eit.uni-kl.de	    break;
17712027Sjungma@eit.uni-kl.de	}
17812027Sjungma@eit.uni-kl.de    }
17912027Sjungma@eit.uni-kl.de
18012027Sjungma@eit.uni-kl.de    // DISABLE OUR OBJECT INSTANCE:
18112027Sjungma@eit.uni-kl.de
18212027Sjungma@eit.uni-kl.de    m_state = m_state | ps_bit_disabled;
18312027Sjungma@eit.uni-kl.de
18412027Sjungma@eit.uni-kl.de    // IF THIS CALL IS BEFORE THE SIMULATION DON'T RUN THE METHOD:
18512027Sjungma@eit.uni-kl.de
18612027Sjungma@eit.uni-kl.de    if ( !sc_is_running() )
18712027Sjungma@eit.uni-kl.de    {
18812027Sjungma@eit.uni-kl.de        sc_get_curr_simcontext()->remove_runnable_method(this);
18912027Sjungma@eit.uni-kl.de    }
19012027Sjungma@eit.uni-kl.de}
19112027Sjungma@eit.uni-kl.de
19212027Sjungma@eit.uni-kl.de
19312027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
19412027Sjungma@eit.uni-kl.de//"sc_method_process::enable_process"
19512027Sjungma@eit.uni-kl.de//
19612027Sjungma@eit.uni-kl.de// This method enables the execution of this process, and if requested, its
19712027Sjungma@eit.uni-kl.de// descendants. If the process was suspended and has a resumption pending it
19812027Sjungma@eit.uni-kl.de// will be dispatched in the next delta cycle. Otherwise the state will be
19912027Sjungma@eit.uni-kl.de// adjusted to indicate it is no longer suspended, but no immediate execution
20012027Sjungma@eit.uni-kl.de// will occur.
20112027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
20212027Sjungma@eit.uni-kl.devoid sc_method_process::enable_process(
20312027Sjungma@eit.uni-kl.de    sc_descendant_inclusion_info descendants )
20412027Sjungma@eit.uni-kl.de{
20512027Sjungma@eit.uni-kl.de
20612027Sjungma@eit.uni-kl.de    // IF NEEDED PROPOGATE THE RESUME REQUEST THROUGH OUR DESCENDANTS:
20712027Sjungma@eit.uni-kl.de
20812027Sjungma@eit.uni-kl.de    if ( descendants == SC_INCLUDE_DESCENDANTS )
20912027Sjungma@eit.uni-kl.de    {
21012027Sjungma@eit.uni-kl.de        const std::vector<sc_object*>& children = get_child_objects();
21112027Sjungma@eit.uni-kl.de        int                            child_n  = children.size();
21212027Sjungma@eit.uni-kl.de
21312027Sjungma@eit.uni-kl.de        for ( int child_i = 0; child_i < child_n; child_i++ )
21412027Sjungma@eit.uni-kl.de        {
21512027Sjungma@eit.uni-kl.de            sc_process_b* child_p = DCAST<sc_process_b*>(children[child_i]);
21612027Sjungma@eit.uni-kl.de            if ( child_p ) child_p->enable_process(descendants);
21712027Sjungma@eit.uni-kl.de        }
21812027Sjungma@eit.uni-kl.de    }
21912027Sjungma@eit.uni-kl.de
22012027Sjungma@eit.uni-kl.de    // ENABLE THIS OBJECT INSTANCE:
22112027Sjungma@eit.uni-kl.de    //
22212027Sjungma@eit.uni-kl.de    // If it was disabled and ready to run then put it on the run queue.
22312027Sjungma@eit.uni-kl.de
22412027Sjungma@eit.uni-kl.de    m_state = m_state & ~ps_bit_disabled;
22512027Sjungma@eit.uni-kl.de    if ( m_state == ps_bit_ready_to_run )
22612027Sjungma@eit.uni-kl.de    {
22712027Sjungma@eit.uni-kl.de        m_state = ps_normal;
22812027Sjungma@eit.uni-kl.de	if ( next_runnable() == 0 )
22912027Sjungma@eit.uni-kl.de	    simcontext()->push_runnable_method(this);
23012027Sjungma@eit.uni-kl.de    }
23112027Sjungma@eit.uni-kl.de}
23212027Sjungma@eit.uni-kl.de
23312027Sjungma@eit.uni-kl.de
23412027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
23512027Sjungma@eit.uni-kl.de//"sc_method_process::kill_process"
23612027Sjungma@eit.uni-kl.de//
23712027Sjungma@eit.uni-kl.de// This method removes throws a kill for this object instance. It calls the
23812027Sjungma@eit.uni-kl.de// sc_process_b::kill_process() method to perform low level clean up.
23912027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
24012027Sjungma@eit.uni-kl.devoid sc_method_process::kill_process(sc_descendant_inclusion_info descendants)
24112027Sjungma@eit.uni-kl.de{
24212027Sjungma@eit.uni-kl.de
24312027Sjungma@eit.uni-kl.de    // IF THE SIMULATION HAS NOT BEEN INITIALIZED YET THAT IS AN ERROR:
24412027Sjungma@eit.uni-kl.de
24512027Sjungma@eit.uni-kl.de    if ( sc_get_status() == SC_ELABORATION )
24612027Sjungma@eit.uni-kl.de    {
24712027Sjungma@eit.uni-kl.de        report_error( SC_ID_KILL_PROCESS_WHILE_UNITIALIZED_ );
24812027Sjungma@eit.uni-kl.de    }
24912027Sjungma@eit.uni-kl.de
25012027Sjungma@eit.uni-kl.de    // IF NEEDED, PROPOGATE THE KILL REQUEST THROUGH OUR DESCENDANTS:
25112027Sjungma@eit.uni-kl.de
25212027Sjungma@eit.uni-kl.de    if ( descendants == SC_INCLUDE_DESCENDANTS )
25312027Sjungma@eit.uni-kl.de    {
25412027Sjungma@eit.uni-kl.de        const std::vector<sc_object*> children = get_child_objects();
25512027Sjungma@eit.uni-kl.de        int                           child_n  = children.size();
25612027Sjungma@eit.uni-kl.de
25712027Sjungma@eit.uni-kl.de        for ( int child_i = 0; child_i < child_n; child_i++ )
25812027Sjungma@eit.uni-kl.de        {
25912027Sjungma@eit.uni-kl.de            sc_process_b* child_p = DCAST<sc_process_b*>(children[child_i]);
26012027Sjungma@eit.uni-kl.de            if ( child_p ) child_p->kill_process(descendants);
26112027Sjungma@eit.uni-kl.de        }
26212027Sjungma@eit.uni-kl.de    }
26312027Sjungma@eit.uni-kl.de
26412027Sjungma@eit.uni-kl.de    // IF THE PROCESS IS CURRENTLY UNWINDING OR IS ALREADY A ZOMBIE
26512027Sjungma@eit.uni-kl.de    // IGNORE THE KILL:
26612027Sjungma@eit.uni-kl.de
26712027Sjungma@eit.uni-kl.de    if ( m_unwinding )
26812027Sjungma@eit.uni-kl.de    {
26912027Sjungma@eit.uni-kl.de        SC_REPORT_WARNING( SC_ID_PROCESS_ALREADY_UNWINDING_, name() );
27012027Sjungma@eit.uni-kl.de        return;
27112027Sjungma@eit.uni-kl.de    }
27212027Sjungma@eit.uni-kl.de
27312027Sjungma@eit.uni-kl.de    if ( m_state & ps_bit_zombie )
27412027Sjungma@eit.uni-kl.de        return;
27512027Sjungma@eit.uni-kl.de
27612027Sjungma@eit.uni-kl.de
27712027Sjungma@eit.uni-kl.de    // REMOVE OUR PROCESS FROM EVENTS, ETC., AND IF ITS THE ACTIVE PROCESS
27812027Sjungma@eit.uni-kl.de    // THROW ITS KILL.
27912027Sjungma@eit.uni-kl.de    //
28012027Sjungma@eit.uni-kl.de    // Note we set the throw status to kill regardless if we throw or not.
28112027Sjungma@eit.uni-kl.de    // That lets check_for_throws stumble across it if we were in the call
28212027Sjungma@eit.uni-kl.de    // chain when the kill call occurred.
28312027Sjungma@eit.uni-kl.de
28412027Sjungma@eit.uni-kl.de    if ( next_runnable() != 0 )
28512027Sjungma@eit.uni-kl.de        simcontext()->remove_runnable_method( this );
28612027Sjungma@eit.uni-kl.de    disconnect_process();
28712027Sjungma@eit.uni-kl.de
28812027Sjungma@eit.uni-kl.de    m_throw_status = THROW_KILL;
28912027Sjungma@eit.uni-kl.de    if ( sc_get_current_process_b() == this )
29012027Sjungma@eit.uni-kl.de    {
29112027Sjungma@eit.uni-kl.de        throw sc_unwind_exception( this, false );
29212027Sjungma@eit.uni-kl.de    }
29312027Sjungma@eit.uni-kl.de}
29412027Sjungma@eit.uni-kl.de
29512027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
29612027Sjungma@eit.uni-kl.de//"sc_method_process::sc_method_process"
29712027Sjungma@eit.uni-kl.de//
29812027Sjungma@eit.uni-kl.de// This is the object instance constructor for this class.
29912027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
30012027Sjungma@eit.uni-kl.desc_method_process::sc_method_process( const char* name_p,
30112027Sjungma@eit.uni-kl.de    bool free_host, SC_ENTRY_FUNC method_p,
30212027Sjungma@eit.uni-kl.de    sc_process_host* host_p, const sc_spawn_options* opt_p
30312027Sjungma@eit.uni-kl.de):
30412027Sjungma@eit.uni-kl.de    sc_process_b(
30512027Sjungma@eit.uni-kl.de        name_p ? name_p : sc_gen_unique_name("method_p"),
30612027Sjungma@eit.uni-kl.de        false, free_host, method_p, host_p, opt_p),
30712027Sjungma@eit.uni-kl.de	m_cor(0), m_stack_size(0), m_monitor_q()
30812027Sjungma@eit.uni-kl.de{
30912027Sjungma@eit.uni-kl.de
31012027Sjungma@eit.uni-kl.de    // CHECK IF THIS IS AN sc_module-BASED PROCESS AND SIMUALTION HAS STARTED:
31112027Sjungma@eit.uni-kl.de
31212027Sjungma@eit.uni-kl.de    if ( DCAST<sc_module*>(host_p) != 0 && sc_is_running() )
31312027Sjungma@eit.uni-kl.de    {
31412027Sjungma@eit.uni-kl.de        report_error( SC_ID_MODULE_METHOD_AFTER_START_, "" );
31512027Sjungma@eit.uni-kl.de    }
31612027Sjungma@eit.uni-kl.de
31712027Sjungma@eit.uni-kl.de    // INITIALIZE VALUES:
31812027Sjungma@eit.uni-kl.de    //
31912027Sjungma@eit.uni-kl.de    // If there are spawn options use them.
32012027Sjungma@eit.uni-kl.de
32112027Sjungma@eit.uni-kl.de    m_process_kind = SC_METHOD_PROC_;
32212027Sjungma@eit.uni-kl.de    if (opt_p) {
32312027Sjungma@eit.uni-kl.de        m_dont_init = opt_p->m_dont_initialize;
32412027Sjungma@eit.uni-kl.de
32512027Sjungma@eit.uni-kl.de        // traverse event sensitivity list
32612027Sjungma@eit.uni-kl.de        for (unsigned int i = 0; i < opt_p->m_sensitive_events.size(); i++) {
32712027Sjungma@eit.uni-kl.de            sc_sensitive::make_static_sensitivity(
32812027Sjungma@eit.uni-kl.de                this, *opt_p->m_sensitive_events[i]);
32912027Sjungma@eit.uni-kl.de        }
33012027Sjungma@eit.uni-kl.de
33112027Sjungma@eit.uni-kl.de        // traverse port base sensitivity list
33212027Sjungma@eit.uni-kl.de        for ( unsigned int i = 0; i < opt_p->m_sensitive_port_bases.size(); i++)
33312027Sjungma@eit.uni-kl.de        {
33412027Sjungma@eit.uni-kl.de            sc_sensitive::make_static_sensitivity(
33512027Sjungma@eit.uni-kl.de                this, *opt_p->m_sensitive_port_bases[i]);
33612027Sjungma@eit.uni-kl.de        }
33712027Sjungma@eit.uni-kl.de
33812027Sjungma@eit.uni-kl.de        // traverse interface sensitivity list
33912027Sjungma@eit.uni-kl.de        for ( unsigned int i = 0; i < opt_p->m_sensitive_interfaces.size(); i++)
34012027Sjungma@eit.uni-kl.de        {
34112027Sjungma@eit.uni-kl.de            sc_sensitive::make_static_sensitivity(
34212027Sjungma@eit.uni-kl.de                this, *opt_p->m_sensitive_interfaces[i]);
34312027Sjungma@eit.uni-kl.de        }
34412027Sjungma@eit.uni-kl.de
34512027Sjungma@eit.uni-kl.de        // traverse event finder sensitivity list
34612027Sjungma@eit.uni-kl.de        for ( unsigned int i = 0; i < opt_p->m_sensitive_event_finders.size();
34712027Sjungma@eit.uni-kl.de            i++)
34812027Sjungma@eit.uni-kl.de        {
34912027Sjungma@eit.uni-kl.de            sc_sensitive::make_static_sensitivity(
35012027Sjungma@eit.uni-kl.de                this, *opt_p->m_sensitive_event_finders[i]);
35112027Sjungma@eit.uni-kl.de        }
35212027Sjungma@eit.uni-kl.de
35312027Sjungma@eit.uni-kl.de	// process any reset signal specification:
35412027Sjungma@eit.uni-kl.de
35512027Sjungma@eit.uni-kl.de	opt_p->specify_resets();
35612027Sjungma@eit.uni-kl.de    }
35712027Sjungma@eit.uni-kl.de
35812027Sjungma@eit.uni-kl.de    else
35912027Sjungma@eit.uni-kl.de    {
36012027Sjungma@eit.uni-kl.de        m_dont_init = false;
36112027Sjungma@eit.uni-kl.de    }
36212027Sjungma@eit.uni-kl.de}
36312027Sjungma@eit.uni-kl.de
36412027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
36512027Sjungma@eit.uni-kl.de//"sc_method_process::sc_method_process"
36612027Sjungma@eit.uni-kl.de//
36712027Sjungma@eit.uni-kl.de// This is the object instance destructor for this class.
36812027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
36912027Sjungma@eit.uni-kl.desc_method_process::~sc_method_process()
37012027Sjungma@eit.uni-kl.de{
37112027Sjungma@eit.uni-kl.de}
37212027Sjungma@eit.uni-kl.de
37312027Sjungma@eit.uni-kl.de
37412027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
37512027Sjungma@eit.uni-kl.de//"sc_method_process::suspend_process"
37612027Sjungma@eit.uni-kl.de//
37712027Sjungma@eit.uni-kl.de// This virtual method suspends this process and its children if requested to.
37812027Sjungma@eit.uni-kl.de//     descendants = indicator of whether this process' children should also
37912027Sjungma@eit.uni-kl.de//                   be suspended
38012027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
38112027Sjungma@eit.uni-kl.devoid sc_method_process::suspend_process(
38212027Sjungma@eit.uni-kl.de    sc_descendant_inclusion_info descendants )
38312027Sjungma@eit.uni-kl.de{
38412027Sjungma@eit.uni-kl.de
38512027Sjungma@eit.uni-kl.de    // IF NEEDED PROPOGATE THE SUSPEND REQUEST THROUGH OUR DESCENDANTS:
38612027Sjungma@eit.uni-kl.de
38712027Sjungma@eit.uni-kl.de    if ( descendants == SC_INCLUDE_DESCENDANTS )
38812027Sjungma@eit.uni-kl.de    {
38912027Sjungma@eit.uni-kl.de        const std::vector<sc_object*>& children = get_child_objects();
39012027Sjungma@eit.uni-kl.de        int                            child_n  = children.size();
39112027Sjungma@eit.uni-kl.de
39212027Sjungma@eit.uni-kl.de        for ( int child_i = 0; child_i < child_n; child_i++ )
39312027Sjungma@eit.uni-kl.de        {
39412027Sjungma@eit.uni-kl.de            sc_process_b* child_p = DCAST<sc_process_b*>(children[child_i]);
39512027Sjungma@eit.uni-kl.de            if ( child_p ) child_p->suspend_process(descendants);
39612027Sjungma@eit.uni-kl.de        }
39712027Sjungma@eit.uni-kl.de    }
39812027Sjungma@eit.uni-kl.de
39912027Sjungma@eit.uni-kl.de    // CORNER CASE CHECKS, THE FOLLOWING ARE ERRORS:
40012027Sjungma@eit.uni-kl.de    //   (a) if this method has a reset_signal_is specification
40112027Sjungma@eit.uni-kl.de    //   (b) if this method is in synchronous reset
40212027Sjungma@eit.uni-kl.de
40312027Sjungma@eit.uni-kl.de    if ( !sc_allow_process_control_corners && m_has_reset_signal )
40412027Sjungma@eit.uni-kl.de    {
40512027Sjungma@eit.uni-kl.de	report_error(SC_ID_PROCESS_CONTROL_CORNER_CASE_,
40612027Sjungma@eit.uni-kl.de		     "attempt to suspend a method that has a reset signal");
40712027Sjungma@eit.uni-kl.de    }
40812027Sjungma@eit.uni-kl.de    else if ( !sc_allow_process_control_corners && m_sticky_reset )
40912027Sjungma@eit.uni-kl.de    {
41012027Sjungma@eit.uni-kl.de	report_error(SC_ID_PROCESS_CONTROL_CORNER_CASE_,
41112027Sjungma@eit.uni-kl.de		     "attempt to suspend a method in synchronous reset");
41212027Sjungma@eit.uni-kl.de    }
41312027Sjungma@eit.uni-kl.de
41412027Sjungma@eit.uni-kl.de    // SUSPEND OUR OBJECT INSTANCE:
41512027Sjungma@eit.uni-kl.de    //
41612027Sjungma@eit.uni-kl.de    // (1) If we are on the runnable queue then set suspended and ready_to_run,
41712027Sjungma@eit.uni-kl.de    //     and remove ourselves from the run queue.
41812027Sjungma@eit.uni-kl.de    // (2) If this is a self-suspension then a resume should cause immediate
41912027Sjungma@eit.uni-kl.de    //     scheduling of the process.
42012027Sjungma@eit.uni-kl.de
42112027Sjungma@eit.uni-kl.de    m_state = m_state | ps_bit_suspended;
42212027Sjungma@eit.uni-kl.de    if ( next_runnable() != 0 )
42312027Sjungma@eit.uni-kl.de    {
42412027Sjungma@eit.uni-kl.de	m_state = m_state | ps_bit_ready_to_run;
42512027Sjungma@eit.uni-kl.de	simcontext()->remove_runnable_method( this );
42612027Sjungma@eit.uni-kl.de    }
42712027Sjungma@eit.uni-kl.de    if ( sc_get_current_process_b() == DCAST<sc_process_b*>(this)  )
42812027Sjungma@eit.uni-kl.de    {
42912027Sjungma@eit.uni-kl.de	m_state = m_state | ps_bit_ready_to_run;
43012027Sjungma@eit.uni-kl.de    }
43112027Sjungma@eit.uni-kl.de}
43212027Sjungma@eit.uni-kl.de
43312027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
43412027Sjungma@eit.uni-kl.de//"sc_method_process::resume_process"
43512027Sjungma@eit.uni-kl.de//
43612027Sjungma@eit.uni-kl.de// This method resumes the execution of this process, and if requested, its
43712027Sjungma@eit.uni-kl.de// descendants. If the process was suspended and has a resumption pending it
43812027Sjungma@eit.uni-kl.de// will be dispatched in the next delta cycle. Otherwise the state will be
43912027Sjungma@eit.uni-kl.de// adjusted to indicate it is no longer suspended, but no immediate execution
44012027Sjungma@eit.uni-kl.de// will occur.
44112027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
44212027Sjungma@eit.uni-kl.devoid sc_method_process::resume_process(
44312027Sjungma@eit.uni-kl.de    sc_descendant_inclusion_info descendants )
44412027Sjungma@eit.uni-kl.de{
44512027Sjungma@eit.uni-kl.de
44612027Sjungma@eit.uni-kl.de    // IF NEEDED PROPOGATE THE RESUME REQUEST THROUGH OUR DESCENDANTS:
44712027Sjungma@eit.uni-kl.de
44812027Sjungma@eit.uni-kl.de    if ( descendants == SC_INCLUDE_DESCENDANTS )
44912027Sjungma@eit.uni-kl.de    {
45012027Sjungma@eit.uni-kl.de        const std::vector<sc_object*>& children = get_child_objects();
45112027Sjungma@eit.uni-kl.de        int                            child_n  = children.size();
45212027Sjungma@eit.uni-kl.de
45312027Sjungma@eit.uni-kl.de        for ( int child_i = 0; child_i < child_n; child_i++ )
45412027Sjungma@eit.uni-kl.de        {
45512027Sjungma@eit.uni-kl.de            sc_process_b* child_p = DCAST<sc_process_b*>(children[child_i]);
45612027Sjungma@eit.uni-kl.de            if ( child_p ) child_p->resume_process(descendants);
45712027Sjungma@eit.uni-kl.de        }
45812027Sjungma@eit.uni-kl.de    }
45912027Sjungma@eit.uni-kl.de
46012027Sjungma@eit.uni-kl.de
46112027Sjungma@eit.uni-kl.de    // BY DEFAULT THE CORNER CASE IS AN ERROR:
46212027Sjungma@eit.uni-kl.de
46312027Sjungma@eit.uni-kl.de    if ( !sc_allow_process_control_corners && (m_state & ps_bit_disabled) &&
46412027Sjungma@eit.uni-kl.de         (m_state & ps_bit_suspended) )
46512027Sjungma@eit.uni-kl.de    {
46612027Sjungma@eit.uni-kl.de	m_state = m_state & ~ps_bit_suspended;
46712027Sjungma@eit.uni-kl.de        report_error( SC_ID_PROCESS_CONTROL_CORNER_CASE_,
46812027Sjungma@eit.uni-kl.de	              "call to resume() on a disabled suspended method");
46912027Sjungma@eit.uni-kl.de    }
47012027Sjungma@eit.uni-kl.de
47112027Sjungma@eit.uni-kl.de    // CLEAR THE SUSPENDED BIT:
47212027Sjungma@eit.uni-kl.de
47312027Sjungma@eit.uni-kl.de    m_state = m_state & ~ps_bit_suspended;
47412027Sjungma@eit.uni-kl.de
47512027Sjungma@eit.uni-kl.de    // RESUME OBJECT INSTANCE:
47612027Sjungma@eit.uni-kl.de    //
47712027Sjungma@eit.uni-kl.de    // If this is not a self-resume and the method is ready to run then
47812027Sjungma@eit.uni-kl.de    // put it on the runnable queue.
47912027Sjungma@eit.uni-kl.de
48012027Sjungma@eit.uni-kl.de    if ( m_state & ps_bit_ready_to_run )
48112027Sjungma@eit.uni-kl.de    {
48212027Sjungma@eit.uni-kl.de	m_state = m_state & ~ps_bit_ready_to_run;
48312027Sjungma@eit.uni-kl.de	if ( next_runnable() == 0 &&
48412027Sjungma@eit.uni-kl.de	   ( sc_get_current_process_b() != DCAST<sc_process_b*>(this) ) )
48512027Sjungma@eit.uni-kl.de        {
48612027Sjungma@eit.uni-kl.de	    simcontext()->push_runnable_method(this);
48712027Sjungma@eit.uni-kl.de	    remove_dynamic_events();
48812027Sjungma@eit.uni-kl.de	}
48912027Sjungma@eit.uni-kl.de    }
49012027Sjungma@eit.uni-kl.de}
49112027Sjungma@eit.uni-kl.de
49212027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
49312027Sjungma@eit.uni-kl.de//"sc_method_process::throw_reset"
49412027Sjungma@eit.uni-kl.de//
49512027Sjungma@eit.uni-kl.de// This virtual method is invoked to "throw" a reset.
49612027Sjungma@eit.uni-kl.de//
49712027Sjungma@eit.uni-kl.de// If the reset is synchronous this is a no-op, except for triggering the
49812027Sjungma@eit.uni-kl.de// reset event if it is present.
49912027Sjungma@eit.uni-kl.de//
50012027Sjungma@eit.uni-kl.de// If the reset is asynchronous we:
50112027Sjungma@eit.uni-kl.de//   (a) cancel any dynamic waits
50212027Sjungma@eit.uni-kl.de//   (b) if it is the active process actually throw a reset exception.
50312027Sjungma@eit.uni-kl.de//   (c) if it was not the active process and does not have a static
50412027Sjungma@eit.uni-kl.de//       sensitivity emit an error if corner cases are to be considered
50512027Sjungma@eit.uni-kl.de//       errors.
50612027Sjungma@eit.uni-kl.de//
50712027Sjungma@eit.uni-kl.de// Notes:
50812027Sjungma@eit.uni-kl.de//   (1) If the process had a reset event it will have been triggered in
50912027Sjungma@eit.uni-kl.de//       sc_process_b::semantics()
51012027Sjungma@eit.uni-kl.de//
51112027Sjungma@eit.uni-kl.de// Arguments:
51212027Sjungma@eit.uni-kl.de//   async = true if this is an asynchronous reset.
51312027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
51412027Sjungma@eit.uni-kl.devoid sc_method_process::throw_reset( bool async )
51512027Sjungma@eit.uni-kl.de{
51612027Sjungma@eit.uni-kl.de    // IF THE PROCESS IS CURRENTLY UNWINDING OR IS ALREADY A ZOMBIE
51712027Sjungma@eit.uni-kl.de    // IGNORE THE RESET:
51812027Sjungma@eit.uni-kl.de
51912027Sjungma@eit.uni-kl.de    if ( m_unwinding )
52012027Sjungma@eit.uni-kl.de    {
52112027Sjungma@eit.uni-kl.de        SC_REPORT_WARNING( SC_ID_PROCESS_ALREADY_UNWINDING_, name() );
52212027Sjungma@eit.uni-kl.de        return;
52312027Sjungma@eit.uni-kl.de    }
52412027Sjungma@eit.uni-kl.de
52512027Sjungma@eit.uni-kl.de    if ( m_state & ps_bit_zombie )
52612027Sjungma@eit.uni-kl.de        return;
52712027Sjungma@eit.uni-kl.de
52812027Sjungma@eit.uni-kl.de    // Set the throw status and if its an asynchronous reset throw an
52912027Sjungma@eit.uni-kl.de    // exception:
53012027Sjungma@eit.uni-kl.de
53112027Sjungma@eit.uni-kl.de    m_throw_status = async ? THROW_ASYNC_RESET : THROW_SYNC_RESET;
53212027Sjungma@eit.uni-kl.de    if ( async )
53312027Sjungma@eit.uni-kl.de    {
53412027Sjungma@eit.uni-kl.de        remove_dynamic_events();
53512027Sjungma@eit.uni-kl.de	if ( sc_get_current_process_b() == this )
53612027Sjungma@eit.uni-kl.de	{
53712027Sjungma@eit.uni-kl.de	    DEBUG_MSG(DEBUG_NAME,this,"throw_reset: throwing exception");
53812027Sjungma@eit.uni-kl.de	    m_throw_status = THROW_ASYNC_RESET;
53912027Sjungma@eit.uni-kl.de	    throw sc_unwind_exception( this, true );
54012027Sjungma@eit.uni-kl.de	}
54112027Sjungma@eit.uni-kl.de	else
54212027Sjungma@eit.uni-kl.de	{
54312027Sjungma@eit.uni-kl.de	    DEBUG_MSG(DEBUG_NAME,this,
54412027Sjungma@eit.uni-kl.de	              "throw_reset: queueing this method for execution");
54512027Sjungma@eit.uni-kl.de	    simcontext()->preempt_with(this);
54612027Sjungma@eit.uni-kl.de	}
54712027Sjungma@eit.uni-kl.de    }
54812027Sjungma@eit.uni-kl.de}
54912027Sjungma@eit.uni-kl.de
55012027Sjungma@eit.uni-kl.de
55112027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
55212027Sjungma@eit.uni-kl.de//"sc_method_process::throw_user"
55312027Sjungma@eit.uni-kl.de//
55412027Sjungma@eit.uni-kl.de// This virtual method is invoked when a user exception is to be thrown.
55512027Sjungma@eit.uni-kl.de// If requested it will also throw the exception to the children of this
55612027Sjungma@eit.uni-kl.de// object instance. Since this is a method no throw will occur for this
55712027Sjungma@eit.uni-kl.de// object instance. The children will be awakened from youngest child to
55812027Sjungma@eit.uni-kl.de// eldest.
55912027Sjungma@eit.uni-kl.de//     helper_p    -> object to use to throw the exception.
56012027Sjungma@eit.uni-kl.de//     descendants =  indicator of whether this process' children should also
56112027Sjungma@eit.uni-kl.de//                    be suspended
56212027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
56312027Sjungma@eit.uni-kl.devoid sc_method_process::throw_user( const sc_throw_it_helper& helper,
56412027Sjungma@eit.uni-kl.de    sc_descendant_inclusion_info descendants )
56512027Sjungma@eit.uni-kl.de{
56612027Sjungma@eit.uni-kl.de
56712027Sjungma@eit.uni-kl.de    // IF THE SIMULATION IS NOT ACTUALLY RUNNING THIS IS AN ERROR:
56812027Sjungma@eit.uni-kl.de
56912027Sjungma@eit.uni-kl.de    if (  sc_get_status() != SC_RUNNING )
57012027Sjungma@eit.uni-kl.de    {
57112027Sjungma@eit.uni-kl.de        report_error( SC_ID_THROW_IT_WHILE_NOT_RUNNING_ );
57212027Sjungma@eit.uni-kl.de    }
57312027Sjungma@eit.uni-kl.de
57412027Sjungma@eit.uni-kl.de    // IF NEEDED PROPOGATE THE THROW REQUEST THROUGH OUR DESCENDANTS:
57512027Sjungma@eit.uni-kl.de
57612027Sjungma@eit.uni-kl.de    if ( descendants == SC_INCLUDE_DESCENDANTS )
57712027Sjungma@eit.uni-kl.de    {
57812027Sjungma@eit.uni-kl.de        const std::vector<sc_object*> children = get_child_objects();
57912027Sjungma@eit.uni-kl.de        int                           child_n  = children.size();
58012027Sjungma@eit.uni-kl.de
58112027Sjungma@eit.uni-kl.de        for ( int child_i = 0; child_i < child_n; child_i++ )
58212027Sjungma@eit.uni-kl.de        {
58312027Sjungma@eit.uni-kl.de            sc_process_b* child_p = DCAST<sc_process_b*>(children[child_i]);
58412027Sjungma@eit.uni-kl.de            if ( child_p )
58512027Sjungma@eit.uni-kl.de	    {
58612027Sjungma@eit.uni-kl.de	        DEBUG_MSG(DEBUG_NAME,child_p,"about to throw user on");
58712027Sjungma@eit.uni-kl.de	        child_p->throw_user(helper, descendants);
58812027Sjungma@eit.uni-kl.de	    }
58912027Sjungma@eit.uni-kl.de        }
59012027Sjungma@eit.uni-kl.de    }
59112027Sjungma@eit.uni-kl.de
59212027Sjungma@eit.uni-kl.de#if 0 // shouldn't we throw, if we're currently running?
59312027Sjungma@eit.uni-kl.de
59412027Sjungma@eit.uni-kl.de    if ( sc_get_current_process_b() == (sc_process_b*)this )
59512027Sjungma@eit.uni-kl.de    {
59612027Sjungma@eit.uni-kl.de        remove_dynamic_events();
59712027Sjungma@eit.uni-kl.de        m_throw_status = THROW_USER;
59812027Sjungma@eit.uni-kl.de        if ( m_throw_helper_p != 0 ) delete m_throw_helper_p;
59912027Sjungma@eit.uni-kl.de        m_throw_helper_p = helper.clone();
60012027Sjungma@eit.uni-kl.de        m_throw_helper_p->throw_it();
60112027Sjungma@eit.uni-kl.de    }
60212027Sjungma@eit.uni-kl.de
60312027Sjungma@eit.uni-kl.de    // throw_it HAS NO EFFECT ON A METHOD, ISSUE A WARNING:
60412027Sjungma@eit.uni-kl.de
60512027Sjungma@eit.uni-kl.de    else
60612027Sjungma@eit.uni-kl.de
60712027Sjungma@eit.uni-kl.de#endif
60812027Sjungma@eit.uni-kl.de   {
60912027Sjungma@eit.uni-kl.de        SC_REPORT_WARNING( SC_ID_THROW_IT_IGNORED_, name() );
61012027Sjungma@eit.uni-kl.de   }
61112027Sjungma@eit.uni-kl.de
61212027Sjungma@eit.uni-kl.de
61312027Sjungma@eit.uni-kl.de}
61412027Sjungma@eit.uni-kl.de
61512027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
61612027Sjungma@eit.uni-kl.de//"sc_method_process::trigger_dynamic"
61712027Sjungma@eit.uni-kl.de//
61812027Sjungma@eit.uni-kl.de// This method sets up a dynamic trigger on an event.
61912027Sjungma@eit.uni-kl.de//
62012027Sjungma@eit.uni-kl.de// Notes:
62112027Sjungma@eit.uni-kl.de//   (1) This method is identical to sc_thread_process::trigger_dynamic(),
62212027Sjungma@eit.uni-kl.de//       but they cannot be combined as sc_process_b::trigger_dynamic()
62312027Sjungma@eit.uni-kl.de//       because the signatures things like sc_event::remove_dynamic()
62412027Sjungma@eit.uni-kl.de//       have different overloads for sc_method_process* and sc_thread_process*.
62512027Sjungma@eit.uni-kl.de//       So if you change code here you'll also need to change it in
62612027Sjungma@eit.uni-kl.de//       sc_thread_process.cpp.
62712027Sjungma@eit.uni-kl.de//
62812027Sjungma@eit.uni-kl.de// Result is true if this process should be removed from the event's list,
62912027Sjungma@eit.uni-kl.de// false if not.
63012027Sjungma@eit.uni-kl.de//
63112027Sjungma@eit.uni-kl.de// If the triggering process is the same process, the trigger is
63212027Sjungma@eit.uni-kl.de// ignored as well, unless SC_ENABLE_IMMEDIATE_SELF_NOTIFICATIONS
63312027Sjungma@eit.uni-kl.de// is defined.
63412027Sjungma@eit.uni-kl.de//------------------------------------------------------------------------------
63512027Sjungma@eit.uni-kl.debool sc_method_process::trigger_dynamic( sc_event* e )
63612027Sjungma@eit.uni-kl.de{
63712027Sjungma@eit.uni-kl.de    // No time outs yet, and keep gcc happy.
63812027Sjungma@eit.uni-kl.de
63912027Sjungma@eit.uni-kl.de    m_timed_out = false;
64012027Sjungma@eit.uni-kl.de
64112027Sjungma@eit.uni-kl.de    // Escape cases:
64212027Sjungma@eit.uni-kl.de    //   (a) If this method issued the notify() don't schedule it for
64312027Sjungma@eit.uni-kl.de    //       execution, but leave the sensitivity in place.
64412027Sjungma@eit.uni-kl.de    //   (b) If this method is already runnable can't trigger an event.
64512027Sjungma@eit.uni-kl.de
64612027Sjungma@eit.uni-kl.de#if ! defined( SC_ENABLE_IMMEDIATE_SELF_NOTIFICATIONS )
64712027Sjungma@eit.uni-kl.de    if( SC_UNLIKELY_( sc_get_current_process_b() == this ) )
64812027Sjungma@eit.uni-kl.de    {
64912027Sjungma@eit.uni-kl.de        report_immediate_self_notification();
65012027Sjungma@eit.uni-kl.de        return false;
65112027Sjungma@eit.uni-kl.de    }
65212027Sjungma@eit.uni-kl.de#endif // SC_ENABLE_IMMEDIATE_SELF_NOTIFICATIONS
65312027Sjungma@eit.uni-kl.de
65412027Sjungma@eit.uni-kl.de    if( is_runnable() )
65512027Sjungma@eit.uni-kl.de        return true;
65612027Sjungma@eit.uni-kl.de
65712027Sjungma@eit.uni-kl.de    // If a process is disabled then we ignore any events, leaving them enabled:
65812027Sjungma@eit.uni-kl.de    //
65912027Sjungma@eit.uni-kl.de    // But if this is a time out event we need to remove both it and the
66012027Sjungma@eit.uni-kl.de    // event that was being waited for.
66112027Sjungma@eit.uni-kl.de
66212027Sjungma@eit.uni-kl.de    if ( m_state & ps_bit_disabled )
66312027Sjungma@eit.uni-kl.de    {
66412027Sjungma@eit.uni-kl.de        if ( e == m_timeout_event_p )
66512027Sjungma@eit.uni-kl.de	{
66612027Sjungma@eit.uni-kl.de	    remove_dynamic_events( true );
66712027Sjungma@eit.uni-kl.de	    return true;
66812027Sjungma@eit.uni-kl.de	}
66912027Sjungma@eit.uni-kl.de	else
67012027Sjungma@eit.uni-kl.de	{
67112027Sjungma@eit.uni-kl.de	    return false;
67212027Sjungma@eit.uni-kl.de	}
67312027Sjungma@eit.uni-kl.de    }
67412027Sjungma@eit.uni-kl.de
67512027Sjungma@eit.uni-kl.de
67612027Sjungma@eit.uni-kl.de    // Process based on the event type and current process state:
67712027Sjungma@eit.uni-kl.de    //
67812027Sjungma@eit.uni-kl.de    // Every case needs to set 'rc' and continue on to the end of
67912027Sjungma@eit.uni-kl.de    // this method to allow suspend processing to work correctly.
68012027Sjungma@eit.uni-kl.de
68112027Sjungma@eit.uni-kl.de    switch( m_trigger_type )
68212027Sjungma@eit.uni-kl.de    {
68312027Sjungma@eit.uni-kl.de      case EVENT:
68412027Sjungma@eit.uni-kl.de	m_event_p = 0;
68512027Sjungma@eit.uni-kl.de	m_trigger_type = STATIC;
68612027Sjungma@eit.uni-kl.de	break;
68712027Sjungma@eit.uni-kl.de
68812027Sjungma@eit.uni-kl.de      case AND_LIST:
68912027Sjungma@eit.uni-kl.de        -- m_event_count;
69012027Sjungma@eit.uni-kl.de	if ( m_event_count == 0 )
69112027Sjungma@eit.uni-kl.de	{
69212027Sjungma@eit.uni-kl.de	    m_event_list_p->auto_delete();
69312027Sjungma@eit.uni-kl.de	    m_event_list_p = 0;
69412027Sjungma@eit.uni-kl.de	    m_trigger_type = STATIC;
69512027Sjungma@eit.uni-kl.de	}
69612027Sjungma@eit.uni-kl.de	else
69712027Sjungma@eit.uni-kl.de	{
69812027Sjungma@eit.uni-kl.de	    return true;
69912027Sjungma@eit.uni-kl.de	}
70012027Sjungma@eit.uni-kl.de	break;
70112027Sjungma@eit.uni-kl.de
70212027Sjungma@eit.uni-kl.de      case OR_LIST:
70312027Sjungma@eit.uni-kl.de	m_event_list_p->remove_dynamic( this, e );
70412027Sjungma@eit.uni-kl.de	m_event_list_p->auto_delete();
70512027Sjungma@eit.uni-kl.de	m_event_list_p = 0;
70612027Sjungma@eit.uni-kl.de	m_trigger_type = STATIC;
70712027Sjungma@eit.uni-kl.de	break;
70812027Sjungma@eit.uni-kl.de
70912027Sjungma@eit.uni-kl.de      case TIMEOUT:
71012027Sjungma@eit.uni-kl.de	m_trigger_type = STATIC;
71112027Sjungma@eit.uni-kl.de	break;
71212027Sjungma@eit.uni-kl.de
71312027Sjungma@eit.uni-kl.de      case EVENT_TIMEOUT:
71412027Sjungma@eit.uni-kl.de        if ( e == m_timeout_event_p )
71512027Sjungma@eit.uni-kl.de	{
71612027Sjungma@eit.uni-kl.de	    m_timed_out = true;
71712027Sjungma@eit.uni-kl.de	    m_event_p->remove_dynamic( this );
71812027Sjungma@eit.uni-kl.de	    m_event_p = 0;
71912027Sjungma@eit.uni-kl.de	    m_trigger_type = STATIC;
72012027Sjungma@eit.uni-kl.de	}
72112027Sjungma@eit.uni-kl.de	else
72212027Sjungma@eit.uni-kl.de	{
72312027Sjungma@eit.uni-kl.de	    m_timeout_event_p->cancel();
72412027Sjungma@eit.uni-kl.de	    m_timeout_event_p->reset();
72512027Sjungma@eit.uni-kl.de	    m_event_p = 0;
72612027Sjungma@eit.uni-kl.de	    m_trigger_type = STATIC;
72712027Sjungma@eit.uni-kl.de	}
72812027Sjungma@eit.uni-kl.de	break;
72912027Sjungma@eit.uni-kl.de
73012027Sjungma@eit.uni-kl.de      case OR_LIST_TIMEOUT:
73112027Sjungma@eit.uni-kl.de        if ( e == m_timeout_event_p )
73212027Sjungma@eit.uni-kl.de	{
73312027Sjungma@eit.uni-kl.de            m_timed_out = true;
73412027Sjungma@eit.uni-kl.de            m_event_list_p->remove_dynamic( this, e );
73512027Sjungma@eit.uni-kl.de            m_event_list_p->auto_delete();
73612027Sjungma@eit.uni-kl.de            m_event_list_p = 0;
73712027Sjungma@eit.uni-kl.de            m_trigger_type = STATIC;
73812027Sjungma@eit.uni-kl.de	}
73912027Sjungma@eit.uni-kl.de
74012027Sjungma@eit.uni-kl.de	else
74112027Sjungma@eit.uni-kl.de	{
74212027Sjungma@eit.uni-kl.de            m_timeout_event_p->cancel();
74312027Sjungma@eit.uni-kl.de            m_timeout_event_p->reset();
74412027Sjungma@eit.uni-kl.de	    m_event_list_p->remove_dynamic( this, e );
74512027Sjungma@eit.uni-kl.de	    m_event_list_p->auto_delete();
74612027Sjungma@eit.uni-kl.de	    m_event_list_p = 0;
74712027Sjungma@eit.uni-kl.de	    m_trigger_type = STATIC;
74812027Sjungma@eit.uni-kl.de	}
74912027Sjungma@eit.uni-kl.de	break;
75012027Sjungma@eit.uni-kl.de
75112027Sjungma@eit.uni-kl.de      case AND_LIST_TIMEOUT:
75212027Sjungma@eit.uni-kl.de        if ( e == m_timeout_event_p )
75312027Sjungma@eit.uni-kl.de	{
75412027Sjungma@eit.uni-kl.de            m_timed_out = true;
75512027Sjungma@eit.uni-kl.de            m_event_list_p->remove_dynamic( this, e );
75612027Sjungma@eit.uni-kl.de            m_event_list_p->auto_delete();
75712027Sjungma@eit.uni-kl.de            m_event_list_p = 0;
75812027Sjungma@eit.uni-kl.de            m_trigger_type = STATIC;
75912027Sjungma@eit.uni-kl.de	}
76012027Sjungma@eit.uni-kl.de
76112027Sjungma@eit.uni-kl.de	else
76212027Sjungma@eit.uni-kl.de	{
76312027Sjungma@eit.uni-kl.de	    -- m_event_count;
76412027Sjungma@eit.uni-kl.de	    if ( m_event_count == 0 )
76512027Sjungma@eit.uni-kl.de	    {
76612027Sjungma@eit.uni-kl.de		m_timeout_event_p->cancel();
76712027Sjungma@eit.uni-kl.de		m_timeout_event_p->reset();
76812027Sjungma@eit.uni-kl.de		// no need to remove_dynamic
76912027Sjungma@eit.uni-kl.de		m_event_list_p->auto_delete();
77012027Sjungma@eit.uni-kl.de		m_event_list_p = 0;
77112027Sjungma@eit.uni-kl.de		m_trigger_type = STATIC;
77212027Sjungma@eit.uni-kl.de	    }
77312027Sjungma@eit.uni-kl.de	    else
77412027Sjungma@eit.uni-kl.de	    {
77512027Sjungma@eit.uni-kl.de	        return true;
77612027Sjungma@eit.uni-kl.de	    }
77712027Sjungma@eit.uni-kl.de	}
77812027Sjungma@eit.uni-kl.de	break;
77912027Sjungma@eit.uni-kl.de
78012027Sjungma@eit.uni-kl.de      case STATIC: {
78112027Sjungma@eit.uni-kl.de        // we should never get here, but throw_it() can make it happen.
78212027Sjungma@eit.uni-kl.de	SC_REPORT_WARNING(SC_ID_NOT_EXPECTING_DYNAMIC_EVENT_NOTIFY_, name());
78312027Sjungma@eit.uni-kl.de        return true;
78412027Sjungma@eit.uni-kl.de      }
78512027Sjungma@eit.uni-kl.de    }
78612027Sjungma@eit.uni-kl.de
78712027Sjungma@eit.uni-kl.de    // If we get here then the method has satisfied its next_trigger, if its
78812027Sjungma@eit.uni-kl.de    // suspended mark its state as ready to run. If its not suspended then push
78912027Sjungma@eit.uni-kl.de    // it onto the runnable queue.
79012027Sjungma@eit.uni-kl.de
79112027Sjungma@eit.uni-kl.de    if ( (m_state & ps_bit_suspended) )
79212027Sjungma@eit.uni-kl.de    {
79312027Sjungma@eit.uni-kl.de	m_state = m_state | ps_bit_ready_to_run;
79412027Sjungma@eit.uni-kl.de    }
79512027Sjungma@eit.uni-kl.de    else
79612027Sjungma@eit.uni-kl.de    {
79712027Sjungma@eit.uni-kl.de        simcontext()->push_runnable_method(this);
79812027Sjungma@eit.uni-kl.de    }
79912027Sjungma@eit.uni-kl.de
80012027Sjungma@eit.uni-kl.de    return true;
80112027Sjungma@eit.uni-kl.de}
80212027Sjungma@eit.uni-kl.de
80312027Sjungma@eit.uni-kl.de} // namespace sc_core
80412027Sjungma@eit.uni-kl.de
80512027Sjungma@eit.uni-kl.de
80612027Sjungma@eit.uni-kl.de/*****************************************************************************
80712027Sjungma@eit.uni-kl.de
80812027Sjungma@eit.uni-kl.de  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
80912027Sjungma@eit.uni-kl.de  changes you are making here.
81012027Sjungma@eit.uni-kl.de
81112027Sjungma@eit.uni-kl.de      Name, Affiliation, Date:
81212027Sjungma@eit.uni-kl.de  Description of Modification:
81312027Sjungma@eit.uni-kl.de
81412027Sjungma@eit.uni-kl.de *****************************************************************************/
81512027Sjungma@eit.uni-kl.de
81612027Sjungma@eit.uni-kl.de// $Log: sc_method_process.cpp,v $
81712027Sjungma@eit.uni-kl.de// Revision 1.49  2011/08/29 18:24:47  acg
81812027Sjungma@eit.uni-kl.de//  Andy Goodrich: remove temporary comment flagging new preempt_with() call.
81912027Sjungma@eit.uni-kl.de//
82012027Sjungma@eit.uni-kl.de// Revision 1.48  2011/08/29 18:04:32  acg
82112027Sjungma@eit.uni-kl.de//  Philipp A. Hartmann: miscellaneous clean ups.
82212027Sjungma@eit.uni-kl.de//
82312027Sjungma@eit.uni-kl.de// Revision 1.47  2011/08/24 22:05:50  acg
82412027Sjungma@eit.uni-kl.de//  Torsten Maehne: initialization changes to remove warnings.
82512027Sjungma@eit.uni-kl.de//
82612027Sjungma@eit.uni-kl.de// Revision 1.46  2011/08/07 19:08:04  acg
82712027Sjungma@eit.uni-kl.de//  Andy Goodrich: moved logs to end of file so line number synching works
82812027Sjungma@eit.uni-kl.de//  better between versions.
82912027Sjungma@eit.uni-kl.de//
83012027Sjungma@eit.uni-kl.de// Revision 1.45  2011/07/29 22:42:45  acg
83112027Sjungma@eit.uni-kl.de//  Andy Goodrich: added check_for_throws() to fix case where a method is
83212027Sjungma@eit.uni-kl.de//  deleted by a process it resets or kills so that it can throw itself.
83312027Sjungma@eit.uni-kl.de//  Philipp A. Hartmann: changes to handle case where a process control
83412027Sjungma@eit.uni-kl.de//  invocation on a child process causes the list of child processes to change.
83512027Sjungma@eit.uni-kl.de//
83612027Sjungma@eit.uni-kl.de// Revision 1.44  2011/07/24 11:27:04  acg
83712027Sjungma@eit.uni-kl.de//  Andy Goodrich: moved the check for unwinding processes until after the
83812027Sjungma@eit.uni-kl.de//  descendants have been processed in throw_user and kill.
83912027Sjungma@eit.uni-kl.de//
84012027Sjungma@eit.uni-kl.de// Revision 1.43  2011/07/24 11:20:03  acg
84112027Sjungma@eit.uni-kl.de//  Philipp A. Hartmann: process control error message improvements:
84212027Sjungma@eit.uni-kl.de//  (1) Downgrade error to warning for re-kills of processes.
84312027Sjungma@eit.uni-kl.de//  (2) Add process name to process messages.
84412027Sjungma@eit.uni-kl.de//  (3) drop some superfluous colons in messages.
84512027Sjungma@eit.uni-kl.de//
84612027Sjungma@eit.uni-kl.de// Revision 1.42  2011/05/05 17:45:27  acg
84712027Sjungma@eit.uni-kl.de//  Philip A. Hartmann: changes in WIN64 support.
84812027Sjungma@eit.uni-kl.de//  Andy Goodrich: additional DEBUG_MSG instances to trace process handling.
84912027Sjungma@eit.uni-kl.de//
85012027Sjungma@eit.uni-kl.de// Revision 1.41  2011/04/19 19:15:41  acg
85112027Sjungma@eit.uni-kl.de//  Andy Goodrich: fix so warning message is always issued for a throw_it()
85212027Sjungma@eit.uni-kl.de//  on a method process.
85312027Sjungma@eit.uni-kl.de//
85412027Sjungma@eit.uni-kl.de// Revision 1.40  2011/04/19 15:04:27  acg
85512027Sjungma@eit.uni-kl.de//  Philipp A. Hartmann: clean up SC_ID messages.
85612027Sjungma@eit.uni-kl.de//
85712027Sjungma@eit.uni-kl.de// Revision 1.39  2011/04/19 02:39:09  acg
85812027Sjungma@eit.uni-kl.de//  Philipp A. Hartmann: added checks for additional throws during stack unwinds.
85912027Sjungma@eit.uni-kl.de//
86012027Sjungma@eit.uni-kl.de// Revision 1.38  2011/04/13 02:41:34  acg
86112027Sjungma@eit.uni-kl.de//  Andy Goodrich: eliminate warning messages generated when the DEBUG_MSG
86212027Sjungma@eit.uni-kl.de//  macro is used.
86312027Sjungma@eit.uni-kl.de//
86412027Sjungma@eit.uni-kl.de// Revision 1.37  2011/04/11 22:10:46  acg
86512027Sjungma@eit.uni-kl.de//  Andy Goodrich:
86612027Sjungma@eit.uni-kl.de//    (1) Add DEBUG_MSG macro and use it to generate a journal of method
86712027Sjungma@eit.uni-kl.de//        throws if it is enabled.
86812027Sjungma@eit.uni-kl.de//    (2) Trim down to the expected behavior of scheduling a method that
86912027Sjungma@eit.uni-kl.de//        is asynchronously reset in anticipation of IEEE 1666 being revised.
87012027Sjungma@eit.uni-kl.de//
87112027Sjungma@eit.uni-kl.de// Revision 1.36  2011/04/10 22:15:29  acg
87212027Sjungma@eit.uni-kl.de//  Andy Goodrich: change to call methods on asynchronous reset.
87312027Sjungma@eit.uni-kl.de//
87412027Sjungma@eit.uni-kl.de// Revision 1.35  2011/04/08 22:31:40  acg
87512027Sjungma@eit.uni-kl.de//  Andy Goodrich: removed unused code.
87612027Sjungma@eit.uni-kl.de//
87712027Sjungma@eit.uni-kl.de// Revision 1.34  2011/04/08 18:24:07  acg
87812027Sjungma@eit.uni-kl.de//  Andy Goodrich: fix asynchronous reset dispatch and when the reset_event()
87912027Sjungma@eit.uni-kl.de//  is fired.
88012027Sjungma@eit.uni-kl.de//
88112027Sjungma@eit.uni-kl.de// Revision 1.33  2011/04/05 20:50:56  acg
88212027Sjungma@eit.uni-kl.de//  Andy Goodrich:
88312027Sjungma@eit.uni-kl.de//    (1) changes to make sure that event(), posedge() and negedge() only
88412027Sjungma@eit.uni-kl.de//        return true if the clock has not moved.
88512027Sjungma@eit.uni-kl.de//    (2) fixes for method self-resumes.
88612027Sjungma@eit.uni-kl.de//    (3) added SC_PRERELEASE_VERSION
88712027Sjungma@eit.uni-kl.de//    (4) removed kernel events from the object hierarchy, added
88812027Sjungma@eit.uni-kl.de//        sc_hierarchy_name_exists().
88912027Sjungma@eit.uni-kl.de//
89012027Sjungma@eit.uni-kl.de// Revision 1.32  2011/04/01 22:30:39  acg
89112027Sjungma@eit.uni-kl.de//  Andy Goodrich: change hard assertion to warning for trigger_dynamic()
89212027Sjungma@eit.uni-kl.de//  getting called when there is only STATIC sensitivity. This can result
89312027Sjungma@eit.uni-kl.de//  because of sc_process_handle::throw_it().
89412027Sjungma@eit.uni-kl.de//
89512027Sjungma@eit.uni-kl.de// Revision 1.31  2011/03/28 13:02:51  acg
89612027Sjungma@eit.uni-kl.de//  Andy Goodrich: Changes for disable() interactions.
89712027Sjungma@eit.uni-kl.de//
89812027Sjungma@eit.uni-kl.de// Revision 1.30  2011/03/23 16:17:52  acg
89912027Sjungma@eit.uni-kl.de//  Andy Goodrich: don't emit an error message for a resume on a disabled
90012027Sjungma@eit.uni-kl.de//  process that is not suspended.
90112027Sjungma@eit.uni-kl.de//
90212027Sjungma@eit.uni-kl.de// Revision 1.29  2011/03/20 13:43:23  acg
90312027Sjungma@eit.uni-kl.de//  Andy Goodrich: added async_signal_is() plus suspend() as a corner case.
90412027Sjungma@eit.uni-kl.de//
90512027Sjungma@eit.uni-kl.de// Revision 1.28  2011/03/08 20:49:30  acg
90612027Sjungma@eit.uni-kl.de//  Andy Goodrich: implement coarse checking for synchronous reset - suspend
90712027Sjungma@eit.uni-kl.de//  interaction.
90812027Sjungma@eit.uni-kl.de//
90912027Sjungma@eit.uni-kl.de// Revision 1.27  2011/03/08 20:32:28  acg
91012027Sjungma@eit.uni-kl.de//  Andy Goodrich: implemented "coarse" checking for undefined process
91112027Sjungma@eit.uni-kl.de//  control interactions.
91212027Sjungma@eit.uni-kl.de//
91312027Sjungma@eit.uni-kl.de// Revision 1.26  2011/03/07 18:25:19  acg
91412027Sjungma@eit.uni-kl.de//  Andy Goodrich: tightening of check for resume on a disabled process to
91512027Sjungma@eit.uni-kl.de//  only produce an error if it is ready to run.
91612027Sjungma@eit.uni-kl.de//
91712027Sjungma@eit.uni-kl.de// Revision 1.25  2011/03/07 17:38:43  acg
91812027Sjungma@eit.uni-kl.de//  Andy Goodrich: tightening up of checks for undefined interaction between
91912027Sjungma@eit.uni-kl.de//  synchronous reset and suspend.
92012027Sjungma@eit.uni-kl.de//
92112027Sjungma@eit.uni-kl.de// Revision 1.24  2011/03/06 23:30:13  acg
92212027Sjungma@eit.uni-kl.de//  Andy Goodrich: refining suspend - sync reset corner case checking so that
92312027Sjungma@eit.uni-kl.de//  the following are error situations:
92412027Sjungma@eit.uni-kl.de//    (1) Calling suspend on a process with a reset_signal_is() specification
92512027Sjungma@eit.uni-kl.de//        or sync_reset_on() is active.
92612027Sjungma@eit.uni-kl.de//    (2) Calling sync_reset_on() on a suspended process.
92712027Sjungma@eit.uni-kl.de//
92812027Sjungma@eit.uni-kl.de// Revision 1.23  2011/03/06 19:57:11  acg
92912027Sjungma@eit.uni-kl.de//  Andy Goodrich: refinements for the illegal suspend - synchronous reset
93012027Sjungma@eit.uni-kl.de//  interaction.
93112027Sjungma@eit.uni-kl.de//
93212027Sjungma@eit.uni-kl.de// Revision 1.22  2011/03/06 16:47:09  acg
93312027Sjungma@eit.uni-kl.de//  Andy Goodrich: changes for testing sync_reset - suspend corner cases.
93412027Sjungma@eit.uni-kl.de//
93512027Sjungma@eit.uni-kl.de// Revision 1.21  2011/03/06 15:57:08  acg
93612027Sjungma@eit.uni-kl.de//  Andy Goodrich: added process control corner case checks.
93712027Sjungma@eit.uni-kl.de//
93812027Sjungma@eit.uni-kl.de// Revision 1.20  2011/03/05 19:44:20  acg
93912027Sjungma@eit.uni-kl.de//  Andy Goodrich: changes for object and event naming and structures.
94012027Sjungma@eit.uni-kl.de//
94112027Sjungma@eit.uni-kl.de// Revision 1.19  2011/02/18 20:27:14  acg
94212027Sjungma@eit.uni-kl.de//  Andy Goodrich: Updated Copyrights.
94312027Sjungma@eit.uni-kl.de//
94412027Sjungma@eit.uni-kl.de// Revision 1.18  2011/02/17 19:50:43  acg
94512027Sjungma@eit.uni-kl.de//  Andy Goodrich:
94612027Sjungma@eit.uni-kl.de//    (1) Changed signature of trigger_dynamic back to a bool.
94712027Sjungma@eit.uni-kl.de//    (2) Added run queue processing into trigger dynamic.
94812027Sjungma@eit.uni-kl.de//    (3) Simplified process control support.
94912027Sjungma@eit.uni-kl.de//
95012027Sjungma@eit.uni-kl.de// Revision 1.17  2011/02/16 22:37:30  acg
95112027Sjungma@eit.uni-kl.de//  Andy Goodrich: clean up to remove need for ps_disable_pending.
95212027Sjungma@eit.uni-kl.de//
95312027Sjungma@eit.uni-kl.de// Revision 1.16  2011/02/13 23:09:58  acg
95412027Sjungma@eit.uni-kl.de//  Andy Goodrich: only remove dynamic events for asynchronous resets.
95512027Sjungma@eit.uni-kl.de//
95612027Sjungma@eit.uni-kl.de// Revision 1.15  2011/02/13 21:47:37  acg
95712027Sjungma@eit.uni-kl.de//  Andy Goodrich: update copyright notice.
95812027Sjungma@eit.uni-kl.de//
95912027Sjungma@eit.uni-kl.de// Revision 1.14  2011/02/13 21:31:02  acg
96012027Sjungma@eit.uni-kl.de//  Andy Goodrich: added error messages for throws when simulator has not
96112027Sjungma@eit.uni-kl.de//  been initialized. Added missing remove_dynamic_events() call to the
96212027Sjungma@eit.uni-kl.de//  reset code.
96312027Sjungma@eit.uni-kl.de//
96412027Sjungma@eit.uni-kl.de// Revision 1.13  2011/02/11 13:25:24  acg
96512027Sjungma@eit.uni-kl.de//  Andy Goodrich: Philipp A. Hartmann's changes:
96612027Sjungma@eit.uni-kl.de//    (1) Removal of SC_CTHREAD method overloads.
96712027Sjungma@eit.uni-kl.de//    (2) New exception processing code.
96812027Sjungma@eit.uni-kl.de//
96912027Sjungma@eit.uni-kl.de// Revision 1.12  2011/02/07 19:17:20  acg
97012027Sjungma@eit.uni-kl.de//  Andy Goodrich: changes for IEEE 1666 compatibility.
97112027Sjungma@eit.uni-kl.de//
97212027Sjungma@eit.uni-kl.de// Revision 1.11  2011/02/04 15:27:36  acg
97312027Sjungma@eit.uni-kl.de//  Andy Goodrich: changes for suspend-resume semantics.
97412027Sjungma@eit.uni-kl.de//
97512027Sjungma@eit.uni-kl.de// Revision 1.10  2011/02/01 23:01:53  acg
97612027Sjungma@eit.uni-kl.de//  Andy Goodrich: removed dead code.
97712027Sjungma@eit.uni-kl.de//
97812027Sjungma@eit.uni-kl.de// Revision 1.9  2011/02/01 21:05:05  acg
97912027Sjungma@eit.uni-kl.de//  Andy Goodrich: Changes in trigger_dynamic methods to handle new
98012027Sjungma@eit.uni-kl.de//  process control rules about event sensitivity.
98112027Sjungma@eit.uni-kl.de//
98212027Sjungma@eit.uni-kl.de// Revision 1.8  2011/01/25 20:50:37  acg
98312027Sjungma@eit.uni-kl.de//  Andy Goodrich: changes for IEEE 1666 2011.
98412027Sjungma@eit.uni-kl.de//
98512027Sjungma@eit.uni-kl.de// Revision 1.7  2011/01/18 20:10:44  acg
98612027Sjungma@eit.uni-kl.de//  Andy Goodrich: changes for IEEE1666_2011 semantics.
98712027Sjungma@eit.uni-kl.de//
98812027Sjungma@eit.uni-kl.de// Revision 1.6  2011/01/06 18:02:43  acg
98912027Sjungma@eit.uni-kl.de//  Andy Goodrich: added check for ps_disabled to method_dynamic().
99012027Sjungma@eit.uni-kl.de//
99112027Sjungma@eit.uni-kl.de// Revision 1.5  2010/11/20 17:10:56  acg
99212027Sjungma@eit.uni-kl.de//  Andy Goodrich: reset processing changes for new IEEE 1666 standard.
99312027Sjungma@eit.uni-kl.de//
99412027Sjungma@eit.uni-kl.de// Revision 1.4  2010/07/22 20:02:33  acg
99512027Sjungma@eit.uni-kl.de//  Andy Goodrich: bug fixes.
99612027Sjungma@eit.uni-kl.de//
99712027Sjungma@eit.uni-kl.de// Revision 1.3  2009/05/22 16:06:29  acg
99812027Sjungma@eit.uni-kl.de//  Andy Goodrich: process control updates.
99912027Sjungma@eit.uni-kl.de//
100012027Sjungma@eit.uni-kl.de// Revision 1.2  2008/05/22 17:06:25  acg
100112027Sjungma@eit.uni-kl.de//  Andy Goodrich: updated copyright notice to include 2008.
100212027Sjungma@eit.uni-kl.de//
100312027Sjungma@eit.uni-kl.de// Revision 1.1.1.1  2006/12/15 20:20:05  acg
100412027Sjungma@eit.uni-kl.de// SystemC 2.3
100512027Sjungma@eit.uni-kl.de//
100612027Sjungma@eit.uni-kl.de// Revision 1.7  2006/04/20 17:08:16  acg
100712027Sjungma@eit.uni-kl.de//  Andy Goodrich: 3.0 style process changes.
100812027Sjungma@eit.uni-kl.de//
100912027Sjungma@eit.uni-kl.de// Revision 1.6  2006/04/11 23:13:20  acg
101012027Sjungma@eit.uni-kl.de//   Andy Goodrich: Changes for reduced reset support that only includes
101112027Sjungma@eit.uni-kl.de//   sc_cthread, but has preliminary hooks for expanding to method and thread
101212027Sjungma@eit.uni-kl.de//   processes also.
101312027Sjungma@eit.uni-kl.de//
101412027Sjungma@eit.uni-kl.de// Revision 1.5  2006/01/26 21:04:54  acg
101512027Sjungma@eit.uni-kl.de//  Andy Goodrich: deprecation message changes and additional messages.
101612027Sjungma@eit.uni-kl.de//
101712027Sjungma@eit.uni-kl.de// Revision 1.4  2006/01/24 20:49:05  acg
101812027Sjungma@eit.uni-kl.de// Andy Goodrich: changes to remove the use of deprecated features within the
101912027Sjungma@eit.uni-kl.de// simulator, and to issue warning messages when deprecated features are used.
102012027Sjungma@eit.uni-kl.de//
102112027Sjungma@eit.uni-kl.de// Revision 1.3  2006/01/13 18:44:29  acg
102212027Sjungma@eit.uni-kl.de// Added $Log to record CVS changes into the source.
102312027Sjungma@eit.uni-kl.de//
1024