SystemC  2.3.2
Accellera SystemC proof-of-concept library
sc_bigint.h
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 */
33 /*****************************************************************************
34 
35  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
36  changes you are making here.
37 
38  Name, Affiliation, Date: Gene Bushayev, Synopsys, Inc.
39  Description of Modification: - Interface between sc_bigint and sc_bv/sc_lv.
40 
41  Name, Affiliation, Date:
42  Description of Modification:
43 
44  *****************************************************************************/
45 
46 // $Log: sc_bigint.h,v $
47 // Revision 1.2 2011/02/18 20:19:14 acg
48 // Andy Goodrich: updating Copyright notice.
49 //
50 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
51 // SystemC 2.3
52 //
53 // Revision 1.3 2006/01/13 18:49:31 acg
54 // Added $Log command so that CVS check in comments are reproduced in the
55 // source.
56 //
57 
58 #ifndef SC_BIGINT_H
59 #define SC_BIGINT_H
60 
61 
64 
65 namespace sc_dt
66 {
67 
68 // classes defined in this module
69 template <int W> class sc_bigint;
70 
71 // forward class declarations
72 class sc_bv_base;
73 class sc_lv_base;
74 class sc_fxval;
75 class sc_fxval_fast;
76 class sc_fxnum;
77 class sc_fxnum_fast;
78 
79 
86 #ifdef SC_MAX_NBITS
87 template< int W = SC_MAX_NBITS >
88 #else
89 template< int W >
90 #endif
91 class sc_bigint
92  : public sc_signed
93 {
94 public:
95 
96  // constructors
97 
99  : sc_signed( W )
100  {}
101 
103  : sc_signed( W )
104  { *this = v; }
105 
106  sc_bigint( const sc_signed& v )
107  : sc_signed( W )
108  { *this = v; }
109 
111  : sc_signed( W )
112  { *this = v; }
113 
114  template< class T >
116  : sc_signed( W )
117  { a->to_sc_signed(*this); }
118 
119  sc_bigint( const sc_unsigned& v )
120  : sc_signed( W )
121  { *this = v; }
122 
124  : sc_signed( W )
125  { *this = v; }
126 
127  sc_bigint( const char* v )
128  : sc_signed( W )
129  { *this = v; }
130 
132  : sc_signed( W )
133  { *this = v; }
134 
136  : sc_signed( W )
137  { *this = v; }
138 
139  sc_bigint( long v )
140  : sc_signed( W )
141  { *this = v; }
142 
143  sc_bigint( unsigned long v )
144  : sc_signed( W )
145  { *this = v; }
146 
147  sc_bigint( int v )
148  : sc_signed( W )
149  { *this = v; }
150 
151  sc_bigint( unsigned int v )
152  : sc_signed( W )
153  { *this = v; }
154 
155  sc_bigint( double v )
156  : sc_signed( W )
157  { *this = v; }
158 
159  sc_bigint( const sc_bv_base& v )
160  : sc_signed( W )
161  { *this = v; }
162 
163  sc_bigint( const sc_lv_base& v )
164  : sc_signed( W )
165  { *this = v; }
166 
167 #ifdef SC_INCLUDE_FX
168 
169  explicit sc_bigint( const sc_fxval& v )
170  : sc_signed( W )
171  { *this = v; }
172 
173  explicit sc_bigint( const sc_fxval_fast& v )
174  : sc_signed( W )
175  { *this = v; }
176 
177  explicit sc_bigint( const sc_fxnum& v )
178  : sc_signed( W )
179  { *this = v; }
180 
181  explicit sc_bigint( const sc_fxnum_fast& v )
182  : sc_signed( W )
183  { *this = v; }
184 
185 #endif
186 
187 
188 #ifndef SC_MAX_NBITS
189 
190  // destructor
191 
193  {}
194 
195 #endif
196 
197  // assignment operators
198 
200  { sc_signed::operator = ( v ); return *this; }
201 
203  { sc_signed::operator = ( v ); return *this; }
204 
206  { sc_signed::operator = ( v ); return *this; }
207 
208  template< class T >
210  { a->to_sc_signed(*this); return *this;}
211 
213  { sc_signed::operator = ( v ); return *this; }
214 
216  { sc_signed::operator = ( v ); return *this; }
217 
218  sc_bigint<W>& operator = ( const char* v )
219  { sc_signed::operator = ( v ); return *this; }
220 
222  { sc_signed::operator = ( v ); return *this; }
223 
225  { sc_signed::operator = ( v ); return *this; }
226 
228  { sc_signed::operator = ( v ); return *this; }
229 
230  sc_bigint<W>& operator = ( unsigned long v )
231  { sc_signed::operator = ( v ); return *this; }
232 
234  { sc_signed::operator = ( v ); return *this; }
235 
236  sc_bigint<W>& operator = ( unsigned int v )
237  { sc_signed::operator = ( v ); return *this; }
238 
240  { sc_signed::operator = ( v ); return *this; }
241 
242 
244  { sc_signed::operator = ( v ); return *this; }
245 
247  { sc_signed::operator = ( v ); return *this; }
248 
250  { sc_signed::operator = ( v ); return *this; }
251 
253  { sc_signed::operator = ( v ); return *this; }
254 
255 #ifdef SC_INCLUDE_FX
256 
257  sc_bigint<W>& operator = ( const sc_fxval& v )
258  { sc_signed::operator = ( v ); return *this; }
259 
261  { sc_signed::operator = ( v ); return *this; }
262 
263  sc_bigint<W>& operator = ( const sc_fxnum& v )
264  { sc_signed::operator = ( v ); return *this; }
265 
267  { sc_signed::operator = ( v ); return *this; }
268 
269 #endif
270 };
271 
272 } // namespace sc_dt
273 
274 
275 #endif
sc_bigint(double v)
Definition: sc_bigint.h:155
Base class for the fixed-point types; limited precision.
Definition: sc_fxnum.h:991
sc_bigint(uint64 v)
Definition: sc_bigint.h:135
sc_bigint(const sc_bigint< W > &v)
Definition: sc_bigint.h:102
Fixed-point value types; limited precision.
Definition: sc_fxval.h:439
Arbitrary precision signed arithmetic.
int64_t int64
Definition: sc_nbdefs.h:188
sc_bigint(const char *v)
Definition: sc_bigint.h:127
Base class for sc_uint.
Definition: sc_uint_base.h:534
Arbitrary precision signed number.
Definition: sc_signed.h:1099
sc_bigint(const sc_lv_base &v)
Definition: sc_bigint.h:163
uint64_t uint64
Definition: sc_nbdefs.h:189
Arbitrary precision unsigned number.
Definition: sc_unsigned.h:1001
Base class for the fixed-point types; arbitrary precision.
Definition: sc_fxnum.h:564
Arbitrary size signed integer type.
Definition: sc_bigint.h:77
Base class for sc_int.
Definition: sc_int_base.h:548
sc_bigint(const sc_signed_subref &v)
Definition: sc_bigint.h:110
Fixed-point value type; arbitrary precision.
Definition: sc_fxval.h:95
Arbitrary size logic vector base class.
Definition: sc_lv_base.h:91
Proxy class for sc_unsigned part selection (r-value and l-value).
Definition: sc_unsigned.h:925
Arbitrary precision unsigned arithmetic.
Proxy class for sc_signed part selection (r-value and l-value).
Definition: sc_signed.h:1018
sc_bigint(int64 v)
Definition: sc_bigint.h:131
sc_bigint(const sc_signed &v)
Definition: sc_bigint.h:106
Proxy class for user-defined value classes and other classes that.
sc_bigint(const sc_unsigned_subref &v)
Definition: sc_bigint.h:123
sc_bigint(const sc_unsigned &v)
Definition: sc_bigint.h:119
sc_bigint(unsigned int v)
Definition: sc_bigint.h:151
sc_bigint< W > & operator=(const sc_bigint< W > &v)
Definition: sc_bigint.h:199
sc_bigint(unsigned long v)
Definition: sc_bigint.h:143
const sc_signed & operator=(const sc_signed &v)
sc_bigint(long v)
Definition: sc_bigint.h:139
sc_bigint(int v)
Definition: sc_bigint.h:147
Arbitrary size bit vector base class.
Definition: sc_bv_base.h:80
sc_bigint(const sc_generic_base< T > &a)
Definition: sc_bigint.h:115
sc_bigint(const sc_bv_base &v)
Definition: sc_bigint.h:159
sc_signed(int nb=sc_length_param().len())