112 #define DECL_CTORS_T(tp) \ 115 sc_fxnum_observer* = 0 ); \ 117 sc_q_mode, sc_o_mode, \ 118 sc_fxnum_observer* = 0 ); \ 120 sc_q_mode, sc_o_mode, int, \ 121 sc_fxnum_observer* = 0 ); \ 123 int, int, sc_q_mode, sc_o_mode, \ 124 sc_fxnum_observer* = 0 ); \ 126 int, int, sc_q_mode, sc_o_mode, int, \ 127 sc_fxnum_observer* = 0 ); \ 129 const sc_fxcast_switch&, \ 130 sc_fxnum_observer* = 0 ); \ 133 const sc_fxcast_switch&, \ 134 sc_fxnum_observer* = 0 ); \ 136 sc_q_mode, sc_o_mode, \ 137 const sc_fxcast_switch&, \ 138 sc_fxnum_observer* = 0 ); \ 140 sc_q_mode, sc_o_mode, int, \ 141 const sc_fxcast_switch&, \ 142 sc_fxnum_observer* = 0 ); \ 144 int, int, sc_q_mode, sc_o_mode, \ 145 const sc_fxcast_switch&, \ 146 sc_fxnum_observer* = 0 ); \ 148 int, int, sc_q_mode, sc_o_mode, int, \ 149 const sc_fxcast_switch&, \ 150 sc_fxnum_observer* = 0 ); \ 152 const sc_fxtype_params&, \ 153 sc_fxnum_observer* = 0 ); \ 155 const sc_fxtype_params&, \ 156 const sc_fxcast_switch&, \ 157 sc_fxnum_observer* = 0 ); 159 #define DECL_CTORS_T_A(tp) \ 161 sc_fxnum_observer* = 0 ); \ 164 #define DECL_CTORS_T_B(tp) \ 165 explicit sc_fix( tp, \ 166 sc_fxnum_observer* = 0 ); \ 180 #ifndef SC_FX_EXCLUDE_OTHER 190 #undef DECL_CTORS_T_A 191 #undef DECL_CTORS_T_B 205 friend void b_not( sc_fix&,
const sc_fix& );
210 friend const sc_fix
operator & (
const sc_fix&,
const sc_fix& );
213 friend const sc_fix
operator | (
const sc_fix&,
const sc_fix& );
216 friend const sc_fix
operator ^ (
const sc_fix&,
const sc_fix& );
223 friend void b_and( sc_fix&,
const sc_fix&,
const sc_fix& );
226 friend void b_or ( sc_fix&,
const sc_fix&,
const sc_fix& );
229 friend void b_xor( sc_fix&,
const sc_fix&,
const sc_fix& );
236 sc_fix& operator = (
const sc_fix& );
238 #define DECL_ASN_OP_T(op,tp) \ 239 sc_fix& operator op ( tp ); 241 #ifndef SC_FX_EXCLUDE_OTHER 242 #define DECL_ASN_OP_OTHER(op) \ 243 DECL_ASN_OP_T(op,int64) \ 244 DECL_ASN_OP_T(op,uint64) \ 245 DECL_ASN_OP_T(op,const sc_int_base&) \ 246 DECL_ASN_OP_T(op,const sc_uint_base&) \ 247 DECL_ASN_OP_T(op,const sc_signed&) \ 248 DECL_ASN_OP_T(op,const sc_unsigned&) 250 #define DECL_ASN_OP_OTHER(op) 253 #define DECL_ASN_OP(op) \ 254 DECL_ASN_OP_T(op,int) \ 255 DECL_ASN_OP_T(op,unsigned int) \ 256 DECL_ASN_OP_T(op,long) \ 257 DECL_ASN_OP_T(op,unsigned long) \ 258 DECL_ASN_OP_T(op,float) \ 259 DECL_ASN_OP_T(op,double) \ 260 DECL_ASN_OP_T(op,const char*) \ 261 DECL_ASN_OP_T(op,const sc_fxval&) \ 262 DECL_ASN_OP_T(op,const sc_fxval_fast&) \ 263 DECL_ASN_OP_T(op,const sc_fxnum&) \ 264 DECL_ASN_OP_T(op,const sc_fxnum_fast&) \ 265 DECL_ASN_OP_OTHER(op) 285 #undef DECL_ASN_OP_OTHER 294 sc_fix& operator ++ ();
295 sc_fix& operator -- ();
347 #define DECL_CTORS_T(tp) \ 350 sc_fxnum_fast_observer* = 0 ); \ 352 sc_q_mode, sc_o_mode, \ 353 sc_fxnum_fast_observer* = 0 ); \ 355 sc_q_mode, sc_o_mode, int, \ 356 sc_fxnum_fast_observer* = 0 ); \ 358 int, int, sc_q_mode, sc_o_mode, \ 359 sc_fxnum_fast_observer* = 0 ); \ 361 int, int, sc_q_mode, sc_o_mode, int, \ 362 sc_fxnum_fast_observer* = 0 ); \ 364 const sc_fxcast_switch&, \ 365 sc_fxnum_fast_observer* = 0 ); \ 368 const sc_fxcast_switch&, \ 369 sc_fxnum_fast_observer* = 0 ); \ 371 sc_q_mode, sc_o_mode, \ 372 const sc_fxcast_switch&, \ 373 sc_fxnum_fast_observer* = 0 ); \ 375 sc_q_mode, sc_o_mode, int, \ 376 const sc_fxcast_switch&, \ 377 sc_fxnum_fast_observer* = 0 ); \ 379 int, int, sc_q_mode, sc_o_mode, \ 380 const sc_fxcast_switch&, \ 381 sc_fxnum_fast_observer* = 0 ); \ 383 int, int, sc_q_mode, sc_o_mode, int, \ 384 const sc_fxcast_switch&, \ 385 sc_fxnum_fast_observer* = 0 ); \ 387 const sc_fxtype_params&, \ 388 sc_fxnum_fast_observer* = 0 ); \ 390 const sc_fxtype_params&, \ 391 const sc_fxcast_switch&, \ 392 sc_fxnum_fast_observer* = 0 ); 394 #define DECL_CTORS_T_A(tp) \ 396 sc_fxnum_fast_observer* = 0 ); \ 399 #define DECL_CTORS_T_B(tp) \ 400 explicit sc_fix_fast( tp, \ 401 sc_fxnum_fast_observer* = 0 ); \ 415 #ifndef SC_FX_EXCLUDE_OTHER 425 #undef DECL_CTORS_T_A 426 #undef DECL_CTORS_T_B 430 sc_fix_fast(
const sc_fix_fast& );
440 friend void b_not( sc_fix_fast&,
const sc_fix_fast& );
445 friend const sc_fix_fast
operator & (
const sc_fix_fast&,
446 const sc_fix_fast& );
447 friend const sc_fix_fast
operator ^ (
const sc_fix_fast&,
448 const sc_fix_fast& );
449 friend const sc_fix_fast
operator | (
const sc_fix_fast&,
450 const sc_fix_fast& );
455 friend void b_and( sc_fix_fast&,
const sc_fix_fast&,
const sc_fix_fast& );
456 friend void b_or ( sc_fix_fast&,
const sc_fix_fast&,
const sc_fix_fast& );
457 friend void b_xor( sc_fix_fast&,
const sc_fix_fast&,
const sc_fix_fast& );
462 sc_fix_fast& operator = (
const sc_fix_fast& );
464 #define DECL_ASN_OP_T(op,tp) \ 465 sc_fix_fast& operator op ( tp ); 467 #ifndef SC_FX_EXCLUDE_OTHER 468 #define DECL_ASN_OP_OTHER(op) \ 469 DECL_ASN_OP_T(op,int64) \ 470 DECL_ASN_OP_T(op,uint64) \ 471 DECL_ASN_OP_T(op,const sc_int_base&) \ 472 DECL_ASN_OP_T(op,const sc_uint_base&) \ 473 DECL_ASN_OP_T(op,const sc_signed&) \ 474 DECL_ASN_OP_T(op,const sc_unsigned&) 476 #define DECL_ASN_OP_OTHER(op) 479 #define DECL_ASN_OP(op) \ 480 DECL_ASN_OP_T(op,int) \ 481 DECL_ASN_OP_T(op,unsigned int) \ 482 DECL_ASN_OP_T(op,long) \ 483 DECL_ASN_OP_T(op,unsigned long) \ 484 DECL_ASN_OP_T(op,float) \ 485 DECL_ASN_OP_T(op,double) \ 486 DECL_ASN_OP_T(op,const char*) \ 487 DECL_ASN_OP_T(op,const sc_fxval&) \ 488 DECL_ASN_OP_T(op,const sc_fxval_fast&) \ 489 DECL_ASN_OP_T(op,const sc_fxnum&) \ 490 DECL_ASN_OP_T(op,const sc_fxnum_fast&) \ 491 DECL_ASN_OP_OTHER(op) 501 DECL_ASN_OP_T(>>=,
int)
503 DECL_ASN_OP_T(&=,const sc_fix&)
504 DECL_ASN_OP_T(&=,const sc_fix_fast&)
505 DECL_ASN_OP_T(|=,const sc_fix&)
506 DECL_ASN_OP_T(|=,const sc_fix_fast&)
507 DECL_ASN_OP_T(^=,const sc_fix&)
508 DECL_ASN_OP_T(^=,const sc_fix_fast&)
511 #undef DECL_ASN_OP_OTHER 517 const sc_fxval_fast operator ++ (
int );
518 const sc_fxval_fast operator -- (
int );
520 sc_fix_fast& operator ++ ();
521 sc_fix_fast& operator -- ();
667 #define DEFN_CTORS_T_A(tp) \ 669 sc_fix::sc_fix( tp a, \ 670 sc_fxnum_observer* observer_ ) \ 672 sc_fxtype_params(), \ 674 sc_fxcast_switch(), \ 679 sc_fix::sc_fix( tp a, \ 681 sc_fxnum_observer* observer_ ) \ 683 sc_fxtype_params( wl_, iwl_ ), \ 685 sc_fxcast_switch(), \ 690 sc_fix::sc_fix( tp a, \ 691 sc_q_mode qm, sc_o_mode om, \ 692 sc_fxnum_observer* observer_ ) \ 694 sc_fxtype_params( qm, om ), \ 696 sc_fxcast_switch(), \ 701 sc_fix::sc_fix( tp a, \ 702 sc_q_mode qm, sc_o_mode om, int nb, \ 703 sc_fxnum_observer* observer_ ) \ 705 sc_fxtype_params( qm, om, nb ), \ 707 sc_fxcast_switch(), \ 712 sc_fix::sc_fix( tp a, \ 713 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \ 714 sc_fxnum_observer* observer_ ) \ 716 sc_fxtype_params( wl_, iwl_, qm, om ), \ 718 sc_fxcast_switch(), \ 723 sc_fix::sc_fix( tp a, \ 724 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \ 725 sc_fxnum_observer* observer_ ) \ 727 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \ 729 sc_fxcast_switch(), \ 734 sc_fix::sc_fix( tp a, \ 735 const sc_fxcast_switch& cast_sw, \ 736 sc_fxnum_observer* observer_ ) \ 738 sc_fxtype_params(), \ 745 sc_fix::sc_fix( tp a, \ 747 const sc_fxcast_switch& cast_sw, \ 748 sc_fxnum_observer* observer_ ) \ 750 sc_fxtype_params( wl_, iwl_ ), \ 757 sc_fix::sc_fix( tp a, \ 758 sc_q_mode qm, sc_o_mode om, \ 759 const sc_fxcast_switch& cast_sw, \ 760 sc_fxnum_observer* observer_ ) \ 762 sc_fxtype_params( qm, om ), \ 769 sc_fix::sc_fix( tp a, \ 770 sc_q_mode qm, sc_o_mode om, int nb, \ 771 const sc_fxcast_switch& cast_sw, \ 772 sc_fxnum_observer* observer_ ) \ 774 sc_fxtype_params( qm, om, nb ), \ 781 sc_fix::sc_fix( tp a, \ 782 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \ 783 const sc_fxcast_switch& cast_sw, \ 784 sc_fxnum_observer* observer_ ) \ 786 sc_fxtype_params( wl_, iwl_, qm, om ), \ 793 sc_fix::sc_fix( tp a, \ 794 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \ 795 const sc_fxcast_switch& cast_sw, \ 796 sc_fxnum_observer* observer_ ) \ 798 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \ 805 sc_fix::sc_fix( tp a, \ 806 const sc_fxtype_params& type_params_, \ 807 sc_fxnum_observer* observer_ ) \ 811 sc_fxcast_switch(), \ 816 sc_fix::sc_fix( tp a, \ 817 const sc_fxtype_params& type_params_, \ 818 const sc_fxcast_switch& cast_sw, \ 819 sc_fxnum_observer* observer_ ) \ 827 #define DEFN_CTORS_T_B(tp) \ 829 sc_fix::sc_fix( tp a, \ 830 sc_fxnum_observer* observer_ ) \ 834 sc_fxcast_switch(), \ 839 sc_fix::sc_fix( tp a, \ 841 sc_fxnum_observer* observer_ ) \ 843 sc_fxtype_params( a.type_params(), wl_, iwl_ ), \ 845 sc_fxcast_switch(), \ 850 sc_fix::sc_fix( tp a, \ 851 sc_q_mode qm, sc_o_mode om, \ 852 sc_fxnum_observer* observer_ ) \ 854 sc_fxtype_params( a.type_params(), qm, om ), \ 856 sc_fxcast_switch(), \ 861 sc_fix::sc_fix( tp a, \ 862 sc_q_mode qm, sc_o_mode om, int nb, \ 863 sc_fxnum_observer* observer_ ) \ 865 sc_fxtype_params( a.type_params(), qm, om, nb ), \ 867 sc_fxcast_switch(), \ 872 sc_fix::sc_fix( tp a, \ 873 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \ 874 sc_fxnum_observer* observer_ ) \ 876 sc_fxtype_params( wl_, iwl_, qm, om ), \ 878 sc_fxcast_switch(), \ 883 sc_fix::sc_fix( tp a, \ 884 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \ 885 sc_fxnum_observer* observer_ ) \ 887 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \ 889 sc_fxcast_switch(), \ 894 sc_fix::sc_fix( tp a, \ 895 const sc_fxcast_switch& cast_sw, \ 896 sc_fxnum_observer* observer_ ) \ 905 sc_fix::sc_fix( tp a, \ 907 const sc_fxcast_switch& cast_sw, \ 908 sc_fxnum_observer* observer_ ) \ 910 sc_fxtype_params( a.type_params(), wl_, iwl_ ), \ 917 sc_fix::sc_fix( tp a, \ 918 sc_q_mode qm, sc_o_mode om, \ 919 const sc_fxcast_switch& cast_sw, \ 920 sc_fxnum_observer* observer_ ) \ 922 sc_fxtype_params( a.type_params(), qm, om ), \ 929 sc_fix::sc_fix( tp a, \ 930 sc_q_mode qm, sc_o_mode om, int nb, \ 931 const sc_fxcast_switch& cast_sw, \ 932 sc_fxnum_observer* observer_ ) \ 934 sc_fxtype_params( a.type_params(), qm, om, nb ), \ 941 sc_fix::sc_fix( tp a, \ 942 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \ 943 const sc_fxcast_switch& cast_sw, \ 944 sc_fxnum_observer* observer_ ) \ 946 sc_fxtype_params( wl_, iwl_, qm, om ), \ 953 sc_fix::sc_fix( tp a, \ 954 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \ 955 const sc_fxcast_switch& cast_sw, \ 956 sc_fxnum_observer* observer_ ) \ 958 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \ 965 sc_fix::sc_fix( tp a, \ 966 const sc_fxtype_params& type_params_, \ 967 sc_fxnum_observer* observer_ ) \ 971 sc_fxcast_switch(), \ 976 sc_fix::sc_fix( tp a, \ 977 const sc_fxtype_params& type_params_, \ 978 const sc_fxcast_switch& cast_sw, \ 979 sc_fxnum_observer* observer_ ) \ 998 #ifndef SC_FX_EXCLUDE_OTHER 1007 #undef DEFN_CTORS_T_A 1008 #undef DEFN_CTORS_T_B 1032 for(
int i = iwl_c - wl_c; i < iwl_c; ++ i )
1034 return sc_fix( c, wl_c, iwl_c );
1045 int iwl_c = c.
iwl();
1046 for(
int i = iwl_c - c.
wl(); i < iwl_c; ++ i )
1055 #define DEFN_BIN_OP_T(op,op2,tp1,tp2) \ 1058 operator op ( const tp1& a, const tp2& b ) \ 1060 a.observer_read(); \ 1061 b.observer_read(); \ 1062 int iwl_a = a.iwl(); \ 1063 int iwl_b = b.iwl(); \ 1064 int iwl_c = sc_max( iwl_a, iwl_b ); \ 1065 int fwl_c = sc_max( a.wl() - iwl_a, b.wl() - iwl_b ); \ 1066 sc_fix c( iwl_c + fwl_c, iwl_c ); \ 1067 for( int i = -fwl_c; i < iwl_c; ++ i ) \ 1068 c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \ 1069 return sc_fix( c, iwl_c + fwl_c, iwl_c ); \ 1084 #undef DEFN_BIN_OP_T 1089 #define DEFN_BIN_FNC_T(fnc,op2,tp1,tp2) \ 1092 fnc ( sc_fix& c, const tp1& a, const tp2& b ) \ 1094 a.observer_read(); \ 1095 b.observer_read(); \ 1096 int iwl_c = c.iwl(); \ 1097 for( int i = iwl_c - c.wl(); i < iwl_c; ++ i ) \ 1098 c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \ 1100 SC_FXNUM_OBSERVER_WRITE_( c ) \ 1115 #undef DEFN_BIN_FNC_T 1124 sc_fxnum::operator = ( a );
1128 #define DEFN_ASN_OP_T(op,tp) \ 1131 sc_fix::operator op ( tp a ) \ 1133 sc_fxnum::operator op( a ); \ 1137 #ifndef SC_FX_EXCLUDE_OTHER 1138 #define DEFN_ASN_OP_OTHER(op) \ 1139 DEFN_ASN_OP_T(op,int64) \ 1140 DEFN_ASN_OP_T(op,uint64) \ 1141 DEFN_ASN_OP_T(op,const sc_int_base&) \ 1142 DEFN_ASN_OP_T(op,const sc_uint_base&) \ 1143 DEFN_ASN_OP_T(op,const sc_signed&) \ 1144 DEFN_ASN_OP_T(op,const sc_unsigned&) 1146 #define DEFN_ASN_OP_OTHER(op) 1149 #define DEFN_ASN_OP(op) \ 1150 DEFN_ASN_OP_T(op,int) \ 1151 DEFN_ASN_OP_T(op,unsigned int) \ 1152 DEFN_ASN_OP_T(op,long) \ 1153 DEFN_ASN_OP_T(op,unsigned long) \ 1154 DEFN_ASN_OP_T(op,float) \ 1155 DEFN_ASN_OP_T(op,double) \ 1156 DEFN_ASN_OP_T(op,const char*) \ 1157 DEFN_ASN_OP_T(op,const sc_fxval&) \ 1158 DEFN_ASN_OP_T(op,const sc_fxval_fast&) \ 1159 DEFN_ASN_OP_T(op,const sc_fxnum&) \ 1160 DEFN_ASN_OP_T(op,const sc_fxnum_fast&) \ 1161 DEFN_ASN_OP_OTHER(op) 1173 #undef DEFN_ASN_OP_T 1174 #undef DEFN_ASN_OP_OTHER 1178 #define DEFN_ASN_OP_T(op,op2,tp) \ 1181 sc_fix::operator op ( const tp& b ) \ 1183 SC_FXNUM_OBSERVER_READ_( *this ) \ 1184 b.observer_read(); \ 1185 int iwl_c = iwl(); \ 1186 for( int i = iwl_c - wl(); i < iwl_c; ++ i ) \ 1187 set_bit( i, get_bit( i ) op2 b.get_bit( i ) ); \ 1189 SC_FXNUM_OBSERVER_WRITE_( *this ) \ 1200 #undef DEFN_ASN_OP_T 1209 return sc_fxval( sc_fxnum::operator ++ ( 0 ) );
1216 return sc_fxval( sc_fxnum::operator -- ( 0 ) );
1377 #define DEFN_CTORS_T_A(tp) \ 1379 sc_fix_fast::sc_fix_fast( tp a, \ 1380 sc_fxnum_fast_observer* observer_ ) \ 1381 : sc_fxnum_fast( a, \ 1382 sc_fxtype_params(), \ 1384 sc_fxcast_switch(), \ 1389 sc_fix_fast::sc_fix_fast( tp a, \ 1390 int wl_, int iwl_, \ 1391 sc_fxnum_fast_observer* observer_ ) \ 1392 : sc_fxnum_fast( a, \ 1393 sc_fxtype_params( wl_, iwl_ ), \ 1395 sc_fxcast_switch(), \ 1400 sc_fix_fast::sc_fix_fast( tp a, \ 1401 sc_q_mode qm, sc_o_mode om, \ 1402 sc_fxnum_fast_observer* observer_ ) \ 1403 : sc_fxnum_fast( a, \ 1404 sc_fxtype_params( qm, om ), \ 1406 sc_fxcast_switch(), \ 1411 sc_fix_fast::sc_fix_fast( tp a, \ 1412 sc_q_mode qm, sc_o_mode om, int nb, \ 1413 sc_fxnum_fast_observer* observer_ ) \ 1414 : sc_fxnum_fast( a, \ 1415 sc_fxtype_params( qm, om, nb ), \ 1417 sc_fxcast_switch(), \ 1422 sc_fix_fast::sc_fix_fast( tp a, \ 1423 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \ 1424 sc_fxnum_fast_observer* observer_ ) \ 1425 : sc_fxnum_fast( a, \ 1426 sc_fxtype_params( wl_, iwl_, qm, om ), \ 1428 sc_fxcast_switch(), \ 1433 sc_fix_fast::sc_fix_fast( tp a, \ 1434 int wl_, int iwl_, \ 1435 sc_q_mode qm, sc_o_mode om, int nb, \ 1436 sc_fxnum_fast_observer* observer_ ) \ 1437 : sc_fxnum_fast( a, \ 1438 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \ 1440 sc_fxcast_switch(), \ 1445 sc_fix_fast::sc_fix_fast( tp a, \ 1446 const sc_fxcast_switch& cast_sw, \ 1447 sc_fxnum_fast_observer* observer_ ) \ 1448 : sc_fxnum_fast( a, \ 1449 sc_fxtype_params(), \ 1456 sc_fix_fast::sc_fix_fast( tp a, \ 1457 int wl_, int iwl_, \ 1458 const sc_fxcast_switch& cast_sw, \ 1459 sc_fxnum_fast_observer* observer_ ) \ 1460 : sc_fxnum_fast( a, \ 1461 sc_fxtype_params( wl_, iwl_ ), \ 1468 sc_fix_fast::sc_fix_fast( tp a, \ 1469 sc_q_mode qm, sc_o_mode om, \ 1470 const sc_fxcast_switch& cast_sw, \ 1471 sc_fxnum_fast_observer* observer_ ) \ 1472 : sc_fxnum_fast( a, \ 1473 sc_fxtype_params( qm, om ), \ 1480 sc_fix_fast::sc_fix_fast( tp a, \ 1481 sc_q_mode qm, sc_o_mode om, int nb, \ 1482 const sc_fxcast_switch& cast_sw, \ 1483 sc_fxnum_fast_observer* observer_ ) \ 1484 : sc_fxnum_fast( a, \ 1485 sc_fxtype_params( qm, om, nb ), \ 1492 sc_fix_fast::sc_fix_fast( tp a, \ 1493 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \ 1494 const sc_fxcast_switch& cast_sw, \ 1495 sc_fxnum_fast_observer* observer_ ) \ 1496 : sc_fxnum_fast( a, \ 1497 sc_fxtype_params( wl_, iwl_, qm, om ), \ 1504 sc_fix_fast::sc_fix_fast( tp a, \ 1505 int wl_, int iwl_, \ 1506 sc_q_mode qm, sc_o_mode om, int nb, \ 1507 const sc_fxcast_switch& cast_sw, \ 1508 sc_fxnum_fast_observer* observer_ ) \ 1509 : sc_fxnum_fast( a, \ 1510 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \ 1517 sc_fix_fast::sc_fix_fast( tp a, \ 1518 const sc_fxtype_params& type_params_, \ 1519 sc_fxnum_fast_observer* observer_ ) \ 1520 : sc_fxnum_fast( a, \ 1523 sc_fxcast_switch(), \ 1528 sc_fix_fast::sc_fix_fast( tp a, \ 1529 const sc_fxtype_params& type_params_, \ 1530 const sc_fxcast_switch& cast_sw, \ 1531 sc_fxnum_fast_observer* observer_ ) \ 1532 : sc_fxnum_fast( a, \ 1539 #define DEFN_CTORS_T_B(tp) \ 1541 sc_fix_fast::sc_fix_fast( tp a, \ 1542 sc_fxnum_fast_observer* observer_ ) \ 1543 : sc_fxnum_fast( a, \ 1546 sc_fxcast_switch(), \ 1551 sc_fix_fast::sc_fix_fast( tp a, \ 1552 int wl_, int iwl_, \ 1553 sc_fxnum_fast_observer* observer_ ) \ 1554 : sc_fxnum_fast( a, \ 1555 sc_fxtype_params( a.type_params(), wl_, iwl_ ), \ 1557 sc_fxcast_switch(), \ 1562 sc_fix_fast::sc_fix_fast( tp a, \ 1563 sc_q_mode qm, sc_o_mode om, \ 1564 sc_fxnum_fast_observer* observer_ ) \ 1565 : sc_fxnum_fast( a, \ 1566 sc_fxtype_params( a.type_params(), qm, om ), \ 1568 sc_fxcast_switch(), \ 1573 sc_fix_fast::sc_fix_fast( tp a, \ 1574 sc_q_mode qm, sc_o_mode om, int nb, \ 1575 sc_fxnum_fast_observer* observer_ ) \ 1576 : sc_fxnum_fast( a, \ 1577 sc_fxtype_params( a.type_params(), qm, om, nb ), \ 1579 sc_fxcast_switch(), \ 1584 sc_fix_fast::sc_fix_fast( tp a, \ 1585 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \ 1586 sc_fxnum_fast_observer* observer_ ) \ 1587 : sc_fxnum_fast( a, \ 1588 sc_fxtype_params( wl_, iwl_, qm, om ), \ 1590 sc_fxcast_switch(), \ 1595 sc_fix_fast::sc_fix_fast( tp a, \ 1596 int wl_, int iwl_, \ 1597 sc_q_mode qm, sc_o_mode om, int nb, \ 1598 sc_fxnum_fast_observer* observer_ ) \ 1599 : sc_fxnum_fast( a, \ 1600 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \ 1602 sc_fxcast_switch(), \ 1607 sc_fix_fast::sc_fix_fast( tp a, \ 1608 const sc_fxcast_switch& cast_sw, \ 1609 sc_fxnum_fast_observer* observer_ ) \ 1610 : sc_fxnum_fast( a, \ 1618 sc_fix_fast::sc_fix_fast( tp a, \ 1619 int wl_, int iwl_, \ 1620 const sc_fxcast_switch& cast_sw, \ 1621 sc_fxnum_fast_observer* observer_ ) \ 1622 : sc_fxnum_fast( a, \ 1623 sc_fxtype_params( a.type_params(), wl_, iwl_ ), \ 1630 sc_fix_fast::sc_fix_fast( tp a, \ 1631 sc_q_mode qm, sc_o_mode om, \ 1632 const sc_fxcast_switch& cast_sw, \ 1633 sc_fxnum_fast_observer* observer_ ) \ 1634 : sc_fxnum_fast( a, \ 1635 sc_fxtype_params( a.type_params(), qm, om ), \ 1642 sc_fix_fast::sc_fix_fast( tp a, \ 1643 sc_q_mode qm, sc_o_mode om, int nb, \ 1644 const sc_fxcast_switch& cast_sw, \ 1645 sc_fxnum_fast_observer* observer_ ) \ 1646 : sc_fxnum_fast( a, \ 1647 sc_fxtype_params( a.type_params(), qm, om, nb ), \ 1654 sc_fix_fast::sc_fix_fast( tp a, \ 1655 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \ 1656 const sc_fxcast_switch& cast_sw, \ 1657 sc_fxnum_fast_observer* observer_ ) \ 1658 : sc_fxnum_fast( a, \ 1659 sc_fxtype_params( wl_, iwl_, qm, om ), \ 1666 sc_fix_fast::sc_fix_fast( tp a, \ 1667 int wl_, int iwl_, \ 1668 sc_q_mode qm, sc_o_mode om, int nb, \ 1669 const sc_fxcast_switch& cast_sw, \ 1670 sc_fxnum_fast_observer* observer_ ) \ 1671 : sc_fxnum_fast( a, \ 1672 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \ 1679 sc_fix_fast::sc_fix_fast( tp a, \ 1680 const sc_fxtype_params& type_params_, \ 1681 sc_fxnum_fast_observer* observer_ ) \ 1682 : sc_fxnum_fast( a, \ 1685 sc_fxcast_switch(), \ 1690 sc_fix_fast::sc_fix_fast( tp a, \ 1691 const sc_fxtype_params& type_params_, \ 1692 const sc_fxcast_switch& cast_sw, \ 1693 sc_fxnum_fast_observer* observer_ ) \ 1694 : sc_fxnum_fast( a, \ 1712 #ifndef SC_FX_EXCLUDE_OTHER 1721 #undef DEFN_CTORS_T_A 1722 #undef DEFN_CTORS_T_B 1746 for(
int i = iwl_c - wl_c; i < iwl_c; ++ i )
1759 int iwl_c = c.
iwl();
1760 for(
int i = iwl_c - c.
wl(); i < iwl_c; ++ i )
1769 #define DEFN_BIN_OP_T(op,op2,tp1,tp2) \ 1772 operator op ( const tp1& a, const tp2& b ) \ 1774 a.observer_read(); \ 1775 b.observer_read(); \ 1776 int iwl_a = a.iwl(); \ 1777 int iwl_b = b.iwl(); \ 1778 int iwl_c = sc_max( iwl_a, iwl_b ); \ 1779 int fwl_c = sc_max( a.wl() - iwl_a, b.wl() - iwl_b ); \ 1780 sc_fix_fast c( iwl_c + fwl_c, iwl_c ); \ 1781 for( int i = -fwl_c; i < iwl_c; ++ i ) \ 1782 c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \ 1783 return sc_fix_fast( c, iwl_c + fwl_c, iwl_c ); \ 1790 #undef DEFN_BIN_OP_T 1795 #define DEFN_BIN_FNC_T(fnc,op2,tp1,tp2) \ 1798 fnc ( sc_fix_fast& c, const tp1& a, const tp2& b ) \ 1800 a.observer_read(); \ 1801 b.observer_read(); \ 1802 int iwl_c = c.iwl(); \ 1803 for( int i = iwl_c - c.wl(); i < iwl_c; ++ i ) \ 1804 c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \ 1806 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \ 1813 #undef DEFN_BIN_FNC_T 1822 sc_fxnum_fast::operator = ( a );
1826 #define DEFN_ASN_OP_T(op,tp) \ 1829 sc_fix_fast::operator op ( tp a ) \ 1831 sc_fxnum_fast::operator op( a ); \ 1835 #ifndef SC_FX_EXCLUDE_OTHER 1836 #define DEFN_ASN_OP_OTHER(op) \ 1837 DEFN_ASN_OP_T(op,int64) \ 1838 DEFN_ASN_OP_T(op,uint64) \ 1839 DEFN_ASN_OP_T(op,const sc_int_base&) \ 1840 DEFN_ASN_OP_T(op,const sc_uint_base&) \ 1841 DEFN_ASN_OP_T(op,const sc_signed&) \ 1842 DEFN_ASN_OP_T(op,const sc_unsigned&) 1844 #define DEFN_ASN_OP_OTHER(op) 1847 #define DEFN_ASN_OP(op) \ 1848 DEFN_ASN_OP_T(op,int) \ 1849 DEFN_ASN_OP_T(op,unsigned int) \ 1850 DEFN_ASN_OP_T(op,long) \ 1851 DEFN_ASN_OP_T(op,unsigned long) \ 1852 DEFN_ASN_OP_T(op,float) \ 1853 DEFN_ASN_OP_T(op,double) \ 1854 DEFN_ASN_OP_T(op,const char*) \ 1855 DEFN_ASN_OP_T(op,const sc_fxval&) \ 1856 DEFN_ASN_OP_T(op,const sc_fxval_fast&) \ 1857 DEFN_ASN_OP_T(op,const sc_fxnum&) \ 1858 DEFN_ASN_OP_T(op,const sc_fxnum_fast&) \ 1859 DEFN_ASN_OP_OTHER(op) 1869 DEFN_ASN_OP_T(>>=,
int)
1871 #undef DEFN_ASN_OP_T 1872 #undef DEFN_ASN_OP_OTHER 1876 #define DEFN_ASN_OP_T(op,op2,tp) \ 1879 sc_fix_fast::operator op ( const tp& b ) \ 1881 SC_FXNUM_FAST_OBSERVER_READ_( *this ) \ 1882 b.observer_read(); \ 1883 int iwl_c = iwl(); \ 1884 for( int i = iwl_c - wl(); i < iwl_c; ++ i ) \ 1885 set_bit( i, get_bit( i ) op2 b.get_bit( i ) ); \ 1887 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \ 1898 #undef DEFN_ASN_OP_T friend void b_and(sc_fix_fast &, const sc_fix_fast &, const sc_fix_fast &)
friend void b_xor(sc_fix_fast &, const sc_fix_fast &, const sc_fix_fast &)
Base class for the fixed-point types; limited precision.
#define DEFN_CTORS_T_A(tp)
Fixed-point value types; limited precision.
sc_fix_fast & operator++()
const sc_fix_fast operator~() const
#define SC_FXNUM_OBSERVER_READ_(object)
Fixed-point cast switch class.
sc_fix_fast & operator=(const sc_fix_fast &)
"Unconstrained" signed fixed-point class; limited precision.
#define SC_FXNUM_FAST_OBSERVER_READ_(object)
Arbitrary precision signed number.
#define DECL_CTORS_T_A(tp)
friend void b_or(sc_fix_fast &, const sc_fix_fast &, const sc_fix_fast &)
Abstract base class for fixed-point types observers; limited precision.
Arbitrary precision unsigned number.
Base class for the fixed-point types; arbitrary precision.
sc_fxnum_fast & operator--()
DEFN_BIN_OP_T(/, div, int64) DEFN_BIN_OP_T(/
const sc_bit b_or(const sc_bit &a, const sc_bit &b)
const sc_bit b_not(const sc_bit &a)
const sc_fxtype_params & type_params() const
const sc_bit operator|(const sc_bit &a, const sc_bit &b)
Fixed-point value type; arbitrary precision.
Abstract base class for fixed-point types observers; arbitrary precision.
sc_fix_fast & operator--()
const sc_fix operator~() const
#define DEFN_BIN_FNC_T(fnc, op2, tp1, tp2)
friend class sc_fxval_fast
Fixed-point type parameters class.
friend void b_not(sc_fix_fast &, const sc_fix_fast &)
friend void b_not(sc_fix &, const sc_fix &)
const sc_bit operator^(const sc_bit &a, const sc_bit &b)
friend void b_or(sc_fix &, const sc_fix &, const sc_fix &)
#define SC_FXNUM_OBSERVER_WRITE_(object)
friend void b_and(sc_fix &, const sc_fix &, const sc_fix &)
#define DEFN_CTORS_T_B(tp)
#define DECL_CTORS_T_B(tp)
#define SC_FXNUM_FAST_OBSERVER_WRITE_(object)
const sc_bit b_xor(const sc_bit &a, const sc_bit &b)
sc_fix_fast(sc_fxnum_fast_observer *=0)
sc_q_mode
Enumeration of quantization modes.
sc_fix & operator=(const sc_fix &)
#define DEFN_ASN_OP_T(op, tp)
sc_fxnum_fast & operator++()
const sc_bit b_and(const sc_bit &a, const sc_bit &b)
const sc_bit operator&(const sc_bit &a, const sc_bit &b)
"Unconstrained" signed fixed-point class; arbitrary precision.
#define DECL_ASN_OP_T(op, tp)
const sc_fxtype_params & type_params() const
sc_fix(sc_fxnum_observer *=0)
sc_o_mode
Enumeration of overflow modes.
friend void b_xor(sc_fix &, const sc_fix &, const sc_fix &)
const sc_bit operator~(const sc_bit &a)