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