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

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