50#ifndef __SYSTEMC_EXT_DT_FX_SC_FIX_HH__
51#define __SYSTEMC_EXT_DT_FX_SC_FIX_HH__
93#define DECL_CTORS_T(tp) \
94 sc_fix(tp, int, int, sc_fxnum_observer * =0); \
95 sc_fix(tp, sc_q_mode, sc_o_mode, sc_fxnum_observer * =0); \
96 sc_fix(tp, sc_q_mode, sc_o_mode, int, sc_fxnum_observer * =0); \
97 sc_fix(tp, int, int, sc_q_mode, sc_o_mode, sc_fxnum_observer * =0); \
98 sc_fix(tp, int, int, sc_q_mode, sc_o_mode, int, sc_fxnum_observer * =0); \
99 sc_fix(tp, const sc_fxcast_switch &, sc_fxnum_observer * =0); \
100 sc_fix(tp, int, int, const sc_fxcast_switch &, sc_fxnum_observer * =0); \
101 sc_fix(tp, sc_q_mode, sc_o_mode, const sc_fxcast_switch &, \
102 sc_fxnum_observer * =0); \
103 sc_fix(tp, sc_q_mode, sc_o_mode, int, const sc_fxcast_switch &, \
104 sc_fxnum_observer * =0); \
105 sc_fix(tp, int, int, sc_q_mode, sc_o_mode, const sc_fxcast_switch &, \
106 sc_fxnum_observer * =0); \
107 sc_fix(tp, int, int, sc_q_mode, sc_o_mode, int, \
108 const sc_fxcast_switch &, sc_fxnum_observer * =0); \
109 sc_fix(tp, const sc_fxtype_params &, sc_fxnum_observer * =0); \
110 sc_fix(tp, const sc_fxtype_params &, const sc_fxcast_switch &, \
111 sc_fxnum_observer * =0);
113#define DECL_CTORS_T_A(tp) \
114 sc_fix(tp, sc_fxnum_observer * =0); \
117#define DECL_CTORS_T_B(tp) \
118 explicit sc_fix(tp, sc_fxnum_observer * =0); \
178#define DECL_ASN_OP_T(op, tp) sc_fix &operator op (tp);
180#define DECL_ASN_OP_OTHER(op) \
181 DECL_ASN_OP_T(op, int64) \
182 DECL_ASN_OP_T(op, uint64) \
183 DECL_ASN_OP_T(op, const sc_int_base &) \
184 DECL_ASN_OP_T(op, const sc_uint_base &) \
185 DECL_ASN_OP_T(op, const sc_signed &) \
186 DECL_ASN_OP_T(op, const sc_unsigned &)
188#define DECL_ASN_OP(op) \
189 DECL_ASN_OP_T(op, int) \
190 DECL_ASN_OP_T(op, unsigned int) \
191 DECL_ASN_OP_T(op, long) \
192 DECL_ASN_OP_T(op, unsigned long) \
193 DECL_ASN_OP_T(op, float) \
194 DECL_ASN_OP_T(op, double) \
195 DECL_ASN_OP_T(op, const char *) \
196 DECL_ASN_OP_T(op, const sc_fxval &) \
197 DECL_ASN_OP_T(op, const sc_fxval_fast &) \
198 DECL_ASN_OP_T(op, const sc_fxnum &) \
199 DECL_ASN_OP_T(op, const sc_fxnum_fast &) \
200 DECL_ASN_OP_OTHER(op)
220#undef DECL_ASN_OP_OTHER
266#define DECL_CTORS_T(tp) \
267 sc_fix_fast(tp, int, int, sc_fxnum_fast_observer * = 0); \
268 sc_fix_fast(tp, sc_q_mode, sc_o_mode, sc_fxnum_fast_observer * = 0); \
269 sc_fix_fast(tp, sc_q_mode, sc_o_mode, int, sc_fxnum_fast_observer * = 0); \
270 sc_fix_fast(tp, int, int, sc_q_mode, sc_o_mode, \
271 sc_fxnum_fast_observer * = 0); \
272 sc_fix_fast(tp, int, int, sc_q_mode, sc_o_mode, int, \
273 sc_fxnum_fast_observer * = 0); \
274 sc_fix_fast(tp, const sc_fxcast_switch &, sc_fxnum_fast_observer * = 0); \
275 sc_fix_fast(tp, int, int, const sc_fxcast_switch &, \
276 sc_fxnum_fast_observer * = 0); \
277 sc_fix_fast(tp, sc_q_mode, sc_o_mode, const sc_fxcast_switch &, \
278 sc_fxnum_fast_observer * = 0); \
279 sc_fix_fast(tp, sc_q_mode, sc_o_mode, int, const sc_fxcast_switch &, \
280 sc_fxnum_fast_observer * = 0); \
281 sc_fix_fast(tp, int, int, sc_q_mode, sc_o_mode, const sc_fxcast_switch &, \
282 sc_fxnum_fast_observer * = 0); \
283 sc_fix_fast(tp, int, int, sc_q_mode, sc_o_mode, int, \
284 const sc_fxcast_switch &, sc_fxnum_fast_observer * = 0); \
285 sc_fix_fast(tp, const sc_fxtype_params &, sc_fxnum_fast_observer * = 0); \
286 sc_fix_fast(tp, const sc_fxtype_params &, const sc_fxcast_switch &, \
287 sc_fxnum_fast_observer * = 0);
289#define DECL_CTORS_T_A(tp) \
290 sc_fix_fast(tp, sc_fxnum_fast_observer * =0); \
293#define DECL_CTORS_T_B(tp) \
294 explicit sc_fix_fast(tp, sc_fxnum_fast_observer * =0); \
345#define DECL_ASN_OP_T(op,tp) sc_fix_fast &operator op (tp);
347#define DECL_ASN_OP_OTHER(op) \
348 DECL_ASN_OP_T(op, int64) \
349 DECL_ASN_OP_T(op, uint64) \
350 DECL_ASN_OP_T(op, const sc_int_base &) \
351 DECL_ASN_OP_T(op, const sc_uint_base &) \
352 DECL_ASN_OP_T(op, const sc_signed &) \
353 DECL_ASN_OP_T(op, const sc_unsigned &)
355#define DECL_ASN_OP(op) \
356 DECL_ASN_OP_T(op, int) \
357 DECL_ASN_OP_T(op, unsigned int) \
358 DECL_ASN_OP_T(op, long) \
359 DECL_ASN_OP_T(op, unsigned long) \
360 DECL_ASN_OP_T(op, float) \
361 DECL_ASN_OP_T(op, double) \
362 DECL_ASN_OP_T(op, const char *) \
363 DECL_ASN_OP_T(op, const sc_fxval &) \
364 DECL_ASN_OP_T(op, const sc_fxval_fast &) \
365 DECL_ASN_OP_T(op, const sc_fxnum &) \
366 DECL_ASN_OP_T(op, const sc_fxnum_fast &) \
367 DECL_ASN_OP_OTHER(op)
387#undef DECL_ASN_OP_OTHER
488#define DEFN_CTORS_T_A(tp) \
489inline sc_fix::sc_fix(tp a, sc_fxnum_observer *observer_) : \
490 sc_fxnum(a, sc_fxtype_params(), SC_TC_, sc_fxcast_switch(), \
494inline sc_fix::sc_fix(tp a, int wl_, int iwl_, \
495 sc_fxnum_observer *observer_) : \
496 sc_fxnum(a, sc_fxtype_params(wl_, iwl_), SC_TC_, sc_fxcast_switch(), \
500inline sc_fix::sc_fix(tp a, sc_q_mode qm, sc_o_mode om, \
501 sc_fxnum_observer *observer_) : \
502 sc_fxnum(a, sc_fxtype_params(qm, om), SC_TC_, sc_fxcast_switch(), \
506inline sc_fix::sc_fix(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
507 sc_fxnum_observer *observer_) : \
508 sc_fxnum(a, sc_fxtype_params(qm, om, nb), SC_TC_, \
509 sc_fxcast_switch(), observer_) \
512inline sc_fix::sc_fix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
513 sc_fxnum_observer *observer_) : \
514 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_TC_, \
515 sc_fxcast_switch(), observer_) \
518inline sc_fix::sc_fix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
519 int nb, sc_fxnum_observer *observer_) : \
520 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_TC_, \
521 sc_fxcast_switch(), observer_) \
524inline sc_fix::sc_fix(tp a, const sc_fxcast_switch &cast_sw, \
525 sc_fxnum_observer *observer_) : \
526 sc_fxnum(a, sc_fxtype_params(), SC_TC_, cast_sw, observer_) \
529inline sc_fix::sc_fix(tp a, int wl_, int iwl_, \
530 const sc_fxcast_switch &cast_sw, \
531 sc_fxnum_observer *observer_) : \
532 sc_fxnum(a, sc_fxtype_params(wl_, iwl_), SC_TC_, cast_sw, observer_) \
535inline sc_fix::sc_fix(tp a, sc_q_mode qm, sc_o_mode om, \
536 const sc_fxcast_switch &cast_sw, \
537 sc_fxnum_observer *observer_) : \
538 sc_fxnum(a, sc_fxtype_params(qm, om), SC_TC_, cast_sw, observer_) \
541inline sc_fix::sc_fix(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
542 const sc_fxcast_switch &cast_sw, \
543 sc_fxnum_observer *observer_) : \
544 sc_fxnum(a, sc_fxtype_params(qm, om, nb), SC_TC_, cast_sw, observer_) \
547inline sc_fix::sc_fix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
548 const sc_fxcast_switch &cast_sw, \
549 sc_fxnum_observer *observer_) : \
550 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_TC_, cast_sw, \
554inline sc_fix::sc_fix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
555 int nb, const sc_fxcast_switch &cast_sw, \
556 sc_fxnum_observer *observer_) : \
557 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_TC_, cast_sw, \
561inline sc_fix::sc_fix(tp a, const sc_fxtype_params &type_params_, \
562 sc_fxnum_observer *observer_) : \
563 sc_fxnum(a, type_params_, SC_TC_, sc_fxcast_switch(), observer_) \
566inline sc_fix::sc_fix(tp a, const sc_fxtype_params &type_params_, \
567 const sc_fxcast_switch &cast_sw, \
568 sc_fxnum_observer *observer_) : \
569 sc_fxnum(a, type_params_, SC_TC_, cast_sw, observer_) \
572#define DEFN_CTORS_T_B(tp) \
573inline sc_fix::sc_fix(tp a, sc_fxnum_observer *observer_) : \
574 sc_fxnum(a, a.type_params(), SC_TC_, sc_fxcast_switch(), observer_) \
577inline sc_fix::sc_fix(tp a, int wl_, int iwl_, \
578 sc_fxnum_observer *observer_) : \
579 sc_fxnum(a, sc_fxtype_params(a.type_params(), wl_, iwl_), SC_TC_, \
580 sc_fxcast_switch(), observer_) \
583inline sc_fix::sc_fix(tp a, sc_q_mode qm, sc_o_mode om, \
584 sc_fxnum_observer *observer_) : \
585 sc_fxnum(a, sc_fxtype_params(a.type_params(), qm, om), SC_TC_, \
586 sc_fxcast_switch(), observer_) \
589inline sc_fix::sc_fix(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
590 sc_fxnum_observer *observer_) : \
591 sc_fxnum(a, sc_fxtype_params(a.type_params(), qm, om, nb), SC_TC_, \
592 sc_fxcast_switch(), observer_) \
595inline sc_fix::sc_fix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
596 sc_fxnum_observer *observer_) : \
597 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_TC_, \
598 sc_fxcast_switch(), observer_) \
601inline sc_fix::sc_fix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
602 int nb, sc_fxnum_observer *observer_) : \
603 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_TC_, \
604 sc_fxcast_switch(), observer_) \
607inline sc_fix::sc_fix(tp a, const sc_fxcast_switch &cast_sw, \
608 sc_fxnum_observer *observer_) : \
609 sc_fxnum(a, a.type_params(), SC_TC_, cast_sw, observer_) \
612inline sc_fix::sc_fix(tp a, int wl_, int iwl_, \
613 const sc_fxcast_switch &cast_sw, \
614 sc_fxnum_observer *observer_) : \
615 sc_fxnum(a, sc_fxtype_params(a.type_params(), wl_, iwl_), SC_TC_, \
616 cast_sw, observer_) \
619inline sc_fix::sc_fix(tp a, sc_q_mode qm, sc_o_mode om, \
620 const sc_fxcast_switch &cast_sw, \
621 sc_fxnum_observer *observer_) : \
622 sc_fxnum(a, sc_fxtype_params(a.type_params(), qm, om), SC_TC_, \
623 cast_sw, observer_) \
626inline sc_fix::sc_fix(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
627 const sc_fxcast_switch &cast_sw, \
628 sc_fxnum_observer *observer_) : \
629 sc_fxnum(a, sc_fxtype_params(a.type_params(), qm, om, nb), SC_TC_, \
630 cast_sw, observer_) \
633inline sc_fix::sc_fix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
634 const sc_fxcast_switch &cast_sw, \
635 sc_fxnum_observer *observer_) : \
636 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_TC_, cast_sw, \
640inline sc_fix::sc_fix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
641 int nb, const sc_fxcast_switch &cast_sw, \
642 sc_fxnum_observer *observer_) : \
643 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_TC_, cast_sw, \
647inline sc_fix::sc_fix(tp a, const sc_fxtype_params &type_params_, \
648 sc_fxnum_observer *observer_) : \
649 sc_fxnum(a, type_params_, SC_TC_, sc_fxcast_switch(), observer_) \
652inline sc_fix::sc_fix(tp a, const sc_fxtype_params &type_params_, \
653 const sc_fxcast_switch &cast_sw, \
654 sc_fxnum_observer *observer_) : \
655 sc_fxnum(a, type_params_, SC_TC_, cast_sw, observer_) \
692 for (
int i = iwl_c - wl_c; i < iwl_c; ++i)
703 for (
int i = iwl_c -
c.wl(); i < iwl_c; ++i)
704 c.set_bit(i, !
a.get_bit(i));
710#define DEFN_BIN_OP_T(op, op2, tp1, tp2) \
712operator op (const tp1 &a, const tp2 &b) \
716 int iwl_a = a.iwl(); \
717 int iwl_b = b.iwl(); \
718 int iwl_c = sc_max(iwl_a, iwl_b); \
719 int fwl_c = sc_max(a.wl() - iwl_a, b.wl() - iwl_b); \
720 sc_fix c(iwl_c + fwl_c, iwl_c); \
721 for (int i = -fwl_c; i < iwl_c; ++ i) \
722 c.set_bit(i, a.get_bit(i) op2 b.get_bit(i)); \
723 return sc_fix(c, iwl_c + fwl_c, iwl_c); \
741#define DEFN_BIN_FNC_T(fnc, op2, tp1, tp2) \
743fnc (sc_fix &c, const tp1 &a, const tp2 &b) \
747 int iwl_c = c.iwl(); \
748 for (int i = iwl_c - c.wl(); i < iwl_c; ++i) \
749 c.set_bit(i, a.get_bit(i) op2 b.get_bit(i)); \
751 SC_FXNUM_OBSERVER_WRITE_(c) \
773 sc_fxnum::operator = (
a);
777#define DEFN_ASN_OP_T(op, tp) \
779sc_fix::operator op (tp a) \
781 sc_fxnum::operator op(a); \
785#define DEFN_ASN_OP_OTHER(op) \
786DEFN_ASN_OP_T(op, int64) \
787DEFN_ASN_OP_T(op, uint64) \
788DEFN_ASN_OP_T(op, const sc_int_base &) \
789DEFN_ASN_OP_T(op, const sc_uint_base &) \
790DEFN_ASN_OP_T(op, const sc_signed &) \
791DEFN_ASN_OP_T(op, const sc_unsigned &)
793#define DEFN_ASN_OP(op) \
794DEFN_ASN_OP_T(op, int) \
795DEFN_ASN_OP_T(op, unsigned int) \
796DEFN_ASN_OP_T(op, long) \
797DEFN_ASN_OP_T(op, unsigned long) \
798DEFN_ASN_OP_T(op, float) \
799DEFN_ASN_OP_T(op, double) \
800DEFN_ASN_OP_T(op, const char *) \
801DEFN_ASN_OP_T(op, const sc_fxval &) \
802DEFN_ASN_OP_T(op, const sc_fxval_fast &) \
803DEFN_ASN_OP_T(op, const sc_fxnum &) \
804DEFN_ASN_OP_T(op, const sc_fxnum_fast &) \
818#undef DEFN_ASN_OP_OTHER
821#define DEFN_ASN_OP_T(op, op2, tp) \
823sc_fix::operator op (const tp &b) \
825 SC_FXNUM_OBSERVER_READ_(*this) \
828 for (int i = iwl_c - wl(); i < iwl_c; ++i) \
829 set_bit(i, get_bit(i) op2 b.get_bit(i)); \
831 SC_FXNUM_OBSERVER_WRITE_(*this) \
848 return sc_fxval(sc_fxnum::operator ++ (0));
854 return sc_fxval(sc_fxnum::operator -- (0));
962#define DEFN_CTORS_T_A(tp) \
963inline sc_fix_fast::sc_fix_fast(tp a, sc_fxnum_fast_observer *observer_ ) : \
964 sc_fxnum_fast(a, sc_fxtype_params(), SC_TC_, sc_fxcast_switch(), \
968inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, \
969 sc_fxnum_fast_observer *observer_) : \
970 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_), SC_TC_, \
971 sc_fxcast_switch(), observer_) \
974inline sc_fix_fast::sc_fix_fast(tp a, sc_q_mode qm, sc_o_mode om, \
975 sc_fxnum_fast_observer *observer_) : \
976 sc_fxnum_fast(a, sc_fxtype_params(qm, om), SC_TC_, \
977 sc_fxcast_switch(), observer_) \
980inline sc_fix_fast::sc_fix_fast(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
981 sc_fxnum_fast_observer *observer_ ) : \
982 sc_fxnum_fast(a, sc_fxtype_params(qm, om, nb), SC_TC_, \
983 sc_fxcast_switch(), observer_) \
986inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, sc_q_mode qm, \
988 sc_fxnum_fast_observer *observer_) : \
989 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_TC_, \
990 sc_fxcast_switch(), observer_) \
993inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, sc_q_mode qm, \
994 sc_o_mode om, int nb, \
995 sc_fxnum_fast_observer *observer_) : \
996 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_TC_, \
997 sc_fxcast_switch(), observer_) \
1000inline sc_fix_fast::sc_fix_fast(tp a, const sc_fxcast_switch &cast_sw, \
1001 sc_fxnum_fast_observer *observer_) : \
1002 sc_fxnum_fast(a, sc_fxtype_params(), SC_TC_, cast_sw, observer_) \
1005inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, \
1006 const sc_fxcast_switch &cast_sw, \
1007 sc_fxnum_fast_observer *observer_) : \
1008 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_), SC_TC_, cast_sw, \
1012inline sc_fix_fast::sc_fix_fast(tp a, sc_q_mode qm, sc_o_mode om, \
1013 const sc_fxcast_switch &cast_sw, \
1014 sc_fxnum_fast_observer *observer_) : \
1015 sc_fxnum_fast(a, sc_fxtype_params(qm, om), SC_TC_, cast_sw, \
1019inline sc_fix_fast::sc_fix_fast(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
1020 const sc_fxcast_switch &cast_sw, \
1021 sc_fxnum_fast_observer *observer_) : \
1022 sc_fxnum_fast(a, sc_fxtype_params(qm, om, nb), SC_TC_, cast_sw, \
1026inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, sc_q_mode qm, \
1028 const sc_fxcast_switch &cast_sw, \
1029 sc_fxnum_fast_observer *observer_) : \
1030 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_TC_, \
1031 cast_sw, observer_) \
1034inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, sc_q_mode qm, \
1035 sc_o_mode om, int nb, \
1036 const sc_fxcast_switch &cast_sw, \
1037 sc_fxnum_fast_observer *observer_) : \
1038 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_TC_, \
1039 cast_sw, observer_) \
1042inline sc_fix_fast::sc_fix_fast(tp a, const sc_fxtype_params &type_params_, \
1043 sc_fxnum_fast_observer *observer_) : \
1044 sc_fxnum_fast(a, type_params_, SC_TC_, sc_fxcast_switch(), observer_) \
1047inline sc_fix_fast::sc_fix_fast(tp a, const sc_fxtype_params &type_params_, \
1048 const sc_fxcast_switch &cast_sw, \
1049 sc_fxnum_fast_observer *observer_) : \
1050 sc_fxnum_fast(a, type_params_, SC_TC_, cast_sw, observer_) \
1053#define DEFN_CTORS_T_B(tp) \
1054inline sc_fix_fast::sc_fix_fast(tp a, sc_fxnum_fast_observer *observer_) : \
1055 sc_fxnum_fast(a, a.type_params(), SC_TC_, sc_fxcast_switch(), \
1059inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, \
1060 sc_fxnum_fast_observer *observer_) : \
1061 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), wl_, iwl_), \
1062 SC_TC_, sc_fxcast_switch(), observer_) \
1065inline sc_fix_fast::sc_fix_fast(tp a, sc_q_mode qm, sc_o_mode om, \
1066 sc_fxnum_fast_observer *observer_) : \
1067 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), qm, om), SC_TC_, \
1068 sc_fxcast_switch(), observer_) \
1071inline sc_fix_fast::sc_fix_fast(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
1072 sc_fxnum_fast_observer *observer_) : \
1073 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), qm, om, nb), \
1074 SC_TC_, sc_fxcast_switch(), observer_) \
1077inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, sc_q_mode qm, \
1079 sc_fxnum_fast_observer *observer_) : \
1080 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_TC_, \
1081 sc_fxcast_switch(), observer_) \
1084inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, sc_q_mode qm, \
1085 sc_o_mode om, int nb, \
1086 sc_fxnum_fast_observer *observer_) : \
1087 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_TC_, \
1088 sc_fxcast_switch(), observer_) \
1091inline sc_fix_fast::sc_fix_fast(tp a, const sc_fxcast_switch &cast_sw, \
1092 sc_fxnum_fast_observer *observer_) : \
1093 sc_fxnum_fast(a, a.type_params(), SC_TC_, cast_sw, observer_) \
1096inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, \
1097 const sc_fxcast_switch &cast_sw, \
1098 sc_fxnum_fast_observer *observer_) : \
1099 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), wl_, iwl_), \
1100 SC_TC_, cast_sw, observer_) \
1103inline sc_fix_fast::sc_fix_fast(tp a, sc_q_mode qm, sc_o_mode om, \
1104 const sc_fxcast_switch &cast_sw, \
1105 sc_fxnum_fast_observer *observer_) : \
1106 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), qm, om), SC_TC_, \
1107 cast_sw, observer_) \
1110inline sc_fix_fast::sc_fix_fast(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
1111 const sc_fxcast_switch &cast_sw, \
1112 sc_fxnum_fast_observer *observer_) : \
1113 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), qm, om, nb), \
1114 SC_TC_, cast_sw, observer_) \
1117inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, sc_q_mode qm, \
1119 const sc_fxcast_switch &cast_sw, \
1120 sc_fxnum_fast_observer *observer_) : \
1121 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_TC_, \
1122 cast_sw, observer_) \
1125inline sc_fix_fast::sc_fix_fast(tp a, int wl_, int iwl_, sc_q_mode qm, \
1126 sc_o_mode om, int nb, \
1127 const sc_fxcast_switch &cast_sw, \
1128 sc_fxnum_fast_observer *observer_) : \
1129 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_TC_, \
1130 cast_sw, observer_) \
1133inline sc_fix_fast::sc_fix_fast(tp a, const sc_fxtype_params &type_params_, \
1134 sc_fxnum_fast_observer *observer_) : \
1135 sc_fxnum_fast(a, type_params_, SC_TC_, sc_fxcast_switch(), observer_) \
1138inline sc_fix_fast::sc_fix_fast(tp a, const sc_fxtype_params &type_params_, \
1139 const sc_fxcast_switch &cast_sw, \
1140 sc_fxnum_fast_observer *observer_) : \
1141 sc_fxnum_fast(a, type_params_, SC_TC_, cast_sw, observer_ ) \
1163#undef DEFN_CTORS_T_A
1164#undef DEFN_CTORS_T_B
1179 for (
int i = iwl_c - wl_c; i < iwl_c; ++i)
1189 int iwl_c =
c.iwl();
1190 for (
int i = iwl_c -
c.wl(); i < iwl_c; ++i)
1191 c.set_bit(i, !
a.get_bit(i));
1197#define DEFN_BIN_OP_T(op, op2, tp1, tp2) \
1198inline const sc_fix_fast \
1199operator op (const tp1 &a, const tp2 &b) \
1201 a.observer_read(); \
1202 b.observer_read(); \
1203 int iwl_a = a.iwl(); \
1204 int iwl_b = b.iwl(); \
1205 int iwl_c = sc_max(iwl_a, iwl_b); \
1206 int fwl_c = sc_max(a.wl() - iwl_a, b.wl() - iwl_b); \
1207 sc_fix_fast c(iwl_c + fwl_c, iwl_c); \
1208 for (int i = -fwl_c; i < iwl_c; ++i) \
1209 c.set_bit(i, a.get_bit(i) op2 b.get_bit(i)); \
1210 return sc_fix_fast(c, iwl_c + fwl_c, iwl_c); \
1220#define DEFN_BIN_FNC_T(fnc, op2, tp1, tp2) \
1222fnc(sc_fix_fast &c, const tp1 &a, const tp2 &b) \
1224 a.observer_read(); \
1225 b.observer_read(); \
1226 int iwl_c = c.iwl(); \
1227 for (int i = iwl_c - c.wl(); i < iwl_c; ++i) \
1228 c.set_bit(i, a.get_bit(i) op2 b.get_bit(i)); \
1230 SC_FXNUM_FAST_OBSERVER_WRITE_(c) \
1237#undef DEFN_BIN_FNC_T
1243 sc_fxnum_fast::operator = (
a);
1247#define DEFN_ASN_OP_T(op, tp) \
1248inline sc_fix_fast & \
1249sc_fix_fast::operator op (tp a) \
1251 sc_fxnum_fast::operator op(a); \
1255#define DEFN_ASN_OP_OTHER(op) \
1256DEFN_ASN_OP_T(op, int64) \
1257DEFN_ASN_OP_T(op, uint64) \
1258DEFN_ASN_OP_T(op, const sc_int_base &) \
1259DEFN_ASN_OP_T(op, const sc_uint_base &) \
1260DEFN_ASN_OP_T(op, const sc_signed &) \
1261DEFN_ASN_OP_T(op, const sc_unsigned &)
1263#define DEFN_ASN_OP(op) \
1264DEFN_ASN_OP_T(op, int) \
1265DEFN_ASN_OP_T(op, unsigned int) \
1266DEFN_ASN_OP_T(op, long) \
1267DEFN_ASN_OP_T(op, unsigned long) \
1268DEFN_ASN_OP_T(op, float) \
1269DEFN_ASN_OP_T(op, double) \
1270DEFN_ASN_OP_T(op, const char *) \
1271DEFN_ASN_OP_T(op, const sc_fxval &) \
1272DEFN_ASN_OP_T(op, const sc_fxval_fast &) \
1273DEFN_ASN_OP_T(op, const sc_fxnum &) \
1274DEFN_ASN_OP_T(op, const sc_fxnum_fast &) \
1275DEFN_ASN_OP_OTHER(op)
1288#undef DEFN_ASN_OP_OTHER
1291#define DEFN_ASN_OP_T(op, op2, tp) \
1292inline sc_fix_fast & \
1293sc_fix_fast::operator op (const tp &b) \
1295 SC_FXNUM_FAST_OBSERVER_READ_(*this) \
1296 b.observer_read(); \
1297 int iwl_c = iwl(); \
1298 for (int i = iwl_c - wl(); i < iwl_c; ++i) \
1299 set_bit(i, get_bit(i) op2 b.get_bit(i)); \
1301 SC_FXNUM_FAST_OBSERVER_WRITE_(*this) \
friend void b_or(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 &)
sc_fix_fast & operator--()
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 &)
friend const sc_fix_fast operator&(const sc_fix_fast &, const sc_fix_fast &)
sc_fix_fast(sc_fxnum_fast_observer *=0)
const sc_fix_fast operator~() const
sc_fix_fast & operator++()
sc_fix_fast & operator=(const sc_fix_fast &)
friend void b_not(sc_fix_fast &, const sc_fix_fast &)
friend const sc_fix_fast operator^(const sc_fix_fast &, const sc_fix_fast &)
friend void b_or(sc_fix &, const sc_fix &, const sc_fix &)
friend void b_xor(sc_fix &, const sc_fix &, const sc_fix &)
friend const sc_fix operator^(const sc_fix &, const sc_fix &)
friend void b_or(sc_fix &, const sc_fix &, const sc_fix_fast &)
friend void b_and(sc_fix &, const sc_fix &, const sc_fix_fast &)
friend const sc_fix operator|(const sc_fix &, const sc_fix &)
const sc_fix operator~() const
friend void b_and(sc_fix &, const sc_fix_fast &, const sc_fix &)
friend void b_and(sc_fix &, const sc_fix &, const sc_fix &)
friend void b_not(sc_fix &, const sc_fix &)
sc_fix & operator=(const sc_fix &)
friend void b_xor(sc_fix &, const sc_fix &, const sc_fix_fast &)
friend const sc_fix operator&(const sc_fix &, const sc_fix &)
friend void b_xor(sc_fix &, const sc_fix_fast &, const sc_fix &)
friend void b_or(sc_fix &, const sc_fix_fast &, const sc_fix &)
sc_fix(sc_fxnum_observer *=0)
sc_fxnum_fast & operator--()
sc_fxnum_fast & operator++()
friend class sc_fxval_fast
const sc_bit b_xor(const sc_bit &a, const sc_bit &b)
const sc_bit b_and(const sc_bit &a, const sc_bit &b)
const sc_bit b_not(const sc_bit &a)
const sc_bit b_or(const sc_bit &a, const sc_bit &b)
#define DEFN_ASN_OP_T(op, tp)
#define DECL_CTORS_T_A(tp)
#define DEFN_CTORS_T_B(tp)
#define DECL_CTORS_T_B(tp)
#define DEFN_CTORS_T_A(tp)
#define DEFN_BIN_FNC_T(fnc, op2, tp1, tp2)
#define DECL_ASN_OP_T(op, tp)
#define SC_FXNUM_OBSERVER_WRITE_(object)
#define SC_FXNUM_OBSERVER_READ_(object)
#define SC_FXNUM_FAST_OBSERVER_WRITE_(object)
#define SC_FXNUM_FAST_OBSERVER_READ_(object)
#define DEFN_BIN_OP_T(ret, op, tp)