110 #define DECL_CTORS_T(tp) \
113 sc_fxnum_observer* = 0 ); \
115 sc_q_mode, sc_o_mode, \
116 sc_fxnum_observer* = 0 ); \
118 sc_q_mode, sc_o_mode, int, \
119 sc_fxnum_observer* = 0 ); \
121 int, int, sc_q_mode, sc_o_mode, \
122 sc_fxnum_observer* = 0 ); \
124 int, int, sc_q_mode, sc_o_mode, int, \
125 sc_fxnum_observer* = 0 ); \
127 const sc_fxcast_switch&, \
128 sc_fxnum_observer* = 0 ); \
131 const sc_fxcast_switch&, \
132 sc_fxnum_observer* = 0 ); \
134 sc_q_mode, sc_o_mode, \
135 const sc_fxcast_switch&, \
136 sc_fxnum_observer* = 0 ); \
138 sc_q_mode, sc_o_mode, int, \
139 const sc_fxcast_switch&, \
140 sc_fxnum_observer* = 0 ); \
142 int, int, sc_q_mode, sc_o_mode, \
143 const sc_fxcast_switch&, \
144 sc_fxnum_observer* = 0 ); \
146 int, int, sc_q_mode, sc_o_mode, int, \
147 const sc_fxcast_switch&, \
148 sc_fxnum_observer* = 0 ); \
150 const sc_fxtype_params&, \
151 sc_fxnum_observer* = 0 ); \
153 const sc_fxtype_params&, \
154 const sc_fxcast_switch&, \
155 sc_fxnum_observer* = 0 );
157 #define DECL_CTORS_T_A(tp) \
159 sc_fxnum_observer* = 0 ); \
162 #define DECL_CTORS_T_B(tp) \
163 explicit sc_fix( tp, \
164 sc_fxnum_observer* = 0 ); \
178 #ifndef SC_FX_EXCLUDE_OTHER
188 #undef DECL_CTORS_T_A
189 #undef DECL_CTORS_T_B
203 friend void b_not( sc_fix&,
const sc_fix& );
208 friend const sc_fix
operator & (
const sc_fix&,
const sc_fix& );
211 friend const sc_fix
operator | (
const sc_fix&,
const sc_fix& );
214 friend const sc_fix
operator ^ (
const sc_fix&,
const sc_fix& );
221 friend void b_and( sc_fix&,
const sc_fix&,
const sc_fix& );
224 friend void b_or ( sc_fix&,
const sc_fix&,
const sc_fix& );
227 friend void b_xor( sc_fix&,
const sc_fix&,
const sc_fix& );
236 #define DECL_ASN_OP_T(op,tp) \
237 sc_fix& operator op ( tp );
239 #ifndef SC_FX_EXCLUDE_OTHER
240 #define DECL_ASN_OP_OTHER(op) \
241 DECL_ASN_OP_T(op,int64) \
242 DECL_ASN_OP_T(op,uint64) \
243 DECL_ASN_OP_T(op,const sc_int_base&) \
244 DECL_ASN_OP_T(op,const sc_uint_base&) \
245 DECL_ASN_OP_T(op,const sc_signed&) \
246 DECL_ASN_OP_T(op,const sc_unsigned&)
248 #define DECL_ASN_OP_OTHER(op)
251 #define DECL_ASN_OP(op) \
252 DECL_ASN_OP_T(op,int) \
253 DECL_ASN_OP_T(op,unsigned int) \
254 DECL_ASN_OP_T(op,long) \
255 DECL_ASN_OP_T(op,unsigned long) \
256 DECL_ASN_OP_T(op,float) \
257 DECL_ASN_OP_T(op,double) \
258 DECL_ASN_OP_T(op,const char*) \
259 DECL_ASN_OP_T(op,const sc_fxval&) \
260 DECL_ASN_OP_T(op,const sc_fxval_fast&) \
261 DECL_ASN_OP_T(op,const sc_fxnum&) \
262 DECL_ASN_OP_T(op,const sc_fxnum_fast&) \
263 DECL_ASN_OP_OTHER(op)
283 #undef DECL_ASN_OP_OTHER
345 #define DECL_CTORS_T(tp) \
348 sc_fxnum_fast_observer* = 0 ); \
350 sc_q_mode, sc_o_mode, \
351 sc_fxnum_fast_observer* = 0 ); \
353 sc_q_mode, sc_o_mode, int, \
354 sc_fxnum_fast_observer* = 0 ); \
356 int, int, sc_q_mode, sc_o_mode, \
357 sc_fxnum_fast_observer* = 0 ); \
359 int, int, sc_q_mode, sc_o_mode, int, \
360 sc_fxnum_fast_observer* = 0 ); \
362 const sc_fxcast_switch&, \
363 sc_fxnum_fast_observer* = 0 ); \
366 const sc_fxcast_switch&, \
367 sc_fxnum_fast_observer* = 0 ); \
369 sc_q_mode, sc_o_mode, \
370 const sc_fxcast_switch&, \
371 sc_fxnum_fast_observer* = 0 ); \
373 sc_q_mode, sc_o_mode, int, \
374 const sc_fxcast_switch&, \
375 sc_fxnum_fast_observer* = 0 ); \
377 int, int, sc_q_mode, sc_o_mode, \
378 const sc_fxcast_switch&, \
379 sc_fxnum_fast_observer* = 0 ); \
381 int, int, sc_q_mode, sc_o_mode, int, \
382 const sc_fxcast_switch&, \
383 sc_fxnum_fast_observer* = 0 ); \
385 const sc_fxtype_params&, \
386 sc_fxnum_fast_observer* = 0 ); \
388 const sc_fxtype_params&, \
389 const sc_fxcast_switch&, \
390 sc_fxnum_fast_observer* = 0 );
392 #define DECL_CTORS_T_A(tp) \
394 sc_fxnum_fast_observer* = 0 ); \
397 #define DECL_CTORS_T_B(tp) \
398 explicit sc_fix_fast( tp, \
399 sc_fxnum_fast_observer* = 0 ); \
413 #ifndef SC_FX_EXCLUDE_OTHER
423 #undef DECL_CTORS_T_A
424 #undef DECL_CTORS_T_B
462 #define DECL_ASN_OP_T(op,tp) \
463 sc_fix_fast& operator op ( tp );
465 #ifndef SC_FX_EXCLUDE_OTHER
466 #define DECL_ASN_OP_OTHER(op) \
467 DECL_ASN_OP_T(op,int64) \
468 DECL_ASN_OP_T(op,uint64) \
469 DECL_ASN_OP_T(op,const sc_int_base&) \
470 DECL_ASN_OP_T(op,const sc_uint_base&) \
471 DECL_ASN_OP_T(op,const sc_signed&) \
472 DECL_ASN_OP_T(op,const sc_unsigned&)
474 #define DECL_ASN_OP_OTHER(op)
477 #define DECL_ASN_OP(op) \
478 DECL_ASN_OP_T(op,int) \
479 DECL_ASN_OP_T(op,unsigned int) \
480 DECL_ASN_OP_T(op,long) \
481 DECL_ASN_OP_T(op,unsigned long) \
482 DECL_ASN_OP_T(op,float) \
483 DECL_ASN_OP_T(op,double) \
484 DECL_ASN_OP_T(op,const char*) \
485 DECL_ASN_OP_T(op,const sc_fxval&) \
486 DECL_ASN_OP_T(op,const sc_fxval_fast&) \
487 DECL_ASN_OP_T(op,const sc_fxnum&) \
488 DECL_ASN_OP_T(op,const sc_fxnum_fast&) \
489 DECL_ASN_OP_OTHER(op)
499 DECL_ASN_OP_T(>>=,
int)
501 DECL_ASN_OP_T(&=,const sc_fix&)
503 DECL_ASN_OP_T(|=,const sc_fix&)
505 DECL_ASN_OP_T(^=,const sc_fix&)
509 #undef DECL_ASN_OP_OTHER
665 #define DEFN_CTORS_T_A(tp) \
667 sc_fix::sc_fix( tp a, \
668 sc_fxnum_observer* observer_ ) \
670 sc_fxtype_params(), \
672 sc_fxcast_switch(), \
677 sc_fix::sc_fix( tp a, \
679 sc_fxnum_observer* observer_ ) \
681 sc_fxtype_params( wl_, iwl_ ), \
683 sc_fxcast_switch(), \
688 sc_fix::sc_fix( tp a, \
689 sc_q_mode qm, sc_o_mode om, \
690 sc_fxnum_observer* observer_ ) \
692 sc_fxtype_params( qm, om ), \
694 sc_fxcast_switch(), \
699 sc_fix::sc_fix( tp a, \
700 sc_q_mode qm, sc_o_mode om, int nb, \
701 sc_fxnum_observer* observer_ ) \
703 sc_fxtype_params( qm, om, nb ), \
705 sc_fxcast_switch(), \
710 sc_fix::sc_fix( tp a, \
711 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
712 sc_fxnum_observer* observer_ ) \
714 sc_fxtype_params( wl_, iwl_, qm, om ), \
716 sc_fxcast_switch(), \
721 sc_fix::sc_fix( tp a, \
722 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
723 sc_fxnum_observer* observer_ ) \
725 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
727 sc_fxcast_switch(), \
732 sc_fix::sc_fix( tp a, \
733 const sc_fxcast_switch& cast_sw, \
734 sc_fxnum_observer* observer_ ) \
736 sc_fxtype_params(), \
743 sc_fix::sc_fix( tp a, \
745 const sc_fxcast_switch& cast_sw, \
746 sc_fxnum_observer* observer_ ) \
748 sc_fxtype_params( wl_, iwl_ ), \
755 sc_fix::sc_fix( tp a, \
756 sc_q_mode qm, sc_o_mode om, \
757 const sc_fxcast_switch& cast_sw, \
758 sc_fxnum_observer* observer_ ) \
760 sc_fxtype_params( qm, om ), \
767 sc_fix::sc_fix( tp a, \
768 sc_q_mode qm, sc_o_mode om, int nb, \
769 const sc_fxcast_switch& cast_sw, \
770 sc_fxnum_observer* observer_ ) \
772 sc_fxtype_params( qm, om, nb ), \
779 sc_fix::sc_fix( tp a, \
780 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
781 const sc_fxcast_switch& cast_sw, \
782 sc_fxnum_observer* observer_ ) \
784 sc_fxtype_params( wl_, iwl_, qm, om ), \
791 sc_fix::sc_fix( tp a, \
792 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
793 const sc_fxcast_switch& cast_sw, \
794 sc_fxnum_observer* observer_ ) \
796 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
803 sc_fix::sc_fix( tp a, \
804 const sc_fxtype_params& type_params, \
805 sc_fxnum_observer* observer_ ) \
809 sc_fxcast_switch(), \
814 sc_fix::sc_fix( tp a, \
815 const sc_fxtype_params& type_params, \
816 const sc_fxcast_switch& cast_sw, \
817 sc_fxnum_observer* observer_ ) \
825 #define DEFN_CTORS_T_B(tp) \
827 sc_fix::sc_fix( tp a, \
828 sc_fxnum_observer* observer_ ) \
832 sc_fxcast_switch(), \
837 sc_fix::sc_fix( tp a, \
839 sc_fxnum_observer* observer_ ) \
841 sc_fxtype_params( a.type_params(), wl_, iwl_ ), \
843 sc_fxcast_switch(), \
848 sc_fix::sc_fix( tp a, \
849 sc_q_mode qm, sc_o_mode om, \
850 sc_fxnum_observer* observer_ ) \
852 sc_fxtype_params( a.type_params(), qm, om ), \
854 sc_fxcast_switch(), \
859 sc_fix::sc_fix( tp a, \
860 sc_q_mode qm, sc_o_mode om, int nb, \
861 sc_fxnum_observer* observer_ ) \
863 sc_fxtype_params( a.type_params(), qm, om, nb ), \
865 sc_fxcast_switch(), \
870 sc_fix::sc_fix( tp a, \
871 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
872 sc_fxnum_observer* observer_ ) \
874 sc_fxtype_params( wl_, iwl_, qm, om ), \
876 sc_fxcast_switch(), \
881 sc_fix::sc_fix( tp a, \
882 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
883 sc_fxnum_observer* observer_ ) \
885 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
887 sc_fxcast_switch(), \
892 sc_fix::sc_fix( tp a, \
893 const sc_fxcast_switch& cast_sw, \
894 sc_fxnum_observer* observer_ ) \
903 sc_fix::sc_fix( tp a, \
905 const sc_fxcast_switch& cast_sw, \
906 sc_fxnum_observer* observer_ ) \
908 sc_fxtype_params( a.type_params(), wl_, iwl_ ), \
915 sc_fix::sc_fix( tp a, \
916 sc_q_mode qm, sc_o_mode om, \
917 const sc_fxcast_switch& cast_sw, \
918 sc_fxnum_observer* observer_ ) \
920 sc_fxtype_params( a.type_params(), qm, om ), \
927 sc_fix::sc_fix( tp a, \
928 sc_q_mode qm, sc_o_mode om, int nb, \
929 const sc_fxcast_switch& cast_sw, \
930 sc_fxnum_observer* observer_ ) \
932 sc_fxtype_params( a.type_params(), qm, om, nb ), \
939 sc_fix::sc_fix( tp a, \
940 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
941 const sc_fxcast_switch& cast_sw, \
942 sc_fxnum_observer* observer_ ) \
944 sc_fxtype_params( wl_, iwl_, qm, om ), \
951 sc_fix::sc_fix( tp a, \
952 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
953 const sc_fxcast_switch& cast_sw, \
954 sc_fxnum_observer* observer_ ) \
956 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
963 sc_fix::sc_fix( tp a, \
964 const sc_fxtype_params& type_params, \
965 sc_fxnum_observer* observer_ ) \
969 sc_fxcast_switch(), \
974 sc_fix::sc_fix( tp a, \
975 const sc_fxtype_params& type_params, \
976 const sc_fxcast_switch& cast_sw, \
977 sc_fxnum_observer* observer_ ) \
996 #ifndef SC_FX_EXCLUDE_OTHER
1005 #undef DEFN_CTORS_T_A
1006 #undef DEFN_CTORS_T_B
1030 for(
int i = iwl_c - wl_c; i < iwl_c; ++ i )
1032 return sc_fix( c, wl_c, iwl_c );
1043 int iwl_c = c.
iwl();
1044 for(
int i = iwl_c - c.
wl(); i < iwl_c; ++ i )
1053 #define DEFN_BIN_OP_T(op,op2,tp1,tp2) \
1056 operator op ( const tp1& a, const tp2& b ) \
1058 a.observer_read(); \
1059 b.observer_read(); \
1060 int iwl_a = a.iwl(); \
1061 int iwl_b = b.iwl(); \
1062 int iwl_c = sc_max( iwl_a, iwl_b ); \
1063 int fwl_c = sc_max( a.wl() - iwl_a, b.wl() - iwl_b ); \
1064 sc_fix c( iwl_c + fwl_c, iwl_c ); \
1065 for( int i = -fwl_c; i < iwl_c; ++ i ) \
1066 c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \
1067 return sc_fix( c, iwl_c + fwl_c, iwl_c ); \
1072 DEFN_BIN_OP_T(&,&&,sc_fix_fast,sc_fix)
1074 DEFN_BIN_OP_T(|,||,sc_fix,sc_fix)
1075 DEFN_BIN_OP_T(|,||,sc_fix,sc_fix_fast)
1076 DEFN_BIN_OP_T(|,||,sc_fix_fast,sc_fix)
1078 DEFN_BIN_OP_T(^,!=,sc_fix,sc_fix)
1079 DEFN_BIN_OP_T(^,!=,sc_fix,sc_fix_fast)
1080 DEFN_BIN_OP_T(^,!=,sc_fix_fast,sc_fix)
1082 #undef DEFN_BIN_OP_T
1087 #define DEFN_BIN_FNC_T(fnc,op2,tp1,tp2) \
1090 fnc ( sc_fix& c, const tp1& a, const tp2& b ) \
1092 a.observer_read(); \
1093 b.observer_read(); \
1094 int iwl_c = c.iwl(); \
1095 for( int i = iwl_c - c.wl(); i < iwl_c; ++ i ) \
1096 c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \
1098 SC_FXNUM_OBSERVER_WRITE_( c ) \
1113 #undef DEFN_BIN_FNC_T
1122 sc_fxnum::operator = ( a );
1126 #define DEFN_ASN_OP_T(op,tp) \
1129 sc_fix::operator op ( tp a ) \
1131 sc_fxnum::operator op( a ); \
1135 #ifndef SC_FX_EXCLUDE_OTHER
1136 #define DEFN_ASN_OP_OTHER(op) \
1137 DEFN_ASN_OP_T(op,int64) \
1138 DEFN_ASN_OP_T(op,uint64) \
1139 DEFN_ASN_OP_T(op,const sc_int_base&) \
1140 DEFN_ASN_OP_T(op,const sc_uint_base&) \
1141 DEFN_ASN_OP_T(op,const sc_signed&) \
1142 DEFN_ASN_OP_T(op,const sc_unsigned&)
1144 #define DEFN_ASN_OP_OTHER(op)
1147 #define DEFN_ASN_OP(op) \
1148 DEFN_ASN_OP_T(op,int) \
1149 DEFN_ASN_OP_T(op,unsigned int) \
1150 DEFN_ASN_OP_T(op,long) \
1151 DEFN_ASN_OP_T(op,unsigned long) \
1152 DEFN_ASN_OP_T(op,float) \
1153 DEFN_ASN_OP_T(op,double) \
1154 DEFN_ASN_OP_T(op,const char*) \
1155 DEFN_ASN_OP_T(op,const sc_fxval&) \
1156 DEFN_ASN_OP_T(op,const sc_fxval_fast&) \
1157 DEFN_ASN_OP_T(op,const sc_fxnum&) \
1158 DEFN_ASN_OP_T(op,const sc_fxnum_fast&) \
1159 DEFN_ASN_OP_OTHER(op)
1169 DEFN_ASN_OP_T(>>=,
int)
1171 #undef DEFN_ASN_OP_T
1172 #undef DEFN_ASN_OP_OTHER
1176 #define DEFN_ASN_OP_T(op,op2,tp) \
1179 sc_fix::operator op ( const tp& b ) \
1181 SC_FXNUM_OBSERVER_READ_( *this ) \
1182 b.observer_read(); \
1183 int iwl_c = iwl(); \
1184 for( int i = iwl_c - wl(); i < iwl_c; ++ i ) \
1185 set_bit( i, get_bit( i ) op2 b.get_bit( i ) ); \
1187 SC_FXNUM_OBSERVER_WRITE_( *this ) \
1192 DEFN_ASN_OP_T(&=,&&,sc_fix_fast)
1193 DEFN_ASN_OP_T(|=,||,sc_fix)
1194 DEFN_ASN_OP_T(|=,||,sc_fix_fast)
1195 DEFN_ASN_OP_T(^=,!=,sc_fix)
1196 DEFN_ASN_OP_T(^=,!=,sc_fix_fast)
1198 #undef DEFN_ASN_OP_T
1207 return sc_fxval( sc_fxnum::operator ++ ( 0 ) );
1214 return sc_fxval( sc_fxnum::operator -- ( 0 ) );
1375 #define DEFN_CTORS_T_A(tp) \
1377 sc_fix_fast::sc_fix_fast( tp a, \
1378 sc_fxnum_fast_observer* observer_ ) \
1379 : sc_fxnum_fast( a, \
1380 sc_fxtype_params(), \
1382 sc_fxcast_switch(), \
1387 sc_fix_fast::sc_fix_fast( tp a, \
1388 int wl_, int iwl_, \
1389 sc_fxnum_fast_observer* observer_ ) \
1390 : sc_fxnum_fast( a, \
1391 sc_fxtype_params( wl_, iwl_ ), \
1393 sc_fxcast_switch(), \
1398 sc_fix_fast::sc_fix_fast( tp a, \
1399 sc_q_mode qm, sc_o_mode om, \
1400 sc_fxnum_fast_observer* observer_ ) \
1401 : sc_fxnum_fast( a, \
1402 sc_fxtype_params( qm, om ), \
1404 sc_fxcast_switch(), \
1409 sc_fix_fast::sc_fix_fast( tp a, \
1410 sc_q_mode qm, sc_o_mode om, int nb, \
1411 sc_fxnum_fast_observer* observer_ ) \
1412 : sc_fxnum_fast( a, \
1413 sc_fxtype_params( qm, om, nb ), \
1415 sc_fxcast_switch(), \
1420 sc_fix_fast::sc_fix_fast( tp a, \
1421 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1422 sc_fxnum_fast_observer* observer_ ) \
1423 : sc_fxnum_fast( a, \
1424 sc_fxtype_params( wl_, iwl_, qm, om ), \
1426 sc_fxcast_switch(), \
1431 sc_fix_fast::sc_fix_fast( tp a, \
1432 int wl_, int iwl_, \
1433 sc_q_mode qm, sc_o_mode om, int nb, \
1434 sc_fxnum_fast_observer* observer_ ) \
1435 : sc_fxnum_fast( a, \
1436 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
1438 sc_fxcast_switch(), \
1443 sc_fix_fast::sc_fix_fast( tp a, \
1444 const sc_fxcast_switch& cast_sw, \
1445 sc_fxnum_fast_observer* observer_ ) \
1446 : sc_fxnum_fast( a, \
1447 sc_fxtype_params(), \
1454 sc_fix_fast::sc_fix_fast( tp a, \
1455 int wl_, int iwl_, \
1456 const sc_fxcast_switch& cast_sw, \
1457 sc_fxnum_fast_observer* observer_ ) \
1458 : sc_fxnum_fast( a, \
1459 sc_fxtype_params( wl_, iwl_ ), \
1466 sc_fix_fast::sc_fix_fast( tp a, \
1467 sc_q_mode qm, sc_o_mode om, \
1468 const sc_fxcast_switch& cast_sw, \
1469 sc_fxnum_fast_observer* observer_ ) \
1470 : sc_fxnum_fast( a, \
1471 sc_fxtype_params( qm, om ), \
1478 sc_fix_fast::sc_fix_fast( tp a, \
1479 sc_q_mode qm, sc_o_mode om, int nb, \
1480 const sc_fxcast_switch& cast_sw, \
1481 sc_fxnum_fast_observer* observer_ ) \
1482 : sc_fxnum_fast( a, \
1483 sc_fxtype_params( qm, om, nb ), \
1490 sc_fix_fast::sc_fix_fast( tp a, \
1491 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1492 const sc_fxcast_switch& cast_sw, \
1493 sc_fxnum_fast_observer* observer_ ) \
1494 : sc_fxnum_fast( a, \
1495 sc_fxtype_params( wl_, iwl_, qm, om ), \
1502 sc_fix_fast::sc_fix_fast( tp a, \
1503 int wl_, int iwl_, \
1504 sc_q_mode qm, sc_o_mode om, int nb, \
1505 const sc_fxcast_switch& cast_sw, \
1506 sc_fxnum_fast_observer* observer_ ) \
1507 : sc_fxnum_fast( a, \
1508 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
1515 sc_fix_fast::sc_fix_fast( tp a, \
1516 const sc_fxtype_params& type_params, \
1517 sc_fxnum_fast_observer* observer_ ) \
1518 : sc_fxnum_fast( a, \
1521 sc_fxcast_switch(), \
1526 sc_fix_fast::sc_fix_fast( tp a, \
1527 const sc_fxtype_params& type_params, \
1528 const sc_fxcast_switch& cast_sw, \
1529 sc_fxnum_fast_observer* observer_ ) \
1530 : sc_fxnum_fast( a, \
1537 #define DEFN_CTORS_T_B(tp) \
1539 sc_fix_fast::sc_fix_fast( tp a, \
1540 sc_fxnum_fast_observer* observer_ ) \
1541 : sc_fxnum_fast( a, \
1544 sc_fxcast_switch(), \
1549 sc_fix_fast::sc_fix_fast( tp a, \
1550 int wl_, int iwl_, \
1551 sc_fxnum_fast_observer* observer_ ) \
1552 : sc_fxnum_fast( a, \
1553 sc_fxtype_params( a.type_params(), wl_, iwl_ ), \
1555 sc_fxcast_switch(), \
1560 sc_fix_fast::sc_fix_fast( tp a, \
1561 sc_q_mode qm, sc_o_mode om, \
1562 sc_fxnum_fast_observer* observer_ ) \
1563 : sc_fxnum_fast( a, \
1564 sc_fxtype_params( a.type_params(), qm, om ), \
1566 sc_fxcast_switch(), \
1571 sc_fix_fast::sc_fix_fast( tp a, \
1572 sc_q_mode qm, sc_o_mode om, int nb, \
1573 sc_fxnum_fast_observer* observer_ ) \
1574 : sc_fxnum_fast( a, \
1575 sc_fxtype_params( a.type_params(), qm, om, nb ), \
1577 sc_fxcast_switch(), \
1582 sc_fix_fast::sc_fix_fast( tp a, \
1583 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1584 sc_fxnum_fast_observer* observer_ ) \
1585 : sc_fxnum_fast( a, \
1586 sc_fxtype_params( wl_, iwl_, qm, om ), \
1588 sc_fxcast_switch(), \
1593 sc_fix_fast::sc_fix_fast( tp a, \
1594 int wl_, int iwl_, \
1595 sc_q_mode qm, sc_o_mode om, int nb, \
1596 sc_fxnum_fast_observer* observer_ ) \
1597 : sc_fxnum_fast( a, \
1598 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
1600 sc_fxcast_switch(), \
1605 sc_fix_fast::sc_fix_fast( tp a, \
1606 const sc_fxcast_switch& cast_sw, \
1607 sc_fxnum_fast_observer* observer_ ) \
1608 : sc_fxnum_fast( a, \
1616 sc_fix_fast::sc_fix_fast( tp a, \
1617 int wl_, int iwl_, \
1618 const sc_fxcast_switch& cast_sw, \
1619 sc_fxnum_fast_observer* observer_ ) \
1620 : sc_fxnum_fast( a, \
1621 sc_fxtype_params( a.type_params(), wl_, iwl_ ), \
1628 sc_fix_fast::sc_fix_fast( tp a, \
1629 sc_q_mode qm, sc_o_mode om, \
1630 const sc_fxcast_switch& cast_sw, \
1631 sc_fxnum_fast_observer* observer_ ) \
1632 : sc_fxnum_fast( a, \
1633 sc_fxtype_params( a.type_params(), qm, om ), \
1640 sc_fix_fast::sc_fix_fast( tp a, \
1641 sc_q_mode qm, sc_o_mode om, int nb, \
1642 const sc_fxcast_switch& cast_sw, \
1643 sc_fxnum_fast_observer* observer_ ) \
1644 : sc_fxnum_fast( a, \
1645 sc_fxtype_params( a.type_params(), qm, om, nb ), \
1652 sc_fix_fast::sc_fix_fast( tp a, \
1653 int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1654 const sc_fxcast_switch& cast_sw, \
1655 sc_fxnum_fast_observer* observer_ ) \
1656 : sc_fxnum_fast( a, \
1657 sc_fxtype_params( wl_, iwl_, qm, om ), \
1664 sc_fix_fast::sc_fix_fast( tp a, \
1665 int wl_, int iwl_, \
1666 sc_q_mode qm, sc_o_mode om, int nb, \
1667 const sc_fxcast_switch& cast_sw, \
1668 sc_fxnum_fast_observer* observer_ ) \
1669 : sc_fxnum_fast( a, \
1670 sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
1677 sc_fix_fast::sc_fix_fast( tp a, \
1678 const sc_fxtype_params& type_params, \
1679 sc_fxnum_fast_observer* observer_ ) \
1680 : sc_fxnum_fast( a, \
1683 sc_fxcast_switch(), \
1688 sc_fix_fast::sc_fix_fast( tp a, \
1689 const sc_fxtype_params& type_params, \
1690 const sc_fxcast_switch& cast_sw, \
1691 sc_fxnum_fast_observer* observer_ ) \
1692 : sc_fxnum_fast( a, \
1710 #ifndef SC_FX_EXCLUDE_OTHER
1719 #undef DEFN_CTORS_T_A
1720 #undef DEFN_CTORS_T_B
1743 sc_fix_fast c( wl_c, iwl_c );
1744 for(
int i = iwl_c - wl_c; i < iwl_c; ++ i )
1754 b_not( sc_fix_fast& c,
const sc_fix_fast& a )
1757 int iwl_c = c.
iwl();
1758 for(
int i = iwl_c - c.
wl(); i < iwl_c; ++ i )
1767 #define DEFN_BIN_OP_T(op,op2,tp1,tp2) \
1770 operator op ( const tp1& a, const tp2& b ) \
1772 a.observer_read(); \
1773 b.observer_read(); \
1774 int iwl_a = a.iwl(); \
1775 int iwl_b = b.iwl(); \
1776 int iwl_c = sc_max( iwl_a, iwl_b ); \
1777 int fwl_c = sc_max( a.wl() - iwl_a, b.wl() - iwl_b ); \
1778 sc_fix_fast c( iwl_c + fwl_c, iwl_c ); \
1779 for( int i = -fwl_c; i < iwl_c; ++ i ) \
1780 c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \
1781 return sc_fix_fast( c, iwl_c + fwl_c, iwl_c ); \
1785 DEFN_BIN_OP_T(|,||,sc_fix_fast,sc_fix_fast)
1786 DEFN_BIN_OP_T(^,!=,sc_fix_fast,sc_fix_fast)
1788 #undef DEFN_BIN_OP_T
1793 #define DEFN_BIN_FNC_T(fnc,op2,tp1,tp2) \
1796 fnc ( sc_fix_fast& c, const tp1& a, const tp2& b ) \
1798 a.observer_read(); \
1799 b.observer_read(); \
1800 int iwl_c = c.iwl(); \
1801 for( int i = iwl_c - c.wl(); i < iwl_c; ++ i ) \
1802 c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \
1804 SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \
1811 #undef DEFN_BIN_FNC_T
1820 sc_fxnum_fast::operator = ( a );
1824 #define DEFN_ASN_OP_T(op,tp) \
1827 sc_fix_fast::operator op ( tp a ) \
1829 sc_fxnum_fast::operator op( a ); \
1833 #ifndef SC_FX_EXCLUDE_OTHER
1834 #define DEFN_ASN_OP_OTHER(op) \
1835 DEFN_ASN_OP_T(op,int64) \
1836 DEFN_ASN_OP_T(op,uint64) \
1837 DEFN_ASN_OP_T(op,const sc_int_base&) \
1838 DEFN_ASN_OP_T(op,const sc_uint_base&) \
1839 DEFN_ASN_OP_T(op,const sc_signed&) \
1840 DEFN_ASN_OP_T(op,const sc_unsigned&)
1842 #define DEFN_ASN_OP_OTHER(op)
1845 #define DEFN_ASN_OP(op) \
1846 DEFN_ASN_OP_T(op,int) \
1847 DEFN_ASN_OP_T(op,unsigned int) \
1848 DEFN_ASN_OP_T(op,long) \
1849 DEFN_ASN_OP_T(op,unsigned long) \
1850 DEFN_ASN_OP_T(op,float) \
1851 DEFN_ASN_OP_T(op,double) \
1852 DEFN_ASN_OP_T(op,const char*) \
1853 DEFN_ASN_OP_T(op,const sc_fxval&) \
1854 DEFN_ASN_OP_T(op,const sc_fxval_fast&) \
1855 DEFN_ASN_OP_T(op,const sc_fxnum&) \
1856 DEFN_ASN_OP_T(op,const sc_fxnum_fast&) \
1857 DEFN_ASN_OP_OTHER(op)
1866 DEFN_ASN_OP_T(<<=,
int)
1867 DEFN_ASN_OP_T(>>=,
int)
1869 #undef DEFN_ASN_OP_T
1870 #undef DEFN_ASN_OP_OTHER
1874 #define DEFN_ASN_OP_T(op,op2,tp) \
1877 sc_fix_fast::operator op ( const tp& b ) \
1879 SC_FXNUM_FAST_OBSERVER_READ_( *this ) \
1880 b.observer_read(); \
1881 int iwl_c = iwl(); \
1882 for( int i = iwl_c - wl(); i < iwl_c; ++ i ) \
1883 set_bit( i, get_bit( i ) op2 b.get_bit( i ) ); \
1885 SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \
1890 DEFN_ASN_OP_T(&=,&&,sc_fix_fast)
1891 DEFN_ASN_OP_T(|=,||,sc_fix)
1892 DEFN_ASN_OP_T(|=,||,sc_fix_fast)
1893 DEFN_ASN_OP_T(^=,!=,sc_fix)
1894 DEFN_ASN_OP_T(^=,!=,sc_fix_fast)
1896 #undef DEFN_ASN_OP_T
#define DEFN_ASN_OP_T(op, tp)
const sc_bit b_xor(const sc_bit &a, const sc_bit &b)
sc_fxnum_fast & operator--()
#define DECL_CTORS_T_A(tp)
const sc_bit b_not(const sc_bit &a)
sc_fix_fast & operator--()
#define DEFN_BIN_FNC_T(fnc, op2, tp1, tp2)
friend void b_not(sc_fix_fast &, const sc_fix_fast &)
sc_fix_fast & operator=(const sc_fix_fast &)
friend class sc_fxval_fast
friend const sc_fix operator|(const sc_fix &, const sc_fix &)
friend void b_xor(sc_fix_fast &, const sc_fix_fast &, const sc_fix_fast &)
friend const sc_fix_fast operator^(const sc_fix_fast &, const sc_fix_fast &)
friend const sc_fix operator^(const sc_fix &, const sc_fix &)
sc_fxnum_fast & operator++()
friend const sc_fix_fast operator|(const sc_fix_fast &, const sc_fix_fast &)
const sc_bit b_or(const sc_bit &a, const sc_bit &b)
#define DECL_CTORS_T_B(tp)
friend void b_not(sc_fix &, const sc_fix &)
friend const sc_fix_fast operator&(const sc_fix_fast &, const sc_fix_fast &)
#define DECL_ASN_OP_T(op, tp)
#define SC_FXNUM_OBSERVER_READ_(object)
#define SC_FXNUM_FAST_OBSERVER_WRITE_(object)
friend void b_and(sc_fix_fast &, const sc_fix_fast &, const sc_fix_fast &)
const sc_bit b_and(const sc_bit &a, const sc_bit &b)
const sc_fix_fast operator~() const
friend void b_or(sc_fix_fast &, const sc_fix_fast &, const sc_fix_fast &)
friend void b_or(sc_fix &, const sc_fix &, const sc_fix &)
#define SC_FXNUM_FAST_OBSERVER_READ_(object)
#define DEFN_CTORS_T_A(tp)
friend void b_and(sc_fix &, const sc_fix &, const sc_fix &)
sc_fix & operator=(const sc_fix &)
sc_fix_fast(sc_fxnum_fast_observer *=0)
#define SC_FXNUM_OBSERVER_WRITE_(object)
const sc_fix operator~() const
friend const sc_fix operator&(const sc_fix &, const sc_fix &)
#define DEFN_CTORS_T_B(tp)
sc_fix_fast & operator++()
friend void b_xor(sc_fix &, const sc_fix &, const sc_fix &)
DEFN_BIN_OP_T(/, div, int64) DEFN_BIN_OP_T(/
sc_fix(sc_fxnum_observer *=0)