SystemC  2.3.1
Accellera SystemC proof-of-concept library
sc_simcontext.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  sc_simcontext.h -- Definition of the simulation context class.
21 
22  Original Author: Stan Y. Liao, Synopsys, Inc.
23  Martin Janssen, Synopsys, Inc.
24 
25  CHANGE LOG AT THE END OF THE FILE
26  *****************************************************************************/
27 
28 #ifndef SC_SIMCONTEXT_H
29 #define SC_SIMCONTEXT_H
30 
31 #include "sysc/kernel/sc_cmnhdr.h"
32 #include "sysc/kernel/sc_process.h"
33 #include "sysc/kernel/sc_status.h"
34 #include "sysc/kernel/sc_time.h"
35 #include "sysc/utils/sc_hash.h"
36 #include "sysc/utils/sc_pq.h"
37 
38 namespace sc_core {
39 
40 // forward declarations
41 
42 class sc_cor;
43 class sc_cor_pkg;
44 class sc_event;
45 class sc_event_timed;
46 class sc_export_registry;
47 class sc_module;
48 class sc_module_name;
49 class sc_module_registry;
50 class sc_name_gen;
51 class sc_object;
52 class sc_object_manager;
53 class sc_phase_callback_registry;
54 class sc_process_handle;
55 class sc_port_registry;
56 class sc_prim_channel_registry;
57 class sc_process_table;
58 class sc_signal_bool_deval;
59 class sc_trace_file;
60 class sc_runnable;
61 class sc_process_host;
62 class sc_method_process;
63 class sc_cthread_process;
64 class sc_thread_process;
65 
66 template< typename > class sc_plist;
68 
70 {
74 };
75 
77 
78 enum sc_stop_mode { // sc_stop modes:
81 };
82 extern void sc_set_stop_mode( sc_stop_mode mode );
84 
86 {
89 };
90 extern void sc_start();
91 extern void sc_start( const sc_time& duration,
93 inline void sc_start( int duration, sc_time_unit unit,
95 {
96  sc_start( sc_time((double)duration,unit), p );
97 }
98 
99 inline void sc_start( double duration, sc_time_unit unit,
101 {
102  sc_start( sc_time(duration,unit), p );
103 }
104 
105 extern void sc_stop();
106 
107 // friend function declarations
108 
110 const std::vector<sc_event*>& sc_get_top_level_events(
111  const sc_simcontext* simc_p);
112 const std::vector<sc_object*>& sc_get_top_level_objects(
113  const sc_simcontext* simc_p);
114 bool sc_is_running( const sc_simcontext* simc_p );
115 void sc_pause();
117 void sc_start( const sc_time&, sc_starvation_policy );
119 void sc_set_time_resolution( double, sc_time_unit );
120 sc_time sc_get_time_resolution();
121 void sc_set_default_time_unit( double, sc_time_unit );
122 sc_time sc_get_default_time_unit();
123 bool sc_pending_activity_at_current_time( const sc_simcontext* );
124 bool sc_pending_activity_at_future_time( const sc_simcontext* );
125 sc_time sc_time_to_pending_activity( const sc_simcontext* );
126 
127 struct sc_invoke_method;
128 
129 // ----------------------------------------------------------------------------
130 // CLASS : sc_simcontext
131 //
132 // The simulation context.
133 // ----------------------------------------------------------------------------
134 
136 {
137  friend struct sc_invoke_method;
138  friend class sc_event;
139  friend class sc_module;
140  friend class sc_object;
141  friend class sc_time;
142  friend class sc_clock;
143  friend class sc_method_process;
145  friend class sc_process_b;
146  friend class sc_process_handle;
147  friend class sc_prim_channel;
148  friend class sc_cthread_process;
149  friend class sc_thread_process;
150  friend sc_dt::uint64 sc_delta_count();
151  friend const std::vector<sc_event*>& sc_get_top_level_events(
152  const sc_simcontext* simc_p);
153  friend const std::vector<sc_object*>& sc_get_top_level_objects(
154  const sc_simcontext* simc_p);
155  friend bool sc_is_running( const sc_simcontext* simc_p );
156  friend void sc_pause();
157  friend bool sc_end_of_simulation_invoked();
158  friend void sc_start( const sc_time&, sc_starvation_policy );
159  friend bool sc_start_of_simulation_invoked();
160  friend void sc_thread_cor_fn(void*);
164 
165 
166  void init();
167  void clean();
168 
169 public:
170 
171  sc_simcontext();
172  ~sc_simcontext();
173 
174  void initialize( bool = false );
175  void cycle( const sc_time& );
176  void simulate( const sc_time& duration );
177  void stop();
178  void end();
179  void reset();
180 
181  int sim_status() const;
182  bool elaboration_done() const;
183 
184  std::vector<sc_thread_handle>& get_active_invokers();
185 
187 
188  inline sc_status get_status() const;
189 
191 
192  void hierarchy_push( sc_module* );
194  sc_module* hierarchy_curr() const;
197  sc_object* find_object( const char* name );
198 
203 
204  // to generate unique names for objects in an MT-Safe way
205  const char* gen_unique_name( const char* basename_,
206  bool preserve_first = false
207  );
208 
209  // process creation
211  const char* name_p, bool free_host, SC_ENTRY_FUNC method_p,
212  sc_process_host* host_p, const sc_spawn_options* opt_p );
213 
215  const char* name_p, bool free_host, SC_ENTRY_FUNC method_p,
216  sc_process_host* host_p, const sc_spawn_options* opt_p );
217 
219  const char* name_p, bool free_host, SC_ENTRY_FUNC method_p,
220  sc_process_host* host_p, const sc_spawn_options* opt_p );
221 
223  sc_object* get_current_writer() const;
224  bool write_check() const;
225  void set_curr_proc( sc_process_b* );
226  void reset_curr_proc();
227 
228  int next_proc_id();
229 
230  void add_trace_file( sc_trace_file* );
232 
233  friend void sc_set_time_resolution( double, sc_time_unit );
235  friend void sc_set_default_time_unit( double, sc_time_unit );
237 
238  const sc_time& max_time() const;
239  const sc_time& time_stamp() const;
240 
241  sc_dt::uint64 change_stamp() const;
242  sc_dt::uint64 delta_count() const;
243  bool event_occurred( sc_dt::uint64 last_change_count ) const;
244  bool evaluation_phase() const;
245  bool is_running() const;
246  bool update_phase() const;
247  bool notify_phase() const;
248  bool get_error();
249  void set_error( sc_report* );
250 
252  { return m_cor_pkg; }
253  sc_cor* next_cor();
254 
255  const ::std::vector<sc_object*>& get_child_objects() const;
256 
257  void elaborate();
258  void prepare_to_simulate();
259  inline void initial_crunch( bool no_crunch );
260  bool next_time( sc_time& t ) const;
262 
263 private:
264 
265  void add_child_event( sc_event* );
266  void add_child_object( sc_object* );
267  void remove_child_event( sc_event* );
268  void remove_child_object( sc_object* );
269 
270  void crunch( bool once=false );
271 
272  int add_delta_event( sc_event* );
273  void remove_delta_event( sc_event* );
274  void add_timed_event( sc_event_timed* );
275 
276  void trace_cycle( bool delta_cycle );
277 
278  const ::std::vector<sc_event*>& get_child_events_internal() const;
279  const ::std::vector<sc_object*>& get_child_objects_internal() const;
280 
281  void execute_method_next( sc_method_handle );
282  void execute_thread_next( sc_thread_handle );
283 
284  sc_method_handle pop_runnable_method();
285  sc_thread_handle pop_runnable_thread();
286 
287  void preempt_with( sc_method_handle );
288  inline void preempt_with( sc_thread_handle );
289 
290  void push_runnable_method( sc_method_handle );
291  void push_runnable_thread( sc_thread_handle );
292 
293  void push_runnable_method_front( sc_method_handle );
294  void push_runnable_thread_front( sc_thread_handle );
295 
296  void remove_runnable_method( sc_method_handle );
297  void remove_runnable_thread( sc_thread_handle );
298 
299  void requeue_current_process();
300  void suspend_current_process();
301 
302  void do_sc_stop_action();
303  void mark_to_collect_process( sc_process_b* zombie_p );
304 
305 private:
306 
307  enum execution_phases {
308  phase_initialize = 0,
309  phase_evaluate,
310  phase_update,
311  phase_notify
312  };
313  sc_object_manager* m_object_manager;
314 
315  sc_module_registry* m_module_registry;
316  sc_port_registry* m_port_registry;
317  sc_export_registry* m_export_registry;
318  sc_prim_channel_registry* m_prim_channel_registry;
319  sc_phase_callback_registry* m_phase_cb_registry;
320 
321  sc_name_gen* m_name_gen;
322 
323  sc_process_table* m_process_table;
324  sc_curr_proc_info m_curr_proc_info;
325  sc_object* m_current_writer;
326  bool m_write_check;
327  int m_next_proc_id;
328 
329  std::vector<sc_thread_handle> m_active_invokers;
330 
331  std::vector<sc_event*> m_child_events;
332  std::vector<sc_object*> m_child_objects;
333 
334  std::vector<sc_event*> m_delta_events;
335  sc_ppq<sc_event_timed*>* m_timed_events;
336 
337  std::vector<sc_trace_file*> m_trace_files;
338  bool m_something_to_trace;
339 
340  sc_runnable* m_runnable;
341  sc_process_list* m_collectable;
342 
343  sc_time_params* m_time_params;
344  sc_time m_curr_time;
345  mutable sc_time m_max_time;
346 
347  sc_invoke_method* m_method_invoker_p;
348  sc_dt::uint64 m_change_stamp; // "time" change occurred.
349  sc_dt::uint64 m_delta_count;
350  bool m_forced_stop;
351  bool m_paused;
352  bool m_ready_to_simulate;
353  bool m_elaboration_done;
354  execution_phases m_execution_phase;
355  sc_report* m_error;
356  bool m_in_simulator_control;
357  bool m_end_of_simulation_called;
358  sc_status m_simulation_status;
359  bool m_start_of_simulation_called;
360 
361  sc_cor_pkg* m_cor_pkg; // the simcontext's coroutine package
362  sc_cor* m_cor; // the simcontext's coroutine
363 
364 private:
365 
366  // disabled
367  sc_simcontext( const sc_simcontext& );
368  sc_simcontext& operator = ( const sc_simcontext& );
369 };
370 
371 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
372 
373 // Not MT safe.
374 
375 #if 1
376 extern sc_simcontext* sc_curr_simcontext;
377 extern sc_simcontext* sc_default_global_context;
378 
379 inline sc_simcontext*
381 {
382  if( sc_curr_simcontext == 0 ) {
385  }
386  return sc_curr_simcontext;
387 }
388 #else
389  extern sc_simcontext* sc_get_curr_simcontext();
390 #endif // 0
392 {
394 }
395 
396 
397 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
398 
399 inline
400 bool
402 {
403  return m_elaboration_done;
404 }
405 
406 
408 {
409  return m_simulation_status != SC_RUNNING ?
410  m_simulation_status :
411  (m_in_simulator_control ? SC_RUNNING : SC_PAUSED);
412 }
413 
414 inline
415 int
417 {
418  if( m_error ) {
419  return SC_SIM_ERROR;
420  }
421  if( m_forced_stop ) {
422  return SC_SIM_USER_STOP;
423  }
424  return SC_SIM_OK;
425 }
426 
427 
428 inline
431 {
432  return m_object_manager;
433 }
434 
435 inline
438 {
439  return m_module_registry;
440 }
441 
442 inline
445 {
446  return m_port_registry;
447 }
448 
449 inline
452 {
453  return m_export_registry;
454 }
455 
456 inline
459 {
460  return m_prim_channel_registry;
461 }
462 
463 
464 inline
467 {
468  return &m_curr_proc_info;
469 }
470 
471 
472 inline
473 int
475 {
476  return ( ++ m_next_proc_id );
477 }
478 
479 
480 inline
481 const sc_time&
483 {
484  if ( m_max_time == SC_ZERO_TIME )
485  {
486  m_max_time = sc_time::from_value( ~sc_dt::UINT64_ZERO );
487  }
488  return m_max_time;
489 }
490 
491 inline
494 {
495  return m_change_stamp;
496 }
497 
498 inline
499 const sc_time&
501 {
502  return m_curr_time;
503 }
504 
505 
506 inline
507 bool
509 {
510  return m_change_stamp == last_change_stamp;
511 }
512 
513 inline
514 bool
516 {
517  return (m_execution_phase == phase_evaluate) &&
518  m_ready_to_simulate;
519 }
520 
521 inline
522 bool
524 {
525  return m_execution_phase == phase_update;
526 }
527 
528 inline
529 bool
531 {
532  return m_execution_phase == phase_notify;
533 }
534 
535 inline
536 void
538 {
539  delete m_error;
540  m_error = err;
541 }
542 
543 
544 inline
545 bool
547 {
548  return m_error != NULL;
549 }
550 
551 inline
552 int
553 sc_simcontext::add_delta_event( sc_event* e )
554 {
555  m_delta_events.push_back( e );
556  return ( m_delta_events.size() - 1 );
557 }
558 
559 inline
560 void
561 sc_simcontext::add_timed_event( sc_event_timed* et )
562 {
563  m_timed_events->insert( et );
564 }
565 
566 inline sc_object*
568 {
569  return m_current_writer;
570 }
571 
572 inline bool
574 {
575  return m_write_check;
576 }
577 
578 // ----------------------------------------------------------------------------
579 
580 class sc_process_handle;
582 
583 // Get the current object hierarchy context
584 //
585 // Returns a pointer the the sc_object (module or process) that
586 // would become the parent object of a newly created element
587 // of the SystemC object hierarchy, or NULL.
588 //
589 inline sc_object*
591 {
593 }
594 
595 inline
598 {
600 }
601 
602 // THE FOLLOWING FUNCTION IS DEPRECATED IN 2.1
604 
605 inline
608 {
610 }
611 
612 
614 {
616 }
617 
618 
619 // Generates unique names within each module.
620 extern
621 const char*
622 sc_gen_unique_name( const char* basename_, bool preserve_first = false );
623 
624 
625 // Set the random seed for controlled randomization -- not yet implemented
626 extern
627 void
628 sc_set_random_seed( unsigned int seed_ );
629 
630 
631 extern void sc_initialize();
632 
633 extern const sc_time& sc_max_time(); // Get maximum time value.
634 extern const sc_time& sc_time_stamp(); // Current simulation time.
635 extern double sc_simulation_time(); // Current time in default time units.
636 
637 inline
638 const std::vector<sc_event*>& sc_get_top_level_events(
639  const sc_simcontext* simc_p = sc_get_curr_simcontext() )
640 {
641  return simc_p->m_child_events;
642 }
643 
644 inline
645 const std::vector<sc_object*>& sc_get_top_level_objects(
646  const sc_simcontext* simc_p = sc_get_curr_simcontext() )
647 {
648  return simc_p->m_child_objects;
649 }
650 
651 extern sc_event* sc_find_event( const char* name );
652 
653 extern sc_object* sc_find_object( const char* name );
654 
655 inline
657 {
658  return sc_get_curr_simcontext()->m_delta_count;
659 }
660 
661 inline
663 {
664  return simc_p->m_ready_to_simulate;
665 }
666 
667 bool sc_is_unwinding();
668 
669 inline void sc_pause()
670 {
671  sc_get_curr_simcontext()->m_paused = true;
672 }
673 
674 // Return indication if there are more processes to execute in this delta phase
675 
677  ( const sc_simcontext* simc_p = sc_get_curr_simcontext() )
678 {
679  return simc_p->pending_activity_at_current_time();
680 }
681 
682 // Return indication if there are timed notifications in the future
683 
685  ( const sc_simcontext* simc_p = sc_get_curr_simcontext() )
686 {
687  sc_time ignored;
688  return simc_p->next_time( ignored );
689 }
690 
691 // Return indication if there are processes to run,
692 // or notifications in the future
693 
694 inline bool sc_pending_activity
695  ( const sc_simcontext* simc_p = sc_get_curr_simcontext() )
696 {
697  return sc_pending_activity_at_current_time( simc_p )
699 }
700 
701 sc_time
703  ( const sc_simcontext* simc_p = sc_get_curr_simcontext() );
704 
705 
706 inline
707 bool
709 {
710  return sc_get_curr_simcontext()->m_end_of_simulation_called;
711 }
712 
713 inline bool sc_hierarchical_name_exists( const char* name )
714 {
715  return sc_find_object(name) || sc_find_event(name);
716 }
717 
718 inline
719 bool
721 {
722  return sc_get_curr_simcontext()->m_start_of_simulation_called;
723 }
724 
725 // The following variable controls whether process control corners should
726 // be considered errors or not. See sc_simcontext.cpp for details on what
727 // happens if this value is set to true.
728 
730 
731 } // namespace sc_core
732 
733 /*****************************************************************************
734 
735  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
736  changes you are making here.
737 
738  Name, Affiliation, Date: Andy Goodrich, Forte Design Systems 20 May 2003
739  Description of Modification: - phase callbacks
740  - sc_stop mode
741 
742  Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
743  25 August, 2003
744  Description of Modification: - support for dynamic process
745  - support for sc export registry
746  - new member methods elaborate(),
747  prepare_to_simulate(), and initial_crunch()
748  that are invoked by initialize() in that order
749  - add sc_get_last_created_process_handle() for
750  use before simulation starts
751 
752  Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
753  3 March, 2004
754  Description of Modification: add sc_get_curr_process_kind()
755 
756  Name, Affiliation, Date:
757  Description of Modification:
758 
759  *****************************************************************************/
760 // $Log: sc_simcontext.h,v $
761 // Revision 1.26 2011/09/05 21:20:22 acg
762 // Andy Goodrich: result of automake invocation.
763 //
764 // Revision 1.25 2011/09/01 15:28:10 acg
765 // Andy Goodrich: the aftermath of automake.
766 //
767 // Revision 1.24 2011/08/29 18:04:32 acg
768 // Philipp A. Hartmann: miscellaneous clean ups.
769 //
770 // Revision 1.23 2011/08/26 20:46:10 acg
771 // Andy Goodrich: moved the modification log to the end of the file to
772 // eliminate source line number skew when check-ins are done.
773 //
774 // Revision 1.22 2011/08/24 22:05:51 acg
775 // Torsten Maehne: initialization changes to remove warnings.
776 //
777 // Revision 1.21 2011/05/09 04:07:49 acg
778 // Philipp A. Hartmann:
779 // (1) Restore hierarchy in all phase callbacks.
780 // (2) Ensure calls to before_end_of_elaboration.
781 //
782 // Revision 1.20 2011/04/08 18:26:07 acg
783 // Andy Goodrich: added execute_method_next() to handle method dispatch
784 // for asynchronous notifications that occur outside the evaluation phase.
785 //
786 // Revision 1.19 2011/04/05 20:50:57 acg
787 // Andy Goodrich:
788 // (1) changes to make sure that event(), posedge() and negedge() only
789 // return true if the clock has not moved.
790 // (2) fixes for method self-resumes.
791 // (3) added SC_PRERELEASE_VERSION
792 // (4) removed kernel events from the object hierarchy, added
793 // sc_hierarchical_name_exists().
794 //
795 // Revision 1.18 2011/03/20 13:43:23 acg
796 // Andy Goodrich: added async_signal_is() plus suspend() as a corner case.
797 //
798 // Revision 1.17 2011/03/07 18:25:19 acg
799 // Andy Goodrich: tightening of check for resume on a disabled process to
800 // only produce an error if it is ready to run.
801 //
802 // Revision 1.16 2011/03/06 15:58:50 acg
803 // Andy Goodrich: added escape to turn off process control corner case
804 // checks.
805 //
806 // Revision 1.15 2011/03/05 04:45:16 acg
807 // Andy Goodrich: moved active process calculation to the sc_simcontext class.
808 //
809 // Revision 1.14 2011/03/05 01:39:21 acg
810 // Andy Goodrich: changes for named events.
811 //
812 // Revision 1.13 2011/02/18 20:27:14 acg
813 // Andy Goodrich: Updated Copyrights.
814 //
815 // Revision 1.12 2011/02/13 21:47:38 acg
816 // Andy Goodrich: update copyright notice.
817 //
818 // Revision 1.11 2011/02/13 21:34:35 acg
819 // Andy Goodrich: added SC_UNITIALIZED enum value to process status so
820 // its possible to detect throws before initialization.
821 //
822 // Revision 1.10 2011/02/11 13:25:24 acg
823 // Andy Goodrich: Philipp A. Hartmann's changes:
824 // (1) Removal of SC_CTHREAD method overloads.
825 // (2) New exception processing code.
826 //
827 // Revision 1.9 2011/02/01 21:18:56 acg
828 // Andy Goodrich: addition of new preempt_with() method used to immediately
829 // throw exceptions from threads.
830 //
831 // Revision 1.8 2011/01/25 20:50:37 acg
832 // Andy Goodrich: changes for IEEE 1666 2011.
833 //
834 // Revision 1.7 2011/01/19 23:21:50 acg
835 // Andy Goodrich: changes for IEEE 1666 2011
836 //
837 // Revision 1.6 2011/01/18 20:10:45 acg
838 // Andy Goodrich: changes for IEEE1666_2011 semantics.
839 //
840 // Revision 1.5 2010/07/22 20:02:33 acg
841 // Andy Goodrich: bug fixes.
842 //
843 // Revision 1.4 2009/05/22 16:06:29 acg
844 // Andy Goodrich: process control updates.
845 //
846 // Revision 1.3 2008/05/22 17:06:26 acg
847 // Andy Goodrich: updated copyright notice to include 2008.
848 //
849 // Revision 1.2 2007/09/20 20:32:35 acg
850 // Andy Goodrich: changes to the semantics of throw_it() to match the
851 // specification. A call to throw_it() will immediately suspend the calling
852 // thread until all the throwees have executed. At that point the calling
853 // thread will be restarted before the execution of any other threads.
854 //
855 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
856 // SystemC 2.3
857 //
858 // Revision 1.13 2006/05/08 18:00:06 acg
859 // Andy Goodrich: added David Long's forward declarations for friend
860 // functions, methods, and operators to keep the Microsoft compiler happy.
861 //
862 // Revision 1.11 2006/04/11 23:13:21 acg
863 // Andy Goodrich: Changes for reduced reset support that only includes
864 // sc_cthread, but has preliminary hooks for expanding to method and thread
865 // processes also.
866 //
867 // Revision 1.10 2006/03/21 00:00:34 acg
868 // Andy Goodrich: changed name of sc_get_current_process_base() to be
869 // sc_get_current_process_b() since its returning an sc_process_b instance.
870 //
871 // Revision 1.9 2006/01/26 21:04:54 acg
872 // Andy Goodrich: deprecation message changes and additional messages.
873 //
874 // Revision 1.8 2006/01/24 20:49:05 acg
875 // Andy Goodrich: changes to remove the use of deprecated features within the
876 // simulator, and to issue warning messages when deprecated features are used.
877 //
878 // Revision 1.7 2006/01/19 00:29:52 acg
879 // Andy Goodrich: Yet another implementation for signal write checking. This
880 // one uses an environment variable SC_SIGNAL_WRITE_CHECK, that when set to
881 // DISABLE will disable write checking on signals.
882 //
883 // Revision 1.6 2006/01/18 21:42:37 acg
884 // Andy Goodrich: Changes for check writer support.
885 //
886 // Revision 1.5 2006/01/13 18:44:30 acg
887 // Added $Log to record CVS changes into the source.
888 //
889 // Revision 1.4 2006/01/03 23:18:44 acg
890 // Changed copyright to include 2006.
891 //
892 // Revision 1.3 2005/12/20 22:11:10 acg
893 // Fixed $Log lines.
894 //
895 // Revision 1.2 2005/12/20 22:02:30 acg
896 // Changed where delta cycles are incremented to match IEEE 1666. Added the
897 // event_occurred() method to hide how delta cycle comparisions are done within
898 // sc_simcontext. Changed the boolean update_phase to an enum that shows all
899 // the phases.
900 
901 #endif
bool pending_activity_at_current_time() const
sc_simcontext * sc_curr_simcontext
sc_object * sc_find_object(const char *name)
const char * gen_unique_name(const char *basename_, bool preserve_first=false)
bool is_running() const
void add_trace_file(sc_trace_file *)
friend void sc_start(const sc_time &, sc_starvation_policy)
sc_time sc_time_to_pending_activity(const sc_simcontext *)
sc_module * hierarchy_pop()
bool elaboration_done() const
friend bool sc_start_of_simulation_invoked()
int sc_get_simulator_status()
bool next_time(sc_time &t) const
sc_time_unit
Definition: sc_time.h:56
sc_object * sc_get_current_object()
const sc_time & sc_max_time()
friend sc_time sc_get_default_time_unit()
bool sc_allow_process_control_corners
sc_dt::uint64 delta_count() const
sc_stop_mode sc_get_stop_mode()
sc_prim_channel_registry * get_prim_channel_registry()
friend sc_time sc_time_to_pending_activity(const sc_simcontext *)
void sc_pause()
sc_cor_pkg * cor_pkg()
bool update_phase() const
sc_dt::uint64 change_stamp() const
const uint64 UINT64_ZERO
void initialize(bool=false)
uint64_t uint64
Definition: sc_nbdefs.h:183
friend struct sc_invoke_method
friend bool sc_end_of_simulation_invoked()
sc_event * sc_find_event(const char *name)
friend void sc_pause()
bool notify_phase() const
void(sc_process_host::* SC_ENTRY_FUNC)()
Definition: sc_process.h:142
void sc_set_random_seed(unsigned int seed_)
static sc_time from_value(value_type)
bool sc_pending_activity_at_future_time(const sc_simcontext *)
friend bool sc_pending_activity_at_future_time(const sc_simcontext *)
sc_status get_status() const
sc_object_manager * get_object_manager()
sc_process_b sc_process_b
Definition: sc_process.h:447
sc_process_handle create_cthread_process(const char *name_p, bool free_host, SC_ENTRY_FUNC method_p, sc_process_host *host_p, const sc_spawn_options *opt_p)
void simulate(const sc_time &duration)
sc_curr_proc_kind sc_get_curr_process_kind()
void set_error(sc_report *)
sc_process_b * sc_get_current_process_b()
bool sc_is_running(const sc_simcontext *simc_p)
sc_curr_proc_handle get_curr_proc_info()
sc_simcontext * sc_get_curr_simcontext()
class sc_thread_process * sc_thread_handle
Definition: sc_process.h:58
sc_object * get_current_writer() const
friend const std::vector< sc_event * > & sc_get_top_level_events(const sc_simcontext *simc_p)
const std::vector< sc_event * > & sc_get_top_level_events(const sc_simcontext *simc_p)
void hierarchy_push(sc_module *)
const std::vector< sc_object * > & sc_get_top_level_objects(const sc_simcontext *simc_p)
sc_module_registry * get_module_registry()
sc_module * hierarchy_curr() const
const int SC_SIM_USER_STOP
Definition: sc_status.h:38
friend bool sc_pending_activity_at_current_time(const sc_simcontext *)
bool event_occurred(sc_dt::uint64 last_change_count) const
friend sc_dt::uint64 sc_delta_count()
friend void sc_thread_cor_fn(void *)
const sc_time & max_time() const
sc_process_handle create_thread_process(const char *name_p, bool free_host, SC_ENTRY_FUNC method_p, sc_process_host *host_p, const sc_spawn_options *opt_p)
const sc_time & time_stamp() const
const char * sc_gen_unique_name(const char *, bool preserve_first)
sc_object * next_object()
void sc_initialize()
void set_curr_proc(sc_process_b *)
bool sc_hierarchical_name_exists(const char *name)
bool write_check() const
bool sc_end_of_simulation_invoked()
bool evaluation_phase() const
sc_object * active_object()
double sc_simulation_time()
const sc_curr_proc_info * sc_curr_proc_handle
Definition: sc_simcontext.h:76
void remove_trace_file(sc_trace_file *)
void initial_crunch(bool no_crunch)
sc_starvation_policy
Definition: sc_simcontext.h:85
friend const std::vector< sc_object * > & sc_get_top_level_objects(const sc_simcontext *simc_p)
const int SC_SIM_OK
Definition: sc_status.h:36
sc_port_registry * get_port_registry()
const int SC_SIM_ERROR
Definition: sc_status.h:37
friend void sc_set_time_resolution(double, sc_time_unit)
sc_dt::uint64 sc_delta_count()
void sc_start()
void sc_set_stop_mode(sc_stop_mode mode)
sc_curr_proc_kind
Definition: sc_process.h:63
bool sc_is_unwinding()
sc_process_b * process_handle
Definition: sc_simcontext.h:71
const sc_time SC_ZERO_TIME
sc_status sc_get_status()
sc_curr_proc_kind kind
Definition: sc_simcontext.h:72
friend bool sc_is_running(const sc_simcontext *simc_p)
sc_time sc_get_time_resolution()
sc_simcontext * sc_default_global_context
sc_process_handle sc_get_current_process_handle()
void cycle(const sc_time &)
void sc_set_time_resolution(double, sc_time_unit)
sc_export_registry * get_export_registry()
const ::std::vector< sc_object * > & get_child_objects() const
class sc_method_process * sc_method_handle
Definition: sc_process.h:57
sc_process_b * sc_get_curr_process_handle()
bool sc_pending_activity(const sc_simcontext *simc_p=sc_get_curr_simcontext())
const sc_time & sc_time_stamp()
void sc_set_default_time_unit(double, sc_time_unit)
bool sc_pending_activity_at_current_time(const sc_simcontext *)
sc_time sc_get_default_time_unit()
sc_process_handle create_method_process(const char *name_p, bool free_host, SC_ENTRY_FUNC method_p, sc_process_host *host_p, const sc_spawn_options *opt_p)
friend sc_time sc_get_time_resolution()
bool sc_start_of_simulation_invoked()
friend class sc_phase_callback_registry
sc_plist< sc_process_b * > sc_process_list
Definition: sc_simcontext.h:66
sc_object * first_object()
std::vector< sc_thread_handle > & get_active_invokers()
friend void sc_set_default_time_unit(double, sc_time_unit)
sc_object * find_object(const char *name)
void sc_stop()