SystemC  2.3.1
Accellera SystemC proof-of-concept library
scfx_rep.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  scfx_rep.h -
21 
22  Original Author: Robert Graulich, Synopsys, Inc.
23  Martin Janssen, Synopsys, Inc.
24 
25  *****************************************************************************/
26 
27 /*****************************************************************************
28 
29  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
30  changes you are making here.
31 
32  Name, Affiliation, Date:
33  Description of Modification:
34 
35  *****************************************************************************/
36 
37 // $Log: scfx_rep.h,v $
38 // Revision 1.6 2011/08/24 22:05:43 acg
39 // Torsten Maehne: initialization changes to remove warnings.
40 //
41 // Revision 1.5 2011/07/25 10:20:29 acg
42 // Andy Goodrich: check in aftermath of call to automake.
43 //
44 // Revision 1.4 2010/12/07 20:09:08 acg
45 // Andy Goodrich: Philipp Hartmann's constructor disambiguation fix
46 //
47 // Revision 1.3 2010/08/03 15:54:52 acg
48 // Andy Goodrich: formatting.
49 //
50 // Revision 1.2 2010/03/15 18:29:01 acg
51 // Andy Goodrich: Moved default argument specifications from friend
52 // declarations to the actual function signatures.
53 //
54 // Revision 1.1.1.1 2006/12/15 20:20:04 acg
55 // SystemC 2.3
56 //
57 // Revision 1.4 2006/03/13 20:24:27 acg
58 // Andy Goodrich: Addition of function declarations, e.g., neg_scfx_rep(),
59 // to keep gcc 4.x happy.
60 //
61 // Revision 1.3 2006/01/13 18:53:58 acg
62 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
63 // the source.
64 //
65 
66 #ifndef SCFX_REP_H
67 #define SCFX_REP_H
68 
69 
70 #include <climits>
71 
75 
76 
77 namespace sc_dt
78 {
79 
80 // classes defined in this module
81 class scfx_index;
82 class scfx_rep;
83 
84 // forward class declarations
85 class sc_bv_base;
86 class sc_signed;
87 class sc_unsigned;
88 
89 // function declarations
90 void multiply( scfx_rep&, const scfx_rep&, const scfx_rep&,
91  int max_wl = SC_DEFAULT_MAX_WL_ );
92 scfx_rep* neg_scfx_rep( const scfx_rep& );
93 scfx_rep* mult_scfx_rep( const scfx_rep&, const scfx_rep&,
94  int max_wl = SC_DEFAULT_MAX_WL_ );
95 scfx_rep* div_scfx_rep( const scfx_rep&, const scfx_rep&,
96  int max_wl = SC_DEFAULT_DIV_WL_ );
97 scfx_rep* add_scfx_rep( const scfx_rep&, const scfx_rep&,
98  int max_wl = SC_DEFAULT_MAX_WL_ );
99 scfx_rep* sub_scfx_rep( const scfx_rep&, const scfx_rep&,
100  int max_wl = SC_DEFAULT_MAX_WL_ );
101 scfx_rep* lsh_scfx_rep( const scfx_rep&, int );
102 scfx_rep* rsh_scfx_rep( const scfx_rep&, int );
103 int cmp_scfx_rep( const scfx_rep&, const scfx_rep& );
104 
105 
106 const int min_mant = 4;
107 
108 const int bits_in_int = sizeof(int) * CHAR_BIT;
109 const int bits_in_word = sizeof(word) * CHAR_BIT;
110 
111 
112 // ----------------------------------------------------------------------------
113 // CLASS : scfx_index
114 // ----------------------------------------------------------------------------
115 
117 {
118 
119 public:
120 
121  scfx_index( int wi_, int bi_ ) : m_wi( wi_ ), m_bi( bi_ ) {}
122 
123  int wi() const { return m_wi; }
124  int bi() const { return m_bi; }
125 
126  void wi( int wi_ ) { m_wi = wi_; }
127 
128 private:
129 
130  int m_wi;
131  int m_bi;
132 
133 };
134 
135 
136 // ----------------------------------------------------------------------------
137 // CLASS : scfx_rep
138 //
139 // Arbitrary-precision fixed-point implementation class.
140 // ----------------------------------------------------------------------------
141 
142 class scfx_rep
143 {
144  enum state
145  {
146  normal,
147  infinity,
148  not_a_number
149  };
150 
151 public:
152 
153  // constructors
154 
155  scfx_rep();
156  explicit scfx_rep( int );
157  explicit scfx_rep( unsigned int );
158  explicit scfx_rep( long );
159  explicit scfx_rep( unsigned long );
160  explicit scfx_rep( double );
161  explicit scfx_rep( const char* );
162  explicit scfx_rep( int64 );
163  explicit scfx_rep( uint64 );
164  explicit scfx_rep( const sc_signed& );
165  explicit scfx_rep( const sc_unsigned& );
166 
167 
168  // copy constructor
169 
170  scfx_rep( const scfx_rep& );
171 
172 
173  // destructor
174 
175  ~scfx_rep();
176 
177 
178  void* operator new( std::size_t );
179  void operator delete( void*, std::size_t );
180 
181 
182  void from_string( const char*, int );
183 
184  double to_double() const;
185 
186  const char* to_string( sc_numrep,
187  int,
188  sc_fmt,
189  const scfx_params* = 0 ) const;
190 
191 
192  // assignment operator
193 
194  void operator = ( const scfx_rep& );
195 
196  friend void multiply( scfx_rep&, const scfx_rep&, const scfx_rep&, int );
197 
198  friend scfx_rep* neg_scfx_rep( const scfx_rep& );
199  friend scfx_rep* mult_scfx_rep( const scfx_rep&, const scfx_rep&, int );
200  friend scfx_rep* div_scfx_rep( const scfx_rep&, const scfx_rep&, int );
201  friend scfx_rep* add_scfx_rep( const scfx_rep&, const scfx_rep&, int );
202  friend scfx_rep* sub_scfx_rep( const scfx_rep&, const scfx_rep&, int );
203  friend scfx_rep* lsh_scfx_rep( const scfx_rep&, int );
204  friend scfx_rep* rsh_scfx_rep( const scfx_rep&, int );
205 
206  void lshift( int );
207  void rshift( int );
208 
209  friend int cmp_scfx_rep( const scfx_rep&, const scfx_rep& );
210 
211  void cast( const scfx_params&, bool&, bool& );
212 
213  bool is_neg() const;
214  bool is_zero() const;
215  bool is_nan() const;
216  bool is_inf() const;
217  bool is_normal() const;
218 
219  void set_zero( int = 1 );
220  void set_nan();
221  void set_inf( int );
222 
223  bool get_bit( int ) const;
224  bool set( int, const scfx_params& );
225  bool clear( int, const scfx_params& );
226 
227  bool get_slice( int, int, const scfx_params&, sc_bv_base& ) const;
228  bool set_slice( int, int, const scfx_params&, const sc_bv_base& );
229 
230  void print( ::std::ostream& ) const;
231  void dump( ::std::ostream& ) const;
232 
233  void get_type( int&, int&, sc_enc& ) const;
234 
235  friend scfx_rep* quantization_scfx_rep( const scfx_rep&,
236  const scfx_params&,
237  bool& );
238  friend scfx_rep* overflow_scfx_rep( const scfx_rep&,
239  const scfx_params&,
240  bool& );
241 
242  bool rounding_flag() const;
243 
244 private:
245 
246  friend void align( const scfx_rep&, const scfx_rep&, int&, int&,
248  friend int compare_msw( const scfx_rep&, const scfx_rep& );
249  friend int compare_msw_ff( const scfx_rep& lhs, const scfx_rep& rhs );
250  unsigned int divide_by_ten();
251  int find_lsw() const;
252  int find_msw() const;
253  void find_sw();
254  void multiply_by_ten();
255  void normalize( int );
256  scfx_mant* resize( int, int ) const;
257  void set_bin( int );
258  void set_oct( int, int );
259  void set_hex( int, int );
260  void shift_left( int );
261  void shift_right( int );
262 
263  const scfx_index calc_indices( int ) const;
264 
265  void o_extend( const scfx_index&, sc_enc );
266  bool o_bit_at( const scfx_index& ) const;
267  bool o_zero_left( const scfx_index& ) const;
268  bool o_zero_right( const scfx_index& ) const;
269  void o_set_low( const scfx_index&, sc_enc );
270  void o_set_high( const scfx_index&, const scfx_index&, sc_enc, int = 1 );
271  void o_set( const scfx_index&, const scfx_index&, sc_enc, bool );
272  void o_invert( const scfx_index& );
273  bool q_bit( const scfx_index& ) const;
274  void q_clear( const scfx_index& );
275  void q_incr( const scfx_index& );
276  bool q_odd( const scfx_index& ) const;
277  bool q_zero( const scfx_index& ) const;
278 
279  void resize_to( int, int = 0 );
280  int size() const;
281  void toggle_tc();
282 
283  friend void print_dec( scfx_string&, const scfx_rep&, int, sc_fmt );
284  friend void print_other( scfx_string&, const scfx_rep&, sc_numrep, int,
285  sc_fmt, const scfx_params* );
286 
287  void quantization( const scfx_params&, bool& );
288  void overflow( const scfx_params&, bool& );
289 
290  friend int compare_abs( const scfx_rep&, const scfx_rep& );
291 
292  void round( int );
293 
294 private:
295 
296  scfx_mant m_mant; // mantissa (bits of the value).
297  int m_wp; // index of highest order word in value.
298  int m_sign; // sign of value.
299  state m_state; // value state, e.g., normal, inf, etc.
300  int m_msw; // index of most significant non-zero word.
301  int m_lsw; // index of least significant non-zero word.
302  bool m_r_flag; // true if founding occurred.
303 
304 };
305 
306 
307 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
308 
309 inline
310 void
312 {
313  m_mant.clear();
314  m_wp = m_msw = m_lsw = 0;
315  m_sign = sign;
316  m_state = normal;
317 }
318 
319 inline
320 void
322 {
323  m_mant.resize_to( min_mant );
324  m_state = not_a_number;
325 }
326 
327 inline
328 void
329 scfx_rep::set_inf( int sign )
330 {
331  m_mant.resize_to( min_mant );
332  m_state = infinity;
333  m_sign = sign;
334 }
335 
336 
337 // constructors
338 
339 inline
340 scfx_rep::scfx_rep( const char* s )
341 : m_mant( min_mant ), m_wp( 2 ), m_sign( 1 ), m_state( normal ),
342  m_msw(0), m_lsw(0), m_r_flag( false )
343 {
345 }
346 
347 
348 // destructor
349 
350 inline
352 {}
353 
354 
355 // assignment operator
356 
357 inline
358 void
360 {
361  if( &f != this )
362  {
363  m_mant = f.m_mant;
364  m_wp = f.m_wp;
365  m_sign = f.m_sign;
366  m_state = f.m_state;
367  m_msw = f.m_msw;
368  m_lsw = f.m_lsw;
369  round( SC_DEFAULT_MAX_WL_ );
370  }
371 }
372 
373 inline
374 scfx_rep*
376 {
377  scfx_rep& c = *new scfx_rep( a );
378  c.m_sign = - c.m_sign;
379  return &c;
380 }
381 
382 inline
383 scfx_rep*
384 mult_scfx_rep( const scfx_rep& a, const scfx_rep& b, int max_wl )
385 {
386  scfx_rep& c = *new scfx_rep;
387  sc_dt::multiply( c, a, b, max_wl );
388  return &c;
389 }
390 
391 inline
392 scfx_rep*
393 lsh_scfx_rep( const scfx_rep& a, int b )
394 {
395  scfx_rep& c = *new scfx_rep( a );
396  c.lshift( b );
397  return &c;
398 }
399 
400 inline
401 scfx_rep*
402 rsh_scfx_rep( const scfx_rep& a, int b )
403 {
404  scfx_rep& c = *new scfx_rep( a );
405  c.rshift( b );
406  return &c;
407 }
408 
409 inline
410 int
411 scfx_rep::size() const
412 {
413  return m_mant.size();
414 }
415 
416 inline
417 bool
419 {
420  return ( m_sign == -1 );
421 }
422 
423 inline
424 bool
426 {
427  if( m_state != normal )
428  return false;
429 
430  for( int i = 0; i < size(); i ++ )
431  {
432  if( m_mant[i] )
433  return false;
434  }
435 
436  return true;
437 }
438 
439 inline
440 bool
442 {
443  return ( m_state == not_a_number );
444 }
445 
446 inline
447 bool
449 {
450  return ( m_state == infinity );
451 }
452 
453 inline
454 bool
456 {
457  return ( m_state == normal );
458 }
459 
460 inline
461 scfx_rep*
463  const scfx_params& params,
464  bool& q_flag )
465 {
466  scfx_rep& c = *new scfx_rep( a );
467  c.quantization( params, q_flag );
468  return &c;
469 }
470 
471 inline
472 scfx_rep*
474  const scfx_params& params,
475  bool& o_flag )
476 {
477  scfx_rep& c = *new scfx_rep( a );
478  c.overflow( params, o_flag );
479  return &c;
480 }
481 
482 inline
483 bool
485 {
486  return m_r_flag;
487 }
488 
489 inline
490 void
491 scfx_rep::resize_to( int new_size, int restore )
492 {
493  if( restore == -1 )
494  {
495  int size_incr = new_size - size();
496  m_wp += size_incr;
497  m_msw += size_incr;
498  m_lsw += size_incr;
499  }
500  m_mant.resize_to( new_size, restore );
501 }
502 
503 inline
504 const scfx_index
505 scfx_rep::calc_indices( int n ) const
506 {
507  int wi = n / bits_in_word + m_wp;
508  int bi = n % bits_in_word;
509 
510  if( bi < 0 )
511  {
512  bi += bits_in_word;
513  -- wi;
514  }
515 
516  return scfx_index( wi, bi );
517 }
518 
519 inline
520 void
521 scfx_rep::o_extend( const scfx_index& x, sc_enc enc )
522 {
523  int wi = x.wi();
524  int bi = x.bi();
525 
526  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
527 
528  if( enc == SC_US_ || ( m_mant[wi] & ( ((word)1) << bi ) ) == 0 )
529  {
530  if( bi != bits_in_word - 1 )
531  m_mant[wi] &= ~( ((word)-1) << ( bi + 1 ) );
532  for( int i = wi + 1; i < size(); ++ i )
533  m_mant[i] = 0;
534  m_sign = 1;
535  }
536  else
537  {
538  if( bi != bits_in_word - 1 )
539  m_mant[wi] |= ( ((word)-1) << ( bi + 1 ) );
540  for( int i = wi + 1; i < size(); ++ i )
541  m_mant[i] = static_cast<word>( -1 );
542  m_sign = -1;
543  }
544 }
545 
546 inline
547 bool
548 scfx_rep::o_bit_at( const scfx_index& x ) const
549 {
550  int wi = x.wi();
551  int bi = x.bi();
552 
553  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
554 
555  return ( m_mant[wi] & ( ((word)1) << bi ) ) != 0;
556 }
557 
558 inline
559 bool
560 scfx_rep::o_zero_left( const scfx_index& x ) const
561 {
562  int wi = x.wi();
563  int bi = x.bi();
564 
565  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
566 
567  bool zero = true;
568  if( bi != bits_in_word - 1 )
569  zero = ( m_mant[wi] & ( ((word)-1) << ( bi + 1 ) ) ) == 0;
570  for( int i = wi + 1; i < size(); ++ i )
571  zero = zero && m_mant[i] == 0;
572 
573  return zero;
574 }
575 
576 inline
577 bool
578 scfx_rep::o_zero_right( const scfx_index& x ) const
579 {
580  int wi = x.wi();
581  int bi = x.bi();
582 
583  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
584 
585  bool zero = ( m_mant[wi] & ~( ((word)-1) << bi ) ) == 0;
586  for( int i = wi - 1; i >= 0; -- i )
587  zero = zero && m_mant[i] == 0;
588 
589  return zero;
590 }
591 
592 inline
593 void
594 scfx_rep::o_set_low( const scfx_index& x, sc_enc enc )
595 {
596  int wi = x.wi();
597  int bi = x.bi();
598 
599  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
600 
601  m_mant.clear();
602 
603  if( enc == SC_TC_ )
604  {
605  m_mant[wi] |= ( ((word)1) << bi );
606  m_sign = -1;
607  }
608  else
609  m_sign = 1;
610 }
611 
612 inline
613 void
614 scfx_rep::o_set_high( const scfx_index& x, const scfx_index& x2,
615  sc_enc enc, int sign )
616 {
617  int wi = x.wi();
618  int bi = x.bi();
619  int wi2 = x2.wi();
620  int bi2 = x2.bi();
621 
622  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
623  SC_ASSERT_( wi2 >= 0 && wi2 < size(), "word index out of range" );
624 
625  int i;
626 
627  for( i = 0; i < size(); ++ i )
628  m_mant[i] = static_cast<word>( -1 );
629 
630  m_mant[wi] &= ~( ((word)-1) << bi );
631  for( i = wi + 1; i < size(); ++ i )
632  m_mant[i] = 0;
633 
634  m_mant[wi2] &= ( ((word)-1) << bi2 );
635  for( i = wi2 - 1; i >= 0; -- i )
636  m_mant[i] = 0;
637 
638  if( enc == SC_TC_ )
639  m_sign = sign;
640  else
641  {
642  m_mant[wi] |= ( ((word)1) << bi );
643  m_sign = 1;
644  }
645 }
646 
647 inline
648 void
649 scfx_rep::o_set( const scfx_index& x, const scfx_index& x3,
650  sc_enc enc, bool under )
651 {
652  int wi = x.wi();
653  int bi = x.bi();
654  int wi3 = x3.wi();
655  int bi3 = x3.bi();
656 
657  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
658  SC_ASSERT_( wi3 >= 0 && wi3 < size(), "word index out of range" );
659 
660  if( bi3 != bits_in_word - 1 )
661  {
662  if( under )
663  m_mant[wi3] &= ~( ((word)-1) << ( bi3 + 1 ) );
664  else
665  m_mant[wi3] |= ( ((word)-1) << ( bi3 + 1 ) );
666  }
667  for( int i = wi3 + 1; i < size(); ++ i )
668  {
669  if( under )
670  m_mant[i] = 0;
671  else
672  m_mant[i] = static_cast<word>( -1 );
673  }
674 
675  if( enc == SC_TC_ )
676  {
677  if( under )
678  m_mant[wi] |= ( ((word)1) << bi );
679  else
680  m_mant[wi] &= ~( ((word)1) << bi );
681  }
682 }
683 
684 inline
685 void
686 scfx_rep::o_invert( const scfx_index& x2 )
687 {
688  int wi2 = x2.wi();
689  int bi2 = x2.bi();
690 
691  m_mant[wi2] ^= ( ((word)-1) << bi2 );
692  for( int i = wi2 + 1; i < size(); ++ i )
693  m_mant[i] = ~ m_mant[i];
694 }
695 
696 inline
697 bool
698 scfx_rep::q_bit( const scfx_index& x ) const
699 {
700  int wi = x.wi();
701  int bi = x.bi();
702 
703  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
704 
705  if( bi != 0 )
706  return ( m_mant[wi] & ( ((word)1) << ( bi - 1 ) ) ) != 0;
707  else if( wi != 0 )
708  return ( m_mant[wi - 1] & ( ((word)1) << ( bits_in_word - 1 ) ) ) != 0;
709  else
710  return false;
711 }
712 
713 inline
714 void
715 scfx_rep::q_clear( const scfx_index& x )
716 {
717  int wi = x.wi();
718  int bi = x.bi();
719 
720  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
721 
722  m_mant[wi] &= ( ((word)-1) << bi );
723  for( int i = wi - 1; i >= 0; -- i )
724  m_mant[i] = 0;
725 }
726 
727 inline
728 void
729 scfx_rep::q_incr( const scfx_index& x )
730 {
731  int wi = x.wi();
732  int bi = x.bi();
733 
734  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
735 
736  word old_val = m_mant[wi];
737  m_mant[wi] += ( ((word)1) << bi );
738  if( m_mant[wi] <= old_val )
739  {
740  if( wi + 1 == size() )
741  resize_to( size() + 1, 1 );
742 
743  for( int i = wi + 1; i < size(); ++ i )
744  {
745  if( ++ m_mant[i] != 0 )
746  break;
747  }
748  }
749 }
750 
751 inline
752 bool
753 scfx_rep::q_odd( const scfx_index& x ) const
754 {
755  int wi = x.wi();
756  int bi = x.bi();
757 
758  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
759 
760  return ( m_mant[wi] & ( ((word)1) << bi ) ) != 0;
761 }
762 
763 inline
764 bool
765 scfx_rep::q_zero( const scfx_index& x ) const
766 {
767  int wi = x.wi();
768  int bi = x.bi();
769 
770  SC_ASSERT_( wi >= 0 && wi < size(), "word index out of range" );
771 
772  bool zero;
773 
774  if( bi != 0 )
775  {
776  zero = ( m_mant[wi] & ~( ((word)-1) << (bi - 1) ) ) == 0;
777  for( int i = wi - 1; i >= 0; -- i )
778  zero = zero && m_mant[i] == 0;
779  }
780  else if( wi != 0 )
781  {
782  zero = ( m_mant[wi - 1] & ~( ((word)-1) << (bits_in_word - 1) ) ) == 0;
783  for( int i = wi - 2; i >= 0; -- i )
784  zero = zero && m_mant[i] == 0;
785  }
786  else
787  zero = true;
788 
789  return zero;
790 }
791 
792 inline
793 int
794 scfx_rep::find_lsw() const
795 {
796  for( int i = 0; i < size(); i ++ )
797  {
798  if( m_mant[i] )
799  return i;
800  }
801  return 0;
802 }
803 
804 inline
805 int
806 scfx_rep::find_msw() const
807 {
808  for( int i = size() - 1; i >= 0; i -- )
809  {
810  if( m_mant[i] )
811  return i;
812  }
813  return 0;
814 }
815 
816 inline
817 void
818 scfx_rep::find_sw()
819 {
820  m_lsw = find_lsw();
821  m_msw = find_msw();
822 }
823 
824 inline
825 void
826 scfx_rep::toggle_tc()
827 {
828  if( is_neg() )
829  {
830  complement( m_mant, m_mant, m_mant.size() );
831  inc( m_mant );
832  }
833 }
834 
835 } // namespace sc_dt
836 
837 
838 #endif
839 
840 // Taf!
sc_enc
Definition: sc_fxdefs.h:63
friend void print_dec(scfx_string &, const scfx_rep &, int, sc_fmt)
void wi(int wi_)
Definition: scfx_rep.h:126
void set_inf(int)
Definition: scfx_rep.h:329
sc_numrep
Definition: sc_nbdefs.h:91
void set_zero(int=1)
Definition: scfx_rep.h:311
bool set_slice(int, int, const scfx_params &, const sc_bv_base &)
const int bits_in_int
Definition: scfx_rep.h:108
uint64_t uint64
Definition: sc_nbdefs.h:183
void lshift(int)
friend int compare_msw(const scfx_rep &, const scfx_rep &)
const int SC_DEFAULT_DIV_WL_
Definition: sc_fxdefs.h:227
bool is_normal() const
Definition: scfx_rep.h:455
scfx_rep * rsh_scfx_rep(const scfx_rep &, int)
Definition: scfx_rep.h:402
friend void multiply(scfx_rep &, const scfx_rep &, const scfx_rep &, int)
friend void align(const scfx_rep &, const scfx_rep &, int &, int &, scfx_mant_ref &, scfx_mant_ref &)
friend int compare_msw_ff(const scfx_rep &lhs, const scfx_rep &rhs)
#define SC_ASSERT_(cnd, msg)
Definition: sc_fxdefs.h:254
int size() const
Definition: scfx_mant.h:120
void resize_to(int, int=0)
Definition: scfx_mant.h:231
uint64 const sc_uint_base int b
Definition: sc_fxval.h:1003
scfx_rep * neg_scfx_rep(const scfx_rep &)
Definition: scfx_rep.h:375
bool is_nan() const
Definition: scfx_rep.h:441
bool is_neg() const
Definition: scfx_rep.h:418
bool get_bit(int) const
unsigned int word
Definition: scfx_mant.h:63
void multiply(scfx_rep &, const scfx_rep &, const scfx_rep &, int max_wl=SC_DEFAULT_MAX_WL_)
int64_t int64
Definition: sc_nbdefs.h:182
int cmp_scfx_rep(const scfx_rep &, const scfx_rep &)
double to_double() const
scfx_rep * overflow_scfx_rep(const scfx_rep &a, const scfx_params &params, bool &o_flag)
Definition: scfx_rep.h:473
bool set(int, const scfx_params &)
const int bits_in_word
Definition: scfx_rep.h:109
bool get_slice(int, int, const scfx_params &, sc_bv_base &) const
void from_string(const char *, int)
friend int compare_abs(const scfx_rep &, const scfx_rep &)
const char * to_string(sc_numrep, int, sc_fmt, const scfx_params *=0) const
friend scfx_rep * rsh_scfx_rep(const scfx_rep &, int)
Definition: scfx_rep.h:402
scfx_rep * mult_scfx_rep(const scfx_rep &, const scfx_rep &, int max_wl=SC_DEFAULT_MAX_WL_)
Definition: scfx_rep.h:384
friend scfx_rep * lsh_scfx_rep(const scfx_rep &, int)
Definition: scfx_rep.h:393
void get_type(int &, int &, sc_enc &) const
scfx_index(int wi_, int bi_)
Definition: scfx_rep.h:121
bool rounding_flag() const
Definition: scfx_rep.h:484
scfx_rep * quantization_scfx_rep(const scfx_rep &a, const scfx_params &params, bool &q_flag)
Definition: scfx_rep.h:462
void complement(scfx_mant &target, const scfx_mant &source, int size)
Definition: scfx_mant.h:346
bool clear(int, const scfx_params &)
scfx_rep * lsh_scfx_rep(const scfx_rep &, int)
Definition: scfx_rep.h:393
const int SC_DEFAULT_MAX_WL_
Definition: sc_fxdefs.h:239
friend scfx_rep * add_scfx_rep(const scfx_rep &, const scfx_rep &, int)
void set_nan()
Definition: scfx_rep.h:321
int bi() const
Definition: scfx_rep.h:124
bool is_zero() const
Definition: scfx_rep.h:425
void print(::std::ostream &) const
friend scfx_rep * overflow_scfx_rep(const scfx_rep &, const scfx_params &, bool &)
Definition: scfx_rep.h:473
friend scfx_rep * quantization_scfx_rep(const scfx_rep &, const scfx_params &, bool &)
Definition: scfx_rep.h:462
void rshift(int)
scfx_rep * sub_scfx_rep(const scfx_rep &, const scfx_rep &, int max_wl=SC_DEFAULT_MAX_WL_)
void cast(const scfx_params &, bool &, bool &)
bool is_inf() const
Definition: scfx_rep.h:448
scfx_rep * div_scfx_rep(const scfx_rep &, const scfx_rep &, int max_wl=SC_DEFAULT_DIV_WL_)
friend scfx_rep * neg_scfx_rep(const scfx_rep &)
Definition: scfx_rep.h:375
friend scfx_rep * mult_scfx_rep(const scfx_rep &, const scfx_rep &, int)
Definition: scfx_rep.h:384
void dump(::std::ostream &) const
friend void print_other(scfx_string &, const scfx_rep &, sc_numrep, int, sc_fmt, const scfx_params *)
const int min_mant
Definition: scfx_rep.h:106
void inc(scfx_mant &mant)
Definition: scfx_mant.h:361
friend scfx_rep * div_scfx_rep(const scfx_rep &, const scfx_rep &, int)
const int SC_DEFAULT_CTE_WL_
Definition: sc_fxdefs.h:233
scfx_rep * add_scfx_rep(const scfx_rep &, const scfx_rep &, int max_wl=SC_DEFAULT_MAX_WL_)
friend int cmp_scfx_rep(const scfx_rep &, const scfx_rep &)
int wi() const
Definition: scfx_rep.h:123
void operator=(const scfx_rep &)
Definition: scfx_rep.h:359
friend scfx_rep * sub_scfx_rep(const scfx_rep &, const scfx_rep &, int)