SystemC 3.0.0
Accellera SystemC proof-of-concept library
scfx_other_defs.h
Go to the documentation of this file.
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 scfx_other_defs.h -
23
24 Original Author: Martin Janssen, 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: scfx_other_defs.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:58 acg
43// Andy Goodrich: added $Log command so that CVS comments are reproduced in
44// the source.
45//
46
47#ifndef SCFX_OTHER_DEFS_H
48#define SCFX_OTHER_DEFS_H
49
50
57
58
59namespace sc_dt
60{
61
62#ifdef SC_INCLUDE_FX
63
64// ----------------------------------------------------------------------------
65// CLASS : sc_signed
66// ----------------------------------------------------------------------------
67
68// assignment operators
69
70inline
71const sc_signed&
72sc_signed::operator = ( const sc_fxval& v )
73{
74 if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
75 {
77 "sc_signed::operator = ( const sc_fxval& )" );
78 return *this;
79 }
80
81 for( int i = 0; i < length(); ++ i )
82 (*this)[i] = v.get_bit( i );
83
84 return *this;
85}
86
87inline
88const sc_signed&
89sc_signed::operator = ( const sc_fxval_fast& v )
90{
91 if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
92 {
94 "sc_signed::operator = ( const sc_fxval_fast& )" );
95 return *this;
96 }
97
98 for( int i = 0; i < length(); ++ i )
99 (*this)[i] = v.get_bit( i );
100
101 return *this;
102}
103
104inline
105const sc_signed&
106sc_signed::operator = ( const sc_fxnum& v )
107{
108 if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
109 {
111 "sc_signed::operator = ( const sc_fxnum& )" );
112 return *this;
113 }
114
115 for( int i = 0; i < length(); ++ i )
116 (*this)[i] = v.get_bit( i );
117
118 return *this;
119}
120
121inline
122const sc_signed&
123sc_signed::operator = ( const sc_fxnum_fast& v )
124{
125 if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
126 {
128 "sc_signed::operator = ( const sc_fxnum_fast& )" );
129 return *this;
130 }
131
132 for( int i = 0; i < length(); ++ i )
133 (*this)[i] = v.get_bit( i );
134
135 return *this;
136}
137
138
139// ----------------------------------------------------------------------------
140// CLASS : sc_unsigned
141// ----------------------------------------------------------------------------
142
143// assignment operators
144
145inline
146const sc_unsigned&
147sc_unsigned::operator = ( const sc_fxval& v )
148{
149 if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
150 {
152 "sc_unsigned::operator = ( const sc_fxval& )" );
153 return *this;
154 }
155
156 for( int i = 0; i < length(); ++ i )
157 (*this)[i] = v.get_bit( i );
158
159 return *this;
160}
161
162inline
163const sc_unsigned&
164sc_unsigned::operator = ( const sc_fxval_fast& v )
165{
166 if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
167 {
169 "sc_unsigned::operator = ( const sc_fxval_fast& )" );
170 return *this;
171 }
172
173 for( int i = 0; i < length(); ++ i )
174 (*this)[i] = v.get_bit( i );
175
176 return *this;
177}
178
179inline
180const sc_unsigned&
181sc_unsigned::operator = ( const sc_fxnum& v )
182{
183 if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
184 {
186 "sc_unsigned::operator = ( const sc_fxnum& )" );
187 return *this;
188 }
189
190 for( int i = 0; i < length(); ++ i )
191 (*this)[i] = v.get_bit( i );
192
193 return *this;
194}
195
196inline
197const sc_unsigned&
198sc_unsigned::operator = ( const sc_fxnum_fast& v )
199{
200 if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
201 {
203 "sc_unsigned::operator = ( const sc_fxnum_fast& )" );
204 return *this;
205 }
206
207 for( int i = 0; i < length(); ++ i )
208 (*this)[i] = v.get_bit( i );
209
210 return *this;
211}
212
213
214// ----------------------------------------------------------------------------
215// CLASS : sc_int_base
216// ----------------------------------------------------------------------------
217
218// assignment operators
219
220inline
221sc_int_base&
222sc_int_base::operator = ( const sc_fxval& v )
223{
224 if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
226 "sc_int_base::operator = ( const sc_fxval& )" );
227 return *this;
228 }
229 for( int i = 0; i < m_len; ++ i ) {
230 set( i, v.get_bit( i ) );
231 }
232 extend_sign();
233 return *this;
234}
235
236inline
237sc_int_base&
238sc_int_base::operator = ( const sc_fxval_fast& v )
239{
240 if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
242 "sc_int_base::operator = ( const sc_fxval_fast& )" );
243 return *this;
244 }
245 for( int i = 0; i < m_len; ++ i ) {
246 set( i, v.get_bit( i ) );
247 }
248 extend_sign();
249 return *this;
250}
251
252inline
253sc_int_base&
254sc_int_base::operator = ( const sc_fxnum& v )
255{
256 if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
258 "sc_int_base::operator = ( const sc_fxnum& )" );
259 return *this;
260 }
261 for( int i = 0; i < m_len; ++ i ) {
262 set( i, v.get_bit( i ) );
263 }
264 extend_sign();
265 return *this;
266}
267
268inline
269sc_int_base&
270sc_int_base::operator = ( const sc_fxnum_fast& v )
271{
272 if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
274 "sc_int_base::operator = ( const sc_fxnum_fast& )" );
275 return *this;
276 }
277 for( int i = 0; i < m_len; ++ i ) {
278 set( i, v.get_bit( i ) );
279 }
280 extend_sign();
281 return *this;
282}
283
284
285// ----------------------------------------------------------------------------
286// CLASS : sc_uint_base
287// ----------------------------------------------------------------------------
288
289// assignment operators
290
291inline
292sc_uint_base&
293sc_uint_base::operator = ( const sc_fxval& v )
294{
295 if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
297 "sc_uint_base::operator = ( const sc_fxval& )" );
298 return *this;
299 }
300 for( int i = 0; i < m_len; ++ i ) {
301 set( i, v.get_bit( i ) );
302 }
303 extend_sign();
304 return *this;
305}
306
307inline
308sc_uint_base&
309sc_uint_base::operator = ( const sc_fxval_fast& v )
310{
311 if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
313 "sc_uint_base::operator = ( const sc_fxval_fast& )" );
314 return *this;
315 }
316 for( int i = 0; i < m_len; ++ i ) {
317 set( i, v.get_bit( i ) );
318 }
319 extend_sign();
320 return *this;
321}
322
323inline
324sc_uint_base&
325sc_uint_base::operator = ( const sc_fxnum& v )
326{
327 if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
329 "sc_uint_base::operator = ( const sc_fxnum& )" );
330 return *this;
331 }
332 for( int i = 0; i < m_len; ++ i ) {
333 set( i, v.get_bit( i ) );
334 }
335 extend_sign();
336 return *this;
337}
338
339inline
340sc_uint_base&
341sc_uint_base::operator = ( const sc_fxnum_fast& v )
342{
343 if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
345 "sc_uint_base::operator = ( const sc_fxnum_fast& )" );
346 return *this;
347 }
348 for( int i = 0; i < m_len; ++ i ) {
349 set( i, v.get_bit( i ) );
350 }
351 extend_sign();
352 return *this;
353}
354
355
356#endif
357
358
359} // namespace sc_dt
360
361
362#endif
363
364// Taf!
#define SC_REPORT_ERROR(msg_type, msg)
Definition: sc_report.h:217
const char SC_ID_INVALID_FX_VALUE_[]
sc_int_base & operator=(int_type v)
Definition: sc_int_base.h:622
void set(int i)
Definition: sc_int_base.h:780
const sc_signed & operator=(const sc_signed &v)
int length() const
Definition: sc_signed.h:807
sc_uint_base & operator=(uint_type v)
Definition: sc_uint_base.h:590
const sc_unsigned & operator=(const sc_unsigned &v)
int length() const
Definition: sc_unsigned.h:808