71 class vcd_sc_fxnum_trace;
72 class vcd_sc_fxnum_fast_trace;
73 class wif_sc_fxnum_trace;
74 class wif_sc_fxnum_fast_trace;
82 class sc_fxnum_bitref;
83 class sc_fxnum_fast_bitref;
84 class sc_fxnum_subref;
85 class sc_fxnum_fast_subref;
119 #define DECL_ASN_OP_T(op,tp) \ 120 sc_fxnum_bitref& operator op ( tp ); 122 #define DECL_ASN_OP(op) \ 123 DECL_ASN_OP_T(op,const sc_fxnum_bitref&) \ 124 DECL_ASN_OP_T(op,const sc_fxnum_fast_bitref&) \ 125 DECL_ASN_OP_T(op,const sc_bit&) \ 126 DECL_ASN_OP_T(op,bool) 140 operator bool()
const;
145 void print( ::std::ostream& = ::std::cout )
const;
146 void scan( ::std::istream& = ::std::cin );
147 void dump( ::std::ostream& = ::std::cout )
const;
190 #define DECL_ASN_OP_T(op,tp) \ 191 sc_fxnum_fast_bitref& operator op ( tp ); 193 #define DECL_ASN_OP(op) \ 194 DECL_ASN_OP_T(op,const sc_fxnum_bitref&) \ 195 DECL_ASN_OP_T(op,const sc_fxnum_fast_bitref&) \ 196 DECL_ASN_OP_T(op,const sc_bit&) \ 197 DECL_ASN_OP_T(op,bool) 211 operator bool()
const;
216 void print( ::std::ostream& = ::std::cout )
const;
217 void scan( ::std::istream& = ::std::cin );
218 void dump( ::std::ostream& = ::std::cout )
const;
266 #define DECL_ASN_OP_T(tp) \ 267 sc_fxnum_subref& operator = ( tp ); 289 #define DECL_ASN_OP_T_A(op,tp) \ 290 sc_fxnum_subref& operator op ## = ( tp ); 292 #define DECL_ASN_OP_A(op) \ 293 DECL_ASN_OP_T_A(op,const sc_fxnum_subref&) \ 294 DECL_ASN_OP_T_A(op,const sc_fxnum_fast_subref&) \ 295 DECL_ASN_OP_T_A(op,const sc_bv_base&) \ 296 DECL_ASN_OP_T_A(op,const sc_lv_base&) 302 #undef DECL_ASN_OP_T_A 308 #define DECL_REL_OP_T(op,tp) \ 309 friend bool operator op ( const sc_fxnum_subref&, tp ); \ 310 friend bool operator op ( tp, const sc_fxnum_subref& ); 312 #define DECL_REL_OP(op) \ 313 friend bool operator op ( const sc_fxnum_subref&, \ 314 const sc_fxnum_subref& ); \ 315 friend bool operator op ( const sc_fxnum_subref&, \ 316 const sc_fxnum_fast_subref& ); \ 317 DECL_REL_OP_T(op,const sc_bv_base&) \ 318 DECL_REL_OP_T(op,const sc_lv_base&) \ 319 DECL_REL_OP_T(op,const char*) \ 320 DECL_REL_OP_T(op,const bool*) \ 321 DECL_REL_OP_T(op,const sc_signed&) \ 322 DECL_REL_OP_T(op,const sc_unsigned&) \ 323 DECL_REL_OP_T(op,int) \ 324 DECL_REL_OP_T(op,unsigned int) \ 325 DECL_REL_OP_T(op,long) \ 326 DECL_REL_OP_T(op,unsigned long) 353 unsigned int to_uint()
const;
354 long to_long()
const;
355 unsigned long to_ulong()
const;
356 int64 to_int64()
const;
359 #ifdef SC_DT_DEPRECATED 360 int to_signed()
const;
361 unsigned int to_unsigned()
const;
376 void print( ::std::ostream& = ::std::cout )
const;
377 void scan( ::std::istream& = ::std::cin );
378 void dump( ::std::ostream& = ::std::cout )
const;
429 #define DECL_ASN_OP_T(tp) \ 430 sc_fxnum_fast_subref& operator = ( tp ); 452 #define DECL_ASN_OP_T_A(op,tp) \ 453 sc_fxnum_fast_subref& operator op ## = ( tp ); 455 #define DECL_ASN_OP_A(op) \ 456 DECL_ASN_OP_T_A(op,const sc_fxnum_subref&) \ 457 DECL_ASN_OP_T_A(op,const sc_fxnum_fast_subref&) \ 458 DECL_ASN_OP_T_A(op,const sc_bv_base&) \ 459 DECL_ASN_OP_T_A(op,const sc_lv_base&) 465 #undef DECL_ASN_OP_T_A 471 #define DECL_REL_OP_T(op,tp) \ 472 friend bool operator op ( const sc_fxnum_fast_subref&, tp ); \ 473 friend bool operator op ( tp, const sc_fxnum_fast_subref& ); 475 #define DECL_REL_OP(op) \ 476 friend bool operator op ( const sc_fxnum_fast_subref&, \ 477 const sc_fxnum_fast_subref& ); \ 478 friend bool operator op ( const sc_fxnum_fast_subref&, \ 479 const sc_fxnum_subref& ); \ 480 DECL_REL_OP_T(op,const sc_bv_base&) \ 481 DECL_REL_OP_T(op,const sc_lv_base&) \ 482 DECL_REL_OP_T(op,const char*) \ 483 DECL_REL_OP_T(op,const bool*) \ 484 DECL_REL_OP_T(op,const sc_signed&) \ 485 DECL_REL_OP_T(op,const sc_unsigned&) \ 486 DECL_REL_OP_T(op,int) \ 487 DECL_REL_OP_T(op,unsigned int) \ 488 DECL_REL_OP_T(op,long) \ 489 DECL_REL_OP_T(op,unsigned long) 516 unsigned int to_uint()
const;
517 long to_long()
const;
518 unsigned long to_ulong()
const;
519 int64 to_int64()
const;
522 #ifdef SC_DT_DEPRECATED 523 int to_signed()
const;
524 unsigned int to_unsigned()
const;
534 operator sc_bv_base()
const;
539 void print( ::std::ostream& = ::std::cout )
const;
540 void scan( ::std::istream& = ::std::cin );
541 void dump( ::std::ostream& = ::std::cout )
const;
545 sc_fxnum_fast& m_num;
554 sc_fxnum_fast_subref();
573 friend class sc_core::vcd_sc_fxnum_trace;
574 friend class sc_core::wif_sc_fxnum_trace;
591 #define DECL_CTOR_T(tp) \ 593 const sc_fxtype_params&, \ 595 const sc_fxcast_switch&, \ 596 sc_fxnum_observer* ); 609 #ifndef SC_FX_EXCLUDE_OTHER 642 #define DECL_BIN_OP_T(op,tp) \ 643 friend const sc_fxval operator op ( const sc_fxnum&, tp ); \ 644 friend const sc_fxval operator op ( tp, const sc_fxnum& ); 646 #ifndef SC_FX_EXCLUDE_OTHER 647 #define DECL_BIN_OP_OTHER(op) \ 648 DECL_BIN_OP_T(op,int64) \ 649 DECL_BIN_OP_T(op,uint64) \ 650 DECL_BIN_OP_T(op,const sc_int_base&) \ 651 DECL_BIN_OP_T(op,const sc_uint_base&) \ 652 DECL_BIN_OP_T(op,const sc_signed&) \ 653 DECL_BIN_OP_T(op,const sc_unsigned&) 655 #define DECL_BIN_OP_OTHER(op) 658 #define DECL_BIN_OP(op,dummy) \ 659 friend const sc_fxval operator op ( const sc_fxnum&, const sc_fxnum& ); \ 660 DECL_BIN_OP_T(op,int) \ 661 DECL_BIN_OP_T(op,unsigned int) \ 662 DECL_BIN_OP_T(op,long) \ 663 DECL_BIN_OP_T(op,unsigned long) \ 664 DECL_BIN_OP_T(op,float) \ 665 DECL_BIN_OP_T(op,double) \ 666 DECL_BIN_OP_T(op,const char*) \ 667 DECL_BIN_OP_T(op,const sc_fxval&) \ 668 DECL_BIN_OP_T(op,const sc_fxval_fast&) \ 669 DECL_BIN_OP_T(op,const sc_fxnum_fast&) \ 670 DECL_BIN_OP_OTHER(op) 689 #ifndef SC_FX_EXCLUDE_OTHER 699 #undef DECL_BIN_OP_OTHER 708 #define DECL_BIN_FNC_T(fnc,tp) \ 709 friend void fnc ( sc_fxval&, const sc_fxnum&, tp ); \ 710 friend void fnc ( sc_fxval&, tp, const sc_fxnum& ); \ 711 friend void fnc ( sc_fxnum&, const sc_fxnum&, tp ); \ 712 friend void fnc ( sc_fxnum&, tp, const sc_fxnum& ); 714 #ifndef SC_FX_EXCLUDE_OTHER 715 #define DECL_BIN_FNC_OTHER(fnc) \ 716 DECL_BIN_FNC_T(fnc,int64) \ 717 DECL_BIN_FNC_T(fnc,uint64) \ 718 DECL_BIN_FNC_T(fnc,const sc_int_base&) \ 719 DECL_BIN_FNC_T(fnc,const sc_uint_base&) \ 720 DECL_BIN_FNC_T(fnc,const sc_signed&) \ 721 DECL_BIN_FNC_T(fnc,const sc_unsigned&) 723 #define DECL_BIN_FNC_OTHER(fnc) 726 #define DECL_BIN_FNC(fnc) \ 727 friend void fnc ( sc_fxval&, const sc_fxnum&, const sc_fxnum& ); \ 728 friend void fnc ( sc_fxnum&, const sc_fxnum&, const sc_fxnum& ); \ 729 DECL_BIN_FNC_T(fnc,int) \ 730 DECL_BIN_FNC_T(fnc,unsigned int) \ 731 DECL_BIN_FNC_T(fnc,long) \ 732 DECL_BIN_FNC_T(fnc,unsigned long) \ 733 DECL_BIN_FNC_T(fnc,float) \ 734 DECL_BIN_FNC_T(fnc,double) \ 735 DECL_BIN_FNC_T(fnc,const char*) \ 736 DECL_BIN_FNC_T(fnc,const sc_fxval&) \ 737 DECL_BIN_FNC_T(fnc,const sc_fxval_fast&) \ 738 DECL_BIN_FNC_T(fnc,const sc_fxnum_fast&) \ 739 DECL_BIN_FNC_OTHER(fnc) 746 #undef DECL_BIN_FNC_T 747 #undef DECL_BIN_FNC_OTHER 758 #define DECL_REL_OP_T(op,tp) \ 759 friend bool operator op ( const sc_fxnum&, tp ); \ 760 friend bool operator op ( tp, const sc_fxnum& ); 762 #ifndef SC_FX_EXCLUDE_OTHER 763 #define DECL_REL_OP_OTHER(op) \ 764 DECL_REL_OP_T(op,int64) \ 765 DECL_REL_OP_T(op,uint64) \ 766 DECL_REL_OP_T(op,const sc_int_base&) \ 767 DECL_REL_OP_T(op,const sc_uint_base&) \ 768 DECL_REL_OP_T(op,const sc_signed&) \ 769 DECL_REL_OP_T(op,const sc_unsigned&) 771 #define DECL_REL_OP_OTHER(op) 774 #define DECL_REL_OP(op) \ 775 friend bool operator op ( const sc_fxnum&, const sc_fxnum& ); \ 776 DECL_REL_OP_T(op,int) \ 777 DECL_REL_OP_T(op,unsigned int) \ 778 DECL_REL_OP_T(op,long) \ 779 DECL_REL_OP_T(op,unsigned long) \ 780 DECL_REL_OP_T(op,float) \ 781 DECL_REL_OP_T(op,double) \ 782 DECL_REL_OP_T(op,const char*) \ 783 DECL_REL_OP_T(op,const sc_fxval&) \ 784 DECL_REL_OP_T(op,const sc_fxval_fast&) \ 785 DECL_REL_OP_T(op,const sc_fxnum_fast&) \ 786 DECL_REL_OP_OTHER(op) 796 #undef DECL_REL_OP_OTHER 802 #define DECL_ASN_OP_T(op,tp) \ 803 sc_fxnum& operator op( tp ); 805 #ifndef SC_FX_EXCLUDE_OTHER 806 #define DECL_ASN_OP_OTHER(op) \ 807 DECL_ASN_OP_T(op,int64) \ 808 DECL_ASN_OP_T(op,uint64) \ 809 DECL_ASN_OP_T(op,const sc_int_base&) \ 810 DECL_ASN_OP_T(op,const sc_uint_base&) \ 811 DECL_ASN_OP_T(op,const sc_signed&) \ 812 DECL_ASN_OP_T(op,const sc_unsigned&) 814 #define DECL_ASN_OP_OTHER(op) 817 #define DECL_ASN_OP(op) \ 818 DECL_ASN_OP_T(op,int) \ 819 DECL_ASN_OP_T(op,unsigned int) \ 820 DECL_ASN_OP_T(op,long) \ 821 DECL_ASN_OP_T(op,unsigned long) \ 822 DECL_ASN_OP_T(op,float) \ 823 DECL_ASN_OP_T(op,double) \ 824 DECL_ASN_OP_T(op,const char*) \ 825 DECL_ASN_OP_T(op,const sc_fxval&) \ 826 DECL_ASN_OP_T(op,const sc_fxval_fast&) \ 827 DECL_ASN_OP_T(op,const sc_fxnum&) \ 828 DECL_ASN_OP_T(op,const sc_fxnum_fast&) \ 829 DECL_ASN_OP_OTHER(op) 839 DECL_ASN_OP_T(>>=,
int)
842 #undef DECL_ASN_OP_OTHER 882 operator double()
const;
887 short to_short()
const;
888 unsigned short to_ushort()
const;
890 unsigned int to_uint()
const;
891 long to_long()
const;
892 unsigned long to_ulong()
const;
893 int64 to_int64()
const;
895 float to_float()
const;
896 double to_double()
const;
908 const std::string to_dec()
const;
909 const std::string to_bin()
const;
910 const std::string to_oct()
const;
911 const std::string to_hex()
const;
917 bool is_zero()
const;
920 bool is_normal()
const;
922 bool quantization_flag()
const;
923 bool overflow_flag()
const;
943 void print( ::std::ostream& = ::std::cout )
const;
944 void scan( ::std::istream& = ::std::cin );
945 void dump( ::std::ostream& = ::std::cout )
const;
949 void observer_read()
const;
953 bool get_bit(
int )
const;
957 bool set_bit(
int,
bool );
960 bool get_slice(
int,
int,
sc_bv_base& )
const;
961 bool set_slice(
int,
int,
const sc_bv_base& );
1000 friend class sc_core::vcd_sc_fxnum_fast_trace;
1001 friend class sc_core::wif_sc_fxnum_fast_trace;
1018 #define DECL_CTOR_T(tp) \ 1019 sc_fxnum_fast( tp, \ 1020 const sc_fxtype_params&, \ 1022 const sc_fxcast_switch&, \ 1023 sc_fxnum_fast_observer* ); 1036 #ifndef SC_FX_EXCLUDE_OTHER 1051 double get_val()
const;
1063 friend void neg( sc_fxval_fast&,
const sc_fxnum_fast& );
1064 friend void neg( sc_fxnum_fast&,
const sc_fxnum_fast& );
1069 #define DECL_BIN_OP_T(op,tp) \ 1070 friend const sc_fxval_fast operator op ( const sc_fxnum_fast&, tp ); \ 1071 friend const sc_fxval_fast operator op ( tp, const sc_fxnum_fast& ); 1073 #ifndef SC_FX_EXCLUDE_OTHER 1074 #define DECL_BIN_OP_OTHER(op) \ 1075 DECL_BIN_OP_T(op,int64) \ 1076 DECL_BIN_OP_T(op,uint64) \ 1077 DECL_BIN_OP_T(op,const sc_int_base&) \ 1078 DECL_BIN_OP_T(op,const sc_uint_base&) \ 1079 DECL_BIN_OP_T(op,const sc_signed&) \ 1080 DECL_BIN_OP_T(op,const sc_unsigned&) 1082 #define DECL_BIN_OP_OTHER(op) 1085 #define DECL_BIN_OP(op,dummy) \ 1086 friend const sc_fxval_fast operator op ( const sc_fxnum_fast&, \ 1087 const sc_fxnum_fast& ); \ 1088 DECL_BIN_OP_T(op,int) \ 1089 DECL_BIN_OP_T(op,unsigned int) \ 1090 DECL_BIN_OP_T(op,long) \ 1091 DECL_BIN_OP_T(op,unsigned long) \ 1092 DECL_BIN_OP_T(op,float) \ 1093 DECL_BIN_OP_T(op,double) \ 1094 DECL_BIN_OP_T(op,const char*) \ 1095 DECL_BIN_OP_T(op,const sc_fxval_fast&) \ 1096 DECL_BIN_OP_OTHER(op) 1102 friend const sc_fxval_fast
operator / (
const sc_fxnum_fast&,
1103 const sc_fxnum_fast& );
1113 #ifndef SC_FX_EXCLUDE_OTHER 1115 DECL_BIN_OP_T(/,
uint64) \
1116 DECL_BIN_OP_T(/,
const sc_int_base&) \
1117 DECL_BIN_OP_T(/,
const sc_uint_base&) \
1118 DECL_BIN_OP_T(/,
const sc_signed&) \
1119 DECL_BIN_OP_T(/,
const sc_unsigned&)
1122 #undef DECL_BIN_OP_T 1123 #undef DECL_BIN_OP_OTHER 1132 #define DECL_BIN_FNC_T(fnc,tp) \ 1133 friend void fnc ( sc_fxval_fast&, const sc_fxnum_fast&, tp ); \ 1134 friend void fnc ( sc_fxval_fast&, tp, const sc_fxnum_fast& ); \ 1135 friend void fnc ( sc_fxnum_fast&, const sc_fxnum_fast&, tp ); \ 1136 friend void fnc ( sc_fxnum_fast&, tp, const sc_fxnum_fast& ); 1138 #ifndef SC_FX_EXCLUDE_OTHER 1139 #define DECL_BIN_FNC_OTHER(fnc) \ 1140 DECL_BIN_FNC_T(fnc,int64) \ 1141 DECL_BIN_FNC_T(fnc,uint64) \ 1142 DECL_BIN_FNC_T(fnc,const sc_int_base&) \ 1143 DECL_BIN_FNC_T(fnc,const sc_uint_base&) \ 1144 DECL_BIN_FNC_T(fnc,const sc_signed&) \ 1145 DECL_BIN_FNC_T(fnc,const sc_unsigned&) 1147 #define DECL_BIN_FNC_OTHER(fnc) 1150 #define DECL_BIN_FNC(fnc) \ 1151 friend void fnc ( sc_fxval_fast&, const sc_fxnum_fast&, \ 1152 const sc_fxnum_fast& ); \ 1153 friend void fnc ( sc_fxnum_fast&, const sc_fxnum_fast&, \ 1154 const sc_fxnum_fast& ); \ 1155 DECL_BIN_FNC_T(fnc,int) \ 1156 DECL_BIN_FNC_T(fnc,unsigned int) \ 1157 DECL_BIN_FNC_T(fnc,long) \ 1158 DECL_BIN_FNC_T(fnc,unsigned long) \ 1159 DECL_BIN_FNC_T(fnc,float) \ 1160 DECL_BIN_FNC_T(fnc,double) \ 1161 DECL_BIN_FNC_T(fnc,const char*) \ 1162 DECL_BIN_FNC_T(fnc,const sc_fxval&) \ 1163 DECL_BIN_FNC_T(fnc,const sc_fxval_fast&) \ 1164 DECL_BIN_FNC_T(fnc,const sc_fxnum&) \ 1165 DECL_BIN_FNC_OTHER(fnc) 1172 #undef DECL_BIN_FNC_T 1173 #undef DECL_BIN_FNC_OTHER 1176 friend void lshift( sc_fxval_fast&,
const sc_fxnum_fast&,
int );
1177 friend void rshift( sc_fxval_fast&,
const sc_fxnum_fast&,
int );
1178 friend void lshift( sc_fxnum_fast&,
const sc_fxnum_fast&,
int );
1179 friend void rshift( sc_fxnum_fast&,
const sc_fxnum_fast&,
int );
1184 #define DECL_REL_OP_T(op,tp) \ 1185 friend bool operator op ( const sc_fxnum_fast&, tp ); \ 1186 friend bool operator op ( tp, const sc_fxnum_fast& ); 1188 #ifndef SC_FX_EXCLUDE_OTHER 1189 #define DECL_REL_OP_OTHER(op) \ 1190 DECL_REL_OP_T(op,int64) \ 1191 DECL_REL_OP_T(op,uint64) \ 1192 DECL_REL_OP_T(op,const sc_int_base&) \ 1193 DECL_REL_OP_T(op,const sc_uint_base&) \ 1194 DECL_REL_OP_T(op,const sc_signed&) \ 1195 DECL_REL_OP_T(op,const sc_unsigned&) 1197 #define DECL_REL_OP_OTHER(op) 1200 #define DECL_REL_OP(op) \ 1201 friend bool operator op ( const sc_fxnum_fast&, const sc_fxnum_fast& ); \ 1202 DECL_REL_OP_T(op,int) \ 1203 DECL_REL_OP_T(op,unsigned int) \ 1204 DECL_REL_OP_T(op,long) \ 1205 DECL_REL_OP_T(op,unsigned long) \ 1206 DECL_REL_OP_T(op,float) \ 1207 DECL_REL_OP_T(op,double) \ 1208 DECL_REL_OP_T(op,const char*) \ 1209 DECL_REL_OP_T(op,const sc_fxval_fast&) \ 1210 DECL_REL_OP_OTHER(op) 1219 #undef DECL_REL_OP_T 1220 #undef DECL_REL_OP_OTHER 1226 #define DECL_ASN_OP_T(op,tp) \ 1227 sc_fxnum_fast& operator op( tp ); 1229 #ifndef SC_FX_EXCLUDE_OTHER 1230 #define DECL_ASN_OP_OTHER(op) \ 1231 DECL_ASN_OP_T(op,int64) \ 1232 DECL_ASN_OP_T(op,uint64) \ 1233 DECL_ASN_OP_T(op,const sc_int_base&) \ 1234 DECL_ASN_OP_T(op,const sc_uint_base&) \ 1235 DECL_ASN_OP_T(op,const sc_signed&) \ 1236 DECL_ASN_OP_T(op,const sc_unsigned&) 1238 #define DECL_ASN_OP_OTHER(op) 1241 #define DECL_ASN_OP(op) \ 1242 DECL_ASN_OP_T(op,int) \ 1243 DECL_ASN_OP_T(op,unsigned int) \ 1244 DECL_ASN_OP_T(op,long) \ 1245 DECL_ASN_OP_T(op,unsigned long) \ 1246 DECL_ASN_OP_T(op,float) \ 1247 DECL_ASN_OP_T(op,double) \ 1248 DECL_ASN_OP_T(op,const char*) \ 1249 DECL_ASN_OP_T(op,const sc_fxval&) \ 1250 DECL_ASN_OP_T(op,const sc_fxval_fast&) \ 1251 DECL_ASN_OP_T(op,const sc_fxnum&) \ 1252 DECL_ASN_OP_T(op,const sc_fxnum_fast&) \ 1253 DECL_ASN_OP_OTHER(op) 1263 DECL_ASN_OP_T(>>=,
int)
1265 #undef DECL_ASN_OP_T 1266 #undef DECL_ASN_OP_OTHER 1272 const sc_fxval_fast operator ++ (
int );
1273 const sc_fxval_fast operator -- (
int );
1275 sc_fxnum_fast& operator ++ ();
1276 sc_fxnum_fast& operator -- ();
1281 const sc_fxnum_fast_bitref operator [] (
int )
const;
1282 sc_fxnum_fast_bitref operator [] (
int );
1284 const sc_fxnum_fast_bitref bit(
int )
const;
1285 sc_fxnum_fast_bitref bit(
int );
1290 const sc_fxnum_fast_subref operator () (
int,
int )
const;
1291 sc_fxnum_fast_subref operator () (
int,
int );
1293 const sc_fxnum_fast_subref range(
int,
int )
const;
1294 sc_fxnum_fast_subref range(
int,
int );
1297 const sc_fxnum_fast_subref operator () ()
const;
1298 sc_fxnum_fast_subref operator () ();
1300 const sc_fxnum_fast_subref range()
const;
1301 sc_fxnum_fast_subref range();
1306 operator double()
const;
1311 short to_short()
const;
1312 unsigned short to_ushort()
const;
1314 unsigned int to_uint()
const;
1315 long to_long()
const;
1316 unsigned long to_ulong()
const;
1317 int64 to_int64()
const;
1318 uint64 to_uint64()
const;
1319 float to_float()
const;
1320 double to_double()
const;
1332 const std::string to_dec()
const;
1333 const std::string to_bin()
const;
1334 const std::string to_oct()
const;
1335 const std::string to_hex()
const;
1340 bool is_neg()
const;
1341 bool is_zero()
const;
1344 bool is_normal()
const;
1346 bool quantization_flag()
const;
1347 bool overflow_flag()
const;
1349 const sc_fxval_fast
value()
const;
1360 const sc_fxtype_params& type_params()
const;
1362 const sc_fxcast_switch& cast_switch()
const;
1367 void print( ::std::ostream& = ::std::cout )
const;
1368 void scan( ::std::istream& = ::std::cin );
1369 void dump( ::std::ostream& = ::std::cout )
const;
1373 void observer_read()
const;
1377 bool get_bit(
int )
const;
1381 bool set_bit(
int,
bool );
1384 bool get_slice(
int,
int, sc_bv_base& )
const;
1385 bool set_slice(
int,
int,
const sc_bv_base& );
1388 sc_fxnum_fast_observer* lock_observer()
const;
1389 void unlock_observer( sc_fxnum_fast_observer* )
const;
1395 scfx_params m_params;
1399 mutable sc_fxnum_fast_observer* m_observer;
1405 sc_fxnum_fast(
const sc_fxnum_fast& );
1420 sc_fxnum_bitref::sc_fxnum_bitref( sc_fxnum& num_,
int idx_ )
1421 : m_num( num_ ), m_idx( idx_ )
1429 : m_num( a.m_num ), m_idx( a.m_idx )
1460 sc_fxnum_bitref::operator = (
const sc_bit& a )
1462 set(
static_cast<bool>( a ) );
1469 sc_fxnum_bitref::operator = (
bool a )
1483 set(
get() && b.get() );
1494 set(
get() && b.get() );
1504 set(
get() && static_cast<bool>( b ) );
1526 set(
get() || b.get() );
1537 set(
get() || b.get() );
1547 set(
get() || static_cast<bool>( b ) );
1569 set(
get() != b.get() );
1580 set(
get() != b.get() );
1590 set(
get() != static_cast<bool>( b ) );
1609 sc_fxnum_bitref::operator bool()
const 1642 sc_fxnum_fast_bitref::sc_fxnum_fast_bitref(
sc_fxnum_fast& num_,
int idx_ )
1643 : m_num( num_ ), m_idx( idx_ )
1651 : m_num( a.m_num ), m_idx( a.m_idx )
1682 sc_fxnum_fast_bitref::operator = (
const sc_bit& a )
1684 set(
static_cast<bool>( a ) );
1691 sc_fxnum_fast_bitref::operator = (
bool a )
1705 set(
get() && b.get() );
1716 set(
get() && b.get() );
1726 set(
get() && static_cast<bool>( b ) );
1748 set(
get() || b.get() );
1759 set(
get() || b.get() );
1769 set(
get() || static_cast<bool>( b ) );
1791 set(
get() != b.get() );
1802 set(
get() != b.get() );
1812 set(
get() != static_cast<bool>( b ) );
1831 sc_fxnum_fast_bitref::operator bool()
const 1865 sc_fxnum_subref::sc_fxnum_subref(
sc_fxnum& num_,
int from_,
int to_ )
1866 : m_num( num_ ), m_from( from_ ), m_to( to_ ),
1868 sc_min( m_from, m_to ) + 1 ) )
1876 : m_num( a.m_num ), m_from( a.m_from ), m_to( a.m_to ),
1915 #define DEFN_ASN_OP_T(tp) \ 1918 sc_fxnum_subref::operator = ( tp a ) \ 1922 SC_FXNUM_OBSERVER_WRITE_( m_num ) \ 1942 #undef DEFN_ASN_OP_T 1945 #define DEFN_ASN_OP_T(op,tp) \ 1948 sc_fxnum_subref::operator op ## = ( tp a ) \ 1950 SC_FXNUM_OBSERVER_READ_( m_num ) \ 1954 SC_FXNUM_OBSERVER_WRITE_( m_num ) \ 1958 #define DEFN_ASN_OP(op) \ 1961 sc_fxnum_subref::operator op ## = ( const sc_fxnum_subref& a ) \ 1963 SC_FXNUM_OBSERVER_READ_( m_num ) \ 1965 m_bv = m_bv op static_cast<sc_bv_base>( a ); \ 1967 SC_FXNUM_OBSERVER_WRITE_( m_num ) \ 1973 sc_fxnum_subref::operator op ## = ( const sc_fxnum_fast_subref& a ) \ 1975 SC_FXNUM_OBSERVER_READ_( m_num ) \ 1977 m_bv = m_bv op static_cast<sc_bv_base>( a ); \ 1979 SC_FXNUM_OBSERVER_WRITE_( m_num ) \ 1983 DEFN_ASN_OP_T(op,const sc_bv_base&) \ 1984 DEFN_ASN_OP_T(op,const sc_lv_base&) 1990 #undef DEFN_ASN_OP_T 1996 #define DEFN_REL_OP_T(op,tp) \ 1999 operator op ( const sc_fxnum_subref& a, tp b ) \ 2001 return ( static_cast<sc_bv_base>( a ) op b ); \ 2006 operator op ( tp a, const sc_fxnum_subref& b ) \ 2008 return ( static_cast<sc_bv_base>( b ) op a ); \ 2011 #define DEFN_REL_OP(op) \ 2014 operator op ( const sc_fxnum_subref& a, const sc_fxnum_subref& b ) \ 2016 return ( static_cast<sc_bv_base>( a ) op static_cast<sc_bv_base>( b ) ); \ 2021 operator op ( const sc_fxnum_subref& a, const sc_fxnum_fast_subref& b ) \ 2023 return ( static_cast<sc_bv_base>( a ) op static_cast<sc_bv_base>( b ) ); \ 2026 DEFN_REL_OP_T(op,const sc_bv_base&) \ 2027 DEFN_REL_OP_T(op,const sc_lv_base&) \ 2028 DEFN_REL_OP_T(op,const char*) \ 2029 DEFN_REL_OP_T(op,const bool*) \ 2030 DEFN_REL_OP_T(op,const sc_signed&) \ 2031 DEFN_REL_OP_T(op,const sc_unsigned&) \ 2032 DEFN_REL_OP_T(op,int) \ 2033 DEFN_REL_OP_T(op,unsigned int) \ 2034 DEFN_REL_OP_T(op,long) \ 2035 DEFN_REL_OP_T(op,unsigned long) 2040 #undef DEFN_REL_OP_T 2046 #define DEFN_RED_FNC(fnc) \ 2049 sc_fxnum_subref::fnc() const \ 2051 SC_FXNUM_OBSERVER_READ_( m_num ) \ 2053 return static_cast<bool>( m_bv.fnc() ); \ 2133 #ifdef SC_DT_DEPRECATED 2137 sc_fxnum_subref::to_signed()
const 2144 sc_fxnum_subref::to_unsigned()
const 2173 return m_bv.
to_string( numrep, w_prefix );
2215 sc_fxnum_fast_subref::sc_fxnum_fast_subref(
sc_fxnum_fast& num_,
2216 int from_,
int to_ )
2217 : m_num( num_ ), m_from( from_ ), m_to( to_ ),
2219 sc_min( m_from, m_to ) + 1 ) )
2227 : m_num( a.m_num ), m_from( a.m_from ), m_to( a.m_to ),
2266 #define DEFN_ASN_OP_T(tp) \ 2268 sc_fxnum_fast_subref& \ 2269 sc_fxnum_fast_subref::operator = ( tp a ) \ 2273 SC_FXNUM_FAST_OBSERVER_WRITE_( m_num ) \ 2293 #undef DEFN_ASN_OP_T 2296 #define DEFN_ASN_OP_T(op,tp) \ 2298 sc_fxnum_fast_subref& \ 2299 sc_fxnum_fast_subref::operator op ## = ( tp a ) \ 2301 SC_FXNUM_FAST_OBSERVER_READ_( m_num ) \ 2305 SC_FXNUM_FAST_OBSERVER_WRITE_( m_num ) \ 2309 #define DEFN_ASN_OP(op) \ 2311 sc_fxnum_fast_subref& \ 2312 sc_fxnum_fast_subref::operator op ## = ( const sc_fxnum_subref& a ) \ 2314 SC_FXNUM_FAST_OBSERVER_READ_( m_num ) \ 2316 m_bv = m_bv op static_cast<sc_bv_base>( a ); \ 2318 SC_FXNUM_FAST_OBSERVER_WRITE_( m_num ) \ 2323 sc_fxnum_fast_subref& \ 2324 sc_fxnum_fast_subref::operator op ## = ( const sc_fxnum_fast_subref& a ) \ 2326 SC_FXNUM_FAST_OBSERVER_READ_( m_num ) \ 2328 m_bv = m_bv op static_cast<sc_bv_base>( a ); \ 2330 SC_FXNUM_FAST_OBSERVER_WRITE_( m_num ) \ 2334 DEFN_ASN_OP_T(op,const sc_bv_base&) \ 2335 DEFN_ASN_OP_T(op,const sc_lv_base&) 2341 #undef DEFN_ASN_OP_T 2347 #define DEFN_REL_OP_T(op,tp) \ 2350 operator op ( const sc_fxnum_fast_subref& a, tp b ) \ 2352 return ( static_cast<sc_bv_base>( a ) op b ); \ 2357 operator op ( tp a, const sc_fxnum_fast_subref& b ) \ 2359 return ( static_cast<sc_bv_base>( b ) op a ); \ 2362 #define DEFN_REL_OP(op) \ 2365 operator op ( const sc_fxnum_fast_subref& a, const sc_fxnum_fast_subref& b ) \ 2367 return ( static_cast<sc_bv_base>( a ) op static_cast<sc_bv_base>( b ) ); \ 2372 operator op ( const sc_fxnum_fast_subref& a, const sc_fxnum_subref& b ) \ 2374 return ( static_cast<sc_bv_base>( a ) op static_cast<sc_bv_base>( b ) ); \ 2377 DEFN_REL_OP_T(op,const sc_bv_base&) \ 2378 DEFN_REL_OP_T(op,const sc_lv_base&) \ 2379 DEFN_REL_OP_T(op,const char*) \ 2380 DEFN_REL_OP_T(op,const bool*) \ 2381 DEFN_REL_OP_T(op,const sc_signed&) \ 2382 DEFN_REL_OP_T(op,const sc_unsigned&) \ 2383 DEFN_REL_OP_T(op,int) \ 2384 DEFN_REL_OP_T(op,unsigned int) \ 2385 DEFN_REL_OP_T(op,long) \ 2386 DEFN_REL_OP_T(op,unsigned long) 2391 #undef DEFN_REL_OP_T 2397 #define DEFN_RED_FNC(fnc) \ 2400 sc_fxnum_fast_subref::fnc() const \ 2402 SC_FXNUM_FAST_OBSERVER_READ_( m_num ) \ 2404 return static_cast<bool>( m_bv.fnc() ); \ 2484 #ifdef SC_DT_DEPRECATED 2488 sc_fxnum_fast_subref::to_signed()
const 2495 sc_fxnum_fast_subref::to_unsigned()
const 2524 return m_bv.
to_string( numrep, w_prefix );
2574 SC_ERROR_IF_( ! m_rep->is_normal(), sc_core::SC_ID_INVALID_FX_VALUE_ );
2576 if( m_params.cast_switch() ==
SC_ON )
2577 m_rep->cast( m_params, m_q_flag, m_o_flag );
2589 m_params( type_params_, enc_, cast_sw ),
2592 m_observer( observer_ )
2598 #define DEFN_CTOR_T(tp,arg) \ 2600 sc_fxnum::sc_fxnum( tp a, \ 2601 const sc_fxtype_params& type_params_, \ 2603 const sc_fxcast_switch& cast_sw, \ 2604 sc_fxnum_observer* observer_ ) \ 2605 : m_rep( new scfx_rep( arg ) ), \ 2606 m_params( type_params_, enc_, cast_sw ), \ 2607 m_q_flag( false ), \ 2608 m_o_flag( false ), \ 2609 m_observer( observer_ ) \ 2611 SC_FXNUM_OBSERVER_DEFAULT_ \ 2613 SC_FXNUM_OBSERVER_CONSTRUCT_( *this ) \ 2614 SC_FXNUM_OBSERVER_WRITE_( *this ) \ 2617 #define DEFN_CTOR_T_A(tp) DEFN_CTOR_T(tp,a) 2618 #define DEFN_CTOR_T_B(tp) DEFN_CTOR_T(tp,*a.m_rep) 2619 #define DEFN_CTOR_T_C(tp) DEFN_CTOR_T(tp,a.to_double()) 2620 #define DEFN_CTOR_T_D(tp) DEFN_CTOR_T(tp,a.value()) 2633 #ifndef SC_FX_EXCLUDE_OTHER 2643 #undef DEFN_CTOR_T_A 2644 #undef DEFN_CTOR_T_B 2645 #undef DEFN_CTOR_T_C 2646 #undef DEFN_CTOR_T_D 2710 #define DEFN_BIN_OP_T(op,fnc,tp) \ 2713 operator op ( const sc_fxnum& a, tp b ) \ 2715 SC_FXNUM_OBSERVER_READ_( a ) \ 2716 sc_fxval tmp( b ); \ 2717 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.get_rep() ) ); \ 2722 operator op ( tp a, const sc_fxnum& b ) \ 2724 SC_FXNUM_OBSERVER_READ_( b ) \ 2725 sc_fxval tmp( a ); \ 2726 return sc_fxval( sc_dt::fnc ## _scfx_rep( *tmp.get_rep(), *b.m_rep ) ); \ 2729 #ifndef SC_FX_EXCLUDE_OTHER 2730 #define DEFN_BIN_OP_OTHER(op,fnc) \ 2731 DEFN_BIN_OP_T(op,fnc,int64) \ 2732 DEFN_BIN_OP_T(op,fnc,uint64) \ 2733 DEFN_BIN_OP_T(op,fnc,const sc_int_base&) \ 2734 DEFN_BIN_OP_T(op,fnc,const sc_uint_base&) \ 2735 DEFN_BIN_OP_T(op,fnc,const sc_signed&) \ 2736 DEFN_BIN_OP_T(op,fnc,const sc_unsigned&) 2738 #define DEFN_BIN_OP_OTHER(op,fnc) 2741 #define DEFN_BIN_OP(op,fnc) \ 2744 operator op ( const sc_fxnum& a, const sc_fxnum& b ) \ 2746 SC_FXNUM_OBSERVER_READ_( a ) \ 2747 SC_FXNUM_OBSERVER_READ_( b ) \ 2748 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.m_rep ) ); \ 2753 operator op ( const sc_fxnum& a, const sc_fxval& b ) \ 2755 SC_FXNUM_OBSERVER_READ_( a ) \ 2756 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.get_rep() ) ); \ 2761 operator op ( const sc_fxval& a, const sc_fxnum& b ) \ 2763 SC_FXNUM_OBSERVER_READ_( b ) \ 2764 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.get_rep(), *b.m_rep ) ); \ 2767 DEFN_BIN_OP_T(op,fnc,int) \ 2768 DEFN_BIN_OP_T(op,fnc,unsigned int) \ 2769 DEFN_BIN_OP_T(op,fnc,long) \ 2770 DEFN_BIN_OP_T(op,fnc,unsigned long) \ 2771 DEFN_BIN_OP_T(op,fnc,float) \ 2772 DEFN_BIN_OP_T(op,fnc,double) \ 2773 DEFN_BIN_OP_T(op,fnc,const char*) \ 2774 DEFN_BIN_OP_T(op,fnc,const sc_fxval_fast&) \ 2775 DEFN_BIN_OP_T(op,fnc,const sc_fxnum_fast&) \ 2776 DEFN_BIN_OP_OTHER(op,fnc) 2818 #ifndef SC_FX_EXCLUDE_OTHER 2827 #undef DEFN_BIN_OP_T 2828 #undef DEFN_BIN_OP_OTHER 2851 #define DEFN_BIN_FNC_T(fnc,tp) \ 2854 fnc ( sc_fxval& c, const sc_fxnum& a, tp b ) \ 2856 SC_FXNUM_OBSERVER_READ_( a ) \ 2857 sc_fxval tmp( b ); \ 2858 c.set_rep( sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.get_rep() ) ); \ 2863 fnc ( sc_fxval& c, tp a, const sc_fxnum& b ) \ 2865 SC_FXNUM_OBSERVER_READ_( b ) \ 2866 sc_fxval tmp( a ); \ 2867 c.set_rep( sc_dt::fnc ## _scfx_rep( *tmp.get_rep(), *b.m_rep ) ); \ 2872 fnc ( sc_fxnum& c, const sc_fxnum& a, tp b ) \ 2874 SC_FXNUM_OBSERVER_READ_( a ) \ 2875 sc_fxval tmp( b ); \ 2877 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.get_rep() ); \ 2879 SC_FXNUM_OBSERVER_WRITE_( c ) \ 2884 fnc ( sc_fxnum& c, tp a, const sc_fxnum& b ) \ 2886 SC_FXNUM_OBSERVER_READ_( b ) \ 2887 sc_fxval tmp( a ); \ 2889 c.m_rep = sc_dt::fnc ## _scfx_rep( *tmp.get_rep(), *b.m_rep ); \ 2891 SC_FXNUM_OBSERVER_WRITE_( c ) \ 2894 #ifndef SC_FX_EXCLUDE_OTHER 2895 #define DEFN_BIN_FNC_OTHER(fnc) \ 2896 DEFN_BIN_FNC_T(fnc,int64) \ 2897 DEFN_BIN_FNC_T(fnc,uint64) \ 2898 DEFN_BIN_FNC_T(fnc,const sc_int_base&) \ 2899 DEFN_BIN_FNC_T(fnc,const sc_uint_base&) \ 2900 DEFN_BIN_FNC_T(fnc,const sc_signed&) \ 2901 DEFN_BIN_FNC_T(fnc,const sc_unsigned&) 2903 #define DEFN_BIN_FNC_OTHER(fnc) 2906 #define DEFN_BIN_FNC(fnc) \ 2909 fnc ( sc_fxval& c, const sc_fxnum& a, const sc_fxnum& b ) \ 2911 SC_FXNUM_OBSERVER_READ_( a ) \ 2912 SC_FXNUM_OBSERVER_READ_( b ) \ 2913 c.set_rep( sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.m_rep ) ); \ 2918 fnc ( sc_fxnum& c, const sc_fxnum& a, const sc_fxnum& b ) \ 2920 SC_FXNUM_OBSERVER_READ_( a ) \ 2921 SC_FXNUM_OBSERVER_READ_( b ) \ 2923 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.m_rep ); \ 2925 SC_FXNUM_OBSERVER_WRITE_( c ) \ 2930 fnc ( sc_fxval& c, const sc_fxnum& a, const sc_fxval& b ) \ 2932 SC_FXNUM_OBSERVER_READ_( a ) \ 2933 c.set_rep( sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.get_rep() ) ); \ 2938 fnc ( sc_fxval& c, const sc_fxval& a, const sc_fxnum& b ) \ 2940 SC_FXNUM_OBSERVER_READ_( b ) \ 2941 c.set_rep( sc_dt::fnc ## _scfx_rep( *a.get_rep(), *b.m_rep ) ); \ 2946 fnc ( sc_fxnum& c, const sc_fxnum& a, const sc_fxval& b ) \ 2948 SC_FXNUM_OBSERVER_READ_( a ) \ 2950 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.m_rep, *b.get_rep() ); \ 2952 SC_FXNUM_OBSERVER_WRITE_( c ) \ 2957 fnc ( sc_fxnum& c, const sc_fxval& a, const sc_fxnum& b ) \ 2959 SC_FXNUM_OBSERVER_READ_( b ) \ 2961 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.get_rep(), *b.m_rep ); \ 2963 SC_FXNUM_OBSERVER_WRITE_( c ) \ 2966 DEFN_BIN_FNC_T(fnc,int) \ 2967 DEFN_BIN_FNC_T(fnc,unsigned int) \ 2968 DEFN_BIN_FNC_T(fnc,long) \ 2969 DEFN_BIN_FNC_T(fnc,unsigned long) \ 2970 DEFN_BIN_FNC_T(fnc,float) \ 2971 DEFN_BIN_FNC_T(fnc,double) \ 2972 DEFN_BIN_FNC_T(fnc,const char*) \ 2973 DEFN_BIN_FNC_T(fnc,const sc_fxval_fast&) \ 2974 DEFN_BIN_FNC_T(fnc,const sc_fxnum_fast&) \ 2975 DEFN_BIN_FNC_OTHER(fnc) 2982 #undef DEFN_BIN_FNC_T 2983 #undef DEFN_BIN_FNC_OTHER 3028 #define DEFN_REL_OP_T(op,ret,tp) \ 3031 operator op ( const sc_fxnum& a, tp b ) \ 3033 SC_FXNUM_OBSERVER_READ_( a ) \ 3034 sc_fxval tmp( b ); \ 3035 int result = sc_dt::cmp_scfx_rep( *a.m_rep, *tmp.get_rep() ); \ 3041 operator op ( tp a, const sc_fxnum& b ) \ 3043 SC_FXNUM_OBSERVER_READ_( b ) \ 3044 sc_fxval tmp( a ); \ 3045 int result = sc_dt::cmp_scfx_rep( *tmp.get_rep(), *b.m_rep ); \ 3049 #ifndef SC_FX_EXCLUDE_OTHER 3050 #define DEFN_REL_OP_OTHER(op,ret) \ 3051 DEFN_REL_OP_T(op,ret,int64) \ 3052 DEFN_REL_OP_T(op,ret,uint64) \ 3053 DEFN_REL_OP_T(op,ret,const sc_int_base&) \ 3054 DEFN_REL_OP_T(op,ret,const sc_uint_base&) \ 3055 DEFN_REL_OP_T(op,ret,const sc_signed&) \ 3056 DEFN_REL_OP_T(op,ret,const sc_unsigned&) 3058 #define DEFN_REL_OP_OTHER(op,ret) 3061 #define DEFN_REL_OP(op,ret) \ 3064 operator op ( const sc_fxnum& a, const sc_fxnum& b ) \ 3066 SC_FXNUM_OBSERVER_READ_( a ) \ 3067 SC_FXNUM_OBSERVER_READ_( b ) \ 3068 int result = sc_dt::cmp_scfx_rep( *a.m_rep, *b.m_rep ); \ 3074 operator op ( const sc_fxnum& a, const sc_fxval& b ) \ 3076 SC_FXNUM_OBSERVER_READ_( a ) \ 3077 int result = sc_dt::cmp_scfx_rep( *a.m_rep, *b.get_rep() ); \ 3083 operator op ( const sc_fxval& a, const sc_fxnum& b ) \ 3085 SC_FXNUM_OBSERVER_READ_( b ) \ 3086 int result = sc_dt::cmp_scfx_rep( *a.get_rep(), *b.m_rep ); \ 3090 DEFN_REL_OP_T(op,ret,int) \ 3091 DEFN_REL_OP_T(op,ret,unsigned int) \ 3092 DEFN_REL_OP_T(op,ret,long) \ 3093 DEFN_REL_OP_T(op,ret,unsigned long) \ 3094 DEFN_REL_OP_T(op,ret,float) \ 3095 DEFN_REL_OP_T(op,ret,double) \ 3096 DEFN_REL_OP_T(op,ret,const char*) \ 3097 DEFN_REL_OP_T(op,ret,const sc_fxval_fast&) \ 3098 DEFN_REL_OP_T(op,ret,const sc_fxnum_fast&) \ 3099 DEFN_REL_OP_OTHER(op,ret) 3108 #undef DEFN_REL_OP_T 3109 #undef DEFN_REL_OP_OTHER 3117 sc_fxnum::operator = (
const sc_fxnum& a )
3131 sc_fxnum::operator = (
const sc_fxval& a )
3139 #define DEFN_ASN_OP_T(tp) \ 3142 sc_fxnum::operator = ( tp a ) \ 3144 sc_fxval tmp( a ); \ 3145 *m_rep = *tmp.get_rep(); \ 3147 SC_FXNUM_OBSERVER_WRITE_( *this ) \ 3160 #ifndef SC_FX_EXCLUDE_OTHER 3169 #undef DEFN_ASN_OP_T 3172 #define DEFN_ASN_OP_T(op,fnc,tp) \ 3175 sc_fxnum::operator op ( tp b ) \ 3177 SC_FXNUM_OBSERVER_READ_( *this ) \ 3178 sc_fxval tmp( b ); \ 3179 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *tmp.get_rep() ); \ 3183 SC_FXNUM_OBSERVER_WRITE_( *this ) \ 3187 #ifndef SC_FX_EXCLUDE_OTHER 3188 #define DEFN_ASN_OP_OTHER(op,fnc) \ 3189 DEFN_ASN_OP_T(op,fnc,int64) \ 3190 DEFN_ASN_OP_T(op,fnc,uint64) \ 3191 DEFN_ASN_OP_T(op,fnc,const sc_int_base&) \ 3192 DEFN_ASN_OP_T(op,fnc,const sc_uint_base&) \ 3193 DEFN_ASN_OP_T(op,fnc,const sc_signed&) \ 3194 DEFN_ASN_OP_T(op,fnc,const sc_unsigned&) 3196 #define DEFN_ASN_OP_OTHER(op,fnc) 3199 #define DEFN_ASN_OP(op,fnc) \ 3202 sc_fxnum::operator op ( const sc_fxnum& b ) \ 3204 SC_FXNUM_OBSERVER_READ_( *this ) \ 3205 SC_FXNUM_OBSERVER_READ_( b ) \ 3206 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *b.m_rep ); \ 3210 SC_FXNUM_OBSERVER_WRITE_( *this ) \ 3216 sc_fxnum::operator op ( const sc_fxval& b ) \ 3218 SC_FXNUM_OBSERVER_READ_( *this ) \ 3219 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *b.get_rep() ); \ 3223 SC_FXNUM_OBSERVER_WRITE_( *this ) \ 3227 DEFN_ASN_OP_T(op,fnc,int) \ 3228 DEFN_ASN_OP_T(op,fnc,unsigned int) \ 3229 DEFN_ASN_OP_T(op,fnc,long) \ 3230 DEFN_ASN_OP_T(op,fnc,unsigned long) \ 3231 DEFN_ASN_OP_T(op,fnc,float) \ 3232 DEFN_ASN_OP_T(op,fnc,double) \ 3233 DEFN_ASN_OP_T(op,fnc,const char*) \ 3234 DEFN_ASN_OP_T(op,fnc,const sc_fxval_fast&) \ 3235 DEFN_ASN_OP_T(op,fnc,const sc_fxnum_fast&) \ 3236 DEFN_ASN_OP_OTHER(op,fnc) 3243 #undef DEFN_ASN_OP_T 3244 #undef DEFN_ASN_OP_OTHER 3250 sc_fxnum::operator <<= (
int b )
3261 sc_fxnum::operator >>= (
int b )
3314 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3316 i - m_params.
fwl() );
3323 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3331 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3333 i - m_params.
fwl() );
3340 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3351 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3352 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3355 i - m_params.
fwl(), j - m_params.
fwl() );
3362 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3363 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3372 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3373 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3376 i - m_params.
fwl(), j - m_params.
fwl() );
3383 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3384 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
3408 return this->
range( m_params.
wl() - 1, 0 );
3415 return this->
range( m_params.
wl() - 1, 0 );
3422 sc_fxnum::operator double()
const 3436 return static_cast<short>( m_rep->
to_uint64() );
3444 return static_cast<unsigned short>( m_rep->
to_uint64() );
3452 return static_cast<int>( m_rep->
to_uint64() );
3468 return static_cast<unsigned int>( m_rep->
to_uint64() );
3484 return static_cast<long>( m_rep->
to_uint64() );
3492 return static_cast<unsigned long>( m_rep->
to_uint64() );
3500 return static_cast<float>( m_rep->
to_double() );
3569 return m_params.
wl();
3576 return m_params.
iwl();
3583 return m_params.
q_mode();
3590 return m_params.
o_mode();
3597 return m_params.
n_bits();
3642 return m_rep->
set( i, m_params );
3644 return m_rep->
clear( i, m_params );
3652 return m_rep->
get_slice( i, j, m_params, bv );
3659 return m_rep->
set_slice( i, j, m_params, bv );
3702 m_params( type_params_, enc_, cast_sw ),
3705 m_observer( observer_ )
3718 m_params( type_params_, enc_, cast_sw ),
3721 m_observer( observer_ )
3730 #define DEFN_CTOR_T(tp,arg) \ 3732 sc_fxnum_fast::sc_fxnum_fast( tp a, \ 3733 const sc_fxtype_params& type_params_, \ 3735 const sc_fxcast_switch& cast_sw, \ 3736 sc_fxnum_fast_observer* observer_ ) \ 3738 m_params( type_params_, enc_, cast_sw ), \ 3739 m_q_flag( false ), \ 3740 m_o_flag( false ), \ 3741 m_observer( observer_ ) \ 3743 SC_FXNUM_FAST_OBSERVER_DEFAULT_ \ 3745 SC_FXNUM_FAST_OBSERVER_CONSTRUCT_(*this) \ 3746 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \ 3749 #define DEFN_CTOR_T_A(tp) DEFN_CTOR_T(tp,static_cast<double>( a )) 3750 #define DEFN_CTOR_T_B(tp) DEFN_CTOR_T(tp,sc_fxval_fast::from_string( a )) 3751 #define DEFN_CTOR_T_C(tp) DEFN_CTOR_T(tp,a.to_double()) 3763 #ifndef SC_FX_EXCLUDE_OTHER 3773 #undef DEFN_CTOR_T_A 3774 #undef DEFN_CTOR_T_B 3775 #undef DEFN_CTOR_T_C 3776 #undef DEFN_CTOR_T_D 3777 #undef DEFN_CTOR_T_E 3831 c.m_val = - a.m_val;
3839 #define DEFN_BIN_OP_T(op,tp) \ 3841 const sc_fxval_fast \ 3842 operator op ( const sc_fxnum_fast& a, tp b ) \ 3844 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 3845 sc_fxval_fast tmp( b ); \ 3846 return sc_fxval_fast( a.m_val op tmp.get_val() ); \ 3850 const sc_fxval_fast \ 3851 operator op ( tp a, const sc_fxnum_fast& b ) \ 3853 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 3854 sc_fxval_fast tmp( a ); \ 3855 return sc_fxval_fast( tmp.get_val() op b.m_val ); \ 3858 #ifndef SC_FX_EXCLUDE_OTHER 3859 #define DEFN_BIN_OP_OTHER(op) \ 3860 DEFN_BIN_OP_T(op,int64) \ 3861 DEFN_BIN_OP_T(op,uint64) \ 3862 DEFN_BIN_OP_T(op,const sc_int_base&) \ 3863 DEFN_BIN_OP_T(op,const sc_uint_base&) \ 3864 DEFN_BIN_OP_T(op,const sc_signed&) \ 3865 DEFN_BIN_OP_T(op,const sc_unsigned&) 3867 #define DEFN_BIN_OP_OTHER(op) 3870 #define DEFN_BIN_OP(op,dummy) \ 3872 const sc_fxval_fast \ 3873 operator op ( const sc_fxnum_fast& a, const sc_fxnum_fast& b ) \ 3875 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 3876 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 3877 return sc_fxval_fast( a.m_val op b.m_val ); \ 3881 const sc_fxval_fast \ 3882 operator op ( const sc_fxnum_fast& a, const sc_fxval_fast& b ) \ 3884 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 3885 return sc_fxval_fast( a.m_val op b.get_val() ); \ 3889 const sc_fxval_fast \ 3890 operator op ( const sc_fxval_fast& a, const sc_fxnum_fast& b ) \ 3892 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 3893 return sc_fxval_fast( a.get_val() op b.m_val ); \ 3896 DEFN_BIN_OP_T(op,int) \ 3897 DEFN_BIN_OP_T(op,unsigned int) \ 3898 DEFN_BIN_OP_T(op,long) \ 3899 DEFN_BIN_OP_T(op,unsigned long) \ 3900 DEFN_BIN_OP_T(op,float) \ 3901 DEFN_BIN_OP_T(op,double) \ 3902 DEFN_BIN_OP_T(op,const char*) \ 3903 DEFN_BIN_OP_OTHER(op) 3942 #ifndef SC_FX_EXCLUDE_OTHER 3951 #undef DEFN_BIN_OP_T 3952 #undef DEFN_BIN_OP_OTHER 3975 #define DEFN_BIN_FNC_T(fnc,op,tp) \ 3978 fnc ( sc_fxval_fast& c, const sc_fxnum_fast& a, tp b ) \ 3980 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 3981 sc_fxval_fast tmp( b ); \ 3982 c.set_val( a.m_val op tmp.get_val() ); \ 3987 fnc ( sc_fxval_fast& c, tp a, const sc_fxnum_fast& b ) \ 3989 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 3990 sc_fxval_fast tmp( a ); \ 3991 c.set_val( tmp.get_val() op b.m_val ); \ 3996 fnc ( sc_fxnum_fast& c, const sc_fxnum_fast& a, tp b ) \ 3998 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 3999 sc_fxval_fast tmp( b ); \ 4000 c.m_val = a.m_val op tmp.get_val(); \ 4002 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \ 4007 fnc ( sc_fxnum_fast& c, tp a, const sc_fxnum_fast& b ) \ 4009 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 4010 sc_fxval_fast tmp( a ); \ 4011 c.m_val = tmp.get_val() op b.m_val; \ 4013 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \ 4016 #ifndef SC_FX_EXCLUDE_OTHER 4017 #define DEFN_BIN_FNC_OTHER(fnc,op) \ 4018 DEFN_BIN_FNC_T(fnc,op,int64) \ 4019 DEFN_BIN_FNC_T(fnc,op,uint64) \ 4020 DEFN_BIN_FNC_T(fnc,op,const sc_int_base&) \ 4021 DEFN_BIN_FNC_T(fnc,op,const sc_uint_base&) \ 4022 DEFN_BIN_FNC_T(fnc,op,const sc_signed&) \ 4023 DEFN_BIN_FNC_T(fnc,op,const sc_unsigned&) 4025 #define DEFN_BIN_FNC_OTHER(fnc,op) 4028 #define DEFN_BIN_FNC(fnc,op) \ 4031 fnc ( sc_fxval_fast& c, const sc_fxnum_fast& a, const sc_fxnum_fast& b ) \ 4033 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 4034 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 4035 c.set_val( a.m_val op b.m_val ); \ 4040 fnc ( sc_fxnum_fast& c, const sc_fxnum_fast& a, const sc_fxnum_fast& b ) \ 4042 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 4043 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 4044 c.m_val = a.m_val op b.m_val; \ 4046 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \ 4051 fnc ( sc_fxval_fast& c, const sc_fxnum_fast& a, const sc_fxval_fast& b ) \ 4053 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 4054 c.set_val( a.m_val op b.get_val() ); \ 4059 fnc ( sc_fxval_fast& c, const sc_fxval_fast& a, const sc_fxnum_fast& b ) \ 4061 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 4062 c.set_val( a.get_val() op b.m_val ); \ 4067 fnc ( sc_fxnum_fast& c, const sc_fxnum_fast& a, const sc_fxval_fast& b ) \ 4069 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 4070 c.m_val = a.m_val op b.get_val(); \ 4072 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \ 4077 fnc ( sc_fxnum_fast& c, const sc_fxval_fast& a, const sc_fxnum_fast& b ) \ 4079 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 4080 c.m_val = a.get_val() op b.m_val; \ 4082 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \ 4085 DEFN_BIN_FNC_T(fnc,op,int) \ 4086 DEFN_BIN_FNC_T(fnc,op,unsigned int) \ 4087 DEFN_BIN_FNC_T(fnc,op,long) \ 4088 DEFN_BIN_FNC_T(fnc,op,unsigned long) \ 4089 DEFN_BIN_FNC_T(fnc,op,float) \ 4090 DEFN_BIN_FNC_T(fnc,op,double) \ 4091 DEFN_BIN_FNC_T(fnc,op,const char*) \ 4092 DEFN_BIN_FNC_T(fnc,op,const sc_fxval&) \ 4093 DEFN_BIN_FNC_T(fnc,op,const sc_fxnum&) \ 4094 DEFN_BIN_FNC_OTHER(fnc,op) 4101 #undef DEFN_BIN_FNC_T 4102 #undef DEFN_BIN_FNC_OTHER 4145 #define DEFN_REL_OP_T(op,tp) \ 4148 operator op ( const sc_fxnum_fast& a, tp b ) \ 4150 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 4151 sc_fxval_fast tmp( b ); \ 4152 return ( a.m_val op tmp.get_val() ); \ 4157 operator op ( tp a, const sc_fxnum_fast& b ) \ 4159 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 4160 sc_fxval_fast tmp( a ); \ 4161 return ( tmp.get_val() op b.m_val ); \ 4164 #ifndef SC_FX_EXCLUDE_OTHER 4165 #define DEFN_REL_OP_OTHER(op) \ 4166 DEFN_REL_OP_T(op,int64) \ 4167 DEFN_REL_OP_T(op,uint64) \ 4168 DEFN_REL_OP_T(op,const sc_int_base&) \ 4169 DEFN_REL_OP_T(op,const sc_uint_base&) \ 4170 DEFN_REL_OP_T(op,const sc_signed&) \ 4171 DEFN_REL_OP_T(op,const sc_unsigned&) 4173 #define DEFN_REL_OP_OTHER(op) 4176 #define DEFN_REL_OP(op) \ 4179 operator op ( const sc_fxnum_fast& a, const sc_fxnum_fast& b ) \ 4181 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 4182 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 4183 return ( a.m_val op b.m_val ); \ 4188 operator op ( const sc_fxnum_fast& a, const sc_fxval_fast& b ) \ 4190 SC_FXNUM_FAST_OBSERVER_READ_( a ) \ 4191 return ( a.m_val op b.get_val() ); \ 4196 operator op ( const sc_fxval_fast& a, const sc_fxnum_fast& b ) \ 4198 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 4199 return ( a.get_val() op b.m_val ); \ 4202 DEFN_REL_OP_T(op,int) \ 4203 DEFN_REL_OP_T(op,unsigned int) \ 4204 DEFN_REL_OP_T(op,long) \ 4205 DEFN_REL_OP_T(op,unsigned long) \ 4206 DEFN_REL_OP_T(op,float) \ 4207 DEFN_REL_OP_T(op,double) \ 4208 DEFN_REL_OP_T(op,const char*) \ 4209 DEFN_REL_OP_OTHER(op) 4218 #undef DEFN_REL_OP_T 4219 #undef DEFN_REL_OP_OTHER 4227 sc_fxnum_fast::operator = (
const sc_fxnum_fast& a )
4243 m_val = a.get_val();
4249 #define DEFN_ASN_OP_T(tp) \ 4252 sc_fxnum_fast::operator = ( tp a ) \ 4254 sc_fxval_fast tmp( a ); \ 4255 m_val = tmp.get_val(); \ 4257 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \ 4270 #ifndef SC_FX_EXCLUDE_OTHER 4279 #undef DEFN_ASN_OP_T 4282 #define DEFN_ASN_OP_T(op,tp) \ 4285 sc_fxnum_fast::operator op ( tp b ) \ 4287 SC_FXNUM_FAST_OBSERVER_READ_( *this ) \ 4288 sc_fxval_fast tmp( b ); \ 4289 m_val op tmp.get_val(); \ 4291 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \ 4295 #ifndef SC_FX_EXCLUDE_OTHER 4296 #define DEFN_ASN_OP_OTHER(op) \ 4297 DEFN_ASN_OP_T(op,int64) \ 4298 DEFN_ASN_OP_T(op,uint64) \ 4299 DEFN_ASN_OP_T(op,const sc_int_base&) \ 4300 DEFN_ASN_OP_T(op,const sc_uint_base&) \ 4301 DEFN_ASN_OP_T(op,const sc_signed&) \ 4302 DEFN_ASN_OP_T(op,const sc_unsigned&) 4304 #define DEFN_ASN_OP_OTHER(op) 4307 #define DEFN_ASN_OP(op) \ 4310 sc_fxnum_fast::operator op ( const sc_fxnum_fast& b ) \ 4312 SC_FXNUM_FAST_OBSERVER_READ_( *this ) \ 4313 SC_FXNUM_FAST_OBSERVER_READ_( b ) \ 4316 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \ 4322 sc_fxnum_fast::operator op ( const sc_fxval_fast& b ) \ 4324 SC_FXNUM_FAST_OBSERVER_READ_( *this ) \ 4325 m_val op b.get_val(); \ 4327 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \ 4331 DEFN_ASN_OP_T(op,int) \ 4332 DEFN_ASN_OP_T(op,unsigned int) \ 4333 DEFN_ASN_OP_T(op,long) \ 4334 DEFN_ASN_OP_T(op,unsigned long) \ 4335 DEFN_ASN_OP_T(op,float) \ 4336 DEFN_ASN_OP_T(op,double) \ 4337 DEFN_ASN_OP_T(op,const char*) \ 4338 DEFN_ASN_OP_T(op,const sc_fxval&) \ 4339 DEFN_ASN_OP_T(op,const sc_fxnum&) \ 4340 DEFN_ASN_OP_OTHER(op) 4347 #undef DEFN_ASN_OP_T 4348 #undef DEFN_ASN_OP_OTHER 4354 sc_fxnum_fast::operator <<= (
int b )
4365 sc_fxnum_fast::operator >>= (
int b )
4432 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4434 i - m_params.
fwl() );
4441 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4449 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4451 i - m_params.
fwl() );
4458 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4469 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4470 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4473 i - m_params.
fwl(), j - m_params.
fwl() );
4480 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4481 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4484 i - m_params.
fwl(), j - m_params.
fwl() );
4491 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4492 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4495 i - m_params.
fwl(), j - m_params.
fwl() );
4502 SC_ERROR_IF_( i < 0 || i >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4503 SC_ERROR_IF_( j < 0 || j >= m_params.
wl(), sc_core::SC_ID_OUT_OF_RANGE_ );
4506 i - m_params.
fwl(), j - m_params.
fwl() );
4527 return this->
range( m_params.
wl() - 1, 0 );
4534 return this->
range( m_params.
wl() - 1, 0 );
4541 sc_fxnum_fast::operator double()
const 4555 return static_cast<short>(
to_uint64() );
4563 return static_cast<unsigned short>(
to_uint64() );
4587 return static_cast<unsigned int>(
to_uint64() );
4601 double mantissa_dbl = frexp(m_val, &exponent);
4606 if (!(-64 < exponent && exponent < 64))
4611 mantissa = exponent >= 0 ? mantissa << exponent : mantissa >> -exponent;
4612 return mantissa_dbl >= 0 ? mantissa : -mantissa;
4620 return static_cast<long>(
to_uint64() );
4628 return static_cast<unsigned long>(
to_uint64() );
4636 return static_cast<float>( m_val );
4656 return (
id.negative() != 0 );
4665 return id.is_zero();
4709 return m_params.
wl();
4716 return m_params.
iwl();
4723 return m_params.
q_mode();
4730 return m_params.
o_mode();
4737 return m_params.
n_bits();
4794 : m_rep( new
scfx_rep( *a.get_rep() ) ),
4795 m_observer( observer_ )
4806 m_observer( observer_ )
4816 #define DEFN_BIN_OP_T(op,fnc,tp) \ 4819 operator op ( const sc_fxval& a, tp b ) \ 4821 SC_FXVAL_OBSERVER_READ_( a ) \ 4822 sc_fxval tmp( b ); \ 4823 return sc_fxval( sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.m_rep ) ); \ 4828 operator op ( tp a, const sc_fxval& b ) \ 4830 SC_FXVAL_OBSERVER_READ_( b ) \ 4831 sc_fxval tmp( a ); \ 4832 return sc_fxval( sc_dt::fnc ## _scfx_rep( *tmp.m_rep, *b.m_rep ) ); \ 4835 #define DEFN_BIN_OP(op,fnc) \ 4836 DEFN_BIN_OP_T(op,fnc,const sc_fxnum_fast&) 4844 #undef DEFN_BIN_OP_T 4850 #define DEFN_BIN_FNC_T(fnc,tp) \ 4853 fnc ( sc_fxval& c, const sc_fxval& a, tp b ) \ 4855 SC_FXVAL_OBSERVER_READ_( a ) \ 4856 sc_fxval tmp( b ); \ 4858 c.m_rep = sc_dt::fnc ## _scfx_rep( *a.m_rep, *tmp.m_rep ); \ 4859 SC_FXVAL_OBSERVER_WRITE_( c ) \ 4864 fnc ( sc_fxval& c, tp a, const sc_fxval& b ) \ 4866 SC_FXVAL_OBSERVER_READ_( b ) \ 4867 sc_fxval tmp( a ); \ 4869 c.m_rep = sc_dt::fnc ## _scfx_rep( *tmp.m_rep, *b.m_rep ); \ 4870 SC_FXVAL_OBSERVER_WRITE_( c ) \ 4873 #define DEFN_BIN_FNC(fnc) \ 4874 DEFN_BIN_FNC_T(fnc,const sc_fxnum_fast&) 4881 #undef DEFN_BIN_FNC_T 4887 #define DEFN_REL_OP_T(op,ret,tp) \ 4890 operator op ( const sc_fxval& a, tp b ) \ 4892 SC_FXVAL_OBSERVER_READ_( a ) \ 4893 sc_fxval tmp( b ); \ 4894 int result = sc_dt::cmp_scfx_rep( *a.m_rep, *tmp.m_rep ); \ 4900 operator op ( tp a, const sc_fxval& b ) \ 4902 SC_FXVAL_OBSERVER_READ_( b ) \ 4903 sc_fxval tmp( a ); \ 4904 int result = sc_dt::cmp_scfx_rep( *tmp.m_rep, *b.m_rep ); \ 4909 #define DEFN_REL_OP(op,ret) \ 4910 DEFN_REL_OP_T(op,ret,const sc_fxnum_fast&) 4915 DEFN_REL_OP(>=,result >= 0 && result != 2)
4916 DEFN_REL_OP(==,result == 0)
4917 DEFN_REL_OP(!=,result != 0)
4919 #undef DEFN_REL_OP_T 4927 sc_fxval::operator = (
const sc_fxnum& a )
4929 *m_rep = *a.get_rep();
4934 #define DEFN_ASN_OP_T(tp) \ 4937 sc_fxval::operator = ( tp b ) \ 4939 sc_fxval tmp( b ); \ 4940 *m_rep = *tmp.m_rep; \ 4941 SC_FXVAL_OBSERVER_WRITE_( *this ) \ 4947 #undef DEFN_ASN_OP_T 4950 #define DEFN_ASN_OP_T(op,fnc,tp) \ 4953 sc_fxval::operator op ( tp b ) \ 4955 SC_FXVAL_OBSERVER_READ_( *this ) \ 4956 sc_fxval tmp( b ); \ 4957 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *tmp.m_rep ); \ 4960 SC_FXVAL_OBSERVER_WRITE_( *this ) \ 4964 #define DEFN_ASN_OP(op,fnc) \ 4967 sc_fxval::operator op ( const sc_fxnum& b ) \ 4969 SC_FXVAL_OBSERVER_READ_( *this ) \ 4970 scfx_rep* new_rep = sc_dt::fnc ## _scfx_rep( *m_rep, *b.get_rep() ); \ 4973 SC_FXVAL_OBSERVER_WRITE_( *this ) \ 4977 DEFN_ASN_OP_T(op,fnc,const sc_fxnum_fast&) 4984 #undef DEFN_ASN_OP_T 5000 m_observer( observer_ )
5011 m_observer( observer_ )
5021 #define DEFN_BIN_FNC_T(fnc,op,tp) \ 5024 fnc ( sc_fxval_fast& c, const sc_fxval_fast& a, tp b ) \ 5026 SC_FXVAL_FAST_OBSERVER_READ_( a ) \ 5027 sc_fxval_fast tmp( b ); \ 5028 c.m_val = a.m_val op tmp.m_val; \ 5029 SC_FXVAL_FAST_OBSERVER_WRITE_( c ) \ 5034 fnc ( sc_fxval_fast& c, tp a, const sc_fxval_fast& b ) \ 5036 SC_FXVAL_FAST_OBSERVER_READ_( b ) \ 5037 sc_fxval_fast tmp( a ); \ 5038 c.m_val = tmp.m_val op b.m_val; \ 5039 SC_FXVAL_FAST_OBSERVER_WRITE_( c ) \ 5042 #define DEFN_BIN_FNC(fnc,op) \ 5043 DEFN_BIN_FNC_T(fnc,op,const sc_fxval&) \ 5044 DEFN_BIN_FNC_T(fnc,op,const sc_fxnum&) 5051 #undef DEFN_BIN_FNC_T 5061 m_val = a.get_val();
5066 #define DEFN_ASN_OP_T(tp) \ 5069 sc_fxval_fast::operator = ( tp a ) \ 5071 sc_fxval_fast tmp( a ); \ 5072 m_val = tmp.m_val; \ 5073 SC_FXVAL_FAST_OBSERVER_WRITE_( *this ) \ 5079 #undef DEFN_ASN_OP_T 5082 #define DEFN_ASN_OP_T(op,tp) \ 5085 sc_fxval_fast::operator op ( tp b ) \ 5087 SC_FXVAL_FAST_OBSERVER_READ_( *this ) \ 5088 sc_fxval_fast tmp( b ); \ 5089 m_val op tmp.m_val; \ 5090 SC_FXVAL_FAST_OBSERVER_WRITE_( *this ) \ 5094 #define DEFN_ASN_OP(op) \ 5097 sc_fxval_fast::operator op ( const sc_fxnum_fast& b ) \ 5099 SC_FXVAL_FAST_OBSERVER_READ_( *this ) \ 5100 m_val op b.get_val(); \ 5101 SC_FXVAL_FAST_OBSERVER_WRITE_( *this ) \ 5105 DEFN_ASN_OP_T(op,const sc_fxnum&) 5112 #undef DEFN_ASN_OP_T
#define DECL_ASN_OP_T(op, tp)
bool quantization_flag() const
const sc_time operator/(const sc_time &, double)
const sc_fxval_fast operator+() const
const sc_fxcast_switch & cast_switch() const
Base class for the fixed-point types; limited precision.
unsigned short to_ushort() const
#define DECL_BIN_OP(op, dummy)
inline ::std::ostream & operator<<(::std::ostream &os, const sc_fifo< T > &a)
friend const sc_fxval operator<<(const sc_fxnum &, int)
const sc_fxnum_fast_subref range() const
sc_fxnum_fast_observer * observer() const
#define DEFN_RED_FNC(fnc)
#define SC_FXVAL_OBSERVER_WRITE_(object)
const T sc_min(const T &a, const T &b)
Fixed-point value types; limited precision.
Convenient interface to union ieee_double.
sc_proxy< X >::value_type nand_reduce(const sc_proxy< X > &a)
const std::string to_string() const
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
sc_enc
Enumeration of sign encodings.
friend class sc_fxnum_fast
const sc_fxcast_switch & cast_switch() const
#define DEFN_CTOR_T_D(tp)
#define SC_FXNUM_FAST_OBSERVER_CONSTRUCT_(object)
void lshift(sc_fxnum_fast &c, const sc_fxnum_fast &a, int b)
Proxy class for part-selection in class sc_fxnum,.
sc_proxy< X >::value_type xnor_reduce(const sc_proxy< X > &a)
#define DEFN_CTOR_T_A(tp)
#define DEFN_CTOR_T_C(tp)
#define SC_FXNUM_OBSERVER_READ_(object)
Fixed-point cast switch class.
const T sc_max(const T &a, const T &b)
friend void rshift(sc_fxval_fast &, const sc_fxnum_fast &, int)
sc_proxy< X >::value_type nor_reduce(const sc_proxy< X > &a)
sc_fxval_fast(sc_fxval_fast_observer *=0)
#define SC_FXNUM_FAST_OBSERVER_READ_(object)
void scan(::std::istream &=::std::cin)
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
Arbitrary precision signed number.
#define DECL_ASN_OP_A(op)
const sc_time operator-(const sc_time &, const sc_time &)
bool get_slice(int, int, const scfx_params &, sc_bv_base &) const
const sc_fxval_fast operator-() const
bool get_slice(int, int, sc_bv_base &) const
Abstract base class for fixed-point types observers; limited precision.
void scan(::std::istream &=::std::cin)
void observer_read() const
Arbitrary precision unsigned number.
Base class for the fixed-point types; arbitrary precision.
bool overflow_flag() const
void print(::std::ostream &=::std::cout) const
double scfx_pow2(int exp)
Computes 2.
Proxy class for bit-selection in class sc_fxnum_fast, behaves like sc_bit.
void print(::std::ostream &=::std::cout) const
friend const sc_fxval operator/(const sc_fxnum &, const sc_fxnum &)
uint64 const sc_uint_base int b
void print(::std::ostream &=::std::cout) const
void rshift(sc_fxnum_fast &c, const sc_fxnum_fast &a, int b)
sc_fxnum_fast & operator--()
void scan(::std::istream &=::std::cin)
const sc_fxval operator+() const
DEFN_BIN_OP_T(/, div, int64) DEFN_BIN_OP_T(/
unsigned int to_uint() const
#define DEFN_ASN_OP_T(tp)
friend void neg(sc_fxval_fast &, const sc_fxnum_fast &)
Abstract base class for fixed-point value type observers;.
const sc_fxtype_params & type_params() const
bool clear(int, const scfx_params &)
const sc_fxnum_fast_bitref bit(int) const
sc_proxy< X >::value_type xor_reduce(const sc_proxy< X > &a)
Fixed-point value type; arbitrary precision.
SC_API scfx_rep * neg_scfx_rep(const scfx_rep &)
const std::string to_string() const
const sc_fxnum_fast_bitref operator[](int) const
Abstract base class for fixed-point types observers; arbitrary precision.
Arbitrary size logic vector base class.
inline ::std::istream & operator>>(::std::istream &is, sc_fxnum_fast &a)
SC_API scfx_rep * lsh_scfx_rep(const scfx_rep &, int)
bool set(int, const scfx_params &)
Arbitrary-precision fixed-point implementation class.
Proxy class for part-selection in class sc_fxnum_fast,.
const sc_fxtype_params & type_params() const
unsigned long to_ulong() const
sc_proxy< X >::value_type or_reduce(const sc_proxy< X > &a)
void print(::std::ostream &=::std::cout) const
#define DECL_BIN_OP_T(op, tp)
#define SC_ERROR_IF_(cnd, id)
const sc_fxnum_subref operator()() const
sc_fmt
Enumeration of formats for character string conversion.
sc_clock period is zero sc_clock low time is zero sc_fifo< T > cannot have more than one writer bind interface to port failed complete binding failed remove port failed insert primitive channel failed sc_signal< T > cannot have more than one driver resolved port not bound to resolved signal sc_semaphore requires an initial value
friend const sc_fxval_fast operator>>(const sc_fxnum_fast &, int)
friend class sc_fxnum_fast_subref
SC_API const std::string to_string(sc_enc)
unsigned int to_uint() const
Abstract base class for fixed-point value type observers;.
SC_API scfx_rep * rsh_scfx_rep(const scfx_rep &, int)
#define SC_FXVAL_FAST_OBSERVER_CONSTRUCT_(object)
bool set_slice(int, int, const sc_bv_base &)
bool overflow_flag() const
bool set_slice(int, int, const scfx_params &, const sc_bv_base &)
void neg(sc_fxnum_fast &c, const sc_fxnum_fast &a)
friend class sc_fxval_fast
Fixed-point type parameters class.
friend void rshift(sc_fxval &, const sc_fxnum &, int)
sc_numrep
Enumeration of number representations for character string conversion.
friend class sc_fxnum_bitref
void print(::std::ostream &=::std::cout) const
#define SC_FXNUM_OBSERVER_DESTRUCT_(object)
#define SC_FXNUM_OBSERVER_WRITE_(object)
void print(::std::ostream &=::std::cout) const
void scan(::std::istream &=::std::cin)
friend const sc_fxval operator>>(const sc_fxnum &, int)
#define DEFN_BIN_FNC(fnc)
const sc_time operator+(const sc_time &, const sc_time &)
unsigned long to_ulong() const
sc_fxnum_observer * observer() const
#define SC_FXNUM_FAST_OBSERVER_WRITE_(object)
#define DEFN_CTOR_T_B(tp)
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
friend void neg(sc_fxval &, const sc_fxnum &)
unsigned long to_ulong() const
#define SC_FXNUM_FAST_OBSERVER_DEFAULT_
const scfx_rep * get_rep() const
const sc_fxnum_subref range() const
#define SC_FXVAL_OBSERVER_DEFAULT_
sc_q_mode
Enumeration of quantization modes.
unsigned long to_ulong() const
#define SC_FXVAL_FAST_OBSERVER_WRITE_(object)
sc_fxnum_fast & operator++()
friend class sc_fxnum_subref
#define SC_FXVAL_OBSERVER_CONSTRUCT_(object)
friend const sc_fxval_fast operator/(const sc_fxnum_fast &, const sc_fxnum_fast &)
SC_API scfx_rep * div_scfx_rep(const scfx_rep &, const scfx_rep &, int max_wl=SC_DEFAULT_DIV_WL_)
#define SC_FXNUM_FAST_OBSERVER_DESTRUCT_(object)
#define DECL_BIN_FNC(fnc)
unsigned int to_uint() const
const sc_fxval operator-() const
const sc_fxnum_fast_subref operator()() const
bool quantization_flag() const
unsigned int to_uint() const
const sc_fxval value() const
friend void lshift(sc_fxval_fast &, const sc_fxnum_fast &, int)
unsigned long to_ulong() const
#define SC_FXNUM_OBSERVER_DEFAULT_
#define SC_FXVAL_FAST_OBSERVER_DEFAULT_
friend void lshift(sc_fxval &, const sc_fxnum &, int)
inline ::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
const sc_fxtype_params & type_params() const
const sc_fxval_fast value() const
friend class sc_fxnum_fast_bitref
const sc_fxcast_switch & cast_switch() const
sc_o_mode
Enumeration of overflow modes.
void observer_read() const
Arbitrary size logic vector class.
Arbitrary size bit vector base class.
Proxy class for bit-selection in class sc_fxnum, behaves like sc_bit.
const scfx_rep * get_rep() const
unsigned int to_uint() const
sc_proxy< X >::value_type and_reduce(const sc_proxy< X > &a)
#define DEFN_BIN_OP(op, fnc)
void scan(::std::istream &=::std::cin)
void scan(::std::istream &=::std::cin)
#define SC_FXNUM_OBSERVER_CONSTRUCT_(object)
inline ::std::istream & operator>>(::std::istream &is, sc_bit &a)
const sc_fxnum_bitref operator[](int) const
const sc_fxnum_bitref bit(int) const
unsigned short to_ushort() const
static const uint64 UINT64_ONE
const std::string to_string() const