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