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 #ifndef SC_FXVAL_H
00037 #define SC_FXVAL_H
00038
00039
00040 #include "systemc/datatypes/fx/scfx_rep.h"
00041 #ifndef SC_FX_EXCLUDE_OTHER
00042 #include "systemc/datatypes/int/sc_int_base.h"
00043 #include "systemc/datatypes/int/sc_uint_base.h"
00044 #include "systemc/datatypes/int/sc_signed.h"
00045 #include "systemc/datatypes/int/sc_unsigned.h"
00046 #endif
00047 #include "systemc/datatypes/fx/sc_fxval_observer.h"
00048
00049
00050 namespace sc_dt
00051 {
00052
00053
00054 class sc_fxval;
00055 class sc_fxval_fast;
00056
00057
00058 class sc_fxnum;
00059 class sc_fxnum_fast;
00060
00061
00062
00063
00064
00065
00066
00067
00068 class sc_fxval
00069 {
00070
00071 friend class sc_fxnum;
00072
00073 protected:
00074
00075 sc_fxval_observer* observer() const;
00076
00077 public:
00078
00079
00080 sc_fxval( scfx_rep* );
00081
00082
00083 explicit sc_fxval( sc_fxval_observer* = 0 );
00084 sc_fxval( int,
00085 sc_fxval_observer* = 0 );
00086 sc_fxval( unsigned int,
00087 sc_fxval_observer* = 0 );
00088 sc_fxval( long,
00089 sc_fxval_observer* = 0 );
00090 sc_fxval( unsigned long,
00091 sc_fxval_observer* = 0 );
00092 sc_fxval( double,
00093 sc_fxval_observer* = 0 );
00094 sc_fxval( const char*,
00095 sc_fxval_observer* = 0 );
00096 sc_fxval( const sc_fxval&,
00097 sc_fxval_observer* = 0 );
00098 sc_fxval( const sc_fxval_fast&,
00099 sc_fxval_observer* = 0 );
00100 sc_fxval( const sc_fxnum&,
00101 sc_fxval_observer* = 0 );
00102 sc_fxval( const sc_fxnum_fast&,
00103 sc_fxval_observer* = 0 );
00104 #ifndef SC_FX_EXCLUDE_OTHER
00105 explicit sc_fxval( int64,
00106 sc_fxval_observer* = 0 );
00107 explicit sc_fxval( uint64,
00108 sc_fxval_observer* = 0 );
00109 explicit sc_fxval( const sc_int_base&,
00110 sc_fxval_observer* = 0 );
00111 explicit sc_fxval( const sc_uint_base&,
00112 sc_fxval_observer* = 0 );
00113 explicit sc_fxval( const sc_signed&,
00114 sc_fxval_observer* = 0 );
00115 explicit sc_fxval( const sc_unsigned&,
00116 sc_fxval_observer* = 0 );
00117 #endif
00118
00119 ~sc_fxval();
00120
00121
00122
00123 const scfx_rep* get_rep() const;
00124 void set_rep( scfx_rep* );
00125
00126
00127
00128
00129 const sc_fxval operator - () const;
00130 const sc_fxval& operator + () const;
00131
00132
00133
00134
00135 friend void neg( sc_fxval&, const sc_fxval& );
00136
00137
00138
00139
00140 #define DECL_BIN_OP_T(op,tp) \
00141 friend const sc_fxval operator op ( const sc_fxval&, tp ); \
00142 friend const sc_fxval operator op ( tp, const sc_fxval& );
00143
00144 #ifndef SC_FX_EXCLUDE_OTHER
00145 #define DECL_BIN_OP_OTHER(op) \
00146 DECL_BIN_OP_T(op,int64) \
00147 DECL_BIN_OP_T(op,uint64) \
00148 DECL_BIN_OP_T(op,const sc_int_base&) \
00149 DECL_BIN_OP_T(op,const sc_uint_base&) \
00150 DECL_BIN_OP_T(op,const sc_signed&) \
00151 DECL_BIN_OP_T(op,const sc_unsigned&)
00152 #else
00153 #define DECL_BIN_OP_OTHER(op)
00154 #endif
00155
00156 #define DECL_BIN_OP(op,dummy) \
00157 friend const sc_fxval operator op ( const sc_fxval&, const sc_fxval& ); \
00158 DECL_BIN_OP_T(op,int) \
00159 DECL_BIN_OP_T(op,unsigned int) \
00160 DECL_BIN_OP_T(op,long) \
00161 DECL_BIN_OP_T(op,unsigned long) \
00162 DECL_BIN_OP_T(op,double) \
00163 DECL_BIN_OP_T(op,const char*) \
00164 DECL_BIN_OP_T(op,const sc_fxval_fast&) \
00165 DECL_BIN_OP_T(op,const sc_fxnum_fast&) \
00166 DECL_BIN_OP_OTHER(op)
00167
00168 DECL_BIN_OP(*,mult)
00169 DECL_BIN_OP(+,add)
00170 DECL_BIN_OP(-,sub)
00171
00172
00173
00174 friend const sc_fxval operator / ( const sc_fxval&, const sc_fxval& );
00175 DECL_BIN_OP_T(/,int)
00176 DECL_BIN_OP_T(/,unsigned int)
00177 DECL_BIN_OP_T(/,long)
00178 DECL_BIN_OP_T(/,unsigned long)
00179 DECL_BIN_OP_T(/,double)
00180 DECL_BIN_OP_T(/,const char*)
00181 DECL_BIN_OP_T(/,const sc_fxval_fast&)
00182 DECL_BIN_OP_T(/,const sc_fxnum_fast&)
00183
00184 #ifndef SC_FX_EXCLUDE_OTHER
00185 DECL_BIN_OP_T(/,int64) \
00186 DECL_BIN_OP_T(/,uint64) \
00187 DECL_BIN_OP_T(/,const sc_int_base&) \
00188 DECL_BIN_OP_T(/,const sc_uint_base&) \
00189 DECL_BIN_OP_T(/,const sc_signed&) \
00190 DECL_BIN_OP_T(/,const sc_unsigned&)
00191 #endif
00192
00193
00194 #undef DECL_BIN_OP_T
00195 #undef DECL_BIN_OP_OTHER
00196 #undef DECL_BIN_OP
00197
00198 friend const sc_fxval operator << ( const sc_fxval&, int );
00199 friend const sc_fxval operator >> ( const sc_fxval&, int );
00200
00201
00202
00203
00204 #define DECL_BIN_FNC_T(fnc,tp) \
00205 friend void fnc ( sc_fxval&, const sc_fxval&, tp ); \
00206 friend void fnc ( sc_fxval&, tp, const sc_fxval& );
00207
00208 #ifndef SC_FX_EXCLUDE_OTHER
00209 #define DECL_BIN_FNC_OTHER(fnc) \
00210 DECL_BIN_FNC_T(fnc,int64) \
00211 DECL_BIN_FNC_T(fnc,uint64) \
00212 DECL_BIN_FNC_T(fnc,const sc_int_base&) \
00213 DECL_BIN_FNC_T(fnc,const sc_uint_base&) \
00214 DECL_BIN_FNC_T(fnc,const sc_signed&) \
00215 DECL_BIN_FNC_T(fnc,const sc_unsigned&)
00216 #else
00217 #define DECL_BIN_FNC_OTHER(fnc)
00218 #endif
00219
00220 #define DECL_BIN_FNC(fnc) \
00221 friend void fnc ( sc_fxval&, const sc_fxval&, const sc_fxval& ); \
00222 DECL_BIN_FNC_T(fnc,int) \
00223 DECL_BIN_FNC_T(fnc,unsigned int) \
00224 DECL_BIN_FNC_T(fnc,long) \
00225 DECL_BIN_FNC_T(fnc,unsigned long) \
00226 DECL_BIN_FNC_T(fnc,double) \
00227 DECL_BIN_FNC_T(fnc,const char*) \
00228 DECL_BIN_FNC_T(fnc,const sc_fxval_fast&) \
00229 DECL_BIN_FNC_T(fnc,const sc_fxnum_fast&) \
00230 DECL_BIN_FNC_OTHER(fnc)
00231
00232 DECL_BIN_FNC(mult)
00233 DECL_BIN_FNC(div)
00234 DECL_BIN_FNC(add)
00235 DECL_BIN_FNC(sub)
00236
00237 #undef DECL_BIN_FNC_T
00238 #undef DECL_BIN_FNC_OTHER
00239 #undef DECL_BIN_FNC
00240
00241 friend void lshift( sc_fxval&, const sc_fxval&, int );
00242 friend void rshift( sc_fxval&, const sc_fxval&, int );
00243
00244
00245
00246
00247 #define DECL_REL_OP_T(op,tp) \
00248 friend bool operator op ( const sc_fxval&, tp ); \
00249 friend bool operator op ( tp, const sc_fxval& );
00250
00251 #ifndef SC_FX_EXCLUDE_OTHER
00252 #define DECL_REL_OP_OTHER(op) \
00253 DECL_REL_OP_T(op,int64) \
00254 DECL_REL_OP_T(op,uint64) \
00255 DECL_REL_OP_T(op,const sc_int_base&) \
00256 DECL_REL_OP_T(op,const sc_uint_base&) \
00257 DECL_REL_OP_T(op,const sc_signed&) \
00258 DECL_REL_OP_T(op,const sc_unsigned&)
00259 #else
00260 #define DECL_REL_OP_OTHER(op)
00261 #endif
00262
00263 #define DECL_REL_OP(op) \
00264 friend bool operator op ( const sc_fxval&, const sc_fxval& ); \
00265 DECL_REL_OP_T(op,int) \
00266 DECL_REL_OP_T(op,unsigned int) \
00267 DECL_REL_OP_T(op,long) \
00268 DECL_REL_OP_T(op,unsigned long) \
00269 DECL_REL_OP_T(op,double) \
00270 DECL_REL_OP_T(op,const char*) \
00271 DECL_REL_OP_T(op,const sc_fxval_fast&) \
00272 DECL_REL_OP_T(op,const sc_fxnum_fast&) \
00273 DECL_REL_OP_OTHER(op)
00274
00275 DECL_REL_OP(<)
00276 DECL_REL_OP(<=)
00277 DECL_REL_OP(>)
00278 DECL_REL_OP(>=)
00279 DECL_REL_OP(==)
00280 DECL_REL_OP(!=)
00281
00282 #undef DECL_REL_OP_T
00283 #undef DECL_REL_OP_OTHER
00284 #undef DECL_REL_OP
00285
00286
00287
00288
00289 #define DECL_ASN_OP_T(op,tp) \
00290 sc_fxval& operator op( tp );
00291
00292 #ifndef SC_FX_EXCLUDE_OTHER
00293 #define DECL_ASN_OP_OTHER(op) \
00294 DECL_ASN_OP_T(op,int64) \
00295 DECL_ASN_OP_T(op,uint64) \
00296 DECL_ASN_OP_T(op,const sc_int_base&) \
00297 DECL_ASN_OP_T(op,const sc_uint_base&) \
00298 DECL_ASN_OP_T(op,const sc_signed&) \
00299 DECL_ASN_OP_T(op,const sc_unsigned&)
00300 #else
00301 #define DECL_ASN_OP_OTHER(op)
00302 #endif
00303
00304 #define DECL_ASN_OP(op) \
00305 DECL_ASN_OP_T(op,int) \
00306 DECL_ASN_OP_T(op,unsigned int) \
00307 DECL_ASN_OP_T(op,long) \
00308 DECL_ASN_OP_T(op,unsigned long) \
00309 DECL_ASN_OP_T(op,double) \
00310 DECL_ASN_OP_T(op,const char*) \
00311 DECL_ASN_OP_T(op,const sc_fxval&) \
00312 DECL_ASN_OP_T(op,const sc_fxval_fast&) \
00313 DECL_ASN_OP_T(op,const sc_fxnum&) \
00314 DECL_ASN_OP_T(op,const sc_fxnum_fast&) \
00315 DECL_ASN_OP_OTHER(op)
00316
00317 DECL_ASN_OP(=)
00318
00319 DECL_ASN_OP(*=)
00320 DECL_ASN_OP(/=)
00321 DECL_ASN_OP(+=)
00322 DECL_ASN_OP(-=)
00323
00324 DECL_ASN_OP_T(<<=,int)
00325 DECL_ASN_OP_T(>>=,int)
00326
00327 #undef DECL_ASN_OP_T
00328 #undef DECL_ASN_OP_OTHER
00329 #undef DECL_ASN_OP
00330
00331
00332
00333
00334 const sc_fxval operator ++ ( int );
00335 const sc_fxval operator -- ( int );
00336
00337 sc_fxval& operator ++ ();
00338 sc_fxval& operator -- ();
00339
00340
00341
00342
00343 operator double() const;
00344
00345
00346
00347
00348 short to_short() const;
00349 unsigned short to_ushort() const;
00350 int to_int() const;
00351 unsigned int to_uint() const;
00352 long to_long() const;
00353 unsigned long to_ulong() const;
00354 float to_float() const;
00355 double to_double() const;
00356
00357
00358
00359
00360 const sc_string to_string() const;
00361 const sc_string to_string( sc_numrep ) const;
00362 const sc_string to_string( sc_numrep, bool ) const;
00363 const sc_string to_string( sc_fmt ) const;
00364 const sc_string to_string( sc_numrep, sc_fmt ) const;
00365 const sc_string to_string( sc_numrep, bool, sc_fmt ) const;
00366
00367 const sc_string to_dec() const;
00368 const sc_string to_bin() const;
00369 const sc_string to_oct() const;
00370 const sc_string to_hex() const;
00371
00372
00373
00374
00375 bool is_neg() const;
00376 bool is_zero() const;
00377 bool is_nan() const;
00378 bool is_inf() const;
00379 bool is_normal() const;
00380
00381 bool rounding_flag() const;
00382
00383
00384
00385
00386 void print( ostream& = cout ) const;
00387 void scan( istream& = cin );
00388 void dump( ostream& = cout ) const;
00389
00390
00391
00392 bool get_bit( int ) const;
00393
00394 protected:
00395
00396 sc_fxval_observer* lock_observer() const;
00397 void unlock_observer( sc_fxval_observer* ) const;
00398
00399
00400 void get_type( int&, int&, sc_enc& ) const;
00401
00402 const sc_fxval quantization( const scfx_params&, bool& ) const;
00403 const sc_fxval overflow( const scfx_params&, bool& ) const;
00404
00405 private:
00406
00407 scfx_rep* m_rep;
00408
00409 mutable sc_fxval_observer* m_observer;
00410
00411 };
00412
00413
00414
00415
00416
00417
00418
00419
00420 class sc_fxval_fast
00421 {
00422
00423 friend class sc_fxnum_fast;
00424
00425 protected:
00426
00427 sc_fxval_fast_observer* observer() const;
00428
00429 public:
00430
00431 explicit sc_fxval_fast( sc_fxval_fast_observer* = 0 );
00432 sc_fxval_fast( int,
00433 sc_fxval_fast_observer* = 0 );
00434 sc_fxval_fast( unsigned int,
00435 sc_fxval_fast_observer* = 0 );
00436 sc_fxval_fast( long,
00437 sc_fxval_fast_observer* = 0 );
00438 sc_fxval_fast( unsigned long,
00439 sc_fxval_fast_observer* = 0 );
00440 sc_fxval_fast( double,
00441 sc_fxval_fast_observer* = 0 );
00442 sc_fxval_fast( const char*,
00443 sc_fxval_fast_observer* = 0 );
00444 sc_fxval_fast( const sc_fxval&,
00445 sc_fxval_fast_observer* = 0 );
00446 sc_fxval_fast( const sc_fxval_fast&,
00447 sc_fxval_fast_observer* = 0 );
00448 sc_fxval_fast( const sc_fxnum&,
00449 sc_fxval_fast_observer* = 0 );
00450 sc_fxval_fast( const sc_fxnum_fast&,
00451 sc_fxval_fast_observer* = 0 );
00452 #ifndef SC_FX_EXCLUDE_OTHER
00453 explicit sc_fxval_fast( int64,
00454 sc_fxval_fast_observer* = 0 );
00455 explicit sc_fxval_fast( uint64,
00456 sc_fxval_fast_observer* = 0 );
00457 explicit sc_fxval_fast( const sc_int_base&,
00458 sc_fxval_fast_observer* = 0 );
00459 explicit sc_fxval_fast( const sc_uint_base&,
00460 sc_fxval_fast_observer* = 0 );
00461 explicit sc_fxval_fast( const sc_signed&,
00462 sc_fxval_fast_observer* = 0 );
00463 explicit sc_fxval_fast( const sc_unsigned&,
00464 sc_fxval_fast_observer* = 0 );
00465 #endif
00466
00467 ~sc_fxval_fast();
00468
00469
00470 double get_val() const;
00471 void set_val( double );
00472
00473
00474
00475
00476 const sc_fxval_fast operator - () const;
00477 const sc_fxval_fast& operator + () const;
00478
00479
00480
00481
00482 friend void neg( sc_fxval_fast&, const sc_fxval_fast& );
00483
00484
00485
00486
00487 #define DECL_BIN_OP_T(op,tp) \
00488 friend const sc_fxval_fast operator op ( const sc_fxval_fast&, tp ); \
00489 friend const sc_fxval_fast operator op ( tp, const sc_fxval_fast& );
00490
00491 #ifndef SC_FX_EXCLUDE_OTHER
00492 #define DECL_BIN_OP_OTHER(op) \
00493 DECL_BIN_OP_T(op,int64) \
00494 DECL_BIN_OP_T(op,uint64) \
00495 DECL_BIN_OP_T(op,const sc_int_base&) \
00496 DECL_BIN_OP_T(op,const sc_uint_base&) \
00497 DECL_BIN_OP_T(op,const sc_signed&) \
00498 DECL_BIN_OP_T(op,const sc_unsigned&)
00499 #else
00500 #define DECL_BIN_OP_OTHER(op)
00501 #endif
00502
00503 #define DECL_BIN_OP(op,dummy) \
00504 friend const sc_fxval_fast operator op ( const sc_fxval_fast&, \
00505 const sc_fxval_fast& ); \
00506 DECL_BIN_OP_T(op,int) \
00507 DECL_BIN_OP_T(op,unsigned int) \
00508 DECL_BIN_OP_T(op,long) \
00509 DECL_BIN_OP_T(op,unsigned long) \
00510 DECL_BIN_OP_T(op,double) \
00511 DECL_BIN_OP_T(op,const char*) \
00512 DECL_BIN_OP_OTHER(op)
00513
00514 DECL_BIN_OP(*,mult)
00515 DECL_BIN_OP(+,add)
00516 DECL_BIN_OP(-,sub)
00517
00518
00519 friend const sc_fxval_fast operator / ( const sc_fxval_fast&,
00520 const sc_fxval_fast& );
00521 DECL_BIN_OP_T(/,int)
00522 DECL_BIN_OP_T(/,unsigned int)
00523 DECL_BIN_OP_T(/,long)
00524 DECL_BIN_OP_T(/,unsigned long)
00525 DECL_BIN_OP_T(/,double)
00526 DECL_BIN_OP_T(/,const char*)
00527
00528 #ifndef SC_FX_EXCLUDE_OTHER
00529 DECL_BIN_OP_T(/,int64) \
00530 DECL_BIN_OP_T(/,uint64) \
00531 DECL_BIN_OP_T(/,const sc_int_base&) \
00532 DECL_BIN_OP_T(/,const sc_uint_base&) \
00533 DECL_BIN_OP_T(/,const sc_signed&) \
00534 DECL_BIN_OP_T(/,const sc_unsigned&)
00535 #endif
00536
00537 #undef DECL_BIN_OP_T
00538 #undef DECL_BIN_OP_OTHER
00539 #undef DECL_BIN_OP
00540
00541 friend const sc_fxval_fast operator << ( const sc_fxval_fast&, int );
00542 friend const sc_fxval_fast operator >> ( const sc_fxval_fast&, int );
00543
00544
00545
00546
00547 #define DECL_BIN_FNC_T(fnc,tp) \
00548 friend void fnc ( sc_fxval_fast&, const sc_fxval_fast&, tp ); \
00549 friend void fnc ( sc_fxval_fast&, tp, const sc_fxval_fast& );
00550
00551 #ifndef SC_FX_EXCLUDE_OTHER
00552 #define DECL_BIN_FNC_OTHER(fnc) \
00553 DECL_BIN_FNC_T(fnc,int64) \
00554 DECL_BIN_FNC_T(fnc,uint64) \
00555 DECL_BIN_FNC_T(fnc,const sc_int_base&) \
00556 DECL_BIN_FNC_T(fnc,const sc_uint_base&) \
00557 DECL_BIN_FNC_T(fnc,const sc_signed&) \
00558 DECL_BIN_FNC_T(fnc,const sc_unsigned&)
00559 #else
00560 #define DECL_BIN_FNC_OTHER(fnc)
00561 #endif
00562
00563 #define DECL_BIN_FNC(fnc) \
00564 friend void fnc ( sc_fxval_fast&, const sc_fxval_fast&, \
00565 const sc_fxval_fast& ); \
00566 DECL_BIN_FNC_T(fnc,int) \
00567 DECL_BIN_FNC_T(fnc,unsigned int) \
00568 DECL_BIN_FNC_T(fnc,long) \
00569 DECL_BIN_FNC_T(fnc,unsigned long) \
00570 DECL_BIN_FNC_T(fnc,double) \
00571 DECL_BIN_FNC_T(fnc,const char*) \
00572 DECL_BIN_FNC_T(fnc,const sc_fxval&) \
00573 DECL_BIN_FNC_T(fnc,const sc_fxnum&) \
00574 DECL_BIN_FNC_OTHER(fnc)
00575
00576 DECL_BIN_FNC(mult)
00577 DECL_BIN_FNC(div)
00578 DECL_BIN_FNC(add)
00579 DECL_BIN_FNC(sub)
00580
00581 #undef DECL_BIN_FNC_T
00582 #undef DECL_BIN_FNC_OTHER
00583 #undef DECL_BIN_FNC
00584
00585 friend void lshift( sc_fxval_fast&, const sc_fxval_fast&, int );
00586 friend void rshift( sc_fxval_fast&, const sc_fxval_fast&, int );
00587
00588
00589
00590
00591 #define DECL_REL_OP_T(op,tp) \
00592 friend bool operator op ( const sc_fxval_fast&, tp ); \
00593 friend bool operator op ( tp, const sc_fxval_fast& );
00594
00595 #ifndef SC_FX_EXCLUDE_OTHER
00596 #define DECL_REL_OP_OTHER(op) \
00597 DECL_REL_OP_T(op,int64) \
00598 DECL_REL_OP_T(op,uint64) \
00599 DECL_REL_OP_T(op,const sc_int_base&) \
00600 DECL_REL_OP_T(op,const sc_uint_base&) \
00601 DECL_REL_OP_T(op,const sc_signed&) \
00602 DECL_REL_OP_T(op,const sc_unsigned&)
00603 #else
00604 #define DECL_REL_OP_OTHER(op)
00605 #endif
00606
00607 #define DECL_REL_OP(op) \
00608 friend bool operator op ( const sc_fxval_fast&, const sc_fxval_fast& ); \
00609 DECL_REL_OP_T(op,int) \
00610 DECL_REL_OP_T(op,unsigned int) \
00611 DECL_REL_OP_T(op,long) \
00612 DECL_REL_OP_T(op,unsigned long) \
00613 DECL_REL_OP_T(op,double) \
00614 DECL_REL_OP_T(op,const char*) \
00615 DECL_REL_OP_OTHER(op)
00616
00617 DECL_REL_OP(<)
00618 DECL_REL_OP(<=)
00619 DECL_REL_OP(>)
00620 DECL_REL_OP(>=)
00621 DECL_REL_OP(==)
00622 DECL_REL_OP(!=)
00623
00624 #undef DECL_REL_OP_T
00625 #undef DECL_REL_OP_OTHER
00626 #undef DECL_REL_OP
00627
00628
00629
00630
00631 #define DECL_ASN_OP_T(op,tp) \
00632 sc_fxval_fast& operator op( tp );
00633
00634 #ifndef SC_FX_EXCLUDE_OTHER
00635 #define DECL_ASN_OP_OTHER(op) \
00636 DECL_ASN_OP_T(op,int64) \
00637 DECL_ASN_OP_T(op,uint64) \
00638 DECL_ASN_OP_T(op,const sc_int_base&) \
00639 DECL_ASN_OP_T(op,const sc_uint_base&) \
00640 DECL_ASN_OP_T(op,const sc_signed&) \
00641 DECL_ASN_OP_T(op,const sc_unsigned&)
00642 #else
00643 #define DECL_ASN_OP_OTHER(op)
00644 #endif
00645
00646 #define DECL_ASN_OP(op) \
00647 DECL_ASN_OP_T(op,int) \
00648 DECL_ASN_OP_T(op,unsigned int) \
00649 DECL_ASN_OP_T(op,long) \
00650 DECL_ASN_OP_T(op,unsigned long) \
00651 DECL_ASN_OP_T(op,double) \
00652 DECL_ASN_OP_T(op,const char*) \
00653 DECL_ASN_OP_T(op,const sc_fxval&) \
00654 DECL_ASN_OP_T(op,const sc_fxval_fast&) \
00655 DECL_ASN_OP_T(op,const sc_fxnum&) \
00656 DECL_ASN_OP_T(op,const sc_fxnum_fast&) \
00657 DECL_ASN_OP_OTHER(op)
00658
00659 DECL_ASN_OP(=)
00660
00661 DECL_ASN_OP(*=)
00662 DECL_ASN_OP(/=)
00663 DECL_ASN_OP(+=)
00664 DECL_ASN_OP(-=)
00665
00666 DECL_ASN_OP_T(<<=,int)
00667 DECL_ASN_OP_T(>>=,int)
00668
00669 #undef DECL_ASN_OP_T
00670 #undef DECL_ASN_OP_OTHER
00671 #undef DECL_ASN_OP
00672
00673
00674
00675
00676 const sc_fxval_fast operator ++ ( int );
00677 const sc_fxval_fast operator -- ( int );
00678
00679 sc_fxval_fast& operator ++ ();
00680 sc_fxval_fast& operator -- ();
00681
00682
00683
00684
00685 operator double() const;
00686
00687
00688
00689
00690 short to_short() const;
00691 unsigned short to_ushort() const;
00692 int to_int() const;
00693 unsigned int to_uint() const;
00694 long to_long() const;
00695 unsigned long to_ulong() const;
00696 float to_float() const;
00697 double to_double() const;
00698
00699
00700
00701
00702 const sc_string to_string() const;
00703 const sc_string to_string( sc_numrep ) const;
00704 const sc_string to_string( sc_numrep, bool ) const;
00705 const sc_string to_string( sc_fmt ) const;
00706 const sc_string to_string( sc_numrep, sc_fmt ) const;
00707 const sc_string to_string( sc_numrep, bool, sc_fmt ) const;
00708
00709 const sc_string to_dec() const;
00710 const sc_string to_bin() const;
00711 const sc_string to_oct() const;
00712 const sc_string to_hex() const;
00713
00714
00715
00716
00717 bool is_neg() const;
00718 bool is_zero() const;
00719 bool is_nan() const;
00720 bool is_inf() const;
00721 bool is_normal() const;
00722
00723 bool rounding_flag() const;
00724
00725
00726
00727
00728 void print( ostream& = cout ) const;
00729 void scan( istream& = cin );
00730 void dump( ostream& = cout ) const;
00731
00732
00733
00734 bool get_bit( int ) const;
00735
00736 protected:
00737
00738 sc_fxval_fast_observer* lock_observer() const;
00739 void unlock_observer( sc_fxval_fast_observer* ) const;
00740
00741
00742 static double from_string( const char* );
00743
00744 private:
00745
00746 double m_val;
00747
00748 mutable sc_fxval_fast_observer* m_observer;
00749
00750 };
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763 inline
00764 sc_fxval_observer*
00765 sc_fxval::observer() const
00766 {
00767 return m_observer;
00768 }
00769
00770
00771
00772 inline
00773 sc_fxval::sc_fxval( scfx_rep* a )
00774 : m_rep( a ),
00775 m_observer( 0 )
00776 {}
00777
00778
00779
00780
00781 inline
00782 sc_fxval::sc_fxval( sc_fxval_observer* observer_ )
00783 : m_rep( new scfx_rep ),
00784 m_observer( observer_ )
00785 {
00786 SC_FXVAL_OBSERVER_DEFAULT_
00787 SC_FXVAL_OBSERVER_CONSTRUCT_( *this )
00788 }
00789
00790 inline
00791 sc_fxval::sc_fxval( const sc_fxval& a,
00792 sc_fxval_observer* observer_ )
00793 : m_rep( new scfx_rep( *a.m_rep ) ),
00794 m_observer( observer_ )
00795 {
00796 SC_FXVAL_OBSERVER_DEFAULT_
00797 SC_FXVAL_OBSERVER_READ_( a )
00798 SC_FXVAL_OBSERVER_CONSTRUCT_( *this )
00799 SC_FXVAL_OBSERVER_WRITE_( *this )
00800 }
00801
00802 #define DEFN_CTOR_T(tp,arg) \
00803 inline \
00804 sc_fxval::sc_fxval( tp a, \
00805 sc_fxval_observer* observer_ ) \
00806 : m_rep( new scfx_rep( arg ) ), \
00807 m_observer( observer_ ) \
00808 { \
00809 SC_FXVAL_OBSERVER_DEFAULT_ \
00810 SC_FXVAL_OBSERVER_CONSTRUCT_( *this ) \
00811 SC_FXVAL_OBSERVER_WRITE_( *this ) \
00812 }
00813
00814 #define DEFN_CTOR_T_A(tp) DEFN_CTOR_T(tp,a)
00815 #define DEFN_CTOR_T_B(tp) DEFN_CTOR_T(tp,a.to_double())
00816 #define DEFN_CTOR_T_C(tp) DEFN_CTOR_T(tp,a.value())
00817
00818 DEFN_CTOR_T_A(int)
00819 DEFN_CTOR_T_A(unsigned int)
00820 DEFN_CTOR_T_A(long)
00821 DEFN_CTOR_T_A(unsigned long)
00822 DEFN_CTOR_T_A(double)
00823 DEFN_CTOR_T_A(const char*)
00824 DEFN_CTOR_T_B(const sc_fxval_fast&)
00825 #ifndef SC_FX_EXCLUDE_OTHER
00826 DEFN_CTOR_T_A(int64)
00827 DEFN_CTOR_T_A(uint64)
00828 DEFN_CTOR_T_C(const sc_int_base&)
00829 DEFN_CTOR_T_C(const sc_uint_base&)
00830 DEFN_CTOR_T_A(const sc_signed&)
00831 DEFN_CTOR_T_A(const sc_unsigned&)
00832 #endif
00833
00834 #undef DEFN_CTOR_T
00835 #undef DEFN_CTOR_T_A
00836 #undef DEFN_CTOR_T_B
00837 #undef DEFN_CTOR_T_C
00838
00839
00840 inline
00841 sc_fxval::~sc_fxval()
00842 {
00843 SC_FXVAL_OBSERVER_DESTRUCT_( *this )
00844 delete m_rep;
00845 }
00846
00847
00848
00849 inline
00850 const scfx_rep*
00851 sc_fxval::get_rep() const
00852 {
00853 SC_FXVAL_OBSERVER_READ_( *this )
00854 return m_rep;
00855 }
00856
00857
00858 inline
00859 void
00860 sc_fxval::set_rep( scfx_rep* rep_ )
00861 {
00862 delete m_rep;
00863 m_rep = rep_;
00864 SC_FXVAL_OBSERVER_WRITE_( *this )
00865 }
00866
00867
00868
00869
00870 inline
00871 const sc_fxval
00872 sc_fxval::operator - () const
00873 {
00874 SC_FXVAL_OBSERVER_READ_( *this )
00875 return sc_fxval( sc_dt::neg_scfx_rep( *m_rep ) );
00876 }
00877
00878 inline
00879 const sc_fxval&
00880 sc_fxval::operator + () const
00881 {
00882
00883 return *this;
00884 }
00885
00886
00887
00888
00889 inline
00890 void
00891 neg( sc_fxval& c, const sc_fxval& a )
00892 {
00893 SC_FXVAL_OBSERVER_READ_( a )
00894 delete c.m_rep;
00895 c.m_rep = sc_dt::neg_scfx_rep( *a.m_rep );
00896 SC_FXVAL_OBSERVER_WRITE_( c )
00897 }
00898
00899
00900
00901
00902 #define DEFN_BIN_OP_T(op,fnc,tp) \
00903 inline \
00904 const sc_fxval \
00905 operator op ( const sc_fxval& a, tp b ) \
00906 { \
00907 SC_FXVAL_OBSERVER_READ_( a ) \
00908 sc_fxval tmp( b ); \
00909 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.m_rep ) ); \
00910 } \
00911 \
00912 inline \
00913 const sc_fxval \
00914 operator op ( tp a, const sc_fxval& b ) \
00915 { \
00916 SC_FXVAL_OBSERVER_READ_( b ) \
00917 sc_fxval tmp( a ); \
00918 return sc_fxval( sc_dt::fnc ## _scfx_rep( *tmp.m_rep, *b.m_rep ) ); \
00919 }
00920
00921 #ifndef SC_FX_EXCLUDE_OTHER
00922 #define DEFN_BIN_OP_OTHER(op,fnc) \
00923 DEFN_BIN_OP_T(op,fnc,int64) \
00924 DEFN_BIN_OP_T(op,fnc,uint64) \
00925 DEFN_BIN_OP_T(op,fnc,const sc_int_base&) \
00926 DEFN_BIN_OP_T(op,fnc,const sc_uint_base&) \
00927 DEFN_BIN_OP_T(op,fnc,const sc_signed&) \
00928 DEFN_BIN_OP_T(op,fnc,const sc_unsigned&)
00929 #else
00930 #define DEFN_BIN_OP_OTHER(op,fnc)
00931 #endif
00932
00933 #define DEFN_BIN_OP(op,fnc) \
00934 inline \
00935 const sc_fxval \
00936 operator op ( const sc_fxval& a, const sc_fxval& b ) \
00937 { \
00938 SC_FXVAL_OBSERVER_READ_( a ) \
00939 SC_FXVAL_OBSERVER_READ_( b ) \
00940 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.m_rep ) ); \
00941 } \
00942 \
00943 DEFN_BIN_OP_T(op,fnc,int) \
00944 DEFN_BIN_OP_T(op,fnc,unsigned int) \
00945 DEFN_BIN_OP_T(op,fnc,long) \
00946 DEFN_BIN_OP_T(op,fnc,unsigned long) \
00947 DEFN_BIN_OP_T(op,fnc,double) \
00948 DEFN_BIN_OP_T(op,fnc,const char*) \
00949 DEFN_BIN_OP_T(op,fnc,const sc_fxval_fast&) \
00950 DEFN_BIN_OP_OTHER(op,fnc)
00951
00952 DEFN_BIN_OP(*,mult)
00953 DEFN_BIN_OP(+,add)
00954 DEFN_BIN_OP(-,sub)
00955
00956
00957 inline
00958 const sc_fxval
00959 operator / ( const sc_fxval& a, const sc_fxval& b )
00960 {
00961 SC_FXVAL_OBSERVER_READ_( a )
00962 SC_FXVAL_OBSERVER_READ_( b )
00963 return sc_fxval( sc_dt::div_scfx_rep( *a.m_rep, *b.m_rep ) );
00964 }
00965
00966 DEFN_BIN_OP_T(/,div,int)
00967 DEFN_BIN_OP_T(/,div,unsigned int)
00968 DEFN_BIN_OP_T(/,div,long)
00969 DEFN_BIN_OP_T(/,div,unsigned long)
00970 DEFN_BIN_OP_T(/,div,double)
00971 DEFN_BIN_OP_T(/,div,const char*)
00972 DEFN_BIN_OP_T(/,div,const sc_fxval_fast&)
00973
00974 #ifndef SC_FX_EXCLUDE_OTHER
00975 DEFN_BIN_OP_T(/,div,int64) \
00976 DEFN_BIN_OP_T(/,div,uint64) \
00977 DEFN_BIN_OP_T(/,div,const sc_int_base&) \
00978 DEFN_BIN_OP_T(/,div,const sc_uint_base&) \
00979 DEFN_BIN_OP_T(/,div,const sc_signed&) \
00980 DEFN_BIN_OP_T(/,div,const sc_unsigned&)
00981 #endif
00982
00983 #undef DEFN_BIN_OP_T
00984 #undef DEFN_BIN_OP_OTHER
00985 #undef DEFN_BIN_OP
00986
00987
00988 inline
00989 const sc_fxval
00990 operator << ( const sc_fxval& a, int b )
00991 {
00992 SC_FXVAL_OBSERVER_READ_( a )
00993 return sc_fxval( sc_dt::lsh_scfx_rep( *a.m_rep, b ) );
00994 }
00995
00996 inline
00997 const sc_fxval
00998 operator >> ( const sc_fxval& a, int b )
00999 {
01000 SC_FXVAL_OBSERVER_READ_( a )
01001 return sc_fxval( sc_dt::rsh_scfx_rep( *a.m_rep, b ) );
01002 }
01003
01004
01005
01006
01007 #define DEFN_BIN_FNC_T(fnc,tp) \
01008 inline \
01009 void \
01010 fnc ( sc_fxval& c, const sc_fxval& a, tp b ) \
01011 { \
01012 SC_FXVAL_OBSERVER_READ_( a ) \
01013 sc_fxval tmp( b ); \
01014 delete c.m_rep; \
01015 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.m_rep ); \
01016 SC_FXVAL_OBSERVER_WRITE_( c ) \
01017 } \
01018 \
01019 inline \
01020 void \
01021 fnc ( sc_fxval& c, tp a, const sc_fxval& b ) \
01022 { \
01023 SC_FXVAL_OBSERVER_READ_( b ) \
01024 sc_fxval tmp( a ); \
01025 delete c.m_rep; \
01026 c.m_rep = sc_dt::fnc ## _scfx_rep( *tmp.m_rep, *b.m_rep ); \
01027 SC_FXVAL_OBSERVER_WRITE_( c ) \
01028 }
01029
01030 #ifndef SC_FX_EXCLUDE_OTHER
01031 #define DEFN_BIN_FNC_OTHER(fnc) \
01032 DEFN_BIN_FNC_T(fnc,int64) \
01033 DEFN_BIN_FNC_T(fnc,uint64) \
01034 DEFN_BIN_FNC_T(fnc,const sc_int_base&) \
01035 DEFN_BIN_FNC_T(fnc,const sc_uint_base&) \
01036 DEFN_BIN_FNC_T(fnc,const sc_signed&) \
01037 DEFN_BIN_FNC_T(fnc,const sc_unsigned&)
01038 #else
01039 #define DEFN_BIN_FNC_OTHER(fnc)
01040 #endif
01041
01042 #define DEFN_BIN_FNC(fnc) \
01043 inline \
01044 void \
01045 fnc( sc_fxval& c, const sc_fxval& a, const sc_fxval& b ) \
01046 { \
01047 SC_FXVAL_OBSERVER_READ_( a ) \
01048 SC_FXVAL_OBSERVER_READ_( b ) \
01049 delete c.m_rep; \
01050 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.m_rep ); \
01051 SC_FXVAL_OBSERVER_WRITE_( c ) \
01052 } \
01053 \
01054 DEFN_BIN_FNC_T(fnc,int) \
01055 DEFN_BIN_FNC_T(fnc,unsigned int) \
01056 DEFN_BIN_FNC_T(fnc,long) \
01057 DEFN_BIN_FNC_T(fnc,unsigned long) \
01058 DEFN_BIN_FNC_T(fnc,double) \
01059 DEFN_BIN_FNC_T(fnc,const char*) \
01060 DEFN_BIN_FNC_T(fnc,const sc_fxval_fast&) \
01061 DEFN_BIN_FNC_OTHER(fnc)
01062
01063 DEFN_BIN_FNC(mult)
01064 DEFN_BIN_FNC(div)
01065 DEFN_BIN_FNC(add)
01066 DEFN_BIN_FNC(sub)
01067
01068 #undef DEFN_BIN_FNC_T
01069 #undef DEFN_BIN_FNC_OTHER
01070 #undef DEFN_BIN_FNC
01071
01072
01073 inline
01074 void
01075 lshift( sc_fxval& c, const sc_fxval& a, int b )
01076 {
01077 SC_FXVAL_OBSERVER_READ_( a )
01078 delete c.m_rep;
01079 c.m_rep = sc_dt::lsh_scfx_rep( *a.m_rep, b );
01080 SC_FXVAL_OBSERVER_WRITE_( c )
01081 }
01082
01083 inline
01084 void
01085 rshift( sc_fxval& c, const sc_fxval& a, int b )
01086 {
01087 SC_FXVAL_OBSERVER_READ_( a )
01088 delete c.m_rep;
01089 c.m_rep = sc_dt::rsh_scfx_rep( *a.m_rep, b );
01090 SC_FXVAL_OBSERVER_WRITE_( c )
01091 }
01092
01093
01094
01095
01096 #define DEFN_REL_OP_T(op,ret,tp) \
01097 inline \
01098 bool \
01099 operator op ( const sc_fxval& a, tp b ) \
01100 { \
01101 SC_FXVAL_OBSERVER_READ_( a ) \
01102 sc_fxval tmp( b ); \
01103 int result = sc_dt::cmp_scfx_rep( *a.m_rep, *tmp.m_rep ); \
01104 return ( ret ); \
01105 } \
01106 \
01107 inline \
01108 bool \
01109 operator op ( tp a, const sc_fxval& b ) \
01110 { \
01111 SC_FXVAL_OBSERVER_READ_( b ) \
01112 sc_fxval tmp( a ); \
01113 int result = sc_dt::cmp_scfx_rep( *tmp.m_rep, *b.m_rep ); \
01114 return ( ret ); \
01115 }
01116
01117 #ifndef SC_FX_EXCLUDE_OTHER
01118 #define DEFN_REL_OP_OTHER(op,ret) \
01119 DEFN_REL_OP_T(op,ret,int64) \
01120 DEFN_REL_OP_T(op,ret,uint64) \
01121 DEFN_REL_OP_T(op,ret,const sc_int_base&) \
01122 DEFN_REL_OP_T(op,ret,const sc_uint_base&) \
01123 DEFN_REL_OP_T(op,ret,const sc_signed&) \
01124 DEFN_REL_OP_T(op,ret,const sc_unsigned&)
01125 #else
01126 #define DEFN_REL_OP_OTHER(op,ret)
01127 #endif
01128
01129 #define DEFN_REL_OP(op,ret) \
01130 inline \
01131 bool \
01132 operator op ( const sc_fxval& a, const sc_fxval& b) \
01133 { \
01134 SC_FXVAL_OBSERVER_READ_( a ) \
01135 SC_FXVAL_OBSERVER_READ_( b ) \
01136 int result = sc_dt::cmp_scfx_rep( *a.m_rep, *b.m_rep ); \
01137 return ( ret ); \
01138 } \
01139 \
01140 DEFN_REL_OP_T(op,ret,int) \
01141 DEFN_REL_OP_T(op,ret,unsigned int) \
01142 DEFN_REL_OP_T(op,ret,long) \
01143 DEFN_REL_OP_T(op,ret,unsigned long) \
01144 DEFN_REL_OP_T(op,ret,double) \
01145 DEFN_REL_OP_T(op,ret,const char*) \
01146 DEFN_REL_OP_T(op,ret,const sc_fxval_fast&) \
01147 DEFN_REL_OP_OTHER(op,ret)
01148
01149 DEFN_REL_OP(<,result < 0)
01150 DEFN_REL_OP(<=,result <= 0)
01151 DEFN_REL_OP(>,result > 0 && result != 2)
01152 DEFN_REL_OP(>=,result >= 0 && result != 2)
01153 DEFN_REL_OP(==,result == 0)
01154 DEFN_REL_OP(!=,result != 0)
01155
01156 #undef DEFN_REL_OP_T
01157 #undef DEFN_REL_OP_OTHER
01158 #undef DEFN_REL_OP
01159
01160
01161
01162
01163 inline
01164 sc_fxval&
01165 sc_fxval::operator = ( const sc_fxval& a )
01166 {
01167 if( &a != this )
01168 {
01169 SC_FXVAL_OBSERVER_READ_( a )
01170 *m_rep = *a.m_rep;
01171 SC_FXVAL_OBSERVER_WRITE_( *this )
01172 }
01173 return *this;
01174 }
01175
01176 #define DEFN_ASN_OP_T(tp) \
01177 inline \
01178 sc_fxval& \
01179 sc_fxval::operator = ( tp b ) \
01180 { \
01181 sc_fxval tmp( b ); \
01182 *m_rep = *tmp.m_rep; \
01183 SC_FXVAL_OBSERVER_WRITE_( *this ) \
01184 return *this; \
01185 }
01186
01187 DEFN_ASN_OP_T(int)
01188 DEFN_ASN_OP_T(unsigned int)
01189 DEFN_ASN_OP_T(long)
01190 DEFN_ASN_OP_T(unsigned long)
01191 DEFN_ASN_OP_T(double)
01192 DEFN_ASN_OP_T(const char*)
01193 DEFN_ASN_OP_T(const sc_fxval_fast&)
01194 #ifndef SC_FX_EXCLUDE_OTHER
01195 DEFN_ASN_OP_T(int64)
01196 DEFN_ASN_OP_T(uint64)
01197 DEFN_ASN_OP_T(const sc_int_base&)
01198 DEFN_ASN_OP_T(const sc_uint_base&)
01199 DEFN_ASN_OP_T(const sc_signed&)
01200 DEFN_ASN_OP_T(const sc_unsigned&)
01201 #endif
01202
01203 #undef DEFN_ASN_OP_T
01204
01205
01206 #define DEFN_ASN_OP_T(op,fnc,tp) \
01207 inline \
01208 sc_fxval& \
01209 sc_fxval::operator op ( tp b ) \
01210 { \
01211 SC_FXVAL_OBSERVER_READ_( *this ) \
01212 sc_fxval tmp( b ); \
01213 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *tmp.m_rep ); \
01214 delete m_rep; \
01215 m_rep = new_rep; \
01216 SC_FXVAL_OBSERVER_WRITE_( *this ) \
01217 return *this; \
01218 }
01219
01220 #ifndef SC_FX_EXCLUDE_OTHER
01221 #define DEFN_ASN_OP_OTHER(op,fnc) \
01222 DEFN_ASN_OP_T(op,fnc,int64) \
01223 DEFN_ASN_OP_T(op,fnc,uint64) \
01224 DEFN_ASN_OP_T(op,fnc,const sc_int_base&) \
01225 DEFN_ASN_OP_T(op,fnc,const sc_uint_base&) \
01226 DEFN_ASN_OP_T(op,fnc,const sc_signed&) \
01227 DEFN_ASN_OP_T(op,fnc,const sc_unsigned&)
01228 #else
01229 #define DEFN_ASN_OP_OTHER(op,fnc)
01230 #endif
01231
01232 #define DEFN_ASN_OP(op,fnc) \
01233 inline \
01234 sc_fxval& \
01235 sc_fxval::operator op ( const sc_fxval& b ) \
01236 { \
01237 SC_FXVAL_OBSERVER_READ_( *this ) \
01238 SC_FXVAL_OBSERVER_READ_( b ) \
01239 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *b.m_rep ); \
01240 delete m_rep; \
01241 m_rep = new_rep; \
01242 SC_FXVAL_OBSERVER_WRITE_( *this ) \
01243 return *this; \
01244 } \
01245 \
01246 DEFN_ASN_OP_T(op,fnc,int) \
01247 DEFN_ASN_OP_T(op,fnc,unsigned int) \
01248 DEFN_ASN_OP_T(op,fnc,long) \
01249 DEFN_ASN_OP_T(op,fnc,unsigned long) \
01250 DEFN_ASN_OP_T(op,fnc,double) \
01251 DEFN_ASN_OP_T(op,fnc,const char*) \
01252 DEFN_ASN_OP_T(op,fnc,const sc_fxval_fast&) \
01253 DEFN_ASN_OP_OTHER(op,fnc)
01254
01255 DEFN_ASN_OP(*=,mult)
01256 DEFN_ASN_OP(/=,div)
01257 DEFN_ASN_OP(+=,add)
01258 DEFN_ASN_OP(-=,sub)
01259
01260 #undef DEFN_ASN_OP_T
01261 #undef DEFN_ASN_OP_OTHER
01262 #undef DEFN_ASN_OP
01263
01264
01265 inline
01266 sc_fxval&
01267 sc_fxval::operator <<= ( int b )
01268 {
01269 SC_FXVAL_OBSERVER_READ_( *this )
01270 m_rep->lshift( b );
01271 SC_FXVAL_OBSERVER_WRITE_( *this )
01272 return *this;
01273 }
01274
01275 inline
01276 sc_fxval&
01277 sc_fxval::operator >>= ( int b )
01278 {
01279 SC_FXVAL_OBSERVER_READ_( *this )
01280 m_rep->rshift( b );
01281 SC_FXVAL_OBSERVER_WRITE_( *this )
01282 return *this;
01283 }
01284
01285
01286
01287
01288 inline
01289 const sc_fxval
01290 sc_fxval::operator ++ ( int )
01291 {
01292 sc_fxval c = *this;
01293 (*this) += 1;
01294 return c;
01295 }
01296
01297 inline
01298 const sc_fxval
01299 sc_fxval::operator -- ( int )
01300 {
01301 sc_fxval c = *this;
01302 (*this) -= 1;
01303 return c;
01304 }
01305
01306 inline
01307 sc_fxval&
01308 sc_fxval::operator ++ ()
01309 {
01310 (*this) += 1;
01311 return *this;
01312 }
01313
01314 inline
01315 sc_fxval&
01316 sc_fxval::operator -- ()
01317 {
01318 (*this) -= 1;
01319 return *this;
01320 }
01321
01322
01323
01324
01325 inline
01326 sc_fxval::operator double() const
01327 {
01328 SC_FXVAL_OBSERVER_READ_( *this )
01329 return m_rep->to_double();
01330 }
01331
01332
01333
01334
01335 inline
01336 short
01337 sc_fxval::to_short() const
01338 {
01339 SC_FXVAL_OBSERVER_READ_( *this )
01340 return static_cast<short>( m_rep->to_double() );
01341 }
01342
01343 inline
01344 unsigned short
01345 sc_fxval::to_ushort() const
01346 {
01347 SC_FXVAL_OBSERVER_READ_( *this )
01348 return static_cast<unsigned short>( m_rep->to_double() );
01349 }
01350
01351 inline
01352 int
01353 sc_fxval::to_int() const
01354 {
01355 SC_FXVAL_OBSERVER_READ_( *this )
01356 return static_cast<int>( m_rep->to_double() );
01357 }
01358
01359 inline
01360 unsigned int
01361 sc_fxval::to_uint() const
01362 {
01363 SC_FXVAL_OBSERVER_READ_( *this )
01364 return static_cast<unsigned int>( m_rep->to_double() );
01365 }
01366
01367 inline
01368 long
01369 sc_fxval::to_long() const
01370 {
01371 SC_FXVAL_OBSERVER_READ_( *this )
01372 return static_cast<long>( m_rep->to_double() );
01373 }
01374
01375 inline
01376 unsigned long
01377 sc_fxval::to