SystemC  2.3.2
Accellera SystemC proof-of-concept library
sc_signal_ifs.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements. See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License. You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied. See the License for the specific language governing
16  permissions and limitations under the License.
17 
18  *****************************************************************************/
19 
20 /*****************************************************************************
21 
22  sc_signal_ifs.h -- The sc_signal<T> interface classes.
23 */
33 #ifndef SC_SIGNAL_IFS_H
34 #define SC_SIGNAL_IFS_H
35 
36 
39 
40 
41 namespace sc_dt
42 {
44 }
45 
46 namespace sc_core {
47 
48 class sc_signal_bool_deval;
49 class sc_signal_logic_deval;
50 
51 
58 template <class T>
60 : virtual public sc_interface
61 {
62 public:
63 
64  // get the value changed event
65  virtual const sc_event& value_changed_event() const = 0;
66 
67 
68  // read the current value
69  virtual const T& read() const = 0;
70 
71  // get a reference to the current value (for tracing)
72  virtual const T& get_data_ref() const = 0;
73 
74 
75  // was there a value changed event?
76  virtual bool event() const = 0;
77 
78 protected:
79 
80  // constructor
81 
83  {}
84 
85 private:
86 
87  // disabled
89  sc_signal_in_if<T>& operator = ( const sc_signal_in_if<T>& );
90 };
91 
92 
99 class SC_API sc_reset;
100 
101 template <>
102 class sc_signal_in_if<bool>
103 : virtual public sc_interface
104 {
105  friend class sc_reset;
106 public:
107 
108  // get the value changed event
109  virtual const sc_event& value_changed_event() const = 0;
110 
111  // get the positive edge event
112  virtual const sc_event& posedge_event() const = 0;
113 
114  // get the negative edge event
115  virtual const sc_event& negedge_event() const = 0;
116 
117 
118  // read the current value
119  virtual const bool& read() const = 0;
120 
121  // get a reference to the current value (for tracing)
122  virtual const bool& get_data_ref() const = 0;
123 
124 
125  // was there a value changed event?
126  virtual bool event() const = 0;
127 
128  // was there a positive edge event?
129  virtual bool posedge() const = 0;
130 
131  // was there a negative edge event?
132  virtual bool negedge() const = 0;
133 
134 protected:
135 
136  // constructor
137 
139  {}
140 
141 private:
142 
143  // disabled
145  sc_signal_in_if<bool>& operator = ( const sc_signal_in_if<bool>& );
146 
147  // designate this object as a reset signal
148  virtual sc_reset* is_reset() const
149  { return NULL; }
150 };
151 
152 
159 template <>
161 : virtual public sc_interface
162 {
163 public:
164 
165  // get the value changed event
166  virtual const sc_event& value_changed_event() const = 0;
167 
168  // get the positive edge event
169  virtual const sc_event& posedge_event() const = 0;
170 
171  // get the negative edge event
172  virtual const sc_event& negedge_event() const = 0;
173 
174 
175  // read the current value
176  virtual const sc_dt::sc_logic& read() const = 0;
177 
178  // get a reference to the current value (for tracing)
179  virtual const sc_dt::sc_logic& get_data_ref() const = 0;
180 
181 
182  // was there a value changed event?
183  virtual bool event() const = 0;
184 
185  // was there a positive edge event?
186  virtual bool posedge() const = 0;
187 
188  // was there a negative edge event?
189  virtual bool negedge() const = 0;
190 
191 
192 protected:
193 
194  // constructor
195 
197  {}
198 
199 private:
200 
201  // disabled
205 };
206 
207 
213 template< typename T >
214 class sc_signal_write_if : public virtual sc_interface
215 {
216 public:
218  // write the new value
219  virtual void write( const T& ) = 0;
221  { return SC_DEFAULT_WRITER_POLICY; }
222 private:
223  // disabled
225  sc_signal_write_if<T>& operator = ( const sc_signal_write_if<T>& );
226 };
227 
228 
235 template <class T>
237 : public sc_signal_in_if<T>, public sc_signal_write_if<T>
238 {
239 
240 protected:
241 
242  // constructor
243 
245  {}
246 
247 private:
248 
249  // disabled
251  sc_signal_inout_if<T>& operator = ( const sc_signal_inout_if<T>& );
252 };
253 
254 
261 // sc_signal_out_if can also be read from, hence no difference with
262 // sc_signal_inout_if.
263 
264 #define sc_signal_out_if sc_signal_inout_if
265 
266 } // namespace sc_core
267 
268 //$Log: sc_signal_ifs.h,v $
269 //Revision 1.4 2011/08/26 20:45:43 acg
270 // Andy Goodrich: moved the modification log to the end of the file to
271 // eliminate source line number skew when check-ins are done.
272 //
273 //Revision 1.3 2011/02/18 20:23:45 acg
274 // Andy Goodrich: Copyright update.
275 //
276 //Revision 1.2 2010/12/07 19:50:37 acg
277 // Andy Goodrich: addition of writer policies, courtesy of Philipp Hartmann.
278 //
279 //Revision 1.1.1.1 2006/12/15 20:20:04 acg
280 //SystemC 2.3
281 //
282 //Revision 1.4 2006/08/29 23:35:00 acg
283 // Andy Goodrich: added bind_count() method to allow users to determine which
284 // ports are connected in before_end_of_elaboration().
285 //
286 //Revision 1.3 2006/04/11 23:11:57 acg
287 // Andy Goodrich: Changes for reset support that only includes
288 // sc_cthread_process instances.
289 //
290 //Revision 1.2 2006/01/03 23:18:26 acg
291 //Changed copyright to include 2006.
292 //
293 //Revision 1.1.1.1 2005/12/19 23:16:43 acg
294 //First check in of SystemC 2.1 into its own archive.
295 //
296 //Revision 1.10 2005/09/15 23:01:51 acg
297 //Added std:: prefix to appropriate methods and types to get around
298 //issues with the Edison Front End.
299 //
300 //Revision 1.9 2005/06/29 18:12:12 acg
301 //Added $log.
302 //
303 //Revision 1.8 2005/06/10 22:43:55 acg
304 //Added CVS change log annotation.
305 //
306 
307 #endif
308 
309 // Taf!
#define SC_DEFAULT_WRITER_POLICY
The sc_signal<T> input interface class.
Definition: sc_signal_ifs.h:49
Specialization of sc_signal_in_if<T> for type bool.
The event class.
Definition: sc_event.h:256
virtual sc_writer_policy get_writer_policy() const
The sc_signal<T> input/output interface class.
Four-valued logic type.
Definition: sc_logic.h:104
Abstract base class of all interface classes.
The standard output interface class.
Abstract base class of all interface classes.
Definition: sc_interface.h:51
Specialization of sc_signal_in_if<T> for type sc_dt::sc_logic.
class SC_API sc_logic
Definition: sc_signal_ifs.h:43
The sc_signal<T> writer policy definition.
#define SC_API
Definition: sc_cmnhdr.h:168