gem5  v20.1.0.0
sc_unsigned.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  sc_unsigned.h -- Arbitrary precision unsigned arithmetic.
23 
24  This file includes the definitions of sc_unsigned_bitref,
25  sc_unsigned_subref, and sc_unsigned classes. The first two classes
26  are proxy classes to reference one bit and a range of bits of a
27  sc_unsigned number, respectively.
28 
29  An sc_signed number has the sign-magnitude representation
30  internally. However, its interface guarantees a 2's-complement
31  representation. The sign-magnitude representation is chosen
32  because of its efficiency: The sc_signed and sc_unsigned types are
33  optimized for arithmetic rather than bitwise operations. For
34  arithmetic operations, the sign-magnitude representation performs
35  better.
36 
37  It is also important to note that an sc_unsigned number with n
38  bits is equivalent to an sc_signed non-negative number with n + 1
39  bits.
40 
41  The implementations of sc_signed and sc_unsigned classes are
42  almost identical: Most of the member and friend functions are
43  defined in sc_nbcommon.cpp and sc_nbfriends.cpp so that they can
44  be shared by both of these classes. These functions are chosed by
45  defining a few macros before including them such as IF_SC_SIGNED
46  and CLASS_TYPE. Our implementation choices are mostly dictated by
47  performance considerations in that we tried to provide the most
48  efficient sc_signed and sc_unsigned types without compromising
49  their interface.
50 
51  For the behavior of operators, we have two semantics: the old and
52  new. The most important difference between these two semantics is
53  that the old semantics is closer to C/C++ semantics in that the
54  result type of a binary operator on unsigned and signed arguments
55  is unsigned; the new semantics, on the other hand, requires the
56  result type be signed. The new semantics is required by the VSIA
57  C/C++ data types standard. We have implemented the new semantics.
58 
59  Original Author: Ali Dasdan, Synopsys, Inc.
60 
61  *****************************************************************************/
62 
63 /*****************************************************************************
64 
65  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
66  changes you are making here.
67 
68  Name, Affiliation, Date:
69  Description of Modification:
70 
71  *****************************************************************************/
72 
73 // $Log: sc_unsigned.h,v $
74 // Revision 1.4 2011/08/24 22:05:46 acg
75 // Torsten Maehne: initialization changes to remove warnings.
76 //
77 // Revision 1.3 2011/02/18 20:19:15 acg
78 // Andy Goodrich: updating Copyright notice.
79 //
80 // Revision 1.2 2009/02/28 00:26:26 acg
81 // Andy Goodrich: bug fixes.
82 //
83 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
84 // SystemC 2.3
85 //
86 // Revision 1.5 2006/05/08 17:50:02 acg
87 // Andy Goodrich: Added David Long's declarations for friend operators,
88 // functions, and methods, to keep the Microsoft compiler happy.
89 //
90 // Revision 1.4 2006/03/13 20:25:27 acg
91 // Andy Goodrich: Addition of function declarations, e.g., xor_signed_friend()
92 // to keep gcc 4.x happy.
93 //
94 // Revision 1.3 2006/01/13 18:49:32 acg
95 // Added $Log command so that CVS check in comments are reproduced in the
96 // source.
97 //
98 
99 #ifndef __SYSTEMC_EXT_DT_INT_SC_UNSIGNED_HH__
100 #define __SYSTEMC_EXT_DT_INT_SC_UNSIGNED_HH__
101 
102 #include <iostream>
103 
104 #include "../misc/sc_value_base.hh"
105 #include "../sc_temporary.hh"
106 #include "sc_length_param.hh"
107 #include "sc_nbdefs.hh"
108 #include "sc_nbexterns.hh"
109 #include "sc_nbutils.hh"
110 
111 namespace sc_dt
112 {
113 
114 // classes defined in this module
115 class sc_unsigned_bitref_r;
116 class sc_unsigned_bitref;
117 class sc_unsigned_subref_r;
118 class sc_unsigned_subref;
119 class sc_concatref;
120 class sc_unsigned;
121 
122 // forward class declarations
123 class sc_bv_base;
124 class sc_lv_base;
125 class sc_int_base;
126 class sc_uint_base;
127 class sc_int_subref_r;
128 class sc_uint_subref_r;
129 class sc_signed;
130 class sc_signed_subref_r;
131 class sc_fxval;
132 class sc_fxval_fast;
133 class sc_fxnum;
134 class sc_fxnum_fast;
135 
136 } // namespace sc_dt
137 
138 // extern template instantiations
139 namespace sc_core
140 {
141 
142 extern template class sc_vpool<sc_dt::sc_unsigned_bitref>;
143 extern template class sc_vpool<sc_dt::sc_unsigned_subref>;
144 extern template class sc_vpool<sc_dt::sc_unsigned>;
145 
146 } // namespace sc_core
147 
148 namespace sc_dt
149 {
150 
151 // Helper function declarions
152 int compare_unsigned(small_type us, int unb, int und, const sc_digit *ud,
153  small_type vs, int vnb, int vnd, const sc_digit *vd,
154  small_type if_u_signed=0, small_type if_v_signed=0);
155 
156 sc_unsigned add_unsigned_friend(
157  small_type us, int unb, int und, const sc_digit *ud,
158  small_type vs, int vnb, int vnd, const sc_digit *vd);
159 
160 sc_unsigned sub_unsigned_friend(
161  small_type us, int unb, int und, const sc_digit *ud,
162  small_type vs, int vnb, int vnd, const sc_digit *vd);
163 
164 sc_unsigned mul_unsigned_friend(
165  small_type s, int unb, int und, const sc_digit *ud,
166  int vnb, int vnd, const sc_digit *vd);
167 
168 sc_unsigned div_unsigned_friend(
169  small_type s, int unb, int und, const sc_digit *ud,
170  int vnb, int vnd, const sc_digit *vd);
171 
172 sc_unsigned mod_unsigned_friend(
173  small_type us, int unb, int und, const sc_digit *ud,
174  int vnb, int vnd, const sc_digit *vd);
175 
176 sc_unsigned and_unsigned_friend(
177  small_type us, int unb, int und, const sc_digit *ud,
178  small_type vs, int vnb, int vnd, const sc_digit *vd);
179 
180 
181 sc_unsigned or_unsigned_friend(
182  small_type us, int unb, int und, const sc_digit *ud,
183  small_type vs, int vnb, int vnd, const sc_digit *vd);
184 
185 sc_unsigned xor_unsigned_friend(
186  small_type us, int unb, int und, const sc_digit *ud,
187  small_type vs, int vnb, int vnd, const sc_digit *vd);
188 
189 
190 /*
191  * friend operator declarations
192  */
193 
194 // ARITHMETIC OPERATORS:
195 
196 // ADDition operators:
197 sc_signed operator + (const sc_unsigned &u, const sc_signed &v);
198 sc_signed operator + (const sc_signed &u, const sc_unsigned &v);
199 
200 sc_unsigned operator + (const sc_unsigned &u, const sc_unsigned &v);
201 sc_signed operator + (const sc_unsigned &u, int64 v);
202 sc_unsigned operator + (const sc_unsigned &u, uint64 v);
203 sc_signed operator + (const sc_unsigned &u, long v);
204 sc_unsigned operator + (const sc_unsigned &u, unsigned long v);
205 sc_signed operator + (const sc_unsigned &u, int v);
206 inline sc_unsigned operator + (const sc_unsigned &u, unsigned int v);
207 
208 sc_signed operator + (int64 u, const sc_unsigned &v);
209 sc_unsigned operator + (uint64 u, const sc_unsigned &v);
210 sc_signed operator + (long u, const sc_unsigned &v);
211 sc_unsigned operator + (unsigned long u, const sc_unsigned &v);
212 sc_signed operator + (int u, const sc_unsigned &v);
213 inline sc_unsigned operator + (unsigned int u, const sc_unsigned &v);
214 
215 sc_unsigned operator + (const sc_unsigned &u, const sc_uint_base &v);
216 sc_signed operator + (const sc_unsigned &u, const sc_int_base &v);
217 sc_unsigned operator + (const sc_uint_base &u, const sc_unsigned &v);
218 sc_signed operator + (const sc_int_base &u, const sc_unsigned &v);
219 
220 // SUBtraction operators:
221 sc_signed operator - (const sc_unsigned &u, const sc_signed &v);
222 sc_signed operator - (const sc_signed &u, const sc_unsigned &v);
223 
224 sc_signed operator - (const sc_unsigned &u, const sc_unsigned &v);
225 sc_signed operator - (const sc_unsigned &u, int64 v);
226 sc_signed operator - (const sc_unsigned &u, uint64 v);
227 sc_signed operator - (const sc_unsigned &u, long v);
228 sc_signed operator - (const sc_unsigned &u, unsigned long v);
229 sc_signed operator - (const sc_unsigned &u, int v);
230 sc_signed operator - (const sc_unsigned &u, unsigned int v);
231 
232 sc_signed operator - (int64 u, const sc_unsigned &v);
233 sc_signed operator - (uint64 u, const sc_unsigned &v);
234 sc_signed operator - (long u, const sc_unsigned &v);
235 sc_signed operator - (unsigned long u, const sc_unsigned &v);
236 sc_signed operator - (int u, const sc_unsigned &v);
237 sc_signed operator - (unsigned int u, const sc_unsigned &v);
238 
239 sc_signed operator - (const sc_unsigned &u, const sc_uint_base &v);
240 sc_signed operator - (const sc_unsigned &u, const sc_int_base &v);
241 sc_signed operator - (const sc_uint_base &u, const sc_unsigned &v);
242 sc_signed operator - (const sc_int_base &u, const sc_unsigned &v);
243 
244 // MULtiplication operators:
245 sc_signed operator * (const sc_unsigned &u, const sc_signed &v);
246 sc_signed operator * (const sc_signed &u, const sc_unsigned &v);
247 
248 sc_unsigned operator * (const sc_unsigned &u, const sc_unsigned &v);
249 sc_signed operator * (const sc_unsigned &u, int64 v);
250 sc_unsigned operator * (const sc_unsigned &u, uint64 v);
251 sc_signed operator * (const sc_unsigned &u, long v);
252 sc_unsigned operator * (const sc_unsigned &u, unsigned long v);
253 sc_signed operator * (const sc_unsigned &u, int v);
254 inline sc_unsigned operator * (const sc_unsigned &u, unsigned int v);
255 
256 sc_signed operator * (int64 u, const sc_unsigned &v);
257 sc_unsigned operator * (uint64 u, const sc_unsigned &v);
258 sc_signed operator * (long u, const sc_unsigned &v);
259 sc_unsigned operator * (unsigned long u, const sc_unsigned &v);
260 sc_signed operator * (int u, const sc_unsigned &v);
261 inline sc_unsigned operator * (unsigned int u, const sc_unsigned &v);
262 
263 sc_unsigned operator * (const sc_unsigned &u, const sc_uint_base &v);
264 sc_signed operator * (const sc_unsigned &u, const sc_int_base &v);
265 sc_unsigned operator * (const sc_uint_base &u, const sc_unsigned &v);
266 sc_signed operator * (const sc_int_base &u, const sc_unsigned &v);
267 
268 // DIVision operators:
269 sc_signed operator / (const sc_unsigned &u, const sc_signed &v);
270 sc_signed operator / (const sc_signed &u, const sc_unsigned &v);
271 
272 sc_unsigned operator / (const sc_unsigned &u, const sc_unsigned &v);
273 sc_signed operator / (const sc_unsigned &u, int64 v);
274 sc_unsigned operator / (const sc_unsigned &u, uint64 v);
275 sc_signed operator / (const sc_unsigned &u, long v);
276 sc_unsigned operator / (const sc_unsigned &u, unsigned long v);
277 sc_signed operator / (const sc_unsigned &u, int v);
278 inline sc_unsigned operator / (const sc_unsigned &u, unsigned int v);
279 
280 sc_signed operator / (int64 u, const sc_unsigned &v);
281 sc_unsigned operator / (uint64 u, const sc_unsigned &v);
282 sc_signed operator / (long u, const sc_unsigned &v);
283 sc_unsigned operator / (unsigned long u, const sc_unsigned &v);
284 sc_signed operator / (int u, const sc_unsigned &v);
285 inline sc_unsigned operator / (unsigned int u, const sc_unsigned &v);
286 
287 sc_unsigned operator / (const sc_unsigned &u, const sc_uint_base &v);
288 sc_signed operator / (const sc_unsigned &u, const sc_int_base &v);
289 sc_unsigned operator / (const sc_uint_base &u, const sc_unsigned &v);
290 sc_signed operator / (const sc_int_base &u, const sc_unsigned &v);
291 
292 // MODulo operators:
293 sc_signed operator % (const sc_unsigned &u, const sc_signed &v);
294 sc_signed operator % (const sc_signed &u, const sc_unsigned &v);
295 
296 sc_unsigned operator % (const sc_unsigned &u, const sc_unsigned &v);
297 sc_signed operator % (const sc_unsigned &u, int64 v);
298 sc_unsigned operator % (const sc_unsigned &u, uint64 v);
299 sc_signed operator % (const sc_unsigned &u, long v);
300 sc_unsigned operator % (const sc_unsigned &u, unsigned long v);
301 sc_signed operator % (const sc_unsigned &u, int v);
302 inline sc_unsigned operator % (const sc_unsigned &u, unsigned int v);
303 
304 sc_signed operator % (int64 u, const sc_unsigned &v);
305 sc_unsigned operator % (uint64 u, const sc_unsigned &v);
306 sc_signed operator % (long u, const sc_unsigned &v);
307 sc_unsigned operator % (unsigned long u, const sc_unsigned &v);
308 sc_signed operator % (int u, const sc_unsigned &v);
309 inline sc_unsigned operator % (unsigned int u, const sc_unsigned &v);
310 
311 sc_unsigned operator % (const sc_unsigned &u, const sc_uint_base &v);
312 sc_signed operator % (const sc_unsigned &u, const sc_int_base &v);
313 sc_unsigned operator % (const sc_uint_base &u, const sc_unsigned &v);
314 sc_signed operator % (const sc_int_base &u, const sc_unsigned &v);
315 
316 // BITWISE OPERATORS:
317 
318 // Bitwise AND operators:
319 sc_signed operator & (const sc_unsigned &u, const sc_signed &v);
320 sc_signed operator & (const sc_signed &u, const sc_unsigned &v);
321 
322 sc_unsigned operator & (const sc_unsigned &u, const sc_unsigned &v);
323 sc_signed operator & (const sc_unsigned &u, int64 v);
324 sc_unsigned operator & (const sc_unsigned &u, uint64 v);
325 sc_signed operator & (const sc_unsigned &u, long v);
326 sc_unsigned operator & (const sc_unsigned &u, unsigned long v);
327 sc_signed operator & (const sc_unsigned &u, int v);
328 inline sc_unsigned operator & (const sc_unsigned &u, unsigned int v);
329 
330 sc_signed operator & (int64 u, const sc_unsigned &v);
331 sc_unsigned operator & (uint64 u, const sc_unsigned &v);
332 sc_signed operator & (long u, const sc_unsigned &v);
333 sc_unsigned operator & (unsigned long u, const sc_unsigned &v);
334 sc_signed operator & (int u, const sc_unsigned &v);
335 inline sc_unsigned operator & (unsigned int u, const sc_unsigned &v);
336 
337 sc_unsigned operator & (const sc_unsigned &u, const sc_uint_base &v);
338 sc_signed operator & (const sc_unsigned &u, const sc_int_base &v);
339 sc_unsigned operator & (const sc_uint_base &u, const sc_unsigned &v);
340 sc_signed operator & (const sc_int_base &u, const sc_unsigned &v);
341 
342 // Bitwise OR operators:
343 sc_signed operator | (const sc_unsigned &u, const sc_signed &v);
344 sc_signed operator | (const sc_signed &u, const sc_unsigned &v);
345 
346 sc_unsigned operator | (const sc_unsigned &u, const sc_unsigned &v);
347 sc_signed operator | (const sc_unsigned &u, int64 v);
348 sc_unsigned operator | (const sc_unsigned &u, uint64 v);
349 sc_signed operator | (const sc_unsigned &u, long v);
350 sc_unsigned operator | (const sc_unsigned &u, unsigned long v);
351 sc_signed operator | (const sc_unsigned &u, int v);
352 inline sc_unsigned operator | (const sc_unsigned &u, unsigned int v);
353 
354 sc_signed operator | (int64 u, const sc_unsigned &v);
355 sc_unsigned operator | (uint64 u, const sc_unsigned &v);
356 sc_signed operator | (long u, const sc_unsigned &v);
357 sc_unsigned operator | (unsigned long u, const sc_unsigned &v);
358 sc_signed operator | (int u, const sc_unsigned &v);
359 inline sc_unsigned operator | (unsigned int u, const sc_unsigned &v);
360 
361 sc_unsigned operator | (const sc_unsigned &u, const sc_uint_base &v);
362 sc_signed operator | (const sc_unsigned &u, const sc_int_base &v);
363 sc_unsigned operator | (const sc_uint_base &u, const sc_unsigned &v);
364 sc_signed operator | (const sc_int_base &u, const sc_unsigned &v);
365 
366 // Bitwise XOR operators:
367 sc_signed operator ^ (const sc_unsigned &u, const sc_signed &v);
368 sc_signed operator ^ (const sc_signed &u, const sc_unsigned &v);
369 
370 sc_unsigned operator ^ (const sc_unsigned &u, const sc_unsigned &v);
371 sc_signed operator ^ (const sc_unsigned &u, int64 v);
372 sc_unsigned operator ^ (const sc_unsigned &u, uint64 v);
373 sc_signed operator ^ (const sc_unsigned &u, long v);
374 sc_unsigned operator ^ (const sc_unsigned &u, unsigned long v);
375 sc_signed operator ^ (const sc_unsigned &u, int v);
376 inline sc_unsigned operator ^ (const sc_unsigned &u, unsigned int v);
377 
378 sc_signed operator ^ (int64 u, const sc_unsigned &v);
379 sc_unsigned operator ^ (uint64 u, const sc_unsigned &v);
380 sc_signed operator ^ (long u, const sc_unsigned &v);
381 sc_unsigned operator ^ (unsigned long u, const sc_unsigned &v);
382 sc_signed operator ^ (int u, const sc_unsigned &v);
383 inline sc_unsigned operator ^ (unsigned int u, const sc_unsigned &v);
384 
385 sc_unsigned operator ^ (const sc_unsigned &u, const sc_uint_base &v);
386 sc_signed operator ^ (const sc_unsigned &u, const sc_int_base &v);
387 sc_unsigned operator ^ (const sc_uint_base &u, const sc_unsigned &v);
388 sc_signed operator ^ (const sc_int_base &u, const sc_unsigned &v);
389 
390 // SHIFT OPERATORS:
391 
392 // LEFT SHIFT operators:
393 sc_unsigned operator << (const sc_unsigned &u, const sc_signed &v);
394 sc_signed operator << (const sc_signed &u, const sc_unsigned &v);
395 
396 sc_unsigned operator << (const sc_unsigned &u, const sc_unsigned &v);
397 sc_unsigned operator << (const sc_unsigned &u, int64 v);
398 sc_unsigned operator << (const sc_unsigned &u, uint64 v);
399 sc_unsigned operator << (const sc_unsigned &u, long v);
400 sc_unsigned operator << (const sc_unsigned &u, unsigned long v);
401 inline sc_unsigned operator << (const sc_unsigned &u, int v);
402 inline sc_unsigned operator << (const sc_unsigned &u, unsigned int v);
403 
404 sc_unsigned operator << (const sc_unsigned &u, const sc_uint_base &v);
405 sc_unsigned operator << (const sc_unsigned &u, const sc_int_base &v);
406 
407 // RIGHT SHIFT operators:
408 sc_unsigned operator >> (const sc_unsigned &u, const sc_signed &v);
409 sc_signed operator >> (const sc_signed &u, const sc_unsigned &v);
410 
411 sc_unsigned operator >> (const sc_unsigned &u, const sc_unsigned &v);
412 sc_unsigned operator >> (const sc_unsigned &u, int64 v);
413 sc_unsigned operator >> (const sc_unsigned &u, uint64 v);
414 sc_unsigned operator >> (const sc_unsigned &u, long v);
415 sc_unsigned operator >> (const sc_unsigned &u, unsigned long v);
416 inline sc_unsigned operator >> (const sc_unsigned &u, int v);
417 inline sc_unsigned operator >> (const sc_unsigned &u, unsigned int v);
418 
419 sc_unsigned operator >> ( const sc_unsigned &, const sc_uint_base &);
420 sc_unsigned operator >> ( const sc_unsigned&, const sc_int_base &);
421 
422 // Unary arithmetic operators
423 sc_unsigned operator + (const sc_unsigned &u);
424 sc_signed operator - (const sc_unsigned &u);
425 
426 // LOGICAL OPERATORS:
427 
428 // Logical EQUAL operators:
429 bool operator == (const sc_unsigned &u, const sc_signed &v);
430 bool operator == (const sc_signed &u, const sc_unsigned &v);
431 
432 bool operator == (const sc_unsigned &u, const sc_unsigned &v);
433 bool operator == (const sc_unsigned &u, int64 v);
434 bool operator == (const sc_unsigned &u, uint64 v);
435 bool operator == (const sc_unsigned &u, long v);
436 bool operator == (const sc_unsigned &u, unsigned long v);
437 inline bool operator == (const sc_unsigned &u, int v);
438 inline bool operator == (const sc_unsigned &u, unsigned int v);
439 
440 bool operator == (int64 u, const sc_unsigned &v);
441 bool operator == (uint64 u, const sc_unsigned &v);
442 bool operator == (long u, const sc_unsigned &v);
443 bool operator == (unsigned long u, const sc_unsigned &v);
444 inline bool operator == (int u, const sc_unsigned &v);
445 inline bool operator == (unsigned int u, const sc_unsigned &v) ;
446 
447 bool operator == (const sc_unsigned &u, const sc_uint_base &v);
448 bool operator == (const sc_unsigned &u, const sc_int_base &v);
449 bool operator == (const sc_uint_base &u, const sc_unsigned &v);
450 bool operator == (const sc_int_base &u, const sc_unsigned &v);
451 
452 // Logical NOT_EQUAL operators:
453 bool operator != (const sc_unsigned &u, const sc_signed &v);
454 bool operator != (const sc_signed &u, const sc_unsigned &v);
455 
456 bool operator != (const sc_unsigned &u, const sc_unsigned &v);
457 bool operator != (const sc_unsigned &u, int64 v);
458 bool operator != (const sc_unsigned &u, uint64 v);
459 bool operator != (const sc_unsigned &u, long v);
460 bool operator != (const sc_unsigned &u, unsigned long v);
461 inline bool operator != (const sc_unsigned &u, int v);
462 inline bool operator != (const sc_unsigned &u, unsigned int v);
463 
464 bool operator != (int64 u, const sc_unsigned &v);
465 bool operator != (uint64 u, const sc_unsigned &v);
466 bool operator != (long u, const sc_unsigned &v);
467 bool operator != (unsigned long u, const sc_unsigned &v);
468 inline bool operator != (int u, const sc_unsigned &v);
469 inline bool operator != (unsigned int u, const sc_unsigned &v);
470 
471 bool operator != (const sc_unsigned &u, const sc_uint_base &v);
472 bool operator != (const sc_unsigned &u, const sc_int_base &v);
473 bool operator != (const sc_uint_base &u, const sc_unsigned &v);
474 bool operator != (const sc_int_base &u, const sc_unsigned &v);
475 
476 // Logical LESS_THAN operators:
477 bool operator < (const sc_unsigned &u, const sc_signed &v);
478 bool operator < (const sc_signed &u, const sc_unsigned &v);
479 
480 bool operator < (const sc_unsigned &u, const sc_unsigned &v);
481 bool operator < (const sc_unsigned &u, int64 v);
482 bool operator < (const sc_unsigned &u, uint64 v);
483 bool operator < (const sc_unsigned &u, long v);
484 bool operator < (const sc_unsigned &u, unsigned long v);
485 inline bool operator < (const sc_unsigned &u, int v);
486 inline bool operator < (const sc_unsigned &u, unsigned int v);
487 
488 bool operator < (int64 u, const sc_unsigned &v);
489 bool operator < (uint64 u, const sc_unsigned &v);
490 bool operator < (long u, const sc_unsigned &v);
491 bool operator < (unsigned long u, const sc_unsigned &v);
492 inline bool operator < (int u, const sc_unsigned &v);
493 inline bool operator < (unsigned int u, const sc_unsigned &v);
494 
495 bool operator < (const sc_unsigned &u, const sc_uint_base &v);
496 bool operator < (const sc_unsigned &u, const sc_int_base &v);
497 bool operator < (const sc_uint_base &u, const sc_unsigned &v);
498 bool operator < (const sc_int_base &u, const sc_unsigned &v);
499 
500 // Logical LESS_THAN_AND_EQUAL operators:
501 bool operator <= (const sc_unsigned &u, const sc_signed &v);
502 bool operator <= (const sc_signed &u, const sc_unsigned &v);
503 
504 bool operator <= (const sc_unsigned &u, const sc_unsigned &v);
505 bool operator <= (const sc_unsigned &u, int64 v);
506 bool operator <= (const sc_unsigned &u, uint64 v);
507 bool operator <= (const sc_unsigned &u, long v);
508 bool operator <= (const sc_unsigned &u, unsigned long v);
509 inline bool operator <= (const sc_unsigned &u, int v);
510 inline bool operator <= (const sc_unsigned &u, unsigned int v);
511 
512 bool operator <= (int64 u, const sc_unsigned &v);
513 bool operator <= (uint64 u, const sc_unsigned &v);
514 bool operator <= (long u, const sc_unsigned &v);
515 bool operator <= (unsigned long u, const sc_unsigned &v);
516 inline bool operator <= (int u, const sc_unsigned &v);
517 inline bool operator <= (unsigned int u, const sc_unsigned &v);
518 
519 bool operator <= (const sc_unsigned &u, const sc_uint_base &v);
520 bool operator <= (const sc_unsigned &u, const sc_int_base &v);
521 bool operator <= (const sc_uint_base &u, const sc_unsigned &v);
522 bool operator <= (const sc_int_base &u, const sc_unsigned &v);
523 
524 // Logical GREATER_THAN operators:
525 bool operator > (const sc_unsigned &u, const sc_signed &v);
526 bool operator > (const sc_signed &u, const sc_unsigned &v);
527 
528 bool operator > (const sc_unsigned &u, const sc_unsigned &v);
529 bool operator > (const sc_unsigned &u, int64 v);
530 bool operator > (const sc_unsigned &u, uint64 v);
531 bool operator > (const sc_unsigned &u, long v);
532 bool operator > (const sc_unsigned &u, unsigned long v);
533 inline bool operator > (const sc_unsigned &u, int v);
534 inline bool operator > (const sc_unsigned &u, unsigned int v);
535 
536 bool operator > (int64 u, const sc_unsigned &v);
537 bool operator > (uint64 u, const sc_unsigned &v);
538 bool operator > (long u, const sc_unsigned &v);
539 bool operator > (unsigned long u, const sc_unsigned &v);
540 inline bool operator > (int u, const sc_unsigned &v);
541 inline bool operator > (unsigned int u, const sc_unsigned &v);
542 
543 bool operator > (const sc_unsigned &u, const sc_uint_base &v);
544 bool operator > (const sc_unsigned &u, const sc_int_base &v);
545 bool operator > (const sc_uint_base &u, const sc_unsigned &v);
546 bool operator > (const sc_int_base &u, const sc_unsigned &v);
547 
548 // Logical GREATER_THAN_AND_EQUAL operators:
549 bool operator >= (const sc_unsigned &u, const sc_signed &v);
550 bool operator >= (const sc_signed &u, const sc_unsigned &v);
551 
552 bool operator >= (const sc_unsigned &u, const sc_unsigned &v);
553 bool operator >= (const sc_unsigned &u, int64 v);
554 bool operator >= (const sc_unsigned &u, uint64 v);
555 bool operator >= (const sc_unsigned &u, long v);
556 bool operator >= (const sc_unsigned &u, unsigned long v);
557 inline bool operator >= (const sc_unsigned &u, int v);
558 inline bool operator >= (const sc_unsigned &u, unsigned int v);
559 
560 bool operator >= (int64 u, const sc_unsigned &v);
561 bool operator >= (uint64 u, const sc_unsigned &v);
562 bool operator >= (long u, const sc_unsigned &v);
563 bool operator >= (unsigned long u, const sc_unsigned &v);
564 inline bool operator >= (int u, const sc_unsigned &v);
565 inline bool operator >= (unsigned int u, const sc_unsigned &v);
566 
567 bool operator >= (const sc_unsigned &u, const sc_uint_base &v);
568 bool operator >= (const sc_unsigned &u, const sc_int_base &v);
569 bool operator >= (const sc_uint_base &u, const sc_unsigned &v);
570 bool operator >= (const sc_int_base &u, const sc_unsigned &v);
571 
572 // Bitwise NOT operator (unary).
573 sc_unsigned operator ~ (const sc_unsigned &u);
574 
575 // ----------------------------------------------------------------------------
576 // CLASS : sc_unsigned_bitref_r
577 //
578 // Proxy class for sc_unsigned bit selection (r-value only).
579 // ----------------------------------------------------------------------------
580 
582 {
583  friend class sc_unsigned;
584 
585  protected:
586  // construction and initialization:
587  sc_unsigned_bitref_r() : sc_value_base(), m_index(0), m_obj_p(0) {}
588 
589  void
590  initialize(const sc_unsigned *obj_p, int index_)
591  {
592  m_obj_p = const_cast<sc_unsigned *>(obj_p);
593  m_index = index_;
594  }
595 
596  public:
597  // destructor
599 
600  // copy constructor
602  sc_value_base(a), m_index(a.m_index), m_obj_p(a.m_obj_p)
603  {}
604 
605  // capacity
606  int length() const { return 1; }
607 
608  // implicit conversion to bool
609  operator uint64 () const;
610  bool operator ! () const;
611  bool operator ~ () const;
612 
613  // explicit conversions
614  uint64 value() const { return operator uint64(); }
615  bool to_bool() const { return operator uint64(); }
616 
617  // concatenation support
618  virtual int
619  concat_length(bool *xz_present_p) const
620  {
621  if (xz_present_p)
622  *xz_present_p = false;
623  return 1;
624  }
625  virtual uint64
627  {
628  return (uint64)operator uint64();
629  }
630  virtual bool
631  concat_get_ctrl(sc_digit *dst_p, int low_i) const
632  {
633  int bit_mask = 1 << (low_i % BITS_PER_DIGIT);
634  int word_i = low_i / BITS_PER_DIGIT;
635  dst_p[word_i] &= ~bit_mask;
636  return false;
637  }
638  virtual bool
639  concat_get_data(sc_digit *dst_p, int low_i) const
640  {
641  int bit_mask = 1 << (low_i % BITS_PER_DIGIT);
642  bool result; // True if non-zero.
643  int word_i = low_i / BITS_PER_DIGIT;
644  if (operator uint64())
645  {
646  dst_p[word_i] |= bit_mask;
647  result = true;
648  } else {
649  dst_p[word_i] &= ~bit_mask;
650  result = false;
651  }
652  return result;
653  }
654 
655  // other methods
656  void print(::std::ostream &os=::std::cout) const { os << to_bool(); }
657 
658  protected:
659  int m_index;
661 
662  private:
663  // Disabled
664  const sc_unsigned_bitref_r &operator = (const sc_unsigned_bitref_r &);
665 };
666 
667 inline ::std::ostream &operator << (
668  ::std::ostream &, const sc_unsigned_bitref_r &);
669 
670 
671 // ----------------------------------------------------------------------------
672 // CLASS : sc_unsigned_bitref
673 //
674 // Proxy class for sc_unsigned bit selection (r-value and l-value).
675 // ----------------------------------------------------------------------------
676 
678 {
679  friend class sc_unsigned;
681 
682  protected: // construction
684 
685  public:
686  // copy constructor
688  {}
689 
690  // assignment operators
691  const sc_unsigned_bitref &operator = (const sc_unsigned_bitref_r &);
692  const sc_unsigned_bitref &operator = (const sc_unsigned_bitref &);
693  const sc_unsigned_bitref &operator = (bool);
694 
695  const sc_unsigned_bitref &operator &= (bool);
696  const sc_unsigned_bitref &operator |= (bool);
697  const sc_unsigned_bitref &operator ^= (bool);
698 
699  // concatenation methods
700  virtual void concat_set(int64 src, int low_i);
701  virtual void concat_set(const sc_signed &src, int low_i);
702  virtual void concat_set(const sc_unsigned &src, int low_i);
703  virtual void concat_set(uint64 src, int low_i);
704 
705  // other methods
706  void scan(::std::istream &is=::std::cin);
707 
708  protected:
710 };
711 
712 inline ::std::istream &operator >> (::std::istream &, sc_unsigned_bitref &);
713 
714 
715 // ----------------------------------------------------------------------------
716 // CLASS : sc_unsigned_subref_r
717 //
718 // Proxy class for sc_unsigned part selection (r-value only).
719 // ----------------------------------------------------------------------------
720 
722 {
723  friend class sc_signed;
724  friend class sc_unsigned;
725  friend class sc_unsigned_signal;
726 
727  protected:
728  // constructor
729  sc_unsigned_subref_r() : sc_value_base(), m_left(0), m_obj_p(0), m_right(0)
730  {}
731 
732  void
733  initialize(const sc_unsigned *obj_p, int left_, int right_)
734  {
735  m_obj_p = const_cast<sc_unsigned *>(obj_p);
736  m_left = left_;
737  m_right = right_;
738  }
739 
740  public:
741  // destructor
743 
744  // copy constructor
746  sc_value_base(a), m_left(a.m_left), m_obj_p(a.m_obj_p),
747  m_right(a.m_right)
748  {}
749 
750  // capacity
751  int
752  length() const
753  {
754  if (m_left >= m_right)
755  return m_left - m_right + 1;
756  else
757  return m_right - m_left + 1;
758  }
759 
760  // implicit conversion to sc_unsigned
761  operator sc_unsigned () const;
762 
763  // explicit conversions
764  int to_int() const;
765  unsigned int to_uint() const;
766  long to_long() const;
767  unsigned long to_ulong() const;
768  int64 to_int64() const;
769  uint64 to_uint64() const;
770  double to_double() const;
771 
772  // explicit conversion to character string
773  const std::string to_string(sc_numrep numrep=SC_DEC) const;
774  const std::string to_string(sc_numrep numrep, bool w_prefix) const;
775 
776  // concatenation support
777  virtual int concat_length(bool *xz_present_p) const
778  {
779  if (xz_present_p)
780  *xz_present_p = false;
781  return m_left - m_right + 1;
782  }
783  virtual uint64 concat_get_uint64() const;
784  virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const;
785  virtual bool concat_get_data(sc_digit *dst_p, int low_i) const;
786 
787  // reduce methods
788  bool and_reduce() const;
789  bool nand_reduce() const;
790  bool or_reduce() const;
791  bool nor_reduce() const;
792  bool xor_reduce() const ;
793  bool xnor_reduce() const;
794 
795  // other methods
796  void
797  print(::std::ostream &os=::std::cout) const
798  {
800  }
801 
802  protected:
803  int m_left; // Left-most bit in this part selection.
804  sc_unsigned *m_obj_p; // Target of this part selection.
805  int m_right; // Right-most bit in this part selection.
806 
807  private:
808  // Disabled
809  const sc_unsigned_subref_r &operator = (const sc_unsigned_subref_r &);
810 };
811 
812 inline ::std::ostream &operator << (
813  ::std::ostream &, const sc_unsigned_subref_r &);
814 
815 
816 // ----------------------------------------------------------------------------
817 // CLASS : sc_unsigned_subref
818 //
819 // Proxy class for sc_unsigned part selection (r-value and l-value).
820 // ----------------------------------------------------------------------------
821 
823 {
824  friend class sc_unsigned;
826 
827  // constructor
828  protected:
830 
831  public:
832  // copy constructor
834  {}
835 
836  // assignment operators
837  const sc_unsigned_subref &operator = (const sc_unsigned_subref_r &a);
838  const sc_unsigned_subref &operator = (const sc_unsigned_subref &a);
839  const sc_unsigned_subref &operator = (const sc_unsigned &a);
840 
841  template<class T>
842  const sc_unsigned_subref &operator = (const sc_generic_base<T> &a);
843  const sc_unsigned_subref &operator = (const sc_signed_subref_r &a);
844  const sc_unsigned_subref &operator = (const sc_signed &a);
845 
846  const sc_unsigned_subref &operator = (const char *a);
847  const sc_unsigned_subref &operator = (unsigned long a);
848  const sc_unsigned_subref &operator = (long a);
849 
850  const sc_unsigned_subref &
851  operator = (unsigned int a)
852  {
853  return operator = ((unsigned long)a);
854  }
855 
856  const sc_unsigned_subref &
857  operator = (int a)
858  {
859  return operator = ((long)a);
860  }
861 
862  const sc_unsigned_subref &operator = (uint64 a);
863  const sc_unsigned_subref &operator = (int64 a);
864  const sc_unsigned_subref &operator = (double a);
865  const sc_unsigned_subref &operator = (const sc_int_base &a);
866  const sc_unsigned_subref &operator = (const sc_uint_base &a);
867 
868  // concatenation methods
869  virtual void concat_set(int64 src, int low_i);
870  virtual void concat_set(const sc_signed &src, int low_i);
871  virtual void concat_set(const sc_unsigned &src, int low_i);
872  virtual void concat_set(uint64 src, int low_i);
873 
874  // other methods
875  void scan(::std::istream &is=::std::cin);
876 
877  protected:
879 };
880 
881 inline ::std::istream &operator >> (::std::istream &, sc_unsigned_subref &);
882 
883 
884 // ----------------------------------------------------------------------------
885 // CLASS : sc_unsigned
886 //
887 // Arbitrary precision unsigned number.
888 // ----------------------------------------------------------------------------
889 
891 {
892  friend class sc_concatref;
893  friend class sc_unsigned_bitref_r;
894  friend class sc_unsigned_bitref;
895  friend class sc_unsigned_subref_r;
896  friend class sc_unsigned_subref;
897  friend class sc_signed;
898  friend class sc_signed_subref;
899  friend class sc_signed_subref_r;
900 
901  // Needed for types using sc_unsigned.
902  typedef bool elemtype;
903 
904  void invalid_init(const char *type_name, int nb) const;
905 
906  public:
907  // constructors
908  explicit sc_unsigned(int nb=sc_length_param().len());
909  sc_unsigned(const sc_unsigned &v);
910  sc_unsigned(const sc_signed &v);
911  template<class T>
912  explicit sc_unsigned(const sc_generic_base<T> &v);
913  explicit sc_unsigned(const sc_bv_base &v);
914  explicit sc_unsigned(const sc_lv_base &v);
915  explicit sc_unsigned(const sc_int_subref_r &v);
916  explicit sc_unsigned(const sc_uint_subref_r &v);
917  explicit sc_unsigned(const sc_signed_subref_r &v);
918  explicit sc_unsigned(const sc_unsigned_subref_r &v);
919 
920  // assignment operators
921  const sc_unsigned &operator = (const sc_unsigned &v);
922  const sc_unsigned &operator = (const sc_unsigned_subref_r &a);
923 
924  template<class T>
925  const sc_unsigned &
926  operator = (const sc_generic_base<T> &a)
927  {
928  a->to_sc_unsigned(*this);
929  return *this;
930  }
931 
932  const sc_unsigned &operator = (const sc_signed &v);
933  const sc_unsigned &operator = (const sc_signed_subref_r &a);
934 
935  const sc_unsigned &operator = (const char *v);
936  const sc_unsigned &operator = (int64 v);
937  const sc_unsigned &operator = (uint64 v);
938  const sc_unsigned &operator = (long v);
939  const sc_unsigned &operator = (unsigned long v);
940 
941  const sc_unsigned &
942  operator = (int v)
943  {
944  return operator = ((long)v);
945  }
946 
947  const sc_unsigned &
948  operator = (unsigned int v)
949  {
950  return operator = ((unsigned long)v);
951  }
952 
953  const sc_unsigned &operator = (double v);
954  const sc_unsigned &operator = (const sc_int_base &v);
955  const sc_unsigned &operator = (const sc_uint_base &v);
956 
957  const sc_unsigned &operator = (const sc_bv_base &);
958  const sc_unsigned &operator = (const sc_lv_base &);
959 
960  const sc_unsigned &operator = (const sc_fxval &);
961  const sc_unsigned &operator = (const sc_fxval_fast &);
962  const sc_unsigned &operator = (const sc_fxnum &);
963  const sc_unsigned &operator = (const sc_fxnum_fast &);
964 
965  // destructor
966  virtual ~sc_unsigned()
967  {
968 # ifndef SC_MAX_NBITS
969  delete [] digit;
970 # endif
971  }
972 
973  // Concatenation support:
974  sc_digit *get_raw() const { return digit; }
975  virtual int
976  concat_length(bool *xz_present_p) const
977  {
978  if (xz_present_p)
979  *xz_present_p = false;
980  return nbits - 1;
981  }
982  virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const;
983  virtual bool concat_get_data(sc_digit *dst_p, int low_i) const;
984  virtual uint64 concat_get_uint64() const;
985  virtual void concat_set(int64 src, int low_i);
986  virtual void concat_set(const sc_signed &src, int low_i);
987  virtual void concat_set(const sc_unsigned &src, int low_i);
988  virtual void concat_set(uint64 src, int low_i);
989 
990  // Increment operators.
991  sc_unsigned &operator ++ ();
992  const sc_unsigned operator ++ (int);
993 
994  // Decrement operators.
995  sc_unsigned &operator -- ();
996  const sc_unsigned operator -- (int);
997 
998  // bit selection
999  inline void
1000  check_index(int i) const
1001  {
1002  if ((i < 0) || (i >= nbits - 1))
1003  invalid_index(i);
1004  }
1005 
1006  void invalid_index(int i) const;
1007 
1009  operator [] (int i)
1010  {
1011  check_index(i);
1012  sc_unsigned_bitref *result_p = sc_unsigned_bitref::m_pool.allocate();
1013  result_p->initialize(this, i);
1014  return *result_p;
1015  }
1016 
1017  const sc_unsigned_bitref_r &
1018  operator [] (int i) const
1019  {
1020  check_index(i);
1021  sc_unsigned_bitref *result_p = sc_unsigned_bitref::m_pool.allocate();
1022  result_p->initialize(this, i);
1023  return *result_p;
1024  }
1025 
1027  bit(int i)
1028  {
1029  check_index(i);
1030  sc_unsigned_bitref *result_p = sc_unsigned_bitref::m_pool.allocate();
1031  result_p->initialize(this, i);
1032  return *result_p;
1033  }
1034 
1035  const sc_unsigned_bitref_r &
1036  bit(int i) const
1037  {
1038  check_index(i);
1039  sc_unsigned_bitref *result_p = sc_unsigned_bitref::m_pool.allocate();
1040  result_p->initialize(this, i);
1041  return *result_p;
1042  }
1043 
1044  // part selection
1045 
1046  // Subref operators. Help access the range of bits from the ith to
1047  // jth. These indices have arbitrary precedence with respect to each
1048  // other, i.e., we can have i <= j or i > j. Note the equivalence
1049  // between range(i, j) and operator (i, j). Also note that
1050  // operator (i, i) returns an unsigned number that corresponds to the
1051  // bit operator [i], so these two forms are not the same.
1052  inline void
1053  check_range(int l, int r) const
1054  {
1055  if (l < r) {
1056  if ((l < 0) || (r >= nbits - 1))
1057  invalid_range(l, r);
1058  } else {
1059  if ((r < 0) || (l >= nbits - 1))
1060  invalid_range(l, r);
1061  }
1062  }
1063 
1064  void invalid_range(int l, int r) const;
1065 
1067  range(int i, int j)
1068  {
1069  check_range(i, j);
1070  sc_unsigned_subref *result_p = sc_unsigned_subref::m_pool.allocate();
1071  result_p->initialize(this, i, j);
1072  return *result_p;
1073  }
1074 
1075  const sc_unsigned_subref_r &
1076  range(int i, int j) const
1077  {
1078  check_range(i, j);
1079  sc_unsigned_subref *result_p = sc_unsigned_subref::m_pool.allocate();
1080  result_p->initialize(this, i, j);
1081  return *result_p;
1082  }
1083 
1085  operator () (int i, int j)
1086  {
1087  check_range(i,j);
1088  sc_unsigned_subref *result_p = sc_unsigned_subref::m_pool.allocate();
1089  result_p->initialize(this, i, j);
1090  return *result_p;
1091  }
1092 
1093  const sc_unsigned_subref_r &
1094  operator () (int i, int j) const
1095  {
1096  check_range(i,j);
1097  sc_unsigned_subref *result_p = sc_unsigned_subref::m_pool.allocate();
1098  result_p->initialize(this, i, j);
1099  return *result_p;
1100  }
1101 
1102  // explicit conversions
1103  int to_int() const;
1104  unsigned int to_uint() const;
1105  long to_long() const;
1106  unsigned long to_ulong() const;
1107  int64 to_int64() const;
1108  uint64 to_uint64() const;
1109  double to_double() const;
1110 
1111  // explicit conversion to character string
1112  const std::string to_string(sc_numrep numrep=SC_DEC) const;
1113  const std::string to_string(sc_numrep numrep, bool w_prefix) const;
1114 
1115  // Print functions. dump prints the internals of the class.
1116  void
1117  print(::std::ostream &os=::std::cout) const
1118  {
1120  }
1121 
1122  void scan(::std::istream &is=::std::cin);
1123  void dump(::std::ostream &os=::std::cout) const;
1124 
1125  // Functions to find various properties.
1126  int length() const { return nbits - 1; } // Bit width.
1127  bool iszero() const; // Is the number zero?
1128  bool sign() const { return 0; } // Sign.
1129 
1130  // reduce methods
1131  bool and_reduce() const;
1132  bool nand_reduce() const { return !and_reduce(); }
1133  bool or_reduce() const;
1134  bool nor_reduce() const { return !or_reduce(); }
1135  bool xor_reduce() const;
1136  bool xnor_reduce() const { return !xor_reduce(); }
1137 
1138  // Functions to access individual bits.
1139  bool test(int i) const; // Is the ith bit 0 or 1?
1140  void set(int i); // Set the ith bit to 1.
1141  void clear(int i); // Set the ith bit to 0.
1142  void
1143  set(int i, bool v) // Set the ith bit to v.
1144  {
1145  if (v)
1146  set(i);
1147  else
1148  clear(i);
1149  }
1150  void
1151  invert(int i) // Negate the ith bit.
1152  {
1153  if (test(i))
1154  clear(i);
1155  else
1156  set(i);
1157  }
1158 
1159  // Make the number equal to its mirror image.
1160  void reverse();
1161 
1162  // Get/set a packed bit representation of the number.
1163  void get_packed_rep(sc_digit *buf) const;
1164  void set_packed_rep(sc_digit *buf);
1165 
1166  /*
1167  The comparison of the old and new semantics are as follows:
1168 
1169  Let s = sc_signed,
1170  u = sc_unsigned,
1171  un = { uint64, unsigned long, unsigned int },
1172  sn = { int64, long, int, char* }, and
1173  OP = { +, -, *, /, % }.
1174 
1175  Old semantics: New semantics:
1176  u OP u -> u u OP u -> u
1177  s OP u -> u s OP u -> s
1178  u OP s -> u u OP s -> s
1179  s OP s -> s s OP s -> s
1180 
1181  u OP un = un OP u -> u u OP un = un OP u -> u
1182  u OP sn = sn OP u -> u u OP sn = sn OP u -> s
1183 
1184  s OP un = un OP s -> s s OP un = un OP s -> s
1185  s OP sn = sn OP s -> s s OP sn = sn OP s -> s
1186 
1187  In the new semantics, the result is u if both operands are u; the
1188  result is s otherwise. The only exception is subtraction. The result
1189  of a subtraction is always s.
1190 
1191  The old semantics is like C/C++ semantics on integer types; the
1192  new semantics is due to the VSIA C/C++ data types standard.
1193  */
1194 
1195  // ARITHMETIC OPERATORS:
1196 
1197  // ADDition operators:
1198  friend sc_signed operator + (const sc_unsigned &u, const sc_signed &v);
1199  friend sc_signed operator + (const sc_signed &u, const sc_unsigned &v);
1200 
1201  friend sc_unsigned operator + (const sc_unsigned &u, const sc_unsigned &v);
1202  friend sc_signed operator + (const sc_unsigned &u, int64 v);
1203  friend sc_unsigned operator + (const sc_unsigned &u, uint64 v);
1204  friend sc_signed operator + (const sc_unsigned &u, long v);
1205  friend sc_unsigned operator + (const sc_unsigned &u, unsigned long v);
1206  friend sc_signed operator + (const sc_unsigned &u, int v);
1207  friend sc_unsigned
1208  operator + (const sc_unsigned &u, unsigned int v)
1209  {
1210  return operator + (u, (unsigned long)v);
1211  }
1212 
1213  friend sc_signed operator + (int64 u, const sc_unsigned &v);
1214  friend sc_unsigned operator + (uint64 u, const sc_unsigned &v);
1215  friend sc_signed operator + (long u, const sc_unsigned &v);
1216  friend sc_unsigned operator + (unsigned long u, const sc_unsigned &v);
1217  friend sc_signed operator + (int u, const sc_unsigned &v);
1218  friend sc_unsigned
1219  operator + (unsigned int u, const sc_unsigned &v)
1220  {
1221  return operator + ((unsigned long)u, v);
1222  }
1223 
1224  const sc_unsigned &operator += (const sc_signed &v);
1225  const sc_unsigned &operator += (const sc_unsigned &v);
1226  const sc_unsigned &operator += (int64 v);
1227  const sc_unsigned &operator += (uint64 v);
1228  const sc_unsigned &operator += (long v);
1229  const sc_unsigned &operator += (unsigned long v);
1230  const sc_unsigned &
1231  operator += (int v)
1232  {
1233  return operator += ((long)v);
1234  }
1235  const sc_unsigned &
1236  operator += (unsigned int v)
1237  {
1238  return operator += ((unsigned long)v);
1239  }
1240 
1241  friend sc_unsigned operator + (
1242  const sc_unsigned &u, const sc_uint_base &v);
1243  friend sc_signed operator + (const sc_unsigned &u, const sc_int_base &v);
1244  friend sc_unsigned operator + (
1245  const sc_uint_base &u, const sc_unsigned &v);
1246  friend sc_signed operator + (const sc_int_base &u, const sc_unsigned &v);
1247  const sc_unsigned &operator += (const sc_int_base &v);
1248  const sc_unsigned &operator += (const sc_uint_base &v);
1249 
1250  // SUBtraction operators:
1251  friend sc_signed operator - (const sc_unsigned &u, const sc_signed &v);
1252  friend sc_signed operator - (const sc_signed &u, const sc_unsigned &v);
1253 
1254  friend sc_signed operator - (const sc_unsigned &u, const sc_unsigned &v);
1255  friend sc_signed operator - (const sc_unsigned &u, int64 v);
1256  friend sc_signed operator - (const sc_unsigned &u, uint64 v);
1257  friend sc_signed operator - (const sc_unsigned &u, long v);
1258  friend sc_signed operator - (const sc_unsigned &u, unsigned long v);
1259  friend sc_signed operator - (const sc_unsigned &u, int v);
1260  friend sc_signed operator - (const sc_unsigned &u, unsigned int v);
1261 
1262  friend sc_signed operator - (int64 u, const sc_unsigned &v);
1263  friend sc_signed operator - (uint64 u, const sc_unsigned &v);
1264  friend sc_signed operator - (long u, const sc_unsigned &v);
1265  friend sc_signed operator - (unsigned long u, const sc_unsigned &v);
1266  friend sc_signed operator - (int u, const sc_unsigned &v);
1267  friend sc_signed operator - (unsigned int u, const sc_unsigned &v);
1268 
1269  const sc_unsigned &operator -= (const sc_signed &v);
1270  const sc_unsigned &operator -= (const sc_unsigned &v);
1271  const sc_unsigned &operator -= (int64 v);
1272  const sc_unsigned &operator -= (uint64 v);
1273  const sc_unsigned &operator -= (long v);
1274  const sc_unsigned &operator -= (unsigned long v);
1275  const sc_unsigned &
1276  operator -= (int v)
1277  {
1278  return operator -= ((long)v);
1279  }
1280  const sc_unsigned &
1281  operator -= (unsigned int v)
1282  {
1283  return operator -= ((unsigned long)v);
1284  }
1285 
1286  friend sc_signed operator - (const sc_unsigned &u, const sc_uint_base &v);
1287  friend sc_signed operator - (const sc_unsigned &u, const sc_int_base &v);
1288  friend sc_signed operator - (const sc_uint_base &u, const sc_unsigned &v);
1289  friend sc_signed operator - (const sc_int_base &u, const sc_unsigned &v);
1290  const sc_unsigned &operator -= (const sc_int_base &v);
1291  const sc_unsigned &operator -= (const sc_uint_base &v);
1292 
1293  // MULtiplication operators:
1294  friend sc_signed operator * (const sc_unsigned &u, const sc_signed &v);
1295  friend sc_signed operator * (const sc_signed &u, const sc_unsigned &v);
1296 
1297  friend sc_unsigned operator * (const sc_unsigned &u, const sc_unsigned &v);
1298  friend sc_signed operator * (const sc_unsigned &u, int64 v);
1299  friend sc_unsigned operator * (const sc_unsigned &u, uint64 v);
1300  friend sc_signed operator * (const sc_unsigned &u, long v);
1301  friend sc_unsigned operator * (const sc_unsigned &u, unsigned long v);
1302  friend sc_signed operator * (const sc_unsigned &u, int v);
1303  friend sc_unsigned
1304  operator * (const sc_unsigned &u, unsigned int v)
1305  {
1306  return operator * (u, (unsigned long)v);
1307  }
1308 
1309  friend sc_signed operator * (int64 u, const sc_unsigned &v);
1310  friend sc_unsigned operator * (uint64 u, const sc_unsigned &v);
1311  friend sc_signed operator * (long u, const sc_unsigned &v);
1312  friend sc_unsigned operator * (unsigned long u, const sc_unsigned &v);
1313  friend sc_signed operator * (int u, const sc_unsigned &v);
1314  friend sc_unsigned
1315  operator * (unsigned int u, const sc_unsigned &v)
1316  {
1317  return operator * ((unsigned long)u, v);
1318  }
1319 
1320  const sc_unsigned &operator *= (const sc_signed &v);
1321  const sc_unsigned &operator *= (const sc_unsigned &v);
1322  const sc_unsigned &operator *= (int64 v);
1323  const sc_unsigned &operator *= (uint64 v);
1324  const sc_unsigned &operator *= (long v);
1325  const sc_unsigned &operator *= (unsigned long v);
1326  const sc_unsigned &operator *= (int v) { return operator *= ((long)v); }
1327  const sc_unsigned &
1328  operator *= (unsigned int v)
1329  {
1330  return operator *= ((unsigned long)v);
1331  }
1332 
1333  friend sc_unsigned operator * (
1334  const sc_unsigned &u, const sc_uint_base &v);
1335  friend sc_signed operator * (const sc_unsigned &u, const sc_int_base &v);
1336  friend sc_unsigned operator * (
1337  const sc_uint_base &u, const sc_unsigned &v);
1338  friend sc_signed operator * (const sc_int_base &u, const sc_unsigned &v);
1339  const sc_unsigned &operator *= (const sc_int_base &v);
1340  const sc_unsigned &operator *= (const sc_uint_base &v);
1341 
1342  // DIVision operators:
1343  friend sc_signed operator / (const sc_unsigned &u, const sc_signed &v);
1344  friend sc_signed operator / (const sc_signed &u, const sc_unsigned &v);
1345 
1346  friend sc_unsigned operator / (const sc_unsigned &u, const sc_unsigned &v);
1347  friend sc_signed operator / (const sc_unsigned &u, int64 v);
1348  friend sc_unsigned operator / (const sc_unsigned &u, uint64 v);
1349  friend sc_signed operator / (const sc_unsigned &u, long v);
1350  friend sc_unsigned operator / (const sc_unsigned &u, unsigned long v);
1351  friend sc_signed operator / (const sc_unsigned &u, int v);
1352  friend sc_unsigned
1353  operator / (const sc_unsigned &u, unsigned int v)
1354  {
1355  return operator / (u, (unsigned long)v);
1356  }
1357 
1358  friend sc_signed operator / (int64 u, const sc_unsigned &v);
1359  friend sc_unsigned operator / (uint64 u, const sc_unsigned &v);
1360  friend sc_signed operator / (long u, const sc_unsigned &v);
1361  friend sc_unsigned operator / (unsigned long u, const sc_unsigned &v);
1362  friend sc_signed operator / (int u, const sc_unsigned &v);
1363  friend sc_unsigned
1364  operator / (unsigned int u, const sc_unsigned &v)
1365  {
1366  return operator / ((unsigned long)u, v);
1367  }
1368 
1369  const sc_unsigned &operator /= (const sc_signed &v);
1370  const sc_unsigned &operator /= (const sc_unsigned &v);
1371  const sc_unsigned &operator /= (int64 v);
1372  const sc_unsigned &operator /= (uint64 v);
1373  const sc_unsigned &operator /= (long v);
1374  const sc_unsigned &operator /= (unsigned long v);
1375  const sc_unsigned &operator /= (int v) { return operator /= ((long)v); }
1376  const sc_unsigned &
1377  operator /= (unsigned int v)
1378  {
1379  return operator /= ((unsigned long)v);
1380  }
1381 
1382  friend sc_unsigned operator / (
1383  const sc_unsigned &u, const sc_uint_base &v);
1384  friend sc_signed operator / (const sc_unsigned &u, const sc_int_base &v);
1385  friend sc_unsigned operator / (
1386  const sc_uint_base &u, const sc_unsigned &v);
1387  friend sc_signed operator / (const sc_int_base &u, const sc_unsigned &v);
1388  const sc_unsigned &operator /= (const sc_int_base &v);
1389  const sc_unsigned &operator /= (const sc_uint_base &v);
1390 
1391  // MODulo operators:
1392  friend sc_signed operator % (const sc_unsigned &u, const sc_signed &v);
1393  friend sc_signed operator % (const sc_signed &u, const sc_unsigned &v);
1394 
1395  friend sc_unsigned operator % (const sc_unsigned &u, const sc_unsigned &v);
1396  friend sc_signed operator % (const sc_unsigned &u, int64 v);
1397  friend sc_unsigned operator % (const sc_unsigned &u, uint64 v);
1398  friend sc_signed operator % (const sc_unsigned &u, long v);
1399  friend sc_unsigned operator % (const sc_unsigned &u, unsigned long v);
1400  friend sc_signed operator % (const sc_unsigned &u, int v);
1401  friend sc_unsigned
1402  operator % (const sc_unsigned &u, unsigned int v)
1403  {
1404  return operator % (u, (unsigned long)v);
1405  }
1406 
1407  friend sc_signed operator % (int64 u, const sc_unsigned &v);
1408  friend sc_unsigned operator % (uint64 u, const sc_unsigned &v);
1409  friend sc_signed operator % (long u, const sc_unsigned &v);
1410  friend sc_unsigned operator % (unsigned long u, const sc_unsigned &v);
1411  friend sc_signed operator % (int u, const sc_unsigned &v);
1412  friend sc_unsigned
1413  operator % (unsigned int u, const sc_unsigned &v)
1414  {
1415  return operator % ((unsigned long)u, v);
1416  }
1417 
1418  const sc_unsigned &operator %= (const sc_signed &v);
1419  const sc_unsigned &operator %= (const sc_unsigned &v);
1420  const sc_unsigned &operator %= (int64 v);
1421  const sc_unsigned &operator %= (uint64 v);
1422  const sc_unsigned &operator %= (long v);
1423  const sc_unsigned &operator %= (unsigned long v);
1424  const sc_unsigned &operator %= (int v) { return operator %= ((long)v); }
1425  const sc_unsigned &
1426  operator %= (unsigned int v)
1427  {
1428  return operator %= ((unsigned long)v);
1429  }
1430 
1431  friend sc_unsigned operator % (
1432  const sc_unsigned &u, const sc_uint_base &v);
1433  friend sc_signed operator % (const sc_unsigned &u, const sc_int_base &v);
1434  friend sc_unsigned operator % (
1435  const sc_uint_base &u, const sc_unsigned &v);
1436  friend sc_signed operator % (const sc_int_base &u, const sc_unsigned &v);
1437  const sc_unsigned &operator %= (const sc_int_base &v);
1438  const sc_unsigned &operator %= (const sc_uint_base &v);
1439 
1440  // BITWISE OPERATORS:
1441 
1442  // Bitwise AND operators:
1443  friend sc_signed operator & (const sc_unsigned &u, const sc_signed &v);
1444  friend sc_signed operator & (const sc_signed &u, const sc_unsigned &v);
1445 
1446  friend sc_unsigned operator & (const sc_unsigned &u, const sc_unsigned &v);
1447  friend sc_signed operator & (const sc_unsigned &u, int64 v);
1448  friend sc_unsigned operator & (const sc_unsigned &u, uint64 v);
1449  friend sc_signed operator & (const sc_unsigned &u, long v);
1450  friend sc_unsigned operator & (const sc_unsigned &u, unsigned long v);
1451  friend sc_signed operator & (const sc_unsigned &u, int v);
1452  friend sc_unsigned
1453  operator & (const sc_unsigned &u, unsigned int v)
1454  {
1455  return operator & (u, (unsigned long)v);
1456  }
1457 
1458  friend sc_signed operator & (int64 u, const sc_unsigned &v);
1459  friend sc_unsigned operator & (uint64 u, const sc_unsigned &v);
1460  friend sc_signed operator & (long u, const sc_unsigned &v);
1461  friend sc_unsigned operator & (unsigned long u, const sc_unsigned &v);
1462  friend sc_signed operator & (int u, const sc_unsigned &v);
1463  friend sc_unsigned
1464  operator & (unsigned int u, const sc_unsigned &v)
1465  {
1466  return operator & ((unsigned long)u, v);
1467  }
1468 
1469  const sc_unsigned &operator &= (const sc_signed &v);
1470  const sc_unsigned &operator &= (const sc_unsigned &v);
1471  const sc_unsigned &operator &= (int64 v);
1472  const sc_unsigned &operator &= (uint64 v);
1473  const sc_unsigned &operator &= (long v);
1474  const sc_unsigned &operator &= (unsigned long v);
1475  const sc_unsigned &operator &= (int v) { return operator&=((long) v); }
1476  const sc_unsigned &
1477  operator &= (unsigned int v)
1478  {
1479  return operator &= ((unsigned long)v);
1480  }
1481 
1482  friend sc_unsigned operator & (
1483  const sc_unsigned &u, const sc_uint_base &v);
1484  friend sc_signed operator & (const sc_unsigned &u, const sc_int_base &v);
1485  friend sc_unsigned operator & (
1486  const sc_uint_base &u, const sc_unsigned &v);
1487  friend sc_signed operator & (const sc_int_base &u, const sc_unsigned &v);
1488  const sc_unsigned &operator &= (const sc_int_base &v);
1489  const sc_unsigned &operator &= (const sc_uint_base &v);
1490 
1491  // Bitwise OR operators:
1492  friend sc_signed operator | (const sc_unsigned &u, const sc_signed &v);
1493  friend sc_signed operator | (const sc_signed &u, const sc_unsigned &v);
1494 
1495  friend sc_unsigned operator | (const sc_unsigned &u, const sc_unsigned &v);
1496  friend sc_signed operator | (const sc_unsigned &u, int64 v);
1497  friend sc_unsigned operator | (const sc_unsigned &u, uint64 v);
1498  friend sc_signed operator | (const sc_unsigned &u, long v);
1499  friend sc_unsigned operator | (const sc_unsigned &u, unsigned long v);
1500  friend sc_signed operator | (const sc_unsigned &u, int v);
1501  friend sc_unsigned
1502  operator | (const sc_unsigned &u, unsigned int v)
1503  {
1504  return operator | (u, (unsigned long)v);
1505  }
1506 
1507  friend sc_signed operator | (int64 u, const sc_unsigned &v);
1508  friend sc_unsigned operator | (uint64 u, const sc_unsigned &v);
1509  friend sc_signed operator | (long u, const sc_unsigned &v);
1510  friend sc_unsigned operator | (unsigned long u, const sc_unsigned &v);
1511  friend sc_signed operator | (int u, const sc_unsigned &v);
1512  friend sc_unsigned
1513  operator | (unsigned int u, const sc_unsigned &v)
1514  {
1515  return operator | ((unsigned long)u, v);
1516  }
1517 
1518  const sc_unsigned &operator |= (const sc_signed &v);
1519  const sc_unsigned &operator |= (const sc_unsigned &v);
1520  const sc_unsigned &operator |= (int64 v);
1521  const sc_unsigned &operator |= (uint64 v);
1522  const sc_unsigned &operator |= (long v);
1523  const sc_unsigned &operator |= (unsigned long v);
1524  const sc_unsigned &operator |= (int v) { return operator|=((long) v); }
1525  const sc_unsigned &
1526  operator |= (unsigned int v)
1527  {
1528  return operator |= ((unsigned long)v);
1529  }
1530 
1531  friend sc_unsigned operator | (
1532  const sc_unsigned &u, const sc_uint_base &v);
1533  friend sc_signed operator | (const sc_unsigned &u, const sc_int_base &v);
1534  friend sc_unsigned operator | (
1535  const sc_uint_base &u, const sc_unsigned &v);
1536  friend sc_signed operator | (const sc_int_base &u, const sc_unsigned &v);
1537  const sc_unsigned &operator |= (const sc_int_base &v);
1538  const sc_unsigned &operator |= (const sc_uint_base &v);
1539 
1540  // Bitwise XOR operators:
1541  friend sc_signed operator ^ (const sc_unsigned &u, const sc_signed &v);
1542  friend sc_signed operator ^ (const sc_signed &u, const sc_unsigned &v);
1543 
1544  friend sc_unsigned operator ^ (const sc_unsigned &u, const sc_unsigned &v);
1545  friend sc_signed operator ^ (const sc_unsigned &u, int64 v);
1546  friend sc_unsigned operator ^ (const sc_unsigned &u, uint64 v);
1547  friend sc_signed operator ^ (const sc_unsigned &u, long v);
1548  friend sc_unsigned operator ^ (const sc_unsigned &u, unsigned long v);
1549  friend sc_signed operator ^ (const sc_unsigned &u, int v);
1550  friend sc_unsigned
1551  operator ^ (const sc_unsigned &u, unsigned int v)
1552  {
1553  return operator ^ (u, (unsigned long)v);
1554  }
1555 
1556  friend sc_signed operator ^ (int64 u, const sc_unsigned &v);
1557  friend sc_unsigned operator ^ (uint64 u, const sc_unsigned &v);
1558  friend sc_signed operator ^ (long u, const sc_unsigned &v);
1559  friend sc_unsigned operator ^ (unsigned long u, const sc_unsigned &v);
1560  friend sc_signed operator ^ (int u, const sc_unsigned &v);
1561  friend sc_unsigned
1562  operator ^ (unsigned int u, const sc_unsigned &v)
1563  {
1564  return operator ^ ((unsigned long)u, v);
1565  }
1566 
1567  const sc_unsigned &operator ^= (const sc_signed &v);
1568  const sc_unsigned &operator ^= (const sc_unsigned &v);
1569  const sc_unsigned &operator ^= (int64 v);
1570  const sc_unsigned &operator ^= (uint64 v);
1571  const sc_unsigned &operator ^= (long v);
1572  const sc_unsigned &operator ^= (unsigned long v);
1573  const sc_unsigned &
1575  {
1576  return operator ^= ((long)v);
1577  }
1578  const sc_unsigned &
1579  operator ^= (unsigned int v)
1580  {
1581  return operator ^= ((unsigned long)v);
1582  }
1583 
1584  friend sc_unsigned operator ^ (
1585  const sc_unsigned &u, const sc_uint_base &v);
1586  friend sc_signed operator ^ (const sc_unsigned &u, const sc_int_base &v);
1587  friend sc_unsigned operator ^ (
1588  const sc_uint_base &u, const sc_unsigned &v);
1589  friend sc_signed operator ^ (const sc_int_base &u, const sc_unsigned &v);
1590  const sc_unsigned &operator ^= (const sc_int_base &v);
1591  const sc_unsigned &operator ^= (const sc_uint_base &v);
1592 
1593  // SHIFT OPERATORS:
1594 
1595  // LEFT SHIFT operators:
1596  friend sc_unsigned operator << (const sc_unsigned &u, const sc_signed &v);
1597  friend sc_signed operator << (const sc_signed &u, const sc_unsigned &v);
1598 
1599  friend sc_unsigned operator << (
1600  const sc_unsigned &u, const sc_unsigned &v);
1601  friend sc_unsigned operator << (const sc_unsigned &u, int64 v);
1602  friend sc_unsigned operator << (const sc_unsigned &u, uint64 v);
1603  friend sc_unsigned operator << (const sc_unsigned &u, long v);
1604  friend sc_unsigned operator << (const sc_unsigned &u, unsigned long v);
1605  friend sc_unsigned
1607  {
1608  return operator << (u, (long)v);
1609  }
1610  friend sc_unsigned
1611  operator << (const sc_unsigned &u, unsigned int v)
1612  {
1613  return operator << (u, (unsigned long)v);
1614  }
1615 
1616  const sc_unsigned &operator <<= (const sc_signed &v);
1617  const sc_unsigned &operator <<= (const sc_unsigned &v);
1618  const sc_unsigned &operator <<= (int64 v);
1619  const sc_unsigned &operator <<= (uint64 v);
1620  const sc_unsigned &operator <<= (long v);
1621  const sc_unsigned &operator <<= (unsigned long v);
1622  const sc_unsigned &operator <<= (int v) { return operator <<= ((long)v); }
1623  const sc_unsigned &
1624  operator <<= (unsigned int v)
1625  {
1626  return operator <<= ((unsigned long)v);
1627  }
1628 
1629  friend sc_unsigned operator << (
1630  const sc_unsigned &u, const sc_uint_base &v);
1631  friend sc_unsigned operator << (
1632  const sc_unsigned &u, const sc_int_base &v);
1633  const sc_unsigned &operator <<= (const sc_int_base &v);
1634  const sc_unsigned &operator <<= (const sc_uint_base &v);
1635 
1636  // RIGHT SHIFT operators:
1637  friend sc_unsigned operator >> (const sc_unsigned &u, const sc_signed &v);
1638  friend sc_signed operator >> (const sc_signed &u, const sc_unsigned &v);
1639 
1640  friend sc_unsigned operator >> (
1641  const sc_unsigned &u, const sc_unsigned &v);
1642  friend sc_unsigned operator >> (const sc_unsigned &u, int64 v);
1643  friend sc_unsigned operator >> (const sc_unsigned &u, uint64 v);
1644  friend sc_unsigned operator >> (const sc_unsigned &u, long v);
1645  friend sc_unsigned operator >> (const sc_unsigned &u, unsigned long v);
1646  friend sc_unsigned
1648  {
1649  return operator >> (u, (long)v);
1650  }
1651  friend sc_unsigned
1652  operator >> (const sc_unsigned &u, unsigned int v)
1653  {
1654  return operator >> (u, (unsigned long)v);
1655  }
1656 
1657  const sc_unsigned &operator >>= (const sc_signed &v);
1658  const sc_unsigned &operator >>= (const sc_unsigned &v);
1659  const sc_unsigned &operator >>= (int64 v);
1660  const sc_unsigned &operator >>= (uint64 v);
1661  const sc_unsigned &operator >>= (long v);
1662  const sc_unsigned &operator >>= (unsigned long v);
1663  const sc_unsigned &operator >>= (int v) { return operator >>= ((long)v); }
1664  const sc_unsigned &
1665  operator >>= (unsigned int v)
1666  {
1667  return operator >>= ((unsigned long)v);
1668  }
1669 
1670  friend sc_unsigned operator >> (const sc_unsigned &, const sc_uint_base &);
1671  friend sc_unsigned operator >> (const sc_unsigned&, const sc_int_base &);
1672  const sc_unsigned &operator >>= (const sc_int_base &v);
1673  const sc_unsigned &operator >>= (const sc_uint_base &v);
1674 
1675  // Unary arithmetic operators
1676  friend sc_unsigned operator + (const sc_unsigned &u);
1677  friend sc_signed operator - (const sc_unsigned &u);
1678 
1679  // LOGICAL OPERATORS:
1680 
1681  // Logical EQUAL operators:
1682  friend bool operator == (const sc_unsigned &u, const sc_signed &v);
1683  friend bool operator == (const sc_signed &u, const sc_unsigned &v);
1684 
1685  friend bool operator == (const sc_unsigned &u, const sc_unsigned &v);
1686  friend bool operator == (const sc_unsigned &u, int64 v);
1687  friend bool operator == (const sc_unsigned &u, uint64 v);
1688  friend bool operator == (const sc_unsigned &u, long v);
1689  friend bool operator == (const sc_unsigned &u, unsigned long v);
1690  friend bool
1692  {
1693  return operator == (u, (long)v);
1694  }
1695  friend bool
1696  operator == (const sc_unsigned &u, unsigned int v)
1697  {
1698  return operator == (u, (unsigned long)v);
1699  }
1700 
1701  friend bool operator == (int64 u, const sc_unsigned &v);
1702  friend bool operator == (uint64 u, const sc_unsigned &v);
1703  friend bool operator == (long u, const sc_unsigned &v);
1704  friend bool operator == (unsigned long u, const sc_unsigned &v);
1705  friend bool
1707  {
1708  return operator == ((long)u, v);
1709  }
1710  friend bool
1711  operator == (unsigned int u, const sc_unsigned &v)
1712  {
1713  return operator == ((unsigned long)u, v);
1714  }
1715 
1716  friend bool operator == (const sc_unsigned &u, const sc_uint_base &v);
1717  friend bool operator == (const sc_unsigned &u, const sc_int_base &v);
1718  friend bool operator == (const sc_uint_base &u, const sc_unsigned &v);
1719  friend bool operator == (const sc_int_base &u, const sc_unsigned &v);
1720 
1721  // Logical NOT_EQUAL operators:
1722  friend bool operator != (const sc_unsigned &u, const sc_signed &v);
1723  friend bool operator != (const sc_signed &u, const sc_unsigned &v);
1724 
1725  friend bool operator != (const sc_unsigned &u, const sc_unsigned &v);
1726  friend bool operator != (const sc_unsigned &u, int64 v);
1727  friend bool operator != (const sc_unsigned &u, uint64 v);
1728  friend bool operator != (const sc_unsigned &u, long v);
1729  friend bool operator != (const sc_unsigned &u, unsigned long v);
1730  friend bool
1732  {
1733  return operator != (u, (long)v);
1734  }
1735  friend bool
1736  operator != (const sc_unsigned &u, unsigned int v)
1737  {
1738  return operator != (u, (unsigned long)v);
1739  }
1740 
1741  friend bool operator != (int64 u, const sc_unsigned &v);
1742  friend bool operator != (uint64 u, const sc_unsigned &v);
1743  friend bool operator != (long u, const sc_unsigned &v);
1744  friend bool operator != (unsigned long u, const sc_unsigned &v);
1745  friend bool
1747  {
1748  return operator != ((long)u, v);
1749  }
1750  friend bool
1751  operator != (unsigned int u, const sc_unsigned &v)
1752  {
1753  return operator != ((unsigned long)u, v);
1754  }
1755 
1756  friend bool operator != (const sc_unsigned &u, const sc_uint_base &v);
1757  friend bool operator != (const sc_unsigned &u, const sc_int_base &v);
1758  friend bool operator != (const sc_uint_base &u, const sc_unsigned &v);
1759  friend bool operator != (const sc_int_base &u, const sc_unsigned &v);
1760 
1761  // Logical LESS_THAN operators:
1762  friend bool operator < (const sc_unsigned &u, const sc_signed &v);
1763  friend bool operator < (const sc_signed &u, const sc_unsigned &v);
1764 
1765  friend bool operator < (const sc_unsigned &u, const sc_unsigned &v);
1766  friend bool operator < (const sc_unsigned &u, int64 v);
1767  friend bool operator < (const sc_unsigned &u, uint64 v);
1768  friend bool operator < (const sc_unsigned &u, long v);
1769  friend bool operator < (const sc_unsigned &u, unsigned long v);
1770  friend bool
1772  {
1773  return operator < (u, (long)v);
1774  }
1775  friend bool
1776  operator < (const sc_unsigned &u, unsigned int v)
1777  {
1778  return operator < (u, (unsigned long)v);
1779  }
1780 
1781  friend bool operator < (int64 u, const sc_unsigned &v);
1782  friend bool operator < (uint64 u, const sc_unsigned &v);
1783  friend bool operator < (long u, const sc_unsigned &v);
1784  friend bool operator < (unsigned long u, const sc_unsigned &v);
1785  friend bool
1787  {
1788  return operator < ((long)u, v);
1789  }
1790  friend bool
1791  operator < (unsigned int u, const sc_unsigned &v)
1792  {
1793  return operator < ((unsigned long)u, v);
1794  }
1795 
1796  friend bool operator < (const sc_unsigned &u, const sc_uint_base &v);
1797  friend bool operator < (const sc_unsigned &u, const sc_int_base &v);
1798  friend bool operator < (const sc_uint_base &u, const sc_unsigned &v);
1799  friend bool operator < (const sc_int_base &u, const sc_unsigned &v);
1800 
1801  // Logical LESS_THAN_AND_EQUAL operators:
1802  friend bool operator <= (const sc_unsigned &u, const sc_signed &v);
1803  friend bool operator <= (const sc_signed &u, const sc_unsigned &v);
1804 
1805  friend bool operator <= (const sc_unsigned &u, const sc_unsigned &v);
1806  friend bool operator <= (const sc_unsigned &u, int64 v);
1807  friend bool operator <= (const sc_unsigned &u, uint64 v);
1808  friend bool operator <= (const sc_unsigned &u, long v);
1809  friend bool operator <= (const sc_unsigned &u, unsigned long v);
1810  friend bool
1812  {
1813  return operator <= (u, (long)v);
1814  }
1815  friend bool
1816  operator <= (const sc_unsigned &u, unsigned int v)
1817  {
1818  return operator <= (u, (unsigned long)v);
1819  }
1820 
1821  friend bool operator <= (int64 u, const sc_unsigned &v);
1822  friend bool operator <= (uint64 u, const sc_unsigned &v);
1823  friend bool operator <= (long u, const sc_unsigned &v);
1824  friend bool operator <= (unsigned long u, const sc_unsigned &v);
1825  friend bool
1827  {
1828  return operator <= ((long)u, v);
1829  }
1830  friend bool
1831  operator <= (unsigned int u, const sc_unsigned &v)
1832  {
1833  return operator <= ((unsigned long)u, v);
1834  }
1835 
1836  friend bool operator <= (const sc_unsigned &u, const sc_uint_base &v);
1837  friend bool operator <= (const sc_unsigned &u, const sc_int_base &v);
1838  friend bool operator <= (const sc_uint_base &u, const sc_unsigned &v);
1839  friend bool operator <= (const sc_int_base &u, const sc_unsigned &v);
1840 
1841  // Logical GREATER_THAN operators:
1842  friend bool operator > (const sc_unsigned &u, const sc_signed &v);
1843  friend bool operator > (const sc_signed &u, const sc_unsigned &v);
1844 
1845  friend bool operator > (const sc_unsigned &u, const sc_unsigned &v);
1846  friend bool operator > (const sc_unsigned &u, int64 v);
1847  friend bool operator > (const sc_unsigned &u, uint64 v);
1848  friend bool operator > (const sc_unsigned &u, long v);
1849  friend bool operator > (const sc_unsigned &u, unsigned long v);
1850  friend bool
1852  {
1853  return operator > (u, (long)v);
1854  }
1855  friend bool
1856  operator > (const sc_unsigned &u, unsigned int v)
1857  {
1858  return operator > (u, (unsigned long)v);
1859  }
1860 
1861  friend bool operator > (int64 u, const sc_unsigned &v);
1862  friend bool operator > (uint64 u, const sc_unsigned &v);
1863  friend bool operator > (long u, const sc_unsigned &v);
1864  friend bool operator > (unsigned long u, const sc_unsigned &v);
1865  friend bool
1867  {
1868  return operator > ((long)u, v);
1869  }
1870  friend bool
1871  operator > (unsigned int u, const sc_unsigned &v)
1872  {
1873  return operator > ((unsigned long)u, v);
1874  }
1875 
1876  friend bool operator > (const sc_unsigned &u, const sc_uint_base &v);
1877  friend bool operator > (const sc_unsigned &u, const sc_int_base &v);
1878  friend bool operator > (const sc_uint_base &u, const sc_unsigned &v);
1879  friend bool operator > (const sc_int_base &u, const sc_unsigned &v);
1880 
1881  // Logical GREATER_THAN_AND_EQUAL operators:
1882  friend bool operator >= (const sc_unsigned &u, const sc_signed &v);
1883  friend bool operator >= (const sc_signed &u, const sc_unsigned &v);
1884 
1885  friend bool operator >= (const sc_unsigned &u, const sc_unsigned &v);
1886  friend bool operator >= (const sc_unsigned &u, int64 v);
1887  friend bool operator >= (const sc_unsigned &u, uint64 v);
1888  friend bool operator >= (const sc_unsigned &u, long v);
1889  friend bool operator >= (const sc_unsigned &u, unsigned long v);
1890  friend bool
1892  {
1893  return operator >= (u, (long)v);
1894  }
1895  friend bool
1896  operator >= (const sc_unsigned &u, unsigned int v)
1897  {
1898  return operator >= (u, (unsigned long)v);
1899  }
1900 
1901  friend bool operator >= (int64 u, const sc_unsigned &v);
1902  friend bool operator >= (uint64 u, const sc_unsigned &v);
1903  friend bool operator >= (long u, const sc_unsigned &v);
1904  friend bool operator >= (unsigned long u, const sc_unsigned &v);
1905  friend bool
1907  {
1908  return operator >= ((long)u, v);
1909  }
1910  friend bool
1911  operator >= (unsigned int u, const sc_unsigned &v)
1912  {
1913  return operator >= ((unsigned long)u, v);
1914  }
1915 
1916  friend bool operator >= (const sc_unsigned &u, const sc_uint_base &v);
1917  friend bool operator >= (const sc_unsigned &u, const sc_int_base &v);
1918  friend bool operator >= (const sc_uint_base &u, const sc_unsigned &v);
1919  friend bool operator >= (const sc_int_base &u, const sc_unsigned &v);
1920 
1921  // Bitwise NOT operator (unary).
1922  friend sc_unsigned operator ~ (const sc_unsigned &u);
1923 
1924  // Helper functions.
1925  friend int compare_unsigned(
1926  small_type us, int unb, int und, const sc_digit *ud,
1927  small_type vs, int vnb, int vnd, const sc_digit *vd,
1928  small_type if_u_signed, small_type if_v_signed);
1929 
1930  friend sc_unsigned add_unsigned_friend(
1931  small_type us, int unb, int und, const sc_digit *ud,
1932  small_type vs, int vnb, int vnd, const sc_digit *vd);
1933 
1934  friend sc_unsigned sub_unsigned_friend(
1935  small_type us, int unb, int und, const sc_digit *ud,
1936  small_type vs, int vnb, int vnd, const sc_digit *vd);
1937 
1938  friend sc_unsigned mul_unsigned_friend(
1939  small_type s, int unb, int und, const sc_digit *ud,
1940  int vnb, int vnd, const sc_digit *vd);
1941 
1942  friend sc_unsigned div_unsigned_friend(
1943  small_type s, int unb, int und, const sc_digit *ud,
1944  int vnb, int vnd, const sc_digit *vd);
1945 
1946  friend sc_unsigned mod_unsigned_friend(
1947  small_type us, int unb, int und, const sc_digit *ud,
1948  int vnb, int vnd, const sc_digit *vd);
1949 
1950  friend sc_unsigned and_unsigned_friend(
1951  small_type us, int unb, int und, const sc_digit *ud,
1952  small_type vs, int vnb, int vnd, const sc_digit *vd);
1953 
1954  friend sc_unsigned or_unsigned_friend(
1955  small_type us, int unb, int und, const sc_digit *ud,
1956  small_type vs, int vnb, int vnd, const sc_digit *vd);
1957 
1958  friend sc_unsigned xor_unsigned_friend(
1959  small_type us, int unb, int und, const sc_digit *ud,
1960  small_type vs, int vnb, int vnd, const sc_digit *vd);
1961 
1962  public:
1964 
1965  private:
1966  small_type sgn; // Shortened as s.
1967  int nbits; // Shortened as nb.
1968  int ndigits; // Shortened as nd.
1969 
1970 #ifdef SC_MAX_NBITS
1971  sc_digit digit[DIV_CEIL(SC_MAX_NBITS)]; // Shortened as d.
1972 #else
1973  sc_digit *digit; // Shortened as d.
1974 #endif
1975 
1976  // Private constructors:
1977 
1978  // Create a copy of v with sign s.
1980  sc_unsigned(const sc_signed &v, small_type s);
1981 
1982  // Create an unsigned number with the given attributes.
1983  sc_unsigned(small_type s, int nb, int nd, sc_digit *d, bool alloc=true);
1984 
1985  // Create an unsigned number using the bits u[l..r].
1986  sc_unsigned(const sc_signed *u, int l, int r);
1987  sc_unsigned(const sc_unsigned *u, int l, int r);
1988 
1989  // Private member functions. The called functions are inline functions.
1990 
1991  small_type default_sign() const { return SC_POS; }
1992 
1993  int num_bits(int nb) const { return nb + 1; }
1994 
1995  bool check_if_outside(int bit_num) const;
1996 
1997  void
1998  copy_digits(int nb, int nd, const sc_digit *d)
1999  {
2000  copy_digits_unsigned(sgn, nbits, ndigits, digit, nb, nd, d);
2001  }
2002 
2003  void makezero() { sgn = make_zero(ndigits, digit); }
2004 
2005  // Conversion functions between 2's complement (2C) and
2006  // sign-magnitude (SM):
2007  void
2009  {
2010  sgn = convert_unsigned_2C_to_SM(nbits, ndigits, digit);
2011  }
2012 
2013  void
2015  {
2016  sgn = convert_unsigned_SM_to_2C_to_SM(sgn, nbits, ndigits, digit);
2017  }
2018 
2019  void convert_SM_to_2C() { convert_unsigned_SM_to_2C(sgn, ndigits, digit); }
2020 };
2021 
2022 inline ::std::ostream &operator << (::std::ostream &, const sc_unsigned &);
2023 
2024 inline ::std::istream &operator >> (::std::istream &, sc_unsigned &);
2025 
2026 
2027 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
2028 
2029 // ----------------------------------------------------------------------------
2030 // CLASS : sc_unsigned_bitref_r
2031 //
2032 // Proxy class for sc_unsigned bit selection (r-value only).
2033 // ----------------------------------------------------------------------------
2034 
2035 
2036 inline ::std::ostream &
2037 operator << (::std::ostream &os, const sc_unsigned_bitref_r &a)
2038 {
2039  a.print(os);
2040  return os;
2041 }
2042 
2043 
2044 // ----------------------------------------------------------------------------
2045 // CLASS : sc_unsigned_bitref
2046 //
2047 // Proxy class for sc_unsigned bit selection (r-value and l-value).
2048 // ----------------------------------------------------------------------------
2049 
2050 template<class T>
2051 inline const sc_unsigned_subref &
2052 sc_unsigned_subref::operator = (const sc_generic_base<T> &a)
2053 {
2054  sc_unsigned temp(length());
2055  a->to_sc_unsigned(temp);
2056  return *this = temp;
2057 }
2058 
2059 inline ::std::istream &
2061 {
2062  a.scan(is);
2063  return is;
2064 }
2065 
2066 
2067 // ----------------------------------------------------------------------------
2068 // CLASS : sc_unsigned_subref_r
2069 //
2070 // Proxy class for sc_unsigned part selection (r-value only).
2071 // ----------------------------------------------------------------------------
2072 
2073 // reduce methods
2074 
2075 inline bool
2077 {
2078  const sc_unsigned *target_p = m_obj_p;
2079  for (int i = m_right; i <= m_left; i++)
2080  if (!target_p->test(i))
2081  return false;
2082  return true;
2083 }
2084 
2085 inline bool
2087 {
2088  return !and_reduce();
2089 }
2090 
2091 inline bool
2093 {
2094  const sc_unsigned *target_p = m_obj_p;
2095  for (int i = m_right; i <= m_left; i++)
2096  if (target_p->test(i))
2097  return true;
2098  return false;
2099 }
2100 
2101 inline bool
2103 {
2104  return !or_reduce();
2105 }
2106 
2107 inline bool
2109 {
2110  int odd;
2111  const sc_unsigned *target_p = m_obj_p;
2112  odd = 0;
2113  for (int i = m_right; i <= m_left; i++)
2114  if (target_p->test(i)) odd = ~odd;
2115  return odd ? true : false;
2116 }
2117 
2118 inline bool sc_unsigned_subref_r::xnor_reduce() const { return !xor_reduce(); }
2119 
2120 inline ::std::ostream &
2121 operator << (::std::ostream &os, const sc_unsigned_subref_r &a)
2122 {
2123  a.print(os);
2124  return os;
2125 }
2126 
2127 
2128 // ----------------------------------------------------------------------------
2129 // CLASS : sc_unsigned_subref
2130 //
2131 // Proxy class for sc_unsigned part selection (r-value and l-value).
2132 // ----------------------------------------------------------------------------
2133 
2134 // assignment operators
2135 
2136 inline const sc_unsigned_subref &
2137 sc_unsigned_subref::operator = (const char *a)
2138 {
2139  sc_unsigned aa(length());
2140  return (*this = aa = a);
2141 }
2142 
2143 
2144 inline ::std::istream &
2146 {
2147  a.scan(is);
2148  return is;
2149 }
2150 
2151 
2152 // ----------------------------------------------------------------------------
2153 // CLASS : sc_unsigned
2154 //
2155 // Arbitrary precision signed number.
2156 // ----------------------------------------------------------------------------
2157 
2158 template<class T>
2159 sc_unsigned::sc_unsigned( const sc_generic_base<T> &v)
2160 {
2161  int nb = v->length();
2162  sgn = default_sign();
2163  if (nb > 0) {
2164  nbits = num_bits(nb);
2165  } else {
2166  invalid_init("sc_generic_base<T>", nb);
2167  sc_core::sc_abort(); // can't recover from here
2168  }
2169  ndigits = DIV_CEIL(nbits);
2170 # ifdef SC_MAX_NBITS
2171  test_bound(nb);
2172 # else
2173  digit = new sc_digit[ndigits];
2174 # endif
2175  makezero();
2176  v->to_sc_unsigned(*this);
2177 }
2178 
2179 inline ::std::ostream &
2180 operator << (::std::ostream &os, const sc_unsigned &a)
2181 {
2182  a.print(os);
2183  return os;
2184 }
2185 
2186 inline ::std::istream &
2187 operator >> (::std::istream &is, sc_unsigned &a)
2188 {
2189  a.scan(is);
2190  return is;
2191 }
2192 
2193 } // namespace sc_dt
2194 
2195 #endif // __SYSTEMC_EXT_DT_INT_SC_UNSIGNED_HH__
to_bool
bool to_bool(const std::string &value, bool &retval)
Turn a string representation of a boolean into a boolean value.
Definition: str.hh:186
sc_dt::sc_unsigned::check_range
void check_range(int l, int r) const
Definition: sc_unsigned.hh:1053
sc_dt::sc_unsigned_subref_r::m_right
int m_right
Definition: sc_unsigned.hh:805
X86ISA::os
Bitfield< 17 > os
Definition: misc.hh:803
length
uint8_t length
Definition: inet.hh:422
sc_dt::sc_unsigned_bitref_r::value
uint64 value() const
Definition: sc_unsigned.hh:614
sc_dt::copy_digits_unsigned
void copy_digits_unsigned(small_type &us, int unb, int und, sc_digit *ud, int, int vnd, const sc_digit *vd)
Definition: sc_nbutils.hh:801
sc_dt::operator|=
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
Definition: sc_lv_base.hh:450
sc_dt::sc_unsigned::sc_unsigned_subref
friend class sc_unsigned_subref
Definition: sc_unsigned.hh:896
sc_dt::sc_unsigned::copy_digits
void copy_digits(int nb, int nd, const sc_digit *d)
Definition: sc_unsigned.hh:1998
sc_dt::sc_unsigned::sc_signed_subref_r
friend class sc_signed_subref_r
Definition: sc_unsigned.hh:899
sc_dt::sc_unsigned_bitref_r::m_obj_p
sc_unsigned * m_obj_p
Definition: sc_unsigned.hh:660
sc_dt::sc_unsigned_bitref_r::print
void print(::std::ostream &os=::std::cout) const
Definition: sc_unsigned.hh:656
sc_nbdefs.hh
sc_dt::sc_unsigned::convert_SM_to_2C_to_SM
void convert_SM_to_2C_to_SM()
Definition: sc_unsigned.hh:2014
sc_dt::sc_unsigned_bitref_r::initialize
void initialize(const sc_unsigned *obj_p, int index_)
Definition: sc_unsigned.hh:590
sc_dt
Definition: sc_bit.cc:67
sc_dt::operator*
sc_unsigned operator*(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1315
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
sc_dt::sc_unsigned::test
bool test(int i) const
test
Definition: test.h:38
sc_dt::sc_uint_subref_r
Definition: sc_uint_base.hh:275
sc_dt::sc_unsigned_subref::sc_unsigned
friend class sc_unsigned
Definition: sc_unsigned.hh:824
sc_dt::sc_unsigned::m_pool
static sc_core::sc_vpool< sc_unsigned > m_pool
Definition: sc_unsigned.hh:1963
sc_dt::convert_unsigned_SM_to_2C_to_SM
small_type convert_unsigned_SM_to_2C_to_SM(small_type s, int nb, int nd, sc_digit *d)
Definition: sc_nbutils.hh:756
sc_core
Definition: messages.cc:31
sc_dt::sc_digit
unsigned int sc_digit
Definition: sc_nbdefs.hh:197
sc_dt::sc_value_base
Definition: sc_value_base.hh:107
MipsISA::vs
Bitfield< 9, 5 > vs
Definition: pra_constants.hh:146
sc_dt::sc_fxnum_fast
Definition: sc_fxnum.hh:844
sc_dt::sc_unsigned_subref::sc_unsigned_subref
sc_unsigned_subref(const sc_unsigned_subref &a)
Definition: sc_unsigned.hh:833
sc_dt::sc_unsigned_subref_r::length
int length() const
Definition: sc_unsigned.hh:752
sc_dt::sc_fxval
Definition: sc_fxval.hh:86
sc_dt::to_string
const std::string to_string(sc_enc enc)
Definition: sc_fxdefs.cc:91
operator-
Time operator-(const Time &l, const Time &r)
Definition: time.hh:252
sc_dt::sc_bv_base
Definition: sc_bv_base.hh:105
sc_dt::sc_int_base
Definition: sc_int_base.hh:494
sc_dt::sc_unsigned_subref::m_pool
static sc_core::sc_vpool< sc_unsigned_subref > m_pool
Definition: sc_unsigned.hh:878
sc_dt::mul_unsigned_friend
sc_unsigned mul_unsigned_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
sc_dt::sc_unsigned::set
void set(int i, bool v)
Definition: sc_unsigned.hh:1143
SimClock::Float::us
double us
microsecond
Definition: core.cc:51
sc_dt::sc_unsigned_bitref_r::length
int length() const
Definition: sc_unsigned.hh:606
sc_dt::operator<
bool operator<(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1791
sc_dt::sc_unsigned_bitref_r::concat_get_uint64
virtual uint64 concat_get_uint64() const
Definition: sc_unsigned.hh:626
sc_dt::sc_unsigned_bitref_r::m_index
int m_index
Definition: sc_unsigned.hh:659
sc_dt::sc_unsigned::sgn
small_type sgn
Definition: sc_unsigned.hh:1966
sc_dt::operator|
sc_unsigned operator|(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1513
PowerISA::aa
Bitfield< 1 > aa
Definition: types.hh:59
sc_dt::operator&=
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
Definition: sc_lv_base.hh:359
sc_dt::sc_unsigned::num_bits
int num_bits(int nb) const
Definition: sc_unsigned.hh:1993
sc_dt::sc_unsigned_subref_r::initialize
void initialize(const sc_unsigned *obj_p, int left_, int right_)
Definition: sc_unsigned.hh:733
sc_core::sc_vpool
Definition: sc_temporary.hh:182
sc_dt::sc_signed
Definition: sc_signed.hh:984
sc_dt::sc_io_show_base
bool sc_io_show_base(::std::ostream &os)
Definition: sc_nbutils.hh:135
sc_dt::sc_unsigned::invert
void invert(int i)
Definition: sc_unsigned.hh:1151
MipsISA::is
Bitfield< 24, 22 > is
Definition: pra_constants.hh:232
sc_dt::xor_reduce
sc_proxy< X >::value_type xor_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.hh:1402
sc_dt::operator>
bool operator>(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1871
sc_dt::sc_unsigned::nor_reduce
bool nor_reduce() const
Definition: sc_unsigned.hh:1134
sc_dt::operator==
bool operator==(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1711
sc_dt::sc_unsigned_bitref_r::concat_length
virtual int concat_length(bool *xz_present_p) const
Definition: sc_unsigned.hh:619
sc_dt::sc_unsigned::length
int length() const
Definition: sc_unsigned.hh:1126
sc_dt::xnor_reduce
sc_proxy< X >::value_type xnor_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.hh:1409
sc_dt::sc_unsigned_subref_r::sc_unsigned_signal
friend class sc_unsigned_signal
Definition: sc_unsigned.hh:725
sc_dt::or_reduce
sc_proxy< X >::value_type or_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.hh:1388
sc_dt::sc_unsigned::print
void print(::std::ostream &os=::std::cout) const
Definition: sc_unsigned.hh:1117
sc_dt::sc_unsigned_subref_r::sc_signed
friend class sc_signed
Definition: sc_unsigned.hh:723
sc_dt::sc_unsigned_subref_r
Definition: sc_unsigned.hh:721
sc_dt::sc_unsigned_subref_r::concat_length
virtual int concat_length(bool *xz_present_p) const
Definition: sc_unsigned.hh:777
sc_dt::sc_unsigned::sc_signed_subref
friend class sc_signed_subref
Definition: sc_unsigned.hh:898
sc_dt::sc_unsigned::~sc_unsigned
virtual ~sc_unsigned()
Definition: sc_unsigned.hh:966
sc_dt::sc_unsigned::xnor_reduce
bool xnor_reduce() const
Definition: sc_unsigned.hh:1136
ArmISA::j
Bitfield< 24 > j
Definition: miscregs_types.hh:54
ArmISA::a
Bitfield< 8 > a
Definition: miscregs_types.hh:62
sc_dt::sc_unsigned_bitref::sc_unsigned_bitref
sc_unsigned_bitref(const sc_unsigned_bitref &a)
Definition: sc_unsigned.hh:687
sc_dt::sc_unsigned::nbits
int nbits
Definition: sc_unsigned.hh:1967
sc_dt::operator^
sc_unsigned operator^(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1562
sc_dt::nand_reduce
sc_proxy< X >::value_type nand_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.hh:1381
sc_dt::uint64
uint64_t uint64
Definition: sc_nbdefs.hh:206
sc_dt::sc_io_base
sc_numrep sc_io_base(::std::ostream &os, sc_numrep def_base)
Definition: sc_nbutils.hh:125
sc_dt::operator&
sc_unsigned operator&(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1464
sc_dt::convert_unsigned_SM_to_2C
void convert_unsigned_SM_to_2C(small_type s, int nd, sc_digit *d)
Definition: sc_nbutils.hh:773
ArmISA::d
Bitfield< 9 > d
Definition: miscregs_types.hh:60
sc_nbexterns.hh
sc_dt::sc_unsigned::nand_reduce
bool nand_reduce() const
Definition: sc_unsigned.hh:1132
sc_dt::sc_unsigned::default_sign
small_type default_sign() const
Definition: sc_unsigned.hh:1991
DIV_CEIL
#define DIV_CEIL(x)
Definition: sc_nbdefs.hh:178
sc_dt::operator<=
bool operator<=(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1831
MipsISA::r
r
Definition: pra_constants.hh:95
sc_dt::div_unsigned_friend
sc_unsigned div_unsigned_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
sc_dt::sc_fxnum
Definition: sc_fxnum.hh:483
sc_nbutils.hh
sc_dt::sc_unsigned_bitref_r::to_bool
bool to_bool() const
Definition: sc_unsigned.hh:615
sc_dt::sc_unsigned::convert_SM_to_2C
void convert_SM_to_2C()
Definition: sc_unsigned.hh:2019
sc_dt::operator>>
inline ::std::istream & operator>>(::std::istream &, sc_unsigned &)
Definition: sc_unsigned.hh:2187
sc_dt::sc_unsigned_subref_r::print
void print(::std::ostream &os=::std::cout) const
Definition: sc_unsigned.hh:797
sc_dt::reverse
const sc_lv_base reverse(const sc_proxy< X > &x)
Definition: sc_lv_base.hh:717
sc_dt::xor_unsigned_friend
sc_unsigned xor_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_dt::sc_unsigned_bitref::m_pool
static sc_core::sc_vpool< sc_unsigned_bitref > m_pool
Definition: sc_unsigned.hh:709
sc_dt::small_type
int small_type
Definition: sc_nbdefs.hh:142
sc_dt::add_unsigned_friend
sc_unsigned add_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_dt::sc_unsigned::check_index
void check_index(int i) const
Definition: sc_unsigned.hh:1000
sc_dt::sc_unsigned_bitref_r::~sc_unsigned_bitref_r
virtual ~sc_unsigned_bitref_r()
Definition: sc_unsigned.hh:598
sc_dt::sc_unsigned_bitref
Definition: sc_unsigned.hh:677
sc_dt::int64
int64_t int64
Definition: sc_nbdefs.hh:205
sc_dt::nor_reduce
sc_proxy< X >::value_type nor_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.hh:1395
sc_dt::sc_unsigned::sc_unsigned_bitref_r
friend class sc_unsigned_bitref_r
Definition: sc_unsigned.hh:893
sc_dt::sc_generic_base
Definition: sc_value_base.hh:145
sc_dt::sc_unsigned::digit
sc_digit * digit
Definition: sc_unsigned.hh:1973
sc_dt::operator/
sc_unsigned operator/(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1364
sc_dt::sc_unsigned::bit
sc_unsigned_bitref & bit(int i)
Definition: sc_unsigned.hh:1027
sc_dt::sc_unsigned::range
sc_unsigned_subref & range(int i, int j)
Definition: sc_unsigned.hh:1067
sc_dt::sc_uint_base
Definition: sc_uint_base.hh:465
sc_dt::compare_unsigned
int compare_unsigned(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd, small_type if_u_signed, small_type if_v_signed)
Definition: sc_unsigned.cc:2109
sc_dt::sc_unsigned_subref_r::sc_unsigned_subref_r
sc_unsigned_subref_r(const sc_unsigned_subref_r &a)
Definition: sc_unsigned.hh:745
sc_dt::convert_unsigned_2C_to_SM
small_type convert_unsigned_2C_to_SM(int nb, int nd, sc_digit *d)
Definition: sc_nbutils.hh:745
sc_dt::sc_unsigned_bitref_r::sc_unsigned_bitref_r
sc_unsigned_bitref_r()
Definition: sc_unsigned.hh:587
sc_dt::sc_unsigned::sc_signed
friend class sc_signed
Definition: sc_unsigned.hh:897
sc_dt::operator%
sc_unsigned operator%(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1413
sc_dt::sc_unsigned::sc_unsigned_subref_r
friend class sc_unsigned_subref_r
Definition: sc_unsigned.hh:895
sc_dt::operator>=
bool operator>=(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1911
sc_dt::sc_unsigned_subref_r::m_left
int m_left
Definition: sc_unsigned.hh:803
sc_dt::operator+
sc_unsigned operator+(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1219
sc_dt::mod_unsigned_friend
sc_unsigned mod_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
sc_dt::sc_numrep
sc_numrep
Definition: sc_nbdefs.hh:115
ArmISA::u
Bitfield< 22 > u
Definition: miscregs_types.hh:348
sc_dt::sc_lv_base
Definition: sc_lv_base.hh:118
sc_dt::sc_unsigned::sign
bool sign() const
Definition: sc_unsigned.hh:1128
sc_dt::sc_unsigned_bitref_r::concat_get_ctrl
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
Definition: sc_unsigned.hh:631
sc_fxval
#define sc_fxval
Definition: fx_precision_double.h:65
sc_dt::sc_unsigned::sc_concatref
friend class sc_concatref
Definition: sc_unsigned.hh:892
sc_dt::and_unsigned_friend
sc_unsigned and_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_dt::sc_unsigned::get_raw
sc_digit * get_raw() const
Definition: sc_unsigned.hh:974
sc_dt::sc_signed_subref_r
Definition: sc_signed.hh:814
sc_dt::sc_fxval_fast
Definition: sc_fxval.hh:376
sc_dt::sc_unsigned_subref_r::sc_unsigned
friend class sc_unsigned
Definition: sc_unsigned.hh:724
sc_dt::sc_unsigned::range
const sc_unsigned_subref_r & range(int i, int j) const
Definition: sc_unsigned.hh:1076
sc_dt::sc_unsigned::sc_unsigned_bitref
friend class sc_unsigned_bitref
Definition: sc_unsigned.hh:894
sc_dt::sc_unsigned::bit
const sc_unsigned_bitref_r & bit(int i) const
Definition: sc_unsigned.hh:1036
Stats::dump
void dump()
Dump all statistics data to the registered outputs.
Definition: statistics.cc:560
sc_dt::and_reduce
sc_proxy< X >::value_type and_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.hh:1374
sc_dt::operator^=
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
Definition: sc_lv_base.hh:541
sc_dt::sc_unsigned_bitref::sc_unsigned_bitref
sc_unsigned_bitref()
Definition: sc_unsigned.hh:683
ArmISA::len
Bitfield< 18, 16 > len
Definition: miscregs_types.hh:439
sc_dt::operator~
sc_unsigned operator~(const sc_unsigned &u)
sc_dt::sc_unsigned
Definition: sc_unsigned.hh:890
sc_dt::sc_unsigned::convert_2C_to_SM
void convert_2C_to_SM()
Definition: sc_unsigned.hh:2008
sc_dt::or_unsigned_friend
sc_unsigned or_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_dt::sc_unsigned_subref
Definition: sc_unsigned.hh:822
sc_core::sc_abort
void sc_abort()
Definition: sc_report.cc:178
sc_dt::make_zero
small_type make_zero(int nd, sc_digit *d)
Definition: sc_nbutils.hh:603
sc_dt::sc_unsigned::operator|=
const sc_unsigned & operator|=(int v)
Definition: sc_unsigned.hh:1524
sc_dt::operator!=
bool operator!=(unsigned int u, const sc_unsigned &v)
Definition: sc_unsigned.hh:1751
sc_dt::sc_unsigned::concat_length
virtual int concat_length(bool *xz_present_p) const
Definition: sc_unsigned.hh:976
sc_dt::sub_unsigned_friend
sc_unsigned sub_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_dt::sc_unsigned::makezero
void makezero()
Definition: sc_unsigned.hh:2003
sc_dt::sc_unsigned_subref_r::~sc_unsigned_subref_r
virtual ~sc_unsigned_subref_r()
Definition: sc_unsigned.hh:742
sc_dt::sc_unsigned_bitref::sc_unsigned
friend class sc_unsigned
Definition: sc_unsigned.hh:679
sc_dt::sc_unsigned_bitref_r::concat_get_data
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
Definition: sc_unsigned.hh:639
ArmISA::s
Bitfield< 4 > s
Definition: miscregs_types.hh:556
sc_dt::sc_unsigned_subref::sc_unsigned_subref
sc_unsigned_subref()
Definition: sc_unsigned.hh:829
sc_dt::sc_unsigned_bitref_r::sc_unsigned_bitref_r
sc_unsigned_bitref_r(const sc_unsigned_bitref_r &a)
Definition: sc_unsigned.hh:601
MipsISA::l
Bitfield< 5 > l
Definition: pra_constants.hh:320
BITS_PER_DIGIT
#define BITS_PER_DIGIT
Definition: sc_nbdefs.hh:161
sc_length_param.hh
sc_dt::sc_length_param
Definition: sc_length_param.hh:113
sc_dt::sc_unsigned_subref_r::sc_unsigned_subref_r
sc_unsigned_subref_r()
Definition: sc_unsigned.hh:729
sc_dt::sc_unsigned::elemtype
bool elemtype
Definition: sc_unsigned.hh:902
sc_dt::SC_DEC
@ SC_DEC
Definition: sc_nbdefs.hh:154
SC_POS
#define SC_POS
Definition: sc_nbdefs.hh:135
sc_dt::sc_unsigned_subref_r::m_obj_p
sc_unsigned * m_obj_p
Definition: sc_unsigned.hh:804
sc_dt::sc_unsigned_bitref_r::sc_unsigned
friend class sc_unsigned
Definition: sc_unsigned.hh:583
ArmISA::v
Bitfield< 28 > v
Definition: miscregs_types.hh:51
sc_dt::operator<<
inline ::std::ostream & operator<<(::std::ostream &, const sc_unsigned &)
Definition: sc_unsigned.hh:2180
sc_dt::sc_unsigned_bitref_r
Definition: sc_unsigned.hh:581
sc_dt::sc_unsigned::operator&=
const sc_unsigned & operator&=(int v)
Definition: sc_unsigned.hh:1475
sc_dt::sc_int_subref_r
Definition: sc_int_base.hh:288
sc_dt::sc_unsigned::ndigits
int ndigits
Definition: sc_unsigned.hh:1968

Generated on Wed Sep 30 2020 14:02:16 for gem5 by doxygen 1.8.17