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