1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22  sc_spawn_options.h -- Process spawning options specification.
23
24  Original Authors: Andy Goodrich, Forte Design Systems, 17 June 2003
25                    Stuart Swan, Cadence,
26                    Bishnupriya Bhattacharya, Cadence Design Systems,
27                    25 August, 2003
28
29  CHANGE LOG AT THE END OF THE FILE
30 *****************************************************************************/
31
32#if !defined(sc_spawn_options_h_INCLUDED)
33#define sc_spawn_options_h_INCLUDED
34
35#include <vector>
36#include "sysc/communication/sc_export.h"
37#include "sysc/communication/sc_signal_ports.h"
38
39namespace sc_core {
40
41class sc_event;
42class sc_port_base;
43class sc_interface;
44class sc_event_finder;
45class sc_process_b;
46class sc_spawn_reset_base;
47
48//=============================================================================
49// CLASS sc_spawn_options
50//
51//=============================================================================
52class sc_spawn_options {
53    friend class sc_cthread_process;
54    friend class sc_method_process;
55    friend class sc_process_b;
56    friend class sc_thread_process;
57  public:
58    sc_spawn_options() :
59        m_dont_initialize(false), m_resets(), m_sensitive_events(),
60        m_sensitive_event_finders(), m_sensitive_interfaces(),
61        m_sensitive_port_bases(), m_spawn_method(false), m_stack_size(0)
62        { }
63
64    ~sc_spawn_options();
65
66    void async_reset_signal_is( const sc_in<bool>&,           bool level );
67    void async_reset_signal_is( const sc_inout<bool>&,        bool level );
68    void async_reset_signal_is( const sc_out<bool>&,          bool level );
69    void async_reset_signal_is( const sc_signal_in_if<bool>&, bool level );
70
71    void reset_signal_is( const sc_in<bool>&,           bool level );
72    void reset_signal_is( const sc_inout<bool>&,        bool level );
73    void reset_signal_is( const sc_out<bool>&,          bool level );
74    void reset_signal_is( const sc_signal_in_if<bool>&, bool level );
75
76    void dont_initialize()   { m_dont_initialize = true; }
77
78    bool is_method() const   { return m_spawn_method; }
79
80    void set_stack_size(int stack_size) { m_stack_size = stack_size; }
81
82    void set_sensitivity(const sc_event* event)
83        { m_sensitive_events.push_back(event); }
84
85    void set_sensitivity(sc_port_base* port_base)
86        { m_sensitive_port_bases.push_back(port_base); }
87
88    void set_sensitivity(sc_interface* interface_p)
89        { m_sensitive_interfaces.push_back(interface_p); }
90
91    void set_sensitivity(sc_export_base* export_base)
92        { m_sensitive_interfaces.push_back(export_base->get_interface()); }
93
94    void set_sensitivity(sc_event_finder* event_finder)
95        { m_sensitive_event_finders.push_back(event_finder); }
96
97    void spawn_method()                 { m_spawn_method = true; }
98
99  protected:
100    void specify_resets() const;
101
102  private:
103    sc_spawn_options( const sc_spawn_options& );
104    const sc_spawn_options& operator = ( const sc_spawn_options& );
105
106  protected:
107    bool                               m_dont_initialize;
108    std::vector<sc_spawn_reset_base*>  m_resets;
109    std::vector<const sc_event*>       m_sensitive_events;
110    std::vector<sc_event_finder*>      m_sensitive_event_finders;
111    std::vector<sc_interface*>         m_sensitive_interfaces;
112    std::vector<sc_port_base*>         m_sensitive_port_bases;
113    bool                               m_spawn_method; // Method not thread.
114    int                                m_stack_size;   // Thread stack size.
115};
116
117} // namespace sc_core
118
119// $Log: sc_spawn_options.h,v $
120// Revision 1.11  2011/08/26 20:46:11  acg
121//  Andy Goodrich: moved the modification log to the end of the file to
122//  eliminate source line number skew when check-ins are done.
123//
124// Revision 1.10  2011/08/24 22:05:51  acg
125//  Torsten Maehne: initialization changes to remove warnings.
126//
127// Revision 1.9  2011/02/18 20:27:14  acg
128//  Andy Goodrich: Updated Copyrights.
129//
130// Revision 1.8  2011/02/13 21:47:38  acg
131//  Andy Goodrich: update copyright notice.
132//
133// Revision 1.7  2011/02/07 19:17:20  acg
134//  Andy Goodrich: changes for IEEE 1666 compatibility.
135//
136// Revision 1.6  2010/12/07 20:09:15  acg
137// Andy Goodrich: replaced sc_signal signatures with sc_signal_in_if signatures for reset methods.
138//
139// Revision 1.5  2010/11/20 17:10:57  acg
140//  Andy Goodrich: reset processing changes for new IEEE 1666 standard.
141//
142// Revision 1.4  2009/05/22 16:06:29  acg
143//  Andy Goodrich: process control updates.
144//
145// Revision 1.3  2009/02/28 00:26:58  acg
146//  Andy Goodrich: changed boost name space to sc_boost to allow use with
147//  full boost library applications.
148//
149// Revision 1.2  2008/05/22 17:06:26  acg
150//  Andy Goodrich: updated copyright notice to include 2008.
151//
152// Revision 1.1.1.1  2006/12/15 20:20:05  acg
153// SystemC 2.3
154//
155// Revision 1.4  2006/04/20 17:08:17  acg
156//  Andy Goodrich: 3.0 style process changes.
157//
158// Revision 1.3  2006/01/13 18:44:30  acg
159// Added $Log to record CVS changes into the source.
160
161#endif // !defined(sc_spawn_options_h_INCLUDED)
162