SystemC  Recoding Infrastructure for SystemC v0.6.0 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
sc_fifo_ports.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_fifo_ports.h -- The sc_fifo<T> port 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_FIFO_PORTS_H
28 #define SC_FIFO_PORTS_H
29 
30 
34 
35 namespace sc_core {
36 
37 /**************************************************************************/
43 template <class T>
45 : public sc_port<sc_fifo_in_if<T>,0,SC_ONE_OR_MORE_BOUND>
46 {
47 public:
48 
49  // typedefs
50 
51  typedef T data_type;
52 
56 
59 
60 public:
61 
62  // constructors
63 
65  : base_type()
66  {}
67 
68  explicit sc_fifo_in( const char* name_ )
69  : base_type( name_ )
70  {}
71 
72  explicit sc_fifo_in( in_if_type& interface_ )
73  : base_type( interface_ )
74  {}
75 
76  sc_fifo_in( const char* name_, in_if_type& interface_ )
77  : base_type( name_, interface_ )
78  {}
79 
80  explicit sc_fifo_in( in_port_type& parent_ )
81  : base_type( parent_ )
82  {}
83 
84  sc_fifo_in( const char* name_, in_port_type& parent_ )
85  : base_type( name_, parent_ )
86  {}
87 
88  sc_fifo_in( this_type& parent_ )
89  : base_type( parent_ )
90  {}
91 
92  sc_fifo_in( const char* name_, this_type& parent_ )
93  : base_type( name_, parent_ )
94  {}
95 
96 
97  // destructor (does nothing)
98 
99  virtual ~sc_fifo_in()
100  {}
101 
102 
103  // interface access shortcut methods
104 
105  // blocking read
106 
111  // 08/19/2015 GL: modified for the OoO simulation
112  void read( data_type& value_, sc_segid seg_id )
113  { (*this)->read( value_, seg_id ); }
114 
119  // 08/19/2015 GL: modified for the OoO simulation
121  { return (*this)->read( seg_id ); }
122 
123 
124  // non-blocking read
125 
126  bool nb_read( data_type& value_ )
127  { return (*this)->nb_read( value_ ); }
128 
129 
130  // get the number of available samples
131 
132  int num_available() const
133  { return (*this)->num_available(); }
134 
135 
136  // get the data written event
137 
139  { return (*this)->data_written_event(); }
140 
141 
142  // use for static sensitivity to data written event
143 
145  {
146  return *new sc_event_finder_t<in_if_type>(
148  }
149 
150  virtual const char* kind() const
151  { return "sc_fifo_in"; }
152 
153 private:
154 
155  // disabled
156  sc_fifo_in( const this_type& );
157  this_type& operator = ( const this_type& );
158 };
159 
160 
161 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
162 
163 /**************************************************************************/
169 template <class T>
171 : public sc_port<sc_fifo_out_if<T>,0,SC_ONE_OR_MORE_BOUND>
172 {
173 public:
174 
175  // typedefs
176 
177  typedef T data_type;
178 
182 
185 
186 public:
187 
188  // constructors
189 
191  : base_type()
192  {}
193 
194  explicit sc_fifo_out( const char* name_ )
195  : base_type( name_ )
196  {}
197 
198  explicit sc_fifo_out( out_if_type& interface_ )
199  : base_type( interface_ )
200  {}
201 
202  sc_fifo_out( const char* name_, out_if_type& interface_ )
203  : base_type( name_, interface_ )
204  {}
205 
206  explicit sc_fifo_out( out_port_type& parent_ )
207  : base_type( parent_ )
208  {}
209 
210  sc_fifo_out( const char* name_, out_port_type& parent_ )
211  : base_type( name_, parent_ )
212  {}
213 
214  sc_fifo_out( this_type& parent_ )
215  : base_type( parent_ )
216  {}
217 
218  sc_fifo_out( const char* name_, this_type& parent_ )
219  : base_type( name_, parent_ )
220  {}
221 
222 
223  // destructor (does nothing)
224 
225  virtual ~sc_fifo_out()
226  {}
227 
228 
229  // interface access shortcut methods
230 
231  // blocking write
232 
237  // 08/19/2015 GL: modified for the OoO simulation
238  void write( const data_type& value_, int seg_id )
239  { (*this)->write( value_, seg_id ); }
240 
241 
242  // non-blocking write
243 
244  bool nb_write( const data_type& value_ )
245  { return (*this)->nb_write( value_ ); }
246 
247 
248  // get the number of free spaces
249 
250  int num_free() const
251  { return (*this)->num_free(); }
252 
253 
254  // get the data read event
255 
256  const sc_event& data_read_event() const
257  { return (*this)->data_read_event(); }
258 
259 
260  // use for static sensitivity to data read event
261 
263  {
264  return *new sc_event_finder_t<out_if_type>(
266  }
267 
268  virtual const char* kind() const
269  { return "sc_fifo_out"; }
270 
271 private:
272 
273  // disabled
274  sc_fifo_out( const this_type& );
275  this_type& operator = ( const this_type& );
276 };
277 
278 
279 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
280 
281 } // namespace sc_core
282 
283 //$Log: sc_fifo_ports.h,v $
284 //Revision 1.3 2011/08/26 20:45:40 acg
285 // Andy Goodrich: moved the modification log to the end of the file to
286 // eliminate source line number skew when check-ins are done.
287 //
288 //Revision 1.2 2011/02/18 20:23:45 acg
289 // Andy Goodrich: Copyright update.
290 //
291 //Revision 1.1.1.1 2006/12/15 20:20:04 acg
292 //SystemC 2.3
293 //
294 //Revision 1.2 2006/01/03 23:18:26 acg
295 //Changed copyright to include 2006.
296 //
297 //Revision 1.1.1.1 2005/12/19 23:16:43 acg
298 //First check in of SystemC 2.1 into its own archive.
299 //
300 //Revision 1.10 2005/09/15 23:01:51 acg
301 //Added std:: prefix to appropriate methods and types to get around
302 //issues with the Edison Front End.
303 //
304 //Revision 1.9 2005/06/10 22:43:55 acg
305 //Added CVS change log annotation.
306 //
307 
308 #endif
309 
310 // Taf!
bool nb_read(data_type &value_)
sc_port_b< out_if_type > out_port_type
Abstract base class for class sc_port.
Definition: sc_port.h:249
sc_fifo_out(out_if_type &interface_)
sc_fifo_out(const char *name_, out_if_type &interface_)
int num_available() const
sc_fifo_out(const char *name_)
virtual const char * kind() const
const sc_event & data_written_event() const
sc_port_b< in_if_type > in_port_type
Definition: sc_fifo_ports.h:58
void read(data_type &value_, sc_segid seg_id)
A new parameter segment ID is added for the out-of-order simulation.
Generic port class and base class for other port classes.
Definition: sc_port.h:375
sc_fifo_out_if< data_type > if_type
sc_fifo_in(const char *name_, in_port_type &parent_)
Definition: sc_fifo_ports.h:84
sc_fifo_in_if< data_type > if_type
Definition: sc_fifo_ports.h:53
sc_fifo_in(const char *name_)
Definition: sc_fifo_ports.h:68
sc_fifo_out(const char *name_, out_port_type &parent_)
sc_port< if_type, 0, SC_ONE_OR_MORE_BOUND > base_type
Definition: sc_fifo_ports.h:54
sc_fifo_out(const char *name_, this_type &parent_)
sc_fifo_in(const char *name_, in_if_type &interface_)
Definition: sc_fifo_ports.h:76
sc_fifo_out(this_type &parent_)
sc_fifo_out< data_type > this_type
sc_fifo_in(this_type &parent_)
Definition: sc_fifo_ports.h:88
sc_fifo_in(in_port_type &parent_)
Definition: sc_fifo_ports.h:80
sc_fifo_in< data_type > this_type
Definition: sc_fifo_ports.h:55
The event class.
Definition: sc_event.h:260
data_type read(sc_segid seg_id)
A new parameter segment ID is added for the out-of-order simulation.
virtual const char * kind() const
bool nb_write(const data_type &value_)
sc_port< if_type, 0, SC_ONE_OR_MORE_BOUND > base_type
void write(const data_type &value_, int seg_id)
A new parameter segment ID is added for the out-of-order simulation.
virtual const sc_event & data_written_event() const =0
Event finder base class.
const sc_event & data_read_event() const
sc_fifo_in(in_if_type &interface_)
Definition: sc_fifo_ports.h:72
sc_event_finder & data_read() const
int num_free() const
sc_fifo_out(out_port_type &parent_)
virtual const sc_event & data_read_event() const =0
segment id currently only used for sc_fifo::read(...) as a bug fix
sc_fifo_in(const char *name_, this_type &parent_)
Definition: sc_fifo_ports.h:92
sc_event_finder & data_written() const