gem5  v21.1.0.2
scfx_rep.hh
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 __SYSTEMC_EXT_DT_FX_SCFX_REP_HH__
69 #define __SYSTEMC_EXT_DT_FX_SCFX_REP_HH__
70 
71 #include <climits>
72 
73 #include "scfx_mant.hh"
74 #include "scfx_params.hh"
75 #include "scfx_string.hh"
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 const int min_mant = 4;
106 
107 const int bits_in_int = sizeof(int) * CHAR_BIT;
108 const int bits_in_word = sizeof(word) * CHAR_BIT;
109 
110 
111 // ----------------------------------------------------------------------------
112 // CLASS : scfx_index
113 // ----------------------------------------------------------------------------
114 
115 class scfx_index
116 {
117  public:
118  scfx_index(int wi_, int bi_) : m_wi(wi_), m_bi(bi_) {}
119 
120  int wi() const { return m_wi; }
121  int bi() const { return m_bi; }
122 
123  void wi(int wi_) { m_wi = wi_; }
124 
125  private:
126  int m_wi;
127  int m_bi;
128 };
129 
130 
131 // ----------------------------------------------------------------------------
132 // CLASS : scfx_rep
133 //
134 // Arbitrary-precision fixed-point implementation class.
135 // ----------------------------------------------------------------------------
136 
137 class scfx_rep
138 {
139  enum state
140  {
141  normal,
142  infinity,
144  };
145 
146  public:
147  // constructors
148  scfx_rep();
149  explicit scfx_rep(int);
150  explicit scfx_rep(unsigned int);
151  explicit scfx_rep(long);
152  explicit scfx_rep(unsigned long);
153  explicit scfx_rep(double);
154  explicit scfx_rep(const char *);
155  explicit scfx_rep(int64);
156  explicit scfx_rep(uint64);
157  explicit scfx_rep(const sc_signed &);
158  explicit scfx_rep(const sc_unsigned &);
159 
160  // copy constructor
161  scfx_rep(const scfx_rep &);
162 
163  // destructor
164  ~scfx_rep();
165 
166  void *operator new (std::size_t);
167  void operator delete (void *, std::size_t);
168 
169  void from_string(const char *, int);
170 
171  double to_double() const;
172  uint64 to_uint64() const;
173 
174  const char *to_string(sc_numrep, int, sc_fmt,
175  const scfx_params * =0) const;
176 
177  // assignment operator
178  void operator = (const scfx_rep &);
179 
180  friend void multiply( scfx_rep&, const scfx_rep&, const scfx_rep&, int );
181 
182  friend scfx_rep *neg_scfx_rep(const scfx_rep &);
183  friend scfx_rep *mult_scfx_rep(const scfx_rep &, const scfx_rep &, int);
184  friend scfx_rep *div_scfx_rep(const scfx_rep &, const scfx_rep &, int);
185  friend scfx_rep *add_scfx_rep(const scfx_rep &, const scfx_rep &, int);
186  friend scfx_rep *sub_scfx_rep(const scfx_rep &, const scfx_rep &, int);
187  friend scfx_rep *lsh_scfx_rep(const scfx_rep &, int);
188  friend scfx_rep *rsh_scfx_rep(const scfx_rep &, int);
189 
190  void lshift(int);
191  void rshift(int);
192 
193  friend int cmp_scfx_rep(const scfx_rep &, const scfx_rep &);
194 
195  void cast(const scfx_params &, bool &, bool &);
196 
197  bool is_neg() const;
198  bool is_zero() const;
199  bool is_nan() const;
200  bool is_inf() const;
201  bool is_normal() const;
202 
203  void set_zero(int=1);
204  void set_nan();
205  void set_inf(int);
206 
207  bool get_bit(int) const;
208  bool set(int, const scfx_params &);
209  bool clear(int, const scfx_params &);
210 
211  bool get_slice(int, int, const scfx_params &, sc_bv_base &) const;
212  bool set_slice(int, int, const scfx_params &, const sc_bv_base &);
213 
214  void print(::std::ostream &) const;
215  void dump(::std::ostream &) const;
216 
217  void get_type(int &, int &, sc_enc &) const;
218 
220  const scfx_rep &, const scfx_params &, bool &);
221  friend scfx_rep *overflow_scfx_rep(
222  const scfx_rep &, const scfx_params &, bool &);
223 
224  bool rounding_flag() const;
225 
226  private:
227  friend void align(const scfx_rep &, const scfx_rep &, int &, int &,
229  friend int compare_msw(const scfx_rep &, const scfx_rep &);
230  friend int compare_msw_ff(const scfx_rep &lhs, const scfx_rep &rhs);
231  unsigned int divide_by_ten();
232  int find_lsw() const;
233  int find_msw() const;
234  void find_sw();
235  void multiply_by_ten();
236  void normalize(int);
237  scfx_mant *resize(int, int) const;
238  void set_bin(int);
239  void set_oct(int, int);
240  void set_hex(int, int);
241  void shift_left(int);
242  void shift_right(int);
243 
244  const scfx_index calc_indices(int) const;
245 
246  void o_extend(const scfx_index &, sc_enc);
247  bool o_bit_at(const scfx_index &) const;
248  bool o_zero_left(const scfx_index &) const;
249  bool o_zero_right(const scfx_index &) const;
250  void o_set_low(const scfx_index &, sc_enc);
251  void o_set_high(const scfx_index &, const scfx_index &, sc_enc, int=1);
252  void o_set(const scfx_index &, const scfx_index &, sc_enc, bool);
253  void o_invert(const scfx_index &);
254  bool q_bit(const scfx_index &) const;
255  void q_clear(const scfx_index &);
256  void q_incr(const scfx_index &);
257  bool q_odd(const scfx_index &) const;
258  bool q_zero(const scfx_index &) const;
259 
260  void resize_to(int, int=0);
261  int size() const;
262  void toggle_tc();
263 
264  friend void print_dec(scfx_string &, const scfx_rep &, int, sc_fmt);
265  friend void print_other(scfx_string &, const scfx_rep &, sc_numrep, int,
266  sc_fmt, const scfx_params *);
267 
268  void quantization(const scfx_params &, bool &);
269  void overflow(const scfx_params &, bool &);
270 
271  friend int compare_abs(const scfx_rep &, const scfx_rep &);
272 
273  void round(int);
274 
275  private:
276  scfx_mant m_mant; // mantissa (bits of the value).
277  int m_wp; // index of highest order word in value.
278  int m_sign; // sign of value.
279  state m_state; // value state, e.g., normal, inf, etc.
280  int m_msw; // index of most significant non-zero word.
281  int m_lsw; // index of least significant non-zero word.
282  bool m_r_flag; // true if rounding occurred.
283 };
284 
285 
286 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
287 
288 inline void
289 scfx_rep::set_zero(int sign)
290 {
291  m_mant.clear();
292  m_wp = m_msw = m_lsw = 0;
293  m_sign = sign;
294  m_state = normal;
295 }
296 
297 inline void
299 {
302 }
303 
304 inline void
305 scfx_rep::set_inf(int sign)
306 {
309  m_sign = sign;
310 }
311 
312 // constructors
313 inline scfx_rep::scfx_rep(const char *s) :
314  m_mant(min_mant), m_wp(2), m_sign(1), m_state(normal),
315  m_msw(0), m_lsw(0), m_r_flag(false)
316 {
317  from_string(s, SC_DEFAULT_CTE_WL_);
318 }
319 
320 // destructor
322 
323 // assignment operator
324 inline void
326 {
327  if (&f != this) {
328  m_mant = f.m_mant;
329  m_wp = f.m_wp;
330  m_sign = f.m_sign;
331  m_state = f.m_state;
332  m_msw = f.m_msw;
333  m_lsw = f.m_lsw;
335  }
336 }
337 
338 inline scfx_rep *
339 neg_scfx_rep(const scfx_rep &a)
340 {
341  scfx_rep &c = *new scfx_rep(a);
342  c.m_sign = - c.m_sign;
343  return &c;
344 }
345 
346 inline scfx_rep *
347 mult_scfx_rep(const scfx_rep &a, const scfx_rep &b, int max_wl)
348 {
349  scfx_rep &c = *new scfx_rep;
350  sc_dt::multiply(c, a, b, max_wl);
351  return &c;
352 }
353 
354 inline scfx_rep *
355 lsh_scfx_rep(const scfx_rep &a, int b)
356 {
357  scfx_rep &c = *new scfx_rep(a);
358  c.lshift(b);
359  return &c;
360 }
361 
362 inline scfx_rep *
363 rsh_scfx_rep(const scfx_rep &a, int b)
364 {
365  scfx_rep &c = *new scfx_rep(a);
366  c.rshift(b);
367  return &c;
368 }
369 
370 inline int scfx_rep::size() const { return m_mant.size(); }
371 
372 inline bool scfx_rep::is_neg() const { return (m_sign == -1); }
373 
374 inline bool
375 scfx_rep::is_zero() const
376 {
377  if (m_state != normal)
378  return false;
379 
380  for (int i = 0; i < size(); i++) {
381  if (m_mant[i])
382  return false;
383  }
384 
385  return true;
386 }
387 
388 inline bool scfx_rep::is_nan() const { return (m_state == not_a_number); }
389 
390 inline bool scfx_rep::is_inf() const { return (m_state == infinity); }
391 
392 inline bool scfx_rep::is_normal() const { return (m_state == normal); }
393 
394 inline scfx_rep *
396  bool &q_flag)
397 {
398  scfx_rep &c = *new scfx_rep(a);
399  c.quantization(params, q_flag);
400  return &c;
401 }
402 
403 inline scfx_rep *
404 overflow_scfx_rep(const scfx_rep &a, const scfx_params &params, bool &o_flag)
405 {
406  scfx_rep& c = *new scfx_rep(a);
407  c.overflow(params, o_flag);
408  return &c;
409 }
410 
411 inline bool scfx_rep::rounding_flag() const { return m_r_flag; }
412 
413 inline void
414 scfx_rep::resize_to(int new_size, int restore)
415 {
416  if (restore == -1) {
417  int size_incr = new_size - size();
418  m_wp += size_incr;
419  m_msw += size_incr;
420  m_lsw += size_incr;
421  }
422  m_mant.resize_to(new_size, restore);
423 }
424 
425 inline const scfx_index
426 scfx_rep::calc_indices(int n) const
427 {
428  int wi = n / bits_in_word + m_wp;
429  int bi = n % bits_in_word;
430 
431  if (bi < 0) {
432  bi += bits_in_word;
433  -- wi;
434  }
435 
436  return scfx_index(wi, bi);
437 }
438 
439 inline void
440 scfx_rep::o_extend(const scfx_index &x, sc_enc enc)
441 {
442  int wi = x.wi();
443  int bi = x.bi();
444 
445  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
446 
447  if (enc == SC_US_ || (m_mant[wi] & (((word)1) << bi)) == 0) {
448  if (bi != bits_in_word - 1)
449  m_mant[wi] &= ~(((word)-1) << (bi + 1));
450  for (int i = wi + 1; i < size(); ++i)
451  m_mant[i] = 0;
452  m_sign = 1;
453  } else {
454  if (bi != bits_in_word - 1)
455  m_mant[wi] |= (((word)-1) << (bi + 1));
456  for (int i = wi + 1; i < size(); ++i)
457  m_mant[i] = static_cast<word>(-1);
458  m_sign = -1;
459  }
460 }
461 
462 inline bool
463 scfx_rep::o_bit_at(const scfx_index &x) const
464 {
465  int wi = x.wi();
466  int bi = x.bi();
467 
468  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
469 
470  return (m_mant[wi] & (((word)1) << bi)) != 0;
471 }
472 
473 inline bool
474 scfx_rep::o_zero_left(const scfx_index &x) const
475 {
476  int wi = x.wi();
477  int bi = x.bi();
478 
479  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
480 
481  bool zero = true;
482  if (bi != bits_in_word - 1)
483  zero = (m_mant[wi] & (((word)-1) << (bi + 1))) == 0;
484  for (int i = wi + 1; i < size(); ++i)
485  zero = zero && m_mant[i] == 0;
486 
487  return zero;
488 }
489 
490 inline bool
491 scfx_rep::o_zero_right(const scfx_index &x) const
492 {
493  int wi = x.wi();
494  int bi = x.bi();
495 
496  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
497 
498  bool zero = (m_mant[wi] & ~(((word)-1) << bi)) == 0;
499  for (int i = wi - 1; i >= 0; --i)
500  zero = zero && m_mant[i] == 0;
501 
502  return zero;
503 }
504 
505 inline void
507 {
508  int wi = x.wi();
509  int bi = x.bi();
510 
511  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
512 
513  m_mant.clear();
514 
515  if (enc == SC_TC_) {
516  m_mant[wi] |= (((word)1) << bi);
517  m_sign = -1;
518  } else {
519  m_sign = 1;
520  }
521 }
522 
523 inline void
524 scfx_rep::o_set_high(const scfx_index &x, const scfx_index &x2,
525  sc_enc enc, int sign)
526 {
527  int wi = x.wi();
528  int bi = x.bi();
529  int wi2 = x2.wi();
530  int bi2 = x2.bi();
531 
532  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
533  SC_ASSERT_(wi2 >= 0 && wi2 < size(), "word index out of range");
534 
535  int i;
536 
537  for (i = 0; i < size(); ++i)
538  m_mant[i] = static_cast<word>(-1);
539 
540  m_mant[wi] &= ~(((word)-1) << bi);
541  for (i = wi + 1; i < size(); ++i)
542  m_mant[i] = 0;
543 
544  m_mant[wi2] &= (((word)-1) << bi2);
545  for (i = wi2 - 1; i >= 0; --i)
546  m_mant[i] = 0;
547 
548  if (enc == SC_TC_) {
549  m_sign = sign;
550  } else {
551  m_mant[wi] |= (((word)1) << bi);
552  m_sign = 1;
553  }
554 }
555 
556 inline void
557 scfx_rep::o_set(const scfx_index &x, const scfx_index &x3, sc_enc enc,
558  bool under)
559 {
560  int wi = x.wi();
561  int bi = x.bi();
562  int wi3 = x3.wi();
563  int bi3 = x3.bi();
564 
565  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
566  SC_ASSERT_(wi3 >= 0 && wi3 < size(), "word index out of range");
567 
568  if (bi3 != bits_in_word - 1) {
569  if (under)
570  m_mant[wi3] &= ~(((word)-1) << (bi3 + 1));
571  else
572  m_mant[wi3] |= (((word)-1) << (bi3 + 1));
573  }
574  for (int i = wi3 + 1; i < size(); ++i) {
575  if (under)
576  m_mant[i] = 0;
577  else
578  m_mant[i] = static_cast<word>(-1);
579  }
580 
581  if (enc == SC_TC_) {
582  if (under)
583  m_mant[wi] |= (((word)1) << bi);
584  else
585  m_mant[wi] &= ~(((word)1) << bi);
586  }
587 }
588 
589 inline void
591 {
592  int wi2 = x2.wi();
593  int bi2 = x2.bi();
594 
595  m_mant[wi2] ^= (((word)-1) << bi2);
596  for (int i = wi2 + 1; i < size(); ++i)
597  m_mant[i] = ~ m_mant[i];
598 }
599 
600 inline bool
601 scfx_rep::q_bit(const scfx_index &x) const
602 {
603  int wi = x.wi();
604  int bi = x.bi();
605 
606  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
607 
608  if (bi != 0)
609  return (m_mant[wi] & (((word)1) << (bi - 1))) != 0;
610  else if (wi != 0)
611  return (m_mant[wi - 1] & (((word)1) << (bits_in_word - 1))) != 0;
612  else
613  return false;
614 }
615 
616 inline void
617 scfx_rep::q_clear(const scfx_index &x)
618 {
619  int wi = x.wi();
620  int bi = x.bi();
621 
622  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
623 
624  m_mant[wi] &= (((word)-1) << bi);
625  for (int i = wi - 1; i >= 0; --i)
626  m_mant[i] = 0;
627 }
628 
629 inline void
631 {
632  int wi = x.wi();
633  int bi = x.bi();
634 
635  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
636 
637  word old_val = m_mant[wi];
638  m_mant[wi] += (((word)1) << bi);
639  if (m_mant[wi] <= old_val) {
640  if (wi + 1 == size())
641  resize_to(size() + 1, 1);
642 
643  for (int i = wi + 1; i < size(); ++i) {
644  if (++m_mant[i] != 0)
645  break;
646  }
647  }
648 }
649 
650 inline bool
651 scfx_rep::q_odd(const scfx_index &x) const
652 {
653  int wi = x.wi();
654  int bi = x.bi();
655 
656  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
657 
658  return (m_mant[wi] & (((word)1) << bi)) != 0;
659 }
660 
661 inline bool
663 {
664  int wi = x.wi();
665  int bi = x.bi();
666 
667  SC_ASSERT_(wi >= 0 && wi < size(), "word index out of range");
668 
669  bool zero;
670 
671  if (bi != 0) {
672  zero = (m_mant[wi] & ~(((word)-1) << (bi - 1))) == 0;
673  for (int i = wi - 1; i >= 0; --i)
674  zero = zero && m_mant[i] == 0;
675  } else if (wi != 0) {
676  zero = (m_mant[wi - 1] & ~( ((word)-1) << (bits_in_word - 1))) == 0;
677  for (int i = wi - 2; i >= 0; --i)
678  zero = zero && m_mant[i] == 0;
679  } else {
680  zero = true;
681  }
682 
683  return zero;
684 }
685 
686 inline int
687 scfx_rep::find_lsw() const
688 {
689  for (int i = 0; i < size(); i++) {
690  if (m_mant[i])
691  return i;
692  }
693  return 0;
694 }
695 
696 inline int
697 scfx_rep::find_msw() const
698 {
699  for (int i = size() - 1; i >= 0; i--) {
700  if (m_mant[i])
701  return i;
702  }
703  return 0;
704 }
705 
706 inline void
708 {
709  m_lsw = find_lsw();
710  m_msw = find_msw();
711 }
712 
713 inline void
715 {
716  if (is_neg()) {
718  inc(m_mant);
719  }
720 }
721 
722 } // namespace sc_dt
723 
724 #endif // __SYSTEMC_EXT_DT_FX_SCFX_REP_HH__
sc_dt::scfx_mant::clear
void clear()
Definition: scfx_mant.hh:227
sc_dt::add_scfx_rep
scfx_rep * add_scfx_rep(const scfx_rep &lhs, const scfx_rep &rhs, int max_wl)
Definition: scfx_rep.cc:1249
sc_dt::scfx_rep::m_lsw
int m_lsw
Definition: scfx_rep.hh:313
sc_dt::SC_DEFAULT_DIV_WL_
const int SC_DEFAULT_DIV_WL_
Definition: sc_fxdefs.hh:216
sc_dt::scfx_rep::multiply
friend void multiply(scfx_rep &, const scfx_rep &, const scfx_rep &, int)
Definition: scfx_rep.cc:1452
sc_dt::scfx_rep::normalize
void normalize(int)
Definition: scfx_rep.cc:2209
sc_dt::word
unsigned int word
Definition: scfx_mant.hh:96
sc_dt::scfx_rep::find_sw
void find_sw()
Definition: scfx_rep.hh:739
sc_dt::scfx_rep
Definition: scfx_rep.hh:169
sc_dt::scfx_rep::align
friend void align(const scfx_rep &, const scfx_rep &, int &, int &, scfx_mant_ref &, scfx_mant_ref &)
Definition: scfx_rep.cc:2083
sc_dt::scfx_rep::calc_indices
const scfx_index calc_indices(int) const
Definition: scfx_rep.hh:458
sc_dt::scfx_mant::size
int size() const
Definition: scfx_mant.hh:145
sc_dt
Definition: sc_bit.cc:67
sc_dt::scfx_rep::o_bit_at
bool o_bit_at(const scfx_index &) const
Definition: scfx_rep.hh:495
sc_dt::scfx_rep::print_dec
friend void print_dec(scfx_string &, const scfx_rep &, int, sc_fmt)
Definition: scfx_rep.cc:895
sc_dt::scfx_rep::set_zero
void set_zero(int=1)
Definition: scfx_rep.hh:321
sc_dt::cmp_scfx_rep
int cmp_scfx_rep(const scfx_rep &a, const scfx_rep &b)
Definition: scfx_rep.cc:1758
sc_dt::scfx_params
Definition: scfx_params.hh:98
sc_dt::scfx_rep::quantization
void quantization(const scfx_params &, bool &)
Definition: scfx_rep.cc:1811
sc_dt::div_scfx_rep
scfx_rep * div_scfx_rep(const scfx_rep &lhs, const scfx_rep &rhs, int div_wl)
Definition: scfx_rep.cc:1527
sc_dt::scfx_rep::scfx_rep
scfx_rep()
Definition: scfx_rep.cc:131
sc_dt::scfx_rep::clear
bool clear(int, const scfx_params &)
Definition: scfx_rep.cc:2429
gem5::ArmISA::f
Bitfield< 6 > f
Definition: misc_types.hh:67
sc_dt::scfx_rep::is_neg
bool is_neg() const
Definition: scfx_rep.hh:404
sc_dt::scfx_rep::infinity
@ infinity
Definition: scfx_rep.hh:174
sc_dt::scfx_rep::find_lsw
int find_lsw() const
Definition: scfx_rep.hh:719
sc_dt::scfx_rep::o_zero_left
bool o_zero_left(const scfx_index &) const
Definition: scfx_rep.hh:506
sc_dt::scfx_rep::find_msw
int find_msw() const
Definition: scfx_rep.hh:729
sc_dt::scfx_rep::m_state
state m_state
Definition: scfx_rep.hh:311
sc_dt::scfx_rep::~scfx_rep
~scfx_rep()
Definition: scfx_rep.hh:353
sc_dt::sc_bv_base
Definition: sc_bv_base.hh:105
gem5::ArmISA::a
Bitfield< 8 > a
Definition: misc_types.hh:65
sc_dt::scfx_rep::add_scfx_rep
friend scfx_rep * add_scfx_rep(const scfx_rep &, const scfx_rep &, int)
Definition: scfx_rep.cc:1249
sc_dt::scfx_index
Definition: scfx_rep.hh:147
sc_dt::scfx_rep::set_inf
void set_inf(int)
Definition: scfx_rep.hh:337
sc_dt::scfx_index::bi
int bi() const
Definition: scfx_rep.hh:153
sc_dt::scfx_rep::shift_right
void shift_right(int)
Definition: scfx_rep.cc:2336
sc_dt::scfx_rep::to_double
double to_double() const
Definition: scfx_rep.cc:754
sc_dt::scfx_rep::rshift
void rshift(int)
Definition: scfx_rep.cc:1656
sc_dt::sc_signed
Definition: sc_signed.hh:984
sc_dt::scfx_rep::round
void round(int)
Definition: scfx_rep.cc:2614
sc_dt::scfx_rep::m_msw
int m_msw
Definition: scfx_rep.hh:312
sc_dt::scfx_rep::overflow
void overflow(const scfx_params &, bool &)
Definition: scfx_rep.cc:1895
sc_dt::scfx_rep::shift_left
void shift_left(int)
Definition: scfx_rep.cc:2311
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:66
sc_dt::scfx_rep::from_string
void from_string(const char *, int)
Definition: scfx_rep.cc:421
sc_dt::sc_enc
sc_enc
Definition: sc_fxdefs.hh:70
gem5::PowerISA::bi
Bitfield< 20, 16 > bi
Definition: types.hh:80
sc_dt::scfx_string
Definition: scfx_string.hh:108
sc_dt::scfx_rep::overflow_scfx_rep
friend scfx_rep * overflow_scfx_rep(const scfx_rep &, const scfx_params &, bool &)
Definition: scfx_rep.hh:436
sc_dt::scfx_rep::normal
@ normal
Definition: scfx_rep.hh:173
sc_dt::scfx_rep::o_invert
void o_invert(const scfx_index &)
Definition: scfx_rep.hh:622
sc_dt::inc
void inc(scfx_mant &mant)
Definition: scfx_mant.hh:341
sc_dt::scfx_rep::set_nan
void set_nan()
Definition: scfx_rep.hh:330
sc_dt::scfx_rep::get_bit
bool get_bit(int) const
Definition: scfx_rep.cc:2360
sc_dt::scfx_index::m_bi
int m_bi
Definition: scfx_rep.hh:159
sc_dt::scfx_rep::cast
void cast(const scfx_params &, bool &, bool &)
Definition: scfx_rep.cc:2056
sc_dt::quantization_scfx_rep
scfx_rep * quantization_scfx_rep(const scfx_rep &a, const scfx_params &params, bool &q_flag)
Definition: scfx_rep.hh:427
sc_dt::scfx_rep::multiply_by_ten
void multiply_by_ten()
Definition: scfx_rep.cc:2178
sc_dt::complement
void complement(scfx_mant &target, const scfx_mant &source, int size)
Definition: scfx_mant.hh:329
sc_dt::scfx_rep::rsh_scfx_rep
friend scfx_rep * rsh_scfx_rep(const scfx_rep &, int)
Definition: scfx_rep.hh:395
sc_dt::scfx_rep::m_mant
scfx_mant m_mant
Definition: scfx_rep.hh:308
sc_dt::scfx_rep::divide_by_ten
unsigned int divide_by_ten()
Definition: scfx_rep.cc:2176
sc_dt::scfx_rep::operator=
void operator=(const scfx_rep &)
Definition: scfx_rep.hh:357
sc_dt::scfx_rep::set_hex
void set_hex(int, int)
Definition: scfx_rep.cc:2284
sc_dt::scfx_rep::resize
scfx_mant * resize(int, int) const
Definition: scfx_rep.cc:2231
sc_dt::scfx_rep::sub_scfx_rep
friend scfx_rep * sub_scfx_rep(const scfx_rep &, const scfx_rep &, int)
Definition: scfx_rep.cc:1358
gem5::ArmISA::b
Bitfield< 7 > b
Definition: misc_types.hh:381
sc_dt::sc_fmt
sc_fmt
Definition: sc_fxdefs.hh:164
sc_dt::uint64
uint64_t uint64
Definition: sc_nbdefs.hh:206
sc_dt::SC_DEFAULT_CTE_WL_
const int SC_DEFAULT_CTE_WL_
Definition: sc_fxdefs.hh:222
sc_dt::scfx_rep::dump
void dump(::std::ostream &) const
Definition: scfx_rep.cc:2526
sc_dt::scfx_mant::resize_to
void resize_to(int, int=0)
Definition: scfx_mant.hh:235
sc_dt::neg_scfx_rep
scfx_rep * neg_scfx_rep(const scfx_rep &)
Definition: scfx_rep.hh:371
sc_dt::scfx_rep::neg_scfx_rep
friend scfx_rep * neg_scfx_rep(const scfx_rep &)
Definition: scfx_rep.hh:371
sc_dt::min_mant
const int min_mant
Definition: scfx_rep.hh:137
sc_dt::scfx_rep::set_bin
void set_bin(int)
Definition: scfx_rep.cc:2252
sc_dt::scfx_rep::q_clear
void q_clear(const scfx_index &)
Definition: scfx_rep.hh:649
sc_dt::scfx_rep::not_a_number
@ not_a_number
Definition: scfx_rep.hh:175
sc_dt::bits_in_word
const int bits_in_word
Definition: scfx_rep.hh:140
gem5::ArmISA::s
Bitfield< 4 > s
Definition: misc_types.hh:561
sc_dt::scfx_rep::to_uint64
uint64 to_uint64() const
Definition: scfx_rep.cc:866
sc_dt::scfx_rep::set
bool set(int, const scfx_params &)
Definition: scfx_rep.cc:2390
sc_dt::scfx_rep::set_slice
bool set_slice(int, int, const scfx_params &, const sc_bv_base &)
Definition: scfx_rep.cc:2486
sc_dt::scfx_mant
Definition: scfx_mant.hh:107
sc_dt::scfx_rep::o_extend
void o_extend(const scfx_index &, sc_enc)
Definition: scfx_rep.hh:472
sc_dt::scfx_rep::is_nan
bool is_nan() const
Definition: scfx_rep.hh:420
sc_dt::scfx_rep::compare_abs
friend int compare_abs(const scfx_rep &, const scfx_rep &)
Definition: scfx_rep.cc:1689
sc_dt::int64
int64_t int64
Definition: sc_nbdefs.hh:205
gem5::ArmISA::c
Bitfield< 29 > c
Definition: misc_types.hh:53
sc_dt::scfx_rep::is_zero
bool is_zero() const
Definition: scfx_rep.hh:407
sc_dt::scfx_rep::print
void print(::std::ostream &) const
Definition: scfx_rep.cc:2515
sc_dt::scfx_rep::div_scfx_rep
friend scfx_rep * div_scfx_rep(const scfx_rep &, const scfx_rep &, int)
Definition: scfx_rep.cc:1527
sc_dt::scfx_rep::lshift
void lshift(int)
Definition: scfx_rep.cc:1625
sc_dt::scfx_rep::q_zero
bool q_zero(const scfx_index &) const
Definition: scfx_rep.hh:694
sc_dt::scfx_rep::q_incr
void q_incr(const scfx_index &)
Definition: scfx_rep.hh:662
sc_dt::scfx_rep::m_sign
int m_sign
Definition: scfx_rep.hh:310
sc_dt::scfx_rep::compare_msw_ff
friend int compare_msw_ff(const scfx_rep &lhs, const scfx_rep &rhs)
Definition: scfx_rep.cc:2127
sc_dt::scfx_rep::state
state
Definition: scfx_rep.hh:171
sc_dt::sc_numrep
sc_numrep
Definition: sc_nbdefs.hh:115
sc_dt::scfx_rep::q_bit
bool q_bit(const scfx_index &) const
Definition: scfx_rep.hh:633
sc_dt::SC_DEFAULT_MAX_WL_
const int SC_DEFAULT_MAX_WL_
Definition: sc_fxdefs.hh:228
sc_dt::scfx_index::m_wi
int m_wi
Definition: scfx_rep.hh:158
sc_dt::scfx_rep::to_string
const char * to_string(sc_numrep, int, sc_fmt, const scfx_params *=0) const
Definition: scfx_rep.cc:1172
sc_dt::scfx_rep::mult_scfx_rep
friend scfx_rep * mult_scfx_rep(const scfx_rep &, const scfx_rep &, int)
Definition: scfx_rep.hh:379
gem5::RiscvISA::x
Bitfield< 3 > x
Definition: pagetable.hh:73
sc_dt::scfx_rep::print_other
friend void print_other(scfx_string &, const scfx_rep &, sc_numrep, int, sc_fmt, const scfx_params *)
Definition: scfx_rep.cc:1019
sc_dt::scfx_index::scfx_index
scfx_index(int wi_, int bi_)
Definition: scfx_rep.hh:150
gem5::ArmISA::n
Bitfield< 31 > n
Definition: misc_types.hh:455
sc_dt::SC_TC_
@ SC_TC_
Definition: sc_fxdefs.hh:72
sc_dt::scfx_rep::resize_to
void resize_to(int, int=0)
Definition: scfx_rep.hh:446
sc_dt::mult_scfx_rep
scfx_rep * mult_scfx_rep(const scfx_rep &, const scfx_rep &, int max_wl=SC_DEFAULT_MAX_WL_)
Definition: scfx_rep.hh:379
sc_dt::scfx_rep::set_oct
void set_oct(int, int)
Definition: scfx_rep.cc:2263
sc_dt::sc_unsigned
Definition: sc_unsigned.hh:890
sc_dt::scfx_rep::is_inf
bool is_inf() const
Definition: scfx_rep.hh:422
sc_dt::scfx_rep::o_zero_right
bool o_zero_right(const scfx_index &) const
Definition: scfx_rep.hh:523
sc_dt::scfx_rep::toggle_tc
void toggle_tc()
Definition: scfx_rep.hh:746
sc_dt::bits_in_int
const int bits_in_int
Definition: scfx_rep.hh:139
sc_dt::scfx_rep::q_odd
bool q_odd(const scfx_index &) const
Definition: scfx_rep.hh:683
sc_dt::sub_scfx_rep
scfx_rep * sub_scfx_rep(const scfx_rep &lhs, const scfx_rep &rhs, int max_wl)
Definition: scfx_rep.cc:1358
scfx_mant.hh
sc_dt::multiply
void multiply(scfx_rep &result, const scfx_rep &lhs, const scfx_rep &rhs, int max_wl)
Definition: scfx_rep.cc:1452
sc_dt::scfx_rep::quantization_scfx_rep
friend scfx_rep * quantization_scfx_rep(const scfx_rep &, const scfx_params &, bool &)
Definition: scfx_rep.hh:427
sc_dt::scfx_rep::is_normal
bool is_normal() const
Definition: scfx_rep.hh:424
sc_dt::scfx_rep::compare_msw
friend int compare_msw(const scfx_rep &, const scfx_rep &)
sc_dt::lsh_scfx_rep
scfx_rep * lsh_scfx_rep(const scfx_rep &, int)
Definition: scfx_rep.hh:387
sc_dt::scfx_index::wi
int wi() const
Definition: scfx_rep.hh:152
sc_dt::scfx_rep::size
int size() const
Definition: scfx_rep.hh:402
sc_dt::overflow_scfx_rep
scfx_rep * overflow_scfx_rep(const scfx_rep &a, const scfx_params &params, bool &o_flag)
Definition: scfx_rep.hh:436
scfx_params.hh
sc_dt::scfx_rep::cmp_scfx_rep
friend int cmp_scfx_rep(const scfx_rep &, const scfx_rep &)
Definition: scfx_rep.cc:1758
scfx_string.hh
sc_dt::scfx_mant_ref
Definition: scfx_mant.hh:356
sc_dt::scfx_rep::m_wp
int m_wp
Definition: scfx_rep.hh:309
sc_dt::scfx_rep::rounding_flag
bool rounding_flag() const
Definition: scfx_rep.hh:443
sc_dt::scfx_rep::o_set_low
void o_set_low(const scfx_index &, sc_enc)
Definition: scfx_rep.hh:538
sc_dt::rsh_scfx_rep
scfx_rep * rsh_scfx_rep(const scfx_rep &, int)
Definition: scfx_rep.hh:395
sc_dt::scfx_rep::get_type
void get_type(int &, int &, sc_enc &) const
Definition: scfx_rep.cc:2570
SC_ASSERT_
#define SC_ASSERT_(cnd, msg)
Definition: sc_fxdefs.hh:248
sc_dt::scfx_rep::m_r_flag
bool m_r_flag
Definition: scfx_rep.hh:314
sc_dt::scfx_rep::o_set
void o_set(const scfx_index &, const scfx_index &, sc_enc, bool)
Definition: scfx_rep.hh:589
sc_dt::scfx_rep::o_set_high
void o_set_high(const scfx_index &, const scfx_index &, sc_enc, int=1)
Definition: scfx_rep.hh:556
sc_dt::scfx_rep::lsh_scfx_rep
friend scfx_rep * lsh_scfx_rep(const scfx_rep &, int)
Definition: scfx_rep.hh:387
sc_dt::scfx_rep::get_slice
bool get_slice(int, int, const scfx_params &, sc_bv_base &) const
Definition: scfx_rep.cc:2465
sc_dt::SC_US_
@ SC_US_
Definition: sc_fxdefs.hh:73

Generated on Tue Sep 21 2021 12:25:53 for gem5 by doxygen 1.8.17