src/sysc/communication/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-2005 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 
00041 #ifndef SC_FIFO_IFS_H
00042 #define SC_FIFO_IFS_H
00043 
00044 
00045 #include "sysc/communication/sc_interface.h"
00046 
00047 namespace sc_core {
00048 
00049 // ----------------------------------------------------------------------------
00050 //  CLASS : sc_fifo_nonblocking_in_if<T>
00051 //
00052 //  The sc_fifo<T> input nonblocking interface class.
00053 // ----------------------------------------------------------------------------
00054 
00055 template <class T> 
00056 class sc_fifo_nonblocking_in_if 
00057 : virtual public sc_interface 
00058 { 
00059 public: 
00060 
00061     // non-blocking read 
00062     virtual bool nb_read( T& ) = 0; 
00063 
00064     // get the data written event 
00065     virtual const sc_event& data_written_event() const = 0; 
00066 }; 
00067 
00068 // ----------------------------------------------------------------------------
00069 //  CLASS : sc_fifo_blocking_in_if<T>
00070 //
00071 //  The sc_fifo<T> input blocking interface class.
00072 // ----------------------------------------------------------------------------
00073 
00074 template <class T> 
00075 class sc_fifo_blocking_in_if 
00076 : virtual public sc_interface 
00077 { 
00078 public: 
00079 
00080     // blocking read 
00081     virtual void read( T& ) = 0; 
00082     virtual T read() = 0; 
00083 }; 
00084 
00085 // ----------------------------------------------------------------------------
00086 //  CLASS : sc_fifo_in_if<T>
00087 //
00088 //  The sc_fifo<T> input interface class.
00089 // ----------------------------------------------------------------------------
00090 
00091 template <class T> 
00092 class sc_fifo_in_if 
00093 : public sc_fifo_nonblocking_in_if<T>, 
00094   public sc_fifo_blocking_in_if<T> 
00095 { 
00096 public: 
00097 
00098     // get the number of available samples 
00099     virtual int num_available() const = 0; 
00100 
00101 protected: 
00102 
00103     // constructor 
00104 
00105     sc_fifo_in_if() 
00106         {} 
00107 
00108 private: 
00109 
00110     // disabled 
00111     sc_fifo_in_if( const sc_fifo_in_if<T>& ); 
00112     sc_fifo_in_if<T>& operator = ( const sc_fifo_in_if<T>& ); 
00113 }; 
00114 
00115 
00116 // ----------------------------------------------------------------------------
00117 //  CLASS : sc_fifo_nonblocking_out_if<T>
00118 //
00119 //  The sc_fifo<T> nonblocking output interface class.
00120 // ----------------------------------------------------------------------------
00121 
00122 template <class T> 
00123 class sc_fifo_nonblocking_out_if 
00124 : virtual public sc_interface 
00125 { 
00126 public: 
00127 
00128     // non-blocking write 
00129     virtual bool nb_write( const T& ) = 0; 
00130 
00131     // get the data read event 
00132     virtual const sc_event& data_read_event() const = 0; 
00133 }; 
00134 
00135 // ----------------------------------------------------------------------------
00136 //  CLASS : sc_fifo_blocking_out_if<T>
00137 //
00138 //  The sc_fifo<T> blocking output interface class.
00139 // ----------------------------------------------------------------------------
00140 
00141 template <class T> 
00142 class sc_fifo_blocking_out_if 
00143 : virtual public sc_interface 
00144 { 
00145 public: 
00146 
00147     // blocking write 
00148     virtual void write( const T& ) = 0; 
00149 
00150 }; 
00151 
00152 // ----------------------------------------------------------------------------
00153 //  CLASS : sc_fifo_out_if<T>
00154 //
00155 //  The sc_fifo<T> output interface class.
00156 // ----------------------------------------------------------------------------
00157 
00158 template <class T> 
00159 class sc_fifo_out_if 
00160 : public sc_fifo_nonblocking_out_if<T>, 
00161   public sc_fifo_blocking_out_if<T> 
00162 { 
00163 public: 
00164 
00165     // get the number of free spaces 
00166     virtual int num_free() const = 0; 
00167 
00168 protected: 
00169 
00170     // constructor 
00171 
00172     sc_fifo_out_if() 
00173         {} 
00174 
00175 private: 
00176 
00177     // disabled 
00178     sc_fifo_out_if( const sc_fifo_out_if<T>& ); 
00179     sc_fifo_out_if<T>& operator = ( const sc_fifo_out_if<T>& ); 
00180 }; 
00181 
00182 } // namespace sc_core
00183 
00184 #endif
00185 
00186 // Taf!

Generated on Wed Apr 25 13:53:25 2007 for SystemC by  doxygen 1.5.1