gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
67namespace sc_dt
68{
69
70// classes defined in this module
71template <int W>
72class 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
85template <int W>
86class sc_uint : public sc_uint_base
87{
88 public:
89 // constructors
101 template< class T >
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 }
138 sc_uint(const char* a) : sc_uint_base(W)
139 {
141 }
142 sc_uint(unsigned long a) : sc_uint_base(W)
143 {
145 }
147 {
149 }
150 sc_uint(unsigned int a) : sc_uint_base(W)
151 {
153 }
155 {
157 }
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> &
176 {
178 return *this;
179 }
180 sc_uint<W> &
182 {
184 return *this;
185 }
186 sc_uint<W> &
188 {
189 m_val = a.m_val;
190 return *this;
191 }
192 template<class T>
193 sc_uint<W> &
195 {
197 return *this;
198 }
199 sc_uint<W> &
201 {
203 return *this;
204 }
205 sc_uint<W> &
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> &
237 {
239 return *this;
240 }
241 sc_uint<W> &
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> &
261 {
263 return *this;
264 }
265 sc_uint<W> &
266 operator = (unsigned int a)
267 {
269 return *this;
270 }
271 sc_uint<W> &
273 {
275 return *this;
276 }
277 sc_uint<W> &
279 {
281 return *this;
282 }
283 sc_uint<W> &
285 {
287 return *this;
288 }
289
290 // arithmetic assignment operators
291 sc_uint<W> &
293 {
295 return *this;
296 }
297 sc_uint<W> &
299 {
301 return *this;
302 }
303 sc_uint<W> &
305 {
307 return *this;
308 }
309 sc_uint<W> &
311 {
313 return *this;
314 }
315 sc_uint<W> &
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 }
335 sc_uint<W> &
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 }
367 sc_uint<W> &
368 operator -- () // prefix
369 {
371 return *this;
372 }
373 const sc_uint<W>
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_uint_base & operator++()
sc_uint_base & operator>>=(uint_type v)
sc_uint_base & operator/=(uint_type v)
sc_uint_base & operator=(uint_type v)
sc_uint_base & operator%=(uint_type v)
sc_uint_base & operator<<=(uint_type v)
sc_uint_base & operator^=(uint_type v)
sc_uint_base & operator+=(uint_type v)
sc_uint_base & operator*=(uint_type v)
sc_uint_base & operator--()
sc_uint_base & operator|=(uint_type v)
sc_uint_base & operator-=(uint_type v)
sc_uint_base & operator&=(uint_type v)
sc_uint< W > & operator/=(uint_type v)
Definition sc_uint.hh:310
sc_uint< W > & operator&=(uint_type v)
Definition sc_uint.hh:324
sc_uint(const sc_uint_subref_r &a)
Definition sc_uint.hh:97
sc_uint(int64 a)
Definition sc_uint.hh:158
sc_uint< W > & operator%=(uint_type v)
Definition sc_uint.hh:316
sc_uint(const sc_signed &a)
Definition sc_uint.hh:106
sc_uint(double a)
Definition sc_uint.hh:162
sc_uint< W > & operator--()
Definition sc_uint.hh:368
sc_uint(const sc_fxnum_fast &a)
Definition sc_uint.hh:126
sc_uint< W > & operator*=(uint_type v)
Definition sc_uint.hh:304
sc_uint(const sc_fxval &a)
Definition sc_uint.hh:114
sc_uint(const sc_fxval_fast &a)
Definition sc_uint.hh:118
sc_uint(unsigned long a)
Definition sc_uint.hh:142
sc_uint(const sc_generic_base< T > &a)
Definition sc_uint.hh:102
sc_uint(const sc_bv_base &a)
Definition sc_uint.hh:130
sc_uint(const sc_uint_base &a)
Definition sc_uint.hh:93
sc_uint< W > & operator|=(uint_type v)
Definition sc_uint.hh:330
sc_uint< W > & operator^=(uint_type v)
Definition sc_uint.hh:336
sc_uint< W > & operator-=(uint_type v)
Definition sc_uint.hh:298
sc_uint(const sc_uint< W > &a)
Definition sc_uint.hh:92
sc_uint(const sc_fxnum &a)
Definition sc_uint.hh:122
sc_uint(uint_type v)
Definition sc_uint.hh:91
sc_uint(unsigned int a)
Definition sc_uint.hh:150
sc_uint< W > & operator+=(uint_type v)
Definition sc_uint.hh:292
sc_uint< W > & operator>>=(uint_type v)
Definition sc_uint.hh:349
sc_uint(const char *a)
Definition sc_uint.hh:138
sc_uint(int a)
Definition sc_uint.hh:154
sc_uint(const sc_lv_base &a)
Definition sc_uint.hh:134
sc_uint< W > & operator=(uint_type v)
Definition sc_uint.hh:169
sc_uint(const sc_unsigned &a)
Definition sc_uint.hh:110
sc_uint(long a)
Definition sc_uint.hh:146
sc_uint< W > & operator<<=(uint_type v)
Definition sc_uint.hh:343
sc_uint< W > & operator++()
Definition sc_uint.hh:357
SwitchingFiber a
int64_t int64
Definition sc_nbdefs.hh:171
uint64 uint_type
Definition sc_nbdefs.hh:207

Generated on Tue Jun 18 2024 16:24:06 for gem5 by doxygen 1.11.0