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

sc_fixed.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_fixed.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_FIXED_H
00037 #define SC_FIXED_H
00038 
00039 
00040 #include "systemc/datatypes/fx/sc_fix.h"
00041 
00042 
00043 namespace sc_dt
00044 {
00045 
00046 // classes defined in this module
00047 template <int W, int I, sc_q_mode Q, sc_o_mode O, int N> class sc_fixed;
00048 template <int W, int I, sc_q_mode Q, sc_o_mode O, int N> class sc_fixed_fast;
00049 
00050 
00051 // ----------------------------------------------------------------------------
00052 //  TEMPLATE CLASS : sc_fixed
00053 //
00054 //  "Constrained" signed fixed-point class; arbitrary precision.
00055 // ----------------------------------------------------------------------------
00056 
00057 template <int W, int I,
00058     sc_q_mode Q = SC_DEFAULT_Q_MODE_,
00059     sc_o_mode O = SC_DEFAULT_O_MODE_, int N = SC_DEFAULT_N_BITS_>
00060 class sc_fixed : public sc_fix
00061 {
00062 
00063 public:
00064 
00065     // constructors
00066 
00067     explicit sc_fixed( sc_fxnum_observer* = 0 );
00068     explicit sc_fixed( const sc_fxcast_switch&, sc_fxnum_observer* = 0 );
00069 
00070 #define DECL_CTORS_T_A(tp)                                                    \
00071              sc_fixed( tp, sc_fxnum_observer* = 0 );                          \
00072              sc_fixed( tp, const sc_fxcast_switch&, sc_fxnum_observer* = 0 );
00073 
00074 #define DECL_CTORS_T_B(tp)                                                    \
00075     explicit sc_fixed( tp, sc_fxnum_observer* = 0 );                          \
00076              sc_fixed( tp, const sc_fxcast_switch&, sc_fxnum_observer* = 0 );
00077 
00078     DECL_CTORS_T_A(int)
00079     DECL_CTORS_T_A(unsigned int)
00080     DECL_CTORS_T_A(long)
00081     DECL_CTORS_T_A(unsigned long)
00082     DECL_CTORS_T_A(double)
00083     DECL_CTORS_T_A(const char*)
00084     DECL_CTORS_T_A(const sc_fxval&)
00085     DECL_CTORS_T_A(const sc_fxval_fast&)
00086     DECL_CTORS_T_A(const sc_fxnum&)
00087     DECL_CTORS_T_A(const sc_fxnum_fast&)
00088 #ifndef SC_FX_EXCLUDE_OTHER
00089     DECL_CTORS_T_B(int64)
00090     DECL_CTORS_T_B(uint64)
00091     DECL_CTORS_T_B(const sc_int_base&)
00092     DECL_CTORS_T_B(const sc_uint_base&)
00093     DECL_CTORS_T_B(const sc_signed&)
00094     DECL_CTORS_T_B(const sc_unsigned&)
00095 #endif
00096 
00097 #undef DECL_CTORS_T_A
00098 #undef DECL_CTORS_T_B
00099 
00100     // copy constructor
00101 
00102     sc_fixed( const sc_fixed<W,I,Q,O,N>& );
00103 
00104 
00105     // assignment operators
00106 
00107     sc_fixed& operator = ( const sc_fixed<W,I,Q,O,N>& );
00108 
00109 #define DECL_ASN_OP_T(op,tp)                                                  \
00110     sc_fixed& operator op ( tp );
00111 
00112 #ifndef SC_FX_EXCLUDE_OTHER
00113 #define DECL_ASN_OP_OTHER(op)                                                 \
00114     DECL_ASN_OP_T(op,int64)                                                   \
00115     DECL_ASN_OP_T(op,uint64)                                                  \
00116     DECL_ASN_OP_T(op,const sc_int_base&)                                      \
00117     DECL_ASN_OP_T(op,const sc_uint_base&)                                     \
00118     DECL_ASN_OP_T(op,const sc_signed&)                                        \
00119     DECL_ASN_OP_T(op,const sc_unsigned&)
00120 #else
00121 #define DECL_ASN_OP_OTHER(op)
00122 #endif
00123 
00124 #define DECL_ASN_OP(op)                                                       \
00125     DECL_ASN_OP_T(op,int)                                                     \
00126     DECL_ASN_OP_T(op,unsigned int)                                            \
00127     DECL_ASN_OP_T(op,long)                                                    \
00128     DECL_ASN_OP_T(op,unsigned long)                                           \
00129     DECL_ASN_OP_T(op,double)                                                  \
00130     DECL_ASN_OP_T(op,const char*)                                             \
00131     DECL_ASN_OP_T(op,const sc_fxval&)                                         \
00132     DECL_ASN_OP_T(op,const sc_fxval_fast&)                                    \
00133     DECL_ASN_OP_T(op,const sc_fxnum&)                                         \
00134     DECL_ASN_OP_T(op,const sc_fxnum_fast&)                                    \
00135     DECL_ASN_OP_OTHER(op)
00136 
00137     DECL_ASN_OP(=)
00138 
00139     DECL_ASN_OP(*=)
00140     DECL_ASN_OP(/=)
00141     DECL_ASN_OP(+=)
00142     DECL_ASN_OP(-=)
00143 
00144     DECL_ASN_OP_T(<<=,int)
00145     DECL_ASN_OP_T(>>=,int)
00146 
00147     DECL_ASN_OP_T(&=,const sc_fix&)
00148     DECL_ASN_OP_T(&=,const sc_fix_fast&)
00149     DECL_ASN_OP_T(|=,const sc_fix&)
00150     DECL_ASN_OP_T(|=,const sc_fix_fast&)
00151     DECL_ASN_OP_T(^=,const sc_fix&)
00152     DECL_ASN_OP_T(^=,const sc_fix_fast&)
00153 
00154 #undef DECL_ASN_OP_T
00155 #undef DECL_ASN_OP_OTHER
00156 #undef DECL_ASN_OP
00157 
00158 
00159     // auto-increment and auto-decrement
00160 
00161     const sc_fxval operator ++ ( int );
00162     const sc_fxval operator -- ( int );
00163 
00164     sc_fixed& operator ++ ();
00165     sc_fixed& operator -- ();
00166 
00167 };
00168 
00169 
00170 // ----------------------------------------------------------------------------
00171 //  TEMPLATE CLASS : sc_fixed_fast
00172 //
00173 //  "Constrained" signed fixed-point class; limited precision.
00174 // ----------------------------------------------------------------------------
00175 
00176 template <int W, int I,
00177     sc_q_mode Q = SC_DEFAULT_Q_MODE_,
00178     sc_o_mode O = SC_DEFAULT_O_MODE_, int N = SC_DEFAULT_N_BITS_>
00179 class sc_fixed_fast : public sc_fix_fast
00180 {
00181 
00182 public:
00183 
00184     // constructors
00185 
00186     explicit sc_fixed_fast( sc_fxnum_fast_observer* = 0 );
00187     explicit sc_fixed_fast( const sc_fxcast_switch&,
00188           sc_fxnum_fast_observer* = 0 );
00189 
00190 #define DECL_CTORS_T_A(tp)                                                    \
00191              sc_fixed_fast( tp, sc_fxnum_fast_observer* = 0 );                \
00192              sc_fixed_fast( tp, const sc_fxcast_switch&,                      \
00193                             sc_fxnum_fast_observer* = 0 );
00194 
00195 #define DECL_CTORS_T_B(tp)                                                    \
00196     explicit sc_fixed_fast( tp, sc_fxnum_fast_observer* = 0 );                \
00197              sc_fixed_fast( tp, const sc_fxcast_switch&,                      \
00198                             sc_fxnum_fast_observer* = 0 );
00199 
00200     DECL_CTORS_T_A(int)
00201     DECL_CTORS_T_A(unsigned int)
00202     DECL_CTORS_T_A(long)
00203     DECL_CTORS_T_A(unsigned long)
00204     DECL_CTORS_T_A(double)
00205     DECL_CTORS_T_A(const char*)
00206     DECL_CTORS_T_A(const sc_fxval&)
00207     DECL_CTORS_T_A(const sc_fxval_fast&)
00208     DECL_CTORS_T_A(const sc_fxnum&)
00209     DECL_CTORS_T_A(const sc_fxnum_fast&)
00210 #ifndef SC_FX_EXCLUDE_OTHER
00211     DECL_CTORS_T_B(int64)
00212     DECL_CTORS_T_B(uint64)
00213     DECL_CTORS_T_B(const sc_int_base&)
00214     DECL_CTORS_T_B(const sc_uint_base&)
00215     DECL_CTORS_T_B(const sc_signed&)
00216     DECL_CTORS_T_B(const sc_unsigned&)
00217 #endif
00218 
00219 #undef DECL_CTORS_T_A
00220 #undef DECL_CTORS_T_B
00221 
00222     // copy constructor
00223 
00224     sc_fixed_fast( const sc_fixed_fast<W,I,Q,O,N>& );
00225 
00226 
00227     // assignment operators
00228 
00229     sc_fixed_fast& operator = ( const sc_fixed_fast<W,I,Q,O,N>& );
00230 
00231 #define DECL_ASN_OP_T(op,tp)                                                  \
00232     sc_fixed_fast& operator op ( tp );
00233 
00234 #ifndef SC_FX_EXCLUDE_OTHER
00235 #define DECL_ASN_OP_OTHER(op)                                                 \
00236     DECL_ASN_OP_T(op,int64)                                                   \
00237     DECL_ASN_OP_T(op,uint64)                                                  \
00238     DECL_ASN_OP_T(op,const sc_int_base&)                                      \
00239     DECL_ASN_OP_T(op,const sc_uint_base&)                                     \
00240     DECL_ASN_OP_T(op,const sc_signed&)                                        \
00241     DECL_ASN_OP_T(op,const sc_unsigned&)
00242 #else
00243 #define DECL_ASN_OP_OTHER(op)
00244 #endif
00245 
00246 #define DECL_ASN_OP(op)                                                       \
00247     DECL_ASN_OP_T(op,int)                                                     \
00248     DECL_ASN_OP_T(op,unsigned int)                                            \
00249     DECL_ASN_OP_T(op,long)                                                    \
00250     DECL_ASN_OP_T(op,unsigned long)                                           \
00251     DECL_ASN_OP_T(op,double)                                                  \
00252     DECL_ASN_OP_T(op,const char*)                                             \
00253     DECL_ASN_OP_T(op,const sc_fxval&)                                         \
00254     DECL_ASN_OP_T(op,const sc_fxval_fast&)                                    \
00255     DECL_ASN_OP_T(op,const sc_fxnum&)                                         \
00256     DECL_ASN_OP_T(op,const sc_fxnum_fast&)                                    \
00257     DECL_ASN_OP_OTHER(op)
00258 
00259     DECL_ASN_OP(=)
00260 
00261     DECL_ASN_OP(*=)
00262     DECL_ASN_OP(/=)
00263     DECL_ASN_OP(+=)
00264     DECL_ASN_OP(-=)
00265 
00266     DECL_ASN_OP_T(<<=,int)
00267     DECL_ASN_OP_T(>>=,int)
00268 
00269     DECL_ASN_OP_T(&=,const sc_fix&)
00270     DECL_ASN_OP_T(&=,const sc_fix_fast&)
00271     DECL_ASN_OP_T(|=,const sc_fix&)
00272     DECL_ASN_OP_T(|=,const sc_fix_fast&)
00273     DECL_ASN_OP_T(^=,const sc_fix&)
00274     DECL_ASN_OP_T(^=,const sc_fix_fast&)
00275 
00276 #undef DECL_ASN_OP_T
00277 #undef DECL_ASN_OP_OTHER
00278 #undef DECL_ASN_OP
00279 
00280 
00281     // auto-increment and auto-decrement
00282 
00283     const sc_fxval_fast operator ++ ( int );
00284     const sc_fxval_fast operator -- ( int );
00285 
00286     sc_fixed_fast& operator ++ ();
00287     sc_fixed_fast& operator -- ();
00288 
00289 };
00290 
00291 
00292 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00293 
00294 // ----------------------------------------------------------------------------
00295 //  TEMPLATE CLASS : sc_fixed
00296 //
00297 //  "Constrained" signed fixed-point class; arbitrary precision.
00298 // ----------------------------------------------------------------------------
00299 
00300 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00301 inline
00302 sc_fixed<W,I,Q,O,N>::sc_fixed( sc_fxnum_observer* observer_ )
00303 : sc_fix( W, I, Q, O, N, observer_ )
00304 {}
00305 
00306 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00307 inline
00308 sc_fixed<W,I,Q,O,N>::sc_fixed( const sc_fxcast_switch& cast_sw,
00309              sc_fxnum_observer* observer_ )
00310 : sc_fix( W, I, Q, O, N, cast_sw, observer_ )
00311 {}
00312 
00313 #define DEFN_CTORS_T(tp)                                                      \
00314 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
00315 inline                                                                        \
00316 sc_fixed<W,I,Q,O,N>::sc_fixed( tp a,                                          \
00317              sc_fxnum_observer* observer_ )                 \
00318 : sc_fix( a, W, I, Q, O, N, observer_ )                                       \
00319 {}                                                                            \
00320                                                                               \
00321 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
00322 inline                                                                        \
00323 sc_fixed<W,I,Q,O,N>::sc_fixed( tp a,                                          \
00324              const sc_fxcast_switch& cast_sw,               \
00325              sc_fxnum_observer* observer_ )                 \
00326 : sc_fix( a, W, I, Q, O, N, cast_sw, observer_ )                              \
00327 {}
00328 
00329 DEFN_CTORS_T(int)
00330 DEFN_CTORS_T(unsigned int)
00331 DEFN_CTORS_T(long)
00332 DEFN_CTORS_T(unsigned long)
00333 DEFN_CTORS_T(double)
00334 DEFN_CTORS_T(const char*)
00335 DEFN_CTORS_T(const sc_fxval&)
00336 DEFN_CTORS_T(const sc_fxval_fast&)
00337 DEFN_CTORS_T(const sc_fxnum&)
00338 DEFN_CTORS_T(const sc_fxnum_fast&)
00339 #ifndef SC_FX_EXCLUDE_OTHER
00340 DEFN_CTORS_T(int64)
00341 DEFN_CTORS_T(uint64)
00342 DEFN_CTORS_T(const sc_int_base&)
00343 DEFN_CTORS_T(const sc_uint_base&)
00344 DEFN_CTORS_T(const sc_signed&)
00345 DEFN_CTORS_T(const sc_unsigned&)
00346 #endif
00347 
00348 #undef DEFN_CTORS_T
00349 
00350 // copy constructor
00351 
00352 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00353 inline
00354 sc_fixed<W,I,Q,O,N>::sc_fixed( const sc_fixed<W,I,Q,O,N>& a )
00355 : sc_fix( a, W, I, Q, O, N )
00356 {}
00357 
00358 
00359 // assignment operators
00360 
00361 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00362 inline
00363 sc_fixed<W,I,Q,O,N>&
00364 sc_fixed<W,I,Q,O,N>::operator = ( const sc_fixed<W,I,Q,O,N>& a )
00365 {
00366     sc_fix::operator = ( a );
00367     return *this;
00368 }
00369 
00370 #define DEFN_ASN_OP_T(op,tp)                                                  \
00371 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
00372 inline                                                                        \
00373 sc_fixed<W,I,Q,O,N>&                                                          \
00374 sc_fixed<W,I,Q,O,N>::operator op ( tp a )                                     \
00375 {                                                                             \
00376     sc_fix::operator op ( a );                                                \
00377     return *this;                                                             \
00378 }
00379 
00380 #ifndef SC_FX_EXCLUDE_OTHER
00381 #define DEFN_ASN_OP_OTHER(op)                                                 \
00382 DEFN_ASN_OP_T(op,int64)                                                       \
00383 DEFN_ASN_OP_T(op,uint64)                                                      \
00384 DEFN_ASN_OP_T(op,const sc_int_base&)                                          \
00385 DEFN_ASN_OP_T(op,const sc_uint_base&)                                         \
00386 DEFN_ASN_OP_T(op,const sc_signed&)                                            \
00387 DEFN_ASN_OP_T(op,const sc_unsigned&)
00388 #else
00389 #define DEFN_ASN_OP_OTHER(op)
00390 #endif
00391 
00392 #define DEFN_ASN_OP(op)                                                       \
00393 DEFN_ASN_OP_T(op,int)                                                         \
00394 DEFN_ASN_OP_T(op,unsigned int)                                                \
00395 DEFN_ASN_OP_T(op,long)                                                        \
00396 DEFN_ASN_OP_T(op,unsigned long)                                               \
00397 DEFN_ASN_OP_T(op,double)                                                      \
00398 DEFN_ASN_OP_T(op,const char*)                                                 \
00399 DEFN_ASN_OP_T(op,const sc_fxval&)                                             \
00400 DEFN_ASN_OP_T(op,const sc_fxval_fast&)                                        \
00401 DEFN_ASN_OP_T(op,const sc_fxnum&)                                             \
00402 DEFN_ASN_OP_T(op,const sc_fxnum_fast&)                                        \
00403 DEFN_ASN_OP_OTHER(op)
00404 
00405 DEFN_ASN_OP(=)
00406 
00407 DEFN_ASN_OP(*=)
00408 DEFN_ASN_OP(/=)
00409 DEFN_ASN_OP(+=)
00410 DEFN_ASN_OP(-=)
00411 
00412 DEFN_ASN_OP_T(<<=,int)
00413 DEFN_ASN_OP_T(>>=,int)
00414 
00415 DEFN_ASN_OP_T(&=,const sc_fix&)
00416 DEFN_ASN_OP_T(&=,const sc_fix_fast&)
00417 DEFN_ASN_OP_T(|=,const sc_fix&)
00418 DEFN_ASN_OP_T(|=,const sc_fix_fast&)
00419 DEFN_ASN_OP_T(^=,const sc_fix&)
00420 DEFN_ASN_OP_T(^=,const sc_fix_fast&)
00421 
00422 #undef DEFN_ASN_OP_T
00423 #undef DEFN_ASN_OP_OTHER
00424 #undef DEFN_ASN_OP
00425 
00426 
00427 // auto-increment and auto-decrement
00428 
00429 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00430 inline
00431 const sc_fxval
00432 sc_fixed<W,I,Q,O,N>::operator ++ ( int )
00433 {
00434     return sc_fxval( sc_fix::operator ++ ( 0 ) );
00435 }
00436 
00437 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00438 inline
00439 const sc_fxval
00440 sc_fixed<W,I,Q,O,N>::operator -- ( int )
00441 {
00442     return sc_fxval( sc_fix::operator -- ( 0 ) );
00443 }
00444 
00445 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00446 inline
00447 sc_fixed<W,I,Q,O,N>&
00448 sc_fixed<W,I,Q,O,N>::operator ++ ()
00449 {
00450     sc_fix::operator ++ ();
00451     return *this;
00452 }
00453 
00454 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00455 inline
00456 sc_fixed<W,I,Q,O,N>&
00457 sc_fixed<W,I,Q,O,N>::operator -- ()
00458 {
00459     sc_fix::operator -- ();
00460     return *this;
00461 }
00462 
00463 
00464 // ----------------------------------------------------------------------------
00465 //  TEMPLATE CLASS : sc_fixed_fast
00466 //
00467 //  "Constrained" signed fixed-point class; limited precision.
00468 // ----------------------------------------------------------------------------
00469 
00470 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00471 inline
00472 sc_fixed_fast<W,I,Q,O,N>::sc_fixed_fast( sc_fxnum_fast_observer* observer_ )
00473 : sc_fix_fast( W, I, Q, O, N, observer_ )
00474 {}
00475 
00476 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00477 inline
00478 sc_fixed_fast<W,I,Q,O,N>::sc_fixed_fast( const sc_fxcast_switch& cast_sw,
00479            sc_fxnum_fast_observer* observer_ )
00480 : sc_fix_fast( W, I, Q, O, N, cast_sw, observer_ )
00481 {}
00482 
00483 #define DEFN_CTORS_T(tp)                                                      \
00484 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
00485 inline                                                                        \
00486 sc_fixed_fast<W,I,Q,O,N>::sc_fixed_fast( tp a,                                \
00487            sc_fxnum_fast_observer* observer_ )  \
00488 : sc_fix_fast( a, W, I, Q, O, N, observer_ )                                  \
00489 {}                                                                            \
00490                                                                               \
00491 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
00492 inline                                                                        \
00493 sc_fixed_fast<W,I,Q,O,N>::sc_fixed_fast( tp a,                                \
00494            const sc_fxcast_switch& cast_sw,     \
00495            sc_fxnum_fast_observer* observer_ )  \
00496 : sc_fix_fast( a, W, I, Q, O, N, cast_sw, observer_ )                         \
00497 {}
00498 
00499 DEFN_CTORS_T(int)
00500 DEFN_CTORS_T(unsigned int)
00501 DEFN_CTORS_T(long)
00502 DEFN_CTORS_T(unsigned long)
00503 DEFN_CTORS_T(double)
00504 DEFN_CTORS_T(const char*)
00505 DEFN_CTORS_T(const sc_fxval&)
00506 DEFN_CTORS_T(const sc_fxval_fast&)
00507 DEFN_CTORS_T(const sc_fxnum&)
00508 DEFN_CTORS_T(const sc_fxnum_fast&)
00509 #ifndef SC_FX_EXCLUDE_OTHER
00510 DEFN_CTORS_T(int64)
00511 DEFN_CTORS_T(uint64)
00512 DEFN_CTORS_T(const sc_int_base&)
00513 DEFN_CTORS_T(const sc_uint_base&)
00514 DEFN_CTORS_T(const sc_signed&)
00515 DEFN_CTORS_T(const sc_unsigned&)
00516 #endif
00517 
00518 #undef DEFN_CTORS_T
00519 
00520 // copy constructor
00521 
00522 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00523 inline
00524 sc_fixed_fast<W,I,Q,O,N>::sc_fixed_fast( const sc_fixed_fast<W,I,Q,O,N>& a )
00525 : sc_fix_fast( a, W, I, Q, O, N )
00526 {}
00527 
00528 
00529 // assignment operators
00530 
00531 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00532 inline
00533 sc_fixed_fast<W,I,Q,O,N>&
00534 sc_fixed_fast<W,I,Q,O,N>::operator = ( const sc_fixed_fast<W,I,Q,O,N>& a )
00535 {
00536     sc_fix_fast::operator = ( a );
00537     return *this;
00538 }
00539 
00540 #define DEFN_ASN_OP_T(op,tp)                                                  \
00541 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
00542 inline                                                                        \
00543 sc_fixed_fast<W,I,Q,O,N>&                                                     \
00544 sc_fixed_fast<W,I,Q,O,N>::operator op ( tp a )                                \
00545 {                                                                             \
00546     sc_fix_fast::operator op ( a );                                           \
00547     return *this;                                                             \
00548 }
00549 
00550 #ifndef SC_FX_EXCLUDE_OTHER
00551 #define DEFN_ASN_OP_OTHER(op)                                                 \
00552 DEFN_ASN_OP_T(op,int64)                                                       \
00553 DEFN_ASN_OP_T(op,uint64)                                                      \
00554 DEFN_ASN_OP_T(op,const sc_int_base&)                                          \
00555 DEFN_ASN_OP_T(op,const sc_uint_base&)                                         \
00556 DEFN_ASN_OP_T(op,const sc_signed&)                                            \
00557 DEFN_ASN_OP_T(op,const sc_unsigned&)
00558 #else
00559 #define DEFN_ASN_OP_OTHER(op)
00560 #endif
00561 
00562 #define DEFN_ASN_OP(op)                                                       \
00563 DEFN_ASN_OP_T(op,int)                                                         \
00564 DEFN_ASN_OP_T(op,unsigned int)                                                \
00565 DEFN_ASN_OP_T(op,long)                                                        \
00566 DEFN_ASN_OP_T(op,unsigned long)                                               \
00567 DEFN_ASN_OP_T(op,double)                                                      \
00568 DEFN_ASN_OP_T(op,const char*)                                                 \
00569 DEFN_ASN_OP_T(op,const sc_fxval&)                                             \
00570 DEFN_ASN_OP_T(op,const sc_fxval_fast&)                                        \
00571 DEFN_ASN_OP_T(op,const sc_fxnum&)                                             \
00572 DEFN_ASN_OP_T(op,const sc_fxnum_fast&)                                        \
00573 DEFN_ASN_OP_OTHER(op)
00574 
00575 DEFN_ASN_OP(=)
00576 
00577 DEFN_ASN_OP(*=)
00578 DEFN_ASN_OP(/=)
00579 DEFN_ASN_OP(+=)
00580 DEFN_ASN_OP(-=)
00581 
00582 DEFN_ASN_OP_T(<<=,int)
00583 DEFN_ASN_OP_T(>>=,int)
00584 
00585 DEFN_ASN_OP_T(&=,const sc_fix&)
00586 DEFN_ASN_OP_T(&=,const sc_fix_fast&)
00587 DEFN_ASN_OP_T(|=,const sc_fix&)
00588 DEFN_ASN_OP_T(|=,const sc_fix_fast&)
00589 DEFN_ASN_OP_T(^=,const sc_fix&)
00590 DEFN_ASN_OP_T(^=,const sc_fix_fast&)
00591 
00592 #undef DEFN_ASN_OP_T
00593 #undef DEFN_ASN_OP_OTHER
00594 #undef DEFN_ASN_OP
00595 
00596 
00597 // auto-increment and auto-decrement
00598 
00599 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00600 inline
00601 const sc_fxval_fast
00602 sc_fixed_fast<W,I,Q,O,N>::operator ++ ( int )
00603 {
00604     return sc_fxval_fast( sc_fix_fast::operator ++ ( 0 ) );
00605 }
00606 
00607 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00608 inline
00609 const sc_fxval_fast
00610 sc_fixed_fast<W,I,Q,O,N>::operator -- ( int )
00611 {
00612     return sc_fxval_fast( sc_fix_fast::operator -- ( 0 ) );
00613 }
00614 
00615 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00616 inline
00617 sc_fixed_fast<W,I,Q,O,N>&
00618 sc_fixed_fast<W,I,Q,O,N>::operator ++ ()
00619 {
00620     sc_fix_fast::operator ++ ();
00621     return *this;
00622 }
00623 
00624 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
00625 inline
00626 sc_fixed_fast<W,I,Q,O,N>&
00627 sc_fixed_fast<W,I,Q,O,N>::operator -- ()
00628 {
00629     sc_fix_fast::operator -- ();
00630     return *this;
00631 }
00632 
00633 } // namespace sc_dt
00634 
00635 
00636 #endif
00637 
00638 // Taf!

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