SystemC  2.3.1
Accellera SystemC proof-of-concept library
sc_biguint.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  sc_biguint.h -- Template version of sc_unsigned. This class
21  enables compile-time bit widths for sc_unsigned numbers.
22 
23  Original Author: Ali Dasdan, Synopsys, Inc.
24 
25  *****************************************************************************/
26 
27 /*****************************************************************************
28 
29  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
30  changes you are making here.
31 
32  Name, Affiliation, Date: Gene Bushayev, Synopsys, Inc.
33  Description of Modification: - Interface between sc_bigint and sc_bv/sc_lv.
34 
35  Name, Affiliation, Date:
36  Description of Modification:
37 
38  *****************************************************************************/
39 
40 // $Log: sc_biguint.h,v $
41 // Revision 1.2 2011/02/18 20:19:14 acg
42 // Andy Goodrich: updating Copyright notice.
43 //
44 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
45 // SystemC 2.3
46 //
47 // Revision 1.3 2006/01/13 18:49:31 acg
48 // Added $Log command so that CVS check in comments are reproduced in the
49 // source.
50 //
51 
52 #ifndef SC_BIGUINT_H
53 #define SC_BIGUINT_H
54 
55 
58 
59 namespace sc_dt
60 {
61 
62 // classes defined in this module
63 template <int W> class sc_biguint;
64 
65 // forward class declarations
66 class sc_bv_base;
67 class sc_lv_base;
68 class sc_fxval;
69 class sc_fxval_fast;
70 class sc_fxnum;
71 class sc_fxnum_fast;
72 
73 
74 // ----------------------------------------------------------------------------
75 // CLASS TEMPLATE : sc_biguint<W>
76 //
77 // Arbitrary size unsigned integer type.
78 // ----------------------------------------------------------------------------
79 
80 #ifdef SC_MAX_NBITS
81 template< int W = SC_MAX_NBITS >
82 #else
83 template< int W >
84 #endif
85 class sc_biguint
86  : public sc_unsigned
87 {
88 public:
89 
90  // constructors
91 
93  : sc_unsigned( W )
94  {}
95 
97  : sc_unsigned( W )
98  { *this = v; }
99 
101  : sc_unsigned( W )
102  { *this = v; }
103 
105  : sc_unsigned( W )
106  { *this = v; }
107 
108  template< class T >
110  : sc_unsigned( W )
111  { a->to_sc_unsigned(*this); }
112 
113  sc_biguint( const sc_signed& v )
114  : sc_unsigned( W )
115  { *this = v; }
116 
118  : sc_unsigned( W )
119  { *this = v; }
120 
121  sc_biguint( const char* v )
122  : sc_unsigned( W )
123  { *this = v; }
124 
126  : sc_unsigned( W )
127  { *this = v; }
128 
130  : sc_unsigned( W )
131  { *this = v; }
132 
133  sc_biguint( long v )
134  : sc_unsigned( W )
135  { *this = v; }
136 
137  sc_biguint( unsigned long v )
138  : sc_unsigned( W )
139  { *this = v; }
140 
141  sc_biguint( int v )
142  : sc_unsigned( W )
143  { *this = v; }
144 
145  sc_biguint( unsigned int v )
146  : sc_unsigned( W )
147  { *this = v; }
148 
149  sc_biguint( double v )
150  : sc_unsigned( W )
151  { *this = v; }
152 
153  sc_biguint( const sc_bv_base& v )
154  : sc_unsigned( W )
155  { *this = v; }
156 
157  sc_biguint( const sc_lv_base& v )
158  : sc_unsigned( W )
159  { *this = v; }
160 
161 #ifdef SC_INCLUDE_FX
162 
163  explicit sc_biguint( const sc_fxval& v )
164  : sc_unsigned( W )
165  { *this = v; }
166 
167  explicit sc_biguint( const sc_fxval_fast& v )
168  : sc_unsigned( W )
169  { *this = v; }
170 
171  explicit sc_biguint( const sc_fxnum& v )
172  : sc_unsigned( W )
173  { *this = v; }
174 
175  explicit sc_biguint( const sc_fxnum_fast& v )
176  : sc_unsigned( W )
177  { *this = v; }
178 
179 #endif
180 
181 
182 #ifndef SC_MAX_NBITS
183 
184  // destructor
185 
187  {}
188 
189 #endif
190 
191 
192  // assignment operators
193 
195  { sc_unsigned::operator = ( v ); return *this; }
196 
198  { sc_unsigned::operator = ( v ); return *this; }
199 
201  { sc_unsigned::operator = ( v ); return *this; }
202 
203  template< class T >
205  { a->to_sc_unsigned(*this); return *this; }
206 
208  { sc_unsigned::operator = ( v ); return *this; }
209 
211  { sc_unsigned::operator = ( v ); return *this; }
212 
213  sc_biguint<W>& operator = ( const char* v )
214  { sc_unsigned::operator = ( v ); return *this; }
215 
217  { sc_unsigned::operator = ( v ); return *this; }
218 
220  { sc_unsigned::operator = ( v ); return *this; }
221 
223  { sc_unsigned::operator = ( v ); return *this; }
224 
225  sc_biguint<W>& operator = ( unsigned long v )
226  { sc_unsigned::operator = ( v ); return *this; }
227 
229  { sc_unsigned::operator = ( v ); return *this; }
230 
231  sc_biguint<W>& operator = ( unsigned int v )
232  { sc_unsigned::operator = ( v ); return *this; }
233 
235  { sc_unsigned::operator = ( v ); return *this; }
236 
237 
239  { sc_unsigned::operator = ( v ); return *this; }
240 
242  { sc_unsigned::operator = ( v ); return *this; }
243 
245  { sc_unsigned::operator = ( v ); return *this; }
246 
248  { sc_unsigned::operator = ( v ); return *this; }
249 
250 #ifdef SC_INCLUDE_FX
251 
252  sc_biguint<W>& operator = ( const sc_fxval& v )
253  { sc_unsigned::operator = ( v ); return *this; }
254 
255  sc_biguint<W>& operator = ( const sc_fxval_fast& v )
256  { sc_unsigned::operator = ( v ); return *this; }
257 
258  sc_biguint<W>& operator = ( const sc_fxnum& v )
259  { sc_unsigned::operator = ( v ); return *this; }
260 
261  sc_biguint<W>& operator = ( const sc_fxnum_fast& v )
262  { sc_unsigned::operator = ( v ); return *this; }
263 
264 #endif
265 };
266 
267 } // namespace sc_dt
268 
269 
270 #endif
sc_biguint(const sc_unsigned &v)
Definition: sc_biguint.h:100
sc_biguint< W > & operator=(const sc_biguint< W > &v)
Definition: sc_biguint.h:194
sc_biguint(const sc_signed_subref &v)
Definition: sc_biguint.h:117
uint64_t uint64
Definition: sc_nbdefs.h:183
sc_biguint(uint64 v)
Definition: sc_biguint.h:129
sc_biguint(unsigned int v)
Definition: sc_biguint.h:145
sc_biguint(double v)
Definition: sc_biguint.h:149
sc_biguint(const sc_biguint< W > &v)
Definition: sc_biguint.h:96
int64_t int64
Definition: sc_nbdefs.h:182
sc_unsigned(int nb=sc_length_param().len())
sc_biguint(unsigned long v)
Definition: sc_biguint.h:137
sc_biguint(const sc_unsigned_subref &v)
Definition: sc_biguint.h:104
sc_biguint(const sc_bv_base &v)
Definition: sc_biguint.h:153
sc_biguint(const char *v)
Definition: sc_biguint.h:121
sc_biguint(const sc_signed &v)
Definition: sc_biguint.h:113
sc_biguint(long v)
Definition: sc_biguint.h:133
sc_biguint(const sc_lv_base &v)
Definition: sc_biguint.h:157
sc_biguint(int64 v)
Definition: sc_biguint.h:125
sc_biguint(const sc_generic_base< T > &a)
Definition: sc_biguint.h:109
const sc_unsigned & operator=(const sc_unsigned &v)