50 #ifndef __SYSTEMC_EXT_DT_FX_SC_UFIX_HH__
51 #define __SYSTEMC_EXT_DT_FX_SC_UFIX_HH__
73 explicit sc_ufix(sc_fxnum_observer * =0);
74 sc_ufix(
int,
int, sc_fxnum_observer * =0);
79 explicit sc_ufix(
const sc_fxcast_switch &, sc_fxnum_observer * =0);
80 sc_ufix(
int,
int,
const sc_fxcast_switch &, sc_fxnum_observer * =0);
82 sc_fxnum_observer * =0);
84 sc_fxnum_observer * =0);
86 sc_fxnum_observer * =0);
88 sc_fxnum_observer * =0);
89 explicit sc_ufix(
const sc_fxtype_params &, sc_fxnum_observer * =0);
90 sc_ufix(
const sc_fxtype_params &,
const sc_fxcast_switch &,
91 sc_fxnum_observer * =0);
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); \
141 #undef DECL_CTORS_T_A
142 #undef DECL_CTORS_T_B
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); \
317 #undef DECL_CTORS_T_A
318 #undef DECL_CTORS_T_B
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
417 sc_fxnum(sc_fxtype_params(),
SC_US_, sc_fxcast_switch(), observer_)
421 sc_fxnum(sc_fxtype_params(wl_, iwl_),
SC_US_, sc_fxcast_switch(),
426 sc_fxnum_observer *observer_) :
427 sc_fxnum(sc_fxtype_params(qm, om),
SC_US_, sc_fxcast_switch(),
433 sc_fxnum_observer *observer_) :
434 sc_fxnum(sc_fxtype_params(qm, om, nb),
SC_US_, sc_fxcast_switch(),
439 sc_fxnum_observer *observer_) :
440 sc_fxnum(sc_fxtype_params(wl_, iwl_, qm, om),
SC_US_,
441 sc_fxcast_switch(), observer_)
445 sc_fxnum_observer *observer_) :
446 sc_fxnum(sc_fxtype_params(wl_, iwl_, qm, om, nb),
SC_US_,
497 #define DEFN_CTORS_T_A(tp) \
498 inline sc_ufix::sc_ufix(tp a, sc_fxnum_observer *observer_ ) : \
499 sc_fxnum(a, sc_fxtype_params(), SC_US_, sc_fxcast_switch(), \
503 inline 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(), \
509 inline 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(), \
515 inline 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(), \
521 inline 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_) \
527 inline 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_) \
533 inline 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_) \
538 inline 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_) \
544 inline 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_) \
550 inline 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_) \
556 inline 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, \
563 inline 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, \
570 inline 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_) \
575 inline 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) \
582 inline sc_ufix::sc_ufix(tp a, sc_fxnum_observer *observer_) : \
583 sc_fxnum(a, a.type_params(), SC_US_, sc_fxcast_switch(), observer_) \
586 inline 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_) \
593 sc_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_) \
599 inline 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_) \
605 inline 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_) \
611 inline 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_) \
617 inline 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_) \
622 inline 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_) \
629 inline 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_) \
636 inline 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_) \
643 inline 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, \
650 inline 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, \
657 inline 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_) \
662 inline 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_) \
687 #undef DEFN_CTORS_T_A
688 #undef DEFN_CTORS_T_B
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) \
723 inline const sc_ufix \
724 operator 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) \
755 fnc (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) \
778 #undef DEFN_BIN_FNC_T
784 sc_fxnum::operator = (
a);
788 #define DEFN_ASN_OP_T(op, tp) \
790 sc_ufix::operator op (tp a) \
792 sc_fxnum::operator op(a); \
796 #define DEFN_ASN_OP_OTHER(op) \
797 DEFN_ASN_OP_T(op, int64) \
798 DEFN_ASN_OP_T(op, uint64) \
799 DEFN_ASN_OP_T(op, const sc_int_base &) \
800 DEFN_ASN_OP_T(op, const sc_uint_base &) \
801 DEFN_ASN_OP_T(op, const sc_signed &) \
802 DEFN_ASN_OP_T(op, const sc_unsigned &)
804 #define DEFN_ASN_OP(op) \
805 DEFN_ASN_OP_T(op, int) \
806 DEFN_ASN_OP_T(op, unsigned int) \
807 DEFN_ASN_OP_T(op, long) \
808 DEFN_ASN_OP_T(op, unsigned long) \
809 DEFN_ASN_OP_T(op, float) \
810 DEFN_ASN_OP_T(op, double) \
811 DEFN_ASN_OP_T(op, const char *) \
812 DEFN_ASN_OP_T(op, const sc_fxval &) \
813 DEFN_ASN_OP_T(op, const sc_fxval_fast &) \
814 DEFN_ASN_OP_T(op, const sc_fxnum &) \
815 DEFN_ASN_OP_T(op, const sc_fxnum_fast &) \
816 DEFN_ASN_OP_OTHER(op)
829 #undef DEFN_ASN_OP_OTHER
833 #define DEFN_ASN_OP_T(op, op2, tp) \
835 sc_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) \
978 inline 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(), \
983 inline 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(), \
989 inline 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(), \
995 inline 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_) \
1001 inline 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_) \
1008 inline 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_) \
1015 inline 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_) \
1020 inline 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_) \
1026 inline 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_) \
1032 inline 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, \
1039 inline 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, \
1047 inline 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_) \
1055 inline 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_) \
1061 inline 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) \
1068 inline 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_) \
1072 inline 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_) \
1078 inline 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_) \
1084 inline 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_) \
1090 inline 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_) \
1097 inline 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_) \
1104 inline 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_) \
1109 inline 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_) \
1116 inline 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_) \
1123 inline 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_) \
1130 inline 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, \
1137 inline 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_) \
1144 inline 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_) \
1149 inline 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
1179 sc_fxnum_fast(
a,
a.type_params(),
SC_US_, sc_fxcast_switch(), 0)
1183 inline const sc_ufix_fast
1189 sc_ufix_fast
c(wl_c, iwl_c);
1190 for (
int i = iwl_c - wl_c;
i < iwl_c; ++
i)
1191 c.set_bit(
i, !get_bit(
i));
1192 return sc_ufix_fast(
c, wl_c, iwl_c);
1197 b_not(sc_ufix_fast &
c, const sc_ufix_fast &
a)
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) \
1209 inline const sc_ufix_fast \
1210 operator 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); \
1228 #undef DEFN_BIN_OP_T
1231 #define DEFN_BIN_FNC_T(fnc, op2, tp1, tp2) \
1233 fnc (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
1251 inline sc_ufix_fast &
1252 sc_ufix_fast::operator = (
const sc_ufix_fast &
a)
1254 sc_fxnum_fast::operator = (
a);
1258 #define DEFN_ASN_OP_T(op, tp) \
1259 inline sc_ufix_fast & \
1260 sc_ufix_fast::operator op (tp a) \
1262 sc_fxnum_fast::operator op(a); \
1266 #define DEFN_ASN_OP_OTHER(op) \
1267 DEFN_ASN_OP_T(op, int64) \
1268 DEFN_ASN_OP_T(op, uint64) \
1269 DEFN_ASN_OP_T(op, const sc_int_base &) \
1270 DEFN_ASN_OP_T(op, const sc_uint_base &) \
1271 DEFN_ASN_OP_T(op, const sc_signed &) \
1272 DEFN_ASN_OP_T(op, const sc_unsigned &)
1274 #define DEFN_ASN_OP(op) \
1275 DEFN_ASN_OP_T(op, int) \
1276 DEFN_ASN_OP_T(op, unsigned int) \
1277 DEFN_ASN_OP_T(op, long) \
1278 DEFN_ASN_OP_T(op, unsigned long) \
1279 DEFN_ASN_OP_T(op, float) \
1280 DEFN_ASN_OP_T(op, double) \
1281 DEFN_ASN_OP_T(op, const char *) \
1282 DEFN_ASN_OP_T(op, const sc_fxval &) \
1283 DEFN_ASN_OP_T(op, const sc_fxval_fast &) \
1284 DEFN_ASN_OP_T(op, const sc_fxnum &) \
1285 DEFN_ASN_OP_T(op, const sc_fxnum_fast &) \
1286 DEFN_ASN_OP_OTHER(op)
1298 #undef DEFN_ASN_OP_T
1299 #undef DEFN_ASN_OP_OTHER
1302 #define DEFN_ASN_OP_T(op, op2, tp) \
1303 inline sc_ufix_fast & \
1304 sc_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) \
1323 #undef DEFN_ASN_OP_T
1326 inline const sc_fxval_fast
1327 sc_ufix_fast::operator ++ (
int)
1329 return sc_fxval_fast(sc_fxnum_fast::operator ++ (0));
1332 inline const sc_fxval_fast
1333 sc_ufix_fast::operator -- (
int)
1335 return sc_fxval_fast(sc_fxnum_fast::operator -- (0));
1338 inline sc_ufix_fast &
1339 sc_ufix_fast::operator ++ ()
1341 sc_fxnum_fast::operator ++ ();
1345 inline sc_ufix_fast &
1346 sc_ufix_fast::operator -- ()
1348 sc_fxnum_fast::operator -- ();
1354 #endif // __SYSTEMC_EXT_DT_FX_SC_UFIX_HH__