SystemC  2.3.1
Accellera SystemC proof-of-concept library
sc_fifo_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_fifo_ifs.h -- The sc_fifo<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_FIFO_IFS_H
28 #define SC_FIFO_IFS_H
29 
30 
32 
33 namespace sc_core {
34 
35 // ----------------------------------------------------------------------------
36 // CLASS : sc_fifo_nonblocking_in_if<T>
37 //
38 // The sc_fifo<T> input nonblocking interface class.
39 // ----------------------------------------------------------------------------
40 
41 template <class T>
43 : virtual public sc_interface
44 {
45 public:
46 
47  // non-blocking read
48  virtual bool nb_read( T& ) = 0;
49 
50  // get the data written event
51  virtual const sc_event& data_written_event() const = 0;
52 };
53 
54 // ----------------------------------------------------------------------------
55 // CLASS : sc_fifo_blocking_in_if<T>
56 //
57 // The sc_fifo<T> input blocking interface class.
58 // ----------------------------------------------------------------------------
59 
60 template <class T>
62 : virtual public sc_interface
63 {
64 public:
65 
66  // blocking read
67  virtual void read( T& ) = 0;
68  virtual T read() = 0;
69 };
70 
71 // ----------------------------------------------------------------------------
72 // CLASS : sc_fifo_in_if<T>
73 //
74 // The sc_fifo<T> input interface class.
75 // ----------------------------------------------------------------------------
76 
77 template <class T>
79 : public sc_fifo_nonblocking_in_if<T>,
80  public sc_fifo_blocking_in_if<T>
81 {
82 public:
83 
84  // get the number of available samples
85  virtual int num_available() const = 0;
86 
87 protected:
88 
89  // constructor
90 
92  {}
93 
94 private:
95 
96  // disabled
98  sc_fifo_in_if<T>& operator = ( const sc_fifo_in_if<T>& );
99 };
100 
101 
102 // ----------------------------------------------------------------------------
103 // CLASS : sc_fifo_nonblocking_out_if<T>
104 //
105 // The sc_fifo<T> nonblocking output interface class.
106 // ----------------------------------------------------------------------------
107 
108 template <class T>
110 : virtual public sc_interface
111 {
112 public:
113 
114  // non-blocking write
115  virtual bool nb_write( const T& ) = 0;
116 
117  // get the data read event
118  virtual const sc_event& data_read_event() const = 0;
119 };
120 
121 // ----------------------------------------------------------------------------
122 // CLASS : sc_fifo_blocking_out_if<T>
123 //
124 // The sc_fifo<T> blocking output interface class.
125 // ----------------------------------------------------------------------------
126 
127 template <class T>
129 : virtual public sc_interface
130 {
131 public:
132 
133  // blocking write
134  virtual void write( const T& ) = 0;
135 
136 };
137 
138 // ----------------------------------------------------------------------------
139 // CLASS : sc_fifo_out_if<T>
140 //
141 // The sc_fifo<T> output interface class.
142 // ----------------------------------------------------------------------------
143 
144 template <class T>
146 : public sc_fifo_nonblocking_out_if<T>,
147  public sc_fifo_blocking_out_if<T>
148 {
149 public:
150 
151  // get the number of free spaces
152  virtual int num_free() const = 0;
153 
154 protected:
155 
156  // constructor
157 
159  {}
160 
161 private:
162 
163  // disabled
165  sc_fifo_out_if<T>& operator = ( const sc_fifo_out_if<T>& );
166 };
167 
168 /*****************************************************************************
169 
170  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
171  changes you are making here.
172 
173  Name, Affiliation, Date: Bishnupriya Bhattacharye, Cadence Design Systems,
174  30 Jan, 2004
175  Description of Modification: Split up the interfaces into blocking and
176  non blocking parts
177 
178  Name, Affiliation, Date:
179  Description of Modification:
180 
181  *****************************************************************************/
182 //$Log: sc_fifo_ifs.h,v $
183 //Revision 1.3 2011/08/26 20:45:40 acg
184 // Andy Goodrich: moved the modification log to the end of the file to
185 // eliminate source line number skew when check-ins are done.
186 //
187 //Revision 1.2 2011/02/18 20:23:45 acg
188 // Andy Goodrich: Copyright update.
189 //
190 //Revision 1.1.1.1 2006/12/15 20:20:04 acg
191 //SystemC 2.3
192 //
193 //Revision 1.2 2006/01/03 23:18:26 acg
194 //Changed copyright to include 2006.
195 //
196 //Revision 1.1.1.1 2005/12/19 23:16:43 acg
197 //First check in of SystemC 2.1 into its own archive.
198 //
199 //Revision 1.10 2005/06/10 22:43:55 acg
200 //Added CVS change log annotation.
201 //
202 
203 } // namespace sc_core
204 
205 #endif
206 
207 // Taf!
virtual void write(const T &)=0
virtual bool nb_write(const T &)=0
virtual int num_available() const =0
virtual const sc_event & data_read_event() const =0
virtual const sc_event & data_written_event() const =0
virtual int num_free() const =0