gem5  v20.1.0.0
sc_bigint.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  sc_bigint.h -- Template version of sc_signed. This class enables
23  compile-time bit widths for sc_signed numbers.
24 
25  Original Author: Ali Dasdan, 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: Gene Bushayev, Synopsys, Inc.
35  Description of Modification: - Interface between sc_bigint and sc_bv/sc_lv.
36 
37  Name, Affiliation, Date:
38  Description of Modification:
39 
40  *****************************************************************************/
41 
42 // $Log: sc_bigint.h,v $
43 // Revision 1.2 2011/02/18 20:19:14 acg
44 // Andy Goodrich: updating Copyright notice.
45 //
46 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
47 // SystemC 2.3
48 //
49 // Revision 1.3 2006/01/13 18:49:31 acg
50 // Added $Log command so that CVS check in comments are reproduced in the
51 // source.
52 //
53 
54 #ifndef __SYSTEMC_EXT_DT_INT_SC_BIGINT_HH__
55 #define __SYSTEMC_EXT_DT_INT_SC_BIGINT_HH__
56 
57 #include "sc_signed.hh"
58 #include "sc_unsigned.hh"
59 
60 namespace sc_dt
61 {
62 
63 // classes defined in this module
64 template <int W>
65 class sc_bigint;
66 
67 // forward class declarations
68 class sc_bv_base;
69 class sc_lv_base;
70 class sc_fxval;
71 class sc_fxval_fast;
72 class sc_fxnum;
73 class sc_fxnum_fast;
74 
75 
76 // ----------------------------------------------------------------------------
77 // CLASS TEMPLATE : sc_bigint<W>
78 //
79 // Arbitrary size signed integer type.
80 // ----------------------------------------------------------------------------
81 
82 #ifdef SC_MAX_NBITS
83 template<int W=SC_MAX_NBITS>
84 #else
85 template<int W>
86 #endif
87 class sc_bigint : public sc_signed
88 {
89  public:
90  // constructors
91  sc_bigint() : sc_signed(W) {}
92  sc_bigint(const sc_bigint<W> &v) : sc_signed(W) { *this = v; }
93  sc_bigint(const sc_signed &v) : sc_signed(W) { *this = v; }
94  sc_bigint(const sc_signed_subref &v) : sc_signed(W) { *this = v; }
95 
96  template< class T >
97  sc_bigint(const sc_generic_base<T> &a) : sc_signed(W)
98  {
99  a->to_sc_signed(*this);
100  }
101 
102  sc_bigint(const sc_unsigned &v) : sc_signed(W) { *this = v; }
103  sc_bigint(const sc_unsigned_subref &v) : sc_signed(W) { *this = v; }
104  sc_bigint(const char *v) : sc_signed(W) { *this = v; }
105  sc_bigint(int64 v) : sc_signed(W) { *this = v; }
106  sc_bigint(uint64 v) : sc_signed(W) { *this = v; }
107  sc_bigint(long v) : sc_signed(W) { *this = v; }
108  sc_bigint(unsigned long v) : sc_signed(W) { *this = v; }
109  sc_bigint(int v) : sc_signed(W) { *this = v; }
110  sc_bigint(unsigned int v) : sc_signed(W) { *this = v; }
111  sc_bigint(double v) : sc_signed(W) { *this = v; }
112  sc_bigint(const sc_bv_base &v) : sc_signed(W) { *this = v; }
113  sc_bigint(const sc_lv_base &v) : sc_signed(W) { *this = v; }
114 
115  explicit sc_bigint(const sc_fxval &v) : sc_signed(W) { *this = v; }
116  explicit sc_bigint(const sc_fxval_fast &v) : sc_signed(W) { *this = v; }
117  explicit sc_bigint(const sc_fxnum &v) : sc_signed(W) { *this = v; }
118  explicit sc_bigint(const sc_fxnum_fast &v) : sc_signed(W) { *this = v; }
119 
120 #ifndef SC_MAX_NBITS
121  // destructor
122  ~sc_bigint() {}
123 #endif
124 
125  // assignment operators
128  {
130  return *this;
131  }
132 
133  sc_bigint<W> &
134  operator = (const sc_signed &v)
135  {
137  return *this;
138  }
139 
142  {
144  return *this;
145  }
146 
147  template< class T >
150  {
151  a->to_sc_signed(*this);
152  return *this;
153  }
154 
155  sc_bigint<W> &
156  operator = (const sc_unsigned &v)
157  {
159  return *this;
160  }
161 
164  {
166  return *this;
167  }
168 
170  operator = (const char *v)
171  {
173  return *this;
174  }
175 
178  {
180  return *this;
181  }
182 
183  sc_bigint<W> &
185  {
187  return *this;
188  }
189 
190  sc_bigint<W> &
192  {
194  return *this;
195  }
196 
197  sc_bigint<W> &
198  operator = (unsigned long v)
199  {
201  return *this;
202  }
203 
204  sc_bigint<W> &
206  {
208  return *this;
209  }
210 
211  sc_bigint<W> &
212  operator = (unsigned int v)
213  {
215  return *this;
216  }
217 
218  sc_bigint<W> &operator = (double v)
219  {
221  return *this;
222  }
223 
224 
225  sc_bigint<W> &
227  {
229  return *this;
230  }
231 
232  sc_bigint<W> &
234  {
236  return *this;
237  }
238 
239  sc_bigint<W> &
241  {
243  return *this;
244  }
245 
246  sc_bigint<W> &
248  {
250  return *this;
251  }
252 
254  operator = (const sc_fxval &v)
255  {
257  return *this;
258  }
259 
260  sc_bigint<W> &
262  {
264  return *this;
265  }
266 
267  sc_bigint<W> &
269  {
271  return *this;
272  }
273 
274  sc_bigint<W> &
276  {
278  return *this;
279  }
280 };
281 
282 } // namespace sc_dt
283 
284 #endif // __SYSTEMC_EXT_DT_INT_SC_BIGINT_HH__
sc_dt::sc_bigint
Definition: sc_bigint.hh:100
sc_dt
Definition: sc_bit.cc:67
sc_dt::sc_fxnum_fast
Definition: sc_fxnum.hh:844
sc_dt::sc_fxval
Definition: sc_fxval.hh:86
sc_dt::sc_bv_base
Definition: sc_bv_base.hh:105
sc_dt::sc_int_base
Definition: sc_int_base.hh:494
sc_dt::sc_signed
Definition: sc_signed.hh:984
ArmISA::a
Bitfield< 8 > a
Definition: miscregs_types.hh:62
sc_dt::uint64
uint64_t uint64
Definition: sc_nbdefs.hh:206
sc_dt::sc_signed_subref
Definition: sc_signed.hh:912
sc_dt::sc_fxnum
Definition: sc_fxnum.hh:483
sc_dt::int64
int64_t int64
Definition: sc_nbdefs.hh:205
sc_dt::sc_generic_base
Definition: sc_value_base.hh:145
sc_dt::sc_uint_base
Definition: sc_uint_base.hh:465
sc_signed.hh
sc_dt::sc_bigint::sc_bigint
sc_bigint()
Definition: sc_bigint.hh:126
sc_dt::sc_lv_base
Definition: sc_lv_base.hh:118
sc_fxval
#define sc_fxval
Definition: fx_precision_double.h:65
sc_unsigned.hh
sc_dt::sc_fxval_fast
Definition: sc_fxval.hh:376
sc_dt::sc_unsigned
Definition: sc_unsigned.hh:890
sc_dt::sc_bigint::~sc_bigint
~sc_bigint()
Definition: sc_bigint.hh:157
sc_dt::sc_unsigned_subref
Definition: sc_unsigned.hh:822
sc_dt::sc_bigint::operator=
sc_bigint< W > & operator=(const sc_bigint< W > &v)
Definition: sc_bigint.hh:162
sc_dt::sc_signed::operator=
const sc_signed & operator=(const sc_signed &v)
ArmISA::v
Bitfield< 28 > v
Definition: miscregs_types.hh:51

Generated on Wed Sep 30 2020 14:02:15 for gem5 by doxygen 1.8.17