00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 #ifndef SC_UNSIGNED_H
00098 #define SC_UNSIGNED_H
00099
00100
00101 #include "sysc/kernel/sc_object.h"
00102 #include "sysc/datatypes/misc/sc_value_base.h"
00103 #include "sysc/utils/sc_iostream.h"
00104 #include "sysc/utils/sc_temporary.h"
00105 #include "sysc/datatypes/int/sc_length_param.h"
00106 #include "sysc/datatypes/int/sc_nbdefs.h"
00107 #include "sysc/datatypes/int/sc_nbutils.h"
00108 #include "sysc/datatypes/int/sc_nbexterns.h"
00109 #include "sysc/utils/sc_temporary.h"
00110
00111
00112 namespace sc_dt
00113 {
00114
00115
00116 class sc_unsigned_bitref_r;
00117 class sc_unsigned_bitref;
00118 class sc_unsigned_subref_r;
00119 class sc_unsigned_subref;
00120 class sc_concatref;
00121 class sc_unsigned;
00122
00123
00124 class sc_bv_base;
00125 class sc_lv_base;
00126 class sc_int_base;
00127 class sc_uint_base;
00128 class sc_int_subref_r;
00129 class sc_uint_subref_r;
00130 class sc_signed;
00131 class sc_signed_subref_r;
00132 class sc_fxval;
00133 class sc_fxval_fast;
00134 class sc_fxnum;
00135 class sc_fxnum_fast;
00136
00137
00138 int compare_unsigned(small_type us,
00139 int unb,
00140 int und,
00141 const sc_digit *ud,
00142 small_type vs,
00143 int vnb,
00144 int vnd,
00145 const sc_digit *vd,
00146 small_type if_u_signed=0,
00147 small_type if_v_signed=0);
00148
00149 sc_unsigned add_unsigned_friend(small_type us,
00150 int unb,
00151 int und,
00152 const sc_digit *ud,
00153 small_type vs,
00154 int vnb,
00155 int vnd,
00156 const sc_digit *vd);
00157
00158 sc_unsigned sub_unsigned_friend(small_type us,
00159 int unb,
00160 int und,
00161 const sc_digit *ud,
00162 small_type vs,
00163 int vnb,
00164 int vnd,
00165 const sc_digit *vd);
00166
00167 sc_unsigned mul_unsigned_friend(small_type s,
00168 int unb,
00169 int und,
00170 const sc_digit *ud,
00171 int vnb,
00172 int vnd,
00173 const sc_digit *vd);
00174
00175 sc_unsigned div_unsigned_friend(small_type s,
00176 int unb,
00177 int und,
00178 const sc_digit *ud,
00179 int vnb,
00180 int vnd,
00181 const sc_digit *vd);
00182
00183 sc_unsigned mod_unsigned_friend(small_type us,
00184 int unb,
00185 int und,
00186 const sc_digit *ud,
00187 int vnb,
00188 int vnd,
00189 const sc_digit *vd);
00190
00191 sc_unsigned and_unsigned_friend(small_type us,
00192 int unb,
00193 int und,
00194 const sc_digit *ud,
00195 small_type vs,
00196 int vnb,
00197 int vnd,
00198 const sc_digit *vd);
00199
00200
00201 sc_unsigned or_unsigned_friend(small_type us,
00202 int unb,
00203 int und,
00204 const sc_digit *ud,
00205 small_type vs,
00206 int vnb,
00207 int vnd,
00208 const sc_digit *vd);
00209
00210 sc_unsigned xor_unsigned_friend(small_type us,
00211 int unb,
00212 int und,
00213 const sc_digit *ud,
00214 small_type vs,
00215 int vnb,
00216 int vnd,
00217 const sc_digit *vd);
00218
00219
00220
00221
00222
00223
00224 sc_signed operator + (const sc_unsigned& u, const sc_signed& v);
00225 sc_signed operator + (const sc_signed& u, const sc_unsigned& v);
00226
00227 sc_unsigned operator + (const sc_unsigned& u, const sc_unsigned& v);
00228 sc_signed operator + (const sc_unsigned& u, int64 v);
00229 sc_unsigned operator + (const sc_unsigned& u, uint64 v);
00230 sc_signed operator + (const sc_unsigned& u, long v);
00231 sc_unsigned operator + (const sc_unsigned& u, unsigned long v);
00232 sc_signed operator + (const sc_unsigned& u, int v);
00233 inline sc_unsigned operator + (const sc_unsigned& u, unsigned int v);
00234
00235 sc_signed operator + (int64 u, const sc_unsigned& v);
00236 sc_unsigned operator + (uint64 u, const sc_unsigned& v);
00237 sc_signed operator + (long u, const sc_unsigned& v);
00238 sc_unsigned operator + (unsigned long u, const sc_unsigned& v);
00239 sc_signed operator + (int u, const sc_unsigned& v);
00240 inline sc_unsigned operator + (unsigned int u, const sc_unsigned& v);
00241
00242 sc_unsigned operator + (const sc_unsigned& u, const sc_uint_base& v);
00243 sc_signed operator + (const sc_unsigned& u, const sc_int_base& v);
00244 sc_unsigned operator + (const sc_uint_base& u, const sc_unsigned& v);
00245 sc_signed operator + (const sc_int_base& u, const sc_unsigned& v);
00246
00247
00248
00249 sc_signed operator - (const sc_unsigned& u, const sc_signed& v);
00250 sc_signed operator - (const sc_signed& u, const sc_unsigned& v);
00251
00252 sc_signed operator - (const sc_unsigned& u, const sc_unsigned& v);
00253 sc_signed operator - (const sc_unsigned& u, int64 v);
00254 sc_signed operator - (const sc_unsigned& u, uint64 v);
00255 sc_signed operator - (const sc_unsigned& u, long v);
00256 sc_signed operator - (const sc_unsigned& u, unsigned long v);
00257 sc_signed operator - (const sc_unsigned& u, int v);
00258 sc_signed operator - (const sc_unsigned& u, unsigned int v);
00259
00260 sc_signed operator - (int64 u, const sc_unsigned& v);
00261 sc_signed operator - (uint64 u, const sc_unsigned& v);
00262 sc_signed operator - (long u, const sc_unsigned& v);
00263 sc_signed operator - (unsigned long u, const sc_unsigned& v);
00264 sc_signed operator - (int u, const sc_unsigned& v);
00265 sc_signed operator - (unsigned int u, const sc_unsigned& v);
00266
00267 sc_signed operator - (const sc_unsigned& u, const sc_uint_base& v);
00268 sc_signed operator - (const sc_unsigned& u, const sc_int_base& v);
00269 sc_signed operator - (const sc_uint_base& u, const sc_unsigned& v);
00270 sc_signed operator - (const sc_int_base& u, const sc_unsigned& v);
00271
00272
00273
00274 sc_signed operator * (const sc_unsigned& u, const sc_signed& v);
00275 sc_signed operator * (const sc_signed& u, const sc_unsigned& v);
00276
00277 sc_unsigned operator * (const sc_unsigned& u, const sc_unsigned& v);
00278 sc_signed operator * (const sc_unsigned& u, int64 v);
00279 sc_unsigned operator * (const sc_unsigned& u, uint64 v);
00280 sc_signed operator * (const sc_unsigned& u, long v);
00281 sc_unsigned operator * (const sc_unsigned& u, unsigned long v);
00282 sc_signed operator * (const sc_unsigned& u, int v);
00283 inline sc_unsigned operator * (const sc_unsigned& u, unsigned int v);
00284
00285 sc_signed operator * (int64 u, const sc_unsigned& v);
00286 sc_unsigned operator * (uint64 u, const sc_unsigned& v);
00287 sc_signed operator * (long u, const sc_unsigned& v);
00288 sc_unsigned operator * (unsigned long u, const sc_unsigned& v);
00289 sc_signed operator * (int u, const sc_unsigned& v);
00290 inline sc_unsigned operator * (unsigned int u, const sc_unsigned& v);
00291
00292 sc_unsigned operator * (const sc_unsigned& u, const sc_uint_base& v);
00293 sc_signed operator * (const sc_unsigned& u, const sc_int_base& v);
00294 sc_unsigned operator * (const sc_uint_base& u, const sc_unsigned& v);
00295 sc_signed operator * (const sc_int_base& u, const sc_unsigned& v);
00296
00297
00298
00299 sc_signed operator / (const sc_unsigned& u, const sc_signed& v);
00300 sc_signed operator / (const sc_signed& u, const sc_unsigned& v);
00301
00302 sc_unsigned operator / (const sc_unsigned& u, const sc_unsigned& v);
00303 sc_signed operator / (const sc_unsigned& u, int64 v);
00304 sc_unsigned operator / (const sc_unsigned& u, uint64 v);
00305 sc_signed operator / (const sc_unsigned& u, long v);
00306 sc_unsigned operator / (const sc_unsigned& u, unsigned long v);
00307 sc_signed operator / (const sc_unsigned& u, int v);
00308 inline sc_unsigned operator / (const sc_unsigned& u, unsigned int v);
00309
00310 sc_signed operator / (int64 u, const sc_unsigned& v);
00311 sc_unsigned operator / (uint64 u, const sc_unsigned& v);
00312 sc_signed operator / (long u, const sc_unsigned& v);
00313 sc_unsigned operator / (unsigned long u, const sc_unsigned& v);
00314 sc_signed operator / (int u, const sc_unsigned& v);
00315 inline sc_unsigned operator / (unsigned int u, const sc_unsigned& v);
00316
00317 sc_unsigned operator / (const sc_unsigned& u, const sc_uint_base& v);
00318 sc_signed operator / (const sc_unsigned& u, const sc_int_base& v);
00319 sc_unsigned operator / (const sc_uint_base& u, const sc_unsigned& v);
00320 sc_signed operator / (const sc_int_base& u, const sc_unsigned& v);
00321
00322
00323
00324 sc_signed operator % (const sc_unsigned& u, const sc_signed& v);
00325 sc_signed operator % (const sc_signed& u, const sc_unsigned& v);
00326
00327 sc_unsigned operator % (const sc_unsigned& u, const sc_unsigned& v);
00328 sc_signed operator % (const sc_unsigned& u, int64 v);
00329 sc_unsigned operator % (const sc_unsigned& u, uint64 v);
00330 sc_signed operator % (const sc_unsigned& u, long v);
00331 sc_unsigned operator % (const sc_unsigned& u, unsigned long v);
00332 sc_signed operator % (const sc_unsigned& u, int v);
00333 inline sc_unsigned operator % (const sc_unsigned& u, unsigned int v);
00334
00335 sc_signed operator % (int64 u, const sc_unsigned& v);
00336 sc_unsigned operator % (uint64 u, const sc_unsigned& v);
00337 sc_signed operator % (long u, const sc_unsigned& v);
00338 sc_unsigned operator % (unsigned long u, const sc_unsigned& v);
00339 sc_signed operator % (int u, const sc_unsigned& v);
00340 inline sc_unsigned operator % (unsigned int u, const sc_unsigned& v);
00341
00342 sc_unsigned operator % (const sc_unsigned& u, const sc_uint_base& v);
00343 sc_signed operator % (const sc_unsigned& u, const sc_int_base& v);
00344 sc_unsigned operator % (const sc_uint_base& u, const sc_unsigned& v);
00345 sc_signed operator % (const sc_int_base& u, const sc_unsigned& v);
00346
00347
00348
00349
00350
00351 sc_signed operator & (const sc_unsigned& u, const sc_signed& v);
00352 sc_signed operator & (const sc_signed& u, const sc_unsigned& v);
00353
00354 sc_unsigned operator & (const sc_unsigned& u, const sc_unsigned& v);
00355 sc_signed operator & (const sc_unsigned& u, int64 v);
00356 sc_unsigned operator & (const sc_unsigned& u, uint64 v);
00357 sc_signed operator & (const sc_unsigned& u, long v);
00358 sc_unsigned operator & (const sc_unsigned& u, unsigned long v);
00359 sc_signed operator & (const sc_unsigned& u, int v);
00360 inline sc_unsigned operator & (const sc_unsigned& u, unsigned int v);
00361
00362 sc_signed operator & (int64 u, const sc_unsigned& v);
00363 sc_unsigned operator & (uint64 u, const sc_unsigned& v);
00364 sc_signed operator & (long u, const sc_unsigned& v);
00365 sc_unsigned operator & (unsigned long u, const sc_unsigned& v);
00366 sc_signed operator & (int u, const sc_unsigned& v);
00367 inline sc_unsigned operator & (unsigned int u, const sc_unsigned& v);
00368
00369 sc_unsigned operator & (const sc_unsigned& u, const sc_uint_base& v);
00370 sc_signed operator & (const sc_unsigned& u, const sc_int_base& v);
00371 sc_unsigned operator & (const sc_uint_base& u, const sc_unsigned& v);
00372 sc_signed operator & (const sc_int_base& u, const sc_unsigned& v);
00373
00374
00375
00376 sc_signed operator | (const sc_unsigned& u, const sc_signed& v);
00377 sc_signed operator | (const sc_signed& u, const sc_unsigned& v);
00378
00379 sc_unsigned operator | (const sc_unsigned& u, const sc_unsigned& v);
00380 sc_signed operator | (const sc_unsigned& u, int64 v);
00381 sc_unsigned operator | (const sc_unsigned& u, uint64 v);
00382 sc_signed operator | (const sc_unsigned& u, long v);
00383 sc_unsigned operator | (const sc_unsigned& u, unsigned long v);
00384 sc_signed operator | (const sc_unsigned& u, int v);
00385 inline sc_unsigned operator | (const sc_unsigned& u, unsigned int v);
00386
00387 sc_signed operator | (int64 u, const sc_unsigned& v);
00388 sc_unsigned operator | (uint64 u, const sc_unsigned& v);
00389 sc_signed operator | (long u, const sc_unsigned& v);
00390 sc_unsigned operator | (unsigned long u, const sc_unsigned& v);
00391 sc_signed operator | (int u, const sc_unsigned& v);
00392 inline sc_unsigned operator | (unsigned int u, const sc_unsigned& v);
00393
00394 sc_unsigned operator | (const sc_unsigned& u, const sc_uint_base& v);
00395 sc_signed operator | (const sc_unsigned& u, const sc_int_base& v);
00396 sc_unsigned operator | (const sc_uint_base& u, const sc_unsigned& v);
00397 sc_signed operator | (const sc_int_base& u, const sc_unsigned& v);
00398
00399
00400
00401 sc_signed operator ^ (const sc_unsigned& u, const sc_signed& v);
00402 sc_signed operator ^ (const sc_signed& u, const sc_unsigned& v);
00403
00404 sc_unsigned operator ^ (const sc_unsigned& u, const sc_unsigned& v);
00405 sc_signed operator ^ (const sc_unsigned& u, int64 v);
00406 sc_unsigned operator ^ (const sc_unsigned& u, uint64 v);
00407 sc_signed operator ^ (const sc_unsigned& u, long v);
00408 sc_unsigned operator ^ (const sc_unsigned& u, unsigned long v);
00409 sc_signed operator ^ (const sc_unsigned& u, int v);
00410 inline sc_unsigned operator ^ (const sc_unsigned& u, unsigned int v);
00411
00412 sc_signed operator ^ (int64 u, const sc_unsigned& v);
00413 sc_unsigned operator ^ (uint64 u, const sc_unsigned& v);
00414 sc_signed operator ^ (long u, const sc_unsigned& v);
00415 sc_unsigned operator ^ (unsigned long u, const sc_unsigned& v);
00416 sc_signed operator ^ (int u, const sc_unsigned& v);
00417 inline sc_unsigned operator ^ (unsigned int u, const sc_unsigned& v);
00418
00419 sc_unsigned operator ^ (const sc_unsigned& u, const sc_uint_base& v);
00420 sc_signed operator ^ (const sc_unsigned& u, const sc_int_base& v);
00421 sc_unsigned operator ^ (const sc_uint_base& u, const sc_unsigned& v);
00422 sc_signed operator ^ (const sc_int_base& u, const sc_unsigned& v);
00423
00424
00425
00426
00427
00428 sc_unsigned operator << (const sc_unsigned& u, const sc_signed& v);
00429 sc_signed operator << (const sc_signed& u, const sc_unsigned& v);
00430
00431 sc_unsigned operator << (const sc_unsigned& u, const sc_unsigned& v);
00432 sc_unsigned operator << (const sc_unsigned& u, int64 v);
00433 sc_unsigned operator << (const sc_unsigned& u, uint64 v);
00434 sc_unsigned operator << (const sc_unsigned& u, long v);
00435 sc_unsigned operator << (const sc_unsigned& u, unsigned long v);
00436 inline sc_unsigned operator << (const sc_unsigned& u, int v);
00437 inline sc_unsigned operator << (const sc_unsigned& u, unsigned int v);
00438
00439 sc_unsigned operator << (const sc_unsigned& u, const sc_uint_base& v);
00440 sc_unsigned operator << (const sc_unsigned& u, const sc_int_base& v);
00441
00442
00443
00444 sc_unsigned operator >> (const sc_unsigned& u, const sc_signed& v);
00445 sc_signed operator >> (const sc_signed& u, const sc_unsigned& v);
00446
00447 sc_unsigned operator >> (const sc_unsigned& u, const sc_unsigned& v);
00448 sc_unsigned operator >> (const sc_unsigned& u, int64 v);
00449 sc_unsigned operator >> (const sc_unsigned& u, uint64 v);
00450 sc_unsigned operator >> (const sc_unsigned& u, long v);
00451 sc_unsigned operator >> (const sc_unsigned& u, unsigned long v);
00452 inline sc_unsigned operator >> (const sc_unsigned& u, int v);
00453 inline sc_unsigned operator >> (const sc_unsigned& u, unsigned int v);
00454
00455 sc_unsigned operator >> ( const sc_unsigned& , const sc_uint_base& );
00456 sc_unsigned operator >> ( const sc_unsigned&, const sc_int_base& );
00457
00458
00459 sc_unsigned operator + (const sc_unsigned& u);
00460 sc_signed operator - (const sc_unsigned& u);
00461
00462
00463
00464
00465
00466 bool operator == (const sc_unsigned& u, const sc_signed& v);
00467 bool operator == (const sc_signed& u, const sc_unsigned& v);
00468
00469 bool operator == (const sc_unsigned& u, const sc_unsigned& v);
00470 bool operator == (const sc_unsigned& u, int64 v);
00471 bool operator == (const sc_unsigned& u, uint64 v);
00472 bool operator == (const sc_unsigned& u, long v);
00473 bool operator == (const sc_unsigned& u, unsigned long v);
00474 inline bool operator == (const sc_unsigned& u, int v);
00475 inline bool operator == (const sc_unsigned& u, unsigned int v);
00476
00477 bool operator == (int64 u, const sc_unsigned& v);
00478 bool operator == (uint64 u, const sc_unsigned& v);
00479 bool operator == (long u, const sc_unsigned& v);
00480 bool operator == (unsigned long u, const sc_unsigned& v);
00481 inline bool operator == (int u, const sc_unsigned& v);
00482 inline bool operator == (unsigned int u, const sc_unsigned& v) ;
00483
00484 bool operator == (const sc_unsigned& u, const sc_uint_base& v);
00485 bool operator == (const sc_unsigned& u, const sc_int_base& v);
00486 bool operator == (const sc_uint_base& u, const sc_unsigned& v);
00487 bool operator == (const sc_int_base& u, const sc_unsigned& v);
00488
00489
00490
00491 bool operator != (const sc_unsigned& u, const sc_signed& v);
00492 bool operator != (const sc_signed& u, const sc_unsigned& v);
00493
00494 bool operator != (const sc_unsigned& u, const sc_unsigned& v);
00495 bool operator != (const sc_unsigned& u, int64 v);
00496 bool operator != (const sc_unsigned& u, uint64 v);
00497 bool operator != (const sc_unsigned& u, long v);
00498 bool operator != (const sc_unsigned& u, unsigned long v);
00499 inline bool operator != (const sc_unsigned& u, int v);
00500 inline bool operator != (const sc_unsigned& u, unsigned int v);
00501
00502 bool operator != (int64 u, const sc_unsigned& v);
00503 bool operator != (uint64 u, const sc_unsigned& v);
00504 bool operator != (long u, const sc_unsigned& v);
00505 bool operator != (unsigned long u, const sc_unsigned& v);
00506 inline bool operator != (int u, const sc_unsigned& v);
00507 inline bool operator != (unsigned int u, const sc_unsigned& v);
00508
00509 bool operator != (const sc_unsigned& u, const sc_uint_base& v);
00510 bool operator != (const sc_unsigned& u, const sc_int_base& v);
00511 bool operator != (const sc_uint_base& u, const sc_unsigned& v);
00512 bool operator != (const sc_int_base& u, const sc_unsigned& v);
00513
00514
00515
00516 bool operator < (const sc_unsigned& u, const sc_signed& v);
00517 bool operator < (const sc_signed& u, const sc_unsigned& v);
00518
00519 bool operator < (const sc_unsigned& u, const sc_unsigned& v);
00520 bool operator < (const sc_unsigned& u, int64 v);
00521 bool operator < (const sc_unsigned& u, uint64 v);
00522 bool operator < (const sc_unsigned& u, long v);
00523 bool operator < (const sc_unsigned& u, unsigned long v);
00524 inline bool operator < (const sc_unsigned& u, int v);
00525 inline bool operator < (const sc_unsigned& u, unsigned int v);
00526
00527 bool operator < (int64 u, const sc_unsigned& v);
00528 bool operator < (uint64 u, const sc_unsigned& v);
00529 bool operator < (long u, const sc_unsigned& v);
00530 bool operator < (unsigned long u, const sc_unsigned& v);
00531 inline bool operator < (int u, const sc_unsigned& v);
00532 inline bool operator < (unsigned int u, const sc_unsigned& v);
00533
00534 bool operator < (const sc_unsigned& u, const sc_uint_base& v);
00535 bool operator < (const sc_unsigned& u, const sc_int_base& v);
00536 bool operator < (const sc_uint_base& u, const sc_unsigned& v);
00537 bool operator < (const sc_int_base& u, const sc_unsigned& v);
00538
00539
00540
00541 bool operator <= (const sc_unsigned& u, const sc_signed& v);
00542 bool operator <= (const sc_signed& u, const sc_unsigned& v);
00543
00544 bool operator <= (const sc_unsigned& u, const sc_unsigned& v);
00545 bool operator <= (const sc_unsigned& u, int64 v);
00546 bool operator <= (const sc_unsigned& u, uint64 v);
00547 bool operator <= (const sc_unsigned& u, long v);
00548 bool operator <= (const sc_unsigned& u, unsigned long v);
00549 inline bool operator <= (const sc_unsigned& u, int v);
00550 inline bool operator <= (const sc_unsigned& u, unsigned int v);
00551
00552 bool operator <= (int64 u, const sc_unsigned& v);
00553 bool operator <= (uint64 u, const sc_unsigned& v);
00554 bool operator <= (long u, const sc_unsigned& v);
00555 bool operator <= (unsigned long u, const sc_unsigned& v);
00556 inline bool operator <= (int u, const sc_unsigned& v);
00557 inline bool operator <= (unsigned int u, const sc_unsigned& v);
00558
00559 bool operator <= (const sc_unsigned& u, const sc_uint_base& v);
00560 bool operator <= (const sc_unsigned& u, const sc_int_base& v);
00561 bool operator <= (const sc_uint_base& u, const sc_unsigned& v);
00562 bool operator <= (const sc_int_base& u, const sc_unsigned& v);
00563
00564
00565
00566 bool operator > (const sc_unsigned& u, const sc_signed& v);
00567 bool operator > (const sc_signed& u, const sc_unsigned& v);
00568
00569 bool operator > (const sc_unsigned& u, const sc_unsigned& v);
00570 bool operator > (const sc_unsigned& u, int64 v);
00571 bool operator > (const sc_unsigned& u, uint64 v);
00572 bool operator > (const sc_unsigned& u, long v);
00573 bool operator > (const sc_unsigned& u, unsigned long v);
00574 inline bool operator > (const sc_unsigned& u, int v);
00575 inline bool operator > (const sc_unsigned& u, unsigned int v);
00576
00577 bool operator > (int64 u, const sc_unsigned& v);
00578 bool operator > (uint64 u, const sc_unsigned& v);
00579 bool operator > (long u, const sc_unsigned& v);
00580 bool operator > (unsigned long u, const sc_unsigned& v);
00581 inline bool operator > (int u, const sc_unsigned& v);
00582 inline bool operator > (unsigned int u, const sc_unsigned& v);
00583
00584 bool operator > (const sc_unsigned& u, const sc_uint_base& v);
00585 bool operator > (const sc_unsigned& u, const sc_int_base& v);
00586 bool operator > (const sc_uint_base& u, const sc_unsigned& v);
00587 bool operator > (const sc_int_base& u, const sc_unsigned& v);
00588
00589
00590
00591 bool operator >= (const sc_unsigned& u, const sc_signed& v);
00592 bool operator >= (const sc_signed& u, const sc_unsigned& v);
00593
00594 bool operator >= (const sc_unsigned& u, const sc_unsigned& v);
00595 bool operator >= (const sc_unsigned& u, int64 v);
00596 bool operator >= (const sc_unsigned& u, uint64 v);
00597 bool operator >= (const sc_unsigned& u, long v);
00598 bool operator >= (const sc_unsigned& u, unsigned long v);
00599 inline bool operator >= (const sc_unsigned& u, int v);
00600 inline bool operator >= (const sc_unsigned& u, unsigned int v);
00601
00602 bool operator >= (int64 u, const sc_unsigned& v);
00603 bool operator >= (uint64 u, const sc_unsigned& v);
00604 bool operator >= (long u, const sc_unsigned& v);
00605 bool operator >= (unsigned long u, const sc_unsigned& v);
00606 inline bool operator >= (int u, const sc_unsigned& v);
00607 inline bool operator >= (unsigned int u, const sc_unsigned& v);
00608
00609 bool operator >= (const sc_unsigned& u, const sc_uint_base& v);
00610 bool operator >= (const sc_unsigned& u, const sc_int_base& v);
00611 bool operator >= (const sc_uint_base& u, const sc_unsigned& v);
00612 bool operator >= (const sc_int_base& u, const sc_unsigned& v);
00613
00614
00615 sc_unsigned operator ~ (const sc_unsigned& u);
00616
00617
00618
00619
00620
00621
00622
00623 class sc_unsigned_bitref_r : public sc_value_base
00624 {
00625 friend class sc_unsigned;
00626
00627 protected:
00628
00629
00630
00631 sc_unsigned_bitref_r() : sc_value_base(), m_index(0), m_obj_p(0)
00632 {}
00633
00634 void initialize( const sc_unsigned* obj_p, int index_ )
00635 {
00636 m_obj_p = CCAST<sc_unsigned*>( obj_p );
00637 m_index = index_;
00638 }
00639
00640 public:
00641
00642
00643
00644 virtual ~sc_unsigned_bitref_r()
00645 {}
00646
00647
00648
00649 sc_unsigned_bitref_r( const sc_unsigned_bitref_r& a )
00650 : sc_value_base(a), m_index( a.m_index ), m_obj_p( a.m_obj_p )
00651 {}
00652
00653
00654
00655 int length() const
00656 { return 1; }
00657
00658
00659
00660
00661 operator uint64 () const;
00662 bool operator ! () const;
00663 bool operator ~ () const;
00664
00665
00666
00667
00668 uint64 value() const
00669 { return operator uint64(); }
00670
00671 bool to_bool() const
00672 { return operator uint64(); }
00673
00674
00675
00676
00677 virtual int concat_length(bool* xz_present_p) const
00678 { if ( xz_present_p ) *xz_present_p = false; return 1; }
00679 virtual uint64 concat_get_uint64() const
00680 { return (uint64)operator uint64(); }
00681 virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const
00682 {
00683 int bit_mask = 1 << (low_i % BITS_PER_DIGIT);
00684 int word_i = low_i / BITS_PER_DIGIT;
00685 dst_p[word_i] &= ~bit_mask;
00686 return false;
00687 }
00688 virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const
00689 {
00690 int bit_mask = 1 << (low_i % BITS_PER_DIGIT);
00691 bool result;
00692 int word_i = low_i / BITS_PER_DIGIT;
00693 if ( operator uint64() )
00694 {
00695 dst_p[word_i] |= bit_mask;
00696 result = true;
00697 }
00698 else
00699 {
00700 dst_p[word_i] &= ~bit_mask;
00701 result = false;
00702 }
00703 return result;
00704 }
00705
00706
00707
00708 void print( ::std::ostream& os = ::std::cout ) const
00709 { os << to_bool(); }
00710
00711 protected:
00712
00713 int m_index;
00714 sc_unsigned* m_obj_p;
00715
00716 private:
00717
00718
00719 const sc_unsigned_bitref_r& operator = ( const sc_unsigned_bitref_r& );
00720 };
00721
00722
00723
00724 inline
00725 ::std::ostream&
00726 operator << ( ::std::ostream&, const sc_unsigned_bitref_r& );
00727
00728
00729
00730
00731
00732
00733
00734
00735 class sc_unsigned_bitref
00736 : public sc_unsigned_bitref_r
00737 {
00738 friend class sc_unsigned;
00739 friend class sc_core::sc_vpool<sc_unsigned_bitref>;
00740
00741
00742 protected:
00743
00744 sc_unsigned_bitref() : sc_unsigned_bitref_r()
00745 {}
00746
00747 public:
00748
00749
00750
00751 sc_unsigned_bitref( const sc_unsigned_bitref& a )
00752 : sc_unsigned_bitref_r( a )
00753 {}
00754
00755
00756
00757
00758 const sc_unsigned_bitref& operator = ( const sc_unsigned_bitref_r& );
00759 const sc_unsigned_bitref& operator = ( const sc_unsigned_bitref& );
00760 const sc_unsigned_bitref& operator = ( bool );
00761
00762 const sc_unsigned_bitref& operator &= ( bool );
00763 const sc_unsigned_bitref& operator |= ( bool );
00764 const sc_unsigned_bitref& operator ^= ( bool );
00765
00766
00767
00768 virtual void concat_set(int64 src, int low_i);
00769 virtual void concat_set(const sc_signed& src, int low_i);
00770 virtual void concat_set(const sc_unsigned& src, int low_i);
00771 virtual void concat_set(uint64 src, int low_i);
00772
00773
00774
00775
00776 void scan( ::std::istream& is = ::std::cin );
00777
00778 protected:
00779 static sc_core::sc_vpool<sc_unsigned_bitref> m_pool;
00780 };
00781
00782
00783
00784 inline
00785 ::std::istream&
00786 operator >> ( ::std::istream&, sc_unsigned_bitref& );
00787
00788
00789
00790
00791
00792
00793
00794
00795 class sc_unsigned_subref_r : public sc_value_base
00796 {
00797 friend class sc_signed;
00798 friend class sc_unsigned;
00799 friend class sc_unsigned_signal;
00800
00801 protected:
00802
00803
00804
00805 sc_unsigned_subref_r() : sc_value_base(), m_left(0), m_obj_p(0), m_right(0)
00806 {}
00807
00808 void initialize( const sc_unsigned* obj_p, int left_, int right_ )
00809 {
00810 m_obj_p = CCAST<sc_unsigned*>( obj_p );
00811 m_left = left_;
00812 m_right = right_;
00813 }
00814
00815 public:
00816
00817
00818
00819 virtual ~sc_unsigned_subref_r()
00820 {}
00821
00822
00823
00824
00825 sc_unsigned_subref_r( const sc_unsigned_subref_r& a )
00826 : sc_value_base(a), m_left( a.m_left ), m_obj_p( a.m_obj_p ),
00827 m_right( a.m_right )
00828 {}
00829
00830
00831
00832
00833 int length() const
00834 { return m_left >= m_right ? (m_left-m_right+1) : (m_right-m_left+1 ); }
00835
00836
00837
00838
00839 operator sc_unsigned () const;
00840
00841
00842
00843
00844 int to_int() const;
00845 unsigned int to_uint() const;
00846 long to_long() const;
00847 unsigned long to_ulong() const;
00848 int64 to_int64() const;
00849 uint64 to_uint64() const;
00850 double to_double() const;
00851
00852
00853
00854
00855 const std::string to_string( sc_numrep numrep = SC_DEC ) const;
00856 const std::string to_string( sc_numrep numrep, bool w_prefix ) const;
00857
00858
00859
00860
00861 virtual int concat_length(bool* xz_present_p) const
00862 {
00863 if ( xz_present_p ) *xz_present_p = false;
00864 return m_left - m_right + 1;
00865 }
00866 virtual uint64 concat_get_uint64() const;
00867 virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const;
00868 virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const;
00869
00870
00871
00872 bool and_reduce() const;
00873 bool nand_reduce() const;
00874 bool or_reduce() const;
00875 bool nor_reduce() const;
00876 bool xor_reduce() const ;
00877 bool xnor_reduce() const;
00878
00879
00880
00881 void print( ::std::ostream& os = ::std::cout ) const
00882 { os << to_string(sc_io_base(os,SC_DEC),sc_io_show_base(os)); }
00883
00884 protected:
00885
00886 int m_left;
00887 sc_unsigned* m_obj_p;
00888 int m_right;
00889
00890 private:
00891
00892
00893 const sc_unsigned_subref_r& operator = ( const sc_unsigned_subref_r& );
00894 };
00895
00896
00897
00898 inline
00899 ::std::ostream&
00900 operator << ( ::std::ostream&, const sc_unsigned_subref_r& );
00901
00902
00903
00904
00905
00906
00907
00908
00909 class sc_unsigned_subref
00910 : public sc_unsigned_subref_r
00911 {
00912 friend class sc_unsigned;
00913 friend class sc_core::sc_vpool<sc_unsigned_subref>;
00914
00915
00916
00917
00918 protected:
00919 sc_unsigned_subref() : sc_unsigned_subref_r()
00920 {}
00921
00922 public:
00923
00924
00925
00926 sc_unsigned_subref( const sc_unsigned_subref& a )
00927 : sc_unsigned_subref_r( a )
00928 {}
00929
00930
00931
00932 const sc_unsigned_subref& operator = ( const sc_unsigned_subref_r& a );
00933 const sc_unsigned_subref& operator = ( const sc_unsigned_subref& a );
00934 const sc_unsigned_subref& operator = ( const sc_unsigned& a );
00935
00936 template<class T>
00937 const sc_unsigned_subref& operator = ( const sc_generic_base<T>& a );
00938 const sc_unsigned_subref& operator = ( const sc_signed_subref_r& a );
00939 const sc_unsigned_subref& operator = ( const sc_signed& a );
00940
00941 const sc_unsigned_subref& operator = ( const char* a );
00942 const sc_unsigned_subref& operator = ( unsigned long a );
00943 const sc_unsigned_subref& operator = ( long a );
00944
00945 const sc_unsigned_subref& operator = ( unsigned int a )
00946 { return operator = ( (unsigned long) a ); }
00947
00948 const sc_unsigned_subref& operator = ( int a )
00949 { return operator = ( (long) a ); }
00950
00951 const sc_unsigned_subref& operator = ( uint64 a );
00952 const sc_unsigned_subref& operator = ( int64 a );
00953 const sc_unsigned_subref& operator = ( double a );
00954 const sc_unsigned_subref& operator = ( const sc_int_base& a );
00955 const sc_unsigned_subref& operator = ( const sc_uint_base& a );
00956
00957
00958
00959 virtual void concat_set(int64 src, int low_i);
00960 virtual void concat_set(const sc_signed& src, int low_i);
00961 virtual void concat_set(const sc_unsigned& src, int low_i);
00962 virtual void concat_set(uint64 src, int low_i);
00963
00964
00965
00966 void scan( ::std::istream& is = ::std::cin );
00967
00968 protected:
00969 static sc_core::sc_vpool<sc_unsigned_subref> m_pool;
00970 };
00971
00972
00973
00974 inline
00975 ::std::istream&
00976 operator >> ( ::std::istream&, sc_unsigned_subref& );
00977
00978
00979
00980
00981
00982
00983
00984
00985 class sc_unsigned : public sc_value_base
00986 {
00987 friend class sc_concatref;
00988 friend class sc_unsigned_bitref_r;
00989 friend class sc_unsigned_bitref;
00990 friend class sc_unsigned_subref_r;
00991 friend class sc_unsigned_subref;
00992 friend class sc_signed;
00993 friend class sc_signed_subref;
00994 friend class sc_signed_subref_r;
00995
00996
00997 typedef bool elemtype;
00998
00999 public:
01000
01001
01002
01003 explicit sc_unsigned( int nb = sc_length_param().len() );
01004 sc_unsigned( const sc_unsigned& v );
01005 sc_unsigned( const sc_signed& v );
01006 template<class T>
01007 explicit sc_unsigned( const sc_generic_base<T>& v );
01008 explicit sc_unsigned( const sc_bv_base& v );
01009 explicit sc_unsigned( const sc_lv_base& v );
01010 explicit sc_unsigned( const sc_int_subref_r& v );
01011 explicit sc_unsigned( const sc_uint_subref_r& v );
01012 explicit sc_unsigned( const sc_signed_subref_r& v );
01013 explicit sc_unsigned( const sc_unsigned_subref_r& v );
01014
01015
01016
01017
01018
01019 const sc_unsigned& operator = (const sc_unsigned& v);
01020 const sc_unsigned& operator = (const sc_unsigned_subref_r& a );
01021
01022 template<class T>
01023 const sc_unsigned& operator = ( const sc_generic_base<T>& a )
01024 { a->to_sc_unsigned(*this); return *this; }
01025
01026 const sc_unsigned& operator = (const sc_signed& v);
01027 const sc_unsigned& operator = (const sc_signed_subref_r& a );
01028
01029 const sc_unsigned& operator = ( const char* v);
01030 const sc_unsigned& operator = ( int64 v);
01031 const sc_unsigned& operator = ( uint64 v);
01032 const sc_unsigned& operator = ( long v);
01033 const sc_unsigned& operator = ( unsigned long v);
01034
01035 const sc_unsigned& operator = ( int v)
01036 { return operator=((long) v); }
01037
01038 const sc_unsigned& operator = ( unsigned int v)
01039 { return operator=((unsigned long) v); }
01040
01041 const sc_unsigned& operator = ( double v);
01042 const sc_unsigned& operator = ( const sc_int_base& v);
01043 const sc_unsigned& operator = ( const sc_uint_base& v);
01044
01045 const sc_unsigned& operator = ( const sc_bv_base& );
01046 const sc_unsigned& operator = ( const sc_lv_base& );
01047
01048 #ifdef SC_INCLUDE_FX
01049 const sc_unsigned& operator = ( const sc_fxval& );
01050 const sc_unsigned& operator = ( const sc_fxval_fast& );
01051 const sc_unsigned& operator = ( const sc_fxnum& );
01052 const sc_unsigned& operator = ( const sc_fxnum_fast& );
01053 #endif
01054
01055
01056
01057
01058 virtual ~sc_unsigned()
01059 {
01060 # ifndef SC_MAX_NBITS
01061 delete [] digit;
01062 # endif
01063 }
01064
01065
01066
01067 sc_digit* get_raw() const { return digit; }
01068 virtual int concat_length(bool* xz_present_p) const
01069 { if ( xz_present_p ) *xz_present_p = false; return nbits-1; }
01070 virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const;
01071 virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const;
01072 virtual uint64 concat_get_uint64() const;
01073 virtual void concat_set(int64 src, int low_i);
01074 virtual void concat_set(const sc_signed& src, int low_i);
01075 virtual void concat_set(const sc_unsigned& src, int low_i);
01076 virtual void concat_set(uint64 src, int low_i);
01077
01078
01079
01080 sc_unsigned& operator ++ ();
01081 const sc_unsigned operator ++ (int);
01082
01083
01084
01085 sc_unsigned& operator -- ();
01086 const sc_unsigned operator -- (int);
01087
01088
01089
01090
01091 inline void check_index( int i ) const
01092 { if ( (i < 0) || (i >= nbits-1) ) invalid_index(i); }
01093
01094 void invalid_index( int i ) const;
01095
01096 sc_unsigned_bitref& operator [] ( int i )
01097 {
01098 check_index(i);
01099 sc_unsigned_bitref* result_p =
01100 sc_unsigned_bitref::m_pool.allocate();
01101 result_p->initialize( this, i );
01102 return *result_p;
01103 }
01104
01105 const sc_unsigned_bitref_r& operator [] ( int i ) const
01106 {
01107 check_index(i);
01108 sc_unsigned_bitref* result_p =
01109 sc_unsigned_bitref::m_pool.allocate();
01110 result_p->initialize( this, i );
01111 return *result_p;
01112 }
01113
01114 sc_unsigned_bitref& bit( int i )
01115 {
01116 check_index(i);
01117 sc_unsigned_bitref* result_p =
01118 sc_unsigned_bitref::m_pool.allocate();
01119 result_p->initialize( this, i );
01120 return *result_p;
01121 }
01122
01123 const sc_unsigned_bitref_r& bit( int i ) const
01124 {
01125 check_index(i);
01126 sc_unsigned_bitref* result_p =
01127 sc_unsigned_bitref::m_pool.allocate();
01128 result_p->initialize( this, i );
01129 return *result_p;
01130 }
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142 inline void check_range( int l, int r ) const
01143 {
01144 if ( l < r )
01145 {
01146 if ( (l < 0) || (r >= nbits-1) ) invalid_range(l,r);
01147 }
01148 else
01149 {
01150 if ( (r < 0) || (l >= nbits-1) ) invalid_range(l,r);
01151 }
01152 }
01153
01154 void invalid_range( int l, int r ) const;
01155
01156 sc_unsigned_subref& range( int i, int j )
01157 {
01158 check_range(i,j);
01159 sc_unsigned_subref* result_p =
01160 sc_unsigned_subref::m_pool.allocate();
01161 result_p->initialize( this, i, j );
01162 return *result_p;
01163 }
01164
01165 const sc_unsigned_subref_r& range( int i, int j ) const
01166 {
01167 check_range(i,j);
01168 sc_unsigned_subref* result_p =
01169 sc_unsigned_subref::m_pool.allocate();
01170 result_p->initialize( this, i, j );
01171 return *result_p;
01172 }
01173
01174 sc_unsigned_subref& operator () ( int i, int j )
01175 {
01176 check_range(i,j);
01177 sc_unsigned_subref* result_p =
01178 sc_unsigned_subref::m_pool.allocate();
01179 result_p->initialize( this, i, j );
01180 return *result_p;
01181 }
01182
01183 const sc_unsigned_subref_r& operator () ( int i, int j ) const
01184 {
01185 check_range(i,j);
01186 sc_unsigned_subref* result_p =
01187 sc_unsigned_subref::m_pool.allocate();
01188 result_p->initialize( this, i, j );
01189 return *result_p;
01190 }
01191
01192
01193
01194 int to_int() const;
01195 unsigned int to_uint() const;
01196 long to_long() const;
01197 unsigned long to_ulong() const;
01198 int64 to_int64() const;
01199 uint64 to_uint64() const;
01200 double to_double() const;
01201
01202 #ifdef SC_DT_DEPRECATED
01203 int to_signed() const
01204 { return to_int(); }
01205
01206 unsigned int to_unsigned() const
01207 { return to_uint(); }
01208 #endif
01209
01210
01211
01212 const std::string to_string( sc_numrep numrep = SC_DEC ) const;
01213 const std::string to_string( sc_numrep numrep, bool w_prefix ) const;
01214
01215
01216
01217 void print( ::std::ostream& os = ::std::cout ) const
01218 { os << to_string(sc_io_base(os,SC_DEC),sc_io_show_base(os)); }
01219
01220 void scan( ::std::istream& is = ::std::cin );
01221
01222 void dump( ::std::ostream& os = ::std::cout ) const;
01223
01224
01225
01226 int length() const { return nbits - 1; }
01227 bool iszero() const;
01228 bool sign() const { return 0; }
01229
01230
01231
01232 bool and_reduce() const;
01233
01234 bool nand_reduce() const
01235 { return ( ! and_reduce() ); }
01236
01237 bool or_reduce() const;
01238
01239 bool nor_reduce() const
01240 { return ( ! or_reduce() ); }
01241
01242 bool xor_reduce() const;
01243
01244 bool xnor_reduce() const
01245 { return ( ! xor_reduce() ); }
01246
01247
01248
01249 bool test(int i) const;
01250 void set(int i);
01251 void clear(int i);
01252 void set(int i, bool v)
01253 { if (v) set(i); else clear(i); }
01254 void invert(int i)
01255 { if (test(i)) clear(i); else set(i); }
01256
01257
01258 void reverse();
01259
01260
01261 void get_packed_rep(sc_digit *buf) const;
01262 void set_packed_rep(sc_digit *buf);
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297 friend sc_signed operator + (const sc_unsigned& u, const sc_signed& v);
01298 friend sc_signed operator + (const sc_signed& u, const sc_unsigned& v);
01299
01300 friend sc_unsigned operator + (const sc_unsigned& u, const sc_unsigned& v);
01301 friend sc_signed operator + (const sc_unsigned& u, int64 v);
01302 friend sc_unsigned operator + (const sc_unsigned& u, uint64 v);
01303 friend sc_signed operator + (const sc_unsigned& u, long v);
01304 friend sc_unsigned operator + (const sc_unsigned& u, unsigned long v);
01305 friend sc_signed operator + (const sc_unsigned& u, int v);
01306 friend sc_unsigned operator + (const sc_unsigned& u, unsigned int v)
01307 { return operator+(u, (unsigned long) v); }
01308
01309 friend sc_signed operator + (int64 u, const sc_unsigned& v);
01310 friend sc_unsigned operator + (uint64 u, const sc_unsigned& v);
01311 friend sc_signed operator + (long u, const sc_unsigned& v);
01312 friend sc_unsigned operator + (unsigned long u, const sc_unsigned& v);
01313 friend sc_signed operator + (int u, const sc_unsigned& v);
01314 friend sc_unsigned operator + (unsigned int u, const sc_unsigned& v)
01315 { return operator+((unsigned long) u, v); }
01316
01317 const sc_unsigned& operator += (const sc_signed& v);
01318 const sc_unsigned& operator += (const sc_unsigned& v);
01319 const sc_unsigned& operator += (int64 v);
01320 const sc_unsigned& operator += (uint64 v);
01321 const sc_unsigned& operator += (long v);
01322 const sc_unsigned& operator += (unsigned long v);
01323 const sc_unsigned& operator += (int v)
01324 { return operator+=((long) v); }
01325 const sc_unsigned& operator += (unsigned int v)
01326 { return operator+=((unsigned long) v); }
01327
01328 friend sc_unsigned operator + (const sc_unsigned& u, const sc_uint_base& v);
01329 friend sc_signed operator + (const sc_unsigned& u, const sc_int_base& v);
01330 friend sc_unsigned operator + (const sc_uint_base& u, const sc_unsigned& v);
01331 friend sc_signed operator + (const sc_int_base& u, const sc_unsigned& v);
01332 const sc_unsigned& operator += (const sc_int_base& v);
01333 const sc_unsigned& operator += (const sc_uint_base& v);
01334
01335
01336
01337 friend sc_signed operator - (const sc_unsigned& u, const sc_signed& v);
01338 friend sc_signed operator - (const sc_signed& u, const sc_unsigned& v);
01339
01340 friend sc_signed operator - (const sc_unsigned& u, const sc_unsigned& v);
01341 friend sc_signed operator - (const sc_unsigned& u, int64 v);
01342 friend sc_signed operator - (const sc_unsigned& u, uint64 v);
01343 friend sc_signed operator - (const sc_unsigned& u, long v);
01344 friend sc_signed operator - (const sc_unsigned& u, unsigned long v);
01345 friend sc_signed operator - (const sc_unsigned& u, int v);
01346 friend sc_signed operator - (const sc_unsigned& u, unsigned int v);
01347
01348 friend sc_signed operator - (int64 u, const sc_unsigned& v);
01349 friend sc_signed operator - (uint64 u, const sc_unsigned& v);
01350 friend sc_signed operator - (long u, const sc_unsigned& v);
01351 friend sc_signed operator - (unsigned long u, const sc_unsigned& v);
01352 friend sc_signed operator - (int u, const sc_unsigned& v);
01353 friend sc_signed operator - (unsigned int u, const sc_unsigned& v);
01354
01355 const sc_unsigned& operator -= (const sc_signed& v);
01356 const sc_unsigned& operator -= (const sc_unsigned& v);
01357 const sc_unsigned& operator -= (int64 v);
01358 const sc_unsigned& operator -= (uint64 v);
01359 const sc_unsigned& operator -= (long v);
01360 const sc_unsigned& operator -= (unsigned long v);
01361 const sc_unsigned& operator -= (int v)
01362 { return operator-=((long) v); }
01363 const sc_unsigned& operator -= (unsigned int v)
01364 { return operator-=((unsigned long) v); }
01365
01366 friend sc_signed operator - (const sc_unsigned& u, const sc_uint_base& v);
01367 friend sc_signed operator - (const sc_unsigned& u, const sc_int_base& v);
01368 friend sc_signed operator - (const sc_uint_base& u, const sc_unsigned& v);
01369 friend sc_signed operator - (const sc_int_base& u, const sc_unsigned& v);
01370 const sc_unsigned& operator -= (const sc_int_base& v);
01371 const sc_unsigned& operator -= (const sc_uint_base& v);
01372
01373
01374
01375 friend sc_signed operator * (const sc_unsigned& u, const sc_signed& v);
01376 friend sc_signed operator * (const sc_signed& u, const sc_unsigned& v);
01377
01378 friend sc_unsigned operator * (const sc_unsigned& u, const sc_unsigned& v);
01379 friend sc_signed operator * (const sc_unsigned& u, int64 v);
01380 friend sc_unsigned operator * (const sc_unsigned& u, uint64 v);
01381 friend sc_signed operator * (const sc_unsigned& u, long v);
01382 friend sc_unsigned operator * (const sc_unsigned& u, unsigned long v);
01383 friend sc_signed operator * (const sc_unsigned& u, int v);
01384 friend sc_unsigned operator * (const sc_unsigned& u, unsigned int v)
01385 { return operator*(u, (unsigned long) v); }
01386
01387 friend sc_signed operator * (int64 u, const sc_unsigned& v);
01388 friend sc_unsigned operator * (uint64 u, const sc_unsigned& v);
01389 friend sc_signed operator * (long u, const sc_unsigned& v);
01390 friend sc_unsigned operator * (unsigned long u, const sc_unsigned& v);
01391 friend sc_signed operator * (int u, const sc_unsigned& v);
01392 friend sc_unsigned operator * (unsigned int u, const sc_unsigned& v)
01393 { return operator*((unsigned long) u, v); }
01394
01395 const sc_unsigned& operator *= (const sc_signed& v);
01396 const sc_unsigned& operator *= (const sc_unsigned& v);
01397 const sc_unsigned& operator *= (int64 v);
01398 const sc_unsigned& operator *= (uint64 v);
01399 const sc_unsigned& operator *= (long v);
01400 const sc_unsigned& operator *= (unsigned long v);
01401 const sc_unsigned& operator *= (int v)
01402 { return operator*=((long) v); }
01403 const sc_unsigned& operator *= (unsigned int v)
01404 { return operator*=((unsigned long) v); }
01405
01406 friend sc_unsigned operator * (const sc_unsigned& u, const sc_uint_base& v);
01407 friend sc_signed operator * (const sc_unsigned& u, const sc_int_base& v);
01408 friend sc_unsigned operator * (const sc_uint_base& u, const sc_unsigned& v);
01409 friend sc_signed operator * (const sc_int_base& u, const sc_unsigned& v);
01410 const sc_unsigned& operator *= (const sc_int_base& v);
01411 const sc_unsigned& operator *= (const sc_uint_base& v);
01412
01413
01414
01415 friend sc_signed operator / (const sc_unsigned& u, const sc_signed& v);
01416 friend sc_signed operator / (const sc_signed& u, const sc_unsigned& v);
01417
01418 friend sc_unsigned operator / (const sc_unsigned& u, const sc_unsigned& v);
01419 friend sc_signed operator / (const sc_unsigned& u, int64 v);
01420 friend sc_unsigned operator / (const sc_unsigned& u, uint64 v);
01421 friend sc_signed operator / (const sc_unsigned& u, long v);
01422 friend sc_unsigned operator / (const sc_unsigned& u, unsigned long v);
01423 friend sc_signed operator / (const sc_unsigned& u, int v);
01424 friend sc_unsigned operator / (const sc_unsigned& u, unsigned int v)
01425 { return operator/(u, (unsigned long) v); }
01426
01427 friend sc_signed operator / (int64 u, const sc_unsigned& v);
01428 friend sc_unsigned operator / (uint64 u, const sc_unsigned& v);
01429 friend sc_signed operator / (long u, const sc_unsigned& v);
01430 friend sc_unsigned operator / (unsigned long u, const sc_unsigned& v);
01431 friend sc_signed operator / (int u, const sc_unsigned& v);
01432 friend sc_unsigned operator / (unsigned int u, const sc_unsigned& v)
01433 { return operator/((unsigned long) u, v); }
01434
01435 const sc_unsigned& operator /= (const sc_signed& v);
01436 const sc_unsigned& operator /= (const sc_unsigned& v);
01437 const sc_unsigned& operator /= (int64 v);
01438 const sc_unsigned& operator /= (uint64 v);
01439 const sc_unsigned& operator /= (long v);
01440 const sc_unsigned& operator /= (unsigned long v);
01441 const sc_unsigned& operator /= (int v)
01442 { return operator/=((long) v); }
01443 const sc_unsigned& operator /= (unsigned int v)
01444 { return operator/=((unsigned long) v); }
01445
01446 friend sc_unsigned operator / (const sc_unsigned& u, const sc_uint_base& v);
01447 friend sc_signed operator / (const sc_unsigned& u, const sc_int_base& v);
01448 friend sc_unsigned operator / (const sc_uint_base& u, const sc_unsigned& v);
01449 friend sc_signed operator / (const sc_int_base& u, const sc_unsigned& v);
01450 const sc_unsigned& operator /= (const sc_int_base& v);
01451 const sc_unsigned& operator /= (const sc_uint_base& v);
01452
01453
01454
01455 friend sc_signed operator % (const sc_unsigned& u, const sc_signed& v);
01456 friend sc_signed operator % (const sc_signed& u, const sc_unsigned& v);
01457
01458 friend sc_unsigned operator % (const sc_unsigned& u, const sc_unsigned& v);
01459 friend sc_signed operator % (const sc_unsigned& u, int64 v);
01460 friend sc_unsigned operator % (const sc_unsigned& u, uint64 v);
01461 friend sc_signed operator % (const sc_unsigned& u, long v);
01462 friend sc_unsigned operator % (const sc_unsigned& u, unsigned long v);
01463 friend sc_signed operator % (const sc_unsigned& u, int v);
01464 friend sc_unsigned operator % (const sc_unsigned& u, unsigned int v)
01465 { return operator%(u, (unsigned long) v); }
01466
01467 friend sc_signed operator % (int64 u, const sc_unsigned& v);
01468 friend sc_unsigned operator % (uint64 u, const sc_unsigned& v);
01469 friend sc_signed operator % (long u, const sc_unsigned& v);
01470 friend sc_unsigned operator % (unsigned long u, const sc_unsigned& v);
01471 friend sc_signed operator % (int u, const sc_unsigned& v);
01472 friend sc_unsigned operator % (unsigned int u, const sc_unsigned& v)
01473 { return operator%((unsigned long) u, v); }
01474
01475 const sc_unsigned& operator %= (const sc_signed& v);
01476 const sc_unsigned& operator %= (const sc_unsigned& v);
01477 const sc_unsigned& operator %= (int64 v);
01478 const sc_unsigned& operator %= (uint64 v);
01479 const sc_unsigned& operator %= (long v);
01480 const sc_unsigned& operator %= (unsigned long v);
01481 const sc_unsigned& operator %= (int v)
01482 { return operator%=((long) v); }
01483 const sc_unsigned& operator %= (unsigned int v)
01484 { return operator%=((unsigned long) v); }
01485
01486 friend sc_unsigned operator % (const sc_unsigned& u, const sc_uint_base& v);
01487 friend sc_signed operator % (const sc_unsigned& u, const sc_int_base& v);
01488 friend sc_unsigned operator % (const sc_uint_base& u, const sc_unsigned& v);
01489 friend sc_signed operator % (const sc_int_base& u, const sc_unsigned& v);
01490 const sc_unsigned& operator %= (const sc_int_base& v);
01491 const sc_unsigned& operator %= (const sc_uint_base& v);
01492
01493
01494
01495
01496
01497 friend sc_signed operator & (const sc_unsigned& u, const sc_signed& v);
01498 friend sc_signed operator & (const sc_signed& u, const sc_unsigned& v);
01499
01500 friend sc_unsigned operator & (const sc_unsigned& u, const sc_unsigned& v);
01501 friend sc_signed operator & (const sc_unsigned& u, int64 v);
01502 friend sc_unsigned operator & (const sc_unsigned& u, uint64 v);
01503 friend sc_signed operator & (const sc_unsigned& u, long v);
01504 friend sc_unsigned operator & (const sc_unsigned& u, unsigned long v);
01505 friend sc_signed operator & (const sc_unsigned& u, int v);
01506 friend sc_unsigned operator & (const sc_unsigned& u, unsigned int v)
01507 { return operator&(u, (unsigned long) v); }
01508
01509 friend sc_signed operator & (int64 u, const sc_unsigned& v);
01510 friend sc_unsigned operator & (uint64 u, const sc_unsigned& v);
01511 friend sc_signed operator & (long u, const sc_unsigned& v);
01512 friend sc_unsigned operator & (unsigned long u, const sc_unsigned& v);
01513 friend sc_signed operator & (int u, const sc_unsigned& v);
01514 friend sc_unsigned operator & (unsigned int u, const sc_unsigned& v)
01515 { return operator&((unsigned long) u, v); }
01516
01517 const sc_unsigned& operator &= (const sc_signed& v);
01518 const sc_unsigned& operator &= (const sc_unsigned& v);
01519 const sc_unsigned& operator &= (int64 v);
01520 const sc_unsigned& operator &= (uint64 v);
01521 const sc_unsigned& operator &= (long v);
01522 const sc_unsigned& operator &= (unsigned long v);
01523 const sc_unsigned& operator &= (int v)
01524 { return operator&=((long) v); }
01525 const sc_unsigned& operator &= (unsigned int v)
01526 { return operator&=((unsigned long) v); }
01527
01528 friend sc_unsigned operator & (const sc_unsigned& u, const sc_uint_base& v);
01529 friend sc_signed operator & (const sc_unsigned& u, const sc_int_base& v);
01530 friend sc_unsigned operator & (const sc_uint_base& u, const sc_unsigned& v);
01531 friend sc_signed operator & (const sc_int_base& u, const sc_unsigned& v);
01532 const sc_unsigned& operator &= (const sc_int_base& v);
01533 const sc_unsigned& operator &= (const sc_uint_base& v);
01534
01535
01536
01537 friend sc_signed operator | (const sc_unsigned& u, const sc_signed& v);
01538 friend sc_signed operator | (const sc_signed& u, const sc_unsigned& v);
01539
01540 friend sc_unsigned operator | (const sc_unsigned& u, const sc_unsigned& v);
01541 friend sc_signed operator | (const sc_unsigned& u, int64 v);
01542 friend sc_unsigned operator | (const sc_unsigned& u, uint64 v);
01543 friend sc_signed operator | (const sc_unsigned& u, long v);
01544 friend sc_unsigned operator | (const sc_unsigned& u, unsigned long v);
01545 friend sc_signed operator | (const sc_unsigned& u, int v);
01546 friend sc_unsigned operator | (const sc_unsigned& u, unsigned int v)
01547 { return operator|(u, (unsigned long) v); }
01548
01549 friend sc_signed operator | (int64 u, const sc_unsigned& v);
01550 friend sc_unsigned operator | (uint64 u, const sc_unsigned& v);
01551 friend sc_signed operator | (long u, const sc_unsigned& v);
01552 friend sc_unsigned operator | (unsigned long u, const sc_unsigned& v);
01553 friend sc_signed operator | (int u, const sc_unsigned& v);
01554 friend sc_unsigned operator | (unsigned int u, const sc_unsigned& v)
01555 { return operator|((unsigned long) u, v); }
01556
01557 const sc_unsigned& operator |= (const sc_signed& v);
01558 const sc_unsigned& operator |= (const sc_unsigned& v);
01559 const sc_unsigned& operator |= (int64 v);
01560 const sc_unsigned& operator |= (uint64 v);
01561 const sc_unsigned& operator |= (long v);
01562 const sc_unsigned& operator |= (unsigned long v);
01563 const sc_unsigned& operator |= (int v)
01564 { return operator|=((long) v); }
01565 const sc_unsigned& operator |= (unsigned int v)
01566 { return operator|=((unsigned long) v); }
01567
01568 friend sc_unsigned operator | (const sc_unsigned& u, const sc_uint_base& v);
01569 friend sc_signed operator | (const sc_unsigned& u, const sc_int_base& v);
01570 friend sc_unsigned operator | (const sc_uint_base& u, const sc_unsigned& v);
01571 friend sc_signed operator | (const sc_int_base& u, const sc_unsigned& v);
01572 const sc_unsigned& operator |= (const sc_int_base& v);
01573 const sc_unsigned& operator |= (const sc_uint_base& v);
01574
01575
01576
01577 friend sc_signed operator ^ (const sc_unsigned& u, const sc_signed& v);
01578 friend sc_signed operator ^ (const sc_signed& u, const sc_unsigned& v);
01579
01580 friend sc_unsigned operator ^ (const sc_unsigned& u, const sc_unsigned& v);
01581 friend sc_signed operator ^ (const sc_unsigned& u, int64 v);
01582 friend sc_unsigned operator ^ (const sc_unsigned& u, uint64 v);
01583 friend sc_signed operator ^ (const sc_unsigned& u, long v);
01584 friend sc_unsigned operator ^ (const sc_unsigned& u, unsigned long v);
01585 friend sc_signed operator ^ (const sc_unsigned& u, int v);
01586 friend sc_unsigned operator ^ (const sc_unsigned& u, unsigned int v)
01587 { return operator^(u, (unsigned long) v); }
01588
01589 friend sc_signed operator ^ (int64 u, const sc_unsigned& v);
01590 friend sc_unsigned operator ^ (uint64 u, const sc_unsigned& v);
01591 friend sc_signed operator ^ (long u, const sc_unsigned& v);
01592 friend sc_unsigned operator ^ (unsigned long u, const sc_unsigned& v);
01593 friend sc_signed operator ^ (int u, const sc_unsigned& v);
01594 friend sc_unsigned operator ^ (unsigned int u, const sc_unsigned& v)
01595 { return operator^((unsigned long) u, v); }
01596
01597 const sc_unsigned& operator ^= (const sc_signed& v);
01598 const sc_unsigned& operator ^= (const sc_unsigned& v);
01599 const sc_unsigned& operator ^= (int64 v);
01600 const sc_unsigned& operator ^= (uint64 v);
01601 const sc_unsigned& operator ^= (long v);
01602 const sc_unsigned& operator ^= (unsigned long v);
01603 const sc_unsigned& operator ^= (int v)
01604 { return operator^=((long) v); }
01605 const sc_unsigned& operator ^= (unsigned int v)
01606 { return operator^=((unsigned long) v); }
01607
01608 friend sc_unsigned operator ^ (const sc_unsigned& u, const sc_uint_base& v);
01609 friend sc_signed operator ^ (const sc_unsigned& u, const sc_int_base& v);
01610 friend sc_unsigned operator ^ (const sc_uint_base& u, const sc_unsigned& v);
01611 friend sc_signed operator ^ (const sc_int_base& u, const sc_unsigned& v);
01612 const sc_unsigned& operator ^= (const sc_int_base& v);
01613 const sc_unsigned& operator ^= (const sc_uint_base& v);
01614
01615
01616
01617
01618
01619 friend sc_unsigned operator << (const sc_unsigned& u, const sc_signed& v);
01620 friend sc_signed operator << (const sc_signed& u, const sc_unsigned& v);
01621
01622 friend sc_unsigned operator << (const sc_unsigned& u, const sc_unsigned& v);
01623 friend sc_unsigned operator << (const sc_unsigned& u, int64 v);
01624 friend sc_unsigned operator << (const sc_unsigned& u, uint64 v);
01625 friend sc_unsigned operator << (const sc_unsigned& u, long v);
01626 friend sc_unsigned operator << (const sc_unsigned& u, unsigned long v);
01627 friend sc_unsigned operator << (const sc_unsigned& u, int v)
01628 { return operator<<(u, (long) v); }
01629 friend sc_unsigned operator << (const sc_unsigned& u, unsigned int v)
01630 { return operator<<(u, (unsigned long) v); }
01631
01632 const sc_unsigned& operator <<= (const sc_signed& v);
01633 const sc_unsigned& operator <<= (const sc_unsigned& v);
01634 const sc_unsigned& operator <<= (int64 v);
01635 const sc_unsigned& operator <<= (uint64 v);
01636 const sc_unsigned& operator <<= (long v);
01637 const sc_unsigned& operator <<= (unsigned long v);
01638 const sc_unsigned& operator <<= (int v)
01639 { return operator<<=((long) v); }
01640 const sc_unsigned& operator <<= (unsigned int v)
01641 { return operator<<=((unsigned long) v); }
01642
01643 friend sc_unsigned operator << (const sc_unsigned& u, const sc_uint_base& v);
01644 friend sc_unsigned operator << (const sc_unsigned& u, const sc_int_base& v);
01645 const sc_unsigned& operator <<= (const sc_int_base& v);
01646 const sc_unsigned& operator <<= (const sc_uint_base& v);
01647
01648
01649
01650 friend sc_unsigned operator >> (const sc_unsigned& u, const sc_signed& v);
01651 friend sc_signed operator >> (const sc_signed& u, const sc_unsigned& v);
01652
01653 friend sc_unsigned operator >> (const sc_unsigned& u, const sc_unsigned& v);
01654 friend sc_unsigned operator >> (const sc_unsigned& u, int64 v);
01655 friend sc_unsigned operator >> (const sc_unsigned& u, uint64 v);
01656 friend sc_unsigned operator >> (const sc_unsigned& u, long v);
01657 friend sc_unsigned operator >> (const sc_unsigned& u, unsigned long v);
01658 friend sc_unsigned operator >> (const sc_unsigned& u, int v)
01659 { return operator>>(u, (long) v); }
01660 friend sc_unsigned operator >> (const sc_unsigned& u, unsigned int v)
01661 { return operator>>(u, (unsigned long) v); }
01662
01663 const sc_unsigned& operator >>= (const sc_signed& v);
01664 const sc_unsigned& operator >>= (const sc_unsigned& v);
01665 const sc_unsigned& operator >>= (int64 v);
01666 const sc_unsigned& operator >>= (uint64 v);
01667 const sc_unsigned& operator >>= (long v);
01668 const sc_unsigned& operator >>= (unsigned long v);
01669 const sc_unsigned& operator >>= (int v)
01670 { return operator>>=((long) v); }
01671 const sc_unsigned& operator >>= (unsigned int v)
01672 { return operator>>=((unsigned long) v); }
01673
01674 friend sc_unsigned operator >> ( const sc_unsigned& , const sc_uint_base& );
01675 friend sc_unsigned operator >> ( const sc_unsigned&, const sc_int_base& );
01676 const sc_unsigned& operator >>= (const sc_int_base& v);
01677 const sc_unsigned& operator >>= (const sc_uint_base& v);
01678
01679
01680 friend sc_unsigned operator + (const sc_unsigned& u);
01681 friend sc_signed operator - (const sc_unsigned& u);
01682
01683
01684
01685
01686
01687 friend bool operator == (const sc_unsigned& u, const sc_signed& v);
01688 friend bool operator == (const sc_signed& u, const sc_unsigned& v);
01689
01690 friend bool operator == (const sc_unsigned& u, const sc_unsigned& v);
01691 friend bool operator == (const sc_unsigned& u, int64 v);
01692 friend bool operator == (const sc_unsigned& u, uint64 v);
01693 friend bool operator == (const sc_unsigned& u, long v);
01694 friend bool operator == (const sc_unsigned& u, unsigned long v);
01695 friend bool operator == (const sc_unsigned& u, int v)
01696 { return operator==(u, (long) v); }
01697 friend bool operator == (const sc_unsigned& u, unsigned int v)
01698 { return operator==(u, (unsigned long) v); }
01699
01700 friend bool operator == (int64 u, const sc_unsigned& v);
01701 friend bool operator == (uint64 u, const sc_unsigned& v);
01702 friend bool operator == (long u, const sc_unsigned& v);
01703 friend bool operator == (unsigned long u, const sc_unsigned& v);
01704 friend bool operator == (int u, const sc_unsigned& v)
01705 { return operator==((long) u, v); }
01706 friend bool operator == (unsigned int u, const sc_unsigned& v)
01707 { return operator==((unsigned long) u, v); }
01708
01709 friend bool operator == (const sc_unsigned& u, const sc_uint_base& v);
01710 friend bool operator == (const sc_unsigned& u, const sc_int_base& v);
01711 friend bool operator == (const sc_uint_base& u, const sc_unsigned& v);
01712 friend bool operator == (const sc_int_base& u, const sc_unsigned& v);
01713
01714
01715
01716 friend bool operator != (const sc_unsigned& u, const sc_signed& v);
01717 friend bool operator != (const sc_signed& u, const sc_unsigned& v);
01718
01719 friend bool operator != (const sc_unsigned& u, const sc_unsigned& v);
01720 friend bool operator != (const sc_unsigned& u, int64 v);
01721 friend bool operator != (const sc_unsigned& u, uint64 v);
01722 friend bool operator != (const sc_unsigned& u, long v);
01723 friend bool operator != (const sc_unsigned& u, unsigned long v);
01724 friend bool operator != (const sc_unsigned& u, int v)
01725 { return operator!=(u, (long) v); }
01726 friend bool operator != (const sc_unsigned& u, unsigned int v)
01727 { return operator!=(u, (unsigned long) v); }
01728
01729 friend bool operator != (int64 u, const sc_unsigned& v);
01730 friend bool operator != (uint64 u, const sc_unsigned& v);
01731 friend bool operator != (long u, const sc_unsigned& v);
01732 friend bool operator != (unsigned long u, const sc_unsigned& v);
01733 friend bool operator != (int u, const sc_unsigned& v)
01734 { return operator!=((long) u, v); }
01735 friend bool operator != (unsigned int u, const sc_unsigned& v)
01736 { return operator!=((unsigned long) u, v); }
01737
01738 friend bool operator != (const sc_unsigned& u, const sc_uint_base& v);
01739 friend bool operator != (const sc_unsigned& u, const sc_int_base& v);
01740 friend bool operator != (const sc_uint_base& u, const sc_unsigned& v);
01741 friend bool operator != (const sc_int_base& u, const sc_unsigned& v);
01742
01743
01744
01745 friend bool operator < (const sc_unsigned& u, const sc_signed& v);
01746 friend bool operator < (const sc_signed& u, const sc_unsigned& v);
01747
01748 friend bool operator < (const sc_unsigned& u, const sc_unsigned& v);
01749 friend bool operator < (const sc_unsigned& u, int64 v);
01750 friend bool operator < (const sc_unsigned& u, uint64 v);
01751 friend bool operator < (const sc_unsigned& u, long v);
01752 friend bool operator < (const sc_unsigned& u, unsigned long v);
01753 friend bool operator < (const sc_unsigned& u, int v)
01754 { return operator<(u, (long) v); }
01755 friend bool operator < (const sc_unsigned& u, unsigned int v)
01756 { return operator<(u, (unsigned long) v); }
01757
01758 friend bool operator < (int64 u, const sc_unsigned& v);
01759 friend bool operator < (uint64 u, const sc_unsigned& v);
01760 friend bool operator < (long u, const sc_unsigned& v);
01761 friend bool operator < (unsigned long u, const sc_unsigned& v);
01762 friend bool operator < (int u, const sc_unsigned& v)
01763 { return operator<((long) u, v); }
01764 friend bool operator < (unsigned int u, const sc_unsigned& v)
01765 { return operator<((unsigned long) u, v); }
01766
01767 friend bool operator < (const sc_unsigned& u, const sc_uint_base& v);
01768 friend bool operator < (const sc_unsigned& u, const sc_int_base& v);
01769 friend bool operator < (const sc_uint_base& u, const sc_unsigned& v);
01770 friend bool operator < (const sc_int_base& u, const sc_unsigned& v);
01771
01772
01773
01774 friend bool operator <= (const sc_unsigned& u, const sc_signed& v);
01775 friend bool operator <= (const sc_signed& u, const sc_unsigned& v);
01776
01777 friend bool operator <= (const sc_unsigned& u, const sc_unsigned& v);
01778 friend bool operator <= (const sc_unsigned& u, int64 v);
01779 friend bool operator <= (const sc_unsigned& u, uint64 v);
01780 friend bool operator <= (const sc_unsigned& u, long v);
01781 friend bool operator <= (const sc_unsigned& u, unsigned long v);
01782 friend bool operator <= (const sc_unsigned& u, int v)
01783 { return operator<=(u, (long) v); }
01784 friend bool operator <= (const sc_unsigned& u, unsigned int v)
01785 { return operator<=(u, (unsigned long) v); }
01786
01787 friend bool operator <= (int64 u, const sc_unsigned& v);
01788 friend bool operator <= (uint64 u, const sc_unsigned& v);
01789 friend bool operator <= (long u, const sc_unsigned& v);
01790 friend bool operator <= (unsigned long u, const sc_unsigned& v);
01791 friend bool operator <= (int u, const sc_unsigned& v)
01792 { return operator<=((long) u, v); }
01793 friend bool operator <= (unsigned int u, const sc_unsigned& v)
01794 { return operator<=((unsigned long) u, v); }
01795
01796 friend bool operator <= (const sc_unsigned& u, const sc_uint_base& v);
01797 friend bool operator <= (const sc_unsigned& u, const sc_int_base& v);
01798 friend bool operator <= (const sc_uint_base& u, const sc_unsigned& v);
01799 friend bool operator <= (const sc_int_base& u, const sc_unsigned& v);
01800
01801
01802
01803 friend bool operator > (const sc_unsigned& u, const sc_signed& v);
01804 friend bool operator > (const sc_signed& u, const sc_unsigned& v);
01805
01806 friend bool operator > (const sc_unsigned& u, const sc_unsigned& v);
01807 friend bool operator > (const sc_unsigned& u, int64 v);
01808 friend bool operator > (const sc_unsigned& u, uint64 v);
01809 friend bool operator > (const sc_unsigned& u, long v);
01810 friend bool operator > (const sc_unsigned& u, unsigned long v);
01811 friend bool operator > (const sc_unsigned& u, int v)
01812 { return operator>(u, (long) v); }
01813 friend bool operator > (const sc_unsigned& u, unsigned int v)
01814 { return operator>(u, (unsigned long) v); }
01815
01816 friend bool operator > (int64 u, const sc_unsigned& v);
01817 friend bool operator > (uint64 u, const sc_unsigned& v);
01818 friend bool operator > (long u, const sc_unsigned& v);
01819 friend bool operator > (unsigned long u, const sc_unsigned& v);
01820 friend bool operator > (int u, const sc_unsigned& v)
01821 { return operator>((long) u, v); }
01822 friend bool operator > (unsigned int u, const sc_unsigned& v)
01823 { return operator>((unsigned long) u, v); }
01824
01825 friend bool operator > (const sc_unsigned& u, const sc_uint_base& v);
01826 friend bool operator > (const sc_unsigned& u, const sc_int_base& v);
01827 friend bool operator > (const sc_uint_base& u, const sc_unsigned& v);
01828 friend bool operator > (const sc_int_base& u, const sc_unsigned& v);
01829
01830
01831
01832 friend bool operator >= (const sc_unsigned& u, const sc_signed& v);
01833 friend bool operator >= (const sc_signed& u, const sc_unsigned& v);
01834
01835 friend bool operator >= (const sc_unsigned& u, const sc_unsigned& v);
01836 friend bool operator >= (const sc_unsigned& u, int64 v);
01837 friend bool operator >= (const sc_unsigned& u, uint64 v);
01838 friend bool operator >= (const sc_unsigned& u, long v);
01839 friend bool operator >= (const sc_unsigned& u, unsigned long v);
01840 friend bool operator >= (const sc_unsigned& u, int v)
01841 { return operator>=(u, (long) v); }
01842 friend bool operator >= (const sc_unsigned& u, unsigned int v)
01843 { return operator>=(u, (unsigned long) v); }
01844
01845 friend bool operator >= (int64 u, const sc_unsigned& v);
01846 friend bool operator >= (uint64 u, const sc_unsigned& v);
01847 friend bool operator >= (long u, const sc_unsigned& v);
01848 friend bool operator >= (unsigned long u, const sc_unsigned& v);
01849 friend bool operator >= (int u, const sc_unsigned& v)
01850 { return operator>=((long) u, v); }
01851 friend bool operator >= (unsigned int u, const sc_unsigned& v)
01852 { return operator>=((unsigned long) u, v); }
01853
01854 friend bool operator >= (const sc_unsigned& u, const sc_uint_base& v);
01855 friend bool operator >= (const sc_unsigned& u, const sc_int_base& v);
01856 friend bool operator >= (const sc_uint_base& u, const sc_unsigned& v);
01857 friend bool operator >= (const sc_int_base& u, const sc_unsigned& v);
01858
01859
01860 friend sc_unsigned operator ~ (const sc_unsigned& u);
01861
01862
01863 friend int compare_unsigned(small_type us,
01864 int unb,
01865 int und,
01866 const sc_digit *ud,
01867 small_type vs,
01868 int vnb,
01869 int vnd,
01870 const sc_digit *vd,
01871 small_type if_u_signed,
01872 small_type if_v_signed);
01873
01874 friend sc_unsigned add_unsigned_friend(small_type us,
01875 int unb,
01876 int und,
01877 const sc_digit *ud,
01878 small_type vs,
01879 int vnb,
01880 int vnd,
01881 const sc_digit *vd);
01882
01883 friend sc_unsigned sub_unsigned_friend(small_type us,
01884 int unb,
01885 int und,
01886 const sc_digit *ud,
01887 small_type vs,
01888 int vnb,
01889 int vnd,
01890 const sc_digit *vd);
01891
01892 friend sc_unsigned mul_unsigned_friend(small_type s,
01893 int unb,
01894 int und,
01895 const sc_digit *ud,
01896 int vnb,
01897 int vnd,
01898 const sc_digit *vd);
01899
01900 friend sc_unsigned div_unsigned_friend(small_type s,
01901 int unb,
01902 int und,
01903 const sc_digit *ud,
01904 int vnb,
01905 int vnd,
01906 const sc_digit *vd);
01907
01908 friend sc_unsigned mod_unsigned_friend(small_type us,
01909 int unb,
01910 int und,
01911 const sc_digit *ud,
01912 int vnb,
01913 int vnd,
01914 const sc_digit *vd);
01915
01916 friend sc_unsigned and_unsigned_friend(small_type us,
01917 int unb,
01918 int und,
01919 const sc_digit *ud,
01920 small_type vs,
01921 int vnb,
01922 int vnd,
01923 const sc_digit *vd);
01924
01925 friend sc_unsigned or_unsigned_friend(small_type us,
01926 int unb,
01927 int und,
01928 const sc_digit *ud,
01929 small_type vs,
01930 int vnb,
01931 int vnd,
01932 const sc_digit *vd);
01933
01934 friend sc_unsigned xor_unsigned_friend(small_type us,
01935 int unb,
01936 int und,
01937 const sc_digit *ud,
01938 small_type vs,
01939 int vnb,
01940 int vnd,
01941 const sc_digit *vd);
01942
01943 public:
01944 static sc_core::sc_vpool<sc_unsigned> m_pool;
01945
01946 private:
01947
01948 small_type sgn;
01949 int nbits;
01950 int ndigits;
01951
01952 #ifdef SC_MAX_NBITS
01953 sc_digit digit[DIV_CEIL(SC_MAX_NBITS)];
01954 #else
01955 sc_digit *digit;
01956 #endif
01957
01958
01959
01960
01961 sc_unsigned(const sc_unsigned& v, small_type s);
01962 sc_unsigned(const sc_signed& v, small_type s);
01963
01964
01965 sc_unsigned(small_type s, int nb, int nd,
01966 sc_digit *d, bool alloc = true);
01967
01968
01969 sc_unsigned(const sc_signed* u, int l, int r);
01970 sc_unsigned(const sc_unsigned* u, int l, int r);
01971
01972
01973
01974 small_type default_sign() const
01975 { return SC_POS; }
01976
01977 int num_bits(int nb) const { return nb + 1; }
01978
01979 bool check_if_outside(int bit_num) const;
01980
01981 void copy_digits(int nb, int nd, const sc_digit *d)
01982 { copy_digits_unsigned(sgn, nbits, ndigits, digit, nb, nd, d); }
01983
01984 void makezero()
01985 { sgn = make_zero(ndigits, digit); }
01986
01987
01988
01989 void convert_2C_to_SM()
01990 { sgn = convert_unsigned_2C_to_SM(nbits, ndigits, digit); }
01991
01992 void convert_SM_to_2C_to_SM()
01993 { sgn = convert_unsigned_SM_to_2C_to_SM(sgn, nbits, ndigits, digit); }
01994
01995 void convert_SM_to_2C()
01996 { convert_unsigned_SM_to_2C(sgn, ndigits, digit); }
01997
01998 };
01999
02000
02001
02002 inline
02003 ::std::ostream&
02004 operator << ( ::std::ostream&, const sc_unsigned& );
02005
02006 inline
02007 ::std::istream&
02008 operator >> ( ::std::istream&, sc_unsigned& );
02009
02010
02011
02012
02013
02014
02015
02016
02017
02018
02019
02020 inline
02021 ::std::ostream&
02022 operator << ( ::std::ostream& os, const sc_unsigned_bitref_r& a )
02023 {
02024 a.print( os );
02025 return os;
02026 }
02027
02028
02029
02030
02031
02032
02033
02034
02035 template<class T>
02036 inline const sc_unsigned_subref& sc_unsigned_subref::operator = (
02037 const sc_generic_base<T>& a )
02038 {
02039 sc_unsigned temp( length() );
02040 a->to_sc_unsigned(temp);
02041 return *this = temp;
02042 }
02043
02044 inline
02045 ::std::istream&
02046 operator >> ( ::std::istream& is, sc_unsigned_bitref& a )
02047 {
02048 a.scan( is );
02049 return is;
02050 }
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060
02061 inline bool sc_unsigned_subref_r::and_reduce() const
02062 {
02063 const sc_unsigned* target_p = m_obj_p;
02064 for ( int i = m_right; i <= m_left; i++ )
02065 if ( !target_p->test(i) ) return false;
02066 return true;
02067 }
02068
02069 inline bool sc_unsigned_subref_r::nand_reduce() const
02070 {
02071 return !and_reduce();
02072 }
02073
02074 inline bool sc_unsigned_subref_r::or_reduce() const
02075 {
02076 const sc_unsigned* target_p = m_obj_p;
02077 for ( int i = m_right; i <= m_left; i++ )
02078 if ( target_p->test(i) ) return true;
02079 return false;
02080 }
02081
02082 inline bool sc_unsigned_subref_r::nor_reduce() const
02083 {
02084 return !or_reduce();
02085 }
02086
02087 inline bool sc_unsigned_subref_r::xor_reduce() const
02088 {
02089 int odd;
02090 const sc_unsigned* target_p = m_obj_p;
02091 odd = 0;
02092 for ( int i = m_right; i <= m_left; i++ )
02093 if ( target_p->test(i) ) odd = ~odd;
02094 return odd ? true : false;
02095 }
02096
02097 inline bool sc_unsigned_subref_r::xnor_reduce() const
02098 {
02099 return !xor_reduce();
02100 }
02101
02102
02103 inline
02104 ::std::ostream&
02105 operator << ( ::std::ostream& os, const sc_unsigned_subref_r& a )
02106 {
02107 a.print( os );
02108 return os;
02109 }
02110
02111
02112
02113
02114
02115
02116
02117
02118
02119
02120 inline
02121 const sc_unsigned_subref&
02122 sc_unsigned_subref::operator = ( const char* a )
02123 {
02124 sc_unsigned aa( length() );
02125 return ( *this = aa = a );
02126 }
02127
02128
02129 inline
02130 ::std::istream&
02131 operator >> ( ::std::istream& is, sc_unsigned_subref& a )
02132 {
02133 a.scan( is );
02134 return is;
02135 }
02136
02137
02138
02139
02140
02141
02142
02143
02144
02145 template<class T>
02146 sc_unsigned::sc_unsigned( const sc_generic_base<T>& v )
02147 {
02148 int nb = v->length();
02149 sgn = default_sign();
02150 if( nb > 0 ) {
02151 nbits = num_bits( nb );
02152 } else {
02153 char msg[BUFSIZ];
02154 std::sprintf( msg,
02155 "sc_unsigned( sc_generic_base<T> ) : nb = %d is not valid", nb);
02156 SC_REPORT_ERROR( sc_core::SC_ID_INIT_FAILED_, msg );
02157 }
02158 ndigits = DIV_CEIL(nbits);
02159 # ifdef SC_MAX_NBITS
02160 test_bound(nb);
02161 # else
02162 digit = new sc_digit[ndigits];
02163 # endif
02164 makezero();
02165 v->to_sc_unsigned(*this);
02166 }
02167
02168
02169 inline
02170 ::std::ostream&
02171 operator << ( ::std::ostream& os, const sc_unsigned& a )
02172 {
02173 a.print( os );
02174 return os;
02175 }
02176
02177 inline
02178 ::std::istream&
02179 operator >> ( ::std::istream& is, sc_unsigned& a )
02180 {
02181 a.scan( is );
02182 return is;
02183 }
02184
02185
02186 }
02187
02188
02189 #endif