sc_ufix.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_ufix.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_ufix.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_UFIX_H
00046 #define SC_UFIX_H
00047 
00048 
00049 #include "sysc/datatypes/fx/sc_fxnum.h"
00050 
00051 
00052 namespace sc_dt
00053 {
00054 
00055 // classes defined in this module
00056 class sc_ufix;
00057 class sc_ufix_fast;
00058 
00059 
00060 // ----------------------------------------------------------------------------
00061 //  CLASS : sc_ufix
00062 //
00063 //  "Unconstrained" unsigned fixed-point class; arbitrary precision.
00064 // ----------------------------------------------------------------------------
00065 
00066 class sc_ufix : public sc_fxnum
00067 {
00068 
00069 public:
00070 
00071     // constructors
00072 
00073     explicit sc_ufix( sc_fxnum_observer* = 0 );
00074              sc_ufix( int, int,
00075               sc_fxnum_observer* = 0 );
00076              sc_ufix( sc_q_mode, sc_o_mode,
00077               sc_fxnum_observer* = 0 );
00078              sc_ufix( sc_q_mode, sc_o_mode, int,
00079               sc_fxnum_observer* = 0 );
00080              sc_ufix( int, int, sc_q_mode, sc_o_mode,
00081               sc_fxnum_observer* = 0 );
00082              sc_ufix( int, int, sc_q_mode, sc_o_mode, int,
00083               sc_fxnum_observer* = 0 );
00084     explicit sc_ufix( const sc_fxcast_switch&,
00085               sc_fxnum_observer* = 0 );
00086              sc_ufix( int, int,
00087               const sc_fxcast_switch&,
00088               sc_fxnum_observer* = 0 );
00089              sc_ufix( sc_q_mode, sc_o_mode,
00090               const sc_fxcast_switch&,
00091               sc_fxnum_observer* = 0 );
00092              sc_ufix( sc_q_mode, sc_o_mode, int,
00093               const sc_fxcast_switch&,
00094               sc_fxnum_observer* = 0 );
00095              sc_ufix( int, int, sc_q_mode, sc_o_mode,
00096               const sc_fxcast_switch&,
00097               sc_fxnum_observer* = 0 );
00098              sc_ufix( int, int, sc_q_mode, sc_o_mode, int,
00099               const sc_fxcast_switch&,
00100               sc_fxnum_observer* = 0 );
00101     explicit sc_ufix( const sc_fxtype_params&,
00102               sc_fxnum_observer* = 0 );
00103              sc_ufix( const sc_fxtype_params&,
00104               const sc_fxcast_switch&,
00105               sc_fxnum_observer* = 0 );
00106 
00107 #define DECL_CTORS_T(tp)                                                      \
00108              sc_ufix( tp,                                                     \
00109               int, int,                                               \
00110               sc_fxnum_observer* = 0 );                               \
00111              sc_ufix( tp,                                                     \
00112               sc_q_mode, sc_o_mode,                                   \
00113               sc_fxnum_observer* = 0 );                               \
00114              sc_ufix( tp,                                                     \
00115               sc_q_mode, sc_o_mode, int,                              \
00116               sc_fxnum_observer* = 0 );                               \
00117              sc_ufix( tp,                                                     \
00118               int, int, sc_q_mode, sc_o_mode,                         \
00119               sc_fxnum_observer* = 0 );                               \
00120              sc_ufix( tp,                                                     \
00121               int, int, sc_q_mode, sc_o_mode, int,                    \
00122               sc_fxnum_observer* = 0 );                               \
00123              sc_ufix( tp,                                                     \
00124               const sc_fxcast_switch&,                                \
00125               sc_fxnum_observer* = 0 );                               \
00126              sc_ufix( tp,                                                     \
00127               int, int,                                               \
00128               const sc_fxcast_switch&,                                \
00129               sc_fxnum_observer* = 0 );                               \
00130              sc_ufix( tp,                                                     \
00131               sc_q_mode, sc_o_mode,                                   \
00132               const sc_fxcast_switch&,                                \
00133               sc_fxnum_observer* = 0 );                               \
00134              sc_ufix( tp,                                                     \
00135               sc_q_mode, sc_o_mode, int,                              \
00136               const sc_fxcast_switch&,                                \
00137               sc_fxnum_observer* = 0 );                               \
00138              sc_ufix( tp,                                                     \
00139               int, int, sc_q_mode, sc_o_mode,                         \
00140               const sc_fxcast_switch&,                                \
00141               sc_fxnum_observer* = 0 );                               \
00142              sc_ufix( tp,                                                     \
00143               int, int, sc_q_mode, sc_o_mode, int,                    \
00144               const sc_fxcast_switch&,                                \
00145               sc_fxnum_observer* = 0 );                               \
00146              sc_ufix( tp,                                                     \
00147               const sc_fxtype_params&,                                \
00148               sc_fxnum_observer* = 0 );                               \
00149              sc_ufix( tp,                                                     \
00150               const sc_fxtype_params&,                                \
00151               const sc_fxcast_switch&,                                \
00152               sc_fxnum_observer* = 0 );
00153 
00154 #define DECL_CTORS_T_A(tp)                                                    \
00155              sc_ufix( tp,                                                     \
00156                   sc_fxnum_observer* = 0 );                               \
00157     DECL_CTORS_T(tp)
00158 
00159 #define DECL_CTORS_T_B(tp)                                                    \
00160     explicit sc_ufix( tp,                                                     \
00161                   sc_fxnum_observer* = 0 );                               \
00162     DECL_CTORS_T(tp)
00163 
00164     DECL_CTORS_T_A(int)
00165     DECL_CTORS_T_A(unsigned int)
00166     DECL_CTORS_T_A(long)
00167     DECL_CTORS_T_A(unsigned long)
00168     DECL_CTORS_T_A(double)
00169     DECL_CTORS_T_A(const char*)
00170     DECL_CTORS_T_A(const sc_fxval&)
00171     DECL_CTORS_T_A(const sc_fxval_fast&)
00172     DECL_CTORS_T_A(const sc_fxnum&)
00173     DECL_CTORS_T_A(const sc_fxnum_fast&)
00174 #ifndef SC_FX_EXCLUDE_OTHER
00175     DECL_CTORS_T_B(int64)
00176     DECL_CTORS_T_B(uint64)
00177     DECL_CTORS_T_B(const sc_int_base&)
00178     DECL_CTORS_T_B(const sc_uint_base&)
00179     DECL_CTORS_T_B(const sc_signed&)
00180     DECL_CTORS_T_B(const sc_unsigned&)
00181 #endif
00182 
00183 #undef DECL_CTORS_T
00184 #undef DECL_CTORS_T_A
00185 #undef DECL_CTORS_T_B
00186 
00187     // copy constructor
00188 
00189     sc_ufix( const sc_ufix& );
00190 
00191 
00192     // unary bitwise operators
00193 
00194     const sc_ufix operator ~ () const;
00195 
00196 
00197     // unary bitwise functions
00198 
00199     friend void b_not( sc_ufix&, const sc_ufix& );
00200 
00201 
00202     // binary bitwise operators
00203 
00204     friend const sc_ufix operator & ( const sc_ufix&, const sc_ufix& );
00205     friend const sc_ufix operator & ( const sc_ufix&, const sc_ufix_fast& );
00206     friend const sc_ufix operator & ( const sc_ufix_fast&, const sc_ufix& );
00207     friend const sc_ufix operator | ( const sc_ufix&, const sc_ufix& );
00208     friend const sc_ufix operator | ( const sc_ufix&, const sc_ufix_fast& );
00209     friend const sc_ufix operator | ( const sc_ufix_fast&, const sc_ufix& );
00210     friend const sc_ufix operator ^ ( const sc_ufix&, const sc_ufix& );
00211     friend const sc_ufix operator ^ ( const sc_ufix&, const sc_ufix_fast& );
00212     friend const sc_ufix operator ^ ( const sc_ufix_fast&, const sc_ufix& );
00213 
00214 
00215     // binary bitwise functions
00216 
00217     friend void b_and( sc_ufix&, const sc_ufix&, const sc_ufix& );
00218     friend void b_and( sc_ufix&, const sc_ufix&, const sc_ufix_fast& );
00219     friend void b_and( sc_ufix&, const sc_ufix_fast&, const sc_ufix& );
00220     friend void b_or ( sc_ufix&, const sc_ufix&, const sc_ufix& );
00221     friend void b_or ( sc_ufix&, const sc_ufix&, const sc_ufix_fast& );
00222     friend void b_or ( sc_ufix&, const sc_ufix_fast&, const sc_ufix& );
00223     friend void b_xor( sc_ufix&, const sc_ufix&, const sc_ufix& );
00224     friend void b_xor( sc_ufix&, const sc_ufix&, const sc_ufix_fast& );
00225     friend void b_xor( sc_ufix&, const sc_ufix_fast&, const sc_ufix& );
00226 
00227 
00228     // assignment operators
00229 
00230     sc_ufix& operator = ( const sc_ufix& );
00231 
00232 #define DECL_ASN_OP_T(op,tp)                                                  \
00233     sc_ufix& operator op ( tp );
00234 
00235 #ifndef SC_FX_EXCLUDE_OTHER
00236 #define DECL_ASN_OP_OTHER(op)                                                 \
00237     DECL_ASN_OP_T(op,int64)                                                   \
00238     DECL_ASN_OP_T(op,uint64)                                                  \
00239     DECL_ASN_OP_T(op,const sc_int_base&)                                      \
00240     DECL_ASN_OP_T(op,const sc_uint_base&)                                     \
00241     DECL_ASN_OP_T(op,const sc_signed&)                                        \
00242     DECL_ASN_OP_T(op,const sc_unsigned&)
00243 #else
00244 #define DECL_ASN_OP_OTHER(op)
00245 #endif
00246 
00247 #define DECL_ASN_OP(op)                                                       \
00248     DECL_ASN_OP_T(op,int)                                                     \
00249     DECL_ASN_OP_T(op,unsigned int)                                            \
00250     DECL_ASN_OP_T(op,long)                                                    \
00251     DECL_ASN_OP_T(op,unsigned long)                                           \
00252     DECL_ASN_OP_T(op,double)                                                  \
00253     DECL_ASN_OP_T(op,const char*)                                             \
00254     DECL_ASN_OP_T(op,const sc_fxval&)                                         \
00255     DECL_ASN_OP_T(op,const sc_fxval_fast&)                                    \
00256     DECL_ASN_OP_T(op,const sc_fxnum&)                                         \
00257     DECL_ASN_OP_T(op,const sc_fxnum_fast&)                                    \
00258     DECL_ASN_OP_OTHER(op)
00259 
00260     DECL_ASN_OP(=)
00261 
00262     DECL_ASN_OP(*=)
00263     DECL_ASN_OP(/=)
00264     DECL_ASN_OP(+=)
00265     DECL_ASN_OP(-=)
00266 
00267     DECL_ASN_OP_T(<<=,int)
00268     DECL_ASN_OP_T(>>=,int)
00269 
00270     DECL_ASN_OP_T(&=,const sc_ufix&)
00271     DECL_ASN_OP_T(&=,const sc_ufix_fast&)
00272     DECL_ASN_OP_T(|=,const sc_ufix&)
00273     DECL_ASN_OP_T(|=,const sc_ufix_fast&)
00274     DECL_ASN_OP_T(^=,const sc_ufix&)
00275     DECL_ASN_OP_T(^=,const sc_ufix_fast&)
00276 
00277 #undef DECL_ASN_OP_T
00278 #undef DECL_ASN_OP_OTHER
00279 #undef DECL_ASN_OP
00280 
00281 
00282     // auto-increment and auto-decrement
00283 
00284     const sc_fxval operator ++ ( int );
00285     const sc_fxval operator -- ( int );
00286 
00287     sc_ufix& operator ++ ();
00288     sc_ufix& operator -- ();
00289 
00290 };
00291 
00292 
00293 // ----------------------------------------------------------------------------
00294 //  CLASS : sc_ufix_fast
00295 //
00296 //  "Unconstrained" unsigned fixed-point class; limited precision.
00297 // ----------------------------------------------------------------------------
00298 
00299 class sc_ufix_fast : public sc_fxnum_fast
00300 {
00301 
00302 public:
00303 
00304     // constructors
00305 
00306     explicit sc_ufix_fast( sc_fxnum_fast_observer* = 0 );
00307              sc_ufix_fast( int, int,
00308                sc_fxnum_fast_observer* = 0 );
00309              sc_ufix_fast( sc_q_mode, sc_o_mode,
00310                sc_fxnum_fast_observer* = 0 );
00311              sc_ufix_fast( sc_q_mode, sc_o_mode, int,
00312                sc_fxnum_fast_observer* = 0 );
00313              sc_ufix_fast( int, int, sc_q_mode, sc_o_mode,
00314                sc_fxnum_fast_observer* = 0 );
00315              sc_ufix_fast( int, int, sc_q_mode, sc_o_mode, int,
00316                sc_fxnum_fast_observer* = 0 );
00317     explicit sc_ufix_fast( const sc_fxcast_switch&,
00318                sc_fxnum_fast_observer* = 0 );
00319              sc_ufix_fast( int, int,
00320                const sc_fxcast_switch&,
00321                sc_fxnum_fast_observer* = 0 );
00322              sc_ufix_fast( sc_q_mode, sc_o_mode,
00323                const sc_fxcast_switch&,
00324                sc_fxnum_fast_observer* = 0 );
00325              sc_ufix_fast( sc_q_mode, sc_o_mode, int,
00326                const sc_fxcast_switch&,
00327                sc_fxnum_fast_observer* = 0 );
00328              sc_ufix_fast( int, int, sc_q_mode, sc_o_mode,
00329                const sc_fxcast_switch&,
00330                sc_fxnum_fast_observer* = 0 );
00331              sc_ufix_fast( int, int, sc_q_mode, sc_o_mode, int,
00332                const sc_fxcast_switch&,
00333                sc_fxnum_fast_observer* = 0 );
00334     explicit sc_ufix_fast( const sc_fxtype_params&,
00335                sc_fxnum_fast_observer* = 0 );
00336              sc_ufix_fast( const sc_fxtype_params&,
00337                const sc_fxcast_switch&,
00338                sc_fxnum_fast_observer* = 0 );
00339 
00340 #define DECL_CTORS_T(tp)                                                      \
00341              sc_ufix_fast( tp,                                                \
00342                int, int,                                          \
00343                sc_fxnum_fast_observer* = 0 );                     \
00344              sc_ufix_fast( tp,                                                \
00345                sc_q_mode, sc_o_mode,                              \
00346                sc_fxnum_fast_observer* = 0 );                     \
00347              sc_ufix_fast( tp,                                                \
00348                sc_q_mode, sc_o_mode, int,                         \
00349                sc_fxnum_fast_observer* = 0 );                     \
00350              sc_ufix_fast( tp,                                                \
00351                int, int, sc_q_mode, sc_o_mode,                    \
00352                sc_fxnum_fast_observer* = 0 );                     \
00353              sc_ufix_fast( tp,                                                \
00354                int, int, sc_q_mode, sc_o_mode, int,               \
00355                sc_fxnum_fast_observer* = 0 );                     \
00356              sc_ufix_fast( tp,                                                \
00357                const sc_fxcast_switch&,                           \
00358                sc_fxnum_fast_observer* = 0 );                     \
00359              sc_ufix_fast( tp,                                                \
00360                int, int,                                          \
00361                const sc_fxcast_switch&,                           \
00362                sc_fxnum_fast_observer* = 0 );                     \
00363              sc_ufix_fast( tp,                                                \
00364                sc_q_mode, sc_o_mode,                              \
00365                const sc_fxcast_switch&,                           \
00366                sc_fxnum_fast_observer* = 0 );                     \
00367              sc_ufix_fast( tp,                                                \
00368                sc_q_mode, sc_o_mode, int,                         \
00369                const sc_fxcast_switch&,                           \
00370                sc_fxnum_fast_observer* = 0 );                     \
00371              sc_ufix_fast( tp,                                                \
00372                int, int, sc_q_mode, sc_o_mode,                    \
00373                const sc_fxcast_switch&,                           \
00374                sc_fxnum_fast_observer* = 0 );                     \
00375              sc_ufix_fast( tp,                                                \
00376                int, int, sc_q_mode, sc_o_mode, int,               \
00377                const sc_fxcast_switch&,                           \
00378                sc_fxnum_fast_observer* = 0 );                     \
00379              sc_ufix_fast( tp,                                                \
00380                const sc_fxtype_params&,                           \
00381                sc_fxnum_fast_observer* = 0 );                     \
00382              sc_ufix_fast( tp,                                                \
00383                const sc_fxtype_params&,                           \
00384                const sc_fxcast_switch&,                           \
00385                sc_fxnum_fast_observer* = 0 );
00386 
00387 #define DECL_CTORS_T_A(tp)                                                    \
00388              sc_ufix_fast( tp,                                                \
00389                    sc_fxnum_fast_observer* = 0 );                     \
00390     DECL_CTORS_T(tp)
00391 
00392 #define DECL_CTORS_T_B(tp)                                                    \
00393     explicit sc_ufix_fast( tp,                                                \
00394                    sc_fxnum_fast_observer* = 0 );                     \
00395     DECL_CTORS_T(tp)
00396 
00397     DECL_CTORS_T_A(int)
00398     DECL_CTORS_T_A(unsigned int)
00399     DECL_CTORS_T_A(long)
00400     DECL_CTORS_T_A(unsigned long)
00401     DECL_CTORS_T_A(double)
00402     DECL_CTORS_T_A(const char*)
00403     DECL_CTORS_T_A(const sc_fxval&)
00404     DECL_CTORS_T_A(const sc_fxval_fast&)
00405     DECL_CTORS_T_A(const sc_fxnum&)
00406     DECL_CTORS_T_A(const sc_fxnum_fast&)
00407 #ifndef SC_FX_EXCLUDE_OTHER
00408     DECL_CTORS_T_B(int64)
00409     DECL_CTORS_T_B(uint64)
00410     DECL_CTORS_T_B(const sc_int_base&)
00411     DECL_CTORS_T_B(const sc_uint_base&)
00412     DECL_CTORS_T_B(const sc_signed&)
00413     DECL_CTORS_T_B(const sc_unsigned&)
00414 #endif
00415 
00416 #undef DECL_CTORS_T
00417 #undef DECL_CTORS_T_A
00418 #undef DECL_CTORS_T_B
00419 
00420     // copy constructor
00421 
00422     sc_ufix_fast( const sc_ufix_fast& );
00423 
00424 
00425     // unary bitwise operators
00426 
00427     const sc_ufix_fast operator ~ () const;
00428 
00429 
00430     // unary bitwise functions
00431 
00432     friend void b_not( sc_ufix_fast&, const sc_ufix_fast& );
00433 
00434 
00435     // binary bitwise operators
00436 
00437     friend const sc_ufix_fast operator & ( const sc_ufix_fast&,
00438                        const sc_ufix_fast& );
00439     friend const sc_ufix_fast operator ^ ( const sc_ufix_fast&,
00440                        const sc_ufix_fast& );
00441     friend const sc_ufix_fast operator | ( const sc_ufix_fast&,
00442                        const sc_ufix_fast& );
00443 
00444 
00445     // binary bitwise functions
00446 
00447     friend void b_and( sc_ufix_fast&, const sc_ufix_fast&,
00448                               const sc_ufix_fast& );
00449     friend void b_or ( sc_ufix_fast&, const sc_ufix_fast&,
00450                               const sc_ufix_fast& );
00451     friend void b_xor( sc_ufix_fast&, const sc_ufix_fast&,
00452                               const sc_ufix_fast& );
00453 
00454 
00455     // assignment operators
00456 
00457     sc_ufix_fast& operator = ( const sc_ufix_fast& );
00458 
00459 #define DECL_ASN_OP_T(op,tp)                                                  \
00460     sc_ufix_fast& operator op ( tp );
00461 
00462 #ifndef SC_FX_EXCLUDE_OTHER
00463 #define DECL_ASN_OP_OTHER(op)                                                 \
00464     DECL_ASN_OP_T(op,int64)                                                   \
00465     DECL_ASN_OP_T(op,uint64)                                                  \
00466     DECL_ASN_OP_T(op,const sc_int_base&)                                      \
00467     DECL_ASN_OP_T(op,const sc_uint_base&)                                     \
00468     DECL_ASN_OP_T(op,const sc_signed&)                                        \
00469     DECL_ASN_OP_T(op,const sc_unsigned&)
00470 #else
00471 #define DECL_ASN_OP_OTHER(op)
00472 #endif
00473 
00474 #define DECL_ASN_OP(op)                                                       \
00475     DECL_ASN_OP_T(op,int)                                                     \
00476     DECL_ASN_OP_T(op,unsigned int)                                            \
00477     DECL_ASN_OP_T(op,long)                                                    \
00478     DECL_ASN_OP_T(op,unsigned long)                                           \
00479     DECL_ASN_OP_T(op,double)                                                  \
00480     DECL_ASN_OP_T(op,const char*)                                             \
00481     DECL_ASN_OP_T(op,const sc_fxval&)                                         \
00482     DECL_ASN_OP_T(op,const sc_fxval_fast&)                                    \
00483     DECL_ASN_OP_T(op,const sc_fxnum&)                                         \
00484     DECL_ASN_OP_T(op,const sc_fxnum_fast&)                                    \
00485     DECL_ASN_OP_OTHER(op)
00486 
00487     DECL_ASN_OP(=)
00488 
00489     DECL_ASN_OP(*=)
00490     DECL_ASN_OP(/=)
00491     DECL_ASN_OP(+=)
00492     DECL_ASN_OP(-=)
00493 
00494     DECL_ASN_OP_T(<<=,int)
00495     DECL_ASN_OP_T(>>=,int)
00496 
00497     DECL_ASN_OP_T(&=,const sc_ufix&)
00498     DECL_ASN_OP_T(&=,const sc_ufix_fast&)
00499     DECL_ASN_OP_T(|=,const sc_ufix&)
00500     DECL_ASN_OP_T(|=,const sc_ufix_fast&)
00501     DECL_ASN_OP_T(^=,const sc_ufix&)
00502     DECL_ASN_OP_T(^=,const sc_ufix_fast&)
00503 
00504 #undef DECL_ASN_OP_T
00505 #undef DECL_ASN_OP_OTHER
00506 #undef DECL_ASN_OP
00507 
00508 
00509     // auto-increment and auto-decrement
00510 
00511     const sc_fxval_fast operator ++ ( int );
00512     const sc_fxval_fast operator -- ( int );
00513 
00514     sc_ufix_fast& operator ++ ();
00515     sc_ufix_fast& operator -- ();
00516 
00517 };
00518 
00519 
00520 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00521 
00522 // ----------------------------------------------------------------------------
00523 //  CLASS : sc_ufix
00524 //
00525 //  "Unconstrained" unsigned fixed-point class; arbitrary precision.
00526 // ----------------------------------------------------------------------------
00527 
00528 // constructors
00529 
00530 inline
00531 sc_ufix::sc_ufix( sc_fxnum_observer* observer_ )
00532 : sc_fxnum( sc_fxtype_params(),
00533         SC_US_,
00534         sc_fxcast_switch(),
00535         observer_ )
00536 {}
00537 
00538 inline
00539 sc_ufix::sc_ufix( int wl_, int iwl_,
00540           sc_fxnum_observer* observer_ )
00541 : sc_fxnum( sc_fxtype_params( wl_, iwl_ ),
00542         SC_US_,
00543         sc_fxcast_switch(),
00544         observer_ )
00545 {}
00546 
00547 inline
00548 sc_ufix::sc_ufix( sc_q_mode qm, sc_o_mode om,
00549           sc_fxnum_observer* observer_ )
00550 : sc_fxnum( sc_fxtype_params( qm, om ),
00551         SC_US_,
00552         sc_fxcast_switch(),
00553         observer_ )
00554 {}
00555 
00556 inline
00557 sc_ufix::sc_ufix( sc_q_mode qm, sc_o_mode om, int nb,
00558           sc_fxnum_observer* observer_ )
00559 : sc_fxnum( sc_fxtype_params( qm, om, nb ),
00560         SC_US_,
00561         sc_fxcast_switch(),
00562         observer_ )
00563 {}
00564 
00565 inline
00566 sc_ufix::sc_ufix( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,
00567           sc_fxnum_observer* observer_ )
00568 : sc_fxnum( sc_fxtype_params( wl_, iwl_, qm, om ),
00569         SC_US_,
00570         sc_fxcast_switch(),
00571         observer_ )
00572 {}
00573 
00574 inline
00575 sc_ufix::sc_ufix( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb,
00576           sc_fxnum_observer* observer_ )
00577 : sc_fxnum( sc_fxtype_params( wl_, iwl_, qm, om, nb ),
00578         SC_US_,
00579         sc_fxcast_switch(),
00580         observer_ )
00581 {}
00582 
00583 inline
00584 sc_ufix::sc_ufix( const sc_fxcast_switch& cast_sw,
00585           sc_fxnum_observer* observer_ )
00586 : sc_fxnum( sc_fxtype_params(),
00587         SC_US_,
00588         cast_sw,
00589         observer_ )
00590 {}
00591 
00592 inline
00593 sc_ufix::sc_ufix( int wl_, int iwl_,
00594           const sc_fxcast_switch& cast_sw,
00595           sc_fxnum_observer* observer_ )
00596 : sc_fxnum( sc_fxtype_params( wl_, iwl_ ),
00597         SC_US_,
00598         cast_sw,
00599         observer_ )
00600 {}
00601 
00602 inline
00603 sc_ufix::sc_ufix( sc_q_mode qm, sc_o_mode om,
00604           const sc_fxcast_switch& cast_sw,
00605           sc_fxnum_observer* observer_ )
00606 : sc_fxnum( sc_fxtype_params( qm, om ),
00607         SC_US_,
00608         cast_sw,
00609         observer_ )
00610 {}
00611 
00612 inline
00613 sc_ufix::sc_ufix( sc_q_mode qm, sc_o_mode om, int nb,
00614           const sc_fxcast_switch& cast_sw,
00615           sc_fxnum_observer* observer_ )
00616 : sc_fxnum( sc_fxtype_params( qm, om, nb ),
00617         SC_US_,
00618         cast_sw,
00619         observer_ )
00620 {}
00621 
00622 inline
00623 sc_ufix::sc_ufix( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,
00624           const sc_fxcast_switch& cast_sw,
00625           sc_fxnum_observer* observer_ )
00626 : sc_fxnum( sc_fxtype_params( wl_, iwl_, qm, om ),
00627         SC_US_,
00628         cast_sw,
00629         observer_ )
00630 {}
00631 
00632 inline
00633 sc_ufix::sc_ufix( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb,
00634           const sc_fxcast_switch& cast_sw,
00635           sc_fxnum_observer* observer_ )
00636 : sc_fxnum( sc_fxtype_params( wl_, iwl_, qm, om, nb ),
00637         SC_US_,
00638         cast_sw,
00639         observer_ )
00640 {}
00641 
00642 inline
00643 sc_ufix::sc_ufix( const sc_fxtype_params& type_params,
00644           sc_fxnum_observer* observer_ )
00645 : sc_fxnum( type_params,
00646         SC_US_,
00647         sc_fxcast_switch(),
00648         observer_ )
00649 {}
00650 
00651 inline
00652 sc_ufix::sc_ufix( const sc_fxtype_params& type_params,
00653           const sc_fxcast_switch& cast_sw,
00654           sc_fxnum_observer* observer_ )
00655 : sc_fxnum( type_params,
00656         SC_US_,
00657         cast_sw,
00658         observer_ )
00659 {}
00660 
00661 #define DEFN_CTORS_T_A(tp)                                                    \
00662 inline                                                                        \
00663 sc_ufix::sc_ufix( tp a,                                                       \
00664           sc_fxnum_observer* observer_ )                              \
00665 : sc_fxnum( a,                                                                \
00666         sc_fxtype_params(),                                               \
00667         SC_US_,                                                           \
00668         sc_fxcast_switch(),                                               \
00669         observer_ )                                                       \
00670 {}                                                                            \
00671                                                                               \
00672 inline                                                                        \
00673 sc_ufix::sc_ufix( tp a,                                                       \
00674           int wl_, int iwl_,                                          \
00675           sc_fxnum_observer* observer_ )                              \
00676 : sc_fxnum( a,                                                                \
00677         sc_fxtype_params( wl_, iwl_ ),                                    \
00678         SC_US_,                                                           \
00679         sc_fxcast_switch(),                                               \
00680         observer_ )                                                       \
00681 {}                                                                            \
00682                                                                               \
00683 inline                                                                        \
00684 sc_ufix::sc_ufix( tp a,                                                       \
00685           sc_q_mode qm, sc_o_mode om,                                 \
00686           sc_fxnum_observer* observer_ )                              \
00687 : sc_fxnum( a,                                                                \
00688         sc_fxtype_params( qm, om ),                                       \
00689         SC_US_,                                                           \
00690         sc_fxcast_switch(),                                               \
00691         observer_ )                                                       \
00692 {}                                                                            \
00693                                                                               \
00694 inline                                                                        \
00695 sc_ufix::sc_ufix( tp a,                                                       \
00696           sc_q_mode qm, sc_o_mode om, int nb,                         \
00697           sc_fxnum_observer* observer_ )                              \
00698 : sc_fxnum( a,                                                                \
00699         sc_fxtype_params( qm, om, nb ),                                   \
00700         SC_US_,                                                           \
00701         sc_fxcast_switch(),                                               \
00702         observer_ )                                                       \
00703 {}                                                                            \
00704                                                                               \
00705 inline                                                                        \
00706 sc_ufix::sc_ufix( tp a,                                                       \
00707           int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,              \
00708           sc_fxnum_observer* observer_ )                              \
00709 : sc_fxnum( a,                                                                \
00710         sc_fxtype_params( wl_, iwl_, qm, om ),                            \
00711         SC_US_,                                                           \
00712         sc_fxcast_switch(),                                               \
00713         observer_ )                                                       \
00714 {}                                                                            \
00715                                                                               \
00716 inline                                                                        \
00717 sc_ufix::sc_ufix( tp a,                                                       \
00718           int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb,      \
00719           sc_fxnum_observer* observer_ )                              \
00720 : sc_fxnum( a,                                                                \
00721         sc_fxtype_params( wl_, iwl_, qm, om, nb ),                        \
00722         SC_US_,                                                           \
00723         sc_fxcast_switch(),                                               \
00724         observer_ )                                                       \
00725 {}                                                                            \
00726                                                                               \
00727 inline                                                                        \
00728 sc_ufix::sc_ufix( tp a,                                                       \
00729           const sc_fxcast_switch& cast_sw,                            \
00730           sc_fxnum_observer* observer_ )                              \
00731 : sc_fxnum( a,                                                                \
00732         sc_fxtype_params(),                                               \
00733         SC_US_,                                                           \
00734         cast_sw,                                                          \
00735         observer_ )                                                       \
00736 {}                                                                            \
00737                                                                               \
00738 inline                                                                        \
00739 sc_ufix::sc_ufix( tp a,                                                       \
00740           int wl_, int iwl_,                                          \
00741           const sc_fxcast_switch& cast_sw,                            \
00742           sc_fxnum_observer* observer_ )                              \
00743 : sc_fxnum( a,                                                                \
00744         sc_fxtype_params( wl_, iwl_ ),                                    \
00745         SC_US_,                                                           \
00746         cast_sw,                                                          \
00747         observer_ )                                                       \
00748 {}                                                                            \
00749                                                                               \
00750 inline                                                                        \
00751 sc_ufix::sc_ufix( tp a,                                                       \
00752           sc_q_mode qm, sc_o_mode om,                                 \
00753           const sc_fxcast_switch& cast_sw,                            \
00754           sc_fxnum_observer* observer_ )                              \
00755 : sc_fxnum( a,                                                                \
00756         sc_fxtype_params( qm, om ),                                       \
00757         SC_US_,                                                           \
00758         cast_sw,                                                          \
00759         observer_ )                                                       \
00760 {}                                                                            \
00761                                                                               \
00762 inline                                                                        \
00763 sc_ufix::sc_ufix( tp a,                                                       \
00764           sc_q_mode qm, sc_o_mode om, int nb,                         \
00765           const sc_fxcast_switch& cast_sw,                            \
00766           sc_fxnum_observer* observer_ )                              \
00767 : sc_fxnum( a,                                                                \
00768         sc_fxtype_params( qm, om, nb ),                                   \
00769         SC_US_,                                                           \
00770         cast_sw,                                                          \
00771         observer_ )                                                       \
00772 {}                                                                            \
00773                                                                               \
00774 inline                                                                        \
00775 sc_ufix::sc_ufix( tp a,                                                       \
00776           int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,              \
00777           const sc_fxcast_switch& cast_sw,                            \
00778           sc_fxnum_observer* observer_ )                              \
00779 : sc_fxnum( a,                                                                \
00780         sc_fxtype_params( wl_, iwl_, qm, om ),                            \
00781         SC_US_,                                                           \
00782         cast_sw,                                                          \
00783         observer_ )                                                       \
00784 {}                                                                            \
00785                                                                               \
00786 inline                                                                        \
00787 sc_ufix::sc_ufix( tp a,                                                       \
00788           int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb,      \
00789           const sc_fxcast_switch& cast_sw,                            \
00790           sc_fxnum_observer* observer_ )                              \
00791 : sc_fxnum( a,                                                                \
00792         sc_fxtype_params( wl_, iwl_, qm, om, nb ),                        \
00793         SC_US_,                                                           \
00794         cast_sw,                                                          \
00795         observer_ )                                                       \
00796 {}                                                                            \
00797                                                                               \
00798 inline                                                                        \
00799 sc_ufix::sc_ufix( tp a,                                                       \
00800           const sc_fxtype_params& type_params,                        \
00801           sc_fxnum_observer* observer_ )                              \
00802 : sc_fxnum( a,                                                                \
00803         type_params,                                                      \
00804         SC_US_,                                                           \
00805         sc_fxcast_switch(),                                               \
00806         observer_ )                                                       \
00807 {}                                                                            \
00808                                                                               \
00809 inline                                                                        \
00810 sc_ufix::sc_ufix( tp a,                                                       \
00811           const sc_fxtype_params& type_params,                        \
00812           const sc_fxcast_switch& cast_sw,                            \
00813           sc_fxnum_observer* observer_ )                              \
00814 : sc_fxnum( a,                                                                \
00815         type_params,                                                      \
00816         SC_US_,                                                           \
00817         cast_sw,                                                          \
00818         observer_ )                                                       \
00819 {}
00820 
00821 #define DEFN_CTORS_T_B(tp)                                                    \
00822 inline                                                                        \
00823 sc_ufix::sc_ufix( tp a,                                                       \
00824           sc_fxnum_observer* observer_ )                              \
00825 : sc_fxnum( a,                                                                \
00826         a.type_params(),                                                  \
00827         SC_US_,                                                           \
00828         sc_fxcast_switch(),                                               \
00829         observer_ )                                                       \
00830 {}                                                                            \
00831                                                                               \
00832 inline                                                                        \
00833 sc_ufix::sc_ufix( tp a,                                                       \
00834           int wl_, int iwl_,                                          \
00835           sc_fxnum_observer* observer_ )                              \
00836 : sc_fxnum( a,                                                                \
00837         sc_fxtype_params( a.type_params(), wl_, iwl_ ),                   \
00838         SC_US_,                                                           \
00839         sc_fxcast_switch(),                                               \
00840         observer_ )                                                       \
00841 {}                                                                            \
00842                                                                               \
00843 inline                                                                        \
00844 sc_ufix::sc_ufix( tp a,                                                       \
00845           sc_q_mode qm, sc_o_mode om,                                 \
00846           sc_fxnum_observer* observer_ )                              \
00847 : sc_fxnum( a,                                                                \
00848         sc_fxtype_params( a.type_params(), qm, om ),                      \
00849         SC_US_,                                                           \
00850         sc_fxcast_switch(),                                               \
00851         observer_ )                                                       \
00852 {}                                                                            \
00853                                                                               \
00854 inline                                                                        \
00855 sc_ufix::sc_ufix( tp a,                                                       \
00856           sc_q_mode qm, sc_o_mode om, int nb,                         \
00857           sc_fxnum_observer* observer_ )                              \
00858 : sc_fxnum( a,                                                                \
00859         sc_fxtype_params( a.type_params(), qm, om, nb ),                  \
00860         SC_US_,                                                           \
00861         sc_fxcast_switch(),                                               \
00862         observer_ )                                                       \
00863 {}                                                                            \
00864                                                                               \
00865 inline                                                                        \
00866 sc_ufix::sc_ufix( tp a,                                                       \
00867           int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,              \
00868           sc_fxnum_observer* observer_ )                              \
00869 : sc_fxnum( a,                                                                \
00870         sc_fxtype_params( wl_, iwl_, qm, om ),                            \
00871         SC_US_,                                                           \
00872         sc_fxcast_switch(),                                               \
00873         observer_ )                                                       \
00874 {}                                                                            \
00875                                                                               \
00876 inline                                                                        \
00877 sc_ufix::sc_ufix( tp a,                                                       \
00878           int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb,      \
00879           sc_fxnum_observer* observer_ )                              \
00880 : sc_fxnum( a,                                                                \
00881         sc_fxtype_params( wl_, iwl_, qm, om, nb ),                        \
00882         SC_US_,                                                           \
00883         sc_fxcast_switch(),                                               \
00884         observer_ )                                                       \
00885 {}                                                                            \
00886                                                                               \
00887 inline                                                                        \
00888 sc_ufix::sc_ufix( tp a,                                                       \
00889           const sc_fxcast_switch& cast_sw,                            \
00890           sc_fxnum_observer* observer_ )                              \
00891 : sc_fxnum( a,                                                                \
00892         a.type_params(),                                                  \
00893         SC_US_,                                                           \
00894         cast_sw,                                                          \
00895         observer_ )                                                       \
00896 {}                                                                            \
00897                                                                               \
00898 inline                                                                        \
00899 sc_ufix::sc_ufix( tp a,                                                       \
00900           int wl_, int iwl_,                                          \
00901           const sc_fxcast_switch& cast_sw,                            \
00902           sc_fxnum_observer* observer_ )                              \
00903 : sc_fxnum( a,                                                                \
00904         sc_fxtype_params( a.type_params(), wl_, iwl_ ),                   \
00905         SC_US_,                                                           \
00906         cast_sw,                                                          \
00907         observer_ )                                                       \
00908 {}                                                                            \
00909                                                                               \
00910 inline                                                                        \
00911 sc_ufix::sc_ufix( tp a,                                                       \
00912           sc_q_mode qm, sc_o_mode om,                                 \
00913           const sc_fxcast_switch& cast_sw,                            \
00914           sc_fxnum_observer* observer_ )                              \
00915 : sc_fxnum( a,                                                                \
00916         sc_fxtype_params( a.type_params(), qm, om ),                      \
00917         SC_US_,                                                           \
00918         cast_sw,                                                          \
00919         observer_ )                                                       \
00920 {}                                                                            \
00921                                                                               \
00922 inline                                                                        \
00923 sc_ufix::sc_ufix( tp a,                                                       \
00924           sc_q_mode qm, sc_o_mode om, int nb,                         \
00925           const sc_fxcast_switch& cast_sw,                            \
00926           sc_fxnum_observer* observer_ )                              \
00927 : sc_fxnum( a,                                                                \
00928         sc_fxtype_params( a.type_params(), qm, om, nb ),                  \
00929         SC_US_,                                                           \
00930         cast_sw,                                                          \
00931         observer_ )                                                       \
00932 {}                                                                            \
00933                                                                               \
00934 inline                                                                        \
00935 sc_ufix::sc_ufix( tp a,                                                       \
00936           int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,              \
00937           const sc_fxcast_switch& cast_sw,                            \
00938           sc_fxnum_observer* observer_ )                              \
00939 : sc_fxnum( a,                                                                \
00940         sc_fxtype_params( wl_, iwl_, qm, om ),                            \
00941         SC_US_,                                                           \
00942         cast_sw,                                                          \
00943         observer_ )                                                       \
00944 {}                                                                            \
00945                                                                               \
00946 inline                                                                        \
00947 sc_ufix::sc_ufix( tp a,                                                       \
00948           int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb,      \
00949           const sc_fxcast_switch& cast_sw,                            \
00950           sc_fxnum_observer* observer_ )                              \
00951 : sc_fxnum( a,                                                                \
00952         sc_fxtype_params( wl_, iwl_, qm, om, nb ),                        \
00953         SC_US_,                                                           \
00954         cast_sw,                                                          \
00955         observer_ )                                                       \
00956 {}                                                                            \
00957                                                                               \
00958 inline                                                                        \
00959 sc_ufix::sc_ufix( tp a,                                                       \
00960           const sc_fxtype_params& type_params,                        \
00961           sc_fxnum_observer* observer_ )                              \
00962 : sc_fxnum( a,                                                                \
00963         type_params,                                                      \
00964         SC_US_,                                                           \
00965         sc_fxcast_switch(),                                               \
00966         observer_ )                                                       \
00967 {}                                                                            \
00968                                                                               \
00969 inline                                                                        \
00970 sc_ufix::sc_ufix( tp a,                                                       \
00971           const sc_fxtype_params& type_params,                        \
00972           const sc_fxcast_switch& cast_sw,                            \
00973           sc_fxnum_observer* observer_ )                              \
00974 : sc_fxnum( a,                                                                \
00975         type_params,                                                      \
00976         SC_US_,                                                           \
00977         cast_sw,                                                          \
00978         observer_ )                                                       \
00979 {}
00980 
00981 DEFN_CTORS_T_A(int)
00982 DEFN_CTORS_T_A(unsigned int)
00983 DEFN_CTORS_T_A(long)
00984 DEFN_CTORS_T_A(unsigned long)
00985 DEFN_CTORS_T_A(double)
00986 DEFN_CTORS_T_A(const char*)
00987 DEFN_CTORS_T_A(const sc_fxval&)
00988 DEFN_CTORS_T_A(const sc_fxval_fast&)
00989 DEFN_CTORS_T_B(const sc_fxnum&)
00990 DEFN_CTORS_T_B(const sc_fxnum_fast&)
00991 #ifndef SC_FX_EXCLUDE_OTHER
00992 DEFN_CTORS_T_A(int64)
00993 DEFN_CTORS_T_A(uint64)
00994 DEFN_CTORS_T_A(const sc_int_base&)
00995 DEFN_CTORS_T_A(const sc_uint_base&)
00996 DEFN_CTORS_T_A(const sc_signed&)
00997 DEFN_CTORS_T_A(const sc_unsigned&)
00998 #endif
00999 
01000 #undef DEFN_CTORS_T_A
01001 #undef DEFN_CTORS_T_B
01002 
01003 // copy constructor
01004 
01005 inline
01006 sc_ufix::sc_ufix( const sc_ufix& a )
01007 : sc_fxnum( a,
01008         a.type_params(),
01009         SC_US_,
01010         sc_fxcast_switch(),
01011         0 )
01012 {}
01013 
01014 
01015 // unary bitwise operators
01016 
01017 inline
01018 const sc_ufix
01019 sc_ufix::operator ~ () const
01020 {
01021     SC_FXNUM_OBSERVER_READ_( *this )
01022     int iwl_c = iwl();
01023     int wl_c = wl();
01024     sc_ufix c( wl_c, iwl_c );
01025     for( int i = iwl_c - wl_c; i < iwl_c; ++ i )
01026     c.set_bit( i, ! get_bit( i ) );
01027     return sc_ufix( c, wl_c, iwl_c );
01028 }
01029 
01030 
01031 // unary bitwise functions
01032 
01033 inline
01034 void
01035 b_not( sc_ufix& c, const sc_ufix& a )
01036 {
01037     SC_FXNUM_OBSERVER_READ_( a )
01038     int iwl_c = c.iwl();
01039     for( int i = iwl_c - c.wl(); i < iwl_c; ++ i )
01040     c.set_bit( i, ! a.get_bit( i ) );
01041     c.cast();
01042     SC_FXNUM_OBSERVER_WRITE_( c )
01043 }
01044 
01045 
01046 // binary bitwise operators
01047 
01048 #define DEFN_BIN_OP_T(op,op2,tp1,tp2)                                         \
01049 inline                                                                        \
01050 const sc_ufix                                                                 \
01051 operator op ( const tp1& a, const tp2& b )                                    \
01052 {                                                                             \
01053     a.observer_read();                                                        \
01054     b.observer_read();                                                        \
01055     int iwl_a = a.iwl();                                                      \
01056     int iwl_b = b.iwl();                                                      \
01057     int iwl_c = sc_max( iwl_a, iwl_b );                                       \
01058     int fwl_c = sc_max( a.wl() - iwl_a, b.wl() - iwl_b );                     \
01059     sc_ufix c( iwl_c + fwl_c, iwl_c );                                        \
01060     for( int i = -fwl_c; i < iwl_c; ++ i )                                    \
01061     c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) );                    \
01062     return sc_ufix( c, iwl_c + fwl_c, iwl_c );                                \
01063 }
01064 
01065 DEFN_BIN_OP_T(&,&&,sc_ufix,sc_ufix)
01066 DEFN_BIN_OP_T(&,&&,sc_ufix,sc_ufix_fast)
01067 DEFN_BIN_OP_T(&,&&,sc_ufix_fast,sc_ufix)
01068 
01069 DEFN_BIN_OP_T(|,||,sc_ufix,sc_ufix)
01070 DEFN_BIN_OP_T(|,||,sc_ufix,sc_ufix_fast)
01071 DEFN_BIN_OP_T(|,||,sc_ufix_fast,sc_ufix)
01072 
01073 DEFN_BIN_OP_T(^,!=,sc_ufix,sc_ufix)
01074 DEFN_BIN_OP_T(^,!=,sc_ufix,sc_ufix_fast)
01075 DEFN_BIN_OP_T(^,!=,sc_ufix_fast,sc_ufix)
01076 
01077 #undef DEFN_BIN_OP_T
01078 
01079 
01080 // binary bitwise functions
01081 
01082 #define DEFN_BIN_FNC_T(fnc,op2,tp1,tp2)                                       \
01083 inline                                                                        \
01084 void                                                                          \
01085 fnc ( sc_ufix& c, const tp1& a, const tp2& b )                                \
01086 {                                                                             \
01087     a.observer_read();                                                        \
01088     b.observer_read();                                                        \
01089     int iwl_c = c.iwl();                                                      \
01090     for( int i = iwl_c - c.wl(); i < iwl_c; ++ i )                            \
01091     c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) );                    \
01092     c.cast();                                                                 \
01093     SC_FXNUM_OBSERVER_WRITE_( c )                                             \
01094 }
01095 
01096 DEFN_BIN_FNC_T(b_and,&&,sc_ufix,sc_ufix)
01097 DEFN_BIN_FNC_T(b_and,&&,sc_ufix,sc_ufix_fast)
01098 DEFN_BIN_FNC_T(b_and,&&,sc_ufix_fast,sc_ufix)
01099 
01100 DEFN_BIN_FNC_T(b_or,||,sc_ufix,sc_ufix)
01101 DEFN_BIN_FNC_T(b_or,||,sc_ufix,sc_ufix_fast)
01102 DEFN_BIN_FNC_T(b_or,||,sc_ufix_fast,sc_ufix)
01103 
01104 DEFN_BIN_FNC_T(b_xor,!=,sc_ufix,sc_ufix)
01105 DEFN_BIN_FNC_T(b_xor,!=,sc_ufix,sc_ufix_fast)
01106 DEFN_BIN_FNC_T(b_xor,!=,sc_ufix_fast,sc_ufix)
01107 
01108 #undef DEFN_BIN_FNC_T
01109 
01110 
01111 // assignment operators
01112 
01113 inline
01114 sc_ufix&
01115 sc_ufix::operator = ( const sc_ufix& a )
01116 {
01117     sc_fxnum::operator = ( a );
01118     return *this;
01119 }
01120 
01121 #define DEFN_ASN_OP_T(op,tp)                                                  \
01122 inline                                                                        \
01123 sc_ufix&                                                                      \
01124 sc_ufix::operator op ( tp a )                                                 \
01125 {                                                                             \
01126     sc_fxnum::operator op( a );                                               \
01127     return *this;                                                             \
01128 }
01129 
01130 #ifndef SC_FX_EXCLUDE_OTHER
01131 #define DEFN_ASN_OP_OTHER(op)                                                 \
01132 DEFN_ASN_OP_T(op,int64)                                                       \
01133 DEFN_ASN_OP_T(op,uint64)                                                      \
01134 DEFN_ASN_OP_T(op,const sc_int_base&)                                          \
01135 DEFN_ASN_OP_T(op,const sc_uint_base&)                                         \
01136 DEFN_ASN_OP_T(op,const sc_signed&)                                            \
01137 DEFN_ASN_OP_T(op,const sc_unsigned&)
01138 #else
01139 #define DEFN_ASN_OP_OTHER(op)
01140 #endif
01141 
01142 #define DEFN_ASN_OP(op)                                                       \
01143 DEFN_ASN_OP_T(op,int)                                                         \
01144 DEFN_ASN_OP_T(op,unsigned int)                                                \
01145 DEFN_ASN_OP_T(op,long)                                                        \
01146 DEFN_ASN_OP_T(op,unsigned long)                                               \
01147 DEFN_ASN_OP_T(op,double)                                                      \
01148 DEFN_ASN_OP_T(op,const char*)                                                 \
01149 DEFN_ASN_OP_T(op,const sc_fxval&)                                             \
01150 DEFN_ASN_OP_T(op,const sc_fxval_fast&)                                        \
01151 DEFN_ASN_OP_T(op,const sc_fxnum&)                                             \
01152 DEFN_ASN_OP_T(op,const sc_fxnum_fast&)                                        \
01153 DEFN_ASN_OP_OTHER(op)
01154 
01155 DEFN_ASN_OP(=)
01156 
01157 DEFN_ASN_OP(*=)
01158 DEFN_ASN_OP(/=)
01159 DEFN_ASN_OP(+=)
01160 DEFN_ASN_OP(-=)
01161 
01162 DEFN_ASN_OP_T(<<=,int)
01163 DEFN_ASN_OP_T(>>=,int)
01164 
01165 #undef DEFN_ASN_OP_T
01166 #undef DEFN_ASN_OP_OTHER
01167 #undef DEFN_ASN_OP
01168 
01169 
01170 #define DEFN_ASN_OP_T(op,op2,tp)                                              \
01171 inline                                                                        \
01172 sc_ufix&                                                                      \
01173 sc_ufix::operator op ( const tp& b )                                          \
01174 {                                                                             \
01175     SC_FXNUM_OBSERVER_READ_( *this )                                          \
01176     b.observer_read();                                                        \
01177     int iwl_c = iwl();                                                        \
01178     for( int i = iwl_c - wl(); i < iwl_c; ++ i )                              \
01179     set_bit( i, get_bit( i ) op2 b.get_bit( i ) );                        \
01180     cast();                                                                   \
01181     SC_FXNUM_OBSERVER_WRITE_( *this )                                         \
01182     return *this;                                                             \
01183 }
01184 
01185 DEFN_ASN_OP_T(&=,&&,sc_ufix)
01186 DEFN_ASN_OP_T(&=,&&,sc_ufix_fast)
01187 DEFN_ASN_OP_T(|=,||,sc_ufix)
01188 DEFN_ASN_OP_T(|=,||,sc_ufix_fast)
01189 DEFN_ASN_OP_T(^=,!=,sc_ufix)
01190 DEFN_ASN_OP_T(^=,!=,sc_ufix_fast)
01191 
01192 #undef DEFN_ASN_OP_T
01193 
01194 
01195 // auto-increment and auto-decrement
01196 
01197 inline
01198 const sc_fxval
01199 sc_ufix::operator ++ ( int )
01200 {
01201     return sc_fxval( sc_fxnum::operator ++ ( 0 ) );
01202 }
01203 
01204 inline
01205 const sc_fxval
01206 sc_ufix::operator -- ( int )
01207 {
01208     return sc_fxval( sc_fxnum::operator -- ( 0 ) );
01209 }
01210 
01211 inline
01212 sc_ufix&
01213 sc_ufix::operator ++ ()
01214 {
01215     sc_fxnum::operator ++ ();
01216     return *this;
01217 }
01218 
01219 inline
01220 sc_ufix&
01221 sc_ufix::operator -- ()
01222 {
01223     sc_fxnum::operator -- ();
01224     return *this;
01225 }
01226 
01227 
01228 // ----------------------------------------------------------------------------
01229 //  CLASS : sc_ufix_fast
01230 //
01231 //  "Unconstrained" unsigned fixed-point class; limited precision.
01232 // ----------------------------------------------------------------------------
01233 
01234 // constructors
01235 
01236 inline
01237 sc_ufix_fast::sc_ufix_fast( sc_fxnum_fast_observer* observer_ )
01238 : sc_fxnum_fast( sc_fxtype_params(),
01239          SC_US_,
01240          sc_fxcast_switch(),
01241          observer_ )
01242 {}
01243 
01244 inline
01245 sc_ufix_fast::sc_ufix_fast( int wl_, int iwl_,
01246                 sc_fxnum_fast_observer* observer_ )
01247 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_ ),
01248          SC_US_,
01249          sc_fxcast_switch(),
01250          observer_ )
01251 {}
01252 
01253 inline
01254 sc_ufix_fast::sc_ufix_fast( sc_q_mode qm, sc_o_mode om,
01255                 sc_fxnum_fast_observer* observer_ )
01256 : sc_fxnum_fast( sc_fxtype_params( qm, om ),
01257          SC_US_,
01258          sc_fxcast_switch(),
01259          observer_ )
01260 {}
01261 
01262 inline
01263 sc_ufix_fast::sc_ufix_fast( sc_q_mode qm, sc_o_mode om, int nb,
01264                 sc_fxnum_fast_observer* observer_ )
01265 : sc_fxnum_fast( sc_fxtype_params( qm, om, nb ),
01266          SC_US_,
01267          sc_fxcast_switch(),
01268          observer_ )
01269 {}
01270 
01271 inline
01272 sc_ufix_fast::sc_ufix_fast( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,
01273                 sc_fxnum_fast_observer* observer_ )
01274 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_, qm, om ),
01275          SC_US_,
01276          sc_fxcast_switch(),
01277          observer_ )
01278 {}
01279 
01280 inline
01281 sc_ufix_fast::sc_ufix_fast( int wl_, int iwl_,
01282                 sc_q_mode qm, sc_o_mode om, int nb,
01283                 sc_fxnum_fast_observer* observer_ )
01284 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_, qm, om, nb ),
01285          SC_US_,
01286          sc_fxcast_switch(),
01287          observer_ )
01288 {}
01289 
01290 inline
01291 sc_ufix_fast::sc_ufix_fast( const sc_fxcast_switch& cast_sw,
01292                 sc_fxnum_fast_observer* observer_ )
01293 : sc_fxnum_fast( sc_fxtype_params(),
01294          SC_US_,
01295          cast_sw,
01296          observer_ )
01297 {}
01298 
01299 inline
01300 sc_ufix_fast::sc_ufix_fast( int wl_, int iwl_,
01301                 const sc_fxcast_switch& cast_sw,
01302                 sc_fxnum_fast_observer* observer_ )
01303 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_ ),
01304          SC_US_,
01305          cast_sw,
01306          observer_ )
01307 {}
01308 
01309 inline
01310 sc_ufix_fast::sc_ufix_fast( sc_q_mode qm, sc_o_mode om,
01311                 const sc_fxcast_switch& cast_sw,
01312                 sc_fxnum_fast_observer* observer_ )
01313 : sc_fxnum_fast( sc_fxtype_params( qm, om ),
01314          SC_US_,
01315          cast_sw,
01316          observer_ )
01317 {}
01318 
01319 inline
01320 sc_ufix_fast::sc_ufix_fast( sc_q_mode qm, sc_o_mode om, int nb,
01321                 const sc_fxcast_switch& cast_sw,
01322                 sc_fxnum_fast_observer* observer_ )
01323 : sc_fxnum_fast( sc_fxtype_params( qm, om, nb ),
01324          SC_US_,
01325          cast_sw,
01326          observer_ )
01327 {}
01328 
01329 inline
01330 sc_ufix_fast::sc_ufix_fast( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,
01331                 const sc_fxcast_switch& cast_sw,
01332                 sc_fxnum_fast_observer* observer_ )
01333 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_, qm, om ),
01334          SC_US_,
01335          cast_sw,
01336          observer_ )
01337 {}
01338 
01339 inline
01340 sc_ufix_fast::sc_ufix_fast( int wl_, int iwl_,
01341                 sc_q_mode qm, sc_o_mode om, int nb,
01342                 const sc_fxcast_switch& cast_sw,
01343                 sc_fxnum_fast_observer* observer_ )
01344 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_, qm, om, nb ),
01345          SC_US_,
01346          cast_sw,
01347          observer_ )
01348 {}
01349 
01350 inline
01351 sc_ufix_fast::sc_ufix_fast( const sc_fxtype_params& type_params,
01352                 sc_fxnum_fast_observer* observer_ )
01353 : sc_fxnum_fast( type_params,
01354          SC_US_,
01355          sc_fxcast_switch(),
01356          observer_ )
01357 {}
01358 
01359 inline
01360 sc_ufix_fast::sc_ufix_fast( const sc_fxtype_params& type_params,
01361                 const sc_fxcast_switch& cast_sw,
01362                 sc_fxnum_fast_observer* observer_ )
01363 : sc_fxnum_fast( type_params,
01364          SC_US_,
01365          cast_sw,
01366          observer_ )
01367 {}
01368 
01369 #define DEFN_CTORS_T_A(tp)                                                    \
01370 inline                                                                        \
01371 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01372                 sc_fxnum_fast_observer* observer_ )               \
01373 : sc_fxnum_fast( a,                                                           \
01374          sc_fxtype_params(),                                          \
01375          SC_US_,                                                      \
01376          sc_fxcast_switch(),                                          \
01377          observer_ )                                                  \
01378 {}                                                                            \
01379                                                                               \
01380 inline                                                                        \
01381 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01382                 int wl_, int iwl_,                                \
01383                 sc_fxnum_fast_observer* observer_ )               \
01384 : sc_fxnum_fast( a,                                                           \
01385          sc_fxtype_params( wl_, iwl_ ),                               \
01386          SC_US_,                                                      \
01387          sc_fxcast_switch(),                                          \
01388          observer_ )                                                  \
01389 {}                                                                            \
01390                                                                               \
01391 inline                                                                        \
01392 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01393                 sc_q_mode qm, sc_o_mode om,                       \
01394                 sc_fxnum_fast_observer* observer_ )               \
01395 : sc_fxnum_fast( a,                                                           \
01396          sc_fxtype_params( qm, om ),                                  \
01397          SC_US_,                                                      \
01398          sc_fxcast_switch(),                                          \
01399          observer_ )                                                  \
01400 {}                                                                            \
01401                                                                               \
01402 inline                                                                        \
01403 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01404                 sc_q_mode qm, sc_o_mode om, int nb,               \
01405                 sc_fxnum_fast_observer* observer_ )               \
01406 : sc_fxnum_fast( a,                                                           \
01407          sc_fxtype_params( qm, om, nb ),                              \
01408          SC_US_,                                                      \
01409          sc_fxcast_switch(),                                          \
01410          observer_ )                                                  \
01411 {}                                                                            \
01412                                                                               \
01413 inline                                                                        \
01414 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01415                 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,    \
01416                 sc_fxnum_fast_observer* observer_ )               \
01417 : sc_fxnum_fast( a,                                                           \
01418          sc_fxtype_params( wl_, iwl_, qm, om ),                       \
01419          SC_US_,                                                      \
01420          sc_fxcast_switch(),                                          \
01421          observer_ )                                                  \
01422 {}                                                                            \
01423                                                                               \
01424 inline                                                                        \
01425 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01426                 int wl_, int iwl_,                                \
01427                 sc_q_mode qm, sc_o_mode om, int nb,               \
01428                 sc_fxnum_fast_observer* observer_ )               \
01429 : sc_fxnum_fast( a,                                                           \
01430          sc_fxtype_params( wl_, iwl_, qm, om, nb ),                   \
01431          SC_US_,                                                      \
01432          sc_fxcast_switch(),                                          \
01433          observer_ )                                                  \
01434 {}                                                                            \
01435                                                                               \
01436 inline                                                                        \
01437 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01438                 const sc_fxcast_switch& cast_sw,                  \
01439                 sc_fxnum_fast_observer* observer_ )               \
01440 : sc_fxnum_fast( a,                                                           \
01441          sc_fxtype_params(),                                          \
01442          SC_US_,                                                      \
01443          cast_sw,                                                     \
01444          observer_ )                                                  \
01445 {}                                                                            \
01446                                                                               \
01447 inline                                                                        \
01448 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01449                 int wl_, int iwl_,                                \
01450                 const sc_fxcast_switch& cast_sw,                  \
01451                 sc_fxnum_fast_observer* observer_ )               \
01452 : sc_fxnum_fast( a,                                                           \
01453          sc_fxtype_params( wl_, iwl_ ),                               \
01454          SC_US_,                                                      \
01455          cast_sw,                                                     \
01456          observer_ )                                                  \
01457 {}                                                                            \
01458                                                                               \
01459 inline                                                                        \
01460 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01461                 sc_q_mode qm, sc_o_mode om,                       \
01462                 const sc_fxcast_switch& cast_sw,                  \
01463                 sc_fxnum_fast_observer* observer_ )               \
01464 : sc_fxnum_fast( a,                                                           \
01465          sc_fxtype_params( qm, om ),                                  \
01466          SC_US_,                                                      \
01467          cast_sw,                                                     \
01468          observer_ )                                                  \
01469 {}                                                                            \
01470                                                                               \
01471 inline                                                                        \
01472 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01473                 sc_q_mode qm, sc_o_mode om, int nb,               \
01474                 const sc_fxcast_switch& cast_sw,                  \
01475                 sc_fxnum_fast_observer* observer_ )               \
01476 : sc_fxnum_fast( a,                                                           \
01477          sc_fxtype_params( qm, om, nb ),                              \
01478          SC_US_,                                                      \
01479          cast_sw,                                                     \
01480          observer_ )                                                  \
01481 {}                                                                            \
01482                                                                               \
01483 inline                                                                        \
01484 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01485                 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,    \
01486                 const sc_fxcast_switch& cast_sw,                  \
01487                 sc_fxnum_fast_observer* observer_ )               \
01488 : sc_fxnum_fast( a,                                                           \
01489          sc_fxtype_params( wl_, iwl_, qm, om ),                       \
01490          SC_US_,                                                      \
01491          cast_sw,                                                     \
01492          observer_ )                                                  \
01493 {}                                                                            \
01494                                                                               \
01495 inline                                                                        \
01496 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01497                 int wl_, int iwl_,                                \
01498                 sc_q_mode qm, sc_o_mode om, int nb,               \
01499                 const sc_fxcast_switch& cast_sw,                  \
01500                 sc_fxnum_fast_observer* observer_ )               \
01501 : sc_fxnum_fast( a,                                                           \
01502          sc_fxtype_params( wl_, iwl_, qm, om, nb ),                   \
01503          SC_US_,                                                      \
01504          cast_sw,                                                     \
01505          observer_ )                                                  \
01506 {}                                                                            \
01507                                                                               \
01508 inline                                                                        \
01509 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01510                 const sc_fxtype_params& type_params,              \
01511                 sc_fxnum_fast_observer* observer_ )               \
01512 : sc_fxnum_fast( a,                                                           \
01513          type_params,                                                 \
01514          SC_US_,                                                      \
01515          sc_fxcast_switch(),                                          \
01516          observer_ )                                                  \
01517 {}                                                                            \
01518                                                                               \
01519 inline                                                                        \
01520 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01521                 const sc_fxtype_params& type_params,              \
01522                 const sc_fxcast_switch& cast_sw,                  \
01523                 sc_fxnum_fast_observer* observer_ )               \
01524 : sc_fxnum_fast( a,                                                           \
01525          type_params,                                                 \
01526          SC_US_,                                                      \
01527          cast_sw,                                                     \
01528          observer_ )                                                  \
01529 {}
01530 
01531 #define DEFN_CTORS_T_B(tp)                                                    \
01532 inline                                                                        \
01533 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01534                 sc_fxnum_fast_observer* observer_ )               \
01535 : sc_fxnum_fast( a,                                                           \
01536          a.type_params(),                                             \
01537          SC_US_,                                                      \
01538          sc_fxcast_switch(),                                          \
01539          observer_ )                                                  \
01540 {}                                                                            \
01541                                                                               \
01542 inline                                                                        \
01543 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01544                 int wl_, int iwl_,                                \
01545                 sc_fxnum_fast_observer* observer_ )               \
01546 : sc_fxnum_fast( a,                                                           \
01547          sc_fxtype_params( a.type_params(), wl_, iwl_ ),              \
01548          SC_US_,                                                      \
01549          sc_fxcast_switch(),                                          \
01550          observer_ )                                                  \
01551 {}                                                                            \
01552                                                                               \
01553 inline                                                                        \
01554 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01555                 sc_q_mode qm, sc_o_mode om,                       \
01556                 sc_fxnum_fast_observer* observer_ )               \
01557 : sc_fxnum_fast( a,                                                           \
01558          sc_fxtype_params( a.type_params(), qm, om ),                 \
01559          SC_US_,                                                      \
01560          sc_fxcast_switch(),                                          \
01561          observer_ )                                                  \
01562 {}                                                                            \
01563                                                                               \
01564 inline                                                                        \
01565 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01566                 sc_q_mode qm, sc_o_mode om, int nb,               \
01567                 sc_fxnum_fast_observer* observer_ )               \
01568 : sc_fxnum_fast( a,                                                           \
01569          sc_fxtype_params( a.type_params(), qm, om, nb ),             \
01570          SC_US_,                                                      \
01571          sc_fxcast_switch(),                                          \
01572          observer_ )                                                  \
01573 {}                                                                            \
01574                                                                               \
01575 inline                                                                        \
01576 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01577                 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,    \
01578                 sc_fxnum_fast_observer* observer_ )               \
01579 : sc_fxnum_fast( a,                                                           \
01580          sc_fxtype_params( wl_, iwl_, qm, om ),                       \
01581          SC_US_,                                                      \
01582          sc_fxcast_switch(),                                          \
01583          observer_ )                                                  \
01584 {}                                                                            \
01585                                                                               \
01586 inline                                                                        \
01587 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01588                 int wl_, int iwl_,                                \
01589                 sc_q_mode qm, sc_o_mode om, int nb,               \
01590                 sc_fxnum_fast_observer* observer_ )               \
01591 : sc_fxnum_fast( a,                                                           \
01592          sc_fxtype_params( wl_, iwl_, qm, om, nb ),                   \
01593          SC_US_,                                                      \
01594          sc_fxcast_switch(),                                          \
01595          observer_ )                                                  \
01596 {}                                                                            \
01597                                                                               \
01598 inline                                                                        \
01599 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01600                 const sc_fxcast_switch& cast_sw,                  \
01601                 sc_fxnum_fast_observer* observer_ )               \
01602 : sc_fxnum_fast( a,                                                           \
01603          a.type_params(),                                             \
01604          SC_US_,                                                      \
01605          cast_sw,                                                     \
01606          observer_ )                                                  \
01607 {}                                                                            \
01608                                                                               \
01609 inline                                                                        \
01610 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01611                 int wl_, int iwl_,                                \
01612                 const sc_fxcast_switch& cast_sw,                  \
01613                 sc_fxnum_fast_observer* observer_ )               \
01614 : sc_fxnum_fast( a,                                                           \
01615          sc_fxtype_params( a.type_params(), wl_, iwl_ ),              \
01616          SC_US_,                                                      \
01617          cast_sw,                                                     \
01618          observer_ )                                                  \
01619 {}                                                                            \
01620                                                                               \
01621 inline                                                                        \
01622 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01623                 sc_q_mode qm, sc_o_mode om,                       \
01624                 const sc_fxcast_switch& cast_sw,                  \
01625                 sc_fxnum_fast_observer* observer_ )               \
01626 : sc_fxnum_fast( a,                                                           \
01627          sc_fxtype_params( a.type_params(), qm, om ),                 \
01628          SC_US_,                                                      \
01629          cast_sw,                                                     \
01630          observer_ )                                                  \
01631 {}                                                                            \
01632                                                                               \
01633 inline                                                                        \
01634 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01635                 sc_q_mode qm, sc_o_mode om, int nb,               \
01636                 const sc_fxcast_switch& cast_sw,                  \
01637                 sc_fxnum_fast_observer* observer_ )               \
01638 : sc_fxnum_fast( a,                                                           \
01639          sc_fxtype_params( a.type_params(), qm, om, nb ),             \
01640          SC_US_,                                                      \
01641          cast_sw,                                                     \
01642          observer_ )                                                  \
01643 {}                                                                            \
01644                                                                               \
01645 inline                                                                        \
01646 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01647                 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,    \
01648                 const sc_fxcast_switch& cast_sw,                  \
01649                 sc_fxnum_fast_observer* observer_ )               \
01650 : sc_fxnum_fast( a,                                                           \
01651          sc_fxtype_params( wl_, iwl_, qm, om ),                       \
01652          SC_US_,                                                      \
01653          cast_sw,                                                     \
01654          observer_ )                                                  \
01655 {}                                                                            \
01656                                                                               \
01657 inline                                                                        \
01658 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01659                 int wl_, int iwl_,                                \
01660                 sc_q_mode qm, sc_o_mode om, int nb,               \
01661                 const sc_fxcast_switch& cast_sw,                  \
01662                 sc_fxnum_fast_observer* observer_ )               \
01663 : sc_fxnum_fast( a,                                                           \
01664          sc_fxtype_params( wl_, iwl_, qm, om, nb ),                   \
01665          SC_US_,                                                      \
01666          cast_sw,                                                     \
01667          observer_ )                                                  \
01668 {}                                                                            \
01669                                                                               \
01670 inline                                                                        \
01671 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01672                 const sc_fxtype_params& type_params,              \
01673                 sc_fxnum_fast_observer* observer_ )               \
01674 : sc_fxnum_fast( a,                                                           \
01675          type_params,                                                 \
01676          SC_US_,                                                      \
01677          sc_fxcast_switch(),                                          \
01678          observer_ )                                                  \
01679 {}                                                                            \
01680                                                                               \
01681 inline                                                                        \
01682 sc_ufix_fast::sc_ufix_fast( tp a,                                             \
01683                 const sc_fxtype_params& type_params,              \
01684                 const sc_fxcast_switch& cast_sw,                  \
01685                 sc_fxnum_fast_observer* observer_ )               \
01686 : sc_fxnum_fast( a,                                                           \
01687          type_params,                                                 \
01688          SC_US_,                                                      \
01689          cast_sw,                                                     \
01690          observer_ )                                                  \
01691 {}
01692 
01693 DEFN_CTORS_T_A(int)
01694 DEFN_CTORS_T_A(unsigned int)
01695 DEFN_CTORS_T_A(long)
01696 DEFN_CTORS_T_A(unsigned long)
01697 DEFN_CTORS_T_A(double)
01698 DEFN_CTORS_T_A(const char*)
01699 DEFN_CTORS_T_A(const sc_fxval&)
01700 DEFN_CTORS_T_A(const sc_fxval_fast&)
01701 DEFN_CTORS_T_B(const sc_fxnum&)
01702 DEFN_CTORS_T_B(const sc_fxnum_fast&)
01703 #ifndef SC_FX_EXCLUDE_OTHER
01704 DEFN_CTORS_T_A(int64)
01705 DEFN_CTORS_T_A(uint64)
01706 DEFN_CTORS_T_A(const sc_int_base&)
01707 DEFN_CTORS_T_A(const sc_uint_base&)
01708 DEFN_CTORS_T_A(const sc_signed&)
01709 DEFN_CTORS_T_A(const sc_unsigned&)
01710 #endif
01711 
01712 #undef DEFN_CTORS_T_A
01713 #undef DEFN_CTORS_T_B
01714 
01715 // copy constructor
01716 
01717 inline
01718 sc_ufix_fast::sc_ufix_fast( const sc_ufix_fast& a )
01719 : sc_fxnum_fast( a,
01720          a.type_params(),
01721          SC_US_,
01722          sc_fxcast_switch(),
01723          0 )
01724 {}
01725 
01726 
01727 // unary bitwise operators
01728 
01729 inline
01730 const sc_ufix_fast
01731 sc_ufix_fast::operator ~ () const
01732 {
01733     SC_FXNUM_FAST_OBSERVER_READ_( *this )
01734     int iwl_c = iwl();
01735     int wl_c = wl();
01736     sc_ufix_fast c( wl_c, iwl_c );
01737     for( int i = iwl_c - wl_c; i < iwl_c; ++ i )
01738     c.set_bit( i, ! get_bit( i ) );
01739     return sc_ufix_fast( c, wl_c, iwl_c );
01740 }
01741 
01742 
01743 // unary bitwise functions
01744 
01745 inline
01746 void
01747 b_not( sc_ufix_fast& c, const sc_ufix_fast& a )
01748 {
01749     SC_FXNUM_FAST_OBSERVER_READ_( a )
01750     int iwl_c = c.iwl();
01751     for( int i = iwl_c - c.wl(); i < iwl_c; ++ i )
01752     c.set_bit( i, ! a.get_bit( i ) );
01753     c.cast();
01754     SC_FXNUM_FAST_OBSERVER_WRITE_( c )
01755 }
01756 
01757 
01758 // binary bitwise operators
01759 
01760 #define DEFN_BIN_OP_T(op,op2,tp1,tp2)                                         \
01761 inline                                                                        \
01762 const sc_ufix_fast                                                            \
01763 operator op ( const tp1& a, const tp2& b )                                    \
01764 {                                                                             \
01765     a.observer_read();                                                        \
01766     b.observer_read();                                                        \
01767     int iwl_a = a.iwl();                                                      \
01768     int iwl_b = b.iwl();                                                      \
01769     int iwl_c = sc_max( iwl_a, iwl_b );                                       \
01770     int fwl_c = sc_max( a.wl() - iwl_a, b.wl() - iwl_b );                     \
01771     sc_ufix_fast c( iwl_c + fwl_c, iwl_c );                                   \
01772     for( int i = -fwl_c; i < iwl_c; ++ i )                                    \
01773     c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) );                    \
01774     return sc_ufix_fast( c, iwl_c + fwl_c, iwl_c );                           \
01775 }
01776 
01777 DEFN_BIN_OP_T(&,&&,sc_ufix_fast,sc_ufix_fast)
01778 DEFN_BIN_OP_T(|,||,sc_ufix_fast,sc_ufix_fast)
01779 DEFN_BIN_OP_T(^,!=,sc_ufix_fast,sc_ufix_fast)
01780 
01781 #undef DEFN_BIN_OP_T
01782 
01783 
01784 // binary bitwise functions
01785 
01786 #define DEFN_BIN_FNC_T(fnc,op2,tp1,tp2)                                       \
01787 inline                                                                        \
01788 void                                                                          \
01789 fnc ( sc_ufix_fast& c, const tp1& a, const tp2& b )                           \
01790 {                                                                             \
01791     a.observer_read();                                                        \
01792     b.observer_read();                                                        \
01793     int iwl_c = c.iwl();                                                      \
01794     for( int i = iwl_c - c.wl(); i < iwl_c; ++ i )                            \
01795     c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) );                    \
01796     c.cast();                                                                 \
01797     SC_FXNUM_FAST_OBSERVER_WRITE_( c )                                        \
01798 }
01799 
01800 DEFN_BIN_FNC_T(b_and,&&,sc_ufix_fast,sc_ufix_fast)
01801 DEFN_BIN_FNC_T(b_or,||,sc_ufix_fast,sc_ufix_fast)
01802 DEFN_BIN_FNC_T(b_xor,!=,sc_ufix_fast,sc_ufix_fast)
01803 
01804 #undef DEFN_BIN_FNC_T
01805 
01806 
01807 // assignment operators
01808 
01809 inline
01810 sc_ufix_fast&
01811 sc_ufix_fast::operator = ( const sc_ufix_fast& a )
01812 {
01813     sc_fxnum_fast::operator = ( a );
01814     return *this;
01815 }
01816 
01817 #define DEFN_ASN_OP_T(op,tp)                                                  \
01818 inline                                                                        \
01819 sc_ufix_fast&                                                                 \
01820 sc_ufix_fast::operator op ( tp a )                                            \
01821 {                                                                             \
01822     sc_fxnum_fast::operator op( a );                                          \
01823     return *this;                                                             \
01824 }
01825 
01826 #ifndef SC_FX_EXCLUDE_OTHER
01827 #define DEFN_ASN_OP_OTHER(op)                                                 \
01828 DEFN_ASN_OP_T(op,int64)                                                       \
01829 DEFN_ASN_OP_T(op,uint64)                                                      \
01830 DEFN_ASN_OP_T(op,const sc_int_base&)                                          \
01831 DEFN_ASN_OP_T(op,const sc_uint_base&)                                         \
01832 DEFN_ASN_OP_T(op,const sc_signed&)                                            \
01833 DEFN_ASN_OP_T(op,const sc_unsigned&)
01834 #else
01835 #define DEFN_ASN_OP_OTHER(op)
01836 #endif
01837 
01838 #define DEFN_ASN_OP(op)                                                       \
01839 DEFN_ASN_OP_T(op,int)                                                         \
01840 DEFN_ASN_OP_T(op,unsigned int)                                                \
01841 DEFN_ASN_OP_T(op,long)                                                        \
01842 DEFN_ASN_OP_T(op,unsigned long)                                               \
01843 DEFN_ASN_OP_T(op,double)                                                      \
01844 DEFN_ASN_OP_T(op,const char*)                                                 \
01845 DEFN_ASN_OP_T(op,const sc_fxval&)                                             \
01846 DEFN_ASN_OP_T(op,const sc_fxval_fast&)                                        \
01847 DEFN_ASN_OP_T(op,const sc_fxnum&)                                             \
01848 DEFN_ASN_OP_T(op,const sc_fxnum_fast&)                                        \
01849 DEFN_ASN_OP_OTHER(op)
01850 
01851 DEFN_ASN_OP(=)
01852 
01853 DEFN_ASN_OP(*=)
01854 DEFN_ASN_OP(/=)
01855 DEFN_ASN_OP(+=)
01856 DEFN_ASN_OP(-=)
01857 
01858 DEFN_ASN_OP_T(<<=,int)
01859 DEFN_ASN_OP_T(>>=,int)
01860 
01861 #undef DEFN_ASN_OP_T
01862 #undef DEFN_ASN_OP_OTHER
01863 #undef DEFN_ASN_OP
01864 
01865 
01866 #define DEFN_ASN_OP_T(op,op2,tp)                                              \
01867 inline                                                                        \
01868 sc_ufix_fast&                                                                 \
01869 sc_ufix_fast::operator op ( const tp& b )                                     \
01870 {                                                                             \
01871     SC_FXNUM_FAST_OBSERVER_READ_( *this )                                     \
01872     b.observer_read();                                                        \
01873     int iwl_c = iwl();                                                        \
01874     for( int i = iwl_c - wl(); i < iwl_c; ++ i )                              \
01875     set_bit( i, get_bit( i ) op2 b.get_bit( i ) );                        \
01876     cast();                                                                   \
01877     SC_FXNUM_FAST_OBSERVER_WRITE_( *this )                                    \
01878     return *this;                                                             \
01879 }
01880 
01881 DEFN_ASN_OP_T(&=,&&,sc_ufix)
01882 DEFN_ASN_OP_T(&=,&&,sc_ufix_fast)
01883 DEFN_ASN_OP_T(|=,||,sc_ufix)
01884 DEFN_ASN_OP_T(|=,||,sc_ufix_fast)
01885 DEFN_ASN_OP_T(^=,!=,sc_ufix)
01886 DEFN_ASN_OP_T(^=,!=,sc_ufix_fast)
01887 
01888 #undef DEFN_ASN_OP_T
01889 
01890 
01891 // auto-increment and auto-decrement
01892 
01893 inline
01894 const sc_fxval_fast
01895 sc_ufix_fast::operator ++ ( int )
01896 {
01897     return sc_fxval_fast( sc_fxnum_fast::operator ++ ( 0 ) );
01898 }
01899 
01900 inline
01901 const sc_fxval_fast
01902 sc_ufix_fast::operator -- ( int )
01903 {
01904     return sc_fxval_fast( sc_fxnum_fast::operator -- ( 0 ) );
01905 }
01906 
01907 inline
01908 sc_ufix_fast&
01909 sc_ufix_fast::operator ++ ()
01910 {
01911     sc_fxnum_fast::operator ++ ();
01912     return *this;
01913 }
01914 
01915 inline
01916 sc_ufix_fast&
01917 sc_ufix_fast::operator -- ()
01918 {
01919     sc_fxnum_fast::operator -- ();
01920     return *this;
01921 }
01922 
01923 } // namespace sc_dt
01924 
01925 
01926 #endif
01927 
01928 // Taf!

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