SystemC  Recoding Infrastructure for SystemC v0.6.3 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
sc_fix.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  sc_fix.h -
21 
22  Original Author: Martin Janssen, Synopsys, Inc.
23 
24  *****************************************************************************/
25 
26 /*****************************************************************************
27 
28  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
29  changes you are making here.
30 
31  Name, Affiliation, Date:
32  Description of Modification:
33 
34  *****************************************************************************/
35 
36 // $Log: sc_fix.h,v $
37 // Revision 1.2 2011/01/19 18:57:40 acg
38 // Andy Goodrich: changes for IEEE_1666_2011.
39 //
40 // Revision 1.1.1.1 2006/12/15 20:20:04 acg
41 // SystemC 2.3
42 //
43 // Revision 1.3 2006/01/13 18:53:57 acg
44 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
45 // the source.
46 //
47 
48 #ifndef SC_FIX_H
49 #define SC_FIX_H
50 
51 
53 
54 
55 namespace sc_dt
56 {
57 
58 // classes defined in this module
59 class sc_fix;
60 class sc_fix_fast;
61 
62 
63 // ----------------------------------------------------------------------------
64 // CLASS : sc_fix
65 //
66 // "Unconstrained" signed fixed-point class; arbitrary precision.
67 // ----------------------------------------------------------------------------
68 
69 class sc_fix : public sc_fxnum
70 {
71 
72 public:
73 
74  // constructors
75 
76  explicit sc_fix( sc_fxnum_observer* = 0 );
77  sc_fix( int, int,
78  sc_fxnum_observer* = 0 );
80  sc_fxnum_observer* = 0 );
81  sc_fix( sc_q_mode, sc_o_mode, int,
82  sc_fxnum_observer* = 0 );
83  sc_fix( int, int, sc_q_mode, sc_o_mode,
84  sc_fxnum_observer* = 0 );
85  sc_fix( int, int, sc_q_mode, sc_o_mode, int,
86  sc_fxnum_observer* = 0 );
87  explicit sc_fix( const sc_fxcast_switch&,
88  sc_fxnum_observer* = 0 );
89  sc_fix( int, int,
90  const sc_fxcast_switch&,
91  sc_fxnum_observer* = 0 );
93  const sc_fxcast_switch&,
94  sc_fxnum_observer* = 0 );
95  sc_fix( sc_q_mode, sc_o_mode, int,
96  const sc_fxcast_switch&,
97  sc_fxnum_observer* = 0 );
98  sc_fix( int, int, sc_q_mode, sc_o_mode,
99  const sc_fxcast_switch&,
100  sc_fxnum_observer* = 0 );
101  sc_fix( int, int, sc_q_mode, sc_o_mode, int,
102  const sc_fxcast_switch&,
103  sc_fxnum_observer* = 0 );
104  explicit sc_fix( const sc_fxtype_params&,
105  sc_fxnum_observer* = 0 );
106  sc_fix( const sc_fxtype_params&,
107  const sc_fxcast_switch&,
108  sc_fxnum_observer* = 0 );
109 
110 #define DECL_CTORS_T(tp) \
111  sc_fix( tp, \
112  int, int, \
113  sc_fxnum_observer* = 0 ); \
114  sc_fix( tp, \
115  sc_q_mode, sc_o_mode, \
116  sc_fxnum_observer* = 0 ); \
117  sc_fix( tp, \
118  sc_q_mode, sc_o_mode, int, \
119  sc_fxnum_observer* = 0 ); \
120  sc_fix( tp, \
121  int, int, sc_q_mode, sc_o_mode, \
122  sc_fxnum_observer* = 0 ); \
123  sc_fix( tp, \
124  int, int, sc_q_mode, sc_o_mode, int, \
125  sc_fxnum_observer* = 0 ); \
126  sc_fix( tp, \
127  const sc_fxcast_switch&, \
128  sc_fxnum_observer* = 0 ); \
129  sc_fix( tp, \
130  int, int, \
131  const sc_fxcast_switch&, \
132  sc_fxnum_observer* = 0 ); \
133  sc_fix( tp, \
134  sc_q_mode, sc_o_mode, \
135  const sc_fxcast_switch&, \
136  sc_fxnum_observer* = 0 ); \
137  sc_fix( tp, \
138  sc_q_mode, sc_o_mode, int, \
139  const sc_fxcast_switch&, \
140  sc_fxnum_observer* = 0 ); \
141  sc_fix( tp, \
142  int, int, sc_q_mode, sc_o_mode, \
143  const sc_fxcast_switch&, \
144  sc_fxnum_observer* = 0 ); \
145  sc_fix( tp, \
146  int, int, sc_q_mode, sc_o_mode, int, \
147  const sc_fxcast_switch&, \
148  sc_fxnum_observer* = 0 ); \
149  sc_fix( tp, \
150  const sc_fxtype_params&, \
151  sc_fxnum_observer* = 0 ); \
152  sc_fix( tp, \
153  const sc_fxtype_params&, \
154  const sc_fxcast_switch&, \
155  sc_fxnum_observer* = 0 );
156 
157 #define DECL_CTORS_T_A(tp) \
158  sc_fix( tp, \
159  sc_fxnum_observer* = 0 ); \
160  DECL_CTORS_T(tp)
161 
162 #define DECL_CTORS_T_B(tp) \
163  explicit sc_fix( tp, \
164  sc_fxnum_observer* = 0 ); \
165  DECL_CTORS_T(tp)
166 
167  DECL_CTORS_T_A(int)
168  DECL_CTORS_T_A(unsigned int)
169  DECL_CTORS_T_A(long)
170  DECL_CTORS_T_A(unsigned long)
171  DECL_CTORS_T_A(float)
172  DECL_CTORS_T_A(double)
173  DECL_CTORS_T_A(const char*)
174  DECL_CTORS_T_A(const sc_fxval&)
176  DECL_CTORS_T_A(const sc_fxnum&)
178 #ifndef SC_FX_EXCLUDE_OTHER
183  DECL_CTORS_T_B(const sc_signed&)
185 #endif
186 
187 #undef DECL_CTORS_T
188 #undef DECL_CTORS_T_A
189 #undef DECL_CTORS_T_B
190 
191  // copy constructor
192 
193  sc_fix( const sc_fix& );
194 
195 
196  // unary bitwise operators
197 
198  const sc_fix operator ~ () const;
199 
200 
201  // unary bitwise functions
202 
203  friend void b_not( sc_fix&, const sc_fix& );
204 
205 
206  // binary bitwise operators
207 
208  friend const sc_fix operator & ( const sc_fix&, const sc_fix& );
209  friend const sc_fix operator & ( const sc_fix&, const sc_fix_fast& );
210  friend const sc_fix operator & ( const sc_fix_fast&, const sc_fix& );
211  friend const sc_fix operator | ( const sc_fix&, const sc_fix& );
212  friend const sc_fix operator | ( const sc_fix&, const sc_fix_fast& );
213  friend const sc_fix operator | ( const sc_fix_fast&, const sc_fix& );
214  friend const sc_fix operator ^ ( const sc_fix&, const sc_fix& );
215  friend const sc_fix operator ^ ( const sc_fix&, const sc_fix_fast& );
216  friend const sc_fix operator ^ ( const sc_fix_fast&, const sc_fix& );
217 
218 
219  // binary bitwise functions
220 
221  friend void b_and( sc_fix&, const sc_fix&, const sc_fix& );
222  friend void b_and( sc_fix&, const sc_fix&, const sc_fix_fast& );
223  friend void b_and( sc_fix&, const sc_fix_fast&, const sc_fix& );
224  friend void b_or ( sc_fix&, const sc_fix&, const sc_fix& );
225  friend void b_or ( sc_fix&, const sc_fix&, const sc_fix_fast& );
226  friend void b_or ( sc_fix&, const sc_fix_fast&, const sc_fix& );
227  friend void b_xor( sc_fix&, const sc_fix&, const sc_fix& );
228  friend void b_xor( sc_fix&, const sc_fix&, const sc_fix_fast& );
229  friend void b_xor( sc_fix&, const sc_fix_fast&, const sc_fix& );
230 
231 
232  // assignment operators
233 
234  sc_fix& operator = ( const sc_fix& );
235 
236 #define DECL_ASN_OP_T(op,tp) \
237  sc_fix& operator op ( tp );
238 
239 #ifndef SC_FX_EXCLUDE_OTHER
240 #define DECL_ASN_OP_OTHER(op) \
241  DECL_ASN_OP_T(op,int64) \
242  DECL_ASN_OP_T(op,uint64) \
243  DECL_ASN_OP_T(op,const sc_int_base&) \
244  DECL_ASN_OP_T(op,const sc_uint_base&) \
245  DECL_ASN_OP_T(op,const sc_signed&) \
246  DECL_ASN_OP_T(op,const sc_unsigned&)
247 #else
248 #define DECL_ASN_OP_OTHER(op)
249 #endif
250 
251 #define DECL_ASN_OP(op) \
252  DECL_ASN_OP_T(op,int) \
253  DECL_ASN_OP_T(op,unsigned int) \
254  DECL_ASN_OP_T(op,long) \
255  DECL_ASN_OP_T(op,unsigned long) \
256  DECL_ASN_OP_T(op,float) \
257  DECL_ASN_OP_T(op,double) \
258  DECL_ASN_OP_T(op,const char*) \
259  DECL_ASN_OP_T(op,const sc_fxval&) \
260  DECL_ASN_OP_T(op,const sc_fxval_fast&) \
261  DECL_ASN_OP_T(op,const sc_fxnum&) \
262  DECL_ASN_OP_T(op,const sc_fxnum_fast&) \
263  DECL_ASN_OP_OTHER(op)
264 
265  DECL_ASN_OP(=)
266 
267  DECL_ASN_OP(*=)
268  DECL_ASN_OP(/=)
269  DECL_ASN_OP(+=)
270  DECL_ASN_OP(-=)
271 
272  DECL_ASN_OP_T(<<=,int)
273  DECL_ASN_OP_T(>>=,int)
274 
275  DECL_ASN_OP_T(&=,const sc_fix&)
276  DECL_ASN_OP_T(&=,const sc_fix_fast&)
277  DECL_ASN_OP_T(|=,const sc_fix&)
278  DECL_ASN_OP_T(|=,const sc_fix_fast&)
279  DECL_ASN_OP_T(^=,const sc_fix&)
280  DECL_ASN_OP_T(^=,const sc_fix_fast&)
281 
282 #undef DECL_ASN_OP_T
283 #undef DECL_ASN_OP_OTHER
284 #undef DECL_ASN_OP
285 
286 
287  // auto-increment and auto-decrement
288 
289  const sc_fxval operator ++ ( int );
290  const sc_fxval operator -- ( int );
291 
292  sc_fix& operator ++ ();
293  sc_fix& operator -- ();
294 
295 };
296 
297 
298 // ----------------------------------------------------------------------------
299 // CLASS : sc_fix_fast
300 //
301 // "Unconstrained" signed fixed-point class; limited precision.
302 // ----------------------------------------------------------------------------
303 
305 {
306 
307 public:
308 
309  // constructors
310 
311  explicit sc_fix_fast( sc_fxnum_fast_observer* = 0 );
312  sc_fix_fast( int, int,
313  sc_fxnum_fast_observer* = 0 );
315  sc_fxnum_fast_observer* = 0 );
317  sc_fxnum_fast_observer* = 0 );
318  sc_fix_fast( int, int, sc_q_mode, sc_o_mode,
319  sc_fxnum_fast_observer* = 0 );
320  sc_fix_fast( int, int, sc_q_mode, sc_o_mode, int,
321  sc_fxnum_fast_observer* = 0 );
322  explicit sc_fix_fast( const sc_fxcast_switch&,
323  sc_fxnum_fast_observer* = 0 );
324  sc_fix_fast( int, int,
325  const sc_fxcast_switch&,
326  sc_fxnum_fast_observer* = 0 );
328  const sc_fxcast_switch&,
329  sc_fxnum_fast_observer* = 0 );
331  const sc_fxcast_switch&,
332  sc_fxnum_fast_observer* = 0 );
333  sc_fix_fast( int, int, sc_q_mode, sc_o_mode,
334  const sc_fxcast_switch&,
335  sc_fxnum_fast_observer* = 0 );
336  sc_fix_fast( int, int, sc_q_mode, sc_o_mode, int,
337  const sc_fxcast_switch&,
338  sc_fxnum_fast_observer* = 0 );
339  explicit sc_fix_fast( const sc_fxtype_params&,
340  sc_fxnum_fast_observer* = 0 );
342  const sc_fxcast_switch&,
343  sc_fxnum_fast_observer* = 0 );
344 
345 #define DECL_CTORS_T(tp) \
346  sc_fix_fast( tp, \
347  int, int, \
348  sc_fxnum_fast_observer* = 0 ); \
349  sc_fix_fast( tp, \
350  sc_q_mode, sc_o_mode, \
351  sc_fxnum_fast_observer* = 0 ); \
352  sc_fix_fast( tp, \
353  sc_q_mode, sc_o_mode, int, \
354  sc_fxnum_fast_observer* = 0 ); \
355  sc_fix_fast( tp, \
356  int, int, sc_q_mode, sc_o_mode, \
357  sc_fxnum_fast_observer* = 0 ); \
358  sc_fix_fast( tp, \
359  int, int, sc_q_mode, sc_o_mode, int, \
360  sc_fxnum_fast_observer* = 0 ); \
361  sc_fix_fast( tp, \
362  const sc_fxcast_switch&, \
363  sc_fxnum_fast_observer* = 0 ); \
364  sc_fix_fast( tp, \
365  int, int, \
366  const sc_fxcast_switch&, \
367  sc_fxnum_fast_observer* = 0 ); \
368  sc_fix_fast( tp, \
369  sc_q_mode, sc_o_mode, \
370  const sc_fxcast_switch&, \
371  sc_fxnum_fast_observer* = 0 ); \
372  sc_fix_fast( tp, \
373  sc_q_mode, sc_o_mode, int, \
374  const sc_fxcast_switch&, \
375  sc_fxnum_fast_observer* = 0 ); \
376  sc_fix_fast( tp, \
377  int, int, sc_q_mode, sc_o_mode, \
378  const sc_fxcast_switch&, \
379  sc_fxnum_fast_observer* = 0 ); \
380  sc_fix_fast( tp, \
381  int, int, sc_q_mode, sc_o_mode, int, \
382  const sc_fxcast_switch&, \
383  sc_fxnum_fast_observer* = 0 ); \
384  sc_fix_fast( tp, \
385  const sc_fxtype_params&, \
386  sc_fxnum_fast_observer* = 0 ); \
387  sc_fix_fast( tp, \
388  const sc_fxtype_params&, \
389  const sc_fxcast_switch&, \
390  sc_fxnum_fast_observer* = 0 );
391 
392 #define DECL_CTORS_T_A(tp) \
393  sc_fix_fast( tp, \
394  sc_fxnum_fast_observer* = 0 ); \
395  DECL_CTORS_T(tp)
396 
397 #define DECL_CTORS_T_B(tp) \
398  explicit sc_fix_fast( tp, \
399  sc_fxnum_fast_observer* = 0 ); \
400  DECL_CTORS_T(tp)
401 
402  DECL_CTORS_T_A(int)
403  DECL_CTORS_T_A(unsigned int)
404  DECL_CTORS_T_A(long)
405  DECL_CTORS_T_A(unsigned long)
406  DECL_CTORS_T_A(float)
407  DECL_CTORS_T_A(double)
408  DECL_CTORS_T_A(const char*)
409  DECL_CTORS_T_A(const sc_fxval&)
411  DECL_CTORS_T_A(const sc_fxnum&)
412  DECL_CTORS_T_A(const sc_fxnum_fast&)
413 #ifndef SC_FX_EXCLUDE_OTHER
416  DECL_CTORS_T_B(const sc_int_base&)
417  DECL_CTORS_T_B(const sc_uint_base&)
418  DECL_CTORS_T_B(const sc_signed&)
419  DECL_CTORS_T_B(const sc_unsigned&)
420 #endif
421 
422 #undef DECL_CTORS_T
423 #undef DECL_CTORS_T_A
424 #undef DECL_CTORS_T_B
425 
426  // copy constructor
427 
428  sc_fix_fast( const sc_fix_fast& );
429 
430 
431  // unary bitwise operators
432 
433  const sc_fix_fast operator ~ () const;
434 
435 
436  // unary bitwise functions
437 
438  friend void b_not( sc_fix_fast&, const sc_fix_fast& );
439 
440 
441  // binary bitwise operators
442 
443  friend const sc_fix_fast operator & ( const sc_fix_fast&,
444  const sc_fix_fast& );
445  friend const sc_fix_fast operator ^ ( const sc_fix_fast&,
446  const sc_fix_fast& );
447  friend const sc_fix_fast operator | ( const sc_fix_fast&,
448  const sc_fix_fast& );
449 
450 
451  // binary bitwise functions
452 
453  friend void b_and( sc_fix_fast&, const sc_fix_fast&, const sc_fix_fast& );
454  friend void b_or ( sc_fix_fast&, const sc_fix_fast&, const sc_fix_fast& );
455  friend void b_xor( sc_fix_fast&, const sc_fix_fast&, const sc_fix_fast& );
456 
457 
458  // assignment operators
459 
461 
462 #define DECL_ASN_OP_T(op,tp) \
463  sc_fix_fast& operator op ( tp );
464 
465 #ifndef SC_FX_EXCLUDE_OTHER
466 #define DECL_ASN_OP_OTHER(op) \
467  DECL_ASN_OP_T(op,int64) \
468  DECL_ASN_OP_T(op,uint64) \
469  DECL_ASN_OP_T(op,const sc_int_base&) \
470  DECL_ASN_OP_T(op,const sc_uint_base&) \
471  DECL_ASN_OP_T(op,const sc_signed&) \
472  DECL_ASN_OP_T(op,const sc_unsigned&)
473 #else
474 #define DECL_ASN_OP_OTHER(op)
475 #endif
476 
477 #define DECL_ASN_OP(op) \
478  DECL_ASN_OP_T(op,int) \
479  DECL_ASN_OP_T(op,unsigned int) \
480  DECL_ASN_OP_T(op,long) \
481  DECL_ASN_OP_T(op,unsigned long) \
482  DECL_ASN_OP_T(op,float) \
483  DECL_ASN_OP_T(op,double) \
484  DECL_ASN_OP_T(op,const char*) \
485  DECL_ASN_OP_T(op,const sc_fxval&) \
486  DECL_ASN_OP_T(op,const sc_fxval_fast&) \
487  DECL_ASN_OP_T(op,const sc_fxnum&) \
488  DECL_ASN_OP_T(op,const sc_fxnum_fast&) \
489  DECL_ASN_OP_OTHER(op)
490 
491  DECL_ASN_OP(=)
492 
493  DECL_ASN_OP(*=)
494  DECL_ASN_OP(/=)
495  DECL_ASN_OP(+=)
496  DECL_ASN_OP(-=)
497 
498  DECL_ASN_OP_T(<<=,int)
499  DECL_ASN_OP_T(>>=,int)
500 
501  DECL_ASN_OP_T(&=,const sc_fix&)
502  DECL_ASN_OP_T(&=,const sc_fix_fast&)
503  DECL_ASN_OP_T(|=,const sc_fix&)
504  DECL_ASN_OP_T(|=,const sc_fix_fast&)
505  DECL_ASN_OP_T(^=,const sc_fix&)
506  DECL_ASN_OP_T(^=,const sc_fix_fast&)
507 
508 #undef DECL_ASN_OP_T
509 #undef DECL_ASN_OP_OTHER
510 #undef DECL_ASN_OP
511 
512 
513  // auto-increment and auto-decrement
514 
515  const sc_fxval_fast operator ++ ( int );
516  const sc_fxval_fast operator -- ( int );
517 
520 
521 };
522 
523 
524 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
525 
526 // ----------------------------------------------------------------------------
527 // CLASS : sc_fix
528 //
529 // "Unconstrained" signed fixed-point class; arbitrary precision.
530 // ----------------------------------------------------------------------------
531 
532 // constructors
533 
534 inline
537  SC_TC_,
539  observer_ )
540 {}
541 
542 inline
543 sc_fix::sc_fix( int wl_, int iwl_,
544  sc_fxnum_observer* observer_ )
545 : sc_fxnum( sc_fxtype_params( wl_, iwl_ ),
546  SC_TC_,
548  observer_ )
549 {}
550 
551 inline
553  sc_fxnum_observer* observer_ )
554 : sc_fxnum( sc_fxtype_params( qm, om ),
555  SC_TC_,
557  observer_ )
558 {}
559 
560 inline
562  sc_fxnum_observer* observer_ )
563 : sc_fxnum( sc_fxtype_params( qm, om, nb ),
564  SC_TC_,
566  observer_ )
567 {}
568 
569 inline
570 sc_fix::sc_fix( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,
571  sc_fxnum_observer* observer_ )
572 : sc_fxnum( sc_fxtype_params( wl_, iwl_, qm, om ),
573  SC_TC_,
575  observer_ )
576 {}
577 
578 inline
579 sc_fix::sc_fix( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb,
580  sc_fxnum_observer* observer_ )
581 : sc_fxnum( sc_fxtype_params( wl_, iwl_, qm, om, nb ),
582  SC_TC_,
584  observer_ )
585 {}
586 
587 inline
589  sc_fxnum_observer* observer_ )
591  SC_TC_,
592  cast_sw,
593  observer_ )
594 {}
595 
596 inline
597 sc_fix::sc_fix( int wl_, int iwl_,
598  const sc_fxcast_switch& cast_sw,
599  sc_fxnum_observer* observer_ )
600 : sc_fxnum( sc_fxtype_params( wl_, iwl_ ),
601  SC_TC_,
602  cast_sw,
603  observer_ )
604 {}
605 
606 inline
608  const sc_fxcast_switch& cast_sw,
609  sc_fxnum_observer* observer_ )
610 : sc_fxnum( sc_fxtype_params( qm, om ),
611  SC_TC_,
612  cast_sw,
613  observer_ )
614 {}
615 
616 inline
618  const sc_fxcast_switch& cast_sw,
619  sc_fxnum_observer* observer_ )
620 : sc_fxnum( sc_fxtype_params( qm, om, nb ),
621  SC_TC_,
622  cast_sw,
623  observer_ )
624 {}
625 
626 inline
627 sc_fix::sc_fix( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,
628  const sc_fxcast_switch& cast_sw,
629  sc_fxnum_observer* observer_ )
630 : sc_fxnum( sc_fxtype_params( wl_, iwl_, qm, om ),
631  SC_TC_,
632  cast_sw,
633  observer_ )
634 {}
635 
636 inline
637 sc_fix::sc_fix( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb,
638  const sc_fxcast_switch& cast_sw,
639  sc_fxnum_observer* observer_ )
640 : sc_fxnum( sc_fxtype_params( wl_, iwl_, qm, om, nb ),
641  SC_TC_,
642  cast_sw,
643  observer_ )
644 {}
645 
646 inline
647 sc_fix::sc_fix( const sc_fxtype_params& type_params,
648  sc_fxnum_observer* observer_ )
649 : sc_fxnum( type_params,
650  SC_TC_,
652  observer_ )
653 {}
654 
655 inline
656 sc_fix::sc_fix( const sc_fxtype_params& type_params,
657  const sc_fxcast_switch& cast_sw,
658  sc_fxnum_observer* observer_ )
659 : sc_fxnum( type_params,
660  SC_TC_,
661  cast_sw,
662  observer_ )
663 {}
664 
665 #define DEFN_CTORS_T_A(tp) \
666 inline \
667 sc_fix::sc_fix( tp a, \
668  sc_fxnum_observer* observer_ ) \
669 : sc_fxnum( a, \
670  sc_fxtype_params(), \
671  SC_TC_, \
672  sc_fxcast_switch(), \
673  observer_ ) \
674 {} \
675  \
676 inline \
677 sc_fix::sc_fix( tp a, \
678  int wl_, int iwl_, \
679  sc_fxnum_observer* observer_ ) \
680 : sc_fxnum( a, \
681  sc_fxtype_params( wl_, iwl_ ), \
682  SC_TC_, \
683  sc_fxcast_switch(), \
684  observer_ ) \
685 {} \
686  \
687 inline \
688 sc_fix::sc_fix( tp a, \
689  sc_q_mode qm, sc_o_mode om, \
690  sc_fxnum_observer* observer_ ) \
691 : sc_fxnum( a, \
692  sc_fxtype_params( qm, om ), \
693  SC_TC_, \
694  sc_fxcast_switch(), \
695  observer_ ) \
696 {} \
697  \
698 inline \
699 sc_fix::sc_fix( tp a, \
700  sc_q_mode qm, sc_o_mode om, int nb, \
701  sc_fxnum_observer* observer_ ) \
702 : sc_fxnum( a, \
703  sc_fxtype_params( qm, om, nb ), \
704  SC_TC_, \
705  sc_fxcast_switch(), \
706  observer_ ) \
707 {} \
708  \
709 inline \
710 sc_fix::sc_fix( tp a, \
711  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
712  sc_fxnum_observer* observer_ ) \
713 : sc_fxnum( a, \
714  sc_fxtype_params( wl_, iwl_, qm, om ), \
715  SC_TC_, \
716  sc_fxcast_switch(), \
717  observer_ ) \
718 {} \
719  \
720 inline \
721 sc_fix::sc_fix( tp a, \
722  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
723  sc_fxnum_observer* observer_ ) \
724 : sc_fxnum( a, \
725  sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
726  SC_TC_, \
727  sc_fxcast_switch(), \
728  observer_ ) \
729 {} \
730  \
731 inline \
732 sc_fix::sc_fix( tp a, \
733  const sc_fxcast_switch& cast_sw, \
734  sc_fxnum_observer* observer_ ) \
735 : sc_fxnum( a, \
736  sc_fxtype_params(), \
737  SC_TC_, \
738  cast_sw, \
739  observer_ ) \
740 {} \
741  \
742 inline \
743 sc_fix::sc_fix( tp a, \
744  int wl_, int iwl_, \
745  const sc_fxcast_switch& cast_sw, \
746  sc_fxnum_observer* observer_ ) \
747 : sc_fxnum( a, \
748  sc_fxtype_params( wl_, iwl_ ), \
749  SC_TC_, \
750  cast_sw, \
751  observer_ ) \
752 {} \
753  \
754 inline \
755 sc_fix::sc_fix( tp a, \
756  sc_q_mode qm, sc_o_mode om, \
757  const sc_fxcast_switch& cast_sw, \
758  sc_fxnum_observer* observer_ ) \
759 : sc_fxnum( a, \
760  sc_fxtype_params( qm, om ), \
761  SC_TC_, \
762  cast_sw, \
763  observer_ ) \
764 {} \
765  \
766 inline \
767 sc_fix::sc_fix( tp a, \
768  sc_q_mode qm, sc_o_mode om, int nb, \
769  const sc_fxcast_switch& cast_sw, \
770  sc_fxnum_observer* observer_ ) \
771 : sc_fxnum( a, \
772  sc_fxtype_params( qm, om, nb ), \
773  SC_TC_, \
774  cast_sw, \
775  observer_ ) \
776 {} \
777  \
778 inline \
779 sc_fix::sc_fix( tp a, \
780  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
781  const sc_fxcast_switch& cast_sw, \
782  sc_fxnum_observer* observer_ ) \
783 : sc_fxnum( a, \
784  sc_fxtype_params( wl_, iwl_, qm, om ), \
785  SC_TC_, \
786  cast_sw, \
787  observer_ ) \
788 {} \
789  \
790 inline \
791 sc_fix::sc_fix( tp a, \
792  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
793  const sc_fxcast_switch& cast_sw, \
794  sc_fxnum_observer* observer_ ) \
795 : sc_fxnum( a, \
796  sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
797  SC_TC_, \
798  cast_sw, \
799  observer_ ) \
800 {} \
801  \
802 inline \
803 sc_fix::sc_fix( tp a, \
804  const sc_fxtype_params& type_params, \
805  sc_fxnum_observer* observer_ ) \
806 : sc_fxnum( a, \
807  type_params, \
808  SC_TC_, \
809  sc_fxcast_switch(), \
810  observer_ ) \
811 {} \
812  \
813 inline \
814 sc_fix::sc_fix( tp a, \
815  const sc_fxtype_params& type_params, \
816  const sc_fxcast_switch& cast_sw, \
817  sc_fxnum_observer* observer_ ) \
818 : sc_fxnum( a, \
819  type_params, \
820  SC_TC_, \
821  cast_sw, \
822  observer_ ) \
823 {}
824 
825 #define DEFN_CTORS_T_B(tp) \
826 inline \
827 sc_fix::sc_fix( tp a, \
828  sc_fxnum_observer* observer_ ) \
829 : sc_fxnum( a, \
830  a.type_params(), \
831  SC_TC_, \
832  sc_fxcast_switch(), \
833  observer_ ) \
834 {} \
835  \
836 inline \
837 sc_fix::sc_fix( tp a, \
838  int wl_, int iwl_, \
839  sc_fxnum_observer* observer_ ) \
840 : sc_fxnum( a, \
841  sc_fxtype_params( a.type_params(), wl_, iwl_ ), \
842  SC_TC_, \
843  sc_fxcast_switch(), \
844  observer_ ) \
845 {} \
846  \
847 inline \
848 sc_fix::sc_fix( tp a, \
849  sc_q_mode qm, sc_o_mode om, \
850  sc_fxnum_observer* observer_ ) \
851 : sc_fxnum( a, \
852  sc_fxtype_params( a.type_params(), qm, om ), \
853  SC_TC_, \
854  sc_fxcast_switch(), \
855  observer_ ) \
856 {} \
857  \
858 inline \
859 sc_fix::sc_fix( tp a, \
860  sc_q_mode qm, sc_o_mode om, int nb, \
861  sc_fxnum_observer* observer_ ) \
862 : sc_fxnum( a, \
863  sc_fxtype_params( a.type_params(), qm, om, nb ), \
864  SC_TC_, \
865  sc_fxcast_switch(), \
866  observer_ ) \
867 {} \
868  \
869 inline \
870 sc_fix::sc_fix( tp a, \
871  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
872  sc_fxnum_observer* observer_ ) \
873 : sc_fxnum( a, \
874  sc_fxtype_params( wl_, iwl_, qm, om ), \
875  SC_TC_, \
876  sc_fxcast_switch(), \
877  observer_ ) \
878 {} \
879  \
880 inline \
881 sc_fix::sc_fix( tp a, \
882  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
883  sc_fxnum_observer* observer_ ) \
884 : sc_fxnum( a, \
885  sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
886  SC_TC_, \
887  sc_fxcast_switch(), \
888  observer_ ) \
889 {} \
890  \
891 inline \
892 sc_fix::sc_fix( tp a, \
893  const sc_fxcast_switch& cast_sw, \
894  sc_fxnum_observer* observer_ ) \
895 : sc_fxnum( a, \
896  a.type_params(), \
897  SC_TC_, \
898  cast_sw, \
899  observer_ ) \
900 {} \
901  \
902 inline \
903 sc_fix::sc_fix( tp a, \
904  int wl_, int iwl_, \
905  const sc_fxcast_switch& cast_sw, \
906  sc_fxnum_observer* observer_ ) \
907 : sc_fxnum( a, \
908  sc_fxtype_params( a.type_params(), wl_, iwl_ ), \
909  SC_TC_, \
910  cast_sw, \
911  observer_ ) \
912 {} \
913  \
914 inline \
915 sc_fix::sc_fix( tp a, \
916  sc_q_mode qm, sc_o_mode om, \
917  const sc_fxcast_switch& cast_sw, \
918  sc_fxnum_observer* observer_ ) \
919 : sc_fxnum( a, \
920  sc_fxtype_params( a.type_params(), qm, om ), \
921  SC_TC_, \
922  cast_sw, \
923  observer_ ) \
924 {} \
925  \
926 inline \
927 sc_fix::sc_fix( tp a, \
928  sc_q_mode qm, sc_o_mode om, int nb, \
929  const sc_fxcast_switch& cast_sw, \
930  sc_fxnum_observer* observer_ ) \
931 : sc_fxnum( a, \
932  sc_fxtype_params( a.type_params(), qm, om, nb ), \
933  SC_TC_, \
934  cast_sw, \
935  observer_ ) \
936 {} \
937  \
938 inline \
939 sc_fix::sc_fix( tp a, \
940  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
941  const sc_fxcast_switch& cast_sw, \
942  sc_fxnum_observer* observer_ ) \
943 : sc_fxnum( a, \
944  sc_fxtype_params( wl_, iwl_, qm, om ), \
945  SC_TC_, \
946  cast_sw, \
947  observer_ ) \
948 {} \
949  \
950 inline \
951 sc_fix::sc_fix( tp a, \
952  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, int nb, \
953  const sc_fxcast_switch& cast_sw, \
954  sc_fxnum_observer* observer_ ) \
955 : sc_fxnum( a, \
956  sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
957  SC_TC_, \
958  cast_sw, \
959  observer_ ) \
960 {} \
961  \
962 inline \
963 sc_fix::sc_fix( tp a, \
964  const sc_fxtype_params& type_params, \
965  sc_fxnum_observer* observer_ ) \
966 : sc_fxnum( a, \
967  type_params, \
968  SC_TC_, \
969  sc_fxcast_switch(), \
970  observer_ ) \
971 {} \
972  \
973 inline \
974 sc_fix::sc_fix( tp a, \
975  const sc_fxtype_params& type_params, \
976  const sc_fxcast_switch& cast_sw, \
977  sc_fxnum_observer* observer_ ) \
978 : sc_fxnum( a, \
979  type_params, \
980  SC_TC_, \
981  cast_sw, \
982  observer_ ) \
983 {}
984 
985 DEFN_CTORS_T_A(int)
986 DEFN_CTORS_T_A(unsigned int)
987 DEFN_CTORS_T_A(long)
988 DEFN_CTORS_T_A(unsigned long)
989 DEFN_CTORS_T_A(float)
990 DEFN_CTORS_T_A(double)
991 DEFN_CTORS_T_A(const char*)
992 DEFN_CTORS_T_A(const sc_fxval&)
994 DEFN_CTORS_T_B(const sc_fxnum&)
996 #ifndef SC_FX_EXCLUDE_OTHER
1001 DEFN_CTORS_T_A(const sc_signed&)
1003 #endif
1004 
1005 #undef DEFN_CTORS_T_A
1006 #undef DEFN_CTORS_T_B
1007 
1008 // copy constructor
1009 
1010 inline
1012 : sc_fxnum( a,
1013  a.type_params(),
1014  SC_TC_,
1015  sc_fxcast_switch(),
1016  0 )
1017 {}
1018 
1019 
1020 // unary bitwise operators
1021 
1022 inline
1023 const sc_fix
1025 {
1026  SC_FXNUM_OBSERVER_READ_( *this )
1027  int iwl_c = iwl();
1028  int wl_c = wl();
1029  sc_fix c( wl_c, iwl_c );
1030  for( int i = iwl_c - wl_c; i < iwl_c; ++ i )
1031  c.set_bit( i, ! get_bit( i ) );
1032  return sc_fix( c, wl_c, iwl_c );
1033 }
1034 
1035 
1036 // unary bitwise functions
1037 
1038 inline
1039 void
1040 b_not( sc_fix& c, const sc_fix& a )
1041 {
1043  int iwl_c = c.iwl();
1044  for( int i = iwl_c - c.wl(); i < iwl_c; ++ i )
1045  c.set_bit( i, ! a.get_bit( i ) );
1046  c.cast();
1048 }
1049 
1050 
1051 // binary bitwise operators
1052 
1053 #define DEFN_BIN_OP_T(op,op2,tp1,tp2) \
1054 inline \
1055 const sc_fix \
1056 operator op ( const tp1& a, const tp2& b ) \
1057 { \
1058  a.observer_read(); \
1059  b.observer_read(); \
1060  int iwl_a = a.iwl(); \
1061  int iwl_b = b.iwl(); \
1062  int iwl_c = sc_max( iwl_a, iwl_b ); \
1063  int fwl_c = sc_max( a.wl() - iwl_a, b.wl() - iwl_b ); \
1064  sc_fix c( iwl_c + fwl_c, iwl_c ); \
1065  for( int i = -fwl_c; i < iwl_c; ++ i ) \
1066  c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \
1067  return sc_fix( c, iwl_c + fwl_c, iwl_c ); \
1068 }
1069 
1070 DEFN_BIN_OP_T(&,&&,sc_fix,sc_fix)
1071 DEFN_BIN_OP_T(&,&&,sc_fix,sc_fix_fast)
1072 DEFN_BIN_OP_T(&,&&,sc_fix_fast,sc_fix)
1073 
1074 DEFN_BIN_OP_T(|,||,sc_fix,sc_fix)
1075 DEFN_BIN_OP_T(|,||,sc_fix,sc_fix_fast)
1076 DEFN_BIN_OP_T(|,||,sc_fix_fast,sc_fix)
1077 
1078 DEFN_BIN_OP_T(^,!=,sc_fix,sc_fix)
1079 DEFN_BIN_OP_T(^,!=,sc_fix,sc_fix_fast)
1080 DEFN_BIN_OP_T(^,!=,sc_fix_fast,sc_fix)
1081 
1082 #undef DEFN_BIN_OP_T
1083 
1084 
1085 // binary bitwise functions
1086 
1087 #define DEFN_BIN_FNC_T(fnc,op2,tp1,tp2) \
1088 inline \
1089 void \
1090 fnc ( sc_fix& c, const tp1& a, const tp2& b ) \
1091 { \
1092  a.observer_read(); \
1093  b.observer_read(); \
1094  int iwl_c = c.iwl(); \
1095  for( int i = iwl_c - c.wl(); i < iwl_c; ++ i ) \
1096  c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \
1097  c.cast(); \
1098  SC_FXNUM_OBSERVER_WRITE_( c ) \
1099 }
1100 
1101 DEFN_BIN_FNC_T(b_and,&&,sc_fix,sc_fix)
1102 DEFN_BIN_FNC_T(b_and,&&,sc_fix,sc_fix_fast)
1103 DEFN_BIN_FNC_T(b_and,&&,sc_fix_fast,sc_fix)
1104 
1105 DEFN_BIN_FNC_T(b_or,||,sc_fix,sc_fix)
1106 DEFN_BIN_FNC_T(b_or,||,sc_fix,sc_fix_fast)
1107 DEFN_BIN_FNC_T(b_or,||,sc_fix_fast,sc_fix)
1108 
1109 DEFN_BIN_FNC_T(b_xor,!=,sc_fix,sc_fix)
1110 DEFN_BIN_FNC_T(b_xor,!=,sc_fix,sc_fix_fast)
1111 DEFN_BIN_FNC_T(b_xor,!=,sc_fix_fast,sc_fix)
1112 
1113 #undef DEFN_BIN_FNC_T
1114 
1115 
1116 // assignment operators
1117 
1118 inline
1119 sc_fix&
1120 sc_fix::operator = ( const sc_fix& a )
1121 {
1122  sc_fxnum::operator = ( a );
1123  return *this;
1124 }
1125 
1126 #define DEFN_ASN_OP_T(op,tp) \
1127 inline \
1128 sc_fix& \
1129 sc_fix::operator op ( tp a ) \
1130 { \
1131  sc_fxnum::operator op( a ); \
1132  return *this; \
1133 }
1134 
1135 #ifndef SC_FX_EXCLUDE_OTHER
1136 #define DEFN_ASN_OP_OTHER(op) \
1137 DEFN_ASN_OP_T(op,int64) \
1138 DEFN_ASN_OP_T(op,uint64) \
1139 DEFN_ASN_OP_T(op,const sc_int_base&) \
1140 DEFN_ASN_OP_T(op,const sc_uint_base&) \
1141 DEFN_ASN_OP_T(op,const sc_signed&) \
1142 DEFN_ASN_OP_T(op,const sc_unsigned&)
1143 #else
1144 #define DEFN_ASN_OP_OTHER(op)
1145 #endif
1146 
1147 #define DEFN_ASN_OP(op) \
1148 DEFN_ASN_OP_T(op,int) \
1149 DEFN_ASN_OP_T(op,unsigned int) \
1150 DEFN_ASN_OP_T(op,long) \
1151 DEFN_ASN_OP_T(op,unsigned long) \
1152 DEFN_ASN_OP_T(op,float) \
1153 DEFN_ASN_OP_T(op,double) \
1154 DEFN_ASN_OP_T(op,const char*) \
1155 DEFN_ASN_OP_T(op,const sc_fxval&) \
1156 DEFN_ASN_OP_T(op,const sc_fxval_fast&) \
1157 DEFN_ASN_OP_T(op,const sc_fxnum&) \
1158 DEFN_ASN_OP_T(op,const sc_fxnum_fast&) \
1159 DEFN_ASN_OP_OTHER(op)
1160 
1161 DEFN_ASN_OP(=)
1162 
1163 DEFN_ASN_OP(*=)
1164 DEFN_ASN_OP(/=)
1165 DEFN_ASN_OP(+=)
1166 DEFN_ASN_OP(-=)
1167 
1168 DEFN_ASN_OP_T(<<=,int)
1169 DEFN_ASN_OP_T(>>=,int)
1170 
1171 #undef DEFN_ASN_OP_T
1172 #undef DEFN_ASN_OP_OTHER
1173 #undef DEFN_ASN_OP
1174 
1175 
1176 #define DEFN_ASN_OP_T(op,op2,tp) \
1177 inline \
1178 sc_fix& \
1179 sc_fix::operator op ( const tp& b ) \
1180 { \
1181  SC_FXNUM_OBSERVER_READ_( *this ) \
1182  b.observer_read(); \
1183  int iwl_c = iwl(); \
1184  for( int i = iwl_c - wl(); i < iwl_c; ++ i ) \
1185  set_bit( i, get_bit( i ) op2 b.get_bit( i ) ); \
1186  cast(); \
1187  SC_FXNUM_OBSERVER_WRITE_( *this ) \
1188  return *this; \
1189 }
1190 
1191 DEFN_ASN_OP_T(&=,&&,sc_fix)
1192 DEFN_ASN_OP_T(&=,&&,sc_fix_fast)
1193 DEFN_ASN_OP_T(|=,||,sc_fix)
1194 DEFN_ASN_OP_T(|=,||,sc_fix_fast)
1195 DEFN_ASN_OP_T(^=,!=,sc_fix)
1196 DEFN_ASN_OP_T(^=,!=,sc_fix_fast)
1197 
1198 #undef DEFN_ASN_OP_T
1199 
1200 
1201 // auto-increment and auto-decrement
1202 
1203 inline
1204 const sc_fxval
1206 {
1207  return sc_fxval( sc_fxnum::operator ++ ( 0 ) );
1208 }
1209 
1210 inline
1211 const sc_fxval
1213 {
1214  return sc_fxval( sc_fxnum::operator -- ( 0 ) );
1215 }
1216 
1217 inline
1218 sc_fix&
1220 {
1222  return *this;
1223 }
1224 
1225 inline
1226 sc_fix&
1228 {
1230  return *this;
1231 }
1232 
1233 
1234 // ----------------------------------------------------------------------------
1235 // CLASS : sc_fix_fast
1236 //
1237 // "Unconstrained" signed fixed-point class; limited precision.
1238 // ----------------------------------------------------------------------------
1239 
1240 // constructors
1241 
1242 inline
1245  SC_TC_,
1246  sc_fxcast_switch(),
1247  observer_ )
1248 {}
1249 
1250 inline
1251 sc_fix_fast::sc_fix_fast( int wl_, int iwl_,
1252  sc_fxnum_fast_observer* observer_ )
1253 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_ ),
1254  SC_TC_,
1255  sc_fxcast_switch(),
1256  observer_ )
1257 {}
1258 
1259 inline
1261  sc_fxnum_fast_observer* observer_ )
1262 : sc_fxnum_fast( sc_fxtype_params( qm, om ),
1263  SC_TC_,
1264  sc_fxcast_switch(),
1265  observer_ )
1266 {}
1267 
1268 inline
1270  sc_fxnum_fast_observer* observer_ )
1271 : sc_fxnum_fast( sc_fxtype_params( qm, om, nb ),
1272  SC_TC_,
1273  sc_fxcast_switch(),
1274  observer_ )
1275 {}
1276 
1277 inline
1278 sc_fix_fast::sc_fix_fast( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,
1279  sc_fxnum_fast_observer* observer_ )
1280 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_, qm, om ),
1281  SC_TC_,
1282  sc_fxcast_switch(),
1283  observer_ )
1284 {}
1285 
1286 inline
1287 sc_fix_fast::sc_fix_fast( int wl_, int iwl_,
1288  sc_q_mode qm, sc_o_mode om, int nb,
1289  sc_fxnum_fast_observer* observer_ )
1290 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_, qm, om, nb ),
1291  SC_TC_,
1292  sc_fxcast_switch(),
1293  observer_ )
1294 {}
1295 
1296 inline
1298  sc_fxnum_fast_observer* observer_ )
1300  SC_TC_,
1301  cast_sw,
1302  observer_ )
1303 {}
1304 
1305 inline
1306 sc_fix_fast::sc_fix_fast( int wl_, int iwl_,
1307  const sc_fxcast_switch& cast_sw,
1308  sc_fxnum_fast_observer* observer_ )
1309 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_ ),
1310  SC_TC_,
1311  cast_sw,
1312  observer_ )
1313 {}
1314 
1315 inline
1317  const sc_fxcast_switch& cast_sw,
1318  sc_fxnum_fast_observer* observer_ )
1319 : sc_fxnum_fast( sc_fxtype_params( qm, om ),
1320  SC_TC_,
1321  cast_sw,
1322  observer_ )
1323 {}
1324 
1325 inline
1327  const sc_fxcast_switch& cast_sw,
1328  sc_fxnum_fast_observer* observer_ )
1329 : sc_fxnum_fast( sc_fxtype_params( qm, om, nb ),
1330  SC_TC_,
1331  cast_sw,
1332  observer_ )
1333 {}
1334 
1335 inline
1336 sc_fix_fast::sc_fix_fast( int wl_, int iwl_, sc_q_mode qm, sc_o_mode om,
1337  const sc_fxcast_switch& cast_sw,
1338  sc_fxnum_fast_observer* observer_ )
1339 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_, qm, om ),
1340  SC_TC_,
1341  cast_sw,
1342  observer_ )
1343 {}
1344 
1345 inline
1346 sc_fix_fast::sc_fix_fast( int wl_, int iwl_,
1347  sc_q_mode qm, sc_o_mode om, int nb,
1348  const sc_fxcast_switch& cast_sw,
1349  sc_fxnum_fast_observer* observer_ )
1350 : sc_fxnum_fast( sc_fxtype_params( wl_, iwl_, qm, om, nb ),
1351  SC_TC_,
1352  cast_sw,
1353  observer_ )
1354 {}
1355 
1356 inline
1358  sc_fxnum_fast_observer* observer_ )
1359 : sc_fxnum_fast( type_params,
1360  SC_TC_,
1361  sc_fxcast_switch(),
1362  observer_ )
1363 {}
1364 
1365 inline
1367  const sc_fxcast_switch& cast_sw,
1368  sc_fxnum_fast_observer* observer_ )
1369 : sc_fxnum_fast( type_params,
1370  SC_TC_,
1371  cast_sw,
1372  observer_ )
1373 {}
1374 
1375 #define DEFN_CTORS_T_A(tp) \
1376 inline \
1377 sc_fix_fast::sc_fix_fast( tp a, \
1378  sc_fxnum_fast_observer* observer_ ) \
1379 : sc_fxnum_fast( a, \
1380  sc_fxtype_params(), \
1381  SC_TC_, \
1382  sc_fxcast_switch(), \
1383  observer_ ) \
1384 {} \
1385  \
1386 inline \
1387 sc_fix_fast::sc_fix_fast( tp a, \
1388  int wl_, int iwl_, \
1389  sc_fxnum_fast_observer* observer_ ) \
1390 : sc_fxnum_fast( a, \
1391  sc_fxtype_params( wl_, iwl_ ), \
1392  SC_TC_, \
1393  sc_fxcast_switch(), \
1394  observer_ ) \
1395 {} \
1396  \
1397 inline \
1398 sc_fix_fast::sc_fix_fast( tp a, \
1399  sc_q_mode qm, sc_o_mode om, \
1400  sc_fxnum_fast_observer* observer_ ) \
1401 : sc_fxnum_fast( a, \
1402  sc_fxtype_params( qm, om ), \
1403  SC_TC_, \
1404  sc_fxcast_switch(), \
1405  observer_ ) \
1406 {} \
1407  \
1408 inline \
1409 sc_fix_fast::sc_fix_fast( tp a, \
1410  sc_q_mode qm, sc_o_mode om, int nb, \
1411  sc_fxnum_fast_observer* observer_ ) \
1412 : sc_fxnum_fast( a, \
1413  sc_fxtype_params( qm, om, nb ), \
1414  SC_TC_, \
1415  sc_fxcast_switch(), \
1416  observer_ ) \
1417 {} \
1418  \
1419 inline \
1420 sc_fix_fast::sc_fix_fast( tp a, \
1421  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1422  sc_fxnum_fast_observer* observer_ ) \
1423 : sc_fxnum_fast( a, \
1424  sc_fxtype_params( wl_, iwl_, qm, om ), \
1425  SC_TC_, \
1426  sc_fxcast_switch(), \
1427  observer_ ) \
1428 {} \
1429  \
1430 inline \
1431 sc_fix_fast::sc_fix_fast( tp a, \
1432  int wl_, int iwl_, \
1433  sc_q_mode qm, sc_o_mode om, int nb, \
1434  sc_fxnum_fast_observer* observer_ ) \
1435 : sc_fxnum_fast( a, \
1436  sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
1437  SC_TC_, \
1438  sc_fxcast_switch(), \
1439  observer_ ) \
1440 {} \
1441  \
1442 inline \
1443 sc_fix_fast::sc_fix_fast( tp a, \
1444  const sc_fxcast_switch& cast_sw, \
1445  sc_fxnum_fast_observer* observer_ ) \
1446 : sc_fxnum_fast( a, \
1447  sc_fxtype_params(), \
1448  SC_TC_, \
1449  cast_sw, \
1450  observer_ ) \
1451 {} \
1452  \
1453 inline \
1454 sc_fix_fast::sc_fix_fast( tp a, \
1455  int wl_, int iwl_, \
1456  const sc_fxcast_switch& cast_sw, \
1457  sc_fxnum_fast_observer* observer_ ) \
1458 : sc_fxnum_fast( a, \
1459  sc_fxtype_params( wl_, iwl_ ), \
1460  SC_TC_, \
1461  cast_sw, \
1462  observer_ ) \
1463 {} \
1464  \
1465 inline \
1466 sc_fix_fast::sc_fix_fast( tp a, \
1467  sc_q_mode qm, sc_o_mode om, \
1468  const sc_fxcast_switch& cast_sw, \
1469  sc_fxnum_fast_observer* observer_ ) \
1470 : sc_fxnum_fast( a, \
1471  sc_fxtype_params( qm, om ), \
1472  SC_TC_, \
1473  cast_sw, \
1474  observer_ ) \
1475 {} \
1476  \
1477 inline \
1478 sc_fix_fast::sc_fix_fast( tp a, \
1479  sc_q_mode qm, sc_o_mode om, int nb, \
1480  const sc_fxcast_switch& cast_sw, \
1481  sc_fxnum_fast_observer* observer_ ) \
1482 : sc_fxnum_fast( a, \
1483  sc_fxtype_params( qm, om, nb ), \
1484  SC_TC_, \
1485  cast_sw, \
1486  observer_ ) \
1487 {} \
1488  \
1489 inline \
1490 sc_fix_fast::sc_fix_fast( tp a, \
1491  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1492  const sc_fxcast_switch& cast_sw, \
1493  sc_fxnum_fast_observer* observer_ ) \
1494 : sc_fxnum_fast( a, \
1495  sc_fxtype_params( wl_, iwl_, qm, om ), \
1496  SC_TC_, \
1497  cast_sw, \
1498  observer_ ) \
1499 {} \
1500  \
1501 inline \
1502 sc_fix_fast::sc_fix_fast( tp a, \
1503  int wl_, int iwl_, \
1504  sc_q_mode qm, sc_o_mode om, int nb, \
1505  const sc_fxcast_switch& cast_sw, \
1506  sc_fxnum_fast_observer* observer_ ) \
1507 : sc_fxnum_fast( a, \
1508  sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
1509  SC_TC_, \
1510  cast_sw, \
1511  observer_ ) \
1512 {} \
1513  \
1514 inline \
1515 sc_fix_fast::sc_fix_fast( tp a, \
1516  const sc_fxtype_params& type_params, \
1517  sc_fxnum_fast_observer* observer_ ) \
1518 : sc_fxnum_fast( a, \
1519  type_params, \
1520  SC_TC_, \
1521  sc_fxcast_switch(), \
1522  observer_ ) \
1523 {} \
1524  \
1525 inline \
1526 sc_fix_fast::sc_fix_fast( tp a, \
1527  const sc_fxtype_params& type_params, \
1528  const sc_fxcast_switch& cast_sw, \
1529  sc_fxnum_fast_observer* observer_ ) \
1530 : sc_fxnum_fast( a, \
1531  type_params, \
1532  SC_TC_, \
1533  cast_sw, \
1534  observer_ ) \
1535 {}
1536 
1537 #define DEFN_CTORS_T_B(tp) \
1538 inline \
1539 sc_fix_fast::sc_fix_fast( tp a, \
1540  sc_fxnum_fast_observer* observer_ ) \
1541 : sc_fxnum_fast( a, \
1542  a.type_params(), \
1543  SC_TC_, \
1544  sc_fxcast_switch(), \
1545  observer_ ) \
1546 {} \
1547  \
1548 inline \
1549 sc_fix_fast::sc_fix_fast( tp a, \
1550  int wl_, int iwl_, \
1551  sc_fxnum_fast_observer* observer_ ) \
1552 : sc_fxnum_fast( a, \
1553  sc_fxtype_params( a.type_params(), wl_, iwl_ ), \
1554  SC_TC_, \
1555  sc_fxcast_switch(), \
1556  observer_ ) \
1557 {} \
1558  \
1559 inline \
1560 sc_fix_fast::sc_fix_fast( tp a, \
1561  sc_q_mode qm, sc_o_mode om, \
1562  sc_fxnum_fast_observer* observer_ ) \
1563 : sc_fxnum_fast( a, \
1564  sc_fxtype_params( a.type_params(), qm, om ), \
1565  SC_TC_, \
1566  sc_fxcast_switch(), \
1567  observer_ ) \
1568 {} \
1569  \
1570 inline \
1571 sc_fix_fast::sc_fix_fast( tp a, \
1572  sc_q_mode qm, sc_o_mode om, int nb, \
1573  sc_fxnum_fast_observer* observer_ ) \
1574 : sc_fxnum_fast( a, \
1575  sc_fxtype_params( a.type_params(), qm, om, nb ), \
1576  SC_TC_, \
1577  sc_fxcast_switch(), \
1578  observer_ ) \
1579 {} \
1580  \
1581 inline \
1582 sc_fix_fast::sc_fix_fast( tp a, \
1583  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1584  sc_fxnum_fast_observer* observer_ ) \
1585 : sc_fxnum_fast( a, \
1586  sc_fxtype_params( wl_, iwl_, qm, om ), \
1587  SC_TC_, \
1588  sc_fxcast_switch(), \
1589  observer_ ) \
1590 {} \
1591  \
1592 inline \
1593 sc_fix_fast::sc_fix_fast( tp a, \
1594  int wl_, int iwl_, \
1595  sc_q_mode qm, sc_o_mode om, int nb, \
1596  sc_fxnum_fast_observer* observer_ ) \
1597 : sc_fxnum_fast( a, \
1598  sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
1599  SC_TC_, \
1600  sc_fxcast_switch(), \
1601  observer_ ) \
1602 {} \
1603  \
1604 inline \
1605 sc_fix_fast::sc_fix_fast( tp a, \
1606  const sc_fxcast_switch& cast_sw, \
1607  sc_fxnum_fast_observer* observer_ ) \
1608 : sc_fxnum_fast( a, \
1609  a.type_params(), \
1610  SC_TC_, \
1611  cast_sw, \
1612  observer_ ) \
1613 {} \
1614  \
1615 inline \
1616 sc_fix_fast::sc_fix_fast( tp a, \
1617  int wl_, int iwl_, \
1618  const sc_fxcast_switch& cast_sw, \
1619  sc_fxnum_fast_observer* observer_ ) \
1620 : sc_fxnum_fast( a, \
1621  sc_fxtype_params( a.type_params(), wl_, iwl_ ), \
1622  SC_TC_, \
1623  cast_sw, \
1624  observer_ ) \
1625 {} \
1626  \
1627 inline \
1628 sc_fix_fast::sc_fix_fast( tp a, \
1629  sc_q_mode qm, sc_o_mode om, \
1630  const sc_fxcast_switch& cast_sw, \
1631  sc_fxnum_fast_observer* observer_ ) \
1632 : sc_fxnum_fast( a, \
1633  sc_fxtype_params( a.type_params(), qm, om ), \
1634  SC_TC_, \
1635  cast_sw, \
1636  observer_ ) \
1637 {} \
1638  \
1639 inline \
1640 sc_fix_fast::sc_fix_fast( tp a, \
1641  sc_q_mode qm, sc_o_mode om, int nb, \
1642  const sc_fxcast_switch& cast_sw, \
1643  sc_fxnum_fast_observer* observer_ ) \
1644 : sc_fxnum_fast( a, \
1645  sc_fxtype_params( a.type_params(), qm, om, nb ), \
1646  SC_TC_, \
1647  cast_sw, \
1648  observer_ ) \
1649 {} \
1650  \
1651 inline \
1652 sc_fix_fast::sc_fix_fast( tp a, \
1653  int wl_, int iwl_, sc_q_mode qm, sc_o_mode om, \
1654  const sc_fxcast_switch& cast_sw, \
1655  sc_fxnum_fast_observer* observer_ ) \
1656 : sc_fxnum_fast( a, \
1657  sc_fxtype_params( wl_, iwl_, qm, om ), \
1658  SC_TC_, \
1659  cast_sw, \
1660  observer_ ) \
1661 {} \
1662  \
1663 inline \
1664 sc_fix_fast::sc_fix_fast( tp a, \
1665  int wl_, int iwl_, \
1666  sc_q_mode qm, sc_o_mode om, int nb, \
1667  const sc_fxcast_switch& cast_sw, \
1668  sc_fxnum_fast_observer* observer_ ) \
1669 : sc_fxnum_fast( a, \
1670  sc_fxtype_params( wl_, iwl_, qm, om, nb ), \
1671  SC_TC_, \
1672  cast_sw, \
1673  observer_ ) \
1674 {} \
1675  \
1676 inline \
1677 sc_fix_fast::sc_fix_fast( tp a, \
1678  const sc_fxtype_params& type_params, \
1679  sc_fxnum_fast_observer* observer_ ) \
1680 : sc_fxnum_fast( a, \
1681  type_params, \
1682  SC_TC_, \
1683  sc_fxcast_switch(), \
1684  observer_ ) \
1685 {} \
1686  \
1687 inline \
1688 sc_fix_fast::sc_fix_fast( tp a, \
1689  const sc_fxtype_params& type_params, \
1690  const sc_fxcast_switch& cast_sw, \
1691  sc_fxnum_fast_observer* observer_ ) \
1692 : sc_fxnum_fast( a, \
1693  type_params, \
1694  SC_TC_, \
1695  cast_sw, \
1696  observer_ ) \
1697 {}
1698 
1699 DEFN_CTORS_T_A(int)
1700 DEFN_CTORS_T_A(unsigned int)
1701 DEFN_CTORS_T_A(long)
1702 DEFN_CTORS_T_A(unsigned long)
1703 DEFN_CTORS_T_A(float)
1704 DEFN_CTORS_T_A(double)
1705 DEFN_CTORS_T_A(const char*)
1706 DEFN_CTORS_T_A(const sc_fxval&)
1707 DEFN_CTORS_T_A(const sc_fxval_fast&)
1708 DEFN_CTORS_T_B(const sc_fxnum&)
1709 DEFN_CTORS_T_B(const sc_fxnum_fast&)
1710 #ifndef SC_FX_EXCLUDE_OTHER
1713 DEFN_CTORS_T_A(const sc_int_base&)
1714 DEFN_CTORS_T_A(const sc_uint_base&)
1715 DEFN_CTORS_T_A(const sc_signed&)
1716 DEFN_CTORS_T_A(const sc_unsigned&)
1717 #endif
1718 
1719 #undef DEFN_CTORS_T_A
1720 #undef DEFN_CTORS_T_B
1721 
1722 // copy constructor
1723 
1724 inline
1725 sc_fix_fast::sc_fix_fast( const sc_fix_fast& a )
1726 : sc_fxnum_fast( a,
1727  a.type_params(),
1728  SC_TC_,
1729  sc_fxcast_switch(),
1730  0 )
1731 {}
1732 
1733 
1734 // unary bitwise operators
1735 
1736 inline
1737 const sc_fix_fast
1739 {
1741  int iwl_c = iwl();
1742  int wl_c = wl();
1743  sc_fix_fast c( wl_c, iwl_c );
1744  for( int i = iwl_c - wl_c; i < iwl_c; ++ i )
1745  c.set_bit( i, ! get_bit( i ) );
1746  return sc_fix_fast( c, wl_c, iwl_c );
1747 }
1748 
1749 
1750 // unary bitwise functions
1751 
1752 inline
1753 void
1754 b_not( sc_fix_fast& c, const sc_fix_fast& a )
1755 {
1757  int iwl_c = c.iwl();
1758  for( int i = iwl_c - c.wl(); i < iwl_c; ++ i )
1759  c.set_bit( i, ! a.get_bit( i ) );
1760  c.cast();
1762 }
1763 
1764 
1765 // binary bitwise operators
1766 
1767 #define DEFN_BIN_OP_T(op,op2,tp1,tp2) \
1768 inline \
1769 const sc_fix_fast \
1770 operator op ( const tp1& a, const tp2& b ) \
1771 { \
1772  a.observer_read(); \
1773  b.observer_read(); \
1774  int iwl_a = a.iwl(); \
1775  int iwl_b = b.iwl(); \
1776  int iwl_c = sc_max( iwl_a, iwl_b ); \
1777  int fwl_c = sc_max( a.wl() - iwl_a, b.wl() - iwl_b ); \
1778  sc_fix_fast c( iwl_c + fwl_c, iwl_c ); \
1779  for( int i = -fwl_c; i < iwl_c; ++ i ) \
1780  c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \
1781  return sc_fix_fast( c, iwl_c + fwl_c, iwl_c ); \
1782 }
1783 
1784 DEFN_BIN_OP_T(&,&&,sc_fix_fast,sc_fix_fast)
1785 DEFN_BIN_OP_T(|,||,sc_fix_fast,sc_fix_fast)
1786 DEFN_BIN_OP_T(^,!=,sc_fix_fast,sc_fix_fast)
1787 
1788 #undef DEFN_BIN_OP_T
1789 
1790 
1791 // binary bitwise functions
1792 
1793 #define DEFN_BIN_FNC_T(fnc,op2,tp1,tp2) \
1794 inline \
1795 void \
1796 fnc ( sc_fix_fast& c, const tp1& a, const tp2& b ) \
1797 { \
1798  a.observer_read(); \
1799  b.observer_read(); \
1800  int iwl_c = c.iwl(); \
1801  for( int i = iwl_c - c.wl(); i < iwl_c; ++ i ) \
1802  c.set_bit( i, a.get_bit( i ) op2 b.get_bit( i ) ); \
1803  c.cast(); \
1804  SC_FXNUM_FAST_OBSERVER_WRITE_( c ) \
1805 }
1806 
1807 DEFN_BIN_FNC_T(b_and,&&,sc_fix_fast,sc_fix_fast)
1808 DEFN_BIN_FNC_T(b_or,||,sc_fix_fast,sc_fix_fast)
1809 DEFN_BIN_FNC_T(b_xor,!=,sc_fix_fast,sc_fix_fast)
1810 
1811 #undef DEFN_BIN_FNC_T
1812 
1813 
1814 // assignment operators
1815 
1816 inline
1817 sc_fix_fast&
1818 sc_fix_fast::operator = ( const sc_fix_fast& a )
1819 {
1820  sc_fxnum_fast::operator = ( a );
1821  return *this;
1822 }
1823 
1824 #define DEFN_ASN_OP_T(op,tp) \
1825 inline \
1826 sc_fix_fast& \
1827 sc_fix_fast::operator op ( tp a ) \
1828 { \
1829  sc_fxnum_fast::operator op( a ); \
1830  return *this; \
1831 }
1832 
1833 #ifndef SC_FX_EXCLUDE_OTHER
1834 #define DEFN_ASN_OP_OTHER(op) \
1835 DEFN_ASN_OP_T(op,int64) \
1836 DEFN_ASN_OP_T(op,uint64) \
1837 DEFN_ASN_OP_T(op,const sc_int_base&) \
1838 DEFN_ASN_OP_T(op,const sc_uint_base&) \
1839 DEFN_ASN_OP_T(op,const sc_signed&) \
1840 DEFN_ASN_OP_T(op,const sc_unsigned&)
1841 #else
1842 #define DEFN_ASN_OP_OTHER(op)
1843 #endif
1844 
1845 #define DEFN_ASN_OP(op) \
1846 DEFN_ASN_OP_T(op,int) \
1847 DEFN_ASN_OP_T(op,unsigned int) \
1848 DEFN_ASN_OP_T(op,long) \
1849 DEFN_ASN_OP_T(op,unsigned long) \
1850 DEFN_ASN_OP_T(op,float) \
1851 DEFN_ASN_OP_T(op,double) \
1852 DEFN_ASN_OP_T(op,const char*) \
1853 DEFN_ASN_OP_T(op,const sc_fxval&) \
1854 DEFN_ASN_OP_T(op,const sc_fxval_fast&) \
1855 DEFN_ASN_OP_T(op,const sc_fxnum&) \
1856 DEFN_ASN_OP_T(op,const sc_fxnum_fast&) \
1857 DEFN_ASN_OP_OTHER(op)
1858 
1859 DEFN_ASN_OP(=)
1860 
1861 DEFN_ASN_OP(*=)
1862 DEFN_ASN_OP(/=)
1863 DEFN_ASN_OP(+=)
1864 DEFN_ASN_OP(-=)
1865 
1866 DEFN_ASN_OP_T(<<=,int)
1867 DEFN_ASN_OP_T(>>=,int)
1868 
1869 #undef DEFN_ASN_OP_T
1870 #undef DEFN_ASN_OP_OTHER
1871 #undef DEFN_ASN_OP
1872 
1873 
1874 #define DEFN_ASN_OP_T(op,op2,tp) \
1875 inline \
1876 sc_fix_fast& \
1877 sc_fix_fast::operator op ( const tp& b ) \
1878 { \
1879  SC_FXNUM_FAST_OBSERVER_READ_( *this ) \
1880  b.observer_read(); \
1881  int iwl_c = iwl(); \
1882  for( int i = iwl_c - wl(); i < iwl_c; ++ i ) \
1883  set_bit( i, get_bit( i ) op2 b.get_bit( i ) ); \
1884  cast(); \
1885  SC_FXNUM_FAST_OBSERVER_WRITE_( *this ) \
1886  return *this; \
1887 }
1888 
1889 DEFN_ASN_OP_T(&=,&&,sc_fix)
1890 DEFN_ASN_OP_T(&=,&&,sc_fix_fast)
1891 DEFN_ASN_OP_T(|=,||,sc_fix)
1892 DEFN_ASN_OP_T(|=,||,sc_fix_fast)
1893 DEFN_ASN_OP_T(^=,!=,sc_fix)
1894 DEFN_ASN_OP_T(^=,!=,sc_fix_fast)
1895 
1896 #undef DEFN_ASN_OP_T
1897 
1898 
1899 // auto-increment and auto-decrement
1900 
1901 inline
1902 const sc_fxval_fast
1904 {
1905  return sc_fxval_fast( sc_fxnum_fast::operator ++ ( 0 ) );
1906 }
1907 
1908 inline
1909 const sc_fxval_fast
1911 {
1912  return sc_fxval_fast( sc_fxnum_fast::operator -- ( 0 ) );
1913 }
1914 
1915 inline
1916 sc_fix_fast&
1918 {
1920  return *this;
1921 }
1922 
1923 inline
1924 sc_fix_fast&
1926 {
1928  return *this;
1929 }
1930 
1931 } // namespace sc_dt
1932 
1933 
1934 #endif
1935 
1936 // Taf!
#define DEFN_ASN_OP_T(op, tp)
Definition: sc_bit.h:174
const sc_bit b_xor(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:350
int iwl() const
Definition: sc_fxnum.h:4694
sc_fxnum_fast & operator--()
Definition: sc_fxnum.h:4413
#define DECL_CTORS_T_A(tp)
Definition: sc_fix.h:392
const sc_bit b_not(const sc_bit &a)
Definition: sc_bit.h:316
sc_fix_fast & operator--()
Definition: sc_fix.h:1925
#define DECL_ASN_OP(op)
Definition: sc_fix.h:477
#define DEFN_BIN_FNC_T(fnc, op2, tp1, tp2)
Definition: sc_fix.h:1793
sc_fxnum & operator++()
Definition: sc_fxnum.h:3290
int64_t int64
Definition: sc_nbdefs.h:182
friend void b_not(sc_fix_fast &, const sc_fix_fast &)
Definition: sc_fix.h:1754
int wl() const
Definition: sc_fxnum.h:4687
sc_fix_fast & operator=(const sc_fix_fast &)
Definition: sc_fix.h:1818
sc_fxnum & operator--()
Definition: sc_fxnum.h:3298
friend class sc_fxval_fast
Definition: sc_fxnum.h:990
friend const sc_fix operator|(const sc_fix &, const sc_fix &)
friend void b_xor(sc_fix_fast &, const sc_fix_fast &, const sc_fix_fast &)
friend const sc_fix_fast operator^(const sc_fix_fast &, const sc_fix_fast &)
friend const sc_fix operator^(const sc_fix &, const sc_fix &)
sc_fxnum_fast & operator++()
Definition: sc_fxnum.h:4402
friend const sc_fix_fast operator|(const sc_fix_fast &, const sc_fix_fast &)
bool set_bit(int, bool)
Definition: sc_fxnum.h:3636
const sc_bit b_or(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:347
#define DECL_CTORS_T_B(tp)
Definition: sc_fix.h:397
#define DEFN_ASN_OP(op)
Definition: sc_bit.h:177
friend void b_not(sc_fix &, const sc_fix &)
Definition: sc_fix.h:1040
friend const sc_fix_fast operator&(const sc_fix_fast &, const sc_fix_fast &)
#define DECL_ASN_OP_T(op, tp)
Definition: sc_fix.h:462
int iwl() const
Definition: sc_fxnum.h:3571
bool set_bit(int, bool)
#define SC_FXNUM_OBSERVER_READ_(object)
sc_fix & operator--()
Definition: sc_fix.h:1227
#define SC_FXNUM_FAST_OBSERVER_WRITE_(object)
friend void b_and(sc_fix_fast &, const sc_fix_fast &, const sc_fix_fast &)
const sc_bit b_and(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:344
const sc_fix_fast operator~() const
Definition: sc_fix.h:1738
sc_o_mode
Definition: sc_fxdefs.h:116
friend void b_or(sc_fix_fast &, const sc_fix_fast &, const sc_fix_fast &)
int wl() const
Definition: sc_fxnum.h:3564
sc_fix & operator++()
Definition: sc_fix.h:1219
friend class sc_fxval
Definition: sc_fxnum.h:563
friend void b_or(sc_fix &, const sc_fix &, const sc_fix &)
uint64_t uint64
Definition: sc_nbdefs.h:183
#define SC_FXNUM_FAST_OBSERVER_READ_(object)
#define DEFN_CTORS_T_A(tp)
Definition: sc_fix.h:1375
friend void b_and(sc_fix &, const sc_fix &, const sc_fix &)
sc_fix & operator=(const sc_fix &)
Definition: sc_fix.h:1120
sc_fix_fast(sc_fxnum_fast_observer *=0)
Definition: sc_fix.h:1243
#define SC_FXNUM_OBSERVER_WRITE_(object)
const sc_fix operator~() const
Definition: sc_fix.h:1024
friend const sc_fix operator&(const sc_fix &, const sc_fix &)
bool get_bit(int) const
#define DEFN_CTORS_T_B(tp)
Definition: sc_fix.h:1537
sc_q_mode
Definition: sc_fxdefs.h:87
sc_fix_fast & operator++()
Definition: sc_fix.h:1917
bool get_bit(int) const
Definition: sc_fxnum.h:3626
friend void b_xor(sc_fix &, const sc_fix &, const sc_fix &)
DEFN_BIN_OP_T(/, div, int64) DEFN_BIN_OP_T(/
sc_fix(sc_fxnum_observer *=0)
Definition: sc_fix.h:535