gem5  v21.2.1.1
sc_uint.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_uint.h -- An unsigned integer whose length is less than 64 bits.
23 
24  Unlike arbitrary precision, arithmetic and bitwise operations
25  are performed using the native types (hence capped at 64 bits).
26  The sc_uint integer is useful when the user does not need
27  arbitrary precision and the performance is superior to
28  sc_bigint/sc_biguint.
29 
30  Original Author: Amit Rao, Synopsys, Inc.
31 
32  *****************************************************************************/
33 
34 /*****************************************************************************
35 
36  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
37  changes you are making here.
38 
39  Name, Affiliation, Date: Ali Dasdan, Synopsys, Inc.
40  Description of Modification: - Resolved ambiguity with sc_(un)signed.
41  - Merged the code for 64- and 32-bit versions
42  via the constants in sc_nbdefs.h.
43  - Eliminated redundant file inclusions.
44 
45  Name, Affiliation, Date:
46  Description of Modification:
47 
48  *****************************************************************************/
49 
50 // $Log: sc_uint.h,v $
51 // Revision 1.2 2011/02/18 20:19:15 acg
52 // Andy Goodrich: updating Copyright notice.
53 //
54 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
55 // SystemC 2.3
56 //
57 // Revision 1.3 2006/01/13 18:49:32 acg
58 // Added $Log command so that CVS check in comments are reproduced in the
59 // source.
60 //
61 
62 #ifndef __SYSTEMC_EXT_DT_INT_SC_UINT_HH__
63 #define __SYSTEMC_EXT_DT_INT_SC_UINT_HH__
64 
65 #include "sc_uint_base.hh"
66 
67 namespace sc_dt
68 {
69 
70 // classes defined in this module
71 template <int W>
72 class sc_uint;
73 
74 
75 // ----------------------------------------------------------------------------
76 // CLASS TEMPLATE : sc_uint<W>
77 //
78 // Template class sc_uint<W> is the interface that the user sees. It
79 // is derived from sc_uint_base and most of its methods are just
80 // wrappers that call the corresponding method in the parent
81 // class. Note that the length of sc_uint datatype is specified as a
82 // template parameter.
83 // ----------------------------------------------------------------------------
84 
85 template <int W>
86 class sc_uint : public sc_uint_base
87 {
88  public:
89  // constructors
90  sc_uint() : sc_uint_base(W) {}
91  sc_uint(uint_type v) : sc_uint_base(v, W) {}
92  sc_uint(const sc_uint<W> &a) : sc_uint_base(a) {}
93  sc_uint(const sc_uint_base &a) : sc_uint_base(W)
94  {
96  }
97  sc_uint(const sc_uint_subref_r &a) : sc_uint_base(W)
98  {
100  }
101  template< class T >
102  sc_uint(const sc_generic_base<T> &a) : sc_uint_base(W)
103  {
105  }
106  sc_uint(const sc_signed &a) : sc_uint_base(W)
107  {
109  }
110  sc_uint(const sc_unsigned &a) : sc_uint_base(W)
111  {
113  }
114  explicit sc_uint(const sc_fxval &a) : sc_uint_base(W)
115  {
117  }
118  explicit sc_uint(const sc_fxval_fast &a) : sc_uint_base(W)
119  {
121  }
122  explicit sc_uint(const sc_fxnum &a) : sc_uint_base(W)
123  {
125  }
126  explicit sc_uint(const sc_fxnum_fast &a) : sc_uint_base(W)
127  {
129  }
130  sc_uint(const sc_bv_base &a) : sc_uint_base(W)
131  {
133  }
135  {
137  }
138  sc_uint(const char* a) : sc_uint_base(W)
139  {
141  }
142  sc_uint(unsigned long a) : sc_uint_base(W)
143  {
145  }
146  sc_uint(long a) : sc_uint_base(W)
147  {
149  }
150  sc_uint(unsigned int a) : sc_uint_base(W)
151  {
153  }
154  sc_uint(int a) : sc_uint_base(W)
155  {
157  }
159  {
161  }
162  sc_uint(double a) : sc_uint_base(W)
163  {
165  }
166 
167  // assignment operators
168  sc_uint<W> &
170  {
172  return *this;
173  }
174  sc_uint<W> &
175  operator = (const sc_uint_base &a)
176  {
178  return *this;
179  }
180  sc_uint<W> &
182  {
184  return *this;
185  }
186  sc_uint<W> &
187  operator = (const sc_uint<W> &a)
188  {
189  m_val = a.m_val;
190  return *this;
191  }
192  template<class T>
195  {
197  return *this;
198  }
199  sc_uint<W> &
200  operator = (const sc_signed &a)
201  {
203  return *this;
204  }
206  operator = (const sc_unsigned &a)
207  {
209  return *this;
210  }
211  sc_uint<W> &
213  {
215  return *this;
216  }
217  sc_uint<W> &
219  {
221  return *this;
222  }
223  sc_uint<W> &
225  {
227  return *this;
228  }
229  sc_uint<W> &
231  {
233  return *this;
234  }
235  sc_uint<W> &
236  operator = (const sc_bv_base &a)
237  {
239  return *this;
240  }
241  sc_uint<W> &
242  operator = (const sc_lv_base &a)
243  {
245  return *this;
246  }
247  sc_uint<W> &
248  operator = (const char* a)
249  {
251  return *this;
252  }
253  sc_uint<W> &
254  operator = (unsigned long a)
255  {
257  return *this;
258  }
259  sc_uint<W> &
260  operator = (long a)
261  {
263  return *this;
264  }
265  sc_uint<W> &
266  operator = (unsigned int a)
267  {
269  return *this;
270  }
271  sc_uint<W> &
272  operator = (int a)
273  {
275  return *this;
276  }
277  sc_uint<W> &
279  {
281  return *this;
282  }
283  sc_uint<W> &
284  operator = (double a)
285  {
287  return *this;
288  }
289 
290  // arithmetic assignment operators
293  {
295  return *this;
296  }
299  {
301  return *this;
302  }
305  {
307  return *this;
308  }
311  {
313  return *this;
314  }
317  {
319  return *this;
320  }
321 
322  // bitwise assignment operators
323  sc_uint<W> &
325  {
327  return *this;
328  }
329  sc_uint<W> &
331  {
333  return *this;
334  }
337  {
339  return *this;
340  }
341 
342  sc_uint<W> &
344  {
346  return *this;
347  }
348  sc_uint<W> &
350  {
352  return *this;
353  }
354 
355  // prefix and postfix increment and decrement operators
356  sc_uint<W> &
357  operator ++ () // prefix
358  {
360  return *this;
361  }
362  const sc_uint<W>
363  operator ++ ( int ) // postfix
364  {
365  return sc_uint<W>(sc_uint_base::operator ++ (0));
366  }
368  operator -- () // prefix
369  {
371  return *this;
372  }
374  operator -- (int) // postfix
375  {
376  return sc_uint<W>(sc_uint_base::operator -- (0));
377  }
378 };
379 
380 } // namespace sc_dt
381 
382 #endif // __SYSTEMC_EXT_DT_INT_SC_UINT_HH__
sc_dt::sc_uint_base::operator^=
sc_uint_base & operator^=(uint_type v)
Definition: sc_uint_base.hh:692
sc_dt::sc_uint::operator--
sc_uint< W > & operator--()
Definition: sc_uint.hh:411
sc_dt::sc_uint_base::operator%=
sc_uint_base & operator%=(uint_type v)
Definition: sc_uint_base.hh:669
sc_dt
Definition: sc_bit.cc:67
sc_dt::sc_uint::operator-=
sc_uint< W > & operator-=(uint_type v)
Definition: sc_uint.hh:341
sc_dt::sc_uint_subref_r
Definition: sc_uint_base.hh:275
sc_dt::uint_type
uint64 uint_type
Definition: sc_nbdefs.hh:241
sc_dt::sc_uint_base::operator*=
sc_uint_base & operator*=(uint_type v)
Definition: sc_uint_base.hh:655
sc_dt::sc_uint_base::operator>>=
sc_uint_base & operator>>=(uint_type v)
Definition: sc_uint_base.hh:706
sc_dt::sc_fxnum_fast
Definition: sc_fxnum.hh:844
sc_dt::sc_uint::operator|=
sc_uint< W > & operator|=(uint_type v)
Definition: sc_uint.hh:373
sc_dt::sc_fxval
Definition: sc_fxval.hh:86
sc_dt::sc_bv_base
Definition: sc_bv_base.hh:105
sc_dt::sc_uint_base::operator&=
sc_uint_base & operator&=(uint_type v)
Definition: sc_uint_base.hh:678
sc_dt::sc_uint_base::operator++
sc_uint_base & operator++()
Definition: sc_uint_base.hh:715
gem5::ArmISA::a
Bitfield< 8 > a
Definition: misc_types.hh:66
sc_dt::sc_uint::operator/=
sc_uint< W > & operator/=(uint_type v)
Definition: sc_uint.hh:353
sc_dt::sc_uint::operator>>=
sc_uint< W > & operator>>=(uint_type v)
Definition: sc_uint.hh:392
sc_dt::sc_uint::operator<<=
sc_uint< W > & operator<<=(uint_type v)
Definition: sc_uint.hh:386
sc_dt::sc_signed
Definition: sc_signed.hh:984
sc_dt::sc_uint_base::operator/=
sc_uint_base & operator/=(uint_type v)
Definition: sc_uint_base.hh:662
sc_dt::sc_uint_base::operator=
sc_uint_base & operator=(uint_type v)
Definition: sc_uint_base.hh:559
sc_dt::sc_uint
Definition: sc_uint.hh:115
gem5::ArmISA::v
Bitfield< 28 > v
Definition: misc_types.hh:54
sc_dt::sc_fxnum
Definition: sc_fxnum.hh:483
sc_dt::sc_uint_base::operator-=
sc_uint_base & operator-=(uint_type v)
Definition: sc_uint_base.hh:648
sc_uint_base.hh
sc_dt::sc_uint::sc_uint
sc_uint()
Definition: sc_uint.hh:133
sc_dt::int64
int64_t int64
Definition: sc_nbdefs.hh:205
sc_dt::sc_uint::operator+=
sc_uint< W > & operator+=(uint_type v)
Definition: sc_uint.hh:335
sc_dt::sc_generic_base
Definition: sc_value_base.hh:145
sc_dt::sc_uint_base::operator+=
sc_uint_base & operator+=(uint_type v)
Definition: sc_uint_base.hh:641
sc_dt::sc_uint::operator&=
sc_uint< W > & operator&=(uint_type v)
Definition: sc_uint.hh:367
sc_dt::sc_uint_base
Definition: sc_uint_base.hh:465
sc_dt::sc_uint_base::operator--
sc_uint_base & operator--()
Definition: sc_uint_base.hh:731
sc_dt::sc_uint::operator*=
sc_uint< W > & operator*=(uint_type v)
Definition: sc_uint.hh:347
sc_dt::sc_lv_base
Definition: sc_lv_base.hh:118
sc_dt::sc_uint::sc_uint
sc_uint(uint_type v)
Definition: sc_uint.hh:134
sc_dt::sc_uint::operator++
sc_uint< W > & operator++()
Definition: sc_uint.hh:400
sc_fxval
#define sc_fxval
Definition: fx_precision_double.h:65
sc_dt::sc_uint::operator%=
sc_uint< W > & operator%=(uint_type v)
Definition: sc_uint.hh:359
sc_dt::sc_fxval_fast
Definition: sc_fxval.hh:376
sc_dt::sc_uint::operator^=
sc_uint< W > & operator^=(uint_type v)
Definition: sc_uint.hh:379
sc_dt::sc_uint::operator=
sc_uint< W > & operator=(uint_type v)
Definition: sc_uint.hh:212
sc_dt::sc_unsigned
Definition: sc_unsigned.hh:890
sc_dt::sc_uint_base::operator<<=
sc_uint_base & operator<<=(uint_type v)
Definition: sc_uint_base.hh:699
sc_dt::sc_uint_base::operator|=
sc_uint_base & operator|=(uint_type v)
Definition: sc_uint_base.hh:685

Generated on Wed May 4 2022 12:14:05 for gem5 by doxygen 1.8.17