SystemC  Recoding Infrastructure for SystemC v0.6.3 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
sc_bigint.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_bigint.h -- Template version of sc_signed. This class enables
21  compile-time bit widths for sc_signed 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_bigint.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_BIGINT_H
53 #define SC_BIGINT_H
54 
55 
58 
59 namespace sc_dt
60 {
61 
62 // classes defined in this module
63 template <int W> class sc_bigint;
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_bigint<W>
76 //
77 // Arbitrary size signed 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_bigint
86  : public sc_signed
87 {
88 public:
89 
90  // constructors
91 
93  : sc_signed( W )
94  {}
95 
96  sc_bigint( const sc_bigint<W>& v )
97  : sc_signed( W )
98  { *this = v; }
99 
100  sc_bigint( const sc_signed& v )
101  : sc_signed( W )
102  { *this = v; }
103 
105  : sc_signed( W )
106  { *this = v; }
107 
108  template< class T >
110  : sc_signed( W )
111  { a->to_sc_signed(*this); }
112 
113  sc_bigint( const sc_unsigned& v )
114  : sc_signed( W )
115  { *this = v; }
116 
118  : sc_signed( W )
119  { *this = v; }
120 
121  sc_bigint( const char* v )
122  : sc_signed( W )
123  { *this = v; }
124 
126  : sc_signed( W )
127  { *this = v; }
128 
130  : sc_signed( W )
131  { *this = v; }
132 
133  sc_bigint( long v )
134  : sc_signed( W )
135  { *this = v; }
136 
137  sc_bigint( unsigned long v )
138  : sc_signed( W )
139  { *this = v; }
140 
141  sc_bigint( int v )
142  : sc_signed( W )
143  { *this = v; }
144 
145  sc_bigint( unsigned int v )
146  : sc_signed( W )
147  { *this = v; }
148 
149  sc_bigint( double v )
150  : sc_signed( W )
151  { *this = v; }
152 
153  sc_bigint( const sc_bv_base& v )
154  : sc_signed( W )
155  { *this = v; }
156 
157  sc_bigint( const sc_lv_base& v )
158  : sc_signed( W )
159  { *this = v; }
160 
161 #ifdef SC_INCLUDE_FX
162 
163  explicit sc_bigint( const sc_fxval& v )
164  : sc_signed( W )
165  { *this = v; }
166 
167  explicit sc_bigint( const sc_fxval_fast& v )
168  : sc_signed( W )
169  { *this = v; }
170 
171  explicit sc_bigint( const sc_fxnum& v )
172  : sc_signed( W )
173  { *this = v; }
174 
175  explicit sc_bigint( const sc_fxnum_fast& v )
176  : sc_signed( W )
177  { *this = v; }
178 
179 #endif
180 
181 
182 #ifndef SC_MAX_NBITS
183 
184  // destructor
185 
187  {}
188 
189 #endif
190 
191  // assignment operators
192 
194  { sc_signed::operator = ( v ); return *this; }
195 
197  { sc_signed::operator = ( v ); return *this; }
198 
200  { sc_signed::operator = ( v ); return *this; }
201 
202  template< class T >
204  { a->to_sc_signed(*this); return *this;}
205 
207  { sc_signed::operator = ( v ); return *this; }
208 
210  { sc_signed::operator = ( v ); return *this; }
211 
212  sc_bigint<W>& operator = ( const char* v )
213  { sc_signed::operator = ( v ); return *this; }
214 
216  { sc_signed::operator = ( v ); return *this; }
217 
219  { sc_signed::operator = ( v ); return *this; }
220 
222  { sc_signed::operator = ( v ); return *this; }
223 
224  sc_bigint<W>& operator = ( unsigned long v )
225  { sc_signed::operator = ( v ); return *this; }
226 
228  { sc_signed::operator = ( v ); return *this; }
229 
230  sc_bigint<W>& operator = ( unsigned int v )
231  { sc_signed::operator = ( v ); return *this; }
232 
234  { sc_signed::operator = ( v ); return *this; }
235 
236 
238  { sc_signed::operator = ( v ); return *this; }
239 
241  { sc_signed::operator = ( v ); return *this; }
242 
244  { sc_signed::operator = ( v ); return *this; }
245 
247  { sc_signed::operator = ( v ); return *this; }
248 
249 #ifdef SC_INCLUDE_FX
250 
251  sc_bigint<W>& operator = ( const sc_fxval& v )
252  { sc_signed::operator = ( v ); return *this; }
253 
254  sc_bigint<W>& operator = ( const sc_fxval_fast& v )
255  { sc_signed::operator = ( v ); return *this; }
256 
257  sc_bigint<W>& operator = ( const sc_fxnum& v )
258  { sc_signed::operator = ( v ); return *this; }
259 
260  sc_bigint<W>& operator = ( const sc_fxnum_fast& v )
261  { sc_signed::operator = ( v ); return *this; }
262 
263 #endif
264 };
265 
266 } // namespace sc_dt
267 
268 
269 #endif
sc_bigint(const sc_bv_base &v)
Definition: sc_bigint.h:153
sc_bigint(const sc_lv_base &v)
Definition: sc_bigint.h:157
int64_t int64
Definition: sc_nbdefs.h:182
sc_bigint(const char *v)
Definition: sc_bigint.h:121
sc_bigint(const sc_unsigned &v)
Definition: sc_bigint.h:113
sc_bigint(const sc_signed_subref &v)
Definition: sc_bigint.h:104
sc_bigint(const sc_unsigned_subref &v)
Definition: sc_bigint.h:117
sc_bigint(const sc_bigint< W > &v)
Definition: sc_bigint.h:96
sc_bigint(int v)
Definition: sc_bigint.h:141
sc_bigint< W > & operator=(const sc_bigint< W > &v)
Definition: sc_bigint.h:193
sc_bigint(uint64 v)
Definition: sc_bigint.h:129
sc_bigint(double v)
Definition: sc_bigint.h:149
sc_bigint(long v)
Definition: sc_bigint.h:133
uint64_t uint64
Definition: sc_nbdefs.h:183
const sc_signed & operator=(const sc_signed &v)
sc_bigint(unsigned int v)
Definition: sc_bigint.h:145
sc_signed(int nb=sc_length_param().len())
sc_bigint(unsigned long v)
Definition: sc_bigint.h:137
sc_bigint(int64 v)
Definition: sc_bigint.h:125
sc_bigint(const sc_signed &v)
Definition: sc_bigint.h:100
sc_bigint(const sc_generic_base< T > &a)
Definition: sc_bigint.h:109