SystemC  Recoding Infrastructure for SystemC v0.6.2 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
sc_module.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_module.h -- Base class of all hierarchical modules and channels.
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 
29 #ifndef SC_MODULE_H
30 #define SC_MODULE_H
31 
33 #include "sysc/kernel/sc_process.h"
36 #include "sysc/kernel/sc_time.h"
37 #include "sysc/kernel/sc_wait.h"
39 #include "sysc/kernel/sc_process.h"
41 #include "sysc/utils/sc_list.h"
42 // 02/22/2016 ZC: to enable verbose display or not
43 #ifndef _SYSC_PRINT_VERBOSE_MESSAGE_ENV_VAR
44 #define _SYSC_PRINT_VERBOSE_MESSAGE_ENV_VAR "SYSC_PRINT_VERBOSE_MESSAGE"
45 #endif
46 namespace sc_core {
47 
48 class Invoker; //DM 05/17/2019
49 
50 class sc_name_gen;
51 template<class T> class sc_in;
52 template<class T> class sc_inout;
53 template<class T> class sc_out;
54 
55 /**************************************************************************/
64 {
67 
68  sc_bind_proxy();
71 };
72 
73 
74 extern const sc_bind_proxy SC_BIND_PROXY_NIL;
75 
76 
77 /**************************************************************************/
83 class sc_module
84 : public sc_object, public sc_process_host
85 {
86  friend class Invoker; //DM 05/17/2019
87 
88  friend class sc_module_name;
89  friend class sc_module_registry;
90  friend class sc_object;
91  friend class sc_port_registry;
92  friend class sc_process_b;
93  friend class sc_simcontext;
94 
95 public:
96 
98  { return simcontext(); }
99 
100  // to generate unique names for objects in an MT-Safe way
101  const char* gen_unique_name( const char* basename_, bool preserve_first );
102 
103  virtual const char* kind() const
104  { return "sc_module"; }
105  void test_message();
106 protected:
107 
108  // called by construction_done
109  virtual void before_end_of_elaboration();
110 
111  void construction_done();
112 
113  // called by elaboration_done (does nothing by default)
114  virtual void end_of_elaboration();
115 
116  void elaboration_done( bool& );
117 
118  // called by start_simulation (does nothing by default)
119  virtual void start_of_simulation();
120 
121  void start_simulation();
122 
123  // called by simulation_done (does nothing by default)
124  virtual void end_of_simulation();
125 
126  void simulation_done();
127 
128  void sc_module_init();
129 
130  // constructor
131  sc_module();
132  sc_module( const sc_module_name& nm ); /* for those used to old style */
133 
134  /* DEPRECATED */ sc_module( const char* nm );
135  /* DEPRECATED */ sc_module( const std::string& nm );
136 
137 public:
138 
139  // destructor
140  virtual ~sc_module();
141 
142  // positional binding methods
143 
146 
148  { return operator << ( interface_ ); }
149 
151  { return operator << ( port_ ); }
152 
153  // operator() is declared at the end of the class.
154 
155  const ::std::vector<sc_object*>& get_child_objects() const;
156 
157 protected:
158 
159  // this must be called by user-defined modules
160  void end_module();
161 
162 
163  // to prevent initialization for SC_METHODs and SC_THREADs
164  void dont_initialize();
165 
166  // positional binding code - used by operator ()
167 
168  void positional_bind( sc_interface& );
169  void positional_bind( sc_port_base& );
170 
171  // set reset sensitivity for SC_xTHREADs
172  void async_reset_signal_is( const sc_in<bool>& port, bool level );
173  void async_reset_signal_is( const sc_inout<bool>& port, bool level );
174  void async_reset_signal_is( const sc_out<bool>& port, bool level );
175  void async_reset_signal_is( const sc_signal_in_if<bool>& iface, bool level);
176  void reset_signal_is( const sc_in<bool>& port, bool level );
177  void reset_signal_is( const sc_inout<bool>& port, bool level );
178  void reset_signal_is( const sc_out<bool>& port, bool level );
179  void reset_signal_is( const sc_signal_in_if<bool>& iface, bool level );
180 
181  // static sensitivity for SC_THREADs and SC_CTHREADs
182 
183  void seg_bound()
184  {
186  }
191  // 08/19/2015 GL: modified for the OoO simulation
192  void wait( int seg_id = -1)
193  { ::sc_core::wait( seg_id, simcontext() ); }
194 
195  // dynamic sensitivity for SC_THREADs and SC_CTHREADs
196 
201  // 08/19/2015 GL: modified for the OoO simulation
202  void wait( const sc_event& e, int seg_id = -1 )
203  {
204  ::sc_core::wait( e, seg_id, simcontext() ); }
205 
210  // 08/19/2015 GL: modified for the OoO simulation
211  void wait( const sc_event_or_list& el, int seg_id = -1)
212  { ::sc_core::wait( el, seg_id, simcontext() ); }
213 
218  // 08/19/2015 GL: modified for the OoO simulation
219  void wait( const sc_event_and_list& el, int seg_id = -1)
220  { ::sc_core::wait( el, seg_id, simcontext() ); }
221 
226  // 08/19/2015 GL: modified for the OoO simulation
227  void wait( const sc_time& t, int seg_id = -1)
228  { ::sc_core::wait( t, seg_id, simcontext() ); }
229 
234  // 08/19/2015 GL: modified for the OoO simulation
235  void wait( double v, sc_time_unit tu, int seg_id = -1)
236  { ::sc_core::wait( sc_time( v, tu, simcontext() ), seg_id,
237  simcontext() ); }
238 
243  // 08/19/2015 GL: modified for the OoO simulation
244  void wait( const sc_time& t, const sc_event& e, int seg_id = -1)
245  { ::sc_core::wait( t, e, seg_id, simcontext() ); }
246 
251  // 08/19/2015 GL: modified for the OoO simulation
252  void wait( double v, sc_time_unit tu, const sc_event& e, int seg_id = -1)
253  { ::sc_core::wait(
254  sc_time( v, tu, simcontext() ), e, seg_id, simcontext() ); }
255 
260  // 08/19/2015 GL: modified for the OoO simulation
261  void wait( const sc_time& t, const sc_event_or_list& el, int seg_id = -1)
262  { ::sc_core::wait( t, el, seg_id, simcontext() ); }
263 
268  // 08/19/2015 GL: modified for the OoO simulation
269  void wait( double v, sc_time_unit tu, const sc_event_or_list& el,
270  int seg_id = -1)
271  { ::sc_core::wait( sc_time( v, tu, simcontext() ), el, seg_id,
272  simcontext() ); }
273 
278  // 08/19/2015 GL: modified for the OoO simulation
279  void wait( const sc_time& t, const sc_event_and_list& el, int seg_id = -1)
280  { ::sc_core::wait( t, el, seg_id, simcontext() ); }
281 
286  // 08/19/2015 GL: modified for the OoO simulation
287  void wait( double v, sc_time_unit tu, const sc_event_and_list& el,
288  int seg_id = -1)
289  { ::sc_core::wait( sc_time( v, tu, simcontext() ), el, seg_id,
290  simcontext() ); }
291 
292 
293  // static sensitivity for SC_METHODs
294 
299  // 08/19/2015 GL: modified for the OoO simulation
300  void next_trigger( )
302 
303 
304  // dynamic sensitivty for SC_METHODs
305 
310  // 08/19/2015 GL: modified for the OoO simulation
311  void next_trigger( const sc_event& e )
313 
318  // 08/19/2015 GL: modified for the OoO simulation
319  void next_trigger( const sc_event_or_list& el )
320  { ::sc_core::next_trigger( el, simcontext() ); }
321 
326  // 08/19/2015 GL: modified for the OoO simulation
327  void next_trigger( const sc_event_and_list& el )
328  { ::sc_core::next_trigger( el, simcontext() ); }
329 
334  // 08/19/2015 GL: modified for the OoO simulation
335  void next_trigger( const sc_time& t )
337 
342  // 08/19/2015 GL: modified for the OoO simulation
343  void next_trigger( double v, sc_time_unit tu )
345  sc_time( v, tu, simcontext() ), simcontext() ); }
346 
351  // 08/19/2015 GL: modified for the OoO simulation
352  void next_trigger( const sc_time& t, const sc_event& e )
353  { ::sc_core::next_trigger( t, e, simcontext() ); }
354 
359  // 08/19/2015 GL: modified for the OoO simulation
360  void next_trigger( double v, sc_time_unit tu, const sc_event& e )
362  sc_time( v, tu, simcontext() ), e, simcontext() ); }
363 
368  // 08/19/2015 GL: modified for the OoO simulation
369  void next_trigger( const sc_time& t, const sc_event_or_list& el )
370  { ::sc_core::next_trigger( t, el, simcontext() ); }
371 
376  // 08/19/2015 GL: modified for the OoO simulation
377  void next_trigger( double v, sc_time_unit tu, const sc_event_or_list& el )
379  sc_time( v, tu, simcontext() ), el, simcontext() ); }
380 
385  // 08/19/2015 GL: modified for the OoO simulation
386  void next_trigger( const sc_time& t, const sc_event_and_list& el )
387  { ::sc_core::next_trigger( t, el, simcontext() ); }
388 
393  // 08/19/2015 GL: modified for the OoO simulation
394  void next_trigger( double v, sc_time_unit tu, const sc_event_and_list& el )
396  sc_time( v, tu, simcontext() ), el, simcontext() ); }
397 
398 
399  // for SC_METHODs and SC_THREADs and SC_CTHREADs
400 
401  bool timed_out()
403 
404 
405  // for SC_CTHREADs
406 
411  // 08/19/2015 GL: modified for the OoO simulation
412  void halt( int seg_id )
413  { ::sc_core::halt( seg_id, simcontext() ); }
414 
419  // 08/19/2015 GL: modified for the OoO simulation
420  void wait( int n, int seg_id)
421  { ::sc_core::wait( n, seg_id, simcontext() ); }
422 
427  // 08/19/2015 GL: modified for the OoO simulation
428  void at_posedge( const sc_signal_in_if<bool>& s, int seg_id )
429  { ::sc_core::at_posedge( s, seg_id, simcontext() ); }
430 
435  // 08/19/2015 GL: modified for the OoO simulation
436  void at_posedge( const sc_signal_in_if<sc_dt::sc_logic>& s, int seg_id )
437  { ::sc_core::at_posedge( s, seg_id, simcontext() ); }
438 
443  // 08/19/2015 GL: modified for the OoO simulation
444  void at_negedge( const sc_signal_in_if<bool>& s, int seg_id )
445  { ::sc_core::at_negedge( s, seg_id, simcontext() ); }
446 
451  // 08/19/2015 GL: modified for the OoO simulation
452  void at_negedge( const sc_signal_in_if<sc_dt::sc_logic>& s, int seg_id )
453  { ::sc_core::at_negedge( s, seg_id, simcontext() ); }
454 
455  // Catch uses of watching:
456  void watching( bool /* expr */ )
457  { SC_REPORT_ERROR(SC_ID_WATCHING_NOT_ALLOWED_,""); }
458 
459  // These are protected so that user derived classes can refer to them.
463 
468  // 04/03/2015 GL.
469  void set_stack_size( std::size_t );
470 
471  int append_port( sc_port_base* );
472 
476  // 09/01/2015 GL.
478 
479 private:
480  sc_module( const sc_module& );
481  const sc_module& operator = ( const sc_module& );
482 
483 private:
484 
485  bool m_end_module_called;
486  std::vector<sc_port_base*>* m_port_vec;
487  int m_port_index;
488  sc_name_gen* m_name_gen;
489  sc_module_name* m_module_name_p;
490 
491 public:
492 
493  void defunct() { }
494 
495  // positional binding methods (cont'd)
496 
497  void operator () ( const sc_bind_proxy& p001,
498  const sc_bind_proxy& p002 = SC_BIND_PROXY_NIL,
499  const sc_bind_proxy& p003 = SC_BIND_PROXY_NIL,
500  const sc_bind_proxy& p004 = SC_BIND_PROXY_NIL,
501  const sc_bind_proxy& p005 = SC_BIND_PROXY_NIL,
502  const sc_bind_proxy& p006 = SC_BIND_PROXY_NIL,
503  const sc_bind_proxy& p007 = SC_BIND_PROXY_NIL,
504  const sc_bind_proxy& p008 = SC_BIND_PROXY_NIL,
505  const sc_bind_proxy& p009 = SC_BIND_PROXY_NIL,
506  const sc_bind_proxy& p010 = SC_BIND_PROXY_NIL,
507  const sc_bind_proxy& p011 = SC_BIND_PROXY_NIL,
508  const sc_bind_proxy& p012 = SC_BIND_PROXY_NIL,
509  const sc_bind_proxy& p013 = SC_BIND_PROXY_NIL,
510  const sc_bind_proxy& p014 = SC_BIND_PROXY_NIL,
511  const sc_bind_proxy& p015 = SC_BIND_PROXY_NIL,
512  const sc_bind_proxy& p016 = SC_BIND_PROXY_NIL,
513  const sc_bind_proxy& p017 = SC_BIND_PROXY_NIL,
514  const sc_bind_proxy& p018 = SC_BIND_PROXY_NIL,
515  const sc_bind_proxy& p019 = SC_BIND_PROXY_NIL,
516  const sc_bind_proxy& p020 = SC_BIND_PROXY_NIL,
517  const sc_bind_proxy& p021 = SC_BIND_PROXY_NIL,
518  const sc_bind_proxy& p022 = SC_BIND_PROXY_NIL,
519  const sc_bind_proxy& p023 = SC_BIND_PROXY_NIL,
520  const sc_bind_proxy& p024 = SC_BIND_PROXY_NIL,
521  const sc_bind_proxy& p025 = SC_BIND_PROXY_NIL,
522  const sc_bind_proxy& p026 = SC_BIND_PROXY_NIL,
523  const sc_bind_proxy& p027 = SC_BIND_PROXY_NIL,
524  const sc_bind_proxy& p028 = SC_BIND_PROXY_NIL,
525  const sc_bind_proxy& p029 = SC_BIND_PROXY_NIL,
526  const sc_bind_proxy& p030 = SC_BIND_PROXY_NIL,
527  const sc_bind_proxy& p031 = SC_BIND_PROXY_NIL,
528  const sc_bind_proxy& p032 = SC_BIND_PROXY_NIL,
529  const sc_bind_proxy& p033 = SC_BIND_PROXY_NIL,
530  const sc_bind_proxy& p034 = SC_BIND_PROXY_NIL,
531  const sc_bind_proxy& p035 = SC_BIND_PROXY_NIL,
532  const sc_bind_proxy& p036 = SC_BIND_PROXY_NIL,
533  const sc_bind_proxy& p037 = SC_BIND_PROXY_NIL,
534  const sc_bind_proxy& p038 = SC_BIND_PROXY_NIL,
535  const sc_bind_proxy& p039 = SC_BIND_PROXY_NIL,
536  const sc_bind_proxy& p040 = SC_BIND_PROXY_NIL,
537  const sc_bind_proxy& p041 = SC_BIND_PROXY_NIL,
538  const sc_bind_proxy& p042 = SC_BIND_PROXY_NIL,
539  const sc_bind_proxy& p043 = SC_BIND_PROXY_NIL,
540  const sc_bind_proxy& p044 = SC_BIND_PROXY_NIL,
541  const sc_bind_proxy& p045 = SC_BIND_PROXY_NIL,
542  const sc_bind_proxy& p046 = SC_BIND_PROXY_NIL,
543  const sc_bind_proxy& p047 = SC_BIND_PROXY_NIL,
544  const sc_bind_proxy& p048 = SC_BIND_PROXY_NIL,
545  const sc_bind_proxy& p049 = SC_BIND_PROXY_NIL,
546  const sc_bind_proxy& p050 = SC_BIND_PROXY_NIL,
547  const sc_bind_proxy& p051 = SC_BIND_PROXY_NIL,
548  const sc_bind_proxy& p052 = SC_BIND_PROXY_NIL,
549  const sc_bind_proxy& p053 = SC_BIND_PROXY_NIL,
550  const sc_bind_proxy& p054 = SC_BIND_PROXY_NIL,
551  const sc_bind_proxy& p055 = SC_BIND_PROXY_NIL,
552  const sc_bind_proxy& p056 = SC_BIND_PROXY_NIL,
553  const sc_bind_proxy& p057 = SC_BIND_PROXY_NIL,
554  const sc_bind_proxy& p058 = SC_BIND_PROXY_NIL,
555  const sc_bind_proxy& p059 = SC_BIND_PROXY_NIL,
556  const sc_bind_proxy& p060 = SC_BIND_PROXY_NIL,
557  const sc_bind_proxy& p061 = SC_BIND_PROXY_NIL,
558  const sc_bind_proxy& p062 = SC_BIND_PROXY_NIL,
559  const sc_bind_proxy& p063 = SC_BIND_PROXY_NIL,
560  const sc_bind_proxy& p064 = SC_BIND_PROXY_NIL );
561 
562 //DM 05/20/2019
563 private:
564  void invoke_method(SC_ENTRY_FUNC);
565 
566 };
567 
568 extern sc_module* sc_module_dynalloc(sc_module*);
569 #define SC_NEW(x) ::sc_core::sc_module_dynalloc(new x);
570 
571 
572 // -----------------------------------------------------------------------------
573 // SOME MACROS TO SIMPLIFY SYNTAX:
574 // -----------------------------------------------------------------------------
575 
576 #define SC_MODULE(user_module_name) \
577  struct user_module_name : ::sc_core::sc_module
578 
579 // 04/07/2015 GL: create a separate sc_channel class
580 #define SC_CHANNEL(user_module_name) \
581  struct user_module_name : ::sc_core::sc_channel
582 
583 #define SC_CTOR(user_module_name) \
584  typedef user_module_name SC_CURRENT_USER_MODULE; \
585  user_module_name( ::sc_core::sc_module_name )
586 
587 // the SC_HAS_PROCESS macro call must be followed by a ;
588 #define SC_HAS_PROCESS(user_module_name) \
589  typedef user_module_name SC_CURRENT_USER_MODULE
590 
591 // The this-> construct on sensitive operators in the macros below is
592 // required for gcc 4.x when a templated class has a templated parent that is
593 // derived from sc_module:
594 //
595 // template<typename X>
596 // class B : public sc_module;
597 // template<typename X>
598 // class A : public B<X>
599 
604 // 06/10/2015 GL: modified for the OoO simulation
605 // 09/01/2015 GL: set the instance id of newly created processes
606 #define declare_method_process(handle, name, host_tag, func, seg_id, inst_id) \
607  { \
608  ::sc_core::sc_process_handle handle = \
609  sc_core::sc_get_curr_simcontext()->create_method_process( \
610  name, false, SC_MAKE_FUNC_PTR( host_tag, func ), \
611  this, 0, seg_id, inst_id ); \
612  this->sensitive << handle; \
613  this->sensitive_pos << handle; \
614  this->sensitive_neg << handle; \
615  }
616 
621 // 06/10/2015 GL: modified for the OoO simulation
622 // 09/01/2015 GL: set the instance id of newly created processes
623 #define declare_thread_process(handle, name, host_tag, func, seg_id, inst_id) \
624  { \
625  ::sc_core::sc_process_handle handle = \
626  sc_core::sc_get_curr_simcontext()->create_thread_process( \
627  name, false, \
628  SC_MAKE_FUNC_PTR( host_tag, func ), \
629  this, 0, seg_id, inst_id ); \
630  this->sensitive << handle; \
631  this->sensitive_pos << handle; \
632  this->sensitive_neg << handle; \
633  }
634 
639 // 06/10/2015 GL: modified for the OoO simulation
640 // 09/01/2015 GL: set the instance id of newly created processes
641 #define declare_cthread_process(handle, name, host_tag, func, edge, \
642  seg_id, inst_id) \
643  { \
644  ::sc_core::sc_process_handle handle = \
645  sc_core::sc_get_curr_simcontext()->create_cthread_process( \
646  name, false, \
647  SC_MAKE_FUNC_PTR( host_tag, func ), \
648  this, 0, seg_id, inst_id ); \
649  this->sensitive.operator() ( handle, edge ); \
650  }
651 
656 // 06/10/2015 GL: modified for the OoO simulation
657 // 09/01/2015 GL: set the instance id of newly created processes
658 #define SC_CTHREAD(func, edge, seg_id, inst_id) \
659  declare_cthread_process( func ## _handle, \
660  #func, \
661  SC_CURRENT_USER_MODULE, \
662  func, \
663  edge, \
664  seg_id, \
665  inst_id )
666 
671 // 06/10/2015 GL: modified for the OoO simulation
672 // 09/01/2015 GL: set the instance id of newly created processes
673 #define SC_METHOD(func, seg_id, inst_id) \
674  declare_method_process( func ## _handle, \
675  #func, \
676  SC_CURRENT_USER_MODULE, \
677  func, \
678  seg_id, \
679  inst_id )
680 
685 // 06/10/2015 GL: modified for the OoO simulation
686 // 09/01/2015 GL: set the instance id of newly created processes
687 #define SC_THREAD(func, seg_id, inst_id) \
688  declare_thread_process( func ## _handle, \
689  #func, \
690  SC_CURRENT_USER_MODULE, \
691  func, \
692  seg_id, \
693  inst_id )
694 
695 
696 
697 // ----------------------------------------------------------------------------
698 // TYPEDEFS
699 // ----------------------------------------------------------------------------
700 
701 // 04/07/2015 GL: create a separate sc_channel class
702 //typedef sc_module sc_channel;
704 
705 
706 /**************************************************************************/
711 // 04/07/2015 GL.
713 : public sc_module
714 {
715  friend class sc_module_name;
716  friend class sc_module_registry;
717  friend class sc_object;
718  friend class sc_port_registry;
719  friend class sc_process_b;
720  friend class sc_simcontext;
721 
722 public:
723 
724  virtual const char* kind() const
725  { return "sc_channel"; }
726 
727 protected:
728 
729  // constructor
730  sc_channel();
731  sc_channel( const sc_module_name& nm ); /* for those used to old style */
732 
733  /* DEPRECATED */ sc_channel( const char* nm );
734  /* DEPRECATED */ sc_channel( const std::string& nm );
735 
736 public:
737 
738  // destructor
739  virtual ~sc_channel();
740 
741 private:
742  sc_channel( const sc_channel& );
743  const sc_channel& operator = ( const sc_channel& );
744 
745 protected:
746 
750  // 04/08/2015 GL.
752 };
753 
754 } // namespace sc_core
755 
756 /*****************************************************************************
757 
758  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
759  changes you are making here.
760 
761  Name, Affiliation, Date: Ali Dasdan, Synopsys, Inc.
762  Description of Modification: - Implementation of operator() and operator,
763  positional connection method.
764  - Implementation of error checking in
765  operator<<'s.
766  - Implementation of the function test_module_prm.
767  - Implementation of set_stack_size().
768 
769  Name, Affiliation, Date: Gene Bushuyev, Synopsys, Inc.
770  Description of Modification: - Change implementation for VC6.
771 
772  Name, Affiliation, Date: Andy Godorich, Forte
773  Bishnupriya Bhattacharya, Cadence Design Systems,
774  25 August, 2003
775  Description of Modification: inherit from sc_process_host as a part of
776  implementing dynamic processes
777 
778  *****************************************************************************/
779 
780 // $Log: sc_module.h,v $
781 // Revision 1.11 2011/08/26 20:46:10 acg
782 // Andy Goodrich: moved the modification log to the end of the file to
783 // eliminate source line number skew when check-ins are done.
784 //
785 // Revision 1.10 2011/08/15 16:43:24 acg
786 // Torsten Maehne: changes to remove unused argument warnings.
787 //
788 // Revision 1.9 2011/03/05 19:44:20 acg
789 // Andy Goodrich: changes for object and event naming and structures.
790 //
791 // Revision 1.8 2011/02/18 20:27:14 acg
792 // Andy Goodrich: Updated Copyrights.
793 //
794 // Revision 1.7 2011/02/13 21:47:37 acg
795 // Andy Goodrich: update copyright notice.
796 //
797 // Revision 1.6 2011/01/18 20:10:44 acg
798 // Andy Goodrich: changes for IEEE1666_2011 semantics.
799 //
800 // Revision 1.5 2010/12/07 20:09:12 acg
801 // Andy Goodrich: remove unused signal declaration
802 //
803 // Revision 1.4 2009/05/22 16:06:29 acg
804 // Andy Goodrich: process control updates.
805 //
806 // Revision 1.3 2008/05/22 17:06:25 acg
807 // Andy Goodrich: updated copyright notice to include 2008.
808 //
809 // Revision 1.2 2007/01/24 20:14:40 acg
810 // Andy Goodrich: improved comments about the use of this-> in the macros
811 // that access sensitive.
812 //
813 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
814 // SystemC 2.3
815 //
816 // Revision 1.10 2006/12/02 20:58:18 acg
817 // Andy Goodrich: updates from 2.2 for IEEE 1666 support.
818 //
819 // Revision 1.7 2006/04/11 23:13:21 acg
820 // Andy Goodrich: Changes for reduced reset support that only includes
821 // sc_cthread, but has preliminary hooks for expanding to method and thread
822 // processes also.
823 //
824 // Revision 1.6 2006/03/15 17:53:34 acg
825 // Andy Goodrich, Forte Design
826 // Reordered includes to pick up <cassert> for use by sc_process_name.h
827 //
828 // Revision 1.5 2006/03/14 23:56:58 acg
829 // Andy Goodrich: This fixes a bug when an exception is thrown in
830 // sc_module::sc_module() for a dynamically allocated sc_module
831 // object. We are calling sc_module::end_module() on a module that has
832 // already been deleted. The scenario runs like this:
833 //
834 // a) the sc_module constructor is entered
835 // b) the exception is thrown
836 // c) the exception processor deletes the storage for the sc_module
837 // d) the stack is unrolled causing the sc_module_name instance to be deleted
838 // e) ~sc_module_name() calls end_module() with its pointer to the sc_module
839 // f) because the sc_module has been deleted its storage is corrupted,
840 // either by linking it to a free space chain, or by reuse of some sort
841 // g) the m_simc field is garbage
842 // h) the m_object_manager field is also garbage
843 // i) an exception occurs
844 //
845 // This does not happen for automatic sc_module instances since the
846 // storage for the module is not reclaimed its just part of the stack.
847 //
848 // I am fixing this by having the destructor for sc_module clear the
849 // module pointer in its sc_module_name instance. That cuts things at
850 // step (e) above, since the pointer will be null if the module has
851 // already been deleted. To make sure the module stack is okay, I call
852 // end-module() in ~sc_module in the case where there is an
853 // sc_module_name pointer lying around.
854 //
855 // Revision 1.4 2006/01/24 20:49:05 acg
856 // Andy Goodrich: changes to remove the use of deprecated features within the
857 // simulator, and to issue warning messages when deprecated features are used.
858 //
859 // Revision 1.3 2006/01/13 18:44:30 acg
860 // Added $Log to record CVS changes into the source.
861 
862 #endif
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 next_trigger() is only allowed in SC_METHODs" ) SC_DEFINE_MESSAGE(SC_ID_IMMEDIATE_NOTIFICATION_
Struct for temporarily storing a pointer to an interface or port.
Definition: sc_module.h:63
void at_posedge(const sc_signal_in_if< sc_dt::sc_logic > &s, int seg_id)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:436
sc_simcontext * sc_get_curr_simcontext()
Definition: sc_module.h:97
void next_trigger(double v, sc_time_unit tu)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:343
void halt(sc_simcontext *)
Specialization of sc_signal_in_if&lt;T&gt; for type bool.
Definition: sc_signal_ifs.h:96
OR list of events.
Definition: sc_event.h:228
void wait(int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:192
#define CHNL_MTX_TYPE_
Definition: sc_process.h:66
#define SC_REPORT_ERROR(msg_type, msg)
Definition: sc_report.h:213
void wait(const sc_time &t, const sc_event &e, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:244
Registry for all modules.
void reset_signal_is(const sc_in< bool > &port, bool level)
virtual void end_of_simulation()
bool timed_out(sc_simcontext *)
void at_negedge(const sc_signal_in_if< sc_dt::sc_logic > &s, int seg_id)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:452
void wait(double v, sc_time_unit tu, const sc_event_or_list &el, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:269
void wait(const sc_time &t, const sc_event_or_list &el, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:261
void wait(const sc_time &t, const sc_event_and_list &el, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:279
void(sc_process_host::* SC_ENTRY_FUNC)()
Definition: sc_process.h:212
sc_port_base * port
Definition: sc_module.h:66
void wait(double v, sc_time_unit tu, const sc_event_and_list &el, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:287
AND list of events.
Definition: sc_event.h:193
void next_trigger(const sc_time &t)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:335
void next_trigger(const sc_event_or_list &el)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:319
void wait(const sc_event &e, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:202
void wait(int, sc_simcontext *)
int append_port(sc_port_base *)
sc_module & operator,(sc_interface &interface_)
Definition: sc_module.h:147
virtual void end_of_elaboration()
void next_trigger(const sc_event_and_list &el)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:327
Registry for all ports.
Definition: sc_port.h:190
sc_simcontext * simcontext() const
Definition: sc_object.h:85
Module name class.
virtual const char * kind() const
Definition: sc_module.h:103
User initiated dynamic process support.
Definition: sc_process.h:558
void at_negedge(const sc_signal_in_if< bool > &, int, sc_simcontext *=sc_get_curr_simcontext())
A new parameter segment ID is added for the out-of-order simulation.
virtual const char * kind() const
Definition: sc_module.h:724
void async_reset_signal_is(const sc_in< bool > &port, bool level)
void watching(bool)
Definition: sc_module.h:456
void next_trigger(const sc_time &t, const sc_event_and_list &el)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:386
void operator()(const sc_bind_proxy &p001, const sc_bind_proxy &p002=SC_BIND_PROXY_NIL, const sc_bind_proxy &p003=SC_BIND_PROXY_NIL, const sc_bind_proxy &p004=SC_BIND_PROXY_NIL, const sc_bind_proxy &p005=SC_BIND_PROXY_NIL, const sc_bind_proxy &p006=SC_BIND_PROXY_NIL, const sc_bind_proxy &p007=SC_BIND_PROXY_NIL, const sc_bind_proxy &p008=SC_BIND_PROXY_NIL, const sc_bind_proxy &p009=SC_BIND_PROXY_NIL, const sc_bind_proxy &p010=SC_BIND_PROXY_NIL, const sc_bind_proxy &p011=SC_BIND_PROXY_NIL, const sc_bind_proxy &p012=SC_BIND_PROXY_NIL, const sc_bind_proxy &p013=SC_BIND_PROXY_NIL, const sc_bind_proxy &p014=SC_BIND_PROXY_NIL, const sc_bind_proxy &p015=SC_BIND_PROXY_NIL, const sc_bind_proxy &p016=SC_BIND_PROXY_NIL, const sc_bind_proxy &p017=SC_BIND_PROXY_NIL, const sc_bind_proxy &p018=SC_BIND_PROXY_NIL, const sc_bind_proxy &p019=SC_BIND_PROXY_NIL, const sc_bind_proxy &p020=SC_BIND_PROXY_NIL, const sc_bind_proxy &p021=SC_BIND_PROXY_NIL, const sc_bind_proxy &p022=SC_BIND_PROXY_NIL, const sc_bind_proxy &p023=SC_BIND_PROXY_NIL, const sc_bind_proxy &p024=SC_BIND_PROXY_NIL, const sc_bind_proxy &p025=SC_BIND_PROXY_NIL, const sc_bind_proxy &p026=SC_BIND_PROXY_NIL, const sc_bind_proxy &p027=SC_BIND_PROXY_NIL, const sc_bind_proxy &p028=SC_BIND_PROXY_NIL, const sc_bind_proxy &p029=SC_BIND_PROXY_NIL, const sc_bind_proxy &p030=SC_BIND_PROXY_NIL, const sc_bind_proxy &p031=SC_BIND_PROXY_NIL, const sc_bind_proxy &p032=SC_BIND_PROXY_NIL, const sc_bind_proxy &p033=SC_BIND_PROXY_NIL, const sc_bind_proxy &p034=SC_BIND_PROXY_NIL, const sc_bind_proxy &p035=SC_BIND_PROXY_NIL, const sc_bind_proxy &p036=SC_BIND_PROXY_NIL, const sc_bind_proxy &p037=SC_BIND_PROXY_NIL, const sc_bind_proxy &p038=SC_BIND_PROXY_NIL, const sc_bind_proxy &p039=SC_BIND_PROXY_NIL, const sc_bind_proxy &p040=SC_BIND_PROXY_NIL, const sc_bind_proxy &p041=SC_BIND_PROXY_NIL, const sc_bind_proxy &p042=SC_BIND_PROXY_NIL, const sc_bind_proxy &p043=SC_BIND_PROXY_NIL, const sc_bind_proxy &p044=SC_BIND_PROXY_NIL, const sc_bind_proxy &p045=SC_BIND_PROXY_NIL, const sc_bind_proxy &p046=SC_BIND_PROXY_NIL, const sc_bind_proxy &p047=SC_BIND_PROXY_NIL, const sc_bind_proxy &p048=SC_BIND_PROXY_NIL, const sc_bind_proxy &p049=SC_BIND_PROXY_NIL, const sc_bind_proxy &p050=SC_BIND_PROXY_NIL, const sc_bind_proxy &p051=SC_BIND_PROXY_NIL, const sc_bind_proxy &p052=SC_BIND_PROXY_NIL, const sc_bind_proxy &p053=SC_BIND_PROXY_NIL, const sc_bind_proxy &p054=SC_BIND_PROXY_NIL, const sc_bind_proxy &p055=SC_BIND_PROXY_NIL, const sc_bind_proxy &p056=SC_BIND_PROXY_NIL, const sc_bind_proxy &p057=SC_BIND_PROXY_NIL, const sc_bind_proxy &p058=SC_BIND_PROXY_NIL, const sc_bind_proxy &p059=SC_BIND_PROXY_NIL, const sc_bind_proxy &p060=SC_BIND_PROXY_NIL, const sc_bind_proxy &p061=SC_BIND_PROXY_NIL, const sc_bind_proxy &p062=SC_BIND_PROXY_NIL, const sc_bind_proxy &p063=SC_BIND_PROXY_NIL, const sc_bind_proxy &p064=SC_BIND_PROXY_NIL)
void wait(const sc_event_or_list &el, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:211
sc_module sc_behavior
Definition: sc_module.h:703
Specialization of sc_inout&lt;T&gt; for type bool.
friend class Invoker
Definition: sc_module.h:86
virtual ~sc_module()
virtual void start_of_simulation()
void set_stack_size(std::size_t)
Function to set the stack size of the current (c)thread process and method process.
void next_trigger(double v, sc_time_unit tu, const sc_event_or_list &el)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:377
The event class.
Definition: sc_event.h:260
void wait(double v, sc_time_unit tu, const sc_event &e, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:252
void at_posedge(const sc_signal_in_if< bool > &, int, sc_simcontext *=sc_get_curr_simcontext())
A new parameter segment ID is added for the out-of-order simulation.
void next_trigger(double v, sc_time_unit tu, const sc_event_and_list &el)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:394
sc_module * sc_module_dynalloc(sc_module *)
The simulation context.
Abstract base class of all interface classes.
Definition: sc_interface.h:44
const ::std::vector< sc_object * > & get_child_objects() const
Base class for all structural entities.
Definition: sc_module.h:83
Specialization of sc_signal_in_if&lt;T&gt; for type sc_dt::sc_logic.
Abstract base class for class sc_port_b.
Definition: sc_port.h:69
sc_sensitive sensitive
Definition: sc_module.h:460
void next_trigger(double v, sc_time_unit tu, const sc_event &e)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:360
void next_trigger(const sc_time &t, const sc_event_or_list &el)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:369
void at_posedge(const sc_signal_in_if< bool > &s, int seg_id)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:428
Base class for all hierarchical channels.
Definition: sc_module.h:712
void halt(int seg_id)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:412
virtual void before_end_of_elaboration()
void wait(const sc_event_and_list &el, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:219
sc_sensitive_pos sensitive_pos
Definition: sc_module.h:461
void wait(int n, int seg_id)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:420
const char * gen_unique_name(const char *basename_, bool preserve_first)
This is the base class for objects which may have processes defined for their methods (e...
Definition: sc_process.h:149
void next_trigger(const sc_event &e)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:311
void wait(double v, sc_time_unit tu, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:235
const sc_bind_proxy SC_BIND_PROXY_NIL
int m_instance_id
Instance ID of this module.
Definition: sc_module.h:477
void aux_seg_bound(sc_simcontext *simc)
A new parameter segment ID is added for the out-of-order simulation.
void at_negedge(const sc_signal_in_if< bool > &s, int seg_id)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:444
sc_interface * iface
Definition: sc_module.h:65
void next_trigger(const sc_time &t, const sc_event &e)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:352
sc_module & operator<<(sc_interface &)
Specialization of sc_in&lt;T&gt; for type bool.
void positional_bind(sc_interface &)
CHNL_MTX_TYPE_ m_mutex
A mutex to protect concurrent communication.
Definition: sc_module.h:751
void wait(const sc_time &t, int seg_id=-1)
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:227
void next_trigger()
A new parameter segment ID is added for the out-of-order simulation.
Definition: sc_module.h:300
sc_sensitive_neg sensitive_neg
Definition: sc_module.h:462
void elaboration_done(bool &)
Abstract base class of all SystemC `simulation&#39; objects.
Definition: sc_object.h:51
sc_time_unit
Definition: sc_time.h:56