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

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