sc_signal_resolved_ports.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_resolved_ports.h -- The sc_signal_resolved port classes.
00021 
00022   Original Author: Martin Janssen, Synopsys, Inc., 2001-08-20
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_resolved_ports.h,v $
00036 //Revision 1.1.1.1  2006/12/15 20:31:35  acg
00037 //SystemC 2.2
00038 //
00039 //Revision 1.2  2006/01/03 23:18:26  acg
00040 //Changed copyright to include 2006.
00041 //
00042 //Revision 1.1.1.1  2005/12/19 23:16:43  acg
00043 //First check in of SystemC 2.1 into its own archive.
00044 //
00045 //Revision 1.9  2005/06/10 22:43:55  acg
00046 //Added CVS change log annotation.
00047 //
00048 
00049 #ifndef SC_SIGNAL_RESOLVED_PORTS_H
00050 #define SC_SIGNAL_RESOLVED_PORTS_H
00051 
00052 
00053 #include "sysc/communication/sc_signal_ports.h"
00054 #include "sysc/datatypes/bit/sc_logic.h"
00055 
00056 namespace sc_core {
00057 
00058 // ----------------------------------------------------------------------------
00059 //  CLASS : sc_in_resolved
00060 //
00061 //  The sc_signal_resolved input port class.
00062 // ----------------------------------------------------------------------------
00063 
00064 class sc_in_resolved
00065     : public sc_in<sc_dt::sc_logic>
00066 {
00067 public:
00068 
00069     // typedefs
00070 
00071     typedef sc_dt::sc_logic            data_type;
00072 
00073     typedef sc_in_resolved             this_type;
00074     typedef sc_in<data_type>           base_type;
00075 
00076     typedef base_type::in_if_type      in_if_type;
00077     typedef base_type::in_port_type    in_port_type;
00078     typedef base_type::inout_port_type inout_port_type;
00079 
00080 public:
00081 
00082     // constructors
00083 
00084     sc_in_resolved()
00085     : base_type()
00086     {}
00087 
00088     explicit sc_in_resolved( const char* name_ )
00089     : base_type( name_ )
00090     {}
00091 
00092     explicit sc_in_resolved( const in_if_type& interface_ )
00093     : base_type( interface_ )
00094     {}
00095 
00096     sc_in_resolved( const char* name_, const in_if_type& interface_ )
00097     : base_type( name_, interface_ )
00098     {}
00099 
00100     explicit sc_in_resolved( in_port_type& parent_ )
00101     : base_type( parent_ )
00102     {}
00103 
00104     sc_in_resolved( const char* name_, in_port_type& parent_ )
00105     : base_type( name_, parent_ )
00106     {}
00107 
00108     explicit sc_in_resolved( inout_port_type& parent_ )
00109     : base_type( parent_ )
00110     {}
00111 
00112     sc_in_resolved( const char* name_, inout_port_type& parent_ )
00113     : base_type( name_, parent_ )
00114     {}
00115 
00116     sc_in_resolved( this_type& parent_ )
00117     : base_type( parent_ )
00118     {}
00119 
00120     sc_in_resolved( const char* name_, this_type& parent_ )
00121     : base_type( name_, parent_ )
00122     {}
00123 
00124 
00125     // destructor (does nothing)
00126 
00127     virtual ~sc_in_resolved()
00128     {}
00129 
00130 
00131     // called when elaboration is done
00132     /*  WHEN DEFINING THIS METHOD IN A DERIVED CLASS, */
00133     /*  MAKE SURE THAT THIS METHOD IS CALLED AS WELL. */
00134 
00135     virtual void end_of_elaboration();
00136 
00137     virtual const char* kind() const
00138         { return "sc_in_resolved"; }
00139 
00140 private:
00141 
00142     // disabled
00143     sc_in_resolved( const this_type& );
00144     this_type& operator = ( const this_type& );
00145 };
00146 
00147 
00148 // ----------------------------------------------------------------------------
00149 //  CLASS : sc_inout_resolved
00150 //
00151 //  The sc_signal_resolved input/output port class.
00152 // ----------------------------------------------------------------------------
00153 
00154 class sc_inout_resolved
00155     : public sc_inout<sc_dt::sc_logic>
00156 {
00157 public:
00158 
00159     // typedefs
00160 
00161     typedef sc_dt::sc_logic            data_type;
00162 
00163     typedef sc_inout_resolved          this_type;
00164     typedef sc_inout<data_type>        base_type;
00165 
00166     typedef base_type::in_if_type      in_if_type;
00167     typedef base_type::in_port_type    in_port_type;
00168     typedef base_type::inout_if_type   inout_if_type;
00169     typedef base_type::inout_port_type inout_port_type;
00170 
00171 public:
00172 
00173     // constructors
00174 
00175     sc_inout_resolved()
00176     : base_type()
00177     {}
00178 
00179     explicit sc_inout_resolved( const char* name_ )
00180     : base_type( name_ )
00181     {}
00182 
00183     explicit sc_inout_resolved( inout_if_type& interface_ )
00184     : base_type( interface_ )
00185     {}
00186 
00187     sc_inout_resolved( const char* name_, inout_if_type& interface_ )
00188     : base_type( name_, interface_ )
00189     {}
00190 
00191     explicit sc_inout_resolved( inout_port_type& parent_ )
00192     : base_type( parent_ )
00193     {}
00194 
00195     sc_inout_resolved( const char* name_, inout_port_type& parent_ )
00196     : base_type( name_, parent_ )
00197     {}
00198 
00199     sc_inout_resolved( this_type& parent_ )
00200     : base_type( parent_ )
00201     {}
00202 
00203     sc_inout_resolved( const char* name_, this_type& parent_ )
00204     : base_type( name_, parent_ )
00205     {}
00206 
00207 
00208     // destructor (does nothing)
00209 
00210     virtual ~sc_inout_resolved()
00211     {}
00212 
00213 
00214     // write the new value
00215 
00216     this_type& operator = ( const data_type& value_ )
00217     { (*this)->write( value_ ); return *this; }
00218 
00219     this_type& operator = ( const in_if_type& interface_ )
00220     { (*this)->write( interface_.read() ); return *this; }
00221 
00222     this_type& operator = ( const in_port_type& port_ )
00223     { (*this)->write( port_->read() ); return *this; }
00224 
00225     this_type& operator = ( const inout_port_type& port_ )
00226     { (*this)->write( port_->read() ); return *this; }
00227 
00228     this_type& operator = ( const this_type& port_ )
00229     { (*this)->write( port_->read() ); return *this; }
00230 
00231 
00232     // called when elaboration is done
00233     /*  WHEN DEFINING THIS METHOD IN A DERIVED CLASS, */
00234     /*  MAKE SURE THAT THIS METHOD IS CALLED AS WELL. */
00235 
00236     virtual void end_of_elaboration();
00237 
00238     virtual const char* kind() const
00239         { return "sc_inout_resolved"; }
00240 
00241 private:
00242 
00243     // disabled
00244     sc_inout_resolved( const this_type& );
00245 };
00246 
00247 
00248 // ----------------------------------------------------------------------------
00249 //  CLASS : sc_out_resolved
00250 //
00251 //  The sc_signal_resolved output port class.
00252 // ----------------------------------------------------------------------------
00253 
00254 // sc_out_resolved can also read from its port, hence no difference with
00255 // sc_inout_resolved. For debugging reasons, a class is provided instead
00256 // of a typedef.
00257 
00258 class sc_out_resolved
00259     : public sc_inout_resolved
00260 {
00261 public:
00262 
00263     // typedefs
00264 
00265     typedef sc_out_resolved            this_type;
00266     typedef sc_inout_resolved          base_type;
00267 
00268     typedef base_type::data_type       data_type;
00269 
00270     typedef base_type::in_if_type      in_if_type;
00271     typedef base_type::in_port_type    in_port_type;
00272     typedef base_type::inout_if_type   inout_if_type;
00273     typedef base_type::inout_port_type inout_port_type;
00274 
00275 public:
00276 
00277     // constructors
00278 
00279     sc_out_resolved()
00280     : base_type()
00281     {}
00282 
00283     explicit sc_out_resolved( const char* name_ )
00284     : base_type( name_ )
00285     {}
00286 
00287     explicit sc_out_resolved( inout_if_type& interface_ )
00288     : base_type( interface_ )
00289     {}
00290 
00291     sc_out_resolved( const char* name_, inout_if_type& interface_ )
00292     : base_type( name_, interface_ )
00293     {}
00294 
00295     explicit sc_out_resolved( inout_port_type& parent_ )
00296     : base_type( parent_ )
00297     {}
00298 
00299     sc_out_resolved( const char* name_, inout_port_type& parent_ )
00300     : base_type( name_, parent_ )
00301     {}
00302 
00303     sc_out_resolved( this_type& parent_ )
00304     : base_type( parent_ )
00305     {}
00306 
00307     sc_out_resolved( const char* name_, this_type& parent_ )
00308     : base_type( name_, parent_ )
00309     {}
00310 
00311 
00312     // destructor (does nothing)
00313 
00314     virtual ~sc_out_resolved()
00315     {}
00316 
00317 
00318     // write the new value
00319 
00320     this_type& operator = ( const data_type& value_ )
00321     { (*this)->write( value_ ); return *this; }
00322 
00323     this_type& operator = ( const in_if_type& interface_ )
00324     { (*this)->write( interface_.read() ); return *this; }
00325 
00326     this_type& operator = ( const in_port_type& port_ )
00327     { (*this)->write( port_->read() ); return *this; }
00328 
00329     this_type& operator = ( const inout_port_type& port_ )
00330     { (*this)->write( port_->read() ); return *this; }
00331 
00332     this_type& operator = ( const this_type& port_ )
00333     { (*this)->write( port_->read() ); return *this; }
00334 
00335     virtual const char* kind() const
00336         { return "sc_out_resolved"; }
00337 
00338 private:
00339 
00340     // disabled
00341     sc_out_resolved( const this_type& );
00342 };
00343 
00344 } // namespace sc_core
00345 
00346 #endif
00347 
00348 // Taf!

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