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

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