68 class vcd_sc_fxnum_trace;
69 class vcd_sc_fxnum_fast_trace;
70 class wif_sc_fxnum_trace;
71 class wif_sc_fxnum_fast_trace;
79 class sc_fxnum_bitref;
80 class sc_fxnum_fast_bitref;
81 class sc_fxnum_subref;
82 class sc_fxnum_fast_subref;
116 #define DECL_ASN_OP_T(op,tp) \
117 sc_fxnum_bitref& operator op ( tp );
119 #define DECL_ASN_OP(op) \
120 DECL_ASN_OP_T(op,const sc_fxnum_bitref&) \
121 DECL_ASN_OP_T(op,const sc_fxnum_fast_bitref&) \
122 DECL_ASN_OP_T(op,const sc_bit&) \
123 DECL_ASN_OP_T(op,bool)
137 operator bool()
const;
142 void print( ::std::ostream& = ::std::cout )
const;
143 void scan( ::std::istream& = ::std::cin );
144 void dump( ::std::ostream& = ::std::cout )
const;
187 #define DECL_ASN_OP_T(op,tp) \
188 sc_fxnum_fast_bitref& operator op ( tp );
190 #define DECL_ASN_OP(op) \
191 DECL_ASN_OP_T(op,const sc_fxnum_bitref&) \
192 DECL_ASN_OP_T(op,const sc_fxnum_fast_bitref&) \
193 DECL_ASN_OP_T(op,const sc_bit&) \
194 DECL_ASN_OP_T(op,bool)
208 operator bool()
const;
213 void print( ::std::ostream& = ::std::cout )
const;
214 void scan( ::std::istream& = ::std::cin );
215 void dump( ::std::ostream& = ::std::cout )
const;
263 #define DECL_ASN_OP_T(tp) \
264 sc_fxnum_subref& operator = ( tp );
286 #define DECL_ASN_OP_T_A(op,tp) \
287 sc_fxnum_subref& operator op ## = ( tp );
289 #define DECL_ASN_OP_A(op) \
290 DECL_ASN_OP_T_A(op,const sc_fxnum_subref&) \
291 DECL_ASN_OP_T_A(op,const sc_fxnum_fast_subref&) \
292 DECL_ASN_OP_T_A(op,const sc_bv_base&) \
293 DECL_ASN_OP_T_A(op,const sc_lv_base&)
299 #undef DECL_ASN_OP_T_A
305 #define DECL_REL_OP_T(op,tp) \
306 friend bool operator op ( const sc_fxnum_subref&, tp ); \
307 friend bool operator op ( tp, const sc_fxnum_subref& );
309 #define DECL_REL_OP(op) \
310 friend bool operator op ( const sc_fxnum_subref&, \
311 const sc_fxnum_subref& ); \
312 friend bool operator op ( const sc_fxnum_subref&, \
313 const sc_fxnum_fast_subref& ); \
314 DECL_REL_OP_T(op,const sc_bv_base&) \
315 DECL_REL_OP_T(op,const sc_lv_base&) \
316 DECL_REL_OP_T(op,const char*) \
317 DECL_REL_OP_T(op,const bool*) \
318 DECL_REL_OP_T(op,const sc_signed&) \
319 DECL_REL_OP_T(op,const sc_unsigned&) \
320 DECL_REL_OP_T(op,int) \
321 DECL_REL_OP_T(op,unsigned int) \
322 DECL_REL_OP_T(op,long) \
323 DECL_REL_OP_T(op,unsigned long)
356 #ifdef SC_DT_DEPRECATED
357 int to_signed()
const;
358 unsigned int to_unsigned()
const;
373 void print( ::std::ostream& = ::std::cout )
const;
374 void scan( ::std::istream& = ::std::cin );
375 void dump( ::std::ostream& = ::std::cout )
const;
426 #define DECL_ASN_OP_T(tp) \
427 sc_fxnum_fast_subref& operator = ( tp );
449 #define DECL_ASN_OP_T_A(op,tp) \
450 sc_fxnum_fast_subref& operator op ## = ( tp );
452 #define DECL_ASN_OP_A(op) \
453 DECL_ASN_OP_T_A(op,const sc_fxnum_subref&) \
454 DECL_ASN_OP_T_A(op,const sc_fxnum_fast_subref&) \
455 DECL_ASN_OP_T_A(op,const sc_bv_base&) \
456 DECL_ASN_OP_T_A(op,const sc_lv_base&)
462 #undef DECL_ASN_OP_T_A
468 #define DECL_REL_OP_T(op,tp) \
469 friend bool operator op ( const sc_fxnum_fast_subref&, tp ); \
470 friend bool operator op ( tp, const sc_fxnum_fast_subref& );
472 #define DECL_REL_OP(op) \
473 friend bool operator op ( const sc_fxnum_fast_subref&, \
474 const sc_fxnum_fast_subref& ); \
475 friend bool operator op ( const sc_fxnum_fast_subref&, \
476 const sc_fxnum_subref& ); \
477 DECL_REL_OP_T(op,const sc_bv_base&) \
478 DECL_REL_OP_T(op,const sc_lv_base&) \
479 DECL_REL_OP_T(op,const char*) \
480 DECL_REL_OP_T(op,const bool*) \
481 DECL_REL_OP_T(op,const sc_signed&) \
482 DECL_REL_OP_T(op,const sc_unsigned&) \
483 DECL_REL_OP_T(op,int) \
484 DECL_REL_OP_T(op,unsigned int) \
485 DECL_REL_OP_T(op,long) \
486 DECL_REL_OP_T(op,unsigned long)
519 #ifdef SC_DT_DEPRECATED
520 int to_signed()
const;
521 unsigned int to_unsigned()
const;
531 operator sc_bv_base()
const;
536 void print( ::std::ostream& = ::std::cout )
const;
537 void scan( ::std::istream& = ::std::cin );
538 void dump( ::std::ostream& = ::std::cout )
const;
551 sc_fxnum_fast_subref();
588 #define DECL_CTOR_T(tp) \
590 const sc_fxtype_params&, \
592 const sc_fxcast_switch&, \
593 sc_fxnum_observer* );
606 #ifndef SC_FX_EXCLUDE_OTHER
639 #define DECL_BIN_OP_T(op,tp) \
640 friend const sc_fxval operator op ( const sc_fxnum&, tp ); \
641 friend const sc_fxval operator op ( tp, const sc_fxnum& );
643 #ifndef SC_FX_EXCLUDE_OTHER
644 #define DECL_BIN_OP_OTHER(op) \
645 DECL_BIN_OP_T(op,int64) \
646 DECL_BIN_OP_T(op,uint64) \
647 DECL_BIN_OP_T(op,const sc_int_base&) \
648 DECL_BIN_OP_T(op,const sc_uint_base&) \
649 DECL_BIN_OP_T(op,const sc_signed&) \
650 DECL_BIN_OP_T(op,const sc_unsigned&)
652 #define DECL_BIN_OP_OTHER(op)
655 #define DECL_BIN_OP(op,dummy) \
656 friend const sc_fxval operator op ( const sc_fxnum&, const sc_fxnum& ); \
657 DECL_BIN_OP_T(op,int) \
658 DECL_BIN_OP_T(op,unsigned int) \
659 DECL_BIN_OP_T(op,long) \
660 DECL_BIN_OP_T(op,unsigned long) \
661 DECL_BIN_OP_T(op,float) \
662 DECL_BIN_OP_T(op,double) \
663 DECL_BIN_OP_T(op,const char*) \
664 DECL_BIN_OP_T(op,const sc_fxval&) \
665 DECL_BIN_OP_T(op,const sc_fxval_fast&) \
666 DECL_BIN_OP_T(op,const sc_fxnum_fast&) \
667 DECL_BIN_OP_OTHER(op)
677 DECL_BIN_OP_T(/,
long)
678 DECL_BIN_OP_T(/,
unsigned long)
679 DECL_BIN_OP_T(/,
float)
680 DECL_BIN_OP_T(/,
double)
681 DECL_BIN_OP_T(/,const
char*)
686 #ifndef SC_FX_EXCLUDE_OTHER
696 #undef DECL_BIN_OP_OTHER
705 #define DECL_BIN_FNC_T(fnc,tp) \
706 friend void fnc ( sc_fxval&, const sc_fxnum&, tp ); \
707 friend void fnc ( sc_fxval&, tp, const sc_fxnum& ); \
708 friend void fnc ( sc_fxnum&, const sc_fxnum&, tp ); \
709 friend void fnc ( sc_fxnum&, tp, const sc_fxnum& );
711 #ifndef SC_FX_EXCLUDE_OTHER
712 #define DECL_BIN_FNC_OTHER(fnc) \
713 DECL_BIN_FNC_T(fnc,int64) \
714 DECL_BIN_FNC_T(fnc,uint64) \
715 DECL_BIN_FNC_T(fnc,const sc_int_base&) \
716 DECL_BIN_FNC_T(fnc,const sc_uint_base&) \
717 DECL_BIN_FNC_T(fnc,const sc_signed&) \
718 DECL_BIN_FNC_T(fnc,const sc_unsigned&)
720 #define DECL_BIN_FNC_OTHER(fnc)
723 #define DECL_BIN_FNC(fnc) \
724 friend void fnc ( sc_fxval&, const sc_fxnum&, const sc_fxnum& ); \
725 friend void fnc ( sc_fxnum&, const sc_fxnum&, const sc_fxnum& ); \
726 DECL_BIN_FNC_T(fnc,int) \
727 DECL_BIN_FNC_T(fnc,unsigned int) \
728 DECL_BIN_FNC_T(fnc,long) \
729 DECL_BIN_FNC_T(fnc,unsigned long) \
730 DECL_BIN_FNC_T(fnc,float) \
731 DECL_BIN_FNC_T(fnc,double) \
732 DECL_BIN_FNC_T(fnc,const char*) \
733 DECL_BIN_FNC_T(fnc,const sc_fxval&) \
734 DECL_BIN_FNC_T(fnc,const sc_fxval_fast&) \
735 DECL_BIN_FNC_T(fnc,const sc_fxnum_fast&) \
736 DECL_BIN_FNC_OTHER(fnc)
743 #undef DECL_BIN_FNC_T
744 #undef DECL_BIN_FNC_OTHER
749 friend void lshift( sc_fxnum&,
const sc_fxnum&,
int );
750 friend void rshift( sc_fxnum&,
const sc_fxnum&,
int );
755 #define DECL_REL_OP_T(op,tp) \
756 friend bool operator op ( const sc_fxnum&, tp ); \
757 friend bool operator op ( tp, const sc_fxnum& );
759 #ifndef SC_FX_EXCLUDE_OTHER
760 #define DECL_REL_OP_OTHER(op) \
761 DECL_REL_OP_T(op,int64) \
762 DECL_REL_OP_T(op,uint64) \
763 DECL_REL_OP_T(op,const sc_int_base&) \
764 DECL_REL_OP_T(op,const sc_uint_base&) \
765 DECL_REL_OP_T(op,const sc_signed&) \
766 DECL_REL_OP_T(op,const sc_unsigned&)
768 #define DECL_REL_OP_OTHER(op)
771 #define DECL_REL_OP(op) \
772 friend bool operator op ( const sc_fxnum&, const sc_fxnum& ); \
773 DECL_REL_OP_T(op,int) \
774 DECL_REL_OP_T(op,unsigned int) \
775 DECL_REL_OP_T(op,long) \
776 DECL_REL_OP_T(op,unsigned long) \
777 DECL_REL_OP_T(op,float) \
778 DECL_REL_OP_T(op,double) \
779 DECL_REL_OP_T(op,const char*) \
780 DECL_REL_OP_T(op,const sc_fxval&) \
781 DECL_REL_OP_T(op,const sc_fxval_fast&) \
782 DECL_REL_OP_T(op,const sc_fxnum_fast&) \
783 DECL_REL_OP_OTHER(op)
793 #undef DECL_REL_OP_OTHER
799 #define DECL_ASN_OP_T(op,tp) \
800 sc_fxnum& operator op( tp );
802 #ifndef SC_FX_EXCLUDE_OTHER
803 #define DECL_ASN_OP_OTHER(op) \
804 DECL_ASN_OP_T(op,int64) \
805 DECL_ASN_OP_T(op,uint64) \
806 DECL_ASN_OP_T(op,const sc_int_base&) \
807 DECL_ASN_OP_T(op,const sc_uint_base&) \
808 DECL_ASN_OP_T(op,const sc_signed&) \
809 DECL_ASN_OP_T(op,const sc_unsigned&)
811 #define DECL_ASN_OP_OTHER(op)
814 #define DECL_ASN_OP(op) \
815 DECL_ASN_OP_T(op,int) \
816 DECL_ASN_OP_T(op,unsigned int) \
817 DECL_ASN_OP_T(op,long) \
818 DECL_ASN_OP_T(op,unsigned long) \
819 DECL_ASN_OP_T(op,float) \
820 DECL_ASN_OP_T(op,double) \
821 DECL_ASN_OP_T(op,const char*) \
822 DECL_ASN_OP_T(op,const sc_fxval&) \
823 DECL_ASN_OP_T(op,const sc_fxval_fast&) \
824 DECL_ASN_OP_T(op,const sc_fxnum&) \
825 DECL_ASN_OP_T(op,const sc_fxnum_fast&) \
826 DECL_ASN_OP_OTHER(op)
836 DECL_ASN_OP_T(>>=,
int)
839 #undef DECL_ASN_OP_OTHER
879 operator double()
const;
905 const std::string
to_dec()
const;
906 const std::string
to_bin()
const;
907 const std::string
to_oct()
const;
908 const std::string
to_hex()
const;
940 void print( ::std::ostream& = ::std::cout )
const;
941 void scan( ::std::istream& = ::std::cin );
942 void dump( ::std::ostream& = ::std::cout )
const;
978 sc_fxnum(
const sc_fxnum& );
1015 #define DECL_CTOR_T(tp) \
1016 sc_fxnum_fast( tp, \
1017 const sc_fxtype_params&, \
1019 const sc_fxcast_switch&, \
1020 sc_fxnum_fast_observer* );
1033 #ifndef SC_FX_EXCLUDE_OTHER
1061 friend void neg( sc_fxnum_fast&,
const sc_fxnum_fast& );
1066 #define DECL_BIN_OP_T(op,tp) \
1067 friend const sc_fxval_fast operator op ( const sc_fxnum_fast&, tp ); \
1068 friend const sc_fxval_fast operator op ( tp, const sc_fxnum_fast& );
1070 #ifndef SC_FX_EXCLUDE_OTHER
1071 #define DECL_BIN_OP_OTHER(op) \
1072 DECL_BIN_OP_T(op,int64) \
1073 DECL_BIN_OP_T(op,uint64) \
1074 DECL_BIN_OP_T(op,const sc_int_base&) \
1075 DECL_BIN_OP_T(op,const sc_uint_base&) \
1076 DECL_BIN_OP_T(op,const sc_signed&) \
1077 DECL_BIN_OP_T(op,const sc_unsigned&)
1079 #define DECL_BIN_OP_OTHER(op)
1082 #define DECL_BIN_OP(op,dummy) \
1083 friend const sc_fxval_fast operator op ( const sc_fxnum_fast&, \
1084 const sc_fxnum_fast& ); \
1085 DECL_BIN_OP_T(op,int) \
1086 DECL_BIN_OP_T(op,unsigned int) \
1087 DECL_BIN_OP_T(op,long) \
1088 DECL_BIN_OP_T(op,unsigned long) \
1089 DECL_BIN_OP_T(op,float) \
1090 DECL_BIN_OP_T(op,double) \
1091 DECL_BIN_OP_T(op,const char*) \
1092 DECL_BIN_OP_T(op,const sc_fxval_fast&) \
1093 DECL_BIN_OP_OTHER(op)
1099 friend const
sc_fxval_fast operator / ( const sc_fxnum_fast&,
1100 const sc_fxnum_fast& );
1101 DECL_BIN_OP_T(/,
int)
1102 DECL_BIN_OP_T(/,
unsigned int)
1103 DECL_BIN_OP_T(/,
long)
1104 DECL_BIN_OP_T(/,
unsigned long)
1105 DECL_BIN_OP_T(/,
float)
1106 DECL_BIN_OP_T(/,
double)
1107 DECL_BIN_OP_T(/,const
char*)
1110 #ifndef SC_FX_EXCLUDE_OTHER
1119 #undef DECL_BIN_OP_T
1120 #undef DECL_BIN_OP_OTHER
1129 #define DECL_BIN_FNC_T(fnc,tp) \
1130 friend void fnc ( sc_fxval_fast&, const sc_fxnum_fast&, tp ); \
1131 friend void fnc ( sc_fxval_fast&, tp, const sc_fxnum_fast& ); \
1132 friend void fnc ( sc_fxnum_fast&, const sc_fxnum_fast&, tp ); \
1133 friend void fnc ( sc_fxnum_fast&, tp, const sc_fxnum_fast& );
1135 #ifndef SC_FX_EXCLUDE_OTHER
1136 #define DECL_BIN_FNC_OTHER(fnc) \
1137 DECL_BIN_FNC_T(fnc,int64) \
1138 DECL_BIN_FNC_T(fnc,uint64) \
1139 DECL_BIN_FNC_T(fnc,const sc_int_base&) \
1140 DECL_BIN_FNC_T(fnc,const sc_uint_base&) \
1141 DECL_BIN_FNC_T(fnc,const sc_signed&) \
1142 DECL_BIN_FNC_T(fnc,const sc_unsigned&)
1144 #define DECL_BIN_FNC_OTHER(fnc)
1147 #define DECL_BIN_FNC(fnc) \
1148 friend void fnc ( sc_fxval_fast&, const sc_fxnum_fast&, \
1149 const sc_fxnum_fast& ); \
1150 friend void fnc ( sc_fxnum_fast&, const sc_fxnum_fast&, \
1151 const sc_fxnum_fast& ); \
1152 DECL_BIN_FNC_T(fnc,int) \
1153 DECL_BIN_FNC_T(fnc,unsigned int) \
1154 DECL_BIN_FNC_T(fnc,long) \
1155 DECL_BIN_FNC_T(fnc,unsigned long) \
1156 DECL_BIN_FNC_T(fnc,float) \
1157 DECL_BIN_FNC_T(fnc,double) \
1158 DECL_BIN_FNC_T(fnc,const char*) \
1159 DECL_BIN_FNC_T(fnc,const sc_fxval&) \
1160 DECL_BIN_FNC_T(fnc,const sc_fxval_fast&) \
1161 DECL_BIN_FNC_T(fnc,const sc_fxnum&) \
1162 DECL_BIN_FNC_OTHER(fnc)
1169 #undef DECL_BIN_FNC_T
1170 #undef DECL_BIN_FNC_OTHER
1175 friend void lshift( sc_fxnum_fast&,
const sc_fxnum_fast&,
int );
1176 friend void rshift( sc_fxnum_fast&,
const sc_fxnum_fast&,
int );
1181 #define DECL_REL_OP_T(op,tp) \
1182 friend bool operator op ( const sc_fxnum_fast&, tp ); \
1183 friend bool operator op ( tp, const sc_fxnum_fast& );
1185 #ifndef SC_FX_EXCLUDE_OTHER
1186 #define DECL_REL_OP_OTHER(op) \
1187 DECL_REL_OP_T(op,int64) \
1188 DECL_REL_OP_T(op,uint64) \
1189 DECL_REL_OP_T(op,const sc_int_base&) \
1190 DECL_REL_OP_T(op,const sc_uint_base&) \
1191 DECL_REL_OP_T(op,const sc_signed&) \
1192 DECL_REL_OP_T(op,const sc_unsigned&)
1194 #define DECL_REL_OP_OTHER(op)
1197 #define DECL_REL_OP(op) \
1198 friend bool operator op ( const sc_fxnum_fast&, const sc_fxnum_fast& ); \
1199 DECL_REL_OP_T(op,int) \
1200 DECL_REL_OP_T(op,unsigned int) \
1201 DECL_REL_OP_T(op,long) \
1202 DECL_REL_OP_T(op,unsigned long) \
1203 DECL_REL_OP_T(op,float) \
1204 DECL_REL_OP_T(op,double) \
1205 DECL_REL_OP_T(op,const char*) \
1206 DECL_REL_OP_T(op,const sc_fxval_fast&) \
1207 DECL_REL_OP_OTHER(op)
1216 #undef DECL_REL_OP_T
1217 #undef DECL_REL_OP_OTHER
1223 #define DECL_ASN_OP_T(op,tp) \
1224 sc_fxnum_fast& operator op( tp );
1226 #ifndef SC_FX_EXCLUDE_OTHER
1227 #define DECL_ASN_OP_OTHER(op) \
1228 DECL_ASN_OP_T(op,int64) \
1229 DECL_ASN_OP_T(op,uint64) \
1230 DECL_ASN_OP_T(op,const sc_int_base&) \
1231 DECL_ASN_OP_T(op,const sc_uint_base&) \
1232 DECL_ASN_OP_T(op,const sc_signed&) \
1233 DECL_ASN_OP_T(op,const sc_unsigned&)
1235 #define DECL_ASN_OP_OTHER(op)
1238 #define DECL_ASN_OP(op) \
1239 DECL_ASN_OP_T(op,int) \
1240 DECL_ASN_OP_T(op,unsigned int) \
1241 DECL_ASN_OP_T(op,long) \
1242 DECL_ASN_OP_T(op,unsigned long) \
1243 DECL_ASN_OP_T(op,float) \
1244 DECL_ASN_OP_T(op,double) \
1245 DECL_ASN_OP_T(op,const char*) \
1246 DECL_ASN_OP_T(op,const sc_fxval&) \
1247 DECL_ASN_OP_T(op,const sc_fxval_fast&) \
1248 DECL_ASN_OP_T(op,const sc_fxnum&) \
1249 DECL_ASN_OP_T(op,const sc_fxnum_fast&) \
1250 DECL_ASN_OP_OTHER(op)
1260 DECL_ASN_OP_T(>>=,
int)
1262 #undef DECL_ASN_OP_T
1263 #undef DECL_ASN_OP_OTHER
1303 operator double()
const;
1329 const std::string
to_dec()
const;
1330 const std::string
to_bin()
const;
1331 const std::string
to_oct()
const;
1332 const std::string
to_hex()
const;
1364 void print( ::std::ostream& = ::std::cout )
const;
1365 void scan( ::std::istream& = ::std::cin );
1366 void dump( ::std::ostream& = ::std::cout )
const;
1381 bool get_slice(
int,
int, sc_bv_base& )
const;
1382 bool set_slice(
int,
int,
const sc_bv_base& );
1392 scfx_params m_params;
1396 mutable sc_fxnum_fast_observer* m_observer;
1402 sc_fxnum_fast(
const sc_fxnum_fast& );
1417 sc_fxnum_bitref::sc_fxnum_bitref( sc_fxnum& num_,
int idx_ )
1418 : m_num( num_ ), m_idx( idx_ )
1426 : m_num( a.m_num ), m_idx( a.m_idx )
1459 set( static_cast<bool>( a ) );
1480 set( get() && b.get() );
1491 set( get() && b.get() );
1501 set( get() && static_cast<
bool>( b ) );
1523 set( get() || b.get() );
1534 set( get() || b.get() );
1544 set( get() || static_cast<
bool>( b ) );
1566 set( get() != b.get() );
1577 set( get() != b.get() );
1587 set( get() != static_cast<
bool>( b ) );
1639 sc_fxnum_fast_bitref::sc_fxnum_fast_bitref( sc_fxnum_fast& num_,
int idx_ )
1640 : m_num( num_ ), m_idx( idx_ )
1648 : m_num( a.m_num ), m_idx( a.m_idx )
1681 set( static_cast<bool>( a ) );
1702 set( get() && b.get() );
1713 set( get() && b.get() );
1723 set( get() && static_cast<
bool>( b ) );
1745 set( get() || b.get() );
1756 set( get() || b.get() );
1766 set( get() || static_cast<
bool>( b ) );
1788 set( get() != b.get() );
1799 set( get() != b.get() );
1809 set( get() != static_cast<
bool>( b ) );
1862 sc_fxnum_subref::sc_fxnum_subref( sc_fxnum& num_,
int from_,
int to_ )
1863 : m_num( num_ ), m_from( from_ ), m_to( to_ ),
1864 m_bv( *new sc_bv_base(
sc_max( m_from, m_to ) -
1865 sc_min( m_from, m_to ) + 1 ) )
1873 : m_num( a.m_num ), m_from( a.m_from ), m_to( a.m_to ),
1904 sc_fxnum_subref::operator = (
const sc_fxnum_fast_subref& a )
1906 m_bv =
static_cast<sc_bv_base
>( a );
1912 #define DEFN_ASN_OP_T(tp) \
1915 sc_fxnum_subref::operator = ( tp a ) \
1919 SC_FXNUM_OBSERVER_WRITE_( m_num ) \
1939 #undef DEFN_ASN_OP_T
1942 #define DEFN_ASN_OP_T(op,tp) \
1945 sc_fxnum_subref::operator op ## = ( tp a ) \
1947 SC_FXNUM_OBSERVER_READ_( m_num ) \
1951 SC_FXNUM_OBSERVER_WRITE_( m_num ) \
1955 #define DEFN_ASN_OP(op) \
1958 sc_fxnum_subref::operator op ## = ( const sc_fxnum_subref& a ) \
1960 SC_FXNUM_OBSERVER_READ_( m_num ) \
1962 m_bv = m_bv op static_cast<sc_bv_base>( a ); \
1964 SC_FXNUM_OBSERVER_WRITE_( m_num ) \
1970 sc_fxnum_subref::operator op ## = ( const sc_fxnum_fast_subref& a ) \
1972 SC_FXNUM_OBSERVER_READ_( m_num ) \
1974 m_bv = m_bv op static_cast<sc_bv_base>( a ); \
1976 SC_FXNUM_OBSERVER_WRITE_( m_num ) \
1980 DEFN_ASN_OP_T(op,const sc_bv_base&) \
1981 DEFN_ASN_OP_T(op,const sc_lv_base&)
1987 #undef DEFN_ASN_OP_T
1993 #define DEFN_REL_OP_T(op,tp) \
1996 operator op ( const sc_fxnum_subref& a, tp b ) \
1998 return ( static_cast<sc_bv_base>( a ) op b ); \
2003 operator op ( tp a, const sc_fxnum_subref& b ) \
2005 return ( static_cast<sc_bv_base>( b ) op a ); \
2008 #define DEFN_REL_OP(op) \
2011 operator op ( const sc_fxnum_subref& a, const sc_fxnum_subref& b ) \
2013 return ( static_cast<sc_bv_base>( a ) op static_cast<sc_bv_base>( b ) ); \
2018 operator op ( const sc_fxnum_subref& a, const sc_fxnum_fast_subref& b ) \
2020 return ( static_cast<sc_bv_base>( a ) op static_cast<sc_bv_base>( b ) ); \
2023 DEFN_REL_OP_T(op,const sc_bv_base&) \
2024 DEFN_REL_OP_T(op,const sc_lv_base&) \
2025 DEFN_REL_OP_T(op,const char*) \
2026 DEFN_REL_OP_T(op,const bool*) \
2027 DEFN_REL_OP_T(op,const sc_signed&) \
2028 DEFN_REL_OP_T(op,const sc_unsigned&) \
2029 DEFN_REL_OP_T(op,int) \
2030 DEFN_REL_OP_T(op,unsigned int) \
2031 DEFN_REL_OP_T(op,long) \
2032 DEFN_REL_OP_T(op,unsigned long)
2037 #undef DEFN_REL_OP_T
2043 #define DEFN_RED_FNC(fnc) \
2046 sc_fxnum_subref::fnc() const \
2048 SC_FXNUM_OBSERVER_READ_( m_num ) \
2050 return static_cast<bool>( m_bv.fnc() ); \
2130 #ifdef SC_DT_DEPRECATED
2134 sc_fxnum_subref::to_signed()
const
2141 sc_fxnum_subref::to_unsigned()
const
2170 return m_bv.
to_string( numrep, w_prefix );
2212 sc_fxnum_fast_subref::sc_fxnum_fast_subref( sc_fxnum_fast& num_,
2213 int from_,
int to_ )
2214 : m_num( num_ ), m_from( from_ ), m_to( to_ ),
2215 m_bv( *new sc_bv_base(
sc_max( m_from, m_to ) -
2216 sc_min( m_from, m_to ) + 1 ) )
2224 : m_num( a.m_num ), m_from( a.m_from ), m_to( a.m_to ),
2263 #define DEFN_ASN_OP_T(tp) \
2265 sc_fxnum_fast_subref& \
2266 sc_fxnum_fast_subref::operator = ( tp a ) \
2270 SC_FXNUM_FAST_OBSERVER_WRITE_( m_num ) \
2290 #undef DEFN_ASN_OP_T
2293 #define DEFN_ASN_OP_T(op,tp) \
2295 sc_fxnum_fast_subref& \
2296 sc_fxnum_fast_subref::operator op ## = ( tp a ) \
2298 SC_FXNUM_FAST_OBSERVER_READ_( m_num ) \
2302 SC_FXNUM_FAST_OBSERVER_WRITE_( m_num ) \
2306 #define DEFN_ASN_OP(op) \
2308 sc_fxnum_fast_subref& \
2309 sc_fxnum_fast_subref::operator op ## = ( const sc_fxnum_subref& a ) \
2311 SC_FXNUM_FAST_OBSERVER_READ_( m_num ) \
2313 m_bv = m_bv op static_cast<sc_bv_base>( a ); \
2315 SC_FXNUM_FAST_OBSERVER_WRITE_( m_num ) \
2320 sc_fxnum_fast_subref& \
2321 sc_fxnum_fast_subref::operator op ## = ( const sc_fxnum_fast_subref& a ) \
2323 SC_FXNUM_FAST_OBSERVER_READ_( m_num ) \
2325 m_bv = m_bv op static_cast<sc_bv_base>( a ); \
2327 SC_FXNUM_FAST_OBSERVER_WRITE_( m_num ) \
2331 DEFN_ASN_OP_T(op,const sc_bv_base&) \
2332 DEFN_ASN_OP_T(op,const sc_lv_base&)
2338 #undef DEFN_ASN_OP_T
2344 #define DEFN_REL_OP_T(op,tp) \
2347 operator op ( const sc_fxnum_fast_subref& a, tp b ) \
2349 return ( static_cast<sc_bv_base>( a ) op b ); \
2354 operator op ( tp a, const sc_fxnum_fast_subref& b ) \
2356 return ( static_cast<sc_bv_base>( b ) op a ); \
2359 #define DEFN_REL_OP(op) \
2362 operator op ( const sc_fxnum_fast_subref& a, const sc_fxnum_fast_subref& b ) \
2364 return ( static_cast<sc_bv_base>( a ) op static_cast<sc_bv_base>( b ) ); \
2369 operator op ( const sc_fxnum_fast_subref& a, const sc_fxnum_subref& b ) \
2371 return ( static_cast<sc_bv_base>( a ) op static_cast<sc_bv_base>( b ) ); \
2374 DEFN_REL_OP_T(op,const sc_bv_base&) \
2375 DEFN_REL_OP_T(op,const sc_lv_base&) \
2376 DEFN_REL_OP_T(op,const char*) \
2377 DEFN_REL_OP_T(op,const bool*) \
2378 DEFN_REL_OP_T(op,const sc_signed&) \
2379 DEFN_REL_OP_T(op,const sc_unsigned&) \
2380 DEFN_REL_OP_T(op,int) \
2381 DEFN_REL_OP_T(op,unsigned int) \
2382 DEFN_REL_OP_T(op,long) \
2383 DEFN_REL_OP_T(op,unsigned long)
2388 #undef DEFN_REL_OP_T
2394 #define DEFN_RED_FNC(fnc) \
2397 sc_fxnum_fast_subref::fnc() const \
2399 SC_FXNUM_FAST_OBSERVER_READ_( m_num ) \
2401 return static_cast<bool>( m_bv.fnc() ); \
2481 #ifdef SC_DT_DEPRECATED
2485 sc_fxnum_fast_subref::to_signed()
const
2492 sc_fxnum_fast_subref::to_unsigned()
const
2521 return m_bv.
to_string( numrep, w_prefix );
2571 SC_ERROR_IF_( ! m_rep->is_normal(), sc_core::SC_ID_INVALID_FX_VALUE_ );
2573 if( m_params.cast_switch() ==
SC_ON )
2574 m_rep->cast( m_params, m_q_flag, m_o_flag );
2586 m_params( type_params_, enc_, cast_sw ),
2589 m_observer( observer_ )
2595 #define DEFN_CTOR_T(tp,arg) \
2597 sc_fxnum::sc_fxnum( tp a, \
2598 const sc_fxtype_params& type_params_, \
2600 const sc_fxcast_switch& cast_sw, \
2601 sc_fxnum_observer* observer_ ) \
2602 : m_rep( new scfx_rep( arg ) ), \
2603 m_params( type_params_, enc_, cast_sw ), \
2604 m_q_flag( false ), \
2605 m_o_flag( false ), \
2606 m_observer( observer_ ) \
2608 SC_FXNUM_OBSERVER_DEFAULT_ \
2610 SC_FXNUM_OBSERVER_CONSTRUCT_( *this ) \
2611 SC_FXNUM_OBSERVER_WRITE_( *this ) \
2614 #define DEFN_CTOR_T_A(tp) DEFN_CTOR_T(tp,a)
2615 #define DEFN_CTOR_T_B(tp) DEFN_CTOR_T(tp,*a.m_rep)
2616 #define DEFN_CTOR_T_C(tp) DEFN_CTOR_T(tp,a.to_double())
2617 #define DEFN_CTOR_T_D(tp) DEFN_CTOR_T(tp,a.value())
2630 #ifndef SC_FX_EXCLUDE_OTHER
2640 #undef DEFN_CTOR_T_A
2641 #undef DEFN_CTOR_T_B
2642 #undef DEFN_CTOR_T_C
2643 #undef DEFN_CTOR_T_D
2695 neg( sc_fxnum& c,
const sc_fxnum& a )
2707 #define DEFN_BIN_OP_T(op,fnc,tp) \
2710 operator op ( const sc_fxnum& a, tp b ) \
2712 SC_FXNUM_OBSERVER_READ_( a ) \
2713 sc_fxval tmp( b ); \
2714 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.get_rep() ) ); \
2719 operator op ( tp a, const sc_fxnum& b ) \
2721 SC_FXNUM_OBSERVER_READ_( b ) \
2722 sc_fxval tmp( a ); \
2723 return sc_fxval( sc_dt::fnc ## _scfx_rep( *tmp.get_rep(), *b.m_rep ) ); \
2726 #ifndef SC_FX_EXCLUDE_OTHER
2727 #define DEFN_BIN_OP_OTHER(op,fnc) \
2728 DEFN_BIN_OP_T(op,fnc,int64) \
2729 DEFN_BIN_OP_T(op,fnc,uint64) \
2730 DEFN_BIN_OP_T(op,fnc,const sc_int_base&) \
2731 DEFN_BIN_OP_T(op,fnc,const sc_uint_base&) \
2732 DEFN_BIN_OP_T(op,fnc,const sc_signed&) \
2733 DEFN_BIN_OP_T(op,fnc,const sc_unsigned&)
2735 #define DEFN_BIN_OP_OTHER(op,fnc)
2738 #define DEFN_BIN_OP(op,fnc) \
2741 operator op ( const sc_fxnum& a, const sc_fxnum& b ) \
2743 SC_FXNUM_OBSERVER_READ_( a ) \
2744 SC_FXNUM_OBSERVER_READ_( b ) \
2745 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.m_rep ) ); \
2750 operator op ( const sc_fxnum& a, const sc_fxval& b ) \
2752 SC_FXNUM_OBSERVER_READ_( a ) \
2753 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.get_rep() ) ); \
2758 operator op ( const sc_fxval& a, const sc_fxnum& b ) \
2760 SC_FXNUM_OBSERVER_READ_( b ) \
2761 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.get_rep(), *b.m_rep ) ); \
2764 DEFN_BIN_OP_T(op,fnc,int) \
2765 DEFN_BIN_OP_T(op,fnc,unsigned int) \
2766 DEFN_BIN_OP_T(op,fnc,long) \
2767 DEFN_BIN_OP_T(op,fnc,unsigned long) \
2768 DEFN_BIN_OP_T(op,fnc,float) \
2769 DEFN_BIN_OP_T(op,fnc,double) \
2770 DEFN_BIN_OP_T(op,fnc,const char*) \
2771 DEFN_BIN_OP_T(op,fnc,const sc_fxval_fast&) \
2772 DEFN_BIN_OP_T(op,fnc,const sc_fxnum_fast&) \
2773 DEFN_BIN_OP_OTHER(op,fnc)
2782 operator / ( const sc_fxnum& a, const sc_fxnum& b )
2807 DEFN_BIN_OP_T(/,div,
long)
2808 DEFN_BIN_OP_T(/,div,
unsigned long)
2809 DEFN_BIN_OP_T(/,div,
float)
2810 DEFN_BIN_OP_T(/,div,
double)
2811 DEFN_BIN_OP_T(/,div,const
char*)
2812 DEFN_BIN_OP_T(/,div,const sc_fxval_fast&)
2813 DEFN_BIN_OP_T(/,div,const sc_fxnum_fast&)
2815 #ifndef SC_FX_EXCLUDE_OTHER
2817 DEFN_BIN_OP_T(/,div,
uint64)
2818 DEFN_BIN_OP_T(/,div,const sc_int_base&)
2819 DEFN_BIN_OP_T(/,div,const sc_uint_base&)
2820 DEFN_BIN_OP_T(/,div,const sc_signed&)
2821 DEFN_BIN_OP_T(/,div,const sc_unsigned&)
2824 #undef DEFN_BIN_OP_T
2825 #undef DEFN_BIN_OP_OTHER
2848 #define DEFN_BIN_FNC_T(fnc,tp) \
2851 fnc ( sc_fxval& c, const sc_fxnum& a, tp b ) \
2853 SC_FXNUM_OBSERVER_READ_( a ) \
2854 sc_fxval tmp( b ); \
2855 c.set_rep( sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.get_rep() ) ); \
2860 fnc ( sc_fxval& c, tp a, const sc_fxnum& b ) \
2862 SC_FXNUM_OBSERVER_READ_( b ) \
2863 sc_fxval tmp( a ); \
2864 c.set_rep( sc_dt::fnc ## _scfx_rep( *tmp.get_rep(), *b.m_rep ) ); \
2869 fnc ( sc_fxnum& c, const sc_fxnum& a, tp b ) \
2871 SC_FXNUM_OBSERVER_READ_( a ) \
2872 sc_fxval tmp( b ); \
2874 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.get_rep() ); \
2876 SC_FXNUM_OBSERVER_WRITE_( c ) \
2881 fnc ( sc_fxnum& c, tp a, const sc_fxnum& b ) \
2883 SC_FXNUM_OBSERVER_READ_( b ) \
2884 sc_fxval tmp( a ); \
2886 c.m_rep = sc_dt::fnc ## _scfx_rep( *tmp.get_rep(), *b.m_rep ); \
2888 SC_FXNUM_OBSERVER_WRITE_( c ) \
2891 #ifndef SC_FX_EXCLUDE_OTHER
2892 #define DEFN_BIN_FNC_OTHER(fnc) \
2893 DEFN_BIN_FNC_T(fnc,int64) \
2894 DEFN_BIN_FNC_T(fnc,uint64) \
2895 DEFN_BIN_FNC_T(fnc,const sc_int_base&) \
2896 DEFN_BIN_FNC_T(fnc,const sc_uint_base&) \
2897 DEFN_BIN_FNC_T(fnc,const sc_signed&) \
2898 DEFN_BIN_FNC_T(fnc,const sc_unsigned&)
2900 #define DEFN_BIN_FNC_OTHER(fnc)
2903 #define DEFN_BIN_FNC(fnc) \
2906 fnc ( sc_fxval& c, const sc_fxnum& a, const sc_fxnum& b ) \
2908 SC_FXNUM_OBSERVER_READ_( a ) \
2909 SC_FXNUM_OBSERVER_READ_( b ) \
2910 c.set_rep( sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.m_rep ) ); \
2915 fnc ( sc_fxnum& c, const sc_fxnum& a, const sc_fxnum& b ) \
2917 SC_FXNUM_OBSERVER_READ_( a ) \
2918 SC_FXNUM_OBSERVER_READ_( b ) \
2920 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.m_rep ); \
2922 SC_FXNUM_OBSERVER_WRITE_( c ) \
2927 fnc ( sc_fxval& c, const sc_fxnum& a, const sc_fxval& b ) \
2929 SC_FXNUM_OBSERVER_READ_( a ) \
2930 c.set_rep( sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.get_rep() ) ); \
2935 fnc ( sc_fxval& c, const sc_fxval& a, const sc_fxnum& b ) \
2937 SC_FXNUM_OBSERVER_READ_( b ) \
2938 c.set_rep( sc_dt::fnc ## _scfx_rep( *a.get_rep(), *b.m_rep ) ); \
2943 fnc ( sc_fxnum& c, const sc_fxnum& a, const sc_fxval& b ) \
2945 SC_FXNUM_OBSERVER_READ_( a ) \
2947 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.get_rep() ); \
2949 SC_FXNUM_OBSERVER_WRITE_( c ) \
2954 fnc ( sc_fxnum& c, const sc_fxval& a, const sc_fxnum& b ) \
2956 SC_FXNUM_OBSERVER_READ_( b ) \
2958 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.get_rep(), *b.m_rep ); \
2960 SC_FXNUM_OBSERVER_WRITE_( c ) \
2963 DEFN_BIN_FNC_T(fnc,int) \
2964 DEFN_BIN_FNC_T(fnc,unsigned int) \
2965 DEFN_BIN_FNC_T(fnc,long) \
2966 DEFN_BIN_FNC_T(fnc,unsigned long) \
2967 DEFN_BIN_FNC_T(fnc,float) \
2968 DEFN_BIN_FNC_T(fnc,double) \
2969 DEFN_BIN_FNC_T(fnc,const char*) \
2970 DEFN_BIN_FNC_T(fnc,const sc_fxval_fast&) \
2971 DEFN_BIN_FNC_T(fnc,const sc_fxnum_fast&) \
2972 DEFN_BIN_FNC_OTHER(fnc)
2979 #undef DEFN_BIN_FNC_T
2980 #undef DEFN_BIN_FNC_OTHER
3002 lshift( sc_fxnum& c,
const sc_fxnum& a,
int b )
3013 rshift( sc_fxnum& c,
const sc_fxnum& a,
int b )
3025 #define DEFN_REL_OP_T(op,ret,tp) \
3028 operator op ( const sc_fxnum& a, tp b ) \
3030 SC_FXNUM_OBSERVER_READ_( a ) \
3031 sc_fxval tmp( b ); \
3032 int result = sc_dt::cmp_scfx_rep( *a.m_rep, *tmp.get_rep() ); \
3038 operator op ( tp a, const sc_fxnum& b ) \
3040 SC_FXNUM_OBSERVER_READ_( b ) \
3041 sc_fxval tmp( a ); \
3042 int result = sc_dt::cmp_scfx_rep( *tmp.get_rep(), *b.m_rep ); \
3046 #ifndef SC_FX_EXCLUDE_OTHER
3047 #define DEFN_REL_OP_OTHER(op,ret) \
3048 DEFN_REL_OP_T(op,ret,int64) \
3049 DEFN_REL_OP_T(op,ret,uint64) \
3050 DEFN_REL_OP_T(op,ret,const sc_int_base&) \
3051 DEFN_REL_OP_T(op,ret,const sc_uint_base&) \
3052 DEFN_REL_OP_T(op,ret,const sc_signed&) \
3053 DEFN_REL_OP_T(op,ret,const sc_unsigned&)
3055 #define DEFN_REL_OP_OTHER(op,ret)
3058 #define DEFN_REL_OP(op,ret) \
3061 operator op ( const sc_fxnum& a, const sc_fxnum& b ) \
3063 SC_FXNUM_OBSERVER_READ_( a ) \
3064 SC_FXNUM_OBSERVER_READ_( b ) \
3065 int result = sc_dt::cmp_scfx_rep( *a.m_rep, *b.m_rep ); \
3071 operator op ( const sc_fxnum& a, const sc_fxval& b ) \
3073 SC_FXNUM_OBSERVER_READ_( a ) \
3074 int result = sc_dt::cmp_scfx_rep( *a.m_rep, *b.get_rep() ); \
3080 operator op ( const sc_fxval& a, const sc_fxnum& b ) \
3082 SC_FXNUM_OBSERVER_READ_( b ) \
3083 int result = sc_dt::cmp_scfx_rep( *a.get_rep(), *b.m_rep ); \
3087 DEFN_REL_OP_T(op,ret,int) \
3088 DEFN_REL_OP_T(op,ret,unsigned int) \
3089 DEFN_REL_OP_T(op,ret,long) \
3090 DEFN_REL_OP_T(op,ret,unsigned long) \
3091 DEFN_REL_OP_T(op,ret,float) \
3092 DEFN_REL_OP_T(op,ret,double) \
3093 DEFN_REL_OP_T(op,ret,const char*) \
3094 DEFN_REL_OP_T(op,ret,const sc_fxval_fast&) \
3095 DEFN_REL_OP_T(op,ret,const sc_fxnum_fast&) \
3096 DEFN_REL_OP_OTHER(op,ret)
3101 DEFN_REL_OP(>=,result >= 0 && result != 2)
3102 DEFN_REL_OP(==,result == 0)
3103 DEFN_REL_OP(!=,result != 0)
3105 #undef DEFN_REL_OP_T
3106 #undef DEFN_REL_OP_OTHER
3114 sc_fxnum::operator = (
const sc_fxnum& a )
3128 sc_fxnum::operator = (
const sc_fxval& a )
3130 *m_rep = *a.get_rep();
3136 #define DEFN_ASN_OP_T(tp) \
3139 sc_fxnum::operator = ( tp a ) \
3141 sc_fxval tmp( a ); \
3142 *m_rep = *tmp.get_rep(); \
3144 SC_FXNUM_OBSERVER_WRITE_( *this ) \
3157 #ifndef SC_FX_EXCLUDE_OTHER
3166 #undef DEFN_ASN_OP_T
3169 #define DEFN_ASN_OP_T(op,fnc,tp) \
3172 sc_fxnum::operator op ( tp b ) \
3174 SC_FXNUM_OBSERVER_READ_( *this ) \
3175 sc_fxval tmp( b ); \
3176 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *tmp.get_rep() ); \
3180 SC_FXNUM_OBSERVER_WRITE_( *this ) \
3184 #ifndef SC_FX_EXCLUDE_OTHER
3185 #define DEFN_ASN_OP_OTHER(op,fnc) \
3186 DEFN_ASN_OP_T(op,fnc,int64) \
3187 DEFN_ASN_OP_T(op,fnc,uint64) \
3188 DEFN_ASN_OP_T(op,fnc,const sc_int_base&) \
3189 DEFN_ASN_OP_T(op,fnc,const sc_uint_base&) \
3190 DEFN_ASN_OP_T(op,fnc,const sc_signed&) \
3191 DEFN_ASN_OP_T(op,fnc,const sc_unsigned&)
3193 #define DEFN_ASN_OP_OTHER(op,fnc)
3196 #define DEFN_ASN_OP(op,fnc) \
3199 sc_fxnum::operator op ( const sc_fxnum& b ) \
3201 SC_FXNUM_OBSERVER_READ_( *this ) \
3202 SC_FXNUM_OBSERVER_READ_( b ) \
3203 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *b.m_rep ); \
3207 SC_FXNUM_OBSERVER_WRITE_( *this ) \
3213 sc_fxnum::operator op ( const sc_fxval& b ) \
3215 SC_FXNUM_OBSERVER_READ_( *this ) \
3216 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *b.get_rep() ); \
3220 SC_FXNUM_OBSERVER_WRITE_( *this ) \
3224 DEFN_ASN_OP_T(op,fnc,int) \
3225 DEFN_ASN_OP_T(op,fnc,unsigned int) \
3226 DEFN_ASN_OP_T(op,fnc,long) \
3227 DEFN_ASN_OP_T(op,fnc,unsigned long) \
3228 DEFN_ASN_OP_T(op,fnc,float) \
3229 DEFN_ASN_OP_T(op,fnc,double) \
3230 DEFN_ASN_OP_T(op,fnc,const char*) \
3231 DEFN_ASN_OP_T(op,fnc,const sc_fxval_fast&) \
3232 DEFN_ASN_OP_T(op,fnc,const sc_fxnum_fast&) \
3233 DEFN_ASN_OP_OTHER(op,fnc)
3240 #undef DEFN_ASN_OP_T
3241 #undef DEFN_ASN_OP_OTHER
3247 sc_fxnum::operator <<= (
int b )
3258 sc_fxnum::operator >>= (
int b )
3272 sc_fxnum::operator ++ (
int )
3311 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3313 i - m_params.
fwl() );
3320 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3328 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3330 i - m_params.
fwl() );
3337 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3348 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3349 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3352 i - m_params.
fwl(), j - m_params.
fwl() );
3359 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3360 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3369 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3370 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3373 i - m_params.
fwl(), j - m_params.
fwl() );
3380 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3381 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3405 return this->
range( m_params.
wl() - 1, 0 );
3412 return this->
range( m_params.
wl() - 1, 0 );
3419 sc_fxnum::operator double()
const
3433 return static_cast<short>( m_rep->
to_double() );
3441 return static_cast<unsigned short>( m_rep->
to_double() );
3449 return static_cast<int>( m_rep->
to_double() );
3465 return static_cast<unsigned int>( m_rep->
to_double() );
3481 return static_cast<long>( m_rep->
to_double() );
3489 return static_cast<unsigned long>( m_rep->
to_double() );
3497 return static_cast<float>( m_rep->
to_double() );
3566 return m_params.
wl();
3573 return m_params.
iwl();
3580 return m_params.
q_mode();
3587 return m_params.
o_mode();
3594 return m_params.
n_bits();
3639 return m_rep->
set( i, m_params );
3641 return m_rep->
clear( i, m_params );
3649 return m_rep->
get_slice( i, j, m_params, bv );
3656 return m_rep->
set_slice( i, j, m_params, bv );
3684 sc_fxnum_fast_observer*
3699 m_params( type_params_, enc_, cast_sw ),
3702 m_observer( observer_ )
3709 sc_fxnum_fast::sc_fxnum_fast(
const sc_fxnum_fast& a,
3715 m_params( type_params_, enc_, cast_sw ),
3718 m_observer( observer_ )
3727 #define DEFN_CTOR_T(tp,arg) \
3729 sc_fxnum_fast::sc_fxnum_fast( tp a, \
3730 const sc_fxtype_params& type_params_, \
3732 const sc_fxcast_switch& cast_sw, \
3733 sc_fxnum_fast_observer* observer_ ) \
3735 m_params( type_params_, enc_, cast_sw ), \
3736 m_q_flag( false ), \
3737 m_o_flag( false ), \
3738 m_observer( observer_ ) \
3740 SC_FXNUM_FAST_OBSERVER_DEFAULT_ \
3742 SC_FXNUM_FAST_OBSERVER_CONSTRUCT_(*this) \
3743 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \
3746 #define DEFN_CTOR_T_A(tp) DEFN_CTOR_T(tp,static_cast<double>( a ))
3747 #define DEFN_CTOR_T_B(tp) DEFN_CTOR_T(tp,sc_fxval_fast::from_string( a ))
3748 #define DEFN_CTOR_T_C(tp) DEFN_CTOR_T(tp,a.to_double())
3760 #ifndef SC_FX_EXCLUDE_OTHER
3770 #undef DEFN_CTOR_T_A
3771 #undef DEFN_CTOR_T_B
3772 #undef DEFN_CTOR_T_C
3773 #undef DEFN_CTOR_T_D
3774 #undef DEFN_CTOR_T_E
3825 neg( sc_fxnum_fast& c,
const sc_fxnum_fast& a )
3828 c.m_val = - a.m_val;
3836 #define DEFN_BIN_OP_T(op,tp) \
3838 const sc_fxval_fast \
3839 operator op ( const sc_fxnum_fast& a, tp b ) \
3841 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
3842 sc_fxval_fast tmp( b ); \
3843 return sc_fxval_fast( a.m_val op tmp.get_val() ); \
3847 const sc_fxval_fast \
3848 operator op ( tp a, const sc_fxnum_fast& b ) \
3850 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
3851 sc_fxval_fast tmp( a ); \
3852 return sc_fxval_fast( tmp.get_val() op b.m_val ); \
3855 #ifndef SC_FX_EXCLUDE_OTHER
3856 #define DEFN_BIN_OP_OTHER(op) \
3857 DEFN_BIN_OP_T(op,int64) \
3858 DEFN_BIN_OP_T(op,uint64) \
3859 DEFN_BIN_OP_T(op,const sc_int_base&) \
3860 DEFN_BIN_OP_T(op,const sc_uint_base&) \
3861 DEFN_BIN_OP_T(op,const sc_signed&) \
3862 DEFN_BIN_OP_T(op,const sc_unsigned&)
3864 #define DEFN_BIN_OP_OTHER(op)
3867 #define DEFN_BIN_OP(op,dummy) \
3869 const sc_fxval_fast \
3870 operator op ( const sc_fxnum_fast& a, const sc_fxnum_fast& b ) \
3872 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
3873 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
3874 return sc_fxval_fast( a.m_val op b.m_val ); \
3878 const sc_fxval_fast \
3879 operator op ( const sc_fxnum_fast& a, const sc_fxval_fast& b ) \
3881 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
3882 return sc_fxval_fast( a.m_val op b.get_val() ); \
3886 const sc_fxval_fast \
3887 operator op ( const sc_fxval_fast& a, const sc_fxnum_fast& b ) \
3889 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
3890 return sc_fxval_fast( a.get_val() op b.m_val ); \
3893 DEFN_BIN_OP_T(op,int) \
3894 DEFN_BIN_OP_T(op,unsigned int) \
3895 DEFN_BIN_OP_T(op,long) \
3896 DEFN_BIN_OP_T(op,unsigned long) \
3897 DEFN_BIN_OP_T(op,float) \
3898 DEFN_BIN_OP_T(op,double) \
3899 DEFN_BIN_OP_T(op,const char*) \
3900 DEFN_BIN_OP_OTHER(op)
3908 operator / ( const sc_fxnum_fast& a, const sc_fxnum_fast& b )
3932 DEFN_BIN_OP_T(/,
unsigned int)
3933 DEFN_BIN_OP_T(/,
long)
3934 DEFN_BIN_OP_T(/,
unsigned long)
3935 DEFN_BIN_OP_T(/,
float)
3936 DEFN_BIN_OP_T(/,
double)
3937 DEFN_BIN_OP_T(/,const
char*)
3939 #ifndef SC_FX_EXCLUDE_OTHER
3942 DEFN_BIN_OP_T(/,const sc_int_base&)
3943 DEFN_BIN_OP_T(/,const sc_uint_base&)
3944 DEFN_BIN_OP_T(/,const sc_signed&)
3945 DEFN_BIN_OP_T(/,const sc_unsigned&)
3948 #undef DEFN_BIN_OP_T
3949 #undef DEFN_BIN_OP_OTHER
3972 #define DEFN_BIN_FNC_T(fnc,op,tp) \
3975 fnc ( sc_fxval_fast& c, const sc_fxnum_fast& a, tp b ) \
3977 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
3978 sc_fxval_fast tmp( b ); \
3979 c.set_val( a.m_val op tmp.get_val() ); \
3984 fnc ( sc_fxval_fast& c, tp a, const sc_fxnum_fast& b ) \
3986 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
3987 sc_fxval_fast tmp( a ); \
3988 c.set_val( tmp.get_val() op b.m_val ); \
3993 fnc ( sc_fxnum_fast& c, const sc_fxnum_fast& a, tp b ) \
3995 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
3996 sc_fxval_fast tmp( b ); \
3997 c.m_val = a.m_val op tmp.get_val(); \
3999 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \
4004 fnc ( sc_fxnum_fast& c, tp a, const sc_fxnum_fast& b ) \
4006 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
4007 sc_fxval_fast tmp( a ); \
4008 c.m_val = tmp.get_val() op b.m_val; \
4010 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \
4013 #ifndef SC_FX_EXCLUDE_OTHER
4014 #define DEFN_BIN_FNC_OTHER(fnc,op) \
4015 DEFN_BIN_FNC_T(fnc,op,int64) \
4016 DEFN_BIN_FNC_T(fnc,op,uint64) \
4017 DEFN_BIN_FNC_T(fnc,op,const sc_int_base&) \
4018 DEFN_BIN_FNC_T(fnc,op,const sc_uint_base&) \
4019 DEFN_BIN_FNC_T(fnc,op,const sc_signed&) \
4020 DEFN_BIN_FNC_T(fnc,op,const sc_unsigned&)
4022 #define DEFN_BIN_FNC_OTHER(fnc,op)
4025 #define DEFN_BIN_FNC(fnc,op) \
4028 fnc ( sc_fxval_fast& c, const sc_fxnum_fast& a, const sc_fxnum_fast& b ) \
4030 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
4031 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
4032 c.set_val( a.m_val op b.m_val ); \
4037 fnc ( sc_fxnum_fast& c, const sc_fxnum_fast& a, const sc_fxnum_fast& b ) \
4039 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
4040 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
4041 c.m_val = a.m_val op b.m_val; \
4043 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \
4048 fnc ( sc_fxval_fast& c, const sc_fxnum_fast& a, const sc_fxval_fast& b ) \
4050 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
4051 c.set_val( a.m_val op b.get_val() ); \
4056 fnc ( sc_fxval_fast& c, const sc_fxval_fast& a, const sc_fxnum_fast& b ) \
4058 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
4059 c.set_val( a.get_val() op b.m_val ); \
4064 fnc ( sc_fxnum_fast& c, const sc_fxnum_fast& a, const sc_fxval_fast& b ) \
4066 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
4067 c.m_val = a.m_val op b.get_val(); \
4069 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \
4074 fnc ( sc_fxnum_fast& c, const sc_fxval_fast& a, const sc_fxnum_fast& b ) \
4076 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
4077 c.m_val = a.get_val() op b.m_val; \
4079 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \
4082 DEFN_BIN_FNC_T(fnc,op,int) \
4083 DEFN_BIN_FNC_T(fnc,op,unsigned int) \
4084 DEFN_BIN_FNC_T(fnc,op,long) \
4085 DEFN_BIN_FNC_T(fnc,op,unsigned long) \
4086 DEFN_BIN_FNC_T(fnc,op,float) \
4087 DEFN_BIN_FNC_T(fnc,op,double) \
4088 DEFN_BIN_FNC_T(fnc,op,const char*) \
4089 DEFN_BIN_FNC_T(fnc,op,const sc_fxval&) \
4090 DEFN_BIN_FNC_T(fnc,op,const sc_fxnum&) \
4091 DEFN_BIN_FNC_OTHER(fnc,op)
4098 #undef DEFN_BIN_FNC_T
4099 #undef DEFN_BIN_FNC_OTHER
4121 lshift( sc_fxnum_fast& c,
const sc_fxnum_fast& a,
int b )
4131 rshift( sc_fxnum_fast& c,
const sc_fxnum_fast& a,
int b )
4142 #define DEFN_REL_OP_T(op,tp) \
4145 operator op ( const sc_fxnum_fast& a, tp b ) \
4147 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
4148 sc_fxval_fast tmp( b ); \
4149 return ( a.m_val op tmp.get_val() ); \
4154 operator op ( tp a, const sc_fxnum_fast& b ) \
4156 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
4157 sc_fxval_fast tmp( a ); \
4158 return ( tmp.get_val() op b.m_val ); \
4161 #ifndef SC_FX_EXCLUDE_OTHER
4162 #define DEFN_REL_OP_OTHER(op) \
4163 DEFN_REL_OP_T(op,int64) \
4164 DEFN_REL_OP_T(op,uint64) \
4165 DEFN_REL_OP_T(op,const sc_int_base&) \
4166 DEFN_REL_OP_T(op,const sc_uint_base&) \
4167 DEFN_REL_OP_T(op,const sc_signed&) \
4168 DEFN_REL_OP_T(op,const sc_unsigned&)
4170 #define DEFN_REL_OP_OTHER(op)
4173 #define DEFN_REL_OP(op) \
4176 operator op ( const sc_fxnum_fast& a, const sc_fxnum_fast& b ) \
4178 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
4179 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
4180 return ( a.m_val op b.m_val ); \
4185 operator op ( const sc_fxnum_fast& a, const sc_fxval_fast& b ) \
4187 SC_FXNUM_FAST_OBSERVER_READ_( a ) \
4188 return ( a.m_val op b.get_val() ); \
4193 operator op ( const sc_fxval_fast& a, const sc_fxnum_fast& b ) \
4195 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
4196 return ( a.get_val() op b.m_val ); \
4199 DEFN_REL_OP_T(op,int) \
4200 DEFN_REL_OP_T(op,unsigned int) \
4201 DEFN_REL_OP_T(op,long) \
4202 DEFN_REL_OP_T(op,unsigned long) \
4203 DEFN_REL_OP_T(op,float) \
4204 DEFN_REL_OP_T(op,double) \
4205 DEFN_REL_OP_T(op,const char*) \
4206 DEFN_REL_OP_OTHER(op)
4215 #undef DEFN_REL_OP_T
4216 #undef DEFN_REL_OP_OTHER
4224 sc_fxnum_fast::operator = (
const sc_fxnum_fast& a )
4240 m_val = a.get_val();
4246 #define DEFN_ASN_OP_T(tp) \
4249 sc_fxnum_fast::operator = ( tp a ) \
4251 sc_fxval_fast tmp( a ); \
4252 m_val = tmp.get_val(); \
4254 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \
4267 #ifndef SC_FX_EXCLUDE_OTHER
4276 #undef DEFN_ASN_OP_T
4279 #define DEFN_ASN_OP_T(op,tp) \
4282 sc_fxnum_fast::operator op ( tp b ) \
4284 SC_FXNUM_FAST_OBSERVER_READ_( *this ) \
4285 sc_fxval_fast tmp( b ); \
4286 m_val op tmp.get_val(); \
4288 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \
4292 #ifndef SC_FX_EXCLUDE_OTHER
4293 #define DEFN_ASN_OP_OTHER(op) \
4294 DEFN_ASN_OP_T(op,int64) \
4295 DEFN_ASN_OP_T(op,uint64) \
4296 DEFN_ASN_OP_T(op,const sc_int_base&) \
4297 DEFN_ASN_OP_T(op,const sc_uint_base&) \
4298 DEFN_ASN_OP_T(op,const sc_signed&) \
4299 DEFN_ASN_OP_T(op,const sc_unsigned&)
4301 #define DEFN_ASN_OP_OTHER(op)
4304 #define DEFN_ASN_OP(op) \
4307 sc_fxnum_fast::operator op ( const sc_fxnum_fast& b ) \
4309 SC_FXNUM_FAST_OBSERVER_READ_( *this ) \
4310 SC_FXNUM_FAST_OBSERVER_READ_( b ) \
4313 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \
4319 sc_fxnum_fast::operator op ( const sc_fxval_fast& b ) \
4321 SC_FXNUM_FAST_OBSERVER_READ_( *this ) \
4322 m_val op b.get_val(); \
4324 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \
4328 DEFN_ASN_OP_T(op,int) \
4329 DEFN_ASN_OP_T(op,unsigned int) \
4330 DEFN_ASN_OP_T(op,long) \
4331 DEFN_ASN_OP_T(op,unsigned long) \
4332 DEFN_ASN_OP_T(op,float) \
4333 DEFN_ASN_OP_T(op,double) \
4334 DEFN_ASN_OP_T(op,const char*) \
4335 DEFN_ASN_OP_T(op,const sc_fxval&) \
4336 DEFN_ASN_OP_T(op,const sc_fxnum&) \
4337 DEFN_ASN_OP_OTHER(op)
4344 #undef DEFN_ASN_OP_T
4345 #undef DEFN_ASN_OP_OTHER
4351 sc_fxnum_fast::operator <<= (
int b )
4362 sc_fxnum_fast::operator >>= (
int b )
4376 sc_fxnum_fast::operator ++ (
int )
4429 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4431 i - m_params.
fwl() );
4438 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4446 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4448 i - m_params.
fwl() );
4455 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4466 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4467 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4470 i - m_params.
fwl(), j - m_params.
fwl() );
4477 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4478 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4481 i - m_params.
fwl(), j - m_params.
fwl() );
4488 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4489 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4492 i - m_params.
fwl(), j - m_params.
fwl() );
4499 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4500 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4503 i - m_params.
fwl(), j - m_params.
fwl() );
4524 return this->
range( m_params.
wl() - 1, 0 );
4531 return this->
range( m_params.
wl() - 1, 0 );
4538 sc_fxnum_fast::operator double()
const
4552 return static_cast<short>( m_val );
4560 return static_cast<unsigned short>( m_val );
4568 return static_cast<int>( m_val );
4576 return static_cast<int64>( m_val );
4584 return static_cast<unsigned int>( m_val );
4592 return static_cast<uint64>( m_val );
4600 return static_cast<long>( m_val );
4608 return static_cast<unsigned long>( m_val );
4616 return static_cast<float>( m_val );
4636 return (
id.negative() != 0 );
4645 return id.is_zero();
4689 return m_params.
wl();
4696 return m_params.
iwl();
4703 return m_params.
q_mode();
4710 return m_params.
o_mode();
4717 return m_params.
n_bits();
4774 : m_rep( new
scfx_rep( *a.get_rep() ) ),
4775 m_observer( observer_ )
4785 : m_rep( new
scfx_rep( a.to_double() ) ),
4786 m_observer( observer_ )
4796 #define DEFN_BIN_OP_T(op,fnc,tp) \
4799 operator op ( const sc_fxval& a, tp b ) \
4801 SC_FXVAL_OBSERVER_READ_( a ) \
4802 sc_fxval tmp( b ); \
4803 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.m_rep ) ); \
4808 operator op ( tp a, const sc_fxval& b ) \
4810 SC_FXVAL_OBSERVER_READ_( b ) \
4811 sc_fxval tmp( a ); \
4812 return sc_fxval( sc_dt::fnc ## _scfx_rep( *tmp.m_rep, *b.m_rep ) ); \
4815 #define DEFN_BIN_OP(op,fnc) \
4816 DEFN_BIN_OP_T(op,fnc,const sc_fxnum_fast&)
4822 DEFN_BIN_OP_T(/,div,const sc_fxnum_fast&)
4824 #undef DEFN_BIN_OP_T
4830 #define DEFN_BIN_FNC_T(fnc,tp) \
4833 fnc ( sc_fxval& c, const sc_fxval& a, tp b ) \
4835 SC_FXVAL_OBSERVER_READ_( a ) \
4836 sc_fxval tmp( b ); \
4838 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.m_rep ); \
4839 SC_FXVAL_OBSERVER_WRITE_( c ) \
4844 fnc ( sc_fxval& c, tp a, const sc_fxval& b ) \
4846 SC_FXVAL_OBSERVER_READ_( b ) \
4847 sc_fxval tmp( a ); \
4849 c.m_rep = sc_dt::fnc ## _scfx_rep( *tmp.m_rep, *b.m_rep ); \
4850 SC_FXVAL_OBSERVER_WRITE_( c ) \
4853 #define DEFN_BIN_FNC(fnc) \
4854 DEFN_BIN_FNC_T(fnc,const sc_fxnum_fast&)
4861 #undef DEFN_BIN_FNC_T
4867 #define DEFN_REL_OP_T(op,ret,tp) \
4870 operator op ( const sc_fxval& a, tp b ) \
4872 SC_FXVAL_OBSERVER_READ_( a ) \
4873 sc_fxval tmp( b ); \
4874 int result = sc_dt::cmp_scfx_rep( *a.m_rep, *tmp.m_rep ); \
4880 operator op ( tp a, const sc_fxval& b ) \
4882 SC_FXVAL_OBSERVER_READ_( b ) \
4883 sc_fxval tmp( a ); \
4884 int result = sc_dt::cmp_scfx_rep( *tmp.m_rep, *b.m_rep ); \
4889 #define DEFN_REL_OP(op,ret) \
4890 DEFN_REL_OP_T(op,ret,const sc_fxnum_fast&)
4893 DEFN_REL_OP(<=,result <= 0)
4894 DEFN_REL_OP(>,result > 0 && result != 2)
4895 DEFN_REL_OP(>=,result >= 0 && result != 2)
4896 DEFN_REL_OP(==,result == 0)
4897 DEFN_REL_OP(!=,result != 0)
4899 #undef DEFN_REL_OP_T
4907 sc_fxval::operator = (
const sc_fxnum& a )
4909 *m_rep = *a.get_rep();
4914 #define DEFN_ASN_OP_T(tp) \
4917 sc_fxval::operator = ( tp b ) \
4919 sc_fxval tmp( b ); \
4920 *m_rep = *tmp.m_rep; \
4921 SC_FXVAL_OBSERVER_WRITE_( *this ) \
4927 #undef DEFN_ASN_OP_T
4930 #define DEFN_ASN_OP_T(op,fnc,tp) \
4933 sc_fxval::operator op ( tp b ) \
4935 SC_FXVAL_OBSERVER_READ_( *this ) \
4936 sc_fxval tmp( b ); \
4937 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *tmp.m_rep ); \
4940 SC_FXVAL_OBSERVER_WRITE_( *this ) \
4944 #define DEFN_ASN_OP(op,fnc) \
4947 sc_fxval::operator op ( const sc_fxnum& b ) \
4949 SC_FXVAL_OBSERVER_READ_( *this ) \
4950 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *b.get_rep() ); \
4953 SC_FXVAL_OBSERVER_WRITE_( *this ) \
4957 DEFN_ASN_OP_T(op,fnc,const sc_fxnum_fast&)
4964 #undef DEFN_ASN_OP_T
4979 : m_val( a.to_double() ),
4980 m_observer( observer_ )
4990 : m_val( a.get_val() ),
4991 m_observer( observer_ )
5001 #define DEFN_BIN_FNC_T(fnc,op,tp) \
5004 fnc ( sc_fxval_fast& c, const sc_fxval_fast& a, tp b ) \
5006 SC_FXVAL_FAST_OBSERVER_READ_( a ) \
5007 sc_fxval_fast tmp( b ); \
5008 c.m_val = a.m_val op tmp.m_val; \
5009 SC_FXVAL_FAST_OBSERVER_WRITE_( c ) \
5014 fnc ( sc_fxval_fast& c, tp a, const sc_fxval_fast& b ) \
5016 SC_FXVAL_FAST_OBSERVER_READ_( b ) \
5017 sc_fxval_fast tmp( a ); \
5018 c.m_val = tmp.m_val op b.m_val; \
5019 SC_FXVAL_FAST_OBSERVER_WRITE_( c ) \
5022 #define DEFN_BIN_FNC(fnc,op) \
5023 DEFN_BIN_FNC_T(fnc,op,const sc_fxval&) \
5024 DEFN_BIN_FNC_T(fnc,op,const sc_fxnum&)
5031 #undef DEFN_BIN_FNC_T
5039 sc_fxval_fast::operator = (
const sc_fxnum_fast& a )
5041 m_val = a.get_val();
5046 #define DEFN_ASN_OP_T(tp) \
5049 sc_fxval_fast::operator = ( tp a ) \
5051 sc_fxval_fast tmp( a ); \
5052 m_val = tmp.m_val; \
5053 SC_FXVAL_FAST_OBSERVER_WRITE_( *this ) \
5059 #undef DEFN_ASN_OP_T
5062 #define DEFN_ASN_OP_T(op,tp) \
5065 sc_fxval_fast::operator op ( tp b ) \
5067 SC_FXVAL_FAST_OBSERVER_READ_( *this ) \
5068 sc_fxval_fast tmp( b ); \
5069 m_val op tmp.m_val; \
5070 SC_FXVAL_FAST_OBSERVER_WRITE_( *this ) \
5074 #define DEFN_ASN_OP(op) \
5077 sc_fxval_fast::operator op ( const sc_fxnum_fast& b ) \
5079 SC_FXVAL_FAST_OBSERVER_READ_( *this ) \
5080 m_val op b.get_val(); \
5081 SC_FXVAL_FAST_OBSERVER_WRITE_( *this ) \
5085 DEFN_ASN_OP_T(op,const sc_fxnum&)
5092 #undef DEFN_ASN_OP_T
#define DEFN_ASN_OP_T(op, tp)
#define SC_FXNUM_OBSERVER_DESTRUCT_(object)
#define SC_FXNUM_FAST_OBSERVER_CONSTRUCT_(object)
sc_fxnum_fast & operator--()
sc_fxnum_fast_observer * observer() const
void dump(::std::ostream &=::std::cout) const
friend void rshift(sc_fxval_fast &, const sc_fxnum_fast &, int)
bool set_slice(int, int, const sc_bv_base &)
friend void lshift(sc_fxval_fast &, const sc_fxnum_fast &, int)
friend const sc_fxval_fast operator/(const sc_fxnum_fast &, const sc_fxnum_fast &)
friend void lshift(sc_fxval &, const sc_fxnum &, int)
const sc_fxtype_params & type_params() const
DECL_BIN_OP_T(/, int64) DECL_BIN_OP_T(/
void rshift(sc_fxval &c, const sc_fxnum &a, int b)
unsigned int to_uint() const
friend class sc_fxnum_fast
bool overflow_flag() const
const std::string to_hex() const
void unlock_observer(sc_fxnum_fast_observer *) const
const std::string to_oct() const
bool get_slice(int, int, const scfx_params &, sc_bv_base &) const
const std::string to_string() const
scfx_rep * rsh_scfx_rep(const scfx_rep &, int)
const scfx_rep * get_rep() const
const sc_fxnum_fast_subref operator()() const
bool clear(int, const scfx_params &)
#define SC_FXVAL_FAST_OBSERVER_DEFAULT_
friend class sc_fxval_fast
const std::string to_string() const
#define SC_FXNUM_OBSERVER_DEFAULT_
const scfx_rep * get_rep() const
const sc_fxcast_switch & cast_switch() const
const sc_fxval operator+() const
#define SC_FXVAL_OBSERVER_DEFAULT_
sc_fxnum_fast & operator++()
scfx_rep * lsh_scfx_rep(const scfx_rep &, int)
const sc_fxnum_bitref bit(int) const
void print(::std::ostream &=::std::cout) const
unsigned int to_uint() const
#define DECL_BIN_FNC(fnc)
scfx_rep * neg_scfx_rep(const scfx_rep &)
uint64 const sc_uint_base int b
void print(::std::ostream &=::std::cout) const
const std::string to_string() const
friend void rshift(sc_fxval &, const sc_fxnum &, int)
void observer_read() const
const sc_fxnum_subref operator()() const
#define DECL_ASN_OP_T(op, tp)
const sc_fxval_fast operator-() const
sc_fxnum_fast_observer * lock_observer() const
friend class sc_core::vcd_sc_fxnum_fast_trace
#define SC_FXNUM_OBSERVER_READ_(object)
unsigned int to_uint() const
unsigned short to_ushort() const
const sc_fxcast_switch & cast_switch() const
const std::string to_bin() const
#define SC_FXNUM_FAST_OBSERVER_WRITE_(object)
#define DEFN_BIN_OP(ret, op)
void scan(::std::istream &=::std::cin)
friend class sc_fxnum_bitref
void scan(::std::istream &=::std::cin)
#define SC_FXNUM_OBSERVER_CONSTRUCT_(object)
bool set_slice(int, int, const sc_bv_base &)
#define SC_ERROR_IF_(cnd, id)
#define SC_FXVAL_OBSERVER_WRITE_(object)
sc_fxnum_observer * observer() const
#define SC_FXVAL_FAST_OBSERVER_WRITE_(object)
friend class sc_fxnum_fast_bitref
const sc_fxval operator-() const
unsigned int to_uint() const
bool overflow_flag() const
friend const sc_fxval operator<<(const sc_fxnum &, int)
unsigned int to_uint() const
bool set_slice(int, int, const scfx_params &, const sc_bv_base &)
friend class sc_fxnum_subref
#define SC_FXNUM_FAST_OBSERVER_DESTRUCT_(object)
const sc_fxval value() const
inline::std::istream & operator>>(::std::istream &is, sc_bit &a)
const sc_fxnum_fast_subref range() const
unsigned long to_ulong() const
friend class sc_core::wif_sc_fxnum_fast_trace
void print(::std::ostream &=::std::cout) const
const T sc_min(const T &a, const T &b)
const std::string to_oct() const
bool set(int, const scfx_params &)
unsigned long to_ulong() const
#define SC_FXNUM_FAST_OBSERVER_READ_(object)
const sc_fxcast_switch & cast_switch() const
const sc_fxnum_fast_bitref bit(int) const
unsigned short to_ushort() const
scfx_rep * div_scfx_rep(const scfx_rep &, const scfx_rep &, int max_wl=SC_DEFAULT_DIV_WL_)
#define DEFN_RED_FNC(fnc)
unsigned long to_ulong() const
const sc_fxtype_params & type_params() const
#define DEFN_CTOR_T_A(tp)
#define DEFN_CTOR_T_D(tp)
#define DECL_ASN_OP_A(op)
void print(::std::ostream &=::std::cout) const
void lshift(sc_fxval &c, const sc_fxnum &a, int b)
void dump(::std::ostream &=::std::cout) const
#define DEFN_BIN_FNC(fnc)
void dump(::std::ostream &=::std::cout) const
void scan(::std::istream &=::std::cin)
const sc_fxnum_bitref operator[](int) const
void scan(::std::istream &=::std::cin)
const sc_fxtype_params & type_params() const
friend void neg(sc_fxval_fast &, const sc_fxnum_fast &)
friend const sc_fxval operator>>(const sc_fxnum &, int)
const sc_fxnum_subref range() const
void observer_read() const
const std::string to_string() const
friend class sc_core::wif_sc_fxnum_trace
const sc_fxval_fast operator+() const
const sc_fxval_fast value() const
const sc_fxnum_fast_bitref operator[](int) const
#define SC_FXNUM_FAST_OBSERVER_DEFAULT_
#define SC_FXNUM_OBSERVER_WRITE_(object)
void unlock_observer(sc_fxnum_observer *) const
sc_fxnum_observer * lock_observer() const
friend void neg(sc_fxval &, const sc_fxnum &)
bool quantization_flag() const
void print(::std::ostream &=::std::cout) const
double scfx_pow2(int exp)
#define DEFN_CTOR_T_B(tp)
void neg(sc_fxval &c, const sc_fxnum &a)
const std::string to_string() const
void print(::std::ostream &=::std::cout) const
inline::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
unsigned long to_ulong() const
const std::string to_dec() const
friend const sc_fxval_fast operator>>(const sc_fxnum_fast &, int)
friend class sc_core::vcd_sc_fxnum_trace
#define DECL_BIN_OP(op, dummy)
const std::string to_hex() const
const std::string to_bin() const
bool get_slice(int, int, sc_bv_base &) const
#define DECL_BIN_OP_T(op, tp)
const std::string to_dec() const
#define DEFN_CTOR_T_C(tp)
sc_fxval_fast(sc_fxval_fast_observer *=0)
void dump(::std::ostream &=::std::cout) const
bool get_slice(int, int, sc_bv_base &) const
void scan(::std::istream &=::std::cin)
bool quantization_flag() const
const T sc_max(const T &a, const T &b)
void dump(::std::ostream &=::std::cout) const
void dump(::std::ostream &=::std::cout) const
#define SC_FXVAL_FAST_OBSERVER_CONSTRUCT_(object)
friend class sc_fxnum_fast_subref
#define SC_FXVAL_OBSERVER_CONSTRUCT_(object)
void scan(::std::istream &=::std::cin)
DEFN_BIN_OP_T(/, div, int64) DEFN_BIN_OP_T(/
const sc_fxval operator/(const sc_fxnum &a, const sc_fxnum &b)
unsigned long to_ulong() const