50 #ifndef __SYSTEMC_EXT_DT_FX_SC_UFIXED_HH__
51 #define __SYSTEMC_EXT_DT_FX_SC_UFIXED_HH__
59 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
61 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
71 template <
int W,
int I,
78 explicit sc_ufixed(sc_fxnum_observer * =0);
79 explicit sc_ufixed(
const sc_fxcast_switch &, sc_fxnum_observer * =0);
81 #define DECL_CTORS_T_A(tp) \
82 sc_ufixed(tp, sc_fxnum_observer * =0); \
83 sc_ufixed(tp, const sc_fxcast_switch &, sc_fxnum_observer * =0);
85 #define DECL_CTORS_T_B(tp) \
86 explicit sc_ufixed(tp, sc_fxnum_observer * =0); \
87 sc_ufixed(tp, const sc_fxcast_switch &, sc_fxnum_observer * =0);
108 #undef DECL_CTORS_T_A
109 #undef DECL_CTORS_T_B
116 #define DECL_ASN_OP_T(op,tp) sc_ufixed &operator op (tp);
118 #define DECL_ASN_OP_OTHER(op) \
119 DECL_ASN_OP_T(op, int64) \
120 DECL_ASN_OP_T(op, uint64) \
121 DECL_ASN_OP_T(op, const sc_int_base &) \
122 DECL_ASN_OP_T(op, const sc_uint_base &) \
123 DECL_ASN_OP_T(op, const sc_signed &) \
124 DECL_ASN_OP_T(op, const sc_unsigned &)
126 #define DECL_ASN_OP(op) \
127 DECL_ASN_OP_T(op, int) \
128 DECL_ASN_OP_T(op, unsigned int) \
129 DECL_ASN_OP_T(op, long) \
130 DECL_ASN_OP_T(op, unsigned long) \
131 DECL_ASN_OP_T(op, float) \
132 DECL_ASN_OP_T(op, double) \
133 DECL_ASN_OP_T(op, const char *) \
134 DECL_ASN_OP_T(op, const sc_fxval &) \
135 DECL_ASN_OP_T(op, const sc_fxval_fast &) \
136 DECL_ASN_OP_T(op, const sc_fxnum &) \
137 DECL_ASN_OP_T(op, const sc_fxnum_fast &) \
138 DECL_ASN_OP_OTHER(op)
158 #undef DECL_ASN_OP_OTHER
176 template <
int W,
int I,
187 #define DECL_CTORS_T_A(tp) \
188 sc_ufixed_fast(tp, sc_fxnum_fast_observer * =0); \
189 sc_ufixed_fast(tp, const sc_fxcast_switch &, sc_fxnum_fast_observer * =0);
191 #define DECL_CTORS_T_B(tp) \
192 explicit sc_ufixed_fast(tp, sc_fxnum_fast_observer * =0); \
193 sc_ufixed_fast(tp, const sc_fxcast_switch &, sc_fxnum_fast_observer * =0);
214 #undef DECL_CTORS_T_A
215 #undef DECL_CTORS_T_B
222 #define DECL_ASN_OP_T(op,tp) sc_ufixed_fast &operator op (tp);
224 #define DECL_ASN_OP_OTHER(op) \
225 DECL_ASN_OP_T(op, int64) \
226 DECL_ASN_OP_T(op, uint64) \
227 DECL_ASN_OP_T(op, const sc_int_base &) \
228 DECL_ASN_OP_T(op, const sc_uint_base &) \
229 DECL_ASN_OP_T(op, const sc_signed &) \
230 DECL_ASN_OP_T(op, const sc_unsigned &)
232 #define DECL_ASN_OP(op) \
233 DECL_ASN_OP_T(op, int) \
234 DECL_ASN_OP_T(op, unsigned int) \
235 DECL_ASN_OP_T(op, long) \
236 DECL_ASN_OP_T(op, unsigned long) \
237 DECL_ASN_OP_T(op, float) \
238 DECL_ASN_OP_T(op, double) \
239 DECL_ASN_OP_T(op, const char *) \
240 DECL_ASN_OP_T(op, const sc_fxval &) \
241 DECL_ASN_OP_T(op, const sc_fxval_fast &) \
242 DECL_ASN_OP_T(op, const sc_fxnum &) \
243 DECL_ASN_OP_T(op, const sc_fxnum_fast &) \
244 DECL_ASN_OP_OTHER(op)
264 #undef DECL_ASN_OP_OTHER
284 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
286 sc_ufix(W, I, Q, O, N, observer_)
289 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
291 sc_fxnum_observer *observer_) :
292 sc_ufix(W, I, Q, O, N, cast_sw, observer_)
295 #define DEFN_CTORS_T(tp) \
296 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
297 inline sc_ufixed<W, I, Q, O, N>::sc_ufixed( \
298 tp a, sc_fxnum_observer *observer_) :\
299 sc_ufix(a, W, I, Q, O, N, observer_) \
302 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
303 inline sc_ufixed<W, I, Q, O, N>::sc_ufixed( \
304 tp a, const sc_fxcast_switch &cast_sw, \
305 sc_fxnum_observer *observer_) : \
306 sc_ufix(a, W, I, Q, O, N, cast_sw, observer_) \
331 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
337 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
345 #define DEFN_ASN_OP_T(op,tp) \
346 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
347 inline sc_ufixed<W, I, Q, O, N> & \
348 sc_ufixed<W, I, Q, O, N>::operator op (tp a) \
350 sc_ufix::operator op (a); \
354 #define DEFN_ASN_OP_OTHER(op) \
355 DEFN_ASN_OP_T(op, int64) \
356 DEFN_ASN_OP_T(op, uint64) \
357 DEFN_ASN_OP_T(op, const sc_int_base &) \
358 DEFN_ASN_OP_T(op, const sc_uint_base &) \
359 DEFN_ASN_OP_T(op, const sc_signed &) \
360 DEFN_ASN_OP_T(op, const sc_unsigned &)
362 #define DEFN_ASN_OP(op) \
363 DEFN_ASN_OP_T(op, int) \
364 DEFN_ASN_OP_T(op, unsigned int) \
365 DEFN_ASN_OP_T(op, long) \
366 DEFN_ASN_OP_T(op, unsigned long) \
367 DEFN_ASN_OP_T(op, float) \
368 DEFN_ASN_OP_T(op, double) \
369 DEFN_ASN_OP_T(op, const char *) \
370 DEFN_ASN_OP_T(op, const sc_fxval &) \
371 DEFN_ASN_OP_T(op, const sc_fxval_fast &) \
372 DEFN_ASN_OP_T(op, const sc_fxnum &) \
373 DEFN_ASN_OP_T(op, const sc_fxnum_fast &) \
374 DEFN_ASN_OP_OTHER(op)
394 #undef DEFN_ASN_OP_OTHER
398 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
402 return sc_fxval(sc_ufix::operator ++ (0));
405 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
409 return sc_fxval(sc_ufix::operator -- (0));
412 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
413 inline sc_ufixed<W, I, Q, O, N> &
420 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
421 inline sc_ufixed<W, I, Q, O, N> &
435 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
441 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
448 #define DEFN_CTORS_T(tp) \
449 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
450 inline sc_ufixed_fast<W, I, Q, O, N>::sc_ufixed_fast( \
451 tp a, sc_fxnum_fast_observer *observer_ ) : \
452 sc_ufix_fast(a, W, I, Q, O, N, observer_) \
455 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
456 inline sc_ufixed_fast<W, I, Q, O, N>::sc_ufixed_fast( \
457 tp a, const sc_fxcast_switch &cast_sw, \
458 sc_fxnum_fast_observer *observer_) : \
459 sc_ufix_fast(a, W, I, Q, O, N, cast_sw, observer_) \
484 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
486 const sc_ufixed_fast<W, I, Q, O, N> &
a) :
487 sc_ufix_fast(
a, W, I, Q, O, N)
491 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
492 inline sc_ufixed_fast<W, I, Q, O, N> &
493 sc_ufixed_fast<W, I, Q, O, N>::operator = (
494 const sc_ufixed_fast<W, I, Q, O, N> &
a)
496 sc_ufix_fast::operator = (
a);
500 #define DEFN_ASN_OP_T(op, tp) \
501 template<int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
502 inline sc_ufixed_fast<W, I, Q, O, N> & \
503 sc_ufixed_fast<W, I, Q, O, N>::operator op (tp a) \
505 sc_ufix_fast::operator op (a); \
509 #define DEFN_ASN_OP_OTHER(op) \
510 DEFN_ASN_OP_T(op, int64) \
511 DEFN_ASN_OP_T(op, uint64) \
512 DEFN_ASN_OP_T(op, const sc_int_base &) \
513 DEFN_ASN_OP_T(op, const sc_uint_base &) \
514 DEFN_ASN_OP_T(op, const sc_signed &) \
515 DEFN_ASN_OP_T(op, const sc_unsigned &)
517 #define DEFN_ASN_OP(op) \
518 DEFN_ASN_OP_T(op, int) \
519 DEFN_ASN_OP_T(op, unsigned int) \
520 DEFN_ASN_OP_T(op, long) \
521 DEFN_ASN_OP_T(op, unsigned long) \
522 DEFN_ASN_OP_T(op, float) \
523 DEFN_ASN_OP_T(op, double) \
524 DEFN_ASN_OP_T(op, const char *) \
525 DEFN_ASN_OP_T(op, const sc_fxval &) \
526 DEFN_ASN_OP_T(op, const sc_fxval_fast &) \
527 DEFN_ASN_OP_T(op, const sc_fxnum &) \
528 DEFN_ASN_OP_T(op, const sc_fxnum_fast &) \
529 DEFN_ASN_OP_OTHER(op)
549 #undef DEFN_ASN_OP_OTHER
553 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
554 inline const sc_fxval_fast
555 sc_ufixed_fast<W, I, Q, O, N>::operator ++ (
int)
557 return sc_fxval_fast( sc_ufix_fast::operator ++ (0));
560 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
561 inline const sc_fxval_fast
562 sc_ufixed_fast<W, I, Q, O, N>::operator -- (
int)
564 return sc_fxval_fast( sc_ufix_fast::operator -- (0));
567 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
568 inline sc_ufixed_fast<W, I, Q, O, N> &
569 sc_ufixed_fast<W, I, Q, O, N>::operator ++ ()
571 sc_ufix_fast::operator ++ ();
575 template<
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
576 inline sc_ufixed_fast<W, I, Q, O, N> &
577 sc_ufixed_fast<W,I,Q,O,N>::operator -- ()
579 sc_ufix_fast::operator -- ();
585 #endif // __SYSTEMC_EXT_DT_FX_SC_UFIXED_HH__