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