50#ifndef __SYSTEMC_EXT_DT_FX_SC_UFIX_HH__
51#define __SYSTEMC_EXT_DT_FX_SC_UFIX_HH__
93#define DECL_CTORS_T(tp) \
94 sc_ufix(tp, int, int, sc_fxnum_observer * =0); \
95 sc_ufix(tp, sc_q_mode, sc_o_mode, sc_fxnum_observer * =0); \
96 sc_ufix(tp, sc_q_mode, sc_o_mode, int, sc_fxnum_observer * =0); \
97 sc_ufix(tp, int, int, sc_q_mode, sc_o_mode, sc_fxnum_observer * =0); \
98 sc_ufix(tp, int, int, sc_q_mode, sc_o_mode, int, sc_fxnum_observer * =0); \
99 sc_ufix(tp, const sc_fxcast_switch &, sc_fxnum_observer * =0); \
100 sc_ufix(tp, int, int, const sc_fxcast_switch &, sc_fxnum_observer * =0); \
101 sc_ufix(tp, sc_q_mode, sc_o_mode, const sc_fxcast_switch &, \
102 sc_fxnum_observer * =0); \
103 sc_ufix(tp, sc_q_mode, sc_o_mode, int, const sc_fxcast_switch &, \
104 sc_fxnum_observer * =0); \
105 sc_ufix(tp, int, int, sc_q_mode, sc_o_mode, const sc_fxcast_switch &, \
106 sc_fxnum_observer * =0); \
107 sc_ufix(tp, int, int, sc_q_mode, sc_o_mode, int, \
108 const sc_fxcast_switch &, sc_fxnum_observer * =0); \
109 sc_ufix(tp, const sc_fxtype_params &, sc_fxnum_observer * =0); \
110 sc_ufix(tp, const sc_fxtype_params &, const sc_fxcast_switch &, \
111 sc_fxnum_observer * =0);
113#define DECL_CTORS_T_A(tp) \
114 sc_ufix(tp, sc_fxnum_observer * =0); \
117#define DECL_CTORS_T_B(tp) \
118 explicit sc_ufix(tp, sc_fxnum_observer * =0); \
178#define DECL_ASN_OP_T(op,tp) sc_ufix &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_ufix_fast(tp, int, int, sc_fxnum_fast_observer * =0); \
268 sc_ufix_fast(tp, sc_q_mode, sc_o_mode, sc_fxnum_fast_observer * =0); \
269 sc_ufix_fast(tp, sc_q_mode, sc_o_mode, int, sc_fxnum_fast_observer * =0); \
270 sc_ufix_fast(tp, int, int, sc_q_mode, sc_o_mode, \
271 sc_fxnum_fast_observer * =0); \
272 sc_ufix_fast(tp, int, int, sc_q_mode, sc_o_mode, int, \
273 sc_fxnum_fast_observer * =0); \
274 sc_ufix_fast(tp, const sc_fxcast_switch &, sc_fxnum_fast_observer * =0); \
275 sc_ufix_fast(tp, int, int, const sc_fxcast_switch &, \
276 sc_fxnum_fast_observer * =0); \
277 sc_ufix_fast(tp, sc_q_mode, sc_o_mode, const sc_fxcast_switch &, \
278 sc_fxnum_fast_observer * =0); \
279 sc_ufix_fast(tp, sc_q_mode, sc_o_mode, int, const sc_fxcast_switch &, \
280 sc_fxnum_fast_observer * =0); \
281 sc_ufix_fast(tp, int, int, sc_q_mode, sc_o_mode, \
282 const sc_fxcast_switch &, sc_fxnum_fast_observer * =0); \
283 sc_ufix_fast(tp, int, int, sc_q_mode, sc_o_mode, int, \
284 const sc_fxcast_switch &, sc_fxnum_fast_observer * =0); \
285 sc_ufix_fast(tp, const sc_fxtype_params &, sc_fxnum_fast_observer * =0); \
286 sc_ufix_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_ufix_fast(tp, sc_fxnum_fast_observer * =0); \
293#define DECL_CTORS_T_B(tp) \
294 explicit sc_ufix_fast(tp, sc_fxnum_fast_observer * =0); \
352#define DECL_ASN_OP_T(op,tp) sc_ufix_fast &operator op (tp);
354#define DECL_ASN_OP_OTHER(op) \
355 DECL_ASN_OP_T(op, int64) \
356 DECL_ASN_OP_T(op, uint64) \
357 DECL_ASN_OP_T(op, const sc_int_base &) \
358 DECL_ASN_OP_T(op, const sc_uint_base &) \
359 DECL_ASN_OP_T(op, const sc_signed &) \
360 DECL_ASN_OP_T(op, const sc_unsigned &)
362#define DECL_ASN_OP(op) \
363 DECL_ASN_OP_T(op, int) \
364 DECL_ASN_OP_T(op, unsigned int) \
365 DECL_ASN_OP_T(op, long) \
366 DECL_ASN_OP_T(op, unsigned long) \
367 DECL_ASN_OP_T(op, float) \
368 DECL_ASN_OP_T(op, double) \
369 DECL_ASN_OP_T(op, const char *) \
370 DECL_ASN_OP_T(op, const sc_fxval &) \
371 DECL_ASN_OP_T(op, const sc_fxval_fast &) \
372 DECL_ASN_OP_T(op, const sc_fxnum &) \
373 DECL_ASN_OP_T(op, const sc_fxnum_fast &) \
374 DECL_ASN_OP_OTHER(op)
394#undef DECL_ASN_OP_OTHER
497#define DEFN_CTORS_T_A(tp) \
498inline sc_ufix::sc_ufix(tp a, sc_fxnum_observer *observer_ ) : \
499 sc_fxnum(a, sc_fxtype_params(), SC_US_, sc_fxcast_switch(), \
503inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, \
504 sc_fxnum_observer *observer_) : \
505 sc_fxnum(a, sc_fxtype_params(wl_, iwl_), SC_US_, sc_fxcast_switch(), \
509inline sc_ufix::sc_ufix(tp a, sc_q_mode qm, sc_o_mode om, \
510 sc_fxnum_observer *observer_) : \
511 sc_fxnum(a, sc_fxtype_params(qm, om), SC_US_, sc_fxcast_switch(), \
515inline sc_ufix::sc_ufix(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
516 sc_fxnum_observer *observer_) : \
517 sc_fxnum(a, sc_fxtype_params(qm, om, nb), SC_US_, sc_fxcast_switch(), \
521inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
522 sc_fxnum_observer *observer_) : \
523 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_US_, \
524 sc_fxcast_switch(), observer_) \
527inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
528 int nb, sc_fxnum_observer *observer_) : \
529 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_US_, \
530 sc_fxcast_switch(), observer_) \
533inline sc_ufix::sc_ufix(tp a, const sc_fxcast_switch &cast_sw, \
534 sc_fxnum_observer *observer_) : \
535 sc_fxnum(a, sc_fxtype_params(), SC_US_, cast_sw, observer_) \
538inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, \
539 const sc_fxcast_switch &cast_sw, \
540 sc_fxnum_observer *observer_) : \
541 sc_fxnum(a, sc_fxtype_params(wl_, iwl_), SC_US_, cast_sw, observer_) \
544inline sc_ufix::sc_ufix(tp a, sc_q_mode qm, sc_o_mode om, \
545 const sc_fxcast_switch &cast_sw, \
546 sc_fxnum_observer *observer_) : \
547 sc_fxnum(a, sc_fxtype_params(qm, om), SC_US_, cast_sw, observer_) \
550inline sc_ufix::sc_ufix(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
551 const sc_fxcast_switch &cast_sw, \
552 sc_fxnum_observer *observer_) : \
553 sc_fxnum(a, sc_fxtype_params(qm, om, nb), SC_US_, cast_sw, observer_) \
556inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
557 const sc_fxcast_switch &cast_sw, \
558 sc_fxnum_observer *observer_) : \
559 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_US_, cast_sw, \
563inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
564 int nb, const sc_fxcast_switch &cast_sw, \
565 sc_fxnum_observer *observer_) : \
566 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_US_, cast_sw, \
570inline sc_ufix::sc_ufix(tp a, const sc_fxtype_params &type_params_, \
571 sc_fxnum_observer * observer_) : \
572 sc_fxnum(a, type_params_, SC_US_, sc_fxcast_switch(), observer_) \
575inline sc_ufix::sc_ufix(tp a, const sc_fxtype_params& type_params_, \
576 const sc_fxcast_switch &cast_sw, \
577 sc_fxnum_observer *observer_) : \
578 sc_fxnum(a, type_params_, SC_US_, cast_sw, observer_) \
581#define DEFN_CTORS_T_B(tp) \
582inline sc_ufix::sc_ufix(tp a, sc_fxnum_observer *observer_) : \
583 sc_fxnum(a, a.type_params(), SC_US_, sc_fxcast_switch(), observer_) \
586inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, \
587 sc_fxnum_observer *observer_) : \
588 sc_fxnum(a, sc_fxtype_params(a.type_params(), wl_, iwl_), SC_US_, \
589 sc_fxcast_switch(), observer_) \
593sc_ufix::sc_ufix(tp a, sc_q_mode qm, sc_o_mode om, \
594 sc_fxnum_observer *observer_) : \
595 sc_fxnum(a, sc_fxtype_params(a.type_params(), qm, om), SC_US_, \
596 sc_fxcast_switch(), observer_) \
599inline sc_ufix::sc_ufix(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
600 sc_fxnum_observer *observer_) : \
601 sc_fxnum(a, sc_fxtype_params(a.type_params(), qm, om, nb), SC_US_, \
602 sc_fxcast_switch(), observer_) \
605inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
606 sc_fxnum_observer* observer_) : \
607 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_US_, \
608 sc_fxcast_switch(), observer_) \
611inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
612 int nb, sc_fxnum_observer *observer_) : \
613 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_US_, \
614 sc_fxcast_switch(), observer_) \
617inline sc_ufix::sc_ufix(tp a, const sc_fxcast_switch& cast_sw, \
618 sc_fxnum_observer* observer_) : \
619 sc_fxnum(a, a.type_params(), SC_US_, cast_sw, observer_) \
622inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, \
623 const sc_fxcast_switch &cast_sw, \
624 sc_fxnum_observer *observer_) : \
625 sc_fxnum(a, sc_fxtype_params(a.type_params(), wl_, iwl_), SC_US_, \
626 cast_sw, observer_) \
629inline sc_ufix::sc_ufix(tp a, sc_q_mode qm, sc_o_mode om, \
630 const sc_fxcast_switch &cast_sw, \
631 sc_fxnum_observer *observer_) : \
632 sc_fxnum(a, sc_fxtype_params(a.type_params(), qm, om), SC_US_, \
633 cast_sw, observer_) \
636inline sc_ufix::sc_ufix(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
637 const sc_fxcast_switch &cast_sw, \
638 sc_fxnum_observer *observer_) : \
639 sc_fxnum(a, sc_fxtype_params(a.type_params(), qm, om, nb), SC_US_, \
640 cast_sw, observer_) \
643inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
644 const sc_fxcast_switch &cast_sw, \
645 sc_fxnum_observer *observer_) : \
646 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_US_, cast_sw, \
650inline sc_ufix::sc_ufix(tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
651 int nb, const sc_fxcast_switch &cast_sw, \
652 sc_fxnum_observer *observer_) : \
653 sc_fxnum(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_US_, cast_sw, \
657inline sc_ufix::sc_ufix(tp a, const sc_fxtype_params &type_params_, \
658 sc_fxnum_observer *observer_) : \
659 sc_fxnum(a, type_params_, SC_US_, sc_fxcast_switch(), observer_) \
662inline sc_ufix::sc_ufix(tp a, const sc_fxtype_params& type_params_, \
663 const sc_fxcast_switch &cast_sw, \
664 sc_fxnum_observer *observer_) : \
665 sc_fxnum(a, type_params_, SC_US_, cast_sw, observer_) \
704 for (
int i = iwl_c - wl_c; i < iwl_c; ++i)
715 for (
int i = iwl_c -
c.wl(); i < iwl_c; ++i)
716 c.set_bit(i, !
a.get_bit(i));
722#define DEFN_BIN_OP_T(op, op2, tp1, tp2) \
723inline const sc_ufix \
724operator op (const tp1 &a, const tp2 &b) \
728 int iwl_a = a.iwl(); \
729 int iwl_b = b.iwl(); \
730 int iwl_c = sc_max(iwl_a, iwl_b); \
731 int fwl_c = sc_max(a.wl() - iwl_a, b.wl() - iwl_b); \
732 sc_ufix c(iwl_c + fwl_c, iwl_c); \
733 for (int i = -fwl_c; i < iwl_c; ++i) \
734 c.set_bit(i, a.get_bit(i) op2 b.get_bit(i)); \
735 return sc_ufix(c, iwl_c + fwl_c, iwl_c); \
753#define DEFN_BIN_FNC_T(fnc, op2, tp1, tp2) \
755fnc (sc_ufix &c, const tp1 &a, const tp2 &b) \
759 int iwl_c = c.iwl(); \
760 for (int i = iwl_c - c.wl(); i < iwl_c; ++i) \
761 c.set_bit(i, a.get_bit(i) op2 b.get_bit(i)); \
763 SC_FXNUM_OBSERVER_WRITE_(c) \
784 sc_fxnum::operator = (
a);
788#define DEFN_ASN_OP_T(op, tp) \
790sc_ufix::operator op (tp a) \
792 sc_fxnum::operator op(a); \
796#define DEFN_ASN_OP_OTHER(op) \
797DEFN_ASN_OP_T(op, int64) \
798DEFN_ASN_OP_T(op, uint64) \
799DEFN_ASN_OP_T(op, const sc_int_base &) \
800DEFN_ASN_OP_T(op, const sc_uint_base &) \
801DEFN_ASN_OP_T(op, const sc_signed &) \
802DEFN_ASN_OP_T(op, const sc_unsigned &)
804#define DEFN_ASN_OP(op) \
805DEFN_ASN_OP_T(op, int) \
806DEFN_ASN_OP_T(op, unsigned int) \
807DEFN_ASN_OP_T(op, long) \
808DEFN_ASN_OP_T(op, unsigned long) \
809DEFN_ASN_OP_T(op, float) \
810DEFN_ASN_OP_T(op, double) \
811DEFN_ASN_OP_T(op, const char *) \
812DEFN_ASN_OP_T(op, const sc_fxval &) \
813DEFN_ASN_OP_T(op, const sc_fxval_fast &) \
814DEFN_ASN_OP_T(op, const sc_fxnum &) \
815DEFN_ASN_OP_T(op, const sc_fxnum_fast &) \
829#undef DEFN_ASN_OP_OTHER
833#define DEFN_ASN_OP_T(op, op2, tp) \
835sc_ufix::operator op (const tp &b) \
837 SC_FXNUM_OBSERVER_READ_(*this) \
840 for (int i = iwl_c - wl(); i < iwl_c; ++i) \
841 set_bit(i, get_bit(i) op2 b.get_bit(i)); \
843 SC_FXNUM_OBSERVER_WRITE_(*this) \
860 return sc_fxval(sc_fxnum::operator ++ (0));
866 return sc_fxval(sc_fxnum::operator -- (0));
977#define DEFN_CTORS_T_A(tp) \
978inline sc_ufix_fast::sc_ufix_fast(tp a, sc_fxnum_fast_observer *observer_) : \
979 sc_fxnum_fast(a, sc_fxtype_params(), SC_US_, sc_fxcast_switch(), \
983inline sc_ufix_fast::sc_ufix_fast(tp a, int wl_, int iwl_, \
984 sc_fxnum_fast_observer *observer_) : \
985 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_), SC_US_, sc_fxcast_switch(), \
989inline sc_ufix_fast::sc_ufix_fast(tp a, sc_q_mode qm, sc_o_mode om, \
990 sc_fxnum_fast_observer *observer_) : \
991 sc_fxnum_fast(a, sc_fxtype_params(qm, om), SC_US_, sc_fxcast_switch(), \
995inline sc_ufix_fast::sc_ufix_fast(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
996 sc_fxnum_fast_observer *observer_) : \
997 sc_fxnum_fast(a, sc_fxtype_params(qm, om, nb), SC_US_, \
998 sc_fxcast_switch(), observer_) \
1001inline sc_ufix_fast::sc_ufix_fast( \
1002 tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1003 sc_fxnum_fast_observer* observer_) : \
1004 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_US_, \
1005 sc_fxcast_switch(), observer_) \
1008inline sc_ufix_fast::sc_ufix_fast( \
1009 tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
1010 sc_fxnum_fast_observer *observer_) : \
1011 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_US_, \
1012 sc_fxcast_switch(), observer_) \
1015inline sc_ufix_fast::sc_ufix_fast(tp a, const sc_fxcast_switch &cast_sw, \
1016 sc_fxnum_fast_observer *observer_) : \
1017 sc_fxnum_fast(a, sc_fxtype_params(), SC_US_, cast_sw, observer_) \
1020inline sc_ufix_fast::sc_ufix_fast(tp a, int wl_, int iwl_, \
1021 const sc_fxcast_switch &cast_sw, \
1022 sc_fxnum_fast_observer *observer_) : \
1023 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_), SC_US_, cast_sw, observer_) \
1026inline sc_ufix_fast::sc_ufix_fast(tp a, sc_q_mode qm, sc_o_mode om, \
1027 const sc_fxcast_switch &cast_sw, \
1028 sc_fxnum_fast_observer *observer_) : \
1029 sc_fxnum_fast(a, sc_fxtype_params(qm, om), SC_US_, cast_sw, observer_) \
1032inline sc_ufix_fast::sc_ufix_fast(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
1033 const sc_fxcast_switch &cast_sw, \
1034 sc_fxnum_fast_observer *observer_) : \
1035 sc_fxnum_fast(a, sc_fxtype_params(qm, om, nb), SC_US_, cast_sw, \
1039inline sc_ufix_fast::sc_ufix_fast(tp a, int wl_, int iwl_, \
1040 sc_q_mode qm, sc_o_mode om, \
1041 const sc_fxcast_switch &cast_sw, \
1042 sc_fxnum_fast_observer *observer_) : \
1043 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_US_, cast_sw, \
1047inline sc_ufix_fast::sc_ufix_fast(tp a, int wl_, int iwl_, \
1048 sc_q_mode qm, sc_o_mode om, int nb, \
1049 const sc_fxcast_switch &cast_sw, \
1050 sc_fxnum_fast_observer *observer_) : \
1051 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_US_, \
1052 cast_sw, observer_) \
1055inline sc_ufix_fast::sc_ufix_fast( \
1056 tp a, const sc_fxtype_params &type_params_, \
1057 sc_fxnum_fast_observer *observer_) : \
1058 sc_fxnum_fast(a, type_params_, SC_US_, sc_fxcast_switch(), observer_) \
1061inline sc_ufix_fast::sc_ufix_fast( \
1062 tp a, const sc_fxtype_params &type_params_, \
1063 const sc_fxcast_switch &cast_sw, sc_fxnum_fast_observer *observer_) : \
1064 sc_fxnum_fast(a, type_params_, SC_US_, cast_sw, observer_) \
1067#define DEFN_CTORS_T_B(tp) \
1068inline sc_ufix_fast::sc_ufix_fast(tp a, sc_fxnum_fast_observer *observer_) : \
1069 sc_fxnum_fast(a, a.type_params(), SC_US_, sc_fxcast_switch(), observer_) \
1072inline sc_ufix_fast::sc_ufix_fast(tp a, int wl_, int iwl_, \
1073 sc_fxnum_fast_observer* observer_) : \
1074 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), wl_, iwl_), SC_US_, \
1075 sc_fxcast_switch(), observer_) \
1078inline sc_ufix_fast::sc_ufix_fast(tp a, sc_q_mode qm, sc_o_mode om, \
1079 sc_fxnum_fast_observer* observer_) : \
1080 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), qm, om), SC_US_, \
1081 sc_fxcast_switch(), observer_) \
1084inline sc_ufix_fast::sc_ufix_fast(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
1085 sc_fxnum_fast_observer* observer_) : \
1086 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), qm, om, nb), SC_US_, \
1087 sc_fxcast_switch(), observer_) \
1090inline sc_ufix_fast::sc_ufix_fast( \
1091 tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1092 sc_fxnum_fast_observer *observer_) : \
1093 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_US_, \
1094 sc_fxcast_switch(), observer_) \
1097inline sc_ufix_fast::sc_ufix_fast( \
1098 tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
1099 sc_fxnum_fast_observer *observer_) : \
1100 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_US_, \
1101 sc_fxcast_switch(), observer_) \
1104inline sc_ufix_fast::sc_ufix_fast(tp a, const sc_fxcast_switch &cast_sw, \
1105 sc_fxnum_fast_observer *observer_) : \
1106 sc_fxnum_fast(a, a.type_params(), SC_US_, cast_sw, observer_) \
1109inline sc_ufix_fast::sc_ufix_fast( \
1110 tp a, int wl_, int iwl_, const sc_fxcast_switch &cast_sw, \
1111 sc_fxnum_fast_observer *observer_) : \
1112 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), wl_, iwl_), SC_US_, \
1113 cast_sw, observer_) \
1116inline sc_ufix_fast::sc_ufix_fast(tp a, sc_q_mode qm, sc_o_mode om, \
1117 const sc_fxcast_switch &cast_sw, \
1118 sc_fxnum_fast_observer *observer_) : \
1119 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), qm, om), SC_US_, \
1120 cast_sw, observer_) \
1123inline sc_ufix_fast::sc_ufix_fast(tp a, sc_q_mode qm, sc_o_mode om, int nb, \
1124 const sc_fxcast_switch &cast_sw, \
1125 sc_fxnum_fast_observer *observer_) : \
1126 sc_fxnum_fast(a, sc_fxtype_params(a.type_params(), qm, om, nb), SC_US_, \
1127 cast_sw, observer_) \
1130inline sc_ufix_fast::sc_ufix_fast( \
1131 tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1132 const sc_fxcast_switch &cast_sw, sc_fxnum_fast_observer *observer_) : \
1133 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om), SC_US_, cast_sw, \
1137inline sc_ufix_fast::sc_ufix_fast( \
1138 tp a, int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
1139 const sc_fxcast_switch &cast_sw, sc_fxnum_fast_observer *observer_) : \
1140 sc_fxnum_fast(a, sc_fxtype_params(wl_, iwl_, qm, om, nb), SC_US_, \
1141 cast_sw, observer_) \
1144inline sc_ufix_fast::sc_ufix_fast(tp a, const sc_fxtype_params &type_params_, \
1145 sc_fxnum_fast_observer *observer_) : \
1146 sc_fxnum_fast(a, type_params_, SC_US_, sc_fxcast_switch(), observer_) \
1149inline sc_ufix_fast::sc_ufix_fast(tp a, const sc_fxtype_params &type_params_, \
1150 const sc_fxcast_switch &cast_sw, \
1151 sc_fxnum_fast_observer* observer_) : \
1152 sc_fxnum_fast(a, type_params_, SC_US_, cast_sw, observer_) \
1174#undef DEFN_CTORS_T_A
1175#undef DEFN_CTORS_T_B
1190 for (
int i = iwl_c - wl_c; i < iwl_c; ++i)
1200 int iwl_c =
c.iwl();
1201 for (
int i = iwl_c -
c.wl(); i < iwl_c; ++i)
1202 c.set_bit(i, !
a.get_bit(i));
1208#define DEFN_BIN_OP_T(op, op2, tp1, tp2) \
1209inline const sc_ufix_fast \
1210operator op (const tp1 &a, const tp2 &b) \
1212 a.observer_read(); \
1213 b.observer_read(); \
1214 int iwl_a = a.iwl(); \
1215 int iwl_b = b.iwl(); \
1216 int iwl_c = sc_max(iwl_a, iwl_b); \
1217 int fwl_c = sc_max(a.wl() - iwl_a, b.wl() - iwl_b); \
1218 sc_ufix_fast c(iwl_c + fwl_c, iwl_c); \
1219 for (int i = -fwl_c; i < iwl_c; ++i) \
1220 c.set_bit(i, a.get_bit(i) op2 b.get_bit(i)); \
1221 return sc_ufix_fast(c, iwl_c + fwl_c, iwl_c); \
1231#define DEFN_BIN_FNC_T(fnc, op2, tp1, tp2) \
1233fnc (sc_ufix_fast &c, const tp1 &a, const tp2 &b) \
1235 a.observer_read(); \
1236 b.observer_read(); \
1237 int iwl_c = c.iwl(); \
1238 for (int i = iwl_c - c.wl(); i < iwl_c; ++i) \
1239 c.set_bit(i, a.get_bit(i) op2 b.get_bit(i)); \
1241 SC_FXNUM_FAST_OBSERVER_WRITE_(c) \
1248#undef DEFN_BIN_FNC_T
1254 sc_fxnum_fast::operator = (
a);
1258#define DEFN_ASN_OP_T(op, tp) \
1259inline sc_ufix_fast & \
1260sc_ufix_fast::operator op (tp a) \
1262 sc_fxnum_fast::operator op(a); \
1266#define DEFN_ASN_OP_OTHER(op) \
1267DEFN_ASN_OP_T(op, int64) \
1268DEFN_ASN_OP_T(op, uint64) \
1269DEFN_ASN_OP_T(op, const sc_int_base &) \
1270DEFN_ASN_OP_T(op, const sc_uint_base &) \
1271DEFN_ASN_OP_T(op, const sc_signed &) \
1272DEFN_ASN_OP_T(op, const sc_unsigned &)
1274#define DEFN_ASN_OP(op) \
1275DEFN_ASN_OP_T(op, int) \
1276DEFN_ASN_OP_T(op, unsigned int) \
1277DEFN_ASN_OP_T(op, long) \
1278DEFN_ASN_OP_T(op, unsigned long) \
1279DEFN_ASN_OP_T(op, float) \
1280DEFN_ASN_OP_T(op, double) \
1281DEFN_ASN_OP_T(op, const char *) \
1282DEFN_ASN_OP_T(op, const sc_fxval &) \
1283DEFN_ASN_OP_T(op, const sc_fxval_fast &) \
1284DEFN_ASN_OP_T(op, const sc_fxnum &) \
1285DEFN_ASN_OP_T(op, const sc_fxnum_fast &) \
1286DEFN_ASN_OP_OTHER(op)
1299#undef DEFN_ASN_OP_OTHER
1302#define DEFN_ASN_OP_T(op, op2, tp) \
1303inline sc_ufix_fast & \
1304sc_ufix_fast::operator op (const tp &b) \
1306 SC_FXNUM_FAST_OBSERVER_READ_(*this) \
1307 b.observer_read(); \
1308 int iwl_c = iwl(); \
1309 for (int i = iwl_c - wl(); i < iwl_c; ++i) \
1310 set_bit(i, get_bit(i) op2 b.get_bit(i)); \
1312 SC_FXNUM_FAST_OBSERVER_WRITE_(*this) \
sc_fxnum_fast & operator--()
sc_fxnum_fast & operator++()
friend class sc_fxval_fast
friend const sc_ufix_fast operator&(const sc_ufix_fast &, const sc_ufix_fast &)
friend void b_and(sc_ufix_fast &, const sc_ufix_fast &, const sc_ufix_fast &)
friend void b_not(sc_ufix_fast &, const sc_ufix_fast &)
sc_ufix_fast & operator--()
friend void b_xor(sc_ufix_fast &, const sc_ufix_fast &, const sc_ufix_fast &)
sc_ufix_fast(sc_fxnum_fast_observer *=0)
friend void b_or(sc_ufix_fast &, const sc_ufix_fast &, const sc_ufix_fast &)
friend const sc_ufix_fast operator|(const sc_ufix_fast &, const sc_ufix_fast &)
sc_ufix_fast & operator=(const sc_ufix_fast &)
sc_ufix_fast & operator++()
const sc_ufix_fast operator~() const
friend const sc_ufix_fast operator^(const sc_ufix_fast &, const sc_ufix_fast &)
friend void b_xor(sc_ufix &, const sc_ufix_fast &, const sc_ufix &)
friend void b_xor(sc_ufix &, const sc_ufix &, const sc_ufix &)
friend void b_and(sc_ufix &, const sc_ufix &, const sc_ufix &)
friend void b_and(sc_ufix &, const sc_ufix &, const sc_ufix_fast &)
friend const sc_ufix operator&(const sc_ufix &, const sc_ufix &)
friend void b_and(sc_ufix &, const sc_ufix_fast &, const sc_ufix &)
const sc_ufix operator~() const
friend const sc_ufix operator^(const sc_ufix &, const sc_ufix &)
friend const sc_ufix operator|(const sc_ufix &, const sc_ufix &)
friend void b_or(sc_ufix &, const sc_ufix_fast &, const sc_ufix &)
sc_ufix & operator=(const sc_ufix &)
friend void b_or(sc_ufix &, const sc_ufix &, const sc_ufix &)
friend void b_xor(sc_ufix &, const sc_ufix &, const sc_ufix_fast &)
friend void b_or(sc_ufix &, const sc_ufix &, const sc_ufix_fast &)
sc_ufix(sc_fxnum_observer *=0)
friend void b_not(sc_ufix &, const sc_ufix &)
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)