sc_bigint.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003   The following code is derived, directly or indirectly, from the SystemC
00004   source code Copyright (c) 1996-2005 by all Contributors.
00005   All Rights reserved.
00006 
00007   The contents of this file are subject to the restrictions and limitations
00008   set forth in the SystemC Open Source License Version 2.4 (the "License");
00009   You may not use this file except in compliance with such restrictions and
00010   limitations. You may obtain instructions on how to receive a copy of the
00011   License at http://www.systemc.org/. Software distributed by Contributors
00012   under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
00013   ANY KIND, either express or implied. See the License for the specific
00014   language governing rights and limitations under the License.
00015 
00016  *****************************************************************************/
00017 
00018 /*****************************************************************************
00019 
00020   sc_bigint.h -- Template version of sc_signed. This class enables
00021                  compile-time bit widths for sc_signed numbers.
00022 
00023   Original Author: Ali Dasdan, Synopsys, Inc.
00024 
00025  *****************************************************************************/
00026 
00027 /*****************************************************************************
00028 
00029   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00030   changes you are making here.
00031 
00032       Name, Affiliation, Date: Gene Bushayev, Synopsys, Inc.
00033   Description of Modification: - Interface between sc_bigint and sc_bv/sc_lv.
00034 
00035       Name, Affiliation, Date:
00036   Description of Modification:
00037 
00038  *****************************************************************************/
00039 
00040 #ifndef SC_BIGINT_H
00041 #define SC_BIGINT_H
00042 
00043 
00044 #include "sysc/datatypes/int/sc_signed.h"
00045 #include "sysc/datatypes/int/sc_unsigned.h"
00046 
00047 namespace sc_dt
00048 {
00049 
00050 // classes defined in this module
00051 template <int W> class sc_bigint;
00052 
00053 // forward class declarations
00054 class sc_bv_base;
00055 class sc_lv_base;
00056 class sc_fxval;
00057 class sc_fxval_fast;
00058 class sc_fxnum;
00059 class sc_fxnum_fast;
00060 
00061 
00062 // ----------------------------------------------------------------------------
00063 //  CLASS TEMPLATE : sc_bigint<W>
00064 //
00065 //  Arbitrary size signed integer type.
00066 // ----------------------------------------------------------------------------
00067 
00068 #ifdef SC_MAX_NBITS
00069 template< int W = SC_MAX_NBITS >
00070 #else
00071 template< int W >
00072 #endif
00073 class sc_bigint
00074     : public sc_signed
00075 {
00076 public:
00077 
00078     // constructors
00079 
00080     sc_bigint()
00081         : sc_signed( W )
00082         {}
00083 
00084     sc_bigint( const sc_bigint<W>& v )
00085         : sc_signed( W )
00086         { *this = v; }
00087 
00088     sc_bigint( const sc_signed& v )
00089         : sc_signed( W )
00090         { *this = v; }
00091 
00092     sc_bigint( const sc_signed_subref& v )
00093         : sc_signed( W )
00094         { *this = v; }
00095 
00096     template< class T >
00097     sc_bigint( const sc_generic_base<T>& a )
00098         : sc_signed( W )
00099         { a->to_sc_signed(*this); }
00100 
00101     sc_bigint( const sc_unsigned& v )
00102         : sc_signed( W )
00103         { *this = v; }
00104 
00105     sc_bigint( const sc_unsigned_subref& v )
00106         : sc_signed( W )
00107         { *this = v; }
00108 
00109     sc_bigint( const char* v )
00110         : sc_signed( W )
00111         { *this = v; }
00112 
00113     sc_bigint( int64 v )
00114         : sc_signed( W )
00115         { *this = v; }
00116 
00117     sc_bigint( uint64 v )
00118         : sc_signed( W )
00119         { *this = v; }
00120 
00121     sc_bigint( long v )
00122         : sc_signed( W )
00123         { *this = v; }
00124 
00125     sc_bigint( unsigned long v )
00126         : sc_signed( W )
00127         { *this = v; }
00128 
00129     sc_bigint( int v )
00130         : sc_signed( W )
00131         { *this = v; }
00132 
00133     sc_bigint( unsigned int v )
00134         : sc_signed( W )
00135         { *this = v; }
00136 
00137     sc_bigint( double v )
00138         : sc_signed( W )
00139         { *this = v; }
00140   
00141     sc_bigint( const sc_bv_base& v )
00142         : sc_signed( W )
00143         { *this = v; }
00144 
00145     sc_bigint( const sc_lv_base& v )
00146         : sc_signed( W )
00147         { *this = v; }
00148 
00149 #ifdef SC_INCLUDE_FX
00150 
00151     explicit sc_bigint( const sc_fxval& v )
00152         : sc_signed( W )
00153         { *this = v; }
00154 
00155     explicit sc_bigint( const sc_fxval_fast& v )
00156         : sc_signed( W )
00157         { *this = v; }
00158 
00159     explicit sc_bigint( const sc_fxnum& v )
00160         : sc_signed( W )
00161         { *this = v; }
00162 
00163     explicit sc_bigint( const sc_fxnum_fast& v )
00164         : sc_signed( W )
00165         { *this = v; }
00166 
00167 #endif
00168 
00169 
00170 #ifndef SC_MAX_NBITS
00171 
00172     // destructor
00173 
00174     ~sc_bigint()
00175         {}
00176 
00177 #endif
00178  
00179     // assignment operators
00180 
00181     sc_bigint<W>& operator = ( const sc_bigint<W>& v )
00182         { sc_signed::operator = ( v ); return *this; }
00183 
00184     sc_bigint<W>& operator = ( const sc_signed& v )
00185         { sc_signed::operator = ( v ); return *this; }
00186 
00187     sc_bigint<W>& operator = (const sc_signed_subref& v )
00188         { sc_signed::operator = ( v ); return *this; }
00189 
00190     template< class T >
00191     sc_bigint<W>& operator = ( const sc_generic_base<T>& a )
00192         { a->to_sc_signed(*this); return *this;}
00193 
00194     sc_bigint<W>& operator = ( const sc_unsigned& v )
00195         { sc_signed::operator = ( v ); return *this; }
00196 
00197     sc_bigint<W>& operator = ( const sc_unsigned_subref& v )
00198         { sc_signed::operator = ( v ); return *this; }
00199 
00200     sc_bigint<W>& operator = ( const char* v )
00201         { sc_signed::operator = ( v ); return *this; }
00202 
00203     sc_bigint<W>& operator = ( int64 v )
00204         { sc_signed::operator = ( v ); return *this; }
00205 
00206     sc_bigint<W>& operator = ( uint64 v )
00207         { sc_signed::operator = ( v ); return *this; }
00208 
00209     sc_bigint<W>& operator = ( long v )
00210         { sc_signed::operator = ( v ); return *this; }
00211 
00212     sc_bigint<W>& operator = ( unsigned long v )
00213         { sc_signed::operator = ( v ); return *this; }
00214 
00215     sc_bigint<W>& operator = ( int v )
00216         { sc_signed::operator = ( v ); return *this; }
00217 
00218     sc_bigint<W>& operator = ( unsigned int v )
00219         { sc_signed::operator = ( v ); return *this; }
00220 
00221     sc_bigint<W>& operator = ( double v )
00222         { sc_signed::operator = ( v ); return *this; }
00223 
00224 
00225     sc_bigint<W>& operator = ( const sc_bv_base& v )
00226         { sc_signed::operator = ( v ); return *this; }
00227 
00228     sc_bigint<W>& operator = ( const sc_lv_base& v )
00229         { sc_signed::operator = ( v ); return *this; }
00230 
00231     sc_bigint<W>& operator = ( const sc_int_base& v )
00232         { sc_signed::operator = ( v ); return *this; }
00233 
00234     sc_bigint<W>& operator = ( const sc_uint_base& v )
00235         { sc_signed::operator = ( v ); return *this; }
00236 
00237 #ifdef SC_INCLUDE_FX
00238 
00239     sc_bigint<W>& operator = ( const sc_fxval& v )
00240         { sc_signed::operator = ( v ); return *this; }
00241 
00242     sc_bigint<W>& operator = ( const sc_fxval_fast& v )
00243         { sc_signed::operator = ( v ); return *this; }
00244 
00245     sc_bigint<W>& operator = ( const sc_fxnum& v )
00246         { sc_signed::operator = ( v ); return *this; }
00247 
00248     sc_bigint<W>& operator = ( const sc_fxnum_fast& v )
00249         { sc_signed::operator = ( v ); return *this; }
00250 
00251 #endif
00252 };
00253 
00254 } // namespace sc_dt
00255 
00256 
00257 #endif
Generated by
Matthieu Moy <Matthieu.Moy@st.com>
Back to Pinapa Home Page