sc_fifo_ifs.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003   The following code is derived, directly or indirectly, from the SystemC
00004   source code Copyright (c) 1996-2006 by all Contributors.
00005   All Rights reserved.
00006 
00007   The contents of this file are subject to the restrictions and limitations
00008   set forth in the SystemC Open Source License Version 2.4 (the "License");
00009   You may not use this file except in compliance with such restrictions and
00010   limitations. You may obtain instructions on how to receive a copy of the
00011   License at http://www.systemc.org/. Software distributed by Contributors
00012   under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
00013   ANY KIND, either express or implied. See the License for the specific
00014   language governing rights and limitations under the License.
00015 
00016  *****************************************************************************/
00017 
00018 /*****************************************************************************
00019 
00020   sc_fifo_ifs.h -- The sc_fifo<T> interface classes.
00021 
00022   Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21
00023 
00024  *****************************************************************************/
00025 
00026 /*****************************************************************************
00027 
00028   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00029   changes you are making here.
00030 
00031       Name, Affiliation, Date: Bishnupriya Bhattacharye, Cadence Design Systems,
00032                                30 Jan, 2004
00033   Description of Modification: Split up the interfaces into blocking and 
00034                                non blocking parts
00035     
00036       Name, Affiliation, Date: 
00037   Description of Modification: 
00038 
00039  *****************************************************************************/
00040 //$Log: sc_fifo_ifs.h,v $
00041 //Revision 1.1.1.1  2006/12/15 20:31:35  acg
00042 //SystemC 2.2
00043 //
00044 //Revision 1.2  2006/01/03 23:18:26  acg
00045 //Changed copyright to include 2006.
00046 //
00047 //Revision 1.1.1.1  2005/12/19 23:16:43  acg
00048 //First check in of SystemC 2.1 into its own archive.
00049 //
00050 //Revision 1.10  2005/06/10 22:43:55  acg
00051 //Added CVS change log annotation.
00052 //
00053 
00054 #ifndef SC_FIFO_IFS_H
00055 #define SC_FIFO_IFS_H
00056 
00057 
00058 #include "sysc/communication/sc_interface.h"
00059 
00060 namespace sc_core {
00061 
00062 // ----------------------------------------------------------------------------
00063 //  CLASS : sc_fifo_nonblocking_in_if<T>
00064 //
00065 //  The sc_fifo<T> input nonblocking interface class.
00066 // ----------------------------------------------------------------------------
00067 
00068 template <class T> 
00069 class sc_fifo_nonblocking_in_if 
00070 : virtual public sc_interface 
00071 { 
00072 public: 
00073 
00074     // non-blocking read 
00075     virtual bool nb_read( T& ) = 0; 
00076 
00077     // get the data written event 
00078     virtual const sc_event& data_written_event() const = 0; 
00079 }; 
00080 
00081 // ----------------------------------------------------------------------------
00082 //  CLASS : sc_fifo_blocking_in_if<T>
00083 //
00084 //  The sc_fifo<T> input blocking interface class.
00085 // ----------------------------------------------------------------------------
00086 
00087 template <class T> 
00088 class sc_fifo_blocking_in_if 
00089 : virtual public sc_interface 
00090 { 
00091 public: 
00092 
00093     // blocking read 
00094     virtual void read( T& ) = 0; 
00095     virtual T read() = 0; 
00096 }; 
00097 
00098 // ----------------------------------------------------------------------------
00099 //  CLASS : sc_fifo_in_if<T>
00100 //
00101 //  The sc_fifo<T> input interface class.
00102 // ----------------------------------------------------------------------------
00103 
00104 template <class T> 
00105 class sc_fifo_in_if 
00106 : public sc_fifo_nonblocking_in_if<T>, 
00107   public sc_fifo_blocking_in_if<T> 
00108 { 
00109 public: 
00110 
00111     // get the number of available samples 
00112     virtual int num_available() const = 0; 
00113 
00114 protected: 
00115 
00116     // constructor 
00117 
00118     sc_fifo_in_if() 
00119         {} 
00120 
00121 private: 
00122 
00123     // disabled 
00124     sc_fifo_in_if( const sc_fifo_in_if<T>& ); 
00125     sc_fifo_in_if<T>& operator = ( const sc_fifo_in_if<T>& ); 
00126 }; 
00127 
00128 
00129 // ----------------------------------------------------------------------------
00130 //  CLASS : sc_fifo_nonblocking_out_if<T>
00131 //
00132 //  The sc_fifo<T> nonblocking output interface class.
00133 // ----------------------------------------------------------------------------
00134 
00135 template <class T> 
00136 class sc_fifo_nonblocking_out_if 
00137 : virtual public sc_interface 
00138 { 
00139 public: 
00140 
00141     // non-blocking write 
00142     virtual bool nb_write( const T& ) = 0; 
00143 
00144     // get the data read event 
00145     virtual const sc_event& data_read_event() const = 0; 
00146 }; 
00147 
00148 // ----------------------------------------------------------------------------
00149 //  CLASS : sc_fifo_blocking_out_if<T>
00150 //
00151 //  The sc_fifo<T> blocking output interface class.
00152 // ----------------------------------------------------------------------------
00153 
00154 template <class T> 
00155 class sc_fifo_blocking_out_if 
00156 : virtual public sc_interface 
00157 { 
00158 public: 
00159 
00160     // blocking write 
00161     virtual void write( const T& ) = 0; 
00162 
00163 }; 
00164 
00165 // ----------------------------------------------------------------------------
00166 //  CLASS : sc_fifo_out_if<T>
00167 //
00168 //  The sc_fifo<T> output interface class.
00169 // ----------------------------------------------------------------------------
00170 
00171 template <class T> 
00172 class sc_fifo_out_if 
00173 : public sc_fifo_nonblocking_out_if<T>, 
00174   public sc_fifo_blocking_out_if<T> 
00175 { 
00176 public: 
00177 
00178     // get the number of free spaces 
00179     virtual int num_free() const = 0; 
00180 
00181 protected: 
00182 
00183     // constructor 
00184 
00185     sc_fifo_out_if() 
00186         {} 
00187 
00188 private: 
00189 
00190     // disabled 
00191     sc_fifo_out_if( const sc_fifo_out_if<T>& ); 
00192     sc_fifo_out_if<T>& operator = ( const sc_fifo_out_if<T>& ); 
00193 }; 
00194 
00195 } // namespace sc_core
00196 
00197 #endif
00198 
00199 // Taf!

Generated on Wed Jan 21 15:32:06 2009 for SystemC by  doxygen 1.5.5