SystemC  Recoding Infrastructure for SystemC v0.6.3 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
sc_signal_ifs.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_signal_ifs.h -- The sc_signal<T> interface classes.
21 
22  Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21
23 
24  CHANGE LOG IS AT THE END OF THE FILE
25  *****************************************************************************/
26 
27 #ifndef SC_SIGNAL_IFS_H
28 #define SC_SIGNAL_IFS_H
29 
30 
33 
34 
35 namespace sc_dt
36 {
37  class sc_logic;
38 }
39 
40 namespace sc_core {
41 
42 class sc_signal_bool_deval;
43 class sc_signal_logic_deval;
44 
45 
46 /**************************************************************************/
52 template <class T>
54 : virtual public sc_interface
55 {
56 public:
57 
58  // get the value changed event
59  virtual const sc_event& value_changed_event() const = 0;
60 
61 
62  // read the current value
63  virtual const T& read() const = 0;
64 
65  // get a reference to the current value (for tracing)
66  virtual const T& get_data_ref() const = 0;
67 
68 
69  // was there a value changed event?
70  virtual bool event() const = 0;
71 
72 protected:
73 
74  // constructor
75 
77  {}
78 
79 private:
80 
81  // disabled
83  sc_signal_in_if<T>& operator = ( const sc_signal_in_if<T>& );
84 };
85 
86 
87 /**************************************************************************/
93 class sc_reset;
94 
95 template <>
96 class sc_signal_in_if<bool>
97 : virtual public sc_interface
98 {
99  friend class sc_reset;
100 public:
101 
102  // get the value changed event
103  virtual const sc_event& value_changed_event() const = 0;
104 
105  // get the positive edge event
106  virtual const sc_event& posedge_event() const = 0;
107 
108  // get the negative edge event
109  virtual const sc_event& negedge_event() const = 0;
110 
111 
112  // read the current value
113  virtual const bool& read() const = 0;
114 
115  // get a reference to the current value (for tracing)
116  virtual const bool& get_data_ref() const = 0;
117 
118 
119  // was there a value changed event?
120  virtual bool event() const = 0;
121 
122  // was there a positive edge event?
123  virtual bool posedge() const = 0;
124 
125  // was there a negative edge event?
126  virtual bool negedge() const = 0;
127 
128 protected:
129 
130  // constructor
131 
133  {}
134 
135 private:
136 
137  // disabled
139  sc_signal_in_if<bool>& operator = ( const sc_signal_in_if<bool>& );
140 
141  // designate this object as a reset signal
142  virtual sc_reset* is_reset() const
143  { return NULL; }
144 };
145 
146 
147 /**************************************************************************/
153 template <>
154 class sc_signal_in_if<sc_dt::sc_logic>
155 : virtual public sc_interface
156 {
157 public:
158 
159  // get the value changed event
160  virtual const sc_event& value_changed_event() const = 0;
161 
162  // get the positive edge event
163  virtual const sc_event& posedge_event() const = 0;
164 
165  // get the negative edge event
166  virtual const sc_event& negedge_event() const = 0;
167 
168 
169  // read the current value
170  virtual const sc_dt::sc_logic& read() const = 0;
171 
172  // get a reference to the current value (for tracing)
173  virtual const sc_dt::sc_logic& get_data_ref() const = 0;
174 
175 
176  // was there a value changed event?
177  virtual bool event() const = 0;
178 
179  // was there a positive edge event?
180  virtual bool posedge() const = 0;
181 
182  // was there a negative edge event?
183  virtual bool negedge() const = 0;
184 
185 
186 protected:
187 
188  // constructor
189 
191  {}
192 
193 private:
194 
195  // disabled
199 };
200 
201 
202 /**************************************************************************/
207 template< typename T >
208 class sc_signal_write_if : public virtual sc_interface
209 {
210 public:
212  // write the new value
213  virtual void write( const T& ) = 0;
215  { return SC_DEFAULT_WRITER_POLICY; }
216 private:
217  // disabled
219  sc_signal_write_if<T>& operator = ( const sc_signal_write_if<T>& );
220 };
221 
222 
223 /**************************************************************************/
229 template <class T>
231 : public sc_signal_in_if<T>, public sc_signal_write_if<T>
232 {
233 
234 protected:
235 
236  // constructor
237 
239  {}
240 
241 private:
242 
243  // disabled
245  sc_signal_inout_if<T>& operator = ( const sc_signal_inout_if<T>& );
246 };
247 
248 
249 /**************************************************************************/
255 // sc_signal_out_if can also be read from, hence no difference with
256 // sc_signal_inout_if.
257 
258 #define sc_signal_out_if sc_signal_inout_if
259 
260 } // namespace sc_core
261 
262 //$Log: sc_signal_ifs.h,v $
263 //Revision 1.4 2011/08/26 20:45:43 acg
264 // Andy Goodrich: moved the modification log to the end of the file to
265 // eliminate source line number skew when check-ins are done.
266 //
267 //Revision 1.3 2011/02/18 20:23:45 acg
268 // Andy Goodrich: Copyright update.
269 //
270 //Revision 1.2 2010/12/07 19:50:37 acg
271 // Andy Goodrich: addition of writer policies, courtesy of Philipp Hartmann.
272 //
273 //Revision 1.1.1.1 2006/12/15 20:20:04 acg
274 //SystemC 2.3
275 //
276 //Revision 1.4 2006/08/29 23:35:00 acg
277 // Andy Goodrich: added bind_count() method to allow users to determine which
278 // ports are connected in before_end_of_elaboration().
279 //
280 //Revision 1.3 2006/04/11 23:11:57 acg
281 // Andy Goodrich: Changes for reset support that only includes
282 // sc_cthread_process instances.
283 //
284 //Revision 1.2 2006/01/03 23:18:26 acg
285 //Changed copyright to include 2006.
286 //
287 //Revision 1.1.1.1 2005/12/19 23:16:43 acg
288 //First check in of SystemC 2.1 into its own archive.
289 //
290 //Revision 1.10 2005/09/15 23:01:51 acg
291 //Added std:: prefix to appropriate methods and types to get around
292 //issues with the Edison Front End.
293 //
294 //Revision 1.9 2005/06/29 18:12:12 acg
295 //Added $log.
296 //
297 //Revision 1.8 2005/06/10 22:43:55 acg
298 //Added CVS change log annotation.
299 //
300 
301 #endif
302 
303 // Taf!
Specialization of sc_signal_in_if&lt;T&gt; for type bool.
Definition: sc_signal_ifs.h:96
virtual sc_writer_policy get_writer_policy() const
virtual const T & get_data_ref() const =0
#define SC_DEFAULT_WRITER_POLICY
virtual const sc_event & value_changed_event() const =0
virtual bool event() const =0
The sc_signal&lt;T&gt; input/output interface class.
The sc_signal&lt;T&gt; input interface class.
Definition: sc_signal_ifs.h:43
The event class.
Definition: sc_event.h:260
Abstract base class of all interface classes.
Definition: sc_interface.h:44
Specialization of sc_signal_in_if&lt;T&gt; for type sc_dt::sc_logic.
virtual void write(const T &)=0
virtual const T & read() const =0
The standard output interface class.