Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

sc_fxtype_params.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-2004 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.3 (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_fxtype_params.h - 
00021 
00022   Original Author: Martin Janssen, Synopsys, Inc.
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_FXTYPE_PARAMS_H
00037 #define SC_FXTYPE_PARAMS_H
00038 
00039 
00040 #include "systemc/datatypes/fx/sc_context.h"
00041 
00042 
00043 namespace sc_dt
00044 {
00045 
00046 // classes defined in this module
00047 class sc_fxtype_params;
00048 
00049 
00050 // ----------------------------------------------------------------------------
00051 //  CLASS : sc_fxtype_params
00052 //
00053 //  Fixed-point type parameters class.
00054 // ----------------------------------------------------------------------------
00055 
00056 class sc_fxtype_params
00057 {
00058 public:
00059 
00060              sc_fxtype_params();
00061              sc_fxtype_params( int, int );
00062              sc_fxtype_params(           sc_q_mode, sc_o_mode, int = 0 );
00063              sc_fxtype_params( int, int, sc_q_mode, sc_o_mode, int = 0 );
00064              sc_fxtype_params( const sc_fxtype_params& );
00065        sc_fxtype_params( const sc_fxtype_params&,
00066              int, int );
00067        sc_fxtype_params( const sc_fxtype_params&,
00068                        sc_q_mode, sc_o_mode, int = 0 );
00069     explicit sc_fxtype_params( sc_without_context );
00070 
00071     sc_fxtype_params& operator = ( const sc_fxtype_params& );
00072 
00073     friend bool operator == ( const sc_fxtype_params&,
00074                               const sc_fxtype_params& );
00075     friend bool operator != ( const sc_fxtype_params&,
00076             const sc_fxtype_params& );
00077 
00078     int wl() const;
00079     void wl( int );
00080 
00081     int iwl() const;
00082     void iwl( int );
00083 
00084     sc_q_mode q_mode() const;
00085     void q_mode( sc_q_mode );
00086 
00087     sc_o_mode o_mode() const;
00088     void o_mode( sc_o_mode );
00089 
00090     int n_bits() const;
00091     void n_bits( int );
00092 
00093     const sc_string to_string() const;
00094 
00095     void print( ostream& = cout ) const;
00096     void dump( ostream& = cout ) const;
00097 
00098 private:
00099 
00100     int       m_wl;
00101     int       m_iwl;
00102     sc_q_mode m_q_mode;
00103     sc_o_mode m_o_mode;
00104     int       m_n_bits;
00105 };
00106 
00107 
00108 // ----------------------------------------------------------------------------
00109 //  TYPEDEF : sc_fxtype_context
00110 //
00111 //  Context type for the fixed-point type parameters.
00112 // ----------------------------------------------------------------------------
00113 
00114 typedef sc_context<sc_fxtype_params> sc_fxtype_context;
00115 
00116 
00117 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00118 
00119 inline
00120 sc_fxtype_params::sc_fxtype_params()
00121 {
00122     *this = sc_fxtype_context::default_value();
00123 }
00124 
00125 inline
00126 sc_fxtype_params::sc_fxtype_params( int wl_, int iwl_ )
00127 {
00128     *this = sc_fxtype_context::default_value();
00129 
00130     SC_CHECK_WL_( wl_ );
00131     m_wl  = wl_;
00132     m_iwl = iwl_;
00133 }
00134 
00135 inline
00136 sc_fxtype_params::sc_fxtype_params( sc_q_mode q_mode_,
00137                                     sc_o_mode o_mode_, int n_bits_ )
00138 {
00139     *this = sc_fxtype_context::default_value();
00140 
00141     SC_CHECK_N_BITS_( n_bits_ );
00142     m_q_mode = q_mode_;
00143     m_o_mode = o_mode_;
00144     m_n_bits = n_bits_;
00145 }
00146 
00147 inline
00148 sc_fxtype_params::sc_fxtype_params( int wl_, int iwl_,
00149                                     sc_q_mode q_mode_,
00150                                     sc_o_mode o_mode_, int n_bits_ )
00151 {
00152     SC_CHECK_WL_( wl_ );
00153     SC_CHECK_N_BITS_( n_bits_ );
00154     m_wl     = wl_;
00155     m_iwl    = iwl_;
00156     m_q_mode = q_mode_;
00157     m_o_mode = o_mode_;
00158     m_n_bits = n_bits_;
00159 }
00160 
00161 inline
00162 sc_fxtype_params::sc_fxtype_params( const sc_fxtype_params& a )
00163 : m_wl( a.m_wl ), m_iwl( a.m_iwl ),
00164   m_q_mode( a.m_q_mode ),
00165   m_o_mode( a.m_o_mode ), m_n_bits( a.m_n_bits )
00166 {}
00167 
00168 inline
00169 sc_fxtype_params::sc_fxtype_params( const sc_fxtype_params& a,
00170             int wl_, int iwl_ )
00171 : m_wl( wl_ ), m_iwl( iwl_ ),
00172   m_q_mode( a.m_q_mode ),
00173   m_o_mode( a.m_o_mode ), m_n_bits( a.m_n_bits )
00174 {}
00175 
00176 inline
00177 sc_fxtype_params::sc_fxtype_params( const sc_fxtype_params& a,
00178             sc_q_mode q_mode_,
00179             sc_o_mode o_mode_, int n_bits_ )
00180 : m_wl( a.m_wl ), m_iwl( a.m_iwl ),
00181   m_q_mode( q_mode_ ),
00182   m_o_mode( o_mode_ ), m_n_bits( n_bits_ )
00183 {}
00184 
00185 inline
00186 sc_fxtype_params::sc_fxtype_params( sc_without_context )
00187 : m_wl    ( SC_DEFAULT_WL_ ),
00188   m_iwl   ( SC_DEFAULT_IWL_ ),
00189   m_q_mode( SC_DEFAULT_Q_MODE_ ),
00190   m_o_mode( SC_DEFAULT_O_MODE_ ),
00191   m_n_bits( SC_DEFAULT_N_BITS_ )
00192 {}
00193 
00194 
00195 inline
00196 sc_fxtype_params&
00197 sc_fxtype_params::operator = ( const sc_fxtype_params& a )
00198 {
00199     if( &a != this )
00200     {
00201         m_wl     = a.m_wl;
00202   m_iwl    = a.m_iwl;
00203   m_q_mode = a.m_q_mode;
00204   m_o_mode = a.m_o_mode;
00205   m_n_bits = a.m_n_bits;
00206     }
00207     return *this;
00208 }
00209 
00210 
00211 inline
00212 bool
00213 operator == ( const sc_fxtype_params& a, const sc_fxtype_params& b )
00214 {
00215     return ( a.m_wl     == b.m_wl     &&
00216        a.m_iwl    == b.m_iwl    &&
00217        a.m_q_mode == b.m_q_mode &&
00218        a.m_o_mode == b.m_o_mode &&
00219        a.m_n_bits == b.m_n_bits );
00220 }
00221 
00222 inline
00223 bool
00224 operator != ( const sc_fxtype_params& a, const sc_fxtype_params& b )
00225 {
00226     return ( a.m_wl     != b.m_wl     ||
00227        a.m_iwl    != b.m_iwl    ||
00228        a.m_q_mode != b.m_q_mode ||
00229        a.m_o_mode != b.m_o_mode ||
00230        a.m_n_bits != b.m_n_bits );
00231 }
00232 
00233 
00234 inline
00235 int
00236 sc_fxtype_params::wl() const
00237 {
00238     return m_wl;
00239 }
00240 
00241 inline
00242 void
00243 sc_fxtype_params::wl( int wl_ )
00244 {
00245     SC_CHECK_WL_( wl_ );
00246     m_wl = wl_;
00247 }
00248 
00249 
00250 inline
00251 int
00252 sc_fxtype_params::iwl() const
00253 {
00254     return m_iwl;
00255 }
00256 
00257 inline
00258 void
00259 sc_fxtype_params::iwl( int iwl_ )
00260 {
00261     m_iwl = iwl_;
00262 }
00263 
00264 
00265 inline
00266 sc_q_mode
00267 sc_fxtype_params::q_mode() const
00268 {
00269     return m_q_mode;
00270 }
00271 
00272 inline
00273 void
00274 sc_fxtype_params::q_mode( sc_q_mode q_mode_ )
00275 {
00276     m_q_mode = q_mode_;
00277 }
00278 
00279 
00280 inline
00281 sc_o_mode
00282 sc_fxtype_params::o_mode() const
00283 {
00284     return m_o_mode;
00285 }
00286 
00287 inline
00288 void
00289 sc_fxtype_params::o_mode( sc_o_mode o_mode_ )
00290 {
00291     m_o_mode = o_mode_;
00292 }
00293 
00294 
00295 inline
00296 int
00297 sc_fxtype_params::n_bits() const
00298 {
00299     return m_n_bits;
00300 }
00301 
00302 inline
00303 void
00304 sc_fxtype_params::n_bits( int n_bits_ )
00305 {
00306     SC_CHECK_N_BITS_( n_bits_ );
00307     m_n_bits = n_bits_;
00308 }
00309 
00310 
00311 inline
00312 ostream&
00313 operator << ( ostream& os, const sc_fxtype_params& a )
00314 {
00315     a.print( os );
00316     return os;
00317 }
00318 
00319 } // namespace sc_dt
00320 
00321 
00322 #endif
00323 
00324 // Taf!

Generated on Fri Jan 14 08:29:02 2005 for SystemC2.1beta11(excludingMSLib)(IncludingSCV)\nProvidedby:www.openverificationfoundation.org by doxygen1.2.18