gem5  v22.1.0.0
scfx_other_defs.hh
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 __SYSTEMC_EXT_DT_FX_SCFX_OTHER_DEFS_HH__
48 #define __SYSTEMC_EXT_DT_FX_SCFX_OTHER_DEFS_HH__
49 
50 #include "../int/sc_int_base.hh"
51 #include "../int/sc_signed.hh"
52 #include "../int/sc_uint_base.hh"
53 #include "../int/sc_unsigned.hh"
54 #include "messages.hh"
55 
56 namespace sc_dt
57 {
58 
59 // ----------------------------------------------------------------------------
60 // CLASS : sc_signed
61 // ----------------------------------------------------------------------------
62 
63 // assignment operators
64 inline const sc_signed &
66 {
67  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
69  "sc_signed::operator = ( const sc_fxval& )");
70  return *this;
71  }
72  for (int i = 0; i < length(); ++i)
73  (*this)[i] = v.get_bit(i);
74 
75  return *this;
76 }
77 
78 inline const sc_signed &
80 {
81  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
83  "sc_signed::operator = ( const sc_fxval_fast& )");
84  return *this;
85  }
86 
87  for (int i = 0; i < length(); ++i)
88  (*this)[i] = v.get_bit(i);
89 
90  return *this;
91 }
92 
93 inline const sc_signed &
95 {
96  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
98  "sc_signed::operator = ( const sc_fxnum& )");
99  return *this;
100  }
101 
102  for (int i = 0; i < length(); ++i)
103  (*this)[i] = v.get_bit(i);
104 
105  return *this;
106 }
107 
108 inline const sc_signed &
110 {
111  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
113  "sc_signed::operator = ( const sc_fxnum_fast& )");
114  return *this;
115  }
116 
117  for (int i = 0; i < length(); ++i)
118  (*this)[i] = v.get_bit(i);
119 
120  return *this;
121 }
122 
123 
124 // ----------------------------------------------------------------------------
125 // CLASS : sc_unsigned
126 // ----------------------------------------------------------------------------
127 
128 // assignment operators
129 
130 inline const sc_unsigned &
132 {
133  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
135  "sc_unsigned::operator = ( const sc_fxval& )");
136  return *this;
137  }
138 
139  for (int i = 0; i < length(); ++i)
140  (*this)[i] = v.get_bit(i);
141 
142  return *this;
143 }
144 
145 inline const sc_unsigned &
147 {
148  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
150  "sc_unsigned::operator = ( const sc_fxval_fast& )");
151  return *this;
152  }
153 
154  for (int i = 0; i < length(); ++i)
155  (*this)[i] = v.get_bit(i);
156 
157  return *this;
158 }
159 
160 inline const sc_unsigned &
162 {
163  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
165  "sc_unsigned::operator = ( const sc_fxnum& )" );
166  return *this;
167  }
168 
169  for (int i = 0; i < length(); ++i)
170  (*this)[i] = v.get_bit(i);
171 
172  return *this;
173 }
174 
175 inline const sc_unsigned &
177 {
178  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
180  "sc_unsigned::operator = ( const sc_fxnum_fast& )" );
181  return *this;
182  }
183 
184  for (int i = 0; i < length(); ++i)
185  (*this)[i] = v.get_bit(i);
186 
187  return *this;
188 }
189 
190 
191 // ----------------------------------------------------------------------------
192 // CLASS : sc_int_base
193 // ----------------------------------------------------------------------------
194 
195 // assignment operators
196 
197 inline sc_int_base &
199 {
200  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
202  "sc_int_base::operator = ( const sc_fxval& )");
203  return *this;
204  }
205  for (int i = 0; i < m_len; ++i) {
206  set(i, v.get_bit(i));
207  }
208  extend_sign();
209  return *this;
210 }
211 
212 inline sc_int_base &
214 {
215  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
217  "sc_int_base::operator = ( const sc_fxval_fast& )");
218  return *this;
219  }
220  for (int i = 0; i < m_len; ++i) {
221  set(i, v.get_bit(i));
222  }
223  extend_sign();
224  return *this;
225 }
226 
227 inline sc_int_base &
229 {
230  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
232  "sc_int_base::operator = ( const sc_fxnum& )");
233  return *this;
234  }
235  for (int i = 0; i < m_len; ++i) {
236  set(i, v.get_bit(i));
237  }
238  extend_sign();
239  return *this;
240 }
241 
242 inline sc_int_base &
244 {
245  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
247  "sc_int_base::operator = ( const sc_fxnum_fast& )");
248  return *this;
249  }
250  for (int i = 0; i < m_len; ++i) {
251  set (i, v.get_bit(i));
252  }
253  extend_sign();
254  return *this;
255 }
256 
257 
258 // ----------------------------------------------------------------------------
259 // CLASS : sc_uint_base
260 // ----------------------------------------------------------------------------
261 
262 // assignment operators
263 inline sc_uint_base &
265 {
266  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
268  "sc_uint_base::operator = ( const sc_fxval& )");
269  return *this;
270  }
271  for (int i = 0; i < m_len; ++i) {
272  set(i, v.get_bit(i));
273  }
274  extend_sign();
275  return *this;
276 }
277 
278 inline sc_uint_base &
280 {
281  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
283  "sc_uint_base::operator = ( const sc_fxval_fast& )");
284  return *this;
285  }
286  for (int i = 0; i < m_len; ++i) {
287  set(i, v.get_bit(i));
288  }
289  extend_sign();
290  return *this;
291 }
292 
293 inline sc_uint_base &
295 {
296  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
298  "sc_uint_base::operator = ( const sc_fxnum& )");
299  return *this;
300  }
301  for (int i = 0; i < m_len; ++i) {
302  set(i, v.get_bit(i));
303  }
304  extend_sign();
305  return *this;
306 }
307 
308 inline sc_uint_base &
310 {
311  if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
313  "sc_uint_base::operator = ( const sc_fxnum_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 
323 } // namespace sc_dt
324 
325 #endif // __SYSTEMC_EXT_DT_FX_SCFX_OTHER_DEFS_HH__
sc_int_base & operator=(int_type v)
Definition: sc_int_base.hh:590
const sc_signed & operator=(const sc_signed &v)
int length() const
Definition: sc_signed.hh:1222
sc_uint_base & operator=(uint_type v)
const sc_unsigned & operator=(const sc_unsigned &v)
int length() const
Bitfield< 7 > i
Definition: misc_types.hh:67
Bitfield< 0 > v
Definition: pagetable.hh:65
const char SC_ID_INVALID_FX_VALUE_[]
Definition: messages.cc:40
Definition: sc_bit.cc:68
#define SC_REPORT_ERROR(msg_type, msg)

Generated on Wed Dec 21 2022 10:22:41 for gem5 by doxygen 1.9.1