00001 /***************************************************************************** 00002 00003 The following code is derived, directly or indirectly, from the SystemC 00004 source code Copyright (c) 1996-2014 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 (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.accellera.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 // $Log: sc_bv.h,v $ 00037 // Revision 1.1.1.1 2006/12/15 20:20:04 acg 00038 // SystemC 2.3 00039 // 00040 // Revision 1.3 2006/01/13 18:53:53 acg 00041 // Andy Goodrich: added $Log command so that CVS comments are reproduced in 00042 // the source. 00043 // 00044 00045 #ifndef SC_BV_H 00046 #define SC_BV_H 00047 00048 00049 #include "sysc/datatypes/bit/sc_bv_base.h" 00050 00051 00052 namespace sc_dt 00053 { 00054 00055 // classes defined in this module 00056 template <int W> class sc_bv; 00057 00058 00059 // ---------------------------------------------------------------------------- 00060 // CLASS TEMPLATE : sc_bv<W> 00061 // 00062 // Arbitrary size bit vector class. 00063 // ---------------------------------------------------------------------------- 00064 00065 template <int W> 00066 class sc_bv 00067 : public sc_bv_base 00068 { 00069 public: 00070 00071 // constructors 00072 00073 sc_bv() 00074 :sc_bv_base( W ) 00075 {} 00076 00077 explicit sc_bv( bool init_value ) 00078 : sc_bv_base( init_value, W ) 00079 {} 00080 00081 explicit sc_bv( char init_value ) 00082 : sc_bv_base( (init_value != '0'), W ) 00083 {} 00084 00085 sc_bv( const char* a ) 00086 : sc_bv_base( W ) 00087 { sc_bv_base::operator = ( a ); } 00088 00089 sc_bv( const bool* a ) 00090 : sc_bv_base( W ) 00091 { sc_bv_base::operator = ( a ); } 00092 00093 sc_bv( const sc_logic* a ) 00094 : sc_bv_base( W ) 00095 { sc_bv_base::operator = ( a ); } 00096 00097 sc_bv( const sc_unsigned& a ) 00098 : sc_bv_base( W ) 00099 { sc_bv_base::operator = ( a ); } 00100 00101 sc_bv( const sc_signed& a ) 00102 : sc_bv_base( W ) 00103 { sc_bv_base::operator = ( a ); } 00104 00105 sc_bv( const sc_uint_base& a ) 00106 : sc_bv_base( W ) 00107 { sc_bv_base::operator = ( a ); } 00108 00109 sc_bv( const sc_int_base& a ) 00110 : sc_bv_base( W ) 00111 { sc_bv_base::operator = ( a ); } 00112 00113 sc_bv( unsigned long a ) 00114 : sc_bv_base( W ) 00115 { sc_bv_base::operator = ( a ); } 00116 00117 sc_bv( long a ) 00118 : sc_bv_base( W ) 00119 { sc_bv_base::operator = ( a ); } 00120 00121 sc_bv( unsigned int a ) 00122 : sc_bv_base( W ) 00123 { sc_bv_base::operator = ( a ); } 00124 00125 sc_bv( int a ) 00126 : sc_bv_base( W ) 00127 { sc_bv_base::operator = ( a ); } 00128 00129 sc_bv( uint64 a ) 00130 : sc_bv_base( W ) 00131 { sc_bv_base::operator = ( a ); } 00132 00133 sc_bv( int64 a ) 00134 : sc_bv_base( W ) 00135 { sc_bv_base::operator = ( a ); } 00136 00137 template <class X> 00138 sc_bv( const sc_proxy<X>& a ) 00139 : sc_bv_base( W ) 00140 { sc_bv_base::operator = ( a ); } 00141 00142 sc_bv( const sc_bv<W>& a ) 00143 : sc_bv_base( a ) 00144 {} 00145 00146 00147 // assignment operators 00148 00149 template <class X> 00150 sc_bv<W>& operator = ( const sc_proxy<X>& a ) 00151 { sc_bv_base::operator = ( a ); return *this; } 00152 00153 sc_bv<W>& operator = ( const sc_bv<W>& a ) 00154 { sc_bv_base::operator = ( a ); return *this; } 00155 00156 sc_bv<W>& operator = ( const char* a ) 00157 { sc_bv_base::operator = ( a ); return *this; } 00158 00159 sc_bv<W>& operator = ( const bool* a ) 00160 { sc_bv_base::operator = ( a ); return *this; } 00161 00162 sc_bv<W>& operator = ( const sc_logic* a ) 00163 { sc_bv_base::operator = ( a ); return *this; } 00164 00165 sc_bv<W>& operator = ( const sc_unsigned& a ) 00166 { sc_bv_base::operator = ( a ); return *this; } 00167 00168 sc_bv<W>& operator = ( const sc_signed& a ) 00169 { sc_bv_base::operator = ( a ); return *this; } 00170 00171 sc_bv<W>& operator = ( const sc_uint_base& a ) 00172 { sc_bv_base::operator = ( a ); return *this; } 00173 00174 sc_bv<W>& operator = ( const sc_int_base& a ) 00175 { sc_bv_base::operator = ( a ); return *this; } 00176 00177 sc_bv<W>& operator = ( unsigned long a ) 00178 { sc_bv_base::operator = ( a ); return *this; } 00179 00180 sc_bv<W>& operator = ( long a ) 00181 { sc_bv_base::operator = ( a ); return *this; } 00182 00183 sc_bv<W>& operator = ( unsigned int a ) 00184 { sc_bv_base::operator = ( a ); return *this; } 00185 00186 sc_bv<W>& operator = ( int a ) 00187 { sc_bv_base::operator = ( a ); return *this; } 00188 00189 sc_bv<W>& operator = ( uint64 a ) 00190 { sc_bv_base::operator = ( a ); return *this; } 00191 00192 sc_bv<W>& operator = ( int64 a ) 00193 { sc_bv_base::operator = ( a ); return *this; } 00194 }; 00195 00196 } // namespace sc_dt 00197 00198 00199 #endif