gem5  v22.1.0.0
sc_fxnum.cc
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  sc_fxnum.cpp -
23 
24  Original Author: Martin Janssen, Synopsys, Inc.
25 
26  *****************************************************************************/
27 
28 /*****************************************************************************
29 
30  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31  changes you are making here.
32 
33  Name, Affiliation, Date:
34  Description of Modification:
35 
36  *****************************************************************************/
37 
38 
39 // $Log: sc_fxnum.cpp,v $
40 // Revision 1.3 2011/01/19 18:57:40 acg
41 // Andy Goodrich: changes for IEEE_1666_2011.
42 //
43 // Revision 1.2 2010/12/07 20:09:08 acg
44 // Andy Goodrich: Philipp Hartmann's constructor disambiguation fix
45 //
46 // Revision 1.1.1.1 2006/12/15 20:20:04 acg
47 // SystemC 2.3
48 //
49 // Revision 1.3 2006/01/13 18:53:57 acg
50 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
51 // the source.
52 //
53 
54 #include <cmath>
55 
58 
59 namespace sc_dt
60 {
61 
62 // ----------------------------------------------------------------------------
63 // CLASS : sc_fxnum_bitref
64 //
65 // Proxy class for bit-selection in class sc_fxnum, behaves like sc_bit.
66 // ----------------------------------------------------------------------------
67 
68 bool sc_fxnum_bitref::get() const { return m_num.get_bit(m_idx); }
70 
71 // print or dump content
72 void sc_fxnum_bitref::print(::std::ostream &os) const { os << get(); }
73 
74 void
75 sc_fxnum_bitref::scan(::std::istream &is)
76 {
77  bool b;
78  is >> b;
79  *this = b;
80 }
81 
82 void
83 sc_fxnum_bitref::dump(::std::ostream &os) const
84 {
85  os << "sc_fxnum_bitref" << ::std::endl;
86  os << "(" << ::std::endl;
87  os << "num = ";
88  m_num.dump(os);
89  os << "idx = " << m_idx << ::std::endl;
90  os << ")" << ::std::endl;
91 }
92 
93 
94 // ----------------------------------------------------------------------------
95 // CLASS : sc_fxnum_fast_bitref
96 //
97 // Proxy class for bit-selection in class sc_fxnum_fast, behaves like sc_bit.
98 // ----------------------------------------------------------------------------
99 
100 bool sc_fxnum_fast_bitref::get() const { return m_num.get_bit(m_idx); }
102 
103 // print or dump content
104 void sc_fxnum_fast_bitref::print(::std::ostream &os) const { os << get(); }
105 
106 void
108 {
109  bool b;
110  is >> b;
111  *this = b;
112 }
113 
114 void
115 sc_fxnum_fast_bitref::dump(::std::ostream &os) const
116 {
117  os << "sc_fxnum_fast_bitref" << ::std::endl;
118  os << "(" << ::std::endl;
119  os << "num = ";
120  m_num.dump(os);
121  os << "idx = " << m_idx << ::std::endl;
122  os << ")" << ::std::endl;
123 }
124 
125 // ----------------------------------------------------------------------------
126 // CLASS : sc_fxnum_subref
127 //
128 // Proxy class for part-selection in class sc_fxnum,
129 // behaves like sc_bv_base.
130 // ----------------------------------------------------------------------------
131 
132 bool
134 {
135  return m_num.get_slice(m_from, m_to, m_bv);
136 }
137 
138 bool
140 {
141  return m_num.set_slice(m_from, m_to, m_bv);
142 }
143 
144 // print or dump content
145 void
146 sc_fxnum_subref::print(::std::ostream &os) const
147 {
148  get();
149  m_bv.print(os);
150 }
151 
152 void
153 sc_fxnum_subref::scan(::std::istream &is)
154 {
155  m_bv.scan(is);
156  set();
157 }
158 
159 void
160 sc_fxnum_subref::dump(::std::ostream &os) const
161 {
162  os << "sc_fxnum_subref" << ::std::endl;
163  os << "(" << ::std::endl;
164  os << "num = ";
165  m_num.dump(os);
166  os << "from = " << m_from << ::std::endl;
167  os << "to = " << m_to << ::std::endl;
168  os << ")" << ::std::endl;
169 }
170 
171 
172 // ----------------------------------------------------------------------------
173 // CLASS : sc_fxnum_fast_subref
174 //
175 // Proxy class for part-selection in class sc_fxnum_fast,
176 // behaves like sc_bv_base.
177 // ----------------------------------------------------------------------------
178 
179 bool
181 {
182  return m_num.get_slice(m_from, m_to, m_bv);
183 }
184 
185 bool
187 {
188  return m_num.set_slice(m_from, m_to, m_bv);
189 }
190 
191 // print or dump content
192 void
193 sc_fxnum_fast_subref::print(::std::ostream &os) const
194 {
195  get();
196  m_bv.print(os);
197 }
198 
199 void
201 {
202  m_bv.scan(is);
203  set();
204 }
205 
206 void
207 sc_fxnum_fast_subref::dump(::std::ostream &os) const
208 {
209  os << "sc_fxnum_fast_subref" << ::std::endl;
210  os << "(" << ::std::endl;
211  os << "num = ";
212  m_num.dump(os);
213  os << "from = " << m_from << ::std::endl;
214  os << "to = " << m_to << ::std::endl;
215  os << ")" << ::std::endl;
216 }
217 
218 
219 // ----------------------------------------------------------------------------
220 // CLASS : sc_fxnum
221 //
222 // Base class for the fixed-point types; arbitrary precision.
223 // ----------------------------------------------------------------------------
224 
225 // explicit conversion to character string
226 
227 const std::string
229 {
230  return std::string(m_rep->to_string(SC_DEC, -1, SC_F, &m_params));
231 }
232 
233 const std::string
235 {
236  return std::string(m_rep->to_string(numrep, -1, SC_F, &m_params));
237 }
238 
239 const std::string
240 sc_fxnum::to_string(sc_numrep numrep, bool w_prefix) const
241 {
242  return std::string(m_rep->to_string(numrep, (w_prefix ? 1 : 0),
243  SC_F, &m_params));
244 }
245 
246 const std::string
248 {
249  return std::string(m_rep->to_string(SC_DEC, -1, fmt, &m_params));
250 }
251 
252 const std::string
254 {
255  return std::string(m_rep->to_string(numrep, -1, fmt, &m_params));
256 }
257 
258 const std::string
259 sc_fxnum::to_string(sc_numrep numrep, bool w_prefix, sc_fmt fmt) const
260 {
261  return std::string(m_rep->to_string(numrep, (w_prefix ? 1 : 0),
262  fmt, &m_params));
263 }
264 
265 
266 const std::string
268 {
269  return std::string(m_rep->to_string(SC_DEC, -1, SC_F, &m_params));
270 }
271 
272 const std::string
274 {
275  return std::string(m_rep->to_string(SC_BIN, -1, SC_F, &m_params));
276 }
277 
278 const std::string
280 {
281  return std::string(m_rep->to_string(SC_OCT, -1, SC_F, &m_params));
282 }
283 
284 const std::string
286 {
287  return std::string(m_rep->to_string(SC_HEX, -1, SC_F, &m_params));
288 }
289 
290 
291 // print or dump content
292 void
293 sc_fxnum::print(::std::ostream &os) const
294 {
295  os << m_rep->to_string(SC_DEC, -1, SC_F, &m_params);
296 }
297 
298 void
299 sc_fxnum::scan(::std::istream &is)
300 {
301  std::string s;
302  is >> s;
303  *this = s.c_str();
304 }
305 
306 void
307 sc_fxnum::dump(::std::ostream &os) const
308 {
309  os << "sc_fxnum" << ::std::endl;
310  os << "(" << ::std::endl;
311  os << "rep = ";
312  m_rep->dump(os);
313  os << "params = ";
314  m_params.dump(os);
315  os << "q_flag = " << m_q_flag << ::std::endl;
316  os << "o_flag = " << m_o_flag << ::std::endl;
317  // TO BE COMPLETED
318  // os << "observer = ";
319  // if (m_observer != 0)
320  // m_observer->dump(os);
321  // else
322  // os << "0" << ::std::endl;
323  os << ")" << ::std::endl;
324 }
325 
326 
329 {
330  SC_ASSERT_(m_observer != 0, "lock observer failed");
332  m_observer = 0;
333  return tmp;
334 }
335 
336 void
338 {
339  SC_ASSERT_(observer_ != 0, "unlock observer failed");
340  m_observer = observer_;
341 }
342 
343 
344 // ----------------------------------------------------------------------------
345 // CLASS : sc_fxnum_fast
346 //
347 // Base class for the fixed-point types; limited precision.
348 // ----------------------------------------------------------------------------
349 
350 static void
351 quantization(double &c, const scfx_params &params, bool &q_flag)
352 {
353  int fwl = params.wl() - params.iwl();
354  double scale = scfx_pow2(fwl);
355  double val = scale * c;
356  double int_part;
357  double frac_part = modf(val, &int_part);
358 
359  q_flag = (frac_part != 0.0);
360 
361  if (q_flag) {
362  val = int_part;
363 
364  switch (params.q_mode()) {
365  case SC_TRN: // truncation
366  {
367  if (c < 0.0)
368  val -= 1.0;
369  break;
370  }
371  case SC_RND: // rounding to plus infinity
372  {
373  if (frac_part >= 0.5)
374  val += 1.0;
375  else if (frac_part < -0.5)
376  val -= 1.0;
377  break;
378  }
379  case SC_TRN_ZERO: // truncation to zero
380  {
381  break;
382  }
383  case SC_RND_INF: // rounding to infinity
384  {
385  if (frac_part >= 0.5)
386  val += 1.0;
387  else if (frac_part <= -0.5)
388  val -= 1.0;
389  break;
390  }
391  case SC_RND_CONV: // convergent rounding
392  {
393  if (frac_part > 0.5 ||
394  (frac_part == 0.5 && fmod(int_part, 2.0) != 0.0)) {
395  val += 1.0;
396  } else if (frac_part < -0.5 ||
397  (frac_part == -0.5 && fmod(int_part, 2.0) != 0.0)) {
398  val -= 1.0;
399  }
400  break;
401  }
402  case SC_RND_ZERO: // rounding to zero
403  {
404  if (frac_part > 0.5)
405  val += 1.0;
406  else if (frac_part < -0.5)
407  val -= 1.0;
408  break;
409  }
410  case SC_RND_MIN_INF: // rounding to minus infinity
411  {
412  if (frac_part > 0.5)
413  val += 1.0;
414  else if (frac_part <= -0.5)
415  val -= 1.0;
416  break;
417  }
418  default:
419  ;
420  }
421  }
422 
423  val /= scale;
424  c = val;
425 }
426 
427 static void
428 overflow(double &c, const scfx_params &params, bool &o_flag)
429 {
430  int iwl = params.iwl();
431  int fwl = params.wl() - iwl;
432  double full_circle = scfx_pow2(iwl);
433  double resolution = scfx_pow2(-fwl);
434  double low, high;
435  if (params.enc() == SC_TC_) {
436  high = full_circle / 2.0 - resolution;
437  if (params.o_mode() == SC_SAT_SYM)
438  low = - high;
439  else
440  low = - full_circle / 2.0;
441  } else {
442  low = 0.0;
443  high = full_circle - resolution;
444  }
445  double val = c;
446  sc_fxval_fast c2(c);
447 
448  bool under = (val < low);
449  bool over = (val > high);
450 
451  o_flag = (under || over);
452 
453  if (o_flag) {
454  switch (params.o_mode()) {
455  case SC_WRAP: // wrap-around
456  {
457  int n_bits = params.n_bits();
458 
459  if (n_bits == 0) {
460  // wrap-around all 'wl' bits
461  val -= floor(val / full_circle) * full_circle;
462  if (val > high)
463  val -= full_circle;
464  } else if (n_bits < params.wl()) {
465  double X = scfx_pow2(iwl - n_bits);
466 
467  // wrap-around least significant 'wl - n_bits' bits
468  val -= floor(val / X) * X;
469  if (val > (X - resolution))
470  val -= X;
471 
472  // saturate most significant 'n_bits' bits
473  if (under) {
474  val += low;
475  } else {
476  if (params.enc() == SC_TC_)
477  val += full_circle / 2.0 - X;
478  else
479  val += full_circle - X;
480  }
481  } else {
482  // saturate all 'wl' bits
483  if (under)
484  val = low;
485  else
486  val = high;
487  }
488  break;
489  }
490  case SC_SAT: // saturation
491  case SC_SAT_SYM: // symmetrical saturation
492  {
493  if (under)
494  val = low;
495  else
496  val = high;
497  break;
498  }
499  case SC_SAT_ZERO: // saturation to zero
500  {
501  val = 0.0;
502  break;
503  }
504  case SC_WRAP_SM: // sign magnitude wrap-around
505  {
506  SC_ERROR_IF_(params.enc() == SC_US_,
508 
509  int n_bits = params.n_bits();
510 
511  if (n_bits == 0) {
512  // invert conditionally
513  if (c2.get_bit(iwl) != c2.get_bit(iwl - 1))
514  val = -val - resolution;
515 
516  // wrap-around all 'wl' bits
517  val -= floor(val / full_circle) * full_circle;
518  if (val > high)
519  val -= full_circle;
520  } else if (n_bits == 1) {
521  // invert conditionally
522  if (c2.is_neg() != c2.get_bit(iwl - 1))
523  val = -val - resolution;
524 
525  // wrap-around all 'wl' bits
526  val -= floor(val / full_circle) * full_circle;
527  if (val > high)
528  val -= full_circle;
529  } else if (n_bits < params.wl()) {
530  // invert conditionally
531  if (c2.is_neg() == c2.get_bit(iwl - n_bits))
532  val = -val - resolution;
533 
534  double X = scfx_pow2(iwl - n_bits);
535 
536  // wrap-around least significant 'wl - n_bits' bits
537  val -= floor(val / X) * X;
538  if (val > (X - resolution))
539  val -= X;
540 
541  // saturate most significant 'n_bits' bits
542  if (under)
543  val += low;
544  else
545  val += full_circle / 2.0 - X;
546  } else {
547  // saturate all 'wl' bits
548  if (under)
549  val = low;
550  else
551  val = high;
552  }
553  break;
554  }
555  default:
556  ;
557  }
558 
559  c = val;
560  }
561 }
562 
563 
564 void
566 {
569 
570  if (m_params.cast_switch() == SC_ON) {
571  m_q_flag = false;
572  m_o_flag = false;
573 
574  // check for special cases
575 
576  if (id.is_zero()) {
577  if (id.negative() != 0)
578  m_val = -m_val;
579  return;
580  }
581 
582  // perform casting
585 
586  // check for special case: -0
587  id = m_val;
588  if (id.is_zero() && id.negative() != 0) {
589  m_val = -m_val;
590  }
591 
592  // check for special case: NaN of Inf
593  if (id.is_nan() || id.is_inf()) {
594  m_val = 0.0;
595  }
596  }
597 }
598 
599 
600 // defined in sc_fxval.cpp;
601 extern const char* to_string(const scfx_ieee_double &, sc_numrep, int, sc_fmt,
602  const scfx_params * =0);
603 
604 
605 // explicit conversion to character string
606 
607 const std::string
609 {
610  return std::string(sc_dt::to_string(m_val, SC_DEC, -1, SC_F, &m_params));
611 }
612 
613 const std::string
615 {
616  return std::string(sc_dt::to_string(m_val, numrep, -1, SC_F, &m_params));
617 }
618 
619 const std::string
620 sc_fxnum_fast::to_string(sc_numrep numrep, bool w_prefix) const
621 {
622  return std::string(sc_dt::to_string(m_val, numrep, (w_prefix ? 1 : 0),
623  SC_F, &m_params));
624 }
625 
626 const std::string
628 {
629  return std::string(sc_dt::to_string(m_val, SC_DEC, -1, fmt, &m_params));
630 }
631 
632 const std::string
634 {
635  return std::string(sc_dt::to_string(m_val, numrep, -1, fmt, &m_params));
636 }
637 
638 const std::string
639 sc_fxnum_fast::to_string(sc_numrep numrep, bool w_prefix, sc_fmt fmt) const
640 {
641  return std::string(sc_dt::to_string(m_val, numrep, (w_prefix ? 1 : 0),
642  fmt, &m_params));
643 }
644 
645 
646 const std::string
648 {
649  return std::string(sc_dt::to_string(m_val, SC_DEC, -1, SC_F, &m_params));
650 }
651 
652 const std::string
654 {
655  return std::string(sc_dt::to_string(m_val, SC_BIN, -1, SC_F, &m_params));
656 }
657 
658 const std::string
660 {
661  return std::string(sc_dt::to_string(m_val, SC_OCT, -1, SC_F, &m_params));
662 }
663 
664 const std::string
666 {
667  return std::string(sc_dt::to_string(m_val, SC_HEX, -1, SC_F, &m_params));
668 }
669 
670 // print or dump content
671 void
672 sc_fxnum_fast::print(::std::ostream &os) const
673 {
675 }
676 
677 void
678 sc_fxnum_fast::scan(::std::istream &is)
679 {
680  std::string s;
681  is >> s;
682  *this = s.c_str();
683 }
684 
685 void
686 sc_fxnum_fast::dump(::std::ostream &os) const
687 {
688  os << "sc_fxnum_fast" << ::std::endl;
689  os << "(" << ::std::endl;
690  os << "val = " << m_val << ::std::endl;
691  os << "params = ";
692  m_params.dump(os);
693  os << "q_flag = " << m_q_flag << ::std::endl;
694  os << "o_flag = " << m_o_flag << ::std::endl;
695  // TO BE COMPLETED
696  // os << "observer = ";
697  // if (m_observer != 0)
698  // m_observer->dump(os);
699  // else
700  // os << "0" << ::std::endl;
701  os << ")" << ::std::endl;
702 }
703 
704 // internal use only;
705 bool
707 {
709  if (id.is_zero() || id.is_nan() || id.is_inf())
710  return false;
711 
712  // convert to two's complement
713  unsigned int m0 = id.mantissa0();
714  unsigned int m1 = id.mantissa1();
715 
716  if (id.is_normal())
717  m0 += 1U << 20;
718 
719  if (id.negative() != 0) {
720  m0 = ~ m0;
721  m1 = ~ m1;
722  unsigned int tmp = m1;
723  m1 += 1U;
724  if (m1 <= tmp)
725  m0 += 1U;
726  }
727 
728  // get the right bit
729  int j = i - id.exponent();
730  if ((j += 20) >= 32)
731  return ((m0 & 1U << 31) != 0);
732  else if (j >= 0)
733  return ((m0 & 1U << j) != 0);
734  else if ((j += 32) >= 0)
735  return ((m1 & 1U << j) != 0);
736  else
737  return false;
738 }
739 
740 
741 bool
743 {
745  if (id.is_nan() || id.is_inf())
746  return false;
747 
748  if (high) {
749  if (get_bit(i))
750  return true;
751 
752  if (m_params.enc() == SC_TC_ && i == m_params.iwl() - 1)
753  m_val -= scfx_pow2(i);
754  else
755  m_val += scfx_pow2(i);
756  } else {
757  if (!get_bit(i))
758  return true;
759 
760  if (m_params.enc() == SC_TC_ && i == m_params.iwl() - 1)
761  m_val += scfx_pow2(i);
762  else
763  m_val -= scfx_pow2(i);
764  }
765 
766  return true;
767 }
768 
769 
770 bool
772 {
774  if (id.is_nan() || id.is_inf())
775  return false;
776 
777  // convert to two's complement
778  unsigned int m0 = id.mantissa0();
779  unsigned int m1 = id.mantissa1();
780 
781  if (id.is_normal())
782  m0 += 1U << 20;
783 
784  if (id.negative() != 0) {
785  m0 = ~ m0;
786  m1 = ~ m1;
787  unsigned int tmp = m1;
788  m1 += 1U;
789  if (m1 <= tmp)
790  m0 += 1U;
791  }
792 
793  // get the bits
794  int l = j;
795  for (int k = 0; k < bv.length(); ++ k) {
796  bool b = false;
797 
798  int n = l - id.exponent();
799  if ((n += 20) >= 32)
800  b = ((m0 & 1U << 31) != 0);
801  else if (n >= 0)
802  b = ((m0 & 1U << n) != 0);
803  else if ((n += 32) >= 0)
804  b = ((m1 & 1U << n) != 0);
805 
806  bv[k] = b;
807 
808  if (i >= j)
809  ++l;
810  else
811  --l;
812  }
813 
814  return true;
815 }
816 
817 bool
819 {
821  if (id.is_nan() || id.is_inf())
822  return false;
823 
824  // set the bits
825  int l = j;
826  for (int k = 0; k < bv.length(); ++k) {
827  if (bv[k].to_bool()) {
828  if (!get_bit(l)) {
829  if (m_params.enc() == SC_TC_ && l == m_params.iwl() - 1)
830  m_val -= scfx_pow2(l);
831  else
832  m_val += scfx_pow2(l);
833  }
834  } else {
835  if (get_bit(l)) {
836  if (m_params.enc() == SC_TC_ && l == m_params.iwl() - 1)
837  m_val += scfx_pow2(l);
838  else
839  m_val -= scfx_pow2(l);
840  }
841  }
842 
843  if (i >= j)
844  ++l;
845  else
846  --l;
847  }
848 
849  return true;
850 }
851 
854 {
855  SC_ASSERT_(m_observer != 0, "lock observer failed");
857  m_observer = 0;
858  return tmp;
859 }
860 
861 void
863 {
864  SC_ASSERT_(observer_ != 0, "unlock observer failed");
865  m_observer = observer_;
866 }
867 
868 } // namespace sc_dt
int length() const
Definition: sc_bv_base.hh:217
bool get() const
Definition: sc_fxnum.cc:68
void print(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:72
void scan(::std::istream &=::std::cin)
Definition: sc_fxnum.cc:75
void dump(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:83
sc_fxnum_fast & m_num
Definition: sc_fxnum.hh:197
void scan(::std::istream &=::std::cin)
Definition: sc_fxnum.cc:107
void print(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:104
void dump(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:115
void dump(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:207
void print(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:193
void scan(::std::istream &=::std::cin)
Definition: sc_fxnum.cc:200
sc_fxnum_fast & m_num
Definition: sc_fxnum.hh:465
const std::string to_hex() const
Definition: sc_fxnum.cc:665
void unlock_observer(sc_fxnum_fast_observer *) const
Definition: sc_fxnum.cc:862
scfx_params m_params
Definition: sc_fxnum.hh:1183
const std::string to_dec() const
Definition: sc_fxnum.cc:647
const std::string to_oct() const
Definition: sc_fxnum.cc:659
bool set_slice(int, int, const sc_bv_base &)
Definition: sc_fxnum.cc:818
sc_fxnum_fast_observer * m_observer
Definition: sc_fxnum.hh:1187
bool is_normal() const
Definition: sc_fxnum.hh:3980
const std::string to_string() const
Definition: sc_fxnum.cc:608
void dump(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:686
void print(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:672
void scan(::std::istream &=::std::cin)
Definition: sc_fxnum.cc:678
const std::string to_bin() const
Definition: sc_fxnum.cc:653
bool is_zero() const
Definition: sc_fxnum.hh:3971
bool get_bit(int) const
Definition: sc_fxnum.cc:706
sc_fxnum_fast_observer * lock_observer() const
Definition: sc_fxnum.cc:853
bool get_slice(int, int, sc_bv_base &) const
Definition: sc_fxnum.cc:771
bool set_bit(int, bool)
Definition: sc_fxnum.cc:742
void print(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:146
sc_bv_base & m_bv
Definition: sc_fxnum.hh:334
void dump(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:160
void scan(::std::istream &=::std::cin)
Definition: sc_fxnum.cc:153
bool get() const
Definition: sc_fxnum.cc:133
scfx_rep * m_rep
Definition: sc_fxnum.hh:823
void dump(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:307
void unlock_observer(sc_fxnum_observer *) const
Definition: sc_fxnum.cc:337
bool get_slice(int, int, sc_bv_base &) const
Definition: sc_fxnum.hh:3103
bool set_slice(int, int, const sc_bv_base &)
Definition: sc_fxnum.hh:3109
const std::string to_hex() const
Definition: sc_fxnum.cc:285
bool get_bit(int) const
Definition: sc_fxnum.hh:3087
void print(::std::ostream &=::std::cout) const
Definition: sc_fxnum.cc:293
const std::string to_dec() const
Definition: sc_fxnum.cc:267
sc_fxnum_observer * lock_observer() const
Definition: sc_fxnum.cc:328
const std::string to_bin() const
Definition: sc_fxnum.cc:273
const std::string to_oct() const
Definition: sc_fxnum.cc:279
void scan(::std::istream &=::std::cin)
Definition: sc_fxnum.cc:299
scfx_params m_params
Definition: sc_fxnum.hh:825
sc_fxnum_observer * m_observer
Definition: sc_fxnum.hh:829
const std::string to_string() const
Definition: sc_fxnum.cc:228
bool set_bit(int, bool)
Definition: sc_fxnum.hh:3094
void scan(::std::istream &is=::std::cin)
Definition: sc_proxy.hh:1229
void print(::std::ostream &os=::std::cout) const
Definition: sc_proxy.hh:447
const sc_fxcast_switch & cast_switch() const
Definition: scfx_params.hh:125
sc_enc enc() const
Definition: scfx_params.hh:119
sc_o_mode o_mode() const
Definition: scfx_params.hh:156
sc_q_mode q_mode() const
Definition: scfx_params.hh:150
void dump(::std::ostream &) const
Definition: scfx_params.hh:169
int n_bits() const
Definition: scfx_params.hh:162
void dump(::std::ostream &) const
Definition: scfx_rep.cc:2526
const char * to_string(sc_numrep, int, sc_fmt, const scfx_params *=0) const
Definition: scfx_rep.cc:1140
Bitfield< 31 > n
Definition: misc_types.hh:462
Bitfield< 7 > b
Definition: misc_types.hh:388
Bitfield< 7 > i
Definition: misc_types.hh:67
Bitfield< 33 > id
Definition: misc_types.hh:257
Bitfield< 24 > j
Definition: misc_types.hh:57
Bitfield< 24, 22 > is
Bitfield< 23 > k
Definition: dt_constants.hh:81
Bitfield< 6 > c2
Bitfield< 1 > s
Definition: pagetable.hh:64
Bitfield< 55 > l
Definition: pagetable.hh:54
Bitfield< 2 > c
Definition: pagetable.hh:63
Bitfield< 15, 0 > X
Definition: int.hh:58
Bitfield< 17 > os
Definition: misc.hh:810
Bitfield< 63 > val
Definition: misc.hh:776
Bitfield< 62 > over
Definition: misc.hh:775
bool to_bool(const std::string &value, bool &retval)
Turn a string representation of a boolean into a boolean value.
Definition: str.hh:191
high
Definition: intmath.hh:176
const char SC_ID_INVALID_FX_VALUE_[]
Definition: messages.cc:40
const char SC_ID_WRAP_SM_NOT_DEFINED_[]
Definition: messages.cc:45
Definition: sc_bit.cc:68
@ SC_US_
Definition: sc_fxdefs.hh:73
@ SC_TC_
Definition: sc_fxdefs.hh:72
bool is_inf(double v)
Definition: sc_nbutils.hh:816
bool is_nan(double v)
Definition: sc_nbutils.hh:810
@ SC_RND_CONV
Definition: sc_fxdefs.hh:97
@ SC_RND
Definition: sc_fxdefs.hh:93
@ SC_RND_MIN_INF
Definition: sc_fxdefs.hh:95
@ SC_TRN_ZERO
Definition: sc_fxdefs.hh:99
@ SC_TRN
Definition: sc_fxdefs.hh:98
@ SC_RND_ZERO
Definition: sc_fxdefs.hh:94
@ SC_RND_INF
Definition: sc_fxdefs.hh:96
sc_numrep
Definition: sc_nbdefs.hh:82
@ SC_BIN
Definition: sc_nbdefs.hh:84
@ SC_HEX
Definition: sc_nbdefs.hh:87
@ SC_OCT
Definition: sc_nbdefs.hh:85
@ SC_DEC
Definition: sc_nbdefs.hh:86
static void quantization(double &c, const scfx_params &params, bool &q_flag)
Definition: sc_fxnum.cc:351
@ SC_F
Definition: sc_fxdefs.hh:166
double scfx_pow2(int exp)
Definition: scfx_ieee.hh:568
static void overflow(double &c, const scfx_params &params, bool &o_flag)
Definition: sc_fxnum.cc:428
@ SC_ON
Definition: sc_fxdefs.hh:146
const std::string to_string(sc_enc enc)
Definition: sc_fxdefs.cc:60
@ SC_WRAP
Definition: sc_fxdefs.hh:122
@ SC_WRAP_SM
Definition: sc_fxdefs.hh:123
@ SC_SAT_SYM
Definition: sc_fxdefs.hh:121
@ SC_SAT_ZERO
Definition: sc_fxdefs.hh:120
@ SC_SAT
Definition: sc_fxdefs.hh:119
#define SC_ERROR_IF_(cnd, id)
Definition: sc_fxdefs.hh:251
#define SC_ASSERT_(cnd, msg)
Definition: sc_fxdefs.hh:248

Generated on Wed Dec 21 2022 10:22:40 for gem5 by doxygen 1.9.1