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