00001 /***************************************************************************** 00002 00003 The following code is derived, directly or indirectly, from the SystemC 00004 source code Copyright (c) 1996-2004 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.3 (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_biguint.h -- Template version of sc_unsigned. This class 00021 enables compile-time bit widths for sc_unsigned 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_BIGUINT_H 00041 #define SC_BIGUINT_H 00042 00043 00044 #include "systemc/datatypes/int/sc_signed.h" 00045 #include "systemc/datatypes/int/sc_unsigned.h" 00046 00047 namespace sc_dt 00048 { 00049 00050 // classes defined in this module 00051 template <int W> class sc_biguint; 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_biguint<W> 00064 // 00065 // Arbitrary size unsigned 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_biguint 00074 : public sc_unsigned 00075 { 00076 public: 00077 00078 // constructors 00079 00080 sc_biguint() 00081 : sc_unsigned( W ) 00082 {} 00083 00084 sc_biguint( const sc_biguint<W>& v ) 00085 : sc_unsigned( W ) 00086 { *this = v; } 00087 00088 sc_biguint( const sc_unsigned& v ) 00089 : sc_unsigned( W ) 00090 { *this = v; } 00091 00092 sc_biguint( const sc_unsigned_subref& v ) 00093 : sc_unsigned( W ) 00094 { *this = v; } 00095 00096 sc_biguint( const sc_concatref& a ) 00097 : sc_unsigned( W ) 00098 { sc_unsigned::operator = ( a ); } 00099 00100 sc_biguint( const sc_signed& v ) 00101 : sc_unsigned( W ) 00102 { *this = v; } 00103 00104 sc_biguint( const sc_signed_subref& v ) 00105 : sc_unsigned( W ) 00106 { *this = v; } 00107 00108 sc_biguint( const char* v ) 00109 : sc_unsigned( W ) 00110 { *this = v; } 00111 00112 sc_biguint( int64 v ) 00113 : sc_unsigned( W ) 00114 { *this = v; } 00115 00116 sc_biguint( uint64 v ) 00117 : sc_unsigned( W ) 00118 { *this = v; } 00119 00120 sc_biguint( long v ) 00121 : sc_unsigned( W ) 00122 { *this = v; } 00123 00124 sc_biguint( unsigned long v ) 00125 : sc_unsigned( W ) 00126 { *this = v; } 00127 00128 sc_biguint( int v ) 00129 : sc_unsigned( W ) 00130 { *this = v; } 00131 00132 sc_biguint( unsigned int v ) 00133 : sc_unsigned( W ) 00134 { *this = v; } 00135 00136 sc_biguint( double v ) 00137 : sc_unsigned( W ) 00138 { *this = v; } 00139 00140 sc_biguint( const sc_bv_base& v ) 00141 : sc_unsigned( W ) 00142 { *this = v; } 00143 00144 sc_biguint( const sc_lv_base& v ) 00145 : sc_unsigned( W ) 00146 { *this = v; } 00147 00148 #ifdef SC_INCLUDE_FX 00149 00150 explicit sc_biguint( const sc_fxval& v ) 00151 : sc_unsigned( W ) 00152 { *this = v; } 00153 00154 explicit sc_biguint( const sc_fxval_fast& v ) 00155 : sc_unsigned( W ) 00156 { *this = v; } 00157 00158 explicit sc_biguint( const sc_fxnum& v ) 00159 : sc_unsigned( W ) 00160 { *this = v; } 00161 00162 explicit sc_biguint( const sc_fxnum_fast& v ) 00163 : sc_unsigned( W ) 00164 { *this = v; } 00165 00166 #endif 00167 00168 00169 #ifndef SC_MAX_NBITS 00170 00171 // destructor 00172 00173 ~sc_biguint() 00174 {} 00175 00176 #endif 00177 00178 00179 // assignment operators 00180 00181 sc_biguint<W>& operator = ( const sc_biguint<W>& v ) 00182 { sc_unsigned::operator = ( v ); return *this; } 00183 00184 sc_biguint<W>& operator = ( const sc_unsigned& v ) 00185 { sc_unsigned::operator = ( v ); return *this; } 00186 00187 sc_biguint<W>& operator = ( const sc_unsigned_subref& v ) 00188 { sc_unsigned::operator = ( v ); return *this; } 00189 00190 sc_biguint<W>& operator = ( const sc_concatref& a ) 00191 { sc_unsigned::operator = ( a ); return *this; } 00192 00193 sc_biguint<W>& operator = ( const sc_signed& v ) 00194 { sc_unsigned::operator = ( v ); return *this; } 00195 00196 sc_biguint<W>& operator = ( const sc_signed_subref& v ) 00197 { sc_unsigned::operator = ( v ); return *this; } 00198 00199 sc_biguint<W>& operator = ( const char* v ) 00200 { sc_unsigned::operator = ( v ); return *this; } 00201 00202 sc_biguint<W>& operator = ( int64 v ) 00203 { sc_unsigned::operator = ( v ); return *this; } 00204 00205 sc_biguint<W>& operator = ( uint64 v ) 00206 { sc_unsigned::operator = ( v ); return *this; } 00207 00208 sc_biguint<W>& operator = ( long v ) 00209 { sc_unsigned::operator = ( v ); return *this; } 00210 00211 sc_biguint<W>& operator = ( unsigned long v ) 00212 { sc_unsigned::operator = ( v ); return *this; } 00213 00214 sc_biguint<W>& operator = ( int v ) 00215 { sc_unsigned::operator = ( v ); return *this; } 00216 00217 sc_biguint<W>& operator = ( unsigned int v ) 00218 { sc_unsigned::operator = ( v ); return *this; } 00219 00220 sc_biguint<W>& operator = ( double v ) 00221 { sc_unsigned::operator = ( v ); return *this; } 00222 00223 00224 sc_biguint<W>& operator = ( const sc_bv_base& v ) 00225 { sc_unsigned::operator = ( v ); return *this; } 00226 00227 sc_biguint<W>& operator = ( const sc_lv_base& v ) 00228 { sc_unsigned::operator = ( v ); return *this; } 00229 00230 sc_biguint<W>& operator = ( const sc_int_base& v ) 00231 { sc_unsigned::operator = ( v ); return *this; } 00232 00233 sc_biguint<W>& operator = ( const sc_uint_base& v ) 00234 { sc_unsigned::operator = ( v ); return *this; } 00235 00236 #ifdef SC_INCLUDE_FX 00237 00238 sc_biguint<W>& operator = ( const sc_fxval& v ) 00239 { sc_unsigned::operator = ( v ); return *this; } 00240 00241 sc_biguint<W>& operator = ( const sc_fxval_fast& v ) 00242 { sc_unsigned::operator = ( v ); return *this; } 00243 00244 sc_biguint<W>& operator = ( const sc_fxnum& v ) 00245 { sc_unsigned::operator = ( v ); return *this; } 00246 00247 sc_biguint<W>& operator = ( const sc_fxnum_fast& v ) 00248 { sc_unsigned::operator = ( v ); return *this; } 00249 00250 #endif 00251 }; 00252 00253 } // namespace sc_dt 00254 00255 00256 #endif
1.2.18