1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22  sc_ufixed.h -
23
24  Original Author: Martin Janssen, Synopsys, Inc.
25
26 *****************************************************************************/
27
28/*****************************************************************************
29
30  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31  changes you are making here.
32
33      Name, Affiliation, Date:
34  Description of Modification:
35
36 *****************************************************************************/
37
38// $Log: sc_ufixed.h,v $
39// Revision 1.2  2011/01/19 18:57:40  acg
40//  Andy Goodrich: changes for IEEE_1666_2011.
41//
42// Revision 1.1.1.1  2006/12/15 20:20:04  acg
43// SystemC 2.3
44//
45// Revision 1.3  2006/01/13 18:53:58  acg
46// Andy Goodrich: added $Log command so that CVS comments are reproduced in
47// the source.
48//
49
50#ifndef SC_UFIXED_H
51#define SC_UFIXED_H
52
53
54#include "sysc/datatypes/fx/sc_ufix.h"
55
56
57namespace sc_dt
58{
59
60// classes defined in this module
61template <int W, int I, sc_q_mode Q, sc_o_mode O, int N> class sc_ufixed;
62template <int W, int I, sc_q_mode Q, sc_o_mode O, int N> class sc_ufixed_fast;
63
64
65// ----------------------------------------------------------------------------
66//  TEMPLATE CLASS : sc_ufixed
67//
68//  "Constrained" unsigned fixed-point class; arbitrary precision.
69// ----------------------------------------------------------------------------
70
71template <int W, int I,
72	  sc_q_mode Q = SC_DEFAULT_Q_MODE_,
73	  sc_o_mode O = SC_DEFAULT_O_MODE_, int N = SC_DEFAULT_N_BITS_>
74class sc_ufixed : public sc_ufix
75{
76
77public:
78
79    // constructors
80
81    explicit sc_ufixed( sc_fxnum_observer* = 0 );
82    explicit sc_ufixed( const sc_fxcast_switch&, sc_fxnum_observer* = 0 );
83
84#define DECL_CTORS_T_A(tp)                                                    \
85             sc_ufixed( tp, sc_fxnum_observer* = 0 );                         \
86             sc_ufixed( tp, const sc_fxcast_switch&, sc_fxnum_observer* = 0 );
87
88#define DECL_CTORS_T_B(tp)                                                    \
89    explicit sc_ufixed( tp, sc_fxnum_observer* = 0 );                         \
90             sc_ufixed( tp, const sc_fxcast_switch&, sc_fxnum_observer* = 0 );
91
92    DECL_CTORS_T_A(int)
93    DECL_CTORS_T_A(unsigned int)
94    DECL_CTORS_T_A(long)
95    DECL_CTORS_T_A(unsigned long)
96    DECL_CTORS_T_A(float)
97    DECL_CTORS_T_A(double)
98    DECL_CTORS_T_A(const char*)
99    DECL_CTORS_T_A(const sc_fxval&)
100    DECL_CTORS_T_A(const sc_fxval_fast&)
101    DECL_CTORS_T_A(const sc_fxnum&)
102    DECL_CTORS_T_A(const sc_fxnum_fast&)
103#ifndef SC_FX_EXCLUDE_OTHER
104    DECL_CTORS_T_B(int64)
105    DECL_CTORS_T_B(uint64)
106    DECL_CTORS_T_B(const sc_int_base&)
107    DECL_CTORS_T_B(const sc_uint_base&)
108    DECL_CTORS_T_B(const sc_signed&)
109    DECL_CTORS_T_B(const sc_unsigned&)
110#endif
111
112#undef DECL_CTORS_T_A
113#undef DECL_CTORS_T_B
114
115    // copy constructor
116
117    sc_ufixed( const sc_ufixed<W,I,Q,O,N>& );
118
119
120    // assignment operators
121
122    sc_ufixed& operator = ( const sc_ufixed<W,I,Q,O,N>& );
123
124#define DECL_ASN_OP_T(op,tp)                                                  \
125    sc_ufixed& operator op ( tp );
126
127#ifndef SC_FX_EXCLUDE_OTHER
128#define DECL_ASN_OP_OTHER(op)                                                 \
129    DECL_ASN_OP_T(op,int64)                                                   \
130    DECL_ASN_OP_T(op,uint64)                                                  \
131    DECL_ASN_OP_T(op,const sc_int_base&)                                      \
132    DECL_ASN_OP_T(op,const sc_uint_base&)                                     \
133    DECL_ASN_OP_T(op,const sc_signed&)                                        \
134    DECL_ASN_OP_T(op,const sc_unsigned&)
135#else
136#define DECL_ASN_OP_OTHER(op)
137#endif
138
139#define DECL_ASN_OP(op)                                                       \
140    DECL_ASN_OP_T(op,int)                                                     \
141    DECL_ASN_OP_T(op,unsigned int)                                            \
142    DECL_ASN_OP_T(op,long)                                                    \
143    DECL_ASN_OP_T(op,unsigned long)                                           \
144    DECL_ASN_OP_T(op,float)                                                  \
145    DECL_ASN_OP_T(op,double)                                                  \
146    DECL_ASN_OP_T(op,const char*)                                             \
147    DECL_ASN_OP_T(op,const sc_fxval&)                                         \
148    DECL_ASN_OP_T(op,const sc_fxval_fast&)                                    \
149    DECL_ASN_OP_T(op,const sc_fxnum&)                                         \
150    DECL_ASN_OP_T(op,const sc_fxnum_fast&)                                    \
151    DECL_ASN_OP_OTHER(op)
152
153    DECL_ASN_OP(=)
154
155    DECL_ASN_OP(*=)
156    DECL_ASN_OP(/=)
157    DECL_ASN_OP(+=)
158    DECL_ASN_OP(-=)
159
160    DECL_ASN_OP_T(<<=,int)
161    DECL_ASN_OP_T(>>=,int)
162
163    DECL_ASN_OP_T(&=,const sc_ufix&)
164    DECL_ASN_OP_T(&=,const sc_ufix_fast&)
165    DECL_ASN_OP_T(|=,const sc_ufix&)
166    DECL_ASN_OP_T(|=,const sc_ufix_fast&)
167    DECL_ASN_OP_T(^=,const sc_ufix&)
168    DECL_ASN_OP_T(^=,const sc_ufix_fast&)
169
170#undef DECL_ASN_OP_T
171#undef DECL_ASN_OP_OTHER
172#undef DECL_ASN_OP
173
174
175    // auto-increment and auto-decrement
176
177    const sc_fxval operator ++ ( int );
178    const sc_fxval operator -- ( int );
179
180    sc_ufixed& operator ++ ();
181    sc_ufixed& operator -- ();
182
183};
184
185
186// ----------------------------------------------------------------------------
187//  TEMPLATE CLASS : sc_ufixed_fast
188//
189//  "Constrained" unsigned fixed-point class; limited precision.
190// ----------------------------------------------------------------------------
191
192template <int W, int I,
193	  sc_q_mode Q = SC_DEFAULT_Q_MODE_,
194	  sc_o_mode O = SC_DEFAULT_O_MODE_, int N = SC_DEFAULT_N_BITS_>
195class sc_ufixed_fast : public sc_ufix_fast
196{
197
198public:
199
200    // constructors
201
202    explicit sc_ufixed_fast( sc_fxnum_fast_observer* = 0 );
203    explicit sc_ufixed_fast( const sc_fxcast_switch&,
204			     sc_fxnum_fast_observer* = 0 );
205
206#define DECL_CTORS_T_A(tp)                                                    \
207             sc_ufixed_fast( tp, sc_fxnum_fast_observer* = 0 );               \
208             sc_ufixed_fast( tp, const sc_fxcast_switch&,                     \
209                             sc_fxnum_fast_observer* = 0 );
210
211#define DECL_CTORS_T_B(tp)                                                    \
212    explicit sc_ufixed_fast( tp, sc_fxnum_fast_observer* = 0 );               \
213             sc_ufixed_fast( tp, const sc_fxcast_switch&,                     \
214			     sc_fxnum_fast_observer* = 0 );
215
216    DECL_CTORS_T_A(int)
217    DECL_CTORS_T_A(unsigned int)
218    DECL_CTORS_T_A(long)
219    DECL_CTORS_T_A(unsigned long)
220    DECL_CTORS_T_A(float)
221    DECL_CTORS_T_A(double)
222    DECL_CTORS_T_A(const char*)
223    DECL_CTORS_T_A(const sc_fxval&)
224    DECL_CTORS_T_A(const sc_fxval_fast&)
225    DECL_CTORS_T_A(const sc_fxnum&)
226    DECL_CTORS_T_A(const sc_fxnum_fast&)
227#ifndef SC_FX_EXCLUDE_OTHER
228    DECL_CTORS_T_B(int64)
229    DECL_CTORS_T_B(uint64)
230    DECL_CTORS_T_B(const sc_int_base&)
231    DECL_CTORS_T_B(const sc_uint_base&)
232    DECL_CTORS_T_B(const sc_signed&)
233    DECL_CTORS_T_B(const sc_unsigned&)
234#endif
235
236#undef DECL_CTORS_T_A
237#undef DECL_CTORS_T_B
238
239    // copy constructor
240
241    sc_ufixed_fast( const sc_ufixed_fast<W,I,Q,O,N>& );
242
243
244    // assignment operators
245
246    sc_ufixed_fast& operator = ( const sc_ufixed_fast<W,I,Q,O,N>& );
247
248#define DECL_ASN_OP_T(op,tp)                                                  \
249    sc_ufixed_fast& operator op ( tp );
250
251#ifndef SC_FX_EXCLUDE_OTHER
252#define DECL_ASN_OP_OTHER(op)                                                 \
253    DECL_ASN_OP_T(op,int64)                                                   \
254    DECL_ASN_OP_T(op,uint64)                                                  \
255    DECL_ASN_OP_T(op,const sc_int_base&)                                      \
256    DECL_ASN_OP_T(op,const sc_uint_base&)                                     \
257    DECL_ASN_OP_T(op,const sc_signed&)                                        \
258    DECL_ASN_OP_T(op,const sc_unsigned&)
259#else
260#define DECL_ASN_OP_OTHER(op)
261#endif
262
263#define DECL_ASN_OP(op)                                                       \
264    DECL_ASN_OP_T(op,int)                                                     \
265    DECL_ASN_OP_T(op,unsigned int)                                            \
266    DECL_ASN_OP_T(op,long)                                                    \
267    DECL_ASN_OP_T(op,unsigned long)                                           \
268    DECL_ASN_OP_T(op,float)                                                  \
269    DECL_ASN_OP_T(op,double)                                                  \
270    DECL_ASN_OP_T(op,const char*)                                             \
271    DECL_ASN_OP_T(op,const sc_fxval&)                                         \
272    DECL_ASN_OP_T(op,const sc_fxval_fast&)                                    \
273    DECL_ASN_OP_T(op,const sc_fxnum&)                                         \
274    DECL_ASN_OP_T(op,const sc_fxnum_fast&)                                    \
275    DECL_ASN_OP_OTHER(op)
276
277    DECL_ASN_OP(=)
278
279    DECL_ASN_OP(*=)
280    DECL_ASN_OP(/=)
281    DECL_ASN_OP(+=)
282    DECL_ASN_OP(-=)
283
284    DECL_ASN_OP_T(<<=,int)
285    DECL_ASN_OP_T(>>=,int)
286
287    DECL_ASN_OP_T(&=,const sc_ufix&)
288    DECL_ASN_OP_T(&=,const sc_ufix_fast&)
289    DECL_ASN_OP_T(|=,const sc_ufix&)
290    DECL_ASN_OP_T(|=,const sc_ufix_fast&)
291    DECL_ASN_OP_T(^=,const sc_ufix&)
292    DECL_ASN_OP_T(^=,const sc_ufix_fast&)
293
294#undef DECL_ASN_OP_T
295#undef DECL_ASN_OP_OTHER
296#undef DECL_ASN_OP
297
298
299    // auto-increment and auto-decrement
300
301    const sc_fxval_fast operator ++ ( int );
302    const sc_fxval_fast operator -- ( int );
303
304    sc_ufixed_fast& operator ++ ();
305    sc_ufixed_fast& operator -- ();
306
307};
308
309
310// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
311
312// ----------------------------------------------------------------------------
313//  TEMPLATE CLASS : sc_ufixed
314//
315//  "Constrained" unsigned fixed-point class; arbitrary precision.
316// ----------------------------------------------------------------------------
317
318template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
319inline
320sc_ufixed<W,I,Q,O,N>::sc_ufixed( sc_fxnum_observer* observer_ )
321: sc_ufix( W, I, Q, O, N, observer_ )
322{}
323
324template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
325inline
326sc_ufixed<W,I,Q,O,N>::sc_ufixed( const sc_fxcast_switch& cast_sw,
327				 sc_fxnum_observer* observer_ )
328: sc_ufix( W, I, Q, O, N, cast_sw, observer_ )
329{}
330
331#define DEFN_CTORS_T(tp)                                                      \
332template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
333inline                                                                        \
334sc_ufixed<W,I,Q,O,N>::sc_ufixed( tp a,                                        \
335				 sc_fxnum_observer* observer_ )               \
336: sc_ufix( a, W, I, Q, O, N, observer_ )                                      \
337{}                                                                            \
338                                                                              \
339template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
340inline                                                                        \
341sc_ufixed<W,I,Q,O,N>::sc_ufixed( tp a,                                        \
342				 const sc_fxcast_switch& cast_sw,             \
343				 sc_fxnum_observer* observer_ )               \
344: sc_ufix( a, W, I, Q, O, N, cast_sw, observer_ )                             \
345{}
346
347DEFN_CTORS_T(int)
348DEFN_CTORS_T(unsigned int)
349DEFN_CTORS_T(long)
350DEFN_CTORS_T(unsigned long)
351DEFN_CTORS_T(float)
352DEFN_CTORS_T(double)
353DEFN_CTORS_T(const char*)
354DEFN_CTORS_T(const sc_fxval&)
355DEFN_CTORS_T(const sc_fxval_fast&)
356DEFN_CTORS_T(const sc_fxnum&)
357DEFN_CTORS_T(const sc_fxnum_fast&)
358#ifndef SC_FX_EXCLUDE_OTHER
359DEFN_CTORS_T(int64)
360DEFN_CTORS_T(uint64)
361DEFN_CTORS_T(const sc_int_base&)
362DEFN_CTORS_T(const sc_uint_base&)
363DEFN_CTORS_T(const sc_signed&)
364DEFN_CTORS_T(const sc_unsigned&)
365#endif
366
367#undef DEFN_CTORS_T
368
369// copy constructor
370
371template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
372inline
373sc_ufixed<W,I,Q,O,N>::sc_ufixed( const sc_ufixed<W,I,Q,O,N>& a )
374: sc_ufix( a, W, I, Q, O, N )
375{}
376
377
378// assignment operators
379
380template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
381inline
382sc_ufixed<W,I,Q,O,N>&
383sc_ufixed<W,I,Q,O,N>::operator = ( const sc_ufixed<W,I,Q,O,N>& a )
384{
385    sc_ufix::operator = ( a );
386    return *this;
387}
388
389#define DEFN_ASN_OP_T(op,tp)                                                  \
390template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
391inline                                                                        \
392sc_ufixed<W,I,Q,O,N>&                                                         \
393sc_ufixed<W,I,Q,O,N>::operator op ( tp a )                                    \
394{                                                                             \
395    sc_ufix::operator op ( a );                                               \
396    return *this;                                                             \
397}
398
399#ifndef SC_FX_EXCLUDE_OTHER
400#define DEFN_ASN_OP_OTHER(op)                                                 \
401DEFN_ASN_OP_T(op,int64)                                                       \
402DEFN_ASN_OP_T(op,uint64)                                                      \
403DEFN_ASN_OP_T(op,const sc_int_base&)                                          \
404DEFN_ASN_OP_T(op,const sc_uint_base&)                                         \
405DEFN_ASN_OP_T(op,const sc_signed&)                                            \
406DEFN_ASN_OP_T(op,const sc_unsigned&)
407#else
408#define DEFN_ASN_OP_OTHER(op)
409#endif
410
411#define DEFN_ASN_OP(op)                                                       \
412DEFN_ASN_OP_T(op,int)                                                         \
413DEFN_ASN_OP_T(op,unsigned int)                                                \
414DEFN_ASN_OP_T(op,long)                                                        \
415DEFN_ASN_OP_T(op,unsigned long)                                               \
416DEFN_ASN_OP_T(op,float)                                                      \
417DEFN_ASN_OP_T(op,double)                                                      \
418DEFN_ASN_OP_T(op,const char*)                                                 \
419DEFN_ASN_OP_T(op,const sc_fxval&)                                             \
420DEFN_ASN_OP_T(op,const sc_fxval_fast&)                                        \
421DEFN_ASN_OP_T(op,const sc_fxnum&)                                             \
422DEFN_ASN_OP_T(op,const sc_fxnum_fast&)                                        \
423DEFN_ASN_OP_OTHER(op)
424
425DEFN_ASN_OP(=)
426
427DEFN_ASN_OP(*=)
428DEFN_ASN_OP(/=)
429DEFN_ASN_OP(+=)
430DEFN_ASN_OP(-=)
431
432DEFN_ASN_OP_T(<<=,int)
433DEFN_ASN_OP_T(>>=,int)
434
435DEFN_ASN_OP_T(&=,const sc_ufix&)
436DEFN_ASN_OP_T(&=,const sc_ufix_fast&)
437DEFN_ASN_OP_T(|=,const sc_ufix&)
438DEFN_ASN_OP_T(|=,const sc_ufix_fast&)
439DEFN_ASN_OP_T(^=,const sc_ufix&)
440DEFN_ASN_OP_T(^=,const sc_ufix_fast&)
441
442#undef DEFN_ASN_OP_T
443#undef DEFN_ASN_OP_OTHER
444#undef DEFN_ASN_OP
445
446
447// auto-increment and auto-decrement
448
449template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
450inline
451const sc_fxval
452sc_ufixed<W,I,Q,O,N>::operator ++ ( int )
453{
454    return sc_fxval( sc_ufix::operator ++ ( 0 ) );
455}
456
457template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
458inline
459const sc_fxval
460sc_ufixed<W,I,Q,O,N>::operator -- ( int )
461{
462    return sc_fxval( sc_ufix::operator -- ( 0 ) );
463}
464
465template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
466inline
467sc_ufixed<W,I,Q,O,N>&
468sc_ufixed<W,I,Q,O,N>::operator ++ ()
469{
470    sc_ufix::operator ++ ();
471    return *this;
472}
473
474template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
475inline
476sc_ufixed<W,I,Q,O,N>&
477sc_ufixed<W,I,Q,O,N>::operator -- ()
478{
479    sc_ufix::operator -- ();
480    return *this;
481}
482
483
484// ----------------------------------------------------------------------------
485//  TEMPLATE CLASS : sc_ufixed_fast
486//
487//  "Constrained" unsigned fixed-point class; limited precision.
488// ----------------------------------------------------------------------------
489
490template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
491inline
492sc_ufixed_fast<W,I,Q,O,N>::sc_ufixed_fast( sc_fxnum_fast_observer* observer_ )
493: sc_ufix_fast( W, I, Q, O, N, observer_ )
494{}
495
496template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
497inline
498sc_ufixed_fast<W,I,Q,O,N>::sc_ufixed_fast( const sc_fxcast_switch& cast_sw,
499					   sc_fxnum_fast_observer* observer_ )
500: sc_ufix_fast( W, I, Q, O, N, cast_sw, observer_ )
501{}
502
503#define DEFN_CTORS_T(tp)                                                      \
504template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
505inline                                                                        \
506sc_ufixed_fast<W,I,Q,O,N>::sc_ufixed_fast( tp a,                              \
507					   sc_fxnum_fast_observer* observer_ )\
508: sc_ufix_fast( a, W, I, Q, O, N, observer_ )                                 \
509{}                                                                            \
510                                                                              \
511template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
512inline                                                                        \
513sc_ufixed_fast<W,I,Q,O,N>::sc_ufixed_fast( tp a,                              \
514					   const sc_fxcast_switch& cast_sw,   \
515					   sc_fxnum_fast_observer* observer_ )\
516: sc_ufix_fast( a, W, I, Q, O, N, cast_sw, observer_ )                        \
517{}
518
519DEFN_CTORS_T(int)
520DEFN_CTORS_T(unsigned int)
521DEFN_CTORS_T(long)
522DEFN_CTORS_T(unsigned long)
523DEFN_CTORS_T(float)
524DEFN_CTORS_T(double)
525DEFN_CTORS_T(const char*)
526DEFN_CTORS_T(const sc_fxval&)
527DEFN_CTORS_T(const sc_fxval_fast&)
528DEFN_CTORS_T(const sc_fxnum&)
529DEFN_CTORS_T(const sc_fxnum_fast&)
530#ifndef SC_FX_EXCLUDE_OTHER
531DEFN_CTORS_T(int64)
532DEFN_CTORS_T(uint64)
533DEFN_CTORS_T(const sc_int_base&)
534DEFN_CTORS_T(const sc_uint_base&)
535DEFN_CTORS_T(const sc_signed&)
536DEFN_CTORS_T(const sc_unsigned&)
537#endif
538
539#undef DEFN_CTORS_T
540
541// copy constructor
542
543template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
544inline
545sc_ufixed_fast<W,I,Q,O,N>::sc_ufixed_fast( const sc_ufixed_fast<W,I,Q,O,N>& a )
546: sc_ufix_fast( a, W, I, Q, O, N )
547{}
548
549
550// assignment operators
551
552template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
553inline
554sc_ufixed_fast<W,I,Q,O,N>&
555sc_ufixed_fast<W,I,Q,O,N>::operator = ( const sc_ufixed_fast<W,I,Q,O,N>& a )
556{
557    sc_ufix_fast::operator = ( a );
558    return *this;
559}
560
561#define DEFN_ASN_OP_T(op,tp)                                                  \
562template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>                       \
563inline                                                                        \
564sc_ufixed_fast<W,I,Q,O,N>&                                                    \
565sc_ufixed_fast<W,I,Q,O,N>::operator op ( tp a )                               \
566{                                                                             \
567    sc_ufix_fast::operator op ( a );                                          \
568    return *this;                                                             \
569}
570
571#ifndef SC_FX_EXCLUDE_OTHER
572#define DEFN_ASN_OP_OTHER(op)                                                 \
573DEFN_ASN_OP_T(op,int64)                                                       \
574DEFN_ASN_OP_T(op,uint64)                                                      \
575DEFN_ASN_OP_T(op,const sc_int_base&)                                          \
576DEFN_ASN_OP_T(op,const sc_uint_base&)                                         \
577DEFN_ASN_OP_T(op,const sc_signed&)                                            \
578DEFN_ASN_OP_T(op,const sc_unsigned&)
579#else
580#define DEFN_ASN_OP_OTHER(op)
581#endif
582
583#define DEFN_ASN_OP(op)                                                       \
584DEFN_ASN_OP_T(op,int)                                                         \
585DEFN_ASN_OP_T(op,unsigned int)                                                \
586DEFN_ASN_OP_T(op,long)                                                        \
587DEFN_ASN_OP_T(op,unsigned long)                                               \
588DEFN_ASN_OP_T(op,float)                                                      \
589DEFN_ASN_OP_T(op,double)                                                      \
590DEFN_ASN_OP_T(op,const char*)                                                 \
591DEFN_ASN_OP_T(op,const sc_fxval&)                                             \
592DEFN_ASN_OP_T(op,const sc_fxval_fast&)                                        \
593DEFN_ASN_OP_T(op,const sc_fxnum&)                                             \
594DEFN_ASN_OP_T(op,const sc_fxnum_fast&)                                        \
595DEFN_ASN_OP_OTHER(op)
596
597DEFN_ASN_OP(=)
598
599DEFN_ASN_OP(*=)
600DEFN_ASN_OP(/=)
601DEFN_ASN_OP(+=)
602DEFN_ASN_OP(-=)
603
604DEFN_ASN_OP_T(<<=,int)
605DEFN_ASN_OP_T(>>=,int)
606
607DEFN_ASN_OP_T(&=,const sc_ufix&)
608DEFN_ASN_OP_T(&=,const sc_ufix_fast&)
609DEFN_ASN_OP_T(|=,const sc_ufix&)
610DEFN_ASN_OP_T(|=,const sc_ufix_fast&)
611DEFN_ASN_OP_T(^=,const sc_ufix&)
612DEFN_ASN_OP_T(^=,const sc_ufix_fast&)
613
614#undef DEFN_ASN_OP_T
615#undef DEFN_ASN_OP_OTHER
616#undef DEFN_ASN_OP
617
618
619// auto-increment and auto-decrement
620
621template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
622inline
623const sc_fxval_fast
624sc_ufixed_fast<W,I,Q,O,N>::operator ++ ( int )
625{
626    return sc_fxval_fast( sc_ufix_fast::operator ++ ( 0 ) );
627}
628
629template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
630inline
631const sc_fxval_fast
632sc_ufixed_fast<W,I,Q,O,N>::operator -- ( int )
633{
634    return sc_fxval_fast( sc_ufix_fast::operator -- ( 0 ) );
635}
636
637template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
638inline
639sc_ufixed_fast<W,I,Q,O,N>&
640sc_ufixed_fast<W,I,Q,O,N>::operator ++ ()
641{
642    sc_ufix_fast::operator ++ ();
643    return *this;
644}
645
646template<int W, int I, sc_q_mode Q, sc_o_mode O, int N>
647inline
648sc_ufixed_fast<W,I,Q,O,N>&
649sc_ufixed_fast<W,I,Q,O,N>::operator -- ()
650{
651    sc_ufix_fast::operator -- ();
652    return *this;
653}
654
655} // namespace sc_dt
656
657
658#endif
659
660// Taf!
661