sc_bv.h revision 12027:1eb7dc7aa10b
1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22  sc_bv.h -- Arbitrary size bit vector class.
23
24  Original Author: Gene Bushuyev, Synopsys, Inc.
25
26 *****************************************************************************/
27
28/*****************************************************************************
29
30  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31  changes you are making here.
32
33      Name, Affiliation, Date:
34  Description of Modification:
35
36 *****************************************************************************/
37
38// $Log: sc_bv.h,v $
39// Revision 1.1.1.1  2006/12/15 20:20:04  acg
40// SystemC 2.3
41//
42// Revision 1.3  2006/01/13 18:53:53  acg
43// Andy Goodrich: added $Log command so that CVS comments are reproduced in
44// the source.
45//
46
47#ifndef SC_BV_H
48#define SC_BV_H
49
50
51#include "sysc/datatypes/bit/sc_bv_base.h"
52
53
54namespace sc_dt
55{
56
57// classes defined in this module
58template <int W> class sc_bv;
59
60
61// ----------------------------------------------------------------------------
62//  CLASS TEMPLATE : sc_bv<W>
63//
64//  Arbitrary size bit vector class.
65// ----------------------------------------------------------------------------
66
67template <int W>
68class sc_bv
69    : public sc_bv_base
70{
71public:
72
73    // constructors
74
75    sc_bv()
76	:sc_bv_base( W )
77	{}
78
79    explicit sc_bv( bool init_value )
80	: sc_bv_base( init_value, W )
81	{}
82
83    explicit sc_bv( char init_value )
84	: sc_bv_base( (init_value != '0'), W )
85	{}
86
87    sc_bv( const char* a )
88	: sc_bv_base( W )
89	{ sc_bv_base::operator = ( a ); }
90
91    sc_bv( const bool* a )
92	: sc_bv_base( W )
93	{ sc_bv_base::operator = ( a ); }
94
95    sc_bv( const sc_logic* a )
96	: sc_bv_base( W )
97	{ sc_bv_base::operator = ( a ); }
98
99    sc_bv( const sc_unsigned& a )
100	: sc_bv_base( W )
101	{ sc_bv_base::operator = ( a ); }
102
103    sc_bv( const sc_signed& a )
104	: sc_bv_base( W )
105	{ sc_bv_base::operator = ( a ); }
106
107    sc_bv( const sc_uint_base& a )
108	: sc_bv_base( W )
109	{ sc_bv_base::operator = ( a ); }
110
111    sc_bv( const sc_int_base& a )
112	: sc_bv_base( W )
113	{ sc_bv_base::operator = ( a ); }
114
115    sc_bv( unsigned long a )
116	: sc_bv_base( W )
117	{ sc_bv_base::operator = ( a ); }
118
119    sc_bv( long a )
120	: sc_bv_base( W )
121	{ sc_bv_base::operator = ( a ); }
122
123    sc_bv( unsigned int a )
124	: sc_bv_base( W )
125	{ sc_bv_base::operator = ( a ); }
126
127    sc_bv( int a )
128	: sc_bv_base( W )
129	{ sc_bv_base::operator = ( a ); }
130
131    sc_bv( uint64 a )
132	: sc_bv_base( W )
133	{ sc_bv_base::operator = ( a ); }
134
135    sc_bv( int64 a )
136	: sc_bv_base( W )
137	{ sc_bv_base::operator = ( a ); }
138
139    template <class X>
140    sc_bv( const sc_proxy<X>& a )
141	: sc_bv_base( W )
142	{ sc_bv_base::operator = ( a ); }
143
144    sc_bv( const sc_bv<W>& a )
145	: sc_bv_base( a )
146	{}
147
148
149    // assignment operators
150
151    template <class X>
152    sc_bv<W>& operator = ( const sc_proxy<X>& a )
153	{ sc_bv_base::operator = ( a ); return *this; }
154
155    sc_bv<W>& operator = ( const sc_bv<W>& a )
156	{ sc_bv_base::operator = ( a ); return *this; }
157
158    sc_bv<W>& operator = ( const char* a )
159	{ sc_bv_base::operator = ( a ); return *this; }
160
161    sc_bv<W>& operator = ( const bool* a )
162	{ sc_bv_base::operator = ( a ); return *this; }
163
164    sc_bv<W>& operator = ( const sc_logic* a )
165	{ sc_bv_base::operator = ( a ); return *this; }
166
167    sc_bv<W>& operator = ( const sc_unsigned& a )
168	{ sc_bv_base::operator = ( a ); return *this; }
169
170    sc_bv<W>& operator = ( const sc_signed& a )
171	{ sc_bv_base::operator = ( a ); return *this; }
172
173    sc_bv<W>& operator = ( const sc_uint_base& a )
174	{ sc_bv_base::operator = ( a ); return *this; }
175
176    sc_bv<W>& operator = ( const sc_int_base& a )
177	{ sc_bv_base::operator = ( a ); return *this; }
178
179    sc_bv<W>& operator = ( unsigned long a )
180	{ sc_bv_base::operator = ( a ); return *this; }
181
182    sc_bv<W>& operator = ( long a )
183	{ sc_bv_base::operator = ( a ); return *this; }
184
185    sc_bv<W>& operator = ( unsigned int a )
186	{ sc_bv_base::operator = ( a ); return *this; }
187
188    sc_bv<W>& operator = ( int a )
189	{ sc_bv_base::operator = ( a ); return *this; }
190
191    sc_bv<W>& operator = ( uint64 a )
192	{ sc_bv_base::operator = ( a ); return *this; }
193
194    sc_bv<W>& operator = ( int64 a )
195	{ sc_bv_base::operator = ( a ); return *this; }
196};
197
198} // namespace sc_dt
199
200
201#endif
202