sc_signal_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_signal_ifs.h -- The sc_signal<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:
00032   Description of Modification:
00033     
00034  *****************************************************************************/
00035 //$Log: sc_signal_ifs.h,v $
00036 //Revision 1.1.1.1  2006/12/15 20:31:35  acg
00037 //SystemC 2.2
00038 //
00039 //Revision 1.3  2006/04/11 23:11:57  acg
00040 //  Andy Goodrich: Changes for reset support that only includes
00041 //  sc_cthread_process instances.
00042 //
00043 //Revision 1.2  2006/01/03 23:18:26  acg
00044 //Changed copyright to include 2006.
00045 //
00046 //Revision 1.1.1.1  2005/12/19 23:16:43  acg
00047 //First check in of SystemC 2.1 into its own archive.
00048 //
00049 //Revision 1.10  2005/09/15 23:01:51  acg
00050 //Added std:: prefix to appropriate methods and types to get around
00051 //issues with the Edison Front End.
00052 //
00053 //Revision 1.9  2005/06/29 18:12:12  acg
00054 //Added $log.
00055 //
00056 //Revision 1.8  2005/06/10 22:43:55  acg
00057 //Added CVS change log annotation.
00058 //
00059 
00060 #ifndef SC_SIGNAL_IFS_H
00061 #define SC_SIGNAL_IFS_H
00062 
00063 
00064 #include "sysc/communication/sc_interface.h"
00065 
00066 
00067 namespace sc_dt
00068 {
00069     class sc_logic;
00070 }
00071 
00072 namespace sc_core {
00073 
00074 class sc_signal_bool_deval;
00075 class sc_signal_logic_deval;
00076 
00077 
00078 // ----------------------------------------------------------------------------
00079 //  CLASS : sc_signal_in_if<T>
00080 //
00081 //  The sc_signal<T> input interface class.
00082 // ----------------------------------------------------------------------------
00083 
00084 template <class T>
00085 class sc_signal_in_if
00086 : virtual public sc_interface
00087 {
00088 public:
00089 
00090     // get the value changed event
00091     virtual const sc_event& value_changed_event() const = 0;
00092 
00093 
00094     // read the current value
00095     virtual const T& read() const = 0;
00096 
00097     // get a reference to the current value (for tracing)
00098     virtual const T& get_data_ref() const = 0;
00099 
00100 
00101     // was there a value changed event?
00102     virtual bool event() const = 0;
00103 
00104 protected:
00105 
00106     // constructor
00107 
00108     sc_signal_in_if()
00109     {}
00110 
00111 private:
00112 
00113     // disabled
00114     sc_signal_in_if( const sc_signal_in_if<T>& );
00115     sc_signal_in_if<T>& operator = ( const sc_signal_in_if<T>& );
00116 };
00117 
00118 
00119 // ----------------------------------------------------------------------------
00120 //  CLASS : sc_signal_in_if<bool>
00121 //
00122 //  Specialization of sc_signal_in_if<T> for type bool.
00123 // ----------------------------------------------------------------------------
00124 
00125 class sc_reset;
00126 
00127 template <>
00128 class sc_signal_in_if<bool>
00129 : virtual public sc_interface
00130 {
00131 public:
00132 
00133     // get the value changed event
00134     virtual const sc_event& value_changed_event() const = 0;
00135 
00136     // get the positive edge event
00137     virtual const sc_event& posedge_event() const = 0;
00138 
00139     // get the negative edge event
00140     virtual const sc_event& negedge_event() const = 0;
00141 
00142 
00143     // read the current value
00144     virtual const bool& read() const = 0;
00145 
00146     // get a reference to the current value (for tracing)
00147     virtual const bool& get_data_ref() const = 0;
00148 
00149 
00150     // was there a value changed event?
00151     virtual bool event() const = 0;
00152 
00153     // was there a positive edge event?
00154     virtual bool posedge() const = 0;
00155 
00156     // was there a negative edge event?
00157     virtual bool negedge() const = 0;
00158 
00159     // designate this object as a reset signal.
00160     virtual sc_reset* is_reset() const = 0; 
00161 
00162 protected:
00163 
00164     // constructor
00165 
00166     sc_signal_in_if()
00167     {}
00168 
00169 private:
00170 
00171     // disabled
00172     sc_signal_in_if( const sc_signal_in_if<bool>& );
00173     sc_signal_in_if<bool>& operator = ( const sc_signal_in_if<bool>& );
00174 };
00175 
00176 
00177 // ----------------------------------------------------------------------------
00178 //  CLASS : sc_signal_in_if<sc_dt::sc_logic>
00179 //
00180 //  Specialization of sc_signal_in_if<T> for type sc_dt::sc_logic.
00181 // ----------------------------------------------------------------------------
00182 
00183 template <>
00184 class sc_signal_in_if<sc_dt::sc_logic>
00185 : virtual public sc_interface
00186 {
00187 public:
00188 
00189     // get the value changed event
00190     virtual const sc_event& value_changed_event() const = 0;
00191 
00192     // get the positive edge event
00193     virtual const sc_event& posedge_event() const = 0;
00194 
00195     // get the negative edge event
00196     virtual const sc_event& negedge_event() const = 0;
00197 
00198 
00199     // read the current value
00200     virtual const sc_dt::sc_logic& read() const = 0;
00201 
00202     // get a reference to the current value (for tracing)
00203     virtual const sc_dt::sc_logic& get_data_ref() const = 0;
00204 
00205 
00206     // was there a value changed event?
00207     virtual bool event() const = 0;
00208 
00209     // was there a positive edge event?
00210     virtual bool posedge() const = 0;
00211 
00212     // was there a negative edge event?
00213     virtual bool negedge() const = 0;
00214 
00215 
00216 protected:
00217 
00218     // constructor
00219 
00220     sc_signal_in_if()
00221     {}
00222 
00223 private:
00224 
00225     // disabled
00226     sc_signal_in_if( const sc_signal_in_if<sc_dt::sc_logic>& );
00227     sc_signal_in_if<sc_dt::sc_logic>& operator = (
00228     const sc_signal_in_if<sc_dt::sc_logic>& );
00229 };
00230 
00231 
00232 // ----------------------------------------------------------------------------
00233 //  CLASS : sc_signal_write_if<T>
00234 //
00235 //  The standard output interface class.
00236 // ----------------------------------------------------------------------------
00237 template< typename T >
00238 class sc_signal_write_if : public virtual sc_interface
00239 {
00240 public:
00241     sc_signal_write_if() {}
00242     // write the new value
00243     virtual void write( const T& ) = 0;
00244 private:
00245     // disabled
00246     sc_signal_write_if( const sc_signal_write_if<T>& );
00247     sc_signal_write_if<T>& operator = ( const sc_signal_write_if<T>& );
00248 };
00249 
00250 
00251 // ----------------------------------------------------------------------------
00252 //  CLASS : sc_signal_inout_if<T>
00253 //
00254 //  The sc_signal<T> input/output interface class.
00255 // ----------------------------------------------------------------------------
00256 
00257 template <class T>
00258 class sc_signal_inout_if
00259 : public sc_signal_in_if<T>, public sc_signal_write_if<T>
00260 {
00261 
00262 protected:
00263 
00264     // constructor
00265 
00266     sc_signal_inout_if()
00267     {}
00268 
00269 private:
00270 
00271     // disabled
00272     sc_signal_inout_if( const sc_signal_inout_if<T>& );
00273     sc_signal_inout_if<T>& operator = ( const sc_signal_inout_if<T>& );
00274 };
00275 
00276 
00277 // ----------------------------------------------------------------------------
00278 //  CLASS : sc_signal_out_if<T>
00279 //
00280 //  The sc_signal<T> output interface class.
00281 // ----------------------------------------------------------------------------
00282 
00283 // sc_signal_out_if can also be read from, hence no difference with
00284 // sc_signal_inout_if.
00285 
00286 #define sc_signal_out_if sc_signal_inout_if
00287 
00288 } // namespace sc_core
00289 
00290 #endif
00291 
00292 // Taf!

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