50 #ifndef __SYSTEMC_EXT_DT_FX_SC_FIXED_HH__
51 #define __SYSTEMC_EXT_DT_FX_SC_FIXED_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>
70 template <
int W,
int I,
77 explicit sc_fixed(sc_fxnum_observer * =0);
78 explicit sc_fixed(
const sc_fxcast_switch &, sc_fxnum_observer * =0);
80 #define DECL_CTORS_T_A(tp) \
81 sc_fixed(tp, sc_fxnum_observer * =0); \
82 sc_fixed(tp, const sc_fxcast_switch &, sc_fxnum_observer * =0);
84 #define DECL_CTORS_T_B(tp) \
85 explicit sc_fixed(tp, sc_fxnum_observer * =0); \
86 sc_fixed(tp, const sc_fxcast_switch &, sc_fxnum_observer * =0);
107 #undef DECL_CTORS_T_A
108 #undef DECL_CTORS_T_B
116 #define DECL_ASN_OP_T(op, tp) sc_fixed &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_fixed_fast(tp, sc_fxnum_fast_observer * =0); \
189 sc_fixed_fast(tp, const sc_fxcast_switch &, \
190 sc_fxnum_fast_observer * =0);
192 #define DECL_CTORS_T_B(tp) \
193 explicit sc_fixed_fast(tp, sc_fxnum_fast_observer * =0); \
194 sc_fixed_fast(tp, const sc_fxcast_switch &, \
195 sc_fxnum_fast_observer * =0);
216 #undef DECL_CTORS_T_A
217 #undef DECL_CTORS_T_B
225 #define DECL_ASN_OP_T(op, tp) sc_fixed_fast &operator op (tp);
227 #define DECL_ASN_OP_OTHER(op) \
228 DECL_ASN_OP_T(op, int64) \
229 DECL_ASN_OP_T(op, uint64) \
230 DECL_ASN_OP_T(op, const sc_int_base &) \
231 DECL_ASN_OP_T(op, const sc_uint_base &) \
232 DECL_ASN_OP_T(op, const sc_signed &) \
233 DECL_ASN_OP_T(op, const sc_unsigned &)
235 #define DECL_ASN_OP(op) \
236 DECL_ASN_OP_T(op, int) \
237 DECL_ASN_OP_T(op, unsigned int) \
238 DECL_ASN_OP_T(op, long) \
239 DECL_ASN_OP_T(op, unsigned long) \
240 DECL_ASN_OP_T(op, float) \
241 DECL_ASN_OP_T(op, double) \
242 DECL_ASN_OP_T(op, const char *) \
243 DECL_ASN_OP_T(op, const sc_fxval &) \
244 DECL_ASN_OP_T(op, const sc_fxval_fast &) \
245 DECL_ASN_OP_T(op, const sc_fxnum &) \
246 DECL_ASN_OP_T(op, const sc_fxnum_fast &) \
247 DECL_ASN_OP_OTHER(op)
267 #undef DECL_ASN_OP_OTHER
287 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
289 sc_fix(W, I, Q, O, N, observer_)
292 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
294 const sc_fxcast_switch &cast_sw, sc_fxnum_observer *observer_) :
295 sc_fix(W, I, Q, O, N, cast_sw, observer_)
298 #define DEFN_CTORS_T(tp) \
299 template <int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
300 inline sc_fixed<W, I, Q, O, N>::sc_fixed( \
301 tp a, sc_fxnum_observer* observer_) : \
302 sc_fix(a, W, I, Q, O, N, observer_) \
305 template <int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
306 inline sc_fixed<W, I, Q, O, N>::sc_fixed( \
307 tp a, const sc_fxcast_switch &cast_sw, \
308 sc_fxnum_observer *observer_) : \
309 sc_fix(a, W, I, Q, O, N, cast_sw, observer_) \
334 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
340 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
348 #define DEFN_ASN_OP_T(op, tp) \
349 template <int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
350 inline sc_fixed<W, I, Q, O, N> & \
351 sc_fixed<W, I, Q, O, N>::operator op (tp a) \
353 sc_fix::operator op (a); \
357 #define DEFN_ASN_OP_OTHER(op) \
358 DEFN_ASN_OP_T(op, int64) \
359 DEFN_ASN_OP_T(op, uint64) \
360 DEFN_ASN_OP_T(op, const sc_int_base &) \
361 DEFN_ASN_OP_T(op, const sc_uint_base &) \
362 DEFN_ASN_OP_T(op, const sc_signed &) \
363 DEFN_ASN_OP_T(op, const sc_unsigned &)
365 #define DEFN_ASN_OP(op) \
366 DEFN_ASN_OP_T(op, int) \
367 DEFN_ASN_OP_T(op, unsigned int) \
368 DEFN_ASN_OP_T(op, long) \
369 DEFN_ASN_OP_T(op, unsigned long) \
370 DEFN_ASN_OP_T(op, float) \
371 DEFN_ASN_OP_T(op, double) \
372 DEFN_ASN_OP_T(op, const char *) \
373 DEFN_ASN_OP_T(op, const sc_fxval &) \
374 DEFN_ASN_OP_T(op, const sc_fxval_fast &) \
375 DEFN_ASN_OP_T(op, const sc_fxnum &) \
376 DEFN_ASN_OP_T(op, const sc_fxnum_fast &) \
377 DEFN_ASN_OP_OTHER(op)
397 #undef DEFN_ASN_OP_OTHER
401 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
405 return sc_fxval(sc_fix::operator ++ (0));
408 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
412 return sc_fxval(sc_fix::operator -- (0));
415 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
416 inline sc_fixed<W, I, Q, O, N> &
423 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
424 inline sc_fixed<W, I, Q, O, N> &
438 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
444 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
450 #define DEFN_CTORS_T(tp) \
451 template <int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
452 inline sc_fixed_fast<W, I, Q, O, N>::sc_fixed_fast( \
453 tp a, sc_fxnum_fast_observer *observer_) : \
454 sc_fix_fast(a, W, I, Q, O, N, observer_) \
457 template <int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
458 inline sc_fixed_fast<W, I, Q, O, N>::sc_fixed_fast( \
459 tp a, const sc_fxcast_switch &cast_sw, \
460 sc_fxnum_fast_observer *observer_) : \
461 sc_fix_fast(a, W, I, Q, O, N, cast_sw, observer_) \
486 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
488 const sc_fixed_fast<W, I, Q, O, N> &
a) : sc_fix_fast(
a, W, I, Q, O, N)
492 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
493 inline sc_fixed_fast<W, I, Q, O, N> &
494 sc_fixed_fast<W, I, Q, O, N>::operator = (
495 const sc_fixed_fast<W, I, Q, O, N> &
a)
497 sc_fix_fast::operator = (
a);
501 #define DEFN_ASN_OP_T(op, tp) \
502 template <int W, int I, sc_q_mode Q, sc_o_mode O, int N> \
503 inline sc_fixed_fast<W, I, Q, O, N> & \
504 sc_fixed_fast<W, I, Q, O, N>::operator op (tp a) \
506 sc_fix_fast::operator op (a); \
510 #define DEFN_ASN_OP_OTHER(op) \
511 DEFN_ASN_OP_T(op, int64) \
512 DEFN_ASN_OP_T(op, uint64) \
513 DEFN_ASN_OP_T(op, const sc_int_base &) \
514 DEFN_ASN_OP_T(op, const sc_uint_base &) \
515 DEFN_ASN_OP_T(op, const sc_signed &) \
516 DEFN_ASN_OP_T(op, const sc_unsigned &)
518 #define DEFN_ASN_OP(op) \
519 DEFN_ASN_OP_T(op, int) \
520 DEFN_ASN_OP_T(op, unsigned int) \
521 DEFN_ASN_OP_T(op, long) \
522 DEFN_ASN_OP_T(op, unsigned long) \
523 DEFN_ASN_OP_T(op, float) \
524 DEFN_ASN_OP_T(op, double) \
525 DEFN_ASN_OP_T(op, const char *) \
526 DEFN_ASN_OP_T(op, const sc_fxval &) \
527 DEFN_ASN_OP_T(op, const sc_fxval_fast &) \
528 DEFN_ASN_OP_T(op, const sc_fxnum &) \
529 DEFN_ASN_OP_T(op, const sc_fxnum_fast &) \
530 DEFN_ASN_OP_OTHER(op)
550 #undef DEFN_ASN_OP_OTHER
554 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
555 inline const sc_fxval_fast
556 sc_fixed_fast<W, I, Q, O, N>::operator ++ (
int)
558 return sc_fxval_fast(sc_fix_fast::operator ++ (0));
561 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
562 inline const sc_fxval_fast
563 sc_fixed_fast<W, I, Q, O, N>::operator -- (
int)
565 return sc_fxval_fast(sc_fix_fast::operator -- (0));
568 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
569 inline sc_fixed_fast<W, I, Q, O, N> &
570 sc_fixed_fast<W, I, Q, O, N>::operator ++ ()
572 sc_fix_fast::operator ++ ();
576 template <
int W,
int I, sc_q_mode Q, sc_o_mode O,
int N>
577 inline sc_fixed_fast<W, I, Q, O, N> &
578 sc_fixed_fast<W, I, Q, O, N>::operator -- ()
580 sc_fix_fast::operator -- ();
586 #endif // __SYSTEMC_EXT_DT_FX_SC_FIXED_HH__