SystemC  2.3.2
Accellera SystemC proof-of-concept library
sc_process.h
Go to the documentation of this file.
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_process.h -- Process base class support.
23 */
35 #if !defined(sc_process_h_INCLUDED)
36 #define sc_process_h_INCLUDED
37 
39 #include "sysc/kernel/sc_object.h"
42 
43 #if defined(_MSC_VER) && !defined(SC_WIN_DLL_WARN)
44 #pragma warning(push)
45 #pragma warning(disable: 4251) // DLL import for std::vector
46 #endif
47 
48 namespace sc_core {
49 
50 // Forward declarations:
51 class sc_process_handle;
52 class sc_thread_process;
53 class sc_reset;
54 
55 SC_API const char* sc_gen_unique_name( const char*, bool preserve_first );
56 SC_API sc_process_handle sc_get_current_process_handle();
57 void sc_thread_cor_fn( void* arg );
59 
60 SC_API extern bool sc_allow_process_control_corners; // see sc_simcontext.cpp.
61 
62 
63 // Process handles as forward references:
64 
68 
69 
70 // Standard process types:
71 
73 {
78 };
79 
80 // Descendant information for process hierarchy operations:
81 
86 };
87 
88 
89 //==============================================================================
90 // CLASS sc_process_host
91 //
92 // This is the base class for objects which may have processes defined for
93 // their methods (e.g., sc_module)
94 //==============================================================================
95 
97 {
98  public:
100  virtual ~sc_process_host() { } // Needed for cast check for sc_module.
101  void defunct() {}
102 };
103 
104 
105 //==============================================================================
106 // CLASS sc_process_monitor
107 //
108 // This class provides a way of monitoring a process' status (e.g., waiting
109 // for a thread to complete its execution.) This class is intended to be a base
110 // class for classes which need to monitor a process or processes (e.g.,
111 // sc_join.) Its methods should be overloaded where notifications are desired.
112 //==============================================================================
113 
115  public:
116  enum {
117  spm_exit = 0
118  };
119  virtual ~sc_process_monitor() {}
120  virtual void signal(sc_thread_handle thread_p, int type);
121 };
122 inline void sc_process_monitor::signal(sc_thread_handle , int ) {}
123 
124 //------------------------------------------------------------------------------
125 // PROCESS INVOCATION METHOD OR FUNCTION:
126 //
127 // Define SC_USE_MEMBER_FUNC_PTR if we want to use member function pointers
128 // to implement process dispatch. Otherwise, we'll use a hack that involves
129 // creating a templated invocation object which will invoke the member
130 // function. This should not be necessary, but some compilers (e.g., VC++)
131 // do not allow the conversion from `void (callback_tag::*)()' to
132 // `void (sc_process_host::*)()'. This is supposed to be OK as long as the
133 // dynamic type is correct. C++ Standard 5.4 "Explicit type conversion",
134 // clause 7: a pointer to member of derived class type may be explicitly
135 // converted to a pointer to member of an unambiguous non-virtual base class
136 // type.
137 //-----------------------------------------------------------------------------
138 
139 #if defined(_MSC_VER)
140 #if ( _MSC_VER > 1200 )
141 # define SC_USE_MEMBER_FUNC_PTR
142 #endif
143 #else
144 # define SC_USE_MEMBER_FUNC_PTR
145 #endif
146 
147 
148 // COMPILER DOES SUPPORT CAST TO void (sc_process_host::*)() from (T::*)():
149 
150 #if defined(SC_USE_MEMBER_FUNC_PTR)
151 
152  typedef void (sc_process_host::*SC_ENTRY_FUNC)();
153 # define SC_DECL_HELPER_STRUCT(callback_tag, func) /*EMPTY*/
154 # define SC_MAKE_FUNC_PTR(callback_tag, func) \
155  static_cast<sc_core::SC_ENTRY_FUNC>(&callback_tag::func)
156 
157 
158 // COMPILER NOT DOES SUPPORT CAST TO void (sc_process_host::*)() from (T::*)():
159 
160 #else // !defined(SC_USE_MEMBER_FUNC_PTR)
161  class SC_API sc_process_call_base {
162  public:
163  inline sc_process_call_base()
164  {
165  }
166 
167  virtual ~sc_process_call_base()
168  {
169  }
170 
171  virtual void invoke(sc_process_host* host_p)
172  {
173  }
174  };
175  extern sc_process_call_base sc_process_defunct;
176 
177  template<class T>
178  class sc_process_call : public sc_process_call_base {
179  public:
180  sc_process_call( void (T::*method_p)() ) :
181  sc_process_call_base()
182  {
183  m_method_p = method_p;
184  }
185 
186  virtual ~sc_process_call()
187  {
188  }
189 
190  virtual void invoke(sc_process_host* host_p)
191  {
192  (((T*)host_p)->*m_method_p)();
193  }
194 
195  protected:
196  void (T::*m_method_p)(); // Method implementing the process.
197  };
198 
199  typedef sc_process_call_base* SC_ENTRY_FUNC;
200 # define SC_DECL_HELPER_STRUCT(callback_tag, func) /*EMPTY*/
201 # define SC_MAKE_FUNC_PTR(callback_tag, func) \
202  (::sc_core::SC_ENTRY_FUNC) (new \
203  ::sc_core::sc_process_call<callback_tag>(&callback_tag::func))
204 
205 #endif // !defined(SC_USE_MEMBER_FUNC_PTR)
206 
207 
208 extern SC_API void sc_set_stack_size( sc_thread_handle, std::size_t );
209 
210 class sc_event;
211 class sc_event_list;
212 class sc_name_gen;
213 class sc_spawn_options;
214 class sc_unwind_exception;
215 
216 //==============================================================================
217 // CLASS sc_throw_it<EXCEPT> - ARBITRARY EXCEPTION CLASS
218 //
219 // This class serves as a way of throwing an execption for an aribtrary type
220 // without knowing what that type is. A true virtual method in the base
221 // class is used to actually throw the execption. A pointer to the base
222 // class is used internally removing the necessity of knowing what the type
223 // of EXCEPT is for code internal to the library.
224 //
225 // Note the clone() true virtual method. This is used to allow instances
226 // of the sc_throw_it<EXCEPT> class to be easily garbage collected. Since
227 // an exception may be propogated to more than one process knowing when
228 // to garbage collect is non-trivial. So when a call is made to
229 // sc_process_handle::throw_it() an instance of sc_throw_it<EXCEPT> is
230 // allocated on the stack. For each process throwing the exception a copy is
231 // made via clone(). That allows those objects to be deleted by the individual
232 // processes when they are no longer needed (in this implementation of SystemC
233 // that deletion will occur each time a new exception is thrown ( see
234 // sc_thread_process::suspend_me() ).
235 //==============================================================================
237  public:
238  virtual sc_throw_it_helper* clone() const = 0;
239  virtual void throw_it() = 0;
241  virtual ~sc_throw_it_helper() {}
242 };
243 
244 template<typename EXCEPT>
246 {
248  public:
249  sc_throw_it( const EXCEPT& value ) : m_value(value) { }
250  virtual ~sc_throw_it() {}
251  virtual inline this_type* clone() const { return new this_type(m_value); }
252  virtual inline void throw_it() { throw m_value; }
253  protected:
254  EXCEPT m_value; // value to be thrown.
255 };
256 
257 //==============================================================================
258 // CLASS sc_process_b - USER INITIATED DYNAMIC PROCESS SUPPORT:
259 //
260 // This class implements the base class for a threaded process_base process
261 // whose semantics are provided by the true virtual method semantics().
262 // Classes derived from this one will provide a version of semantics which
263 // implements the desired semantics. See the sc_spawn_xxx classes below.
264 //
265 // Notes:
266 // (1) Object instances of this class maintain a reference count of
267 // outstanding handles. When the handle count goes to zero the
268 // object will be deleted.
269 // (2) Descriptions of the methods and operators in this class appear with
270 // their implementations.
271 // (3) The m_sticky_reset field is used to handle synchronous resets that
272 // are enabled via the sc_process_handle::sync_reset_on() method. These
273 // resets are not generated by a signal, but rather are modal by
274 // method call: sync_reset_on - sync_reset_off.
275 //
276 //==============================================================================
277 class SC_API sc_process_b : public sc_object {
278  friend class sc_simcontext; // Allow static processes to have base.
279  friend class sc_cthread_process; // Child can access parent.
280  friend class sc_method_process; // Child can access parent.
281  friend class sc_process_handle; // Allow handles to modify ref. count.
282  friend class sc_process_table; // Allow process_table to modify ref. count.
283  friend class sc_thread_process; // Child can access parent.
284 
285  friend class sc_object;
286  friend class sc_port_base;
287  friend class sc_runnable;
288  friend class sc_sensitive;
289  friend class sc_sensitive_pos;
290  friend class sc_sensitive_neg;
291  friend class sc_module;
292  friend class sc_report_handler;
293  friend class sc_reset;
294  friend class sc_reset_finder;
295  friend class sc_unwind_exception;
296 
297  friend SC_API const char* sc_gen_unique_name( const char*, bool preserve_first );
299  friend void sc_thread_cor_fn( void* arg );
300  friend SC_API bool timed_out( sc_simcontext* );
301 
302  public:
304  THROW_NONE = 0,
308  THROW_SYNC_RESET
309  };
310 
312  ps_bit_disabled = 1, // process is disabled.
313  ps_bit_ready_to_run = 2, // process is ready to run.
314  ps_bit_suspended = 4, // process is suspended.
315  ps_bit_zombie = 8, // process is a zombie.
316  ps_normal = 0 // must be zero.
317  };
318 
319  enum reset_type { // types for sc_process_b::reset_process()
320  reset_asynchronous = 0, // asynchronous reset.
321  reset_synchronous_off, // turn off synchronous reset sticky bit.
322  reset_synchronous_on // turn on synchronous reset sticky bit.
323  };
324 
326  {
334  AND_LIST_TIMEOUT
335  };
336 
337  public:
338  sc_process_b( const char* name_p, bool is_thread, bool free_host,
339  SC_ENTRY_FUNC method_p, sc_process_host* host_p,
340  const sc_spawn_options* opt_p );
341 
342  protected:
343  // may not be deleted manually (called from destroy_process())
344  virtual ~sc_process_b();
345 
346  public:
347  inline int current_state() { return m_state; }
348  bool dont_initialize() const { return m_dont_init; }
349  virtual void dont_initialize( bool dont );
350  std::string dump_state() const;
351  const ::std::vector<sc_object*>& get_child_objects() const;
352  inline sc_curr_proc_kind proc_kind() const;
353  sc_event& reset_event();
354  sc_event& terminated_event();
355 
356  public:
357  static inline sc_process_handle last_created_process_handle();
358 
359  protected:
360  virtual void add_child_object( sc_object* );
361  void add_static_event( const sc_event& );
362  bool dynamic() const { return m_dynamic_proc; }
363  const char* gen_unique_name( const char* basename_, bool preserve_first );
364  inline sc_report* get_last_report() { return m_last_report_p; }
365  inline bool is_disabled() const;
366  inline bool is_runnable() const;
367  static inline sc_process_b* last_created_process_base();
368  virtual bool remove_child_object( sc_object* );
369  void remove_dynamic_events( bool skip_timeout = false );
370  void remove_static_events();
371  inline void set_last_report( sc_report* last_p )
372  {
373  delete m_last_report_p;
374  m_last_report_p = last_p;
375  }
376  inline bool timed_out() const;
377  void report_error( const char* msgid, const char* msg = "" ) const;
378  void report_immediate_self_notification() const;
379 
380  protected: // process control methods:
381  virtual void disable_process(
383  void disconnect_process();
384  virtual void enable_process(
386  inline void initially_in_reset( bool async );
387  inline bool is_unwinding() const;
388  inline bool start_unwinding();
389  inline bool clear_unwinding();
390  virtual void kill_process(
392  void reset_changed( bool async, bool asserted );
393  void reset_process( reset_type rt,
395  virtual void resume_process(
397  virtual void suspend_process(
399  virtual void throw_user( const sc_throw_it_helper& helper,
401  virtual void throw_reset( bool async ) = 0;
402  virtual bool terminated() const;
403  void trigger_reset_event();
404 
405  private:
406  void delete_process();
407  inline void reference_decrement();
408  inline void reference_increment();
409 
410  protected:
411  inline void semantics();
412 
413  // debugging stuff:
414 
415  public:
416  const char* file;
417  int lineno;
418  int proc_id;
419 
420  protected:
421  int m_active_areset_n; // number of aresets active.
422  int m_active_reset_n; // number of resets active.
423  bool m_dont_init; // true: no initialize call.
424  bool m_dynamic_proc; // true: after elaboration.
425  const sc_event* m_event_p; // Dynamic event waiting on.
426  int m_event_count; // number of events.
427  const sc_event_list* m_event_list_p; // event list waiting on.
428  sc_process_b* m_exist_p; // process existence link.
429  bool m_free_host; // free sc_semantic_host_p.
430  bool m_has_reset_signal; // has reset_signal_is.
431  bool m_has_stack; // true is stack present.
432  bool m_is_thread; // true if this is thread.
433  sc_report* m_last_report_p; // last report this process.
434  sc_name_gen* m_name_gen_p; // subprocess name generator
435  sc_curr_proc_kind m_process_kind; // type of process.
436  int m_references_n; // outstanding handles.
437  std::vector<sc_reset*> m_resets; // resets for process.
438  sc_event* m_reset_event_p; // reset event.
439  sc_event* m_resume_event_p; // resume event.
440  sc_process_b* m_runnable_p; // sc_runnable link
441  sc_process_host* m_semantics_host_p; // host for semantics.
442  SC_ENTRY_FUNC m_semantics_method_p; // method for semantics.
443  int m_state; // process state.
444  std::vector<const sc_event*> m_static_events; // static events waiting on.
445  bool m_sticky_reset; // see note 3 above.
446  sc_event* m_term_event_p; // terminated event.
448  process_throw_type m_throw_status; // exception throwing status
449  bool m_timed_out; // true if we timed out.
450  sc_event* m_timeout_event_p; // timeout event.
451  trigger_t m_trigger_type; // type of trigger using.
452  bool m_unwinding; // true if unwinding stack.
453 
454  protected:
455  static sc_process_b* m_last_created_process_p; // Last process created.
456 };
457 
458 typedef sc_process_b sc_process_b; // For compatibility.
459 
460 
461 //------------------------------------------------------------------------------
462 //"sc_process_b::XXXX_child_YYYYY"
463 //
464 // These methods provide child object support.
465 //------------------------------------------------------------------------------
466 inline void
468 {
469  sc_object::add_child_object( object_p );
470  reference_increment();
471 }
472 
473 inline bool
475 {
476  if ( sc_object::remove_child_object( object_p ) ) {
477  reference_decrement();
478  return true;
479  }
480  else
481  {
482  return false;
483  }
484 }
485 
486 inline const ::std::vector<sc_object*>&
488 {
489  return m_child_objects;
490 }
491 
492 
493 //------------------------------------------------------------------------------
494 //"sc_process_b::initially_in_reset"
495 //
496 // This inline method is a callback to indicate that a reset is active at
497 // start up. This is because the signal will have been initialized before
498 // a reset linkage for it is set up, so we won't get a reset_changed()
499 // callback.
500 // async = true if this an asynchronous reset.
501 //------------------------------------------------------------------------------
502 inline void sc_process_b::initially_in_reset( bool async )
503 {
504  if ( async )
505  m_active_areset_n++;
506  else
507  m_active_reset_n++;
508 }
509 
510 //------------------------------------------------------------------------------
511 //"sc_process_b::is_disabled"
512 //
513 // This method returns true if this process is disabled.
514 //------------------------------------------------------------------------------
515 inline bool sc_process_b::is_disabled() const
516 {
517  return (m_state & ps_bit_disabled) ? true : false;
518 }
519 
520 //------------------------------------------------------------------------------
521 //"sc_process_b::is_runnable"
522 //
523 // This method returns true if this process is runnable. That is indicated
524 // by a non-zero m_runnable_p field.
525 //------------------------------------------------------------------------------
526 inline bool sc_process_b::is_runnable() const
527 {
528  return m_runnable_p != 0;
529 }
530 
531 //------------------------------------------------------------------------------
532 //"sc_process_b::is_unwinding"
533 //
534 // This method returns true if this process is unwinding from a kill or reset.
535 //------------------------------------------------------------------------------
536 inline bool sc_process_b::is_unwinding() const
537 {
538  return m_unwinding;
539 }
540 
541 //------------------------------------------------------------------------------
542 //"sc_process_b::start_unwinding"
543 //
544 // This method flags that this object instance should start unwinding if the
545 // current throw status requires an unwind.
546 //
547 // Result is true if the flag is set, false if the flag is already set.
548 //------------------------------------------------------------------------------
550 {
551  if ( !m_unwinding )
552  {
553  switch( m_throw_status )
554  {
555  case THROW_KILL:
556  case THROW_ASYNC_RESET:
557  case THROW_SYNC_RESET:
558  m_unwinding = true;
559  return true;
560  case THROW_USER:
561  default:
562  break;
563  }
564  }
565  return false;
566 }
567 
568 //------------------------------------------------------------------------------
569 //"sc_process_b::clear_unwinding"
570 //
571 // This method clears this object instance's throw status and always returns
572 // true.
573 //------------------------------------------------------------------------------
575 {
576  m_unwinding = false;
577  return true;
578 }
579 
580 
581 //------------------------------------------------------------------------------
582 //"sc_process_b::last_created_process_base"
583 //
584 // This virtual method returns the sc_process_b pointer for the last
585 // created process. It is only used internally by the simulator.
586 //------------------------------------------------------------------------------
588 {
589  return m_last_created_process_p;
590 }
591 
592 
593 
594 //------------------------------------------------------------------------------
595 //"sc_process_b::proc_kind"
596 //
597 // This method returns the kind of this process.
598 //------------------------------------------------------------------------------
600 {
601  return m_process_kind;
602 }
603 
604 
605 //------------------------------------------------------------------------------
606 //"sc_process_b::reference_decrement"
607 //
608 // This inline method decrements the number of outstanding references to this
609 // object instance. If the number of references goes to zero, this object
610 // can be deleted in "sc_process_b::delete_process()".
611 //------------------------------------------------------------------------------
612 inline void sc_process_b::reference_decrement()
613 {
614  m_references_n--;
615  if ( m_references_n == 0 ) delete_process();
616 }
617 
618 
619 //------------------------------------------------------------------------------
620 //"sc_process_b::reference_increment"
621 //
622 // This inline method increments the number of outstanding references to this
623 // object instance.
624 //------------------------------------------------------------------------------
625 inline void sc_process_b::reference_increment()
626 {
627  sc_assert(m_references_n != 0);
628  m_references_n++;
629 }
630 
631 //------------------------------------------------------------------------------
632 //"sc_process_b::semantics"
633 //
634 // This inline method invokes the semantics for this object instance.
635 // We check to see if we are initially in reset and then invoke the
636 // process semantics.
637 //
638 // Notes:
639 // (1) For a description of the process reset mechanism see the top of
640 // the file sc_reset.cpp.
641 //------------------------------------------------------------------------------
643 {
644  scoped_flag( bool& b ) : ref(b){ ref = true; }
645  ~scoped_flag() { ref = false; }
646  bool& ref;
647 private:
648  scoped_flag& operator=(const scoped_flag&) /* = delete */;
649 };
651 {
652 
653  // within this function, the process has a stack associated
654 
655  scoped_flag scoped_stack_flag( m_has_stack );
656 
657  sc_assert( m_process_kind != SC_NO_PROC_ );
658 
659  // Determine the reset status of this object instance and potentially
660  // trigger its notify event:
661 
662  // See if we need to trigger the notify event:
663 
664  if ( m_reset_event_p &&
665  ( (m_throw_status == THROW_SYNC_RESET) ||
666  (m_throw_status == THROW_ASYNC_RESET) )
667  ) {
668  trigger_reset_event();
669  }
670 
671  // Set the new reset status of this object based on the reset counts:
672 
673  m_throw_status = m_active_areset_n ? THROW_ASYNC_RESET :
674  ( m_active_reset_n ? THROW_SYNC_RESET : THROW_NONE);
675 
676  // Dispatch the actual semantics for the process:
677 
678 # ifndef SC_USE_MEMBER_FUNC_PTR
679  m_semantics_method_p->invoke( m_semantics_host_p );
680 # else
681  (m_semantics_host_p->*m_semantics_method_p)();
682 # endif
683 }
684 
685 
686 //------------------------------------------------------------------------------
687 //"sc_process_b::terminated"
688 //
689 // This inline method returns true if this object has terminated.
690 //------------------------------------------------------------------------------
691 inline bool sc_process_b::terminated() const
692 {
693  return (m_state & ps_bit_zombie) != 0;
694 }
695 
696 
697 //------------------------------------------------------------------------------
698 //"sc_process_b::timed_out"
699 //
700 // This inline method returns true if this object instance timed out.
701 //------------------------------------------------------------------------------
702 inline bool sc_process_b::timed_out() const
703 {
704  return m_timed_out;
705 }
706 
707 } // namespace sc_core
708 
709 #if defined(_MSC_VER) && !defined(SC_WIN_DLL_WARN)
710 #pragma warning(pop)
711 #endif
712 
713 /*****************************************************************************
714 
715  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
716  changes you are making here.
717 
718  Name, Affiliation, Date: Andy Goodrich, Forte Design Systems, 12 Aug 05
719  Description of Modification: This is the rewrite of process support. It
720  contains some code from the original
721  sc_process.h by Stan Liao, and the now-defunct
722  sc_process_b.h by Stan Liao and Martin
723  Janssen, all of Synopsys, Inc., It also contains
724  code from the original sc_process_b.h by
725  Andy Goodrich of Forte Design Systems and
726  Bishnupriya Bhattacharya of Cadence Design
727  Systems.
728 
729  Name, Affiliation, Date:
730  Description of Modification:
731 
732  *****************************************************************************/
733 
734 // $Log: sc_process.h,v $
735 // Revision 1.36 2011/08/26 22:44:30 acg
736 // Torsten Maehne: eliminate unused argument warning.
737 //
738 // Revision 1.35 2011/08/26 20:46:10 acg
739 // Andy Goodrich: moved the modification log to the end of the file to
740 // eliminate source line number skew when check-ins are done.
741 //
742 // Revision 1.34 2011/08/24 22:05:51 acg
743 // Torsten Maehne: initialization changes to remove warnings.
744 //
745 // Revision 1.33 2011/08/15 16:43:24 acg
746 // Torsten Maehne: changes to remove unused argument warnings.
747 //
748 // Revision 1.32 2011/07/24 11:20:03 acg
749 // Philipp A. Hartmann: process control error message improvements:
750 // (1) Downgrade error to warning for re-kills of processes.
751 // (2) Add process name to process messages.
752 // (3) drop some superfluous colons in messages.
753 //
754 // Revision 1.31 2011/04/13 02:44:26 acg
755 // Andy Goodrich: added m_unwinding flag in place of THROW_NOW because the
756 // throw status will be set back to THROW_*_RESET if reset is active and
757 // the check for an unwind being complete was expecting THROW_NONE as the
758 // clearing of THROW_NOW.
759 //
760 // Revision 1.30 2011/04/11 22:07:27 acg
761 // Andy Goodrich: check for reset event notification before resetting the
762 // throw_status value.
763 //
764 // Revision 1.29 2011/04/10 22:17:36 acg
765 // Andy Goodrich: added trigger_reset_event() to allow sc_process.h to
766 // contain the run_process() inline method. sc_process.h cannot have
767 // sc_simcontext information because of recursive includes.
768 //
769 // Revision 1.28 2011/04/08 22:34:06 acg
770 // Andy Goodrich: moved the semantics() method to this file and made it
771 // an inline method. Added reset processing to the semantics() method.
772 //
773 // Revision 1.27 2011/04/08 18:24:48 acg
774 // Andy Goodrich: moved reset_changed() to .cpp since it needs visibility
775 // to sc_simcontext.
776 //
777 // Revision 1.26 2011/04/01 21:24:57 acg
778 // Andy Goodrich: removed unused code.
779 //
780 // Revision 1.25 2011/03/28 13:02:51 acg
781 // Andy Goodrich: Changes for disable() interactions.
782 //
783 // Revision 1.24 2011/03/20 13:43:23 acg
784 // Andy Goodrich: added async_signal_is() plus suspend() as a corner case.
785 //
786 // Revision 1.23 2011/03/12 21:07:51 acg
787 // Andy Goodrich: changes to kernel generated event support.
788 //
789 // Revision 1.22 2011/03/08 20:49:31 acg
790 // Andy Goodrich: implement coarse checking for synchronous reset - suspend
791 // interaction.
792 //
793 // Revision 1.21 2011/03/07 17:38:43 acg
794 // Andy Goodrich: tightening up of checks for undefined interaction between
795 // synchronous reset and suspend.
796 //
797 // Revision 1.20 2011/03/06 19:57:11 acg
798 // Andy Goodrich: refinements for the illegal suspend - synchronous reset
799 // interaction.
800 //
801 // Revision 1.19 2011/03/05 19:44:20 acg
802 // Andy Goodrich: changes for object and event naming and structures.
803 //
804 // Revision 1.18 2011/02/19 08:30:53 acg
805 // Andy Goodrich: Moved process queueing into trigger_static from
806 // sc_event::notify.
807 //
808 // Revision 1.17 2011/02/18 20:27:14 acg
809 // Andy Goodrich: Updated Copyrights.
810 //
811 // Revision 1.16 2011/02/18 20:10:44 acg
812 // Philipp A. Hartmann: force return expression to be a bool to keep MSVC
813 // happy.
814 //
815 // Revision 1.15 2011/02/17 19:52:45 acg
816 // Andy Goodrich:
817 // (1) Simplified process control usage.
818 // (2) Changed dump_status() to dump_state() with new signature.
819 //
820 // Revision 1.14 2011/02/16 22:37:30 acg
821 // Andy Goodrich: clean up to remove need for ps_disable_pending.
822 //
823 // Revision 1.13 2011/02/13 21:47:37 acg
824 // Andy Goodrich: update copyright notice.
825 //
826 // Revision 1.12 2011/02/13 21:41:34 acg
827 // Andy Goodrich: get the log messages for the previous check in correct.
828 //
829 // Revision 1.11 2011/02/13 21:32:24 acg
830 // Andy Goodrich: moved sc_process_b::reset_process() implementation
831 // from header to cpp file . Added dump_status() to print out the status of a
832 // process.
833 //
834 // Revision 1.10 2011/02/11 13:25:24 acg
835 // Andy Goodrich: Philipp A. Hartmann's changes:
836 // (1) Removal of SC_CTHREAD method overloads.
837 // (2) New exception processing code.
838 //
839 // Revision 1.9 2011/02/04 15:27:36 acg
840 // Andy Goodrich: changes for suspend-resume semantics.
841 //
842 // Revision 1.8 2011/02/01 21:06:12 acg
843 // Andy Goodrich: new layout for the process_state enum.
844 //
845 // Revision 1.7 2011/01/25 20:50:37 acg
846 // Andy Goodrich: changes for IEEE 1666 2011.
847 //
848 // Revision 1.6 2011/01/19 23:21:50 acg
849 // Andy Goodrich: changes for IEEE 1666 2011
850 //
851 // Revision 1.5 2011/01/18 20:10:45 acg
852 // Andy Goodrich: changes for IEEE1666_2011 semantics.
853 //
854 // Revision 1.4 2010/07/22 20:02:33 acg
855 // Andy Goodrich: bug fixes.
856 //
857 // Revision 1.3 2009/05/22 16:06:29 acg
858 // Andy Goodrich: process control updates.
859 //
860 // Revision 1.2 2008/05/22 17:06:26 acg
861 // Andy Goodrich: updated copyright notice to include 2008.
862 //
863 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
864 // SystemC 2.3
865 //
866 // Revision 1.11 2006/05/08 17:58:10 acg
867 // Andy Goodrich: added David Long's forward declarations for friend
868 // functions, methods, and operators to keep the Microsoft compiler happy.
869 //
870 // Revision 1.10 2006/04/28 23:29:01 acg
871 // Andy Goodrich: added an sc_core:: prefix to SC_FUNC_PTR in the
872 // SC_MAKE_FUNC_PTR macro to allow its transpareuse outside of the sc_core
873 // namespace.
874 //
875 // Revision 1.9 2006/04/28 21:52:57 acg
876 // Andy Goodrich: changed SC_MAKE_FUNC_PTR to use a static cast to address
877 // and AIX issue wrt sc_module's inherited classes.
878 //
879 // Revision 1.8 2006/04/20 17:08:17 acg
880 // Andy Goodrich: 3.0 style process changes.
881 //
882 // Revision 1.7 2006/04/11 23:13:21 acg
883 // Andy Goodrich: Changes for reduced reset support that only includes
884 // sc_cthread, but has preliminary hooks for expanding to method and thread
885 // processes also.
886 //
887 // Revision 1.6 2006/03/13 20:26:50 acg
888 // Andy Goodrich: Addition of forward class declarations, e.g.,
889 // sc_reset, to keep gcc 4.x happy.
890 //
891 // Revision 1.5 2006/01/31 20:09:10 acg
892 // Andy Goodrich: added explaination of static vs dynamic waits to
893 // sc_process_b::trigger_static.
894 //
895 // Revision 1.4 2006/01/24 20:49:05 acg
896 // Andy Goodrich: changes to remove the use of deprecated features within the
897 // simulator, and to issue warning messages when deprecated features are used.
898 //
899 // Revision 1.3 2006/01/13 18:44:30 acg
900 // Added $Log to record CVS changes into the source.
901 
902 #endif // !defined(sc_process_h_INCLUDED)
virtual ~sc_throw_it()
Definition: sc_process.h:250
bool dynamic() const
Definition: sc_process.h:362
std::vector< sc_reset * > m_resets
Definition: sc_process.h:437
virtual bool remove_child_object(sc_object *object_p)
Static sensitivity class for negative edge events.
Definition: sc_sensitive.h:209
#define sc_assert(expr)
Definition: sc_report.h:270
sc_process_b * m_runnable_p
Definition: sc_process.h:440
void set_last_report(sc_report *last_p)
Definition: sc_process.h:371
virtual void throw_it()
Definition: sc_process.h:252
Default constants whose values may need to be.
sc_curr_proc_kind
Definition: sc_process.h:72
virtual this_type * clone() const
Definition: sc_process.h:251
Abstract base class of all SystemC `simulation&#39; objects.
Definition: sc_object.h:61
virtual bool remove_child_object(sc_object *)
Definition: sc_process.h:474
const sc_event * m_event_p
Definition: sc_process.h:425
class sc_cthread_process * sc_cthread_handle
Definition: sc_process.h:65
Abstract base class for class sc_port_b.
Definition: sc_port.h:81
The event class.
Definition: sc_event.h:256
static sc_process_b * last_created_process_base()
Definition: sc_process.h:587
bool is_disabled() const
Definition: sc_process.h:515
Base class for lists of events.
Definition: sc_event.h:130
bool is_runnable() const
Definition: sc_process.h:526
sc_name_gen * m_name_gen_p
Definition: sc_process.h:434
Static sensitivity class for positive edge events.
Definition: sc_sensitive.h:143
uint64 const sc_uint_base int b
Definition: sc_fxval.h:1005
sc_process_b * m_exist_p
Definition: sc_process.h:428
virtual bool terminated() const
Definition: sc_process.h:691
sc_curr_proc_kind m_process_kind
Definition: sc_process.h:435
const ::std::vector< sc_object * > & get_child_objects() const
Definition: sc_process.h:487
const sc_event_list * m_event_list_p
Definition: sc_process.h:427
bool timed_out() const
Definition: sc_process.h:702
sc_event * m_reset_event_p
Definition: sc_process.h:438
sc_event * m_timeout_event_p
Definition: sc_process.h:450
Unique name generator class.
Definition: sc_name_gen.h:48
SC_ENTRY_FUNC m_semantics_method_p
Definition: sc_process.h:442
Base class for all structural entities.
Definition: sc_module.h:83
class SC_API sc_event
Definition: sc_interface.h:40
Static sensitivity class for events.
Definition: sc_sensitive.h:65
sc_curr_proc_kind proc_kind() const
Definition: sc_process.h:599
void(sc_process_host::* SC_ENTRY_FUNC)()
Definition: sc_process.h:152
bool dont_initialize() const
Definition: sc_process.h:348
sc_clock period is zero sc_clock low time is zero sc_fifo< T > cannot have more than one writer bind interface to port failed complete binding failed remove port failed insert primitive channel failed sc_signal< T > cannot have more than one driver resolved port not bound to resolved signal sc_semaphore requires an initial value
Exception reporting.
Definition: sc_report.h:121
void sc_thread_cor_fn(void *arg)
trigger_t m_trigger_type
Definition: sc_process.h:451
Abstract base class of all SystemC `simulation&#39; objects.
SC_API bool timed_out(sc_simcontext *)
The simulation context.
Base classes of all export classes.
SC_API void sc_set_stack_size(sc_method_handle, std::size_t)
sc_process_host * m_semantics_host_p
Definition: sc_process.h:441
SC_API const char * sc_gen_unique_name(const char *, bool preserve_first)
SC_API bool sc_allow_process_control_corners
bool is_unwinding() const
Definition: sc_process.h:536
sc_throw_it(const EXCEPT &value)
Definition: sc_process.h:249
class sc_thread_process * sc_thread_handle
Definition: sc_process.h:67
class sc_method_process * sc_method_handle
Definition: sc_process.h:66
class SC_API sc_reset
Definition: sc_signal.h:399
virtual void signal(sc_thread_handle thread_p, int type)
Definition: sc_process.h:122
const char * file
Definition: sc_process.h:416
static sc_process_b * m_last_created_process_p
Definition: sc_process.h:455
Report ids for the kernel code.
sc_event * m_term_event_p
Definition: sc_process.h:446
virtual void add_child_object(sc_object *)
Definition: sc_process.h:467
void initially_in_reset(bool async)
Definition: sc_process.h:502
sc_event * m_resume_event_p
Definition: sc_process.h:439
sc_throw_it_helper * m_throw_helper_p
Definition: sc_process.h:447
operand is not sc_logic object already exists internal maximum number of processes per module module construction not properly hierarchical name as shown may be incorrect due to previous errors incorrect use of sc_module_name set time resolution failed default time unit changed to time resolution immediate notification is not allowed during update phase or elaboration use dont_initialize() has no effect for SC_CTHREADs" ) SC_DEFINE_MESSAGE(SC_ID_WAIT_N_INVALID_
SC_API sc_process_handle sc_get_current_process_handle()
sc_report * get_last_report()
Definition: sc_process.h:364
sc_process_b sc_process_b
Definition: sc_process.h:458
virtual void add_child_object(sc_object *object_p)
std::vector< const sc_event * > m_static_events
Definition: sc_process.h:444
class SC_API sc_simcontext
Definition: sc_object.h:51
process_throw_type m_throw_status
Definition: sc_process.h:448
#define SC_API
Definition: sc_cmnhdr.h:168
sc_report * m_last_report_p
Definition: sc_process.h:433
sc_descendant_inclusion_info
Definition: sc_process.h:82