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_bv.h -- Arbitrary size bit vector class. 00021 00022 Original Author: Gene Bushuyev, Synopsys, Inc. 00023 00024 *****************************************************************************/ 00025 00026 /***************************************************************************** 00027 00028 MODIFICATION LOG - modifiers, enter your name, affiliation, date and 00029 changes you are making here. 00030 00031 Name, Affiliation, Date: 00032 Description of Modification: 00033 00034 *****************************************************************************/ 00035 00036 #ifndef SC_BV_H 00037 #define SC_BV_H 00038 00039 00040 #include "systemc/datatypes/bit/sc_bv_base.h" 00041 00042 00043 namespace sc_dt 00044 { 00045 00046 // classes defined in this module 00047 template <int W> class sc_bv; 00048 00049 00050 // ---------------------------------------------------------------------------- 00051 // CLASS TEMPLATE : sc_bv<W> 00052 // 00053 // Arbitrary size bit vector class. 00054 // ---------------------------------------------------------------------------- 00055 00056 template <int W> 00057 class sc_bv 00058 : public sc_bv_base 00059 { 00060 public: 00061 00062 // constructors 00063 00064 sc_bv() 00065 :sc_bv_base( W ) 00066 {} 00067 00068 explicit sc_bv( bool init_value ) 00069 : sc_bv_base( init_value, W ) 00070 {} 00071 00072 explicit sc_bv( char init_value ) 00073 : sc_bv_base( (init_value != '0'), W ) 00074 {} 00075 00076 sc_bv( const char* a ) 00077 : sc_bv_base( W ) 00078 { sc_bv_base::operator = ( a ); } 00079 00080 sc_bv( const bool* a ) 00081 : sc_bv_base( W ) 00082 { sc_bv_base::operator = ( a ); } 00083 00084 sc_bv( const sc_logic* a ) 00085 : sc_bv_base( W ) 00086 { sc_bv_base::operator = ( a ); } 00087 00088 sc_bv( const sc_unsigned& a ) 00089 : sc_bv_base( W ) 00090 { sc_bv_base::operator = ( a ); } 00091 00092 sc_bv( const sc_signed& a ) 00093 : sc_bv_base( W ) 00094 { sc_bv_base::operator = ( a ); } 00095 00096 sc_bv( const sc_uint_base& a ) 00097 : sc_bv_base( W ) 00098 { sc_bv_base::operator = ( a ); } 00099 00100 sc_bv( const sc_int_base& a ) 00101 : sc_bv_base( W ) 00102 { sc_bv_base::operator = ( a ); } 00103 00104 sc_bv( unsigned long a ) 00105 : sc_bv_base( W ) 00106 { sc_bv_base::operator = ( a ); } 00107 00108 sc_bv( long a ) 00109 : sc_bv_base( W ) 00110 { sc_bv_base::operator = ( a ); } 00111 00112 sc_bv( unsigned int a ) 00113 : sc_bv_base( W ) 00114 { sc_bv_base::operator = ( a ); } 00115 00116 sc_bv( int a ) 00117 : sc_bv_base( W ) 00118 { sc_bv_base::operator = ( a ); } 00119 00120 sc_bv( uint64 a ) 00121 : sc_bv_base( W ) 00122 { sc_bv_base::operator = ( a ); } 00123 00124 sc_bv( int64 a ) 00125 : sc_bv_base( W ) 00126 { sc_bv_base::operator = ( a ); } 00127 00128 template <class X> 00129 sc_bv( const sc_proxy<X>& a ) 00130 : sc_bv_base( W ) 00131 { sc_bv_base::operator = ( a ); } 00132 00133 sc_bv( const sc_bv<W>& a ) 00134 : sc_bv_base( a ) 00135 {} 00136 00137 00138 // assignment operators 00139 00140 template <class X> 00141 sc_bv<W>& operator = ( const sc_proxy<X>& a ) 00142 { sc_bv_base::operator = ( a ); return *this; } 00143 00144 sc_bv<W>& operator = ( const sc_bv<W>& a ) 00145 { sc_bv_base::operator = ( a ); return *this; } 00146 00147 sc_bv<W>& operator = ( const char* a ) 00148 { sc_bv_base::operator = ( a ); return *this; } 00149 00150 sc_bv<W>& operator = ( const bool* a ) 00151 { sc_bv_base::operator = ( a ); return *this; } 00152 00153 sc_bv<W>& operator = ( const sc_logic* a ) 00154 { sc_bv_base::operator = ( a ); return *this; } 00155 00156 sc_bv<W>& operator = ( const sc_unsigned& a ) 00157 { sc_bv_base::operator = ( a ); return *this; } 00158 00159 sc_bv<W>& operator = ( const sc_signed& a ) 00160 { sc_bv_base::operator = ( a ); return *this; } 00161 00162 sc_bv<W>& operator = ( const sc_uint_base& a ) 00163 { sc_bv_base::operator = ( a ); return *this; } 00164 00165 sc_bv<W>& operator = ( const sc_int_base& a ) 00166 { sc_bv_base::operator = ( a ); return *this; } 00167 00168 sc_bv<W>& operator = ( unsigned long a ) 00169 { sc_bv_base::operator = ( a ); return *this; } 00170 00171 sc_bv<W>& operator = ( long a ) 00172 { sc_bv_base::operator = ( a ); return *this; } 00173 00174 sc_bv<W>& operator = ( unsigned int a ) 00175 { sc_bv_base::operator = ( a ); return *this; } 00176 00177 sc_bv<W>& operator = ( int a ) 00178 { sc_bv_base::operator = ( a ); return *this; } 00179 00180 sc_bv<W>& operator = ( uint64 a ) 00181 { sc_bv_base::operator = ( a ); return *this; } 00182 00183 sc_bv<W>& operator = ( int64 a ) 00184 { sc_bv_base::operator = ( a ); return *this; } 00185 }; 00186 00187 } // namespace sc_dt 00188 00189 00190 #endif
1.2.18