SystemC  Recoding Infrastructure for SystemC v0.6.3 derived from Accellera 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 distribu ted 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 #include <map>
38 #include <unordered_map>
39 #include <unordered_set>
40 #include <list>
41 #include <string.h>
42 #include <time.h>
43 
44 // 02/22/2016 ZC: to enable verbose display or not
45 #ifndef _SYSC_PRINT_VERBOSE_MESSAGE_ENV_VAR
46 #define _SYSC_PRINT_VERBOSE_MESSAGE_ENV_VAR "SYSC_PRINT_VERBOSE_MESSAGE"
47 #endif
48 namespace sc_core {
49 
50 // forward declarations
51 class Invoker; //DM 05/16/2019
52 
53 class sc_cor;
54 class sc_cor_pkg;
55 class sc_event;
56 class sc_event_timed;
57 class sc_export_registry;
58 class sc_module;
59 class sc_module_name;
60 class sc_module_registry;
61 class sc_name_gen;
62 class sc_object;
63 class sc_object_manager;
64 class sc_phase_callback_registry;
65 class sc_process_handle;
66 class sc_port_registry;
67 class sc_prim_channel_registry;
68 class sc_process_table;
69 class sc_signal_bool_deval;
70 class sc_trace_file;
71 class sc_runnable;
72 class sc_process_host;
73 class sc_method_process;
74 class sc_cthread_process;
75 class sc_thread_process;
76 
77 template< typename > class sc_plist;
79 
80 
81 
82 enum sc_stop_mode { // sc_stop modes:
85 };
86 extern void sc_set_stop_mode( sc_stop_mode mode );
88 
90 {
93 };
94 extern void sc_start();
95 extern void sc_start( const sc_time& duration,
97 inline void sc_start( int duration, sc_time_unit unit,
99 {
100  sc_start( sc_time((double)duration,unit), p );
101 }
102 
103 inline void sc_start( double duration, sc_time_unit unit,
105 {
106  sc_start( sc_time(duration,unit), p );
107 }
108 
109 extern void sc_stop();
110 
111 // 06/16/2016 GL: enable synchronized parallel simulation
112 extern bool _SYSC_SYNC_PAR_SIM;
113 
114 // friend function declarations
115 
117 const std::vector<sc_event*>& sc_get_top_level_events(
118  const sc_simcontext* simc_p);
119 const std::vector<sc_object*>& sc_get_top_level_objects(
120  const sc_simcontext* simc_p);
121 bool sc_is_running( const sc_simcontext* simc_p );
122 void sc_pause();
124 void sc_start( const sc_time&, sc_starvation_policy );
126 void sc_set_time_resolution( double, sc_time_unit );
127 sc_time sc_get_time_resolution();
128 void sc_set_default_time_unit( double, sc_time_unit );
129 sc_time sc_get_default_time_unit();
130 bool sc_pending_activity_at_current_time( const sc_simcontext* );
131 bool sc_pending_activity_at_future_time( const sc_simcontext* );
132 sc_time sc_time_to_pending_activity( const sc_simcontext* );
133 
134 struct sc_invoke_method;
135 
139 // 05/22/2015 GL.
143  explicit sc_kernel_lock();
144  ~sc_kernel_lock();
145 };
146 
147 // 09/01/2019 ZC.
148 extern const char* _OoO_Table_File_Name;
149 
150 // 09/01/2019 ZC.
151 // extern std::string _OoO_File_Name_;
152 // 02/21/2017 ZC.
153 extern unsigned int _OoO_Combined_Data_Conflict_Table_Size;
154 
155 // 02/21/2017 ZC.
157 
158 // 02/21/2017 ZC.
160 
161 // 02/21/2017 ZC.
163 
164 // 02/21/2017 ZC.
166 
167 // 02/21/2017 ZC.
168 // extern unsigned int _OoO_Prediction_Event_Notification_Table_Number_Segments;
169 
170 // 02/21/2017 ZC.
171 // extern unsigned int _OoO_Prediction_Event_Notification_Table_Max_Instances;
172 
173 // 02/21/2017 ZC.
175 
176 // 02/21/2017 ZC.
178 
179 
180 // 02/21/2017 ZC.
182 
183 // 02/21/2017 ZC.
185 
186 // 02/21/2017 ZC.
188 
189 // 02/21/2017 ZC.
191 
192 // 02/21/2017 ZC.
194 
195 // 02/21/2017 ZC.
196 // extern long long _OoO_Prediction_Event_Notification_Table_Time_Units[];
197 
198 // 02/21/2017 ZC.
199 // extern int _OoO_Prediction_Event_Notification_Table_Delta[];
200 
201 // 02/21/2017 ZC.
203 
204 // 02/21/2017 ZC.
206 
207 // 02/21/2017 ZC.
208 // extern int _OoO_Prediction_Event_Notification_Lookup_Table[];
209 
210 // 02/21/2017 ZC.
212 
213 
217 // 08/17/2015 GL.
218 extern bool _OoO_Data_Conflict_Table[];
219 
223 // 08/17/2015 GL.
224 extern unsigned int _OoO_Data_Conflict_Table_Size;
225 
229 // 08/17/2015 GL.
230 extern bool _OoO_Event_Notify_Table[];
231 
235 // 08/17/2015 GL.
236 extern unsigned int _OoO_Event_Notify_Table_Size;
237 
242 // 09/01/2015 GL.
244 
248 // 09/01/2015 GL.
249 extern unsigned int _OoO_Max_Number_of_Instances;
250 
254 // 09/01/2015 GL.
255 extern unsigned int _OoO_Number_of_Segments;
256 
261 // 08/18/2015 GL.
262 extern long long _OoO_Curr_Time_Advance_Table_Time[];
263 
268 // 08/18/2015 GL.
270 
274 // 08/18/2015 GL.
275 extern unsigned int _OoO_Curr_Time_Advance_Table_Size;
276 
281 // 08/18/2015 GL.
282 extern long long _OoO_Next_Time_Advance_Table_Time[];
283 
288 // 08/18/2015 GL.
290 
294 // 08/18/2015 GL.
295 extern unsigned int _OoO_Next_Time_Advance_Table_Size;
296 
300 // 09/01/2015 GL.
302 
306 // 09/01/2015 GL.
308 
309 /**************************************************************************/
315 class sc_segid{
316 public:
317  int seg_id;
318  inline explicit sc_segid(int val):
319  seg_id(val)
320  {}
321 };
322 
323 /**************************************************************************/
330 {
331  //DM 05/16/2019
332  friend class Invoker;
333 
334  friend struct sc_invoke_method;
335  friend class sc_event;
336  friend class sc_module;
337 
338  // 04/07/2015 GL: a new sc_channel class is derived from sc_module
339  friend class sc_channel;
340 
341  friend class sc_object;
342  friend class sc_time;
343  friend class sc_clock;
344  friend class sc_method_process;
346  friend class sc_process_b;
347  friend class sc_process_handle;
348  friend class sc_prim_channel;
349  friend class sc_cthread_process;
350  friend class sc_thread_process;
351  friend class sc_runnable;
352  friend sc_dt::uint64 sc_delta_count();
353  friend const std::vector<sc_event*>& sc_get_top_level_events(
354  const sc_simcontext* simc_p);
355  friend const std::vector<sc_object*>& sc_get_top_level_objects(
356  const sc_simcontext* simc_p);
357  friend bool sc_is_running( const sc_simcontext* simc_p );
358  friend void sc_pause();
359  friend bool sc_end_of_simulation_invoked();
360  friend void sc_start( const sc_time&, sc_starvation_policy );
361  friend bool sc_start_of_simulation_invoked();
362  friend void sc_thread_cor_fn(void*);
363  friend void sc_method_cor_fn(void*);//DM 05/24/2019
367 
368  // 05/25/2015 GL: a scoped mutex for the kernel lock
369  friend struct sc_kernel_lock;
370 
371  // 05/26/2015 GL: get sc_cor pointer
372  friend sc_cor* get_cor_pointer( sc_process_b* process_p );
373 
374 
375  void init();
376  void clean();
377 public:
378 
379  sc_simcontext();
380  ~sc_simcontext();
381 
382  void initialize( bool = false );
383 
388  // 08/20/2015 GL.
389  void cycle( const sc_time& );
390 
391  void simulate( const sc_time& duration );
392  void stop();
393  void end();
394  void reset();
395 
396  void print_threads_states();
397  void print_events_states();
398 
399  // 11/05/2014 GL: thread mapping function used in parallel simulators
400  //void mapper( sc_cor *cor );
401 
407  // 05/18/2015 GL.
408  //void schedule( sc_cor *cor );
409 
410  //DM 08/11/2019 update dependency set
411  void update_dependency_set();
412 
416  // 08/12/2015 GL.
417  void oooschedule( sc_cor *cor );
418 
419  int sim_status() const;
420  bool elaboration_done() const;
421 
422  std::vector<sc_thread_handle>& get_active_invokers();
423 
425 
426  inline sc_status get_status() const;
427 
429 
430  void hierarchy_push( sc_module* );
432  sc_module* hierarchy_curr() const;
435  sc_object* find_object( const char* name );
436 
441 
442  // to generate unique names for objects in an MT-Safe way
443  const char* gen_unique_name( const char* basename_,
444  bool preserve_first = false
445  );
446 
447  // process creation
448 
453  // 06/12/2015 GL: modified for the OoO simulation
454  // 09/02/2015 GL: set the instance id
456  const char* name_p, bool free_host, SC_ENTRY_FUNC method_p,
457  sc_process_host* host_p, const sc_spawn_options* opt_p,
458  int seg_id, int inst_id );
459 
464  // 06/12/2015 GL: modified for the OoO simulation
465  // 09/02/2015 GL: set the instance id
467  const char* name_p, bool free_host, SC_ENTRY_FUNC method_p,
468  sc_process_host* host_p, const sc_spawn_options* opt_p,
469  int seg_id, int inst_id );
470 
475  // 06/12/2015 GL: modified for the OoO simulation
476  // 09/02/2015 GL: set the instance id
478  const char* name_p, bool free_host, SC_ENTRY_FUNC method_p,
479  sc_process_host* host_p, const sc_spawn_options* opt_p,
480  int seg_id, int inst_id );
481 
482 private:
483  //DM 05/15/2019 for method clustering
484  sc_process_handle create_invoker_process(
485  const char* name_p, bool free_host, SC_ENTRY_FUNC method_p,
486  sc_process_host* host_p, const sc_spawn_options* opt_p,
487  int invoker_id );
488 
489 public:
490  // 10/28/2014 GL: to be replaced by get_curr_proc
491  //sc_curr_proc_handle get_curr_proc_info();
492 
493  sc_process_b* get_curr_proc() const;
494  sc_object* get_current_writer() const;
495  bool write_check() const;
496 
501  // 10/29/2014 GL.
502  void set_curr_proc( sc_process_b* );
503 
504  void reset_curr_proc();
505 
506  int next_proc_id();
507 
508  void add_trace_file( sc_trace_file* );
510 
511  friend void sc_set_time_resolution( double, sc_time_unit );
513  friend void sc_set_default_time_unit( double, sc_time_unit );
515 
516  const sc_time& max_time() const;
517 
518  // 08/19/2015 GL: obsolete, to be removed in the future
519  const sc_time& time_stamp();
520 
521  sc_dt::uint64 change_stamp() const;
522 
523  // 08/19/2015 GL: obsolete, to be removed in the future
524  sc_dt::uint64 delta_count() const;
525 
526  bool event_occurred( sc_dt::uint64 last_change_count ) const;
527  bool evaluation_phase() const;
528  bool is_running() const;
529  bool update_phase() const;
530  bool notify_phase() const;
531  bool get_error();
532  void set_error( sc_report* );
533 
535  { return m_cor_pkg; }
536  sc_cor* next_cor(); // 11/05/2014 GL: obsolete, to be removed in the future
537 
538  const ::std::vector<sc_object*>& get_child_objects() const;
539 
540  void elaborate();
541  void prepare_to_simulate();
542 
547  // 08/19/2015 GL.
548  inline void initial_crunch( bool no_crunch );
549 
550  bool next_time( sc_time& t ) const;
551  bool pending_activity_at_current_time() const;
552 
556  // 11/05/2014 GL.
558 
562  // 11/05/2014 GL.
564 
568  // 11/05/2014 GL.
569  void suspend_cor( sc_cor* );
570 
574  // 11/05/2014 GL.
575  void resume_cor( sc_cor* );
576 
580  // 04/29/2015 GL.
581  bool is_locked();
582 
586  // 04/29/2015 GL.
587  bool is_unlocked();
588 
593  // 04/29/2015 GL.
594  bool is_lock_owner();
595 
600  // 04/29/2015 GL.
601  bool is_not_owner();
602 
607  // 04/29/2015 GL.
608  bool is_locked_and_owner();
609 
614  // 09/02/2015 GL.
615  unsigned int conflict_table_index_lookup( int, int );
616 
620  // 09/02/2015 GL.
621  unsigned int time_adv_table_index_lookup( int );
622 
623 private:
624  void clean_up_old_event_notifications();
625  void predict_wakeup_create_defining_tree(
626  std::unordered_map<sc_process_b*, std::unordered_map<sc_event*, sc_timestamp> >& wkup_t_evnt);
627  void predict_wakeup_time_by_running_ready_threads();
628  void predict_wakeup_time_by_events(
629  std::unordered_map<sc_process_b*, std::unordered_map<sc_event*, sc_timestamp> >& wkup_t_evnt);
630  void predict_wakeup_time_by_waiting_threads(
631  std::unordered_map<sc_process_b*, std::unordered_map<sc_event*, sc_timestamp> >& wkup_t_evnt);
632 // std::unordered_map<sc_process_b*, sc_timestamp>& wkup_t_pred_and_evnt,
633 // std::unordered_map<sc_process_b*, std::map<sc_event*, sc_timestamp> >& wkup_t_evnt,
634 // std::unordered_map<sc_process_b*, sc_timestamp>& wkup_t_prd_run_rdy);
635  bool check_and_deliver_events();
636 
637 
638  void add_child_event( sc_event* );
639  void add_child_object( sc_object* );
640  void remove_child_event( sc_event* );
641  void remove_child_object( sc_object* );
642 
643  //void crunch( bool once=false );
644 
645  int add_delta_event( sc_event* );
646  void remove_delta_event( sc_event* );
647  void add_timed_event( sc_event_timed* );
648 
649  void trace_cycle( bool delta_cycle );
650 
651  const ::std::vector<sc_event*>& get_child_events_internal() const;
652  const ::std::vector<sc_object*>& get_child_objects_internal() const;
653 
654  void execute_method_next( sc_method_handle );
655  void execute_thread_next( sc_thread_handle );
656 
657  sc_method_handle pop_runnable_method();
658  sc_thread_handle pop_runnable_thread();
659 
664  // 10/28/2014 GL.
665  void preempt_with( sc_method_handle );
666 
671  // 10/28/2014 GL.
672  inline void preempt_with( sc_thread_handle );
673 
674  void push_runnable_method( sc_method_handle );
675  void push_runnable_thread( sc_thread_handle );
676 
677  void push_runnable_method_front( sc_method_handle );
678  void push_runnable_thread_front( sc_thread_handle );
679 
680  void remove_runnable_method( sc_method_handle );
681  void remove_runnable_thread( sc_thread_handle );
682 
683  void requeue_current_process();
684  void suspend_current_process();
685 
686  void do_sc_stop_action();
687  void mark_to_collect_process( sc_process_b* zombie_p );
688 
692  // 05/22/2015 GL.
693  void acquire_sched_mutex();
694 
698  // 05/22/2015 GL.
699  void release_sched_mutex();
700 
704  // 08/17/2015 GL.
705  bool has_no_conflicts( sc_process_b*, std::list<sc_method_handle>, std::list<sc_thread_handle> );
706  //DM 07/31/2019 experiment
707  bool has_no_conflicts_method( sc_process_b*, std::list<sc_method_handle>, std::list<sc_thread_handle> );
708 
712  // 02/22/2017 ZC.
713  //int reverse_event_prediction_index_lookup_seg( int );
714 
718  // 02/22/2017 ZC.
719  //int reverse_event_prediction_index_lookup_inst( int );
720 
724  // 02/22/2017 ZC.
725  int combined_data_conflict_table_index_lookup( int , int );
726 
730  // 02/22/2017 ZC.
731  int event_prediction_table_index_lookup( int , int );
732 
736  // 02/22/2017 ZC.
737  int prediction_time_advance_table_index_lookup( int);
738 
742  // 02/22/2017 ZC.
743  bool conflict_between_two_segs(
744  int ,
745  int ,
746  int ,
747  int ,
748  sc_timestamp ,
749  sc_timestamp );
750 
754  // 02/22/2017 ZC.
755  bool conflict_between_with_prediction( sc_process_b*, sc_process_b* );
756 
760  // 10:54 2017/3/10 ZC.
761  void add_to_wait_queue( sc_process_b*) ;
762  void remove_from_wait_queue(sc_process_b*) ;
763 
767  // 08/17/2015 GL.
768  bool conflict_between( sc_process_b*, sc_process_b* );
769 
773  // 12/22/2016 GL.
774  void update_oldest_time( sc_time& curr_time );
775 
776 
777 private:
778 
779  enum execution_phases {
780  phase_initialize = 0,
781  phase_evaluate,
782  phase_update,
783  phase_notify
784  };
785  sc_object_manager* m_object_manager;
786 
787  sc_module_registry* m_module_registry;
788  sc_port_registry* m_port_registry;
789  sc_export_registry* m_export_registry;
790  sc_prim_channel_registry* m_prim_channel_registry;
791  sc_phase_callback_registry* m_phase_cb_registry;
792 
793  sc_name_gen* m_name_gen;
794 
795  sc_process_table* m_process_table;
796 
797  // 10/22/2014 GL: to be removed
798  //sc_curr_proc_info m_curr_proc_info;
799 
800  std::list<sc_process_b*> m_curr_proc_queue;
801 
802  // 10/22/2014 GL: to be replaced by m_curr_proc_queue.size()
803  //int m_curr_proc_num;
804 
805  // 02/06/2015 GL: to be removed
806  //sc_object* m_current_writer;
807 
808  bool m_write_check;
809  int m_next_proc_id;
810 
811  std::vector<sc_thread_handle> m_active_invokers;
812 
813  std::vector<sc_event*> m_child_events;
814  std::vector<sc_object*> m_child_objects;
815 
816  std::vector<sc_event*> m_delta_events;
817  sc_ppq<sc_event_timed*>* m_timed_events;
818 
819  std::vector<sc_trace_file*> m_trace_files;
820  bool m_something_to_trace;
821 
822  sc_runnable* m_runnable;
823  sc_process_list* m_collectable;
824 
825  sc_time_params* m_time_params;
826 
827  // 08/17/2015 GL: no global time count
828  //sc_time m_curr_time;
829 
830  mutable sc_time m_max_time;
831 
832  sc_invoke_method* m_method_invoker_p;
833  sc_dt::uint64 m_change_stamp; // "time" change occurred.
834 
835  // 08/17/2015 GL: no global delta count
836  //sc_dt::uint64 m_delta_count;
837 
838  bool m_forced_stop;
839  bool m_paused;
840  bool m_ready_to_simulate;
841  bool m_elaboration_done;
842  execution_phases m_execution_phase;
843  sc_report* m_error;
844  bool m_in_simulator_control;
845  bool m_end_of_simulation_called;
846  sc_status m_simulation_status;
847  bool m_start_of_simulation_called;
848 
849  sc_cor_pkg* m_cor_pkg; // the simcontext's coroutine package
850  sc_cor* m_cor; // the simcontext's coroutine
851 
852  // 05/19/2015 GL: the following variables are used in
853  // sc_simcontext::schedule
854  bool m_one_delta_cycle;
855  bool m_one_timed_cycle;
856  sc_time m_finish_time;
857 
858 
859  // 12/22/2016 GL: the oldest timestamp in simulation
860 
861 
862  long* workload_table;
863 
864  long* visits;
865 
866  long old_sys_time;
867  // 03/10/2017 ZC: wait queue
868  //std::list<sc_process_b*> m_waiting_proc_queue; //DM 08/16/2019 to unordered_set
869  std::unordered_set<sc_process_b*> m_waiting_proc_queue;
870 
871 private:
872 
873  // disabled
874  sc_simcontext( const sc_simcontext& );
875  sc_simcontext& operator = ( const sc_simcontext& );
876 
877 public:
878  //std::list<sc_thread_handle> m_synch_thread_queue;
879  std::list<sc_process_b*> m_synch_thread_queue; //DM 05/27/2019 synch queue now includes both threads and methods
880 
881  // 12/22/2016 GL: a list of all threads and methods created in simulation
882  std::list<sc_process_b*> m_all_proc;
883 //4/10/2018 DM
884 private:
885  sc_time oldest_untraced_time;
886 
887  // 18.8.6 ZC paused processes, which is for sc_start(time)
888  std::vector<sc_process_b*> m_paused_processes;
889 
890 
891 public:
898  std::list<sc_process_b*> m_waking_up_threads;
899 
900 private:
901 //05/15/2019 DM TODO: use C++11 data structures
902 std::unordered_map<sc_process_b*,Invoker*> method_to_invoker_map;
903 std::vector<Invoker*> m_invokers;
904 std::unordered_set<Invoker*> ready_invokers;
905 std::unordered_set<Invoker*> running_invokers;
906 //bool check_and_deliver_events_now;
907 bool event_notification_update;
908 //DM 07/24/2019 sc_methods updates:
909 unsigned int running_methods;
910 // DM 07/28/2019 experiment
911 int num_kernel_requests;
912 pthread_mutex_t kernel_request_mutex;
913 //DM 08/14/2019 experiment
914 std::list<sc_process_b*> new_waiting_proc;
915 std::unordered_set<sc_process_b*> mod_wakeup_proc;
916 std::unordered_set<sc_process_b*> defining_tree;
917 unsigned long long total_runrdycheck;
918 unsigned long long total_eventcheck;
919 unsigned long long total_waitcheck;
920 unsigned long long total_threadevent;
921 unsigned long long total_delivery;
922 unsigned long long total_eventpred;
923 std::unordered_map<sc_process_b*,std::unordered_set<sc_event*> > new_event_notify;
924 //std::vector<std::unordered_set<sc_process_b*> > running_groups;
925 //std::vector<std::unordered_set<sc_process_b*> > proc_groups;
926 };
927 
928 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
929 
930 // Not MT safe.
931 
932 #if 1
935 
936 inline sc_simcontext*
938 {
939  if( sc_curr_simcontext == 0 ) {
942  }
943  return sc_curr_simcontext;
944 }
945 #else
946  extern sc_simcontext* sc_get_curr_simcontext();
947 #endif // 0
949 {
951 }
952 
953 
954 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
955 
956 inline
957 bool
959 {
960  return m_elaboration_done;
961 }
962 
963 
965 {
966  return m_simulation_status != SC_RUNNING ?
967  m_simulation_status :
968  (m_in_simulator_control ? SC_RUNNING : SC_PAUSED);
969 }
970 
971 inline
972 int
974 {
975  if( m_error ) {
976  return SC_SIM_ERROR;
977  }
978  if( m_forced_stop ) {
979  return SC_SIM_USER_STOP;
980  }
981  return SC_SIM_OK;
982 }
983 
984 
985 inline
988 {
989  return m_object_manager;
990 }
991 
992 inline
995 {
996  return m_module_registry;
997 }
998 
999 inline
1002 {
1003  return m_port_registry;
1004 }
1005 
1006 inline
1009 {
1010  return m_export_registry;
1011 }
1012 
1013 inline
1016 {
1017  return m_prim_channel_registry;
1018 }
1019 
1020 
1021 inline
1022 int
1024 {
1025  return ( ++ m_next_proc_id );
1026 }
1027 
1028 
1029 inline
1030 const sc_time&
1032 {
1033  if ( m_max_time == SC_ZERO_TIME )
1034  {
1035 // current RISC implementation uses 'long long', not 'unsigned long long'
1036 // (this was a poor choice to allow for "special" values, not easy to change now)
1037 // m_max_time = sc_time::from_value( ~sc_dt::UINT64_ZERO );
1038  m_max_time = sc_time::from_value( LLONG_MAX - 0x02ff );
1039  // note: lowest 10 bits are lost due to 'double' conversion (08/23/19, RD)
1040 // printf("DEBUG: m_max_time.m_value = %lld\n", m_max_time.m_value);
1041  }
1042  return m_max_time;
1043 }
1044 
1045 inline
1048 {
1049  return m_change_stamp;
1050 }
1051 
1052 
1053 
1054 inline
1055 bool
1057 {
1058  return m_change_stamp == last_change_stamp;
1059 }
1060 
1061 inline
1062 bool
1064 {
1065  return (m_execution_phase == phase_evaluate) &&
1066  m_ready_to_simulate;
1067 }
1068 
1069 inline
1070 bool
1072 {
1073  return m_execution_phase == phase_update;
1074 }
1075 
1076 inline
1077 bool
1079 {
1080  return m_execution_phase == phase_notify;
1081 }
1082 
1083 inline
1084 void
1086 {
1087  delete m_error;
1088  m_error = err;
1089 }
1090 
1091 
1092 inline
1093 bool
1095 {
1096  return m_error != NULL;
1097 }
1098 
1099 inline
1100 int
1101 sc_simcontext::add_delta_event( sc_event* e )
1102 {
1103  m_delta_events.push_back( e );
1104  return ( m_delta_events.size() - 1 );
1105 }
1106 
1107 inline
1108 void
1109 sc_simcontext::add_timed_event( sc_event_timed* et )
1110 {
1111  m_timed_events->insert( et );
1112 }
1113 
1114 inline sc_object*
1116 {
1117  // 02/06/2015 GL: m_current_writer are different in different threads
1118  return m_write_check ? get_curr_proc() : (sc_object*)0;
1119 }
1120 
1121 inline bool
1123 {
1124  return m_write_check;
1125 }
1126 
1127 inline void
1129 {
1130  m_curr_proc_queue.remove( proc );
1131 }
1132 
1133 inline bool
1135 {
1136  for ( std::list<sc_process_b*>::iterator it = m_curr_proc_queue.begin();
1137  it != m_curr_proc_queue.end(); it++ )
1138  if ( *it == proc )
1139  return true;
1140  return false;
1141 }
1142 
1143 
1144 // ----------------------------------------------------------------------------
1145 
1146 class sc_process_handle;
1148 
1149 // Get the current object hierarchy context
1150 //
1151 // Returns a pointer the the sc_object (module or process) that
1152 // would become the parent object of a newly created element
1153 // of the SystemC object hierarchy, or NULL.
1154 //
1155 inline sc_object*
1157 {
1159 }
1160 
1161 inline
1162 sc_process_b*
1164 {
1166 }
1167 
1168 // THE FOLLOWING FUNCTION IS DEPRECATED IN 2.1
1170 
1171 inline
1174 {
1176 }
1177 
1178 
1180 {
1181  return sc_get_curr_simcontext()->sim_status();
1182 }
1183 
1184 
1185 // Generates unique names within each module.
1186 extern
1187 const char*
1188 sc_gen_unique_name( const char* basename_, bool preserve_first = false );
1189 
1190 
1191 // Set the random seed for controlled randomization -- not yet implemented
1192 extern
1193 void
1194 sc_set_random_seed( unsigned int seed_ );
1195 
1196 
1197 extern void sc_initialize();
1198 
1199 extern const sc_time& sc_max_time(); // Get maximum time value.
1200 extern const sc_time& sc_time_stamp(); // Current simulation time.
1201 extern double sc_simulation_time(); // Current time in default time units.
1202 //4/10/2018 DM
1203 extern const sc_time& get_current_trace_time();
1204 
1205 inline
1206 const std::vector<sc_event*>& sc_get_top_level_events(
1207  const sc_simcontext* simc_p = sc_get_curr_simcontext() )
1208 {
1209  return simc_p->m_child_events;
1210 }
1211 
1212 inline
1213 const std::vector<sc_object*>& sc_get_top_level_objects(
1214  const sc_simcontext* simc_p = sc_get_curr_simcontext() )
1215 {
1216  return simc_p->m_child_objects;
1217 }
1218 
1219 extern sc_event* sc_find_event( const char* name );
1220 
1221 extern sc_object* sc_find_object( const char* name );
1222 
1226 inline
1228 {
1229  //return sc_get_curr_simcontext()->m_delta_count;
1230 
1231  // 08/20/2015 GL: get the local delta count instead of the global one
1233 
1234  if ( proc )
1235  return proc->get_timestamp().get_delta_count();
1236  else
1237  return 0;
1238 }
1239 
1240 inline
1242 {
1243  return simc_p->m_ready_to_simulate;
1244 }
1245 
1246 bool sc_is_unwinding();
1247 
1248 inline void sc_pause()
1249 {
1250  sc_get_curr_simcontext()->m_paused = true;
1251 }
1252 
1253 // Return indication if there are more processes to execute in this delta phase
1254 
1257 {
1258  return simc_p->pending_activity_at_current_time();
1259 }
1260 
1261 // Return indication if there are timed notifications in the future
1262 
1265 {
1266  sc_time ignored;
1267  return simc_p->next_time( ignored );
1268 }
1269 
1270 // Return indication if there are processes to run,
1271 // or notifications in the future
1272 
1273 inline bool sc_pending_activity
1275 {
1276  return sc_pending_activity_at_current_time( simc_p )
1278 }
1279 
1280 sc_time
1282  ( const sc_simcontext* simc_p = sc_get_curr_simcontext() );
1283 
1284 
1285 inline
1286 bool
1288 {
1289  return sc_get_curr_simcontext()->m_end_of_simulation_called;
1290 }
1291 
1292 inline bool sc_hierarchical_name_exists( const char* name )
1293 {
1294  return sc_find_object(name) || sc_find_event(name);
1295 }
1296 
1297 inline
1298 bool
1300 {
1301  return sc_get_curr_simcontext()->m_start_of_simulation_called;
1302 }
1303 
1304 // The following variable controls whether process control corners should
1305 // be considered errors or not. See sc_simcontext.cpp for details on what
1306 // happens if this value is set to true.
1307 
1309 
1310 } // namespace sc_core
1311 
1312 /*****************************************************************************
1313 
1314  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
1315  changes you are making here.
1316 
1317  Name, Affiliation, Date: Andy Goodrich, Forte Design Systems 20 May 2003
1318  Description of Modification: - phase callbacks
1319  - sc_stop mode
1320 
1321  Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
1322  25 August, 2003
1323  Description of Modification: - support for dynamic process
1324  - support for sc export registry
1325  - new member methods elaborate(),
1326  prepare_to_simulate(), and initial_crunch()
1327  that are invoked by initialize() in that order
1328  - add sc_get_last_created_process_handle() for
1329  use before simulation starts
1330 
1331  Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
1332  3 March, 2004
1333  Description of Modification: add sc_get_curr_process_kind()
1334 
1335  Name, Affiliation, Date:
1336  Description of Modification:
1337 
1338  *****************************************************************************/
1339 // $Log: sc_simcontext.h,v $
1340 // Revision 1.26 2011/09/05 21:20:22 acg
1341 // Andy Goodrich: result of automake invocation.
1342 //
1343 // Revision 1.25 2011/09/01 15:28:10 acg
1344 // Andy Goodrich: the aftermath of automake.
1345 //
1346 // Revision 1.24 2011/08/29 18:04:32 acg
1347 // Philipp A. Hartmann: miscellaneous clean ups.
1348 //
1349 // Revision 1.23 2011/08/26 20:46:10 acg
1350 // Andy Goodrich: moved the modification log to the end of the file to
1351 // eliminate source line number skew when check-ins are done.
1352 //
1353 // Revision 1.22 2011/08/24 22:05:51 acg
1354 // Torsten Maehne: initialization changes to remove warnings.
1355 //
1356 // Revision 1.21 2011/05/09 04:07:49 acg
1357 // Philipp A. Hartmann:
1358 // (1) Restore hierarchy in all phase callbacks.
1359 // (2) Ensure calls to before_end_of_elaboration.
1360 //
1361 // Revision 1.20 2011/04/08 18:26:07 acg
1362 // Andy Goodrich: added execute_method_next() to handle method dispatch
1363 // for asynchronous notifications that occur outside the evaluation phase.
1364 //
1365 // Revision 1.19 2011/04/05 20:50:57 acg
1366 // Andy Goodrich:
1367 // (1) changes to make sure that event(), posedge() and negedge() only
1368 // return true if the clock has not moved.
1369 // (2) fixes for method self-resumes.
1370 // (3) added SC_PRERELEASE_VERSION
1371 // (4) removed kernel events from the object hierarchy, added
1372 // sc_hierarchical_name_exists().
1373 //
1374 // Revision 1.18 2011/03/20 13:43:23 acg
1375 // Andy Goodrich: added async_signal_is() plus suspend() as a corner case.
1376 //
1377 // Revision 1.17 2011/03/07 18:25:19 acg
1378 // Andy Goodrich: tightening of check for resume on a disabled process to
1379 // only produce an error if it is ready to run.
1380 //
1381 // Revision 1.16 2011/03/06 15:58:50 acg
1382 // Andy Goodrich: added escape to turn off process control corner case
1383 // checks.
1384 //
1385 // Revision 1.15 2011/03/05 04:45:16 acg
1386 // Andy Goodrich: moved active process calculation to the sc_simcontext class.
1387 //
1388 // Revision 1.14 2011/03/05 01:39:21 acg
1389 // Andy Goodrich: changes for named events.
1390 //
1391 // Revision 1.13 2011/02/18 20:27:14 acg
1392 // Andy Goodrich: Updated Copyrights.
1393 //
1394 // Revision 1.12 2011/02/13 21:47:38 acg
1395 // Andy Goodrich: update copyright notice.
1396 //
1397 // Revision 1.11 2011/02/13 21:34:35 acg
1398 // Andy Goodrich: added SC_UNITIALIZED enum value to process status so
1399 // its possible to detect throws before initialization.
1400 //
1401 // Revision 1.10 2011/02/11 13:25:24 acg
1402 // Andy Goodrich: Philipp A. Hartmann's changes:
1403 // (1) Removal of SC_CTHREAD method overloads.
1404 // (2) New exception processing code.
1405 //
1406 // Revision 1.9 2011/02/01 21:18:56 acg
1407 // Andy Goodrich: addition of new preempt_with() method used to immediately
1408 // throw exceptions from threads.
1409 //
1410 // Revision 1.8 2011/01/25 20:50:37 acg
1411 // Andy Goodrich: changes for IEEE 1666 2011.
1412 //
1413 // Revision 1.7 2011/01/19 23:21:50 acg
1414 // Andy Goodrich: changes for IEEE 1666 2011
1415 //
1416 // Revision 1.6 2011/01/18 20:10:45 acg
1417 // Andy Goodrich: changes for IEEE1666_2011 semantics.
1418 //
1419 // Revision 1.5 2010/07/22 20:02:33 acg
1420 // Andy Goodrich: bug fixes.
1421 //
1422 // Revision 1.4 2009/05/22 16:06:29 acg
1423 // Andy Goodrich: process control updates.
1424 //
1425 // Revision 1.3 2008/05/22 17:06:26 acg
1426 // Andy Goodrich: updated copyright notice to include 2008.
1427 //
1428 // Revision 1.2 2007/09/20 20:32:35 acg
1429 // Andy Goodrich: changes to the semantics of throw_it() to match the
1430 // specification. A call to throw_it() will immediately suspend the calling
1431 // thread until all the throwees have executed. At that point the calling
1432 // thread will be restarted before the execution of any other threads.
1433 //
1434 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
1435 // SystemC 2.3
1436 //
1437 // Revision 1.13 2006/05/08 18:00:06 acg
1438 // Andy Goodrich: added David Long's forward declarations for friend
1439 // functions, methods, and operators to keep the Microsoft compiler happy.
1440 //
1441 // Revision 1.11 2006/04/11 23:13:21 acg
1442 // Andy Goodrich: Changes for reduced reset support that only includes
1443 // sc_cthread, but has preliminary hooks for expanding to method and thread
1444 // processes also.
1445 //
1446 // Revision 1.10 2006/03/21 00:00:34 acg
1447 // Andy Goodrich: changed name of sc_get_current_process_base() to be
1448 // sc_get_current_process_b() since its returning an sc_process_b instance.
1449 //
1450 // Revision 1.9 2006/01/26 21:04:54 acg
1451 // Andy Goodrich: deprecation message changes and additional messages.
1452 //
1453 // Revision 1.8 2006/01/24 20:49:05 acg
1454 // Andy Goodrich: changes to remove the use of deprecated features within the
1455 // simulator, and to issue warning messages when deprecated features are used.
1456 //
1457 // Revision 1.7 2006/01/19 00:29:52 acg
1458 // Andy Goodrich: Yet another implementation for signal write checking. This
1459 // one uses an environment variable SC_SIGNAL_WRITE_CHECK, that when set to
1460 // DISABLE will disable write checking on signals.
1461 //
1462 // Revision 1.6 2006/01/18 21:42:37 acg
1463 // Andy Goodrich: Changes for check writer support.
1464 //
1465 // Revision 1.5 2006/01/13 18:44:30 acg
1466 // Added $Log to record CVS changes into the source.
1467 //
1468 // Revision 1.4 2006/01/03 23:18:44 acg
1469 // Changed copyright to include 2006.
1470 //
1471 // Revision 1.3 2005/12/20 22:11:10 acg
1472 // Fixed $Log lines.
1473 //
1474 // Revision 1.2 2005/12/20 22:02:30 acg
1475 // Changed where delta cycles are incremented to match IEEE 1666. Added the
1476 // event_occurred() method to hide how delta cycle comparisions are done within
1477 // sc_simcontext. Changed the boolean update_phase to an enum that shows all
1478 // the phases.
1479 
1480 #endif
sc_starvation_policy
Definition: sc_simcontext.h:89
friend sc_dt::uint64 sc_delta_count()
This function returns the local delta count of the running process.
void sc_set_time_resolution(double, sc_time_unit)
sc_process_b * sc_get_current_process_b()
void hierarchy_push(sc_module *)
friend struct sc_invoke_method
long long _OoO_Next_Time_Advance_Table_Time[]
Next time advance table (timed cycles) for the out-of-order simulation.
bool evaluation_phase() const
unsigned int _OoO_Combined_Data_Conflict_Lookup_Table_Number_Segments
friend sc_time sc_time_to_pending_activity(const sc_simcontext *)
sc_cor_pkg * cor_pkg()
static sc_time from_value(value_type)
unsigned int _OoO_Time_Advance_Index_Lookup_Table_Size
Size of the index lookup table for the time advance table.
friend sc_cor * get_cor_pointer(sc_process_b *process_p)
bool notify_phase() const
A scoped mutex for the kernel lock.
unsigned int _OoO_Curr_Time_Advance_Table_Size
Size of the current time advance table.
Coroutine package abstract base class.
Definition: sc_cor.h:101
sc_process_b sc_process_b
Definition: sc_process.h:977
void simulate(const sc_time &duration)
A time stamp combining timed cycles and delta cycles.
Definition: sc_process.h:434
Registry for all modules.
sc_object * get_current_writer() const
unsigned int _OoO_Prediction_Event_Notification_Table_No_Indirect_Max_Instances
sc_object * sc_find_object(const char *name)
void oooschedule(sc_cor *cor)
Scheduling function in the OoO simulation.
const sc_time & get_current_trace_time()
Class for storing the time to notify a timed event.
Definition: sc_event.h:398
int sc_get_simulator_status()
friend void sc_pause()
sc_port_registry * get_port_registry()
This class provides access to an sc_process_b object instance in a manner which allows some persisten...
sc_time sc_get_time_resolution()
The clock channel.
Definition: sc_clock.h:43
bool sc_allow_process_control_corners
int _OoO_Combined_Data_Conflict_Table[]
void(sc_process_host::* SC_ENTRY_FUNC)()
Definition: sc_process.h:212
Registry for all exports.
Definition: sc_export.h:217
bool sc_pending_activity(const sc_simcontext *simc_p=sc_get_curr_simcontext())
bool is_not_owner()
Check whether the kernel lock is not owned by the currently running coroutine.
void add_trace_file(sc_trace_file *)
unsigned int _OoO_Data_Conflict_Table_Size
Size of the data conflict table.
sc_object * next_object()
sc_time sc_get_default_time_unit()
sc_object * find_object(const char *name)
void cycle(const sc_time &)
This function is not supported by the out-of-order simulation in the current release.
void sc_pause()
sc_curr_proc_kind sc_get_curr_process_kind()
friend void sc_set_default_time_unit(double, sc_time_unit)
unsigned int _OoO_Combined_Data_Conflict_Lookup_Table_Max_Instances
friend bool sc_end_of_simulation_invoked()
friend class sc_phase_callback_registry
friend void sc_method_cor_fn(void *)
Coroutine abstract base class.
Definition: sc_cor.h:57
sc_starvation_policy m_starvation_policy
long long _OoO_Curr_Time_Advance_Table_Time[]
Current time advance table (timed cycles) for the out-of-order simulation.
unsigned int conflict_table_index_lookup(int, int)
Convert segment ID and instance ID to index in the data conflict table and event notification table...
bool update_phase() const
sc_timestamp m_simulation_time
unsigned int _OoO_Event_Notify_Table_Size
Size of the event notification table.
Registry for all ports.
Definition: sc_port.h:190
class sc_method_process * sc_method_handle
Definition: sc_process.h:120
const int SC_SIM_OK
Definition: sc_status.h:36
bool event_occurred(sc_dt::uint64 last_change_count) const
bool is_locked_and_owner()
Check whether the kernel lock is acquired and owned by the currently running coroutine.
sc_process_b * get_curr_proc() const
bool sc_is_running(const sc_simcontext *simc_p)
void sc_set_random_seed(unsigned int seed_)
bool _OoO_Data_Conflict_Table[]
Data conflict table for the out-of-order simulation.
sc_object * active_object()
void sc_initialize()
User initiated dynamic process support.
Definition: sc_process.h:558
const std::vector< sc_object * > & sc_get_top_level_objects(const sc_simcontext *simc_p)
unsigned int _OoO_Next_Time_Advance_Table_Size
Size of the next time advance table.
unsigned int _OoO_Combined_Data_Conflict_Table_Size
bool next_time(sc_time &t) const
friend sc_time sc_get_time_resolution()
sc_dt::uint64 sc_delta_count()
This function returns the local delta count of the running process.
friend const std::vector< sc_event * > & sc_get_top_level_events(const sc_simcontext *simc_p)
bool pending_activity_at_current_time() const
bool _OoO_Event_Notify_Table[]
Event notification table for the out-of-order simulation.
sc_curr_proc_kind proc_kind() const
Definition: sc_process.h:1120
sc_module_registry * get_module_registry()
const char * sc_gen_unique_name(const char *, bool preserve_first)
void resume_cor(sc_cor *)
Resume a coroutine.
Class that manages the ready-to-run queues.
Definition: sc_runnable.h:42
int _OoO_Prediction_Time_Advance_Lookup_Table[]
friend class sc_runnable
const char * gen_unique_name(const char *basename_, bool preserve_first=false)
friend void sc_set_time_resolution(double, sc_time_unit)
sc_curr_proc_kind
Definition: sc_process.h:126
bool elaboration_done() const
sc_object * sc_get_current_object()
class sc_thread_process * sc_thread_handle
Definition: sc_process.h:121
bool is_running() const
int _OoO_Combined_Data_Conflict_Lookup_Table[]
friend sc_time sc_get_default_time_unit()
const char * _OoO_Table_File_Name
unsigned int _OoO_Prediction_Time_Advance_Table_Number_Segments
std::list< sc_process_b * > m_all_proc
int _OoO_Time_Advance_Index_Lookup_Table[]
Index lookup table for the time advance table.
void remove_running_process(sc_process_b *)
Remove a process from the running queue.
friend const std::vector< sc_object * > & sc_get_top_level_objects(const sc_simcontext *simc_p)
sc_simcontext * sc_curr_simcontext
The event class.
Definition: sc_event.h:260
sc_status sc_get_status()
friend bool sc_is_running(const sc_simcontext *simc_p)
uint64_t uint64
Definition: sc_nbdefs.h:183
const sc_time & sc_time_stamp()
sc_module * hierarchy_pop()
std::list< sc_process_b * > m_synch_thread_queue
sc_timestamp m_simulation_duration
const int SC_SIM_ERROR
Definition: sc_status.h:37
sc_process_handle sc_get_current_process_handle()
bool is_unlocked()
Check whether the kernel lock is released.
void sc_start()
const sc_time & max_time() const
const sc_time & get_oldest_untraced_time()
sc_prim_channel_registry * get_prim_channel_registry()
sc_time sc_time_to_pending_activity(const sc_simcontext *)
The simulation context.
long long _OoO_Prediction_Time_Advance_Table_Time_Units[]
const sc_time & time_stamp()
unsigned int _OoO_Number_of_Segments
The number of segments.
int _OoO_Prediction_Time_Advance_Table_Delta[]
sc_simcontext * simc_p
Base class for all structural entities.
Definition: sc_module.h:83
int _OoO_Prediction_Event_Notification_Table_No_Indirect_Delta[]
const ::std::vector< sc_object * > & get_child_objects() const
sc_object_manager * get_object_manager()
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, int seg_id, int inst_id)
Two new parameters segment ID and instance ID are added for the out-of-order simulation.
bool is_running_process(sc_process_b *)
Check whether a process is in the running queue.
std::list< sc_process_b * > m_waking_up_threads
void initialize(bool=false)
bool is_locked()
Check whether the kernel lock is acquired.
bool write_check() const
void sc_set_stop_mode(sc_stop_mode mode)
void remove_trace_file(sc_trace_file *)
void initial_crunch(bool no_crunch)
This function is partially supported by the out-of-order simulation in the current release...
Registry for all primitive channels.
unsigned int _OoO_Prediction_Event_Notification_Table_No_Indirect_Number_Segments
bool _SYSC_SYNC_PAR_SIM
double sc_simulation_time()
unsigned int _OoO_Prediction_Time_Advance_Table_Number_Steps
Base class for all hierarchical channels.
Definition: sc_module.h:712
bool sc_is_unwinding()
const std::vector< sc_event * > & sc_get_top_level_events(const sc_simcontext *simc_p)
friend void sc_start(const sc_time &, sc_starvation_policy)
bool sc_pending_activity_at_current_time(const sc_simcontext *)
long long _OoO_Prediction_Event_Notification_Table_No_Indirect_Time_Units[]
friend bool sc_pending_activity_at_current_time(const sc_simcontext *)
friend bool sc_start_of_simulation_invoked()
bool is_lock_owner()
Check whether the kernel lock is owned by the currently running coroutine.
sc_simcontext * sc_get_curr_simcontext()
int _OoO_Conflict_Index_Lookup_Table[]
Index lookup table for the data conflict table and event notification table.
sc_plist< sc_process_b * > sc_process_list
Definition: sc_simcontext.h:77
void set_curr_proc(sc_process_b *)
This function is not supported by the out-of-order simulation in the current release.
int _OoO_Next_Time_Advance_Table_Delta[]
Next time advance table (delta cycles) for the out-of-order simulation.
const sc_time SC_ZERO_TIME
bool sc_hierarchical_name_exists(const char *name)
void set_error(sc_report *)
bool sc_end_of_simulation_invoked()
int _OoO_Curr_Time_Advance_Table_Delta[]
Current time advance table (delta cycles) for the out-of-order simulation.
This is the base class for objects which may have processes defined for their methods (e...
Definition: sc_process.h:149
sc_simcontext * sc_default_global_context
sc_process_b * sc_get_curr_process_handle()
sc_dt::uint64 change_stamp() const
sc_status get_status() const
friend void sc_thread_cor_fn(void *)
unsigned int time_adv_table_index_lookup(int)
Convert segment ID to index in the time advance table.
unsigned int _OoO_Max_Number_of_Instances
The maximum number of instances.
const int SC_SIM_USER_STOP
Definition: sc_status.h:38
sc_module * hierarchy_curr() const
const sc_timestamp & get_timestamp()
Set the local time stamp of this process.
value_type get_delta_count() const
Get the value of delta cycles.
int _OoO_Prediction_Event_Notification_No_Indirect_Lookup_Table[]
sc_stop_mode sc_get_stop_mode()
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, int seg_id, int inst_id)
Two new parameters segment ID and instance ID are added for the out-of-order simulation.
const sc_time & sc_max_time()
sc_dt::uint64 delta_count() const
friend bool sc_pending_activity_at_future_time(const sc_simcontext *)
sc_object * first_object()
segment id currently only used for sc_fifo::read(...) as a bug fix
bool sc_pending_activity_at_future_time(const sc_simcontext *)
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, int seg_id, int inst_id)
Two new parameters segment ID and instance ID are added for the out-of-order simulation.
void suspend_cor(sc_cor *)
Suspend a coroutine.
std::vector< sc_thread_handle > & get_active_invokers()
void sc_stop()
Abstract base class of all primitive channel classes.
Abstract base class of all SystemC `simulation&#39; objects.
Definition: sc_object.h:51
sc_event * sc_find_event(const char *name)
void sc_set_default_time_unit(double, sc_time_unit)
sc_export_registry * get_export_registry()
bool sc_start_of_simulation_invoked()
sc_time_unit
Definition: sc_time.h:56