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 #ifndef SC_PROXY_H
00060 #define SC_PROXY_H
00061
00062
00063 #include "sysc/kernel/sc_cmnhdr.h"
00064 #include "sysc/utils/sc_iostream.h"
00065 #include "sysc/datatypes/int/sc_signed.h"
00066 #include "sysc/datatypes/int/sc_unsigned.h"
00067 #include "sysc/datatypes/int/sc_int_base.h"
00068 #include "sysc/datatypes/int/sc_uint_base.h"
00069 #include "sysc/datatypes/bit/sc_bit.h"
00070 #include "sysc/datatypes/bit/sc_bit_ids.h"
00071 #include "sysc/datatypes/bit/sc_logic.h"
00072 #include "sysc/kernel/sc_macros.h"
00073
00074
00075 namespace sc_dt
00076 {
00077
00078
00079 template <class X> class sc_proxy;
00080
00081
00082 class sc_bv_base;
00083 class sc_lv_base;
00084 template <class X> class sc_bitref_r;
00085 template <class X> class sc_bitref;
00086 template <class X> class sc_subref_r;
00087 template <class X> class sc_subref;
00088 template <class X, class Y> class sc_concref_r;
00089 template <class X, class Y> class sc_concref;
00090
00091
00092 const int SC_DIGIT_SIZE = BITS_PER_BYTE * sizeof( sc_digit );
00093
00094 const sc_digit SC_DIGIT_ZERO = (sc_digit)0;
00095 const sc_digit SC_DIGIT_ONE = (sc_digit)1;
00096 const sc_digit SC_DIGIT_TWO = (sc_digit)2;
00097
00098
00099
00100
00101 template <class X, class Y>
00102 inline
00103 void
00104 assign_p_( sc_proxy<X>& px, const sc_proxy<Y>& py );
00105
00106
00107
00108
00109 template <class X, class T>
00110 inline
00111 void
00112 assign_v_( sc_proxy<X>& px, const T& a );
00113
00114
00115
00116
00117 const std::string convert_to_bin( const char* s );
00118 const std::string convert_to_fmt( const std::string& s, sc_numrep numrep, bool );
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 template<typename X> struct sc_proxy_traits;
00131
00132 template<> struct sc_proxy_traits<sc_bv_base>
00133 {
00134 typedef sc_proxy_traits<sc_bv_base> traits_type;
00135 typedef bool value_type;
00136 typedef bool bit_type;
00137 typedef sc_bv_base vector_type;
00138 typedef traits_type type;
00139 };
00140
00141 template<> struct sc_proxy_traits<sc_lv_base>
00142 {
00143 typedef sc_proxy_traits<sc_lv_base> traits_type;
00144 typedef sc_logic_value_t value_type;
00145 typedef sc_logic bit_type;
00146 typedef sc_lv_base vector_type;
00147 typedef traits_type type;
00148 };
00149
00150
00151 template<typename X> struct sc_proxy_traits<sc_bitref_r<X> >
00152 : sc_proxy_traits<X> {};
00153
00154 template<typename X> struct sc_proxy_traits<sc_bitref<X> >
00155 : sc_proxy_traits<X> {};
00156
00157
00158 template<typename X> struct sc_proxy_traits<sc_subref_r<X> >
00159 : sc_proxy_traits<X> {};
00160
00161 template<typename X> struct sc_proxy_traits<sc_subref<X> >
00162 : sc_proxy_traits<X> {};
00163
00164
00165 template<typename X> struct sc_proxy_traits<sc_proxy<X> >
00166 : sc_proxy_traits<X> {};
00167
00168
00169 template< typename X, typename Y > struct sc_mixed_proxy_traits_helper
00170 : sc_proxy_traits<sc_lv_base> {};
00171
00172 template<typename X> struct sc_mixed_proxy_traits_helper<X,X>
00173 : X {};
00174
00175
00176 template<typename X, typename Y> struct sc_proxy_traits< sc_concref_r<X,Y> >
00177 : sc_mixed_proxy_traits_helper< typename X::traits_type::type
00178 , typename Y::traits_type::type >
00179 {};
00180
00181 template<typename X, typename Y> struct sc_proxy_traits<sc_concref<X,Y> >
00182 : sc_mixed_proxy_traits_helper< typename X::traits_type::type
00183 , typename Y::traits_type::type >
00184 {};
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 template <class X>
00195 class sc_proxy
00196 {
00197 public:
00198 typedef typename sc_proxy_traits<X>::type traits_type;
00199 typedef typename traits_type::bit_type bit_type;
00200
00201
00202
00203 virtual ~sc_proxy() {}
00204
00205
00206
00207
00208 X& back_cast()
00209 { return SCAST<X&>( *this ); }
00210
00211 const X& back_cast() const
00212 { return SCAST<const X&>( *this ); }
00213
00214
00215
00216
00217 template <class Y>
00218 X& assign_( const sc_proxy<Y>& a )
00219 { assign_p_( *this, a ); return back_cast(); }
00220
00221 X& assign_( const char* a );
00222 X& assign_( const bool* a );
00223 X& assign_( const sc_logic* a );
00224
00225 X& assign_( const sc_unsigned& a )
00226 { assign_v_( *this, a ); return back_cast(); }
00227
00228 X& assign_( const sc_signed& a )
00229 { assign_v_( *this, a ); return back_cast(); }
00230
00231 X& assign_( const sc_uint_base& a )
00232 { return assign_( (uint64) a ); }
00233
00234 X& assign_( const sc_int_base& a )
00235 { return assign_( (int64) a ); }
00236
00237 X& assign_( unsigned int a );
00238 X& assign_( int a );
00239
00240 X& assign_( unsigned long a );
00241
00242 X& assign_( long a );
00243
00244 X& assign_( uint64 a );
00245 X& assign_( int64 a );
00246
00247
00248
00249
00250
00251
00252 X& b_not();
00253
00254 const sc_lv_base operator ~ () const;
00255
00256
00257
00258
00259 X& operator &= ( const char* b );
00260 X& operator &= ( const bool* b );
00261 X& operator &= ( const sc_logic* b );
00262 X& operator &= ( const sc_unsigned& b );
00263 X& operator &= ( const sc_signed& b );
00264
00265 X& operator &= ( const sc_uint_base& b )
00266 { return operator &= ( (uint64) b ); }
00267
00268 X& operator &= ( const sc_int_base& b )
00269 { return operator &= ( (int64) b ); }
00270
00271 X& operator &= ( unsigned long b );
00272 X& operator &= ( long b );
00273
00274 X& operator &= ( unsigned int b )
00275 { return operator &= ( (unsigned long) b ); }
00276
00277 X& operator &= ( int b )
00278 { return operator &= ( (long) b ); }
00279
00280 X& operator &= ( uint64 b );
00281 X& operator &= ( int64 b );
00282
00283
00284 const sc_lv_base operator & ( const char* b ) const;
00285 const sc_lv_base operator & ( const bool* b ) const;
00286 const sc_lv_base operator & ( const sc_logic* b ) const;
00287 const sc_lv_base operator & ( const sc_unsigned& b ) const;
00288 const sc_lv_base operator & ( const sc_signed& b ) const;
00289 const sc_lv_base operator & ( const sc_uint_base& b ) const;
00290 const sc_lv_base operator & ( const sc_int_base& b ) const;
00291 const sc_lv_base operator & ( unsigned long b ) const;
00292 const sc_lv_base operator & ( long b ) const;
00293 const sc_lv_base operator & ( unsigned int b ) const;
00294 const sc_lv_base operator & ( int b ) const;
00295 const sc_lv_base operator & ( uint64 b ) const;
00296 const sc_lv_base operator & ( int64 b ) const;
00297
00298
00299
00300
00301 X& operator |= ( const char* b );
00302 X& operator |= ( const bool* b );
00303 X& operator |= ( const sc_logic* b );
00304 X& operator |= ( const sc_unsigned& b );
00305 X& operator |= ( const sc_signed& b );
00306
00307 X& operator |= ( const sc_uint_base& b )
00308 { return operator |= ( (uint64) b ); }
00309
00310 X& operator |= ( const sc_int_base& b )
00311 { return operator |= ( (int64) b ); }
00312
00313 X& operator |= ( unsigned long b );
00314 X& operator |= ( long b );
00315
00316 X& operator |= ( unsigned int b )
00317 { return operator |= ( (unsigned long) b ); }
00318
00319 X& operator |= ( int b )
00320 { return operator |= ( (long) b ); }
00321
00322 X& operator |= ( uint64 b );
00323 X& operator |= ( int64 b );
00324
00325
00326 const sc_lv_base operator | ( const char* b ) const;
00327 const sc_lv_base operator | ( const bool* b ) const;
00328 const sc_lv_base operator | ( const sc_logic* b ) const;
00329 const sc_lv_base operator | ( const sc_unsigned& b ) const;
00330 const sc_lv_base operator | ( const sc_signed& b ) const;
00331 const sc_lv_base operator | ( const sc_uint_base& b ) const;
00332 const sc_lv_base operator | ( const sc_int_base& b ) const;
00333 const sc_lv_base operator | ( unsigned long b ) const;
00334 const sc_lv_base operator | ( long b ) const;
00335 const sc_lv_base operator | ( unsigned int b ) const;
00336 const sc_lv_base operator | ( int b ) const;
00337 const sc_lv_base operator | ( uint64 b ) const;
00338 const sc_lv_base operator | ( int64 b ) const;
00339
00340
00341
00342
00343 X& operator ^= ( const char* b );
00344 X& operator ^= ( const bool* b );
00345 X& operator ^= ( const sc_logic* b );
00346 X& operator ^= ( const sc_unsigned& b );
00347 X& operator ^= ( const sc_signed& b );
00348
00349 X& operator ^= ( const sc_uint_base& b )
00350 { return operator ^= ( (uint64) b ); }
00351
00352 X& operator ^= ( const sc_int_base& b )
00353 { return operator ^= ( (int64) b ); }
00354
00355 X& operator ^= ( unsigned long b );
00356 X& operator ^= ( long b );
00357
00358 X& operator ^= ( unsigned int b )
00359 { return operator ^= ( (unsigned long) b ); }
00360
00361 X& operator ^= ( int b )
00362 { return operator ^= ( (long) b ); }
00363
00364 X& operator ^= ( uint64 b );
00365 X& operator ^= ( int64 b );
00366
00367
00368 const sc_lv_base operator ^ ( const char* b ) const;
00369 const sc_lv_base operator ^ ( const bool* b ) const;
00370 const sc_lv_base operator ^ ( const sc_logic* b ) const;
00371 const sc_lv_base operator ^ ( const sc_unsigned& b ) const;
00372 const sc_lv_base operator ^ ( const sc_signed& b ) const;
00373 const sc_lv_base operator ^ ( const sc_uint_base& b ) const;
00374 const sc_lv_base operator ^ ( const sc_int_base& b ) const;
00375 const sc_lv_base operator ^ ( unsigned long b ) const;
00376 const sc_lv_base operator ^ ( long b ) const;
00377 const sc_lv_base operator ^ ( unsigned int b ) const;
00378 const sc_lv_base operator ^ ( int b ) const;
00379 const sc_lv_base operator ^ ( uint64 b ) const;
00380 const sc_lv_base operator ^ ( int64 b ) const;
00381
00382
00383
00384
00385 X& operator <<= ( int n );
00386
00387 const sc_lv_base operator << ( int n ) const;
00388
00389
00390
00391
00392 X& operator >>= ( int n );
00393
00394 const sc_lv_base operator >> ( int n ) const;
00395
00396
00397
00398
00399 X& lrotate( int n );
00400
00401
00402
00403
00404 X& rrotate( int n );
00405
00406
00407
00408
00409 X& reverse();
00410
00411
00412
00413
00414 sc_bitref<X> operator [] ( int i )
00415 { return sc_bitref<X>( back_cast(), i ); }
00416
00417 sc_bitref_r<X> operator [] ( int i ) const
00418 { return sc_bitref_r<X>( back_cast(), i ); }
00419
00420 sc_bitref<X> bit( int i )
00421 { return sc_bitref<X>( back_cast(), i ); }
00422
00423 sc_bitref_r<X> bit( int i ) const
00424 { return sc_bitref_r<X>( back_cast(), i ); }
00425
00426
00427
00428
00429 sc_subref<X> operator () ( int hi, int lo )
00430 { return sc_subref<X>( back_cast(), hi, lo ); }
00431
00432 sc_subref_r<X> operator () ( int hi, int lo ) const
00433 { return sc_subref_r<X>( back_cast(), hi, lo ); }
00434
00435 sc_subref<X> range( int hi, int lo )
00436 { return sc_subref<X>( back_cast(), hi, lo ); }
00437
00438 sc_subref_r<X> range( int hi, int lo ) const
00439 { return sc_subref_r<X>( back_cast(), hi, lo ); }
00440
00441
00442
00443
00444 sc_logic_value_t and_reduce() const;
00445
00446 sc_logic_value_t nand_reduce() const
00447 { return sc_logic::not_table[and_reduce()]; }
00448
00449 sc_logic_value_t or_reduce() const;
00450
00451 sc_logic_value_t nor_reduce() const
00452 { return sc_logic::not_table[or_reduce()]; }
00453
00454 sc_logic_value_t xor_reduce() const;
00455
00456 sc_logic_value_t xnor_reduce() const
00457 { return sc_logic::not_table[xor_reduce()]; }
00458
00459
00460
00461
00462 bool operator == ( const char* b ) const;
00463 bool operator == ( const bool* b ) const;
00464 bool operator == ( const sc_logic* b ) const;
00465 bool operator == ( const sc_unsigned& b ) const;
00466 bool operator == ( const sc_signed& b ) const;
00467 bool operator == ( const sc_uint_base& b ) const;
00468 bool operator == ( const sc_int_base& b ) const;
00469 bool operator == ( unsigned long b ) const;
00470 bool operator == ( long b ) const;
00471 bool operator == ( unsigned int b ) const;
00472 bool operator == ( int b ) const;
00473 bool operator == ( uint64 b ) const;
00474 bool operator == ( int64 b ) const;
00475
00476
00477
00478
00479 const std::string to_string() const;
00480 const std::string to_string( sc_numrep ) const;
00481 const std::string to_string( sc_numrep, bool ) const;
00482
00483
00484
00485
00486 inline int64 to_int64() const
00487 { return to_anything_signed(); }
00488 inline uint64 to_uint64() const;
00489 int to_int() const
00490 { return (int)to_anything_signed(); }
00491
00492 unsigned int to_uint() const
00493 { return (unsigned int)to_anything_unsigned(); }
00494
00495 long to_long() const
00496 { return (long)to_anything_signed(); }
00497
00498 unsigned long to_ulong() const
00499 { return (unsigned long)to_anything_unsigned(); }
00500
00501 #ifdef SC_DT_DEPRECATED
00502
00503 int to_signed() const
00504 { return to_int(); }
00505
00506 sc_digit to_unsigned() const
00507 { return to_uint(); }
00508
00509 #endif
00510
00511
00512
00513
00514 void print( ::std::ostream& os = ::std::cout ) const
00515 {
00516
00517
00518 if ( sc_io_base(os, SC_DEC) == SC_DEC )
00519 os << to_string();
00520 else
00521 os << to_string(sc_io_base(os,SC_BIN),sc_io_show_base(os));
00522 }
00523
00524 void scan( ::std::istream& is = ::std::cin );
00525
00526 protected:
00527
00528 void check_bounds( int n ) const;
00529 void check_wbounds( int n ) const;
00530
00531 sc_digit to_anything_unsigned() const;
00532 int64 to_anything_signed() const;
00533 };
00534
00535
00536
00537
00538
00539
00540
00541
00542 template <class X, class Y>
00543 inline
00544 X&
00545 operator &= ( sc_proxy<X>& px, const sc_proxy<Y>& py );
00546
00547
00548 template <class X, class Y>
00549 inline
00550 const sc_lv_base
00551 operator & ( const sc_proxy<X>& px, const sc_proxy<Y>& py );
00552
00553
00554 #define DECL_BITWISE_AND_OP_T(tp) \
00555 template <class X> \
00556 inline \
00557 const sc_lv_base \
00558 operator & ( tp b, const sc_proxy<X>& px );
00559
00560 DECL_BITWISE_AND_OP_T(const char*)
00561 DECL_BITWISE_AND_OP_T(const bool*)
00562 DECL_BITWISE_AND_OP_T(const sc_logic*)
00563 DECL_BITWISE_AND_OP_T(const sc_unsigned&)
00564 DECL_BITWISE_AND_OP_T(const sc_signed&)
00565 DECL_BITWISE_AND_OP_T(const sc_uint_base&)
00566 DECL_BITWISE_AND_OP_T(const sc_int_base&)
00567 DECL_BITWISE_AND_OP_T(unsigned long)
00568 DECL_BITWISE_AND_OP_T(long)
00569 DECL_BITWISE_AND_OP_T(unsigned int)
00570 DECL_BITWISE_AND_OP_T(int)
00571 DECL_BITWISE_AND_OP_T(uint64)
00572 DECL_BITWISE_AND_OP_T(int64)
00573
00574 #undef DECL_BITWISE_AND_OP_T
00575
00576
00577
00578
00579 template <class X, class Y>
00580 inline
00581 X&
00582 operator |= ( sc_proxy<X>& px, const sc_proxy<Y>& py );
00583
00584
00585 template <class X, class Y>
00586 inline
00587 const sc_lv_base
00588 operator | ( const sc_proxy<X>& px, const sc_proxy<Y>& py );
00589
00590
00591 #define DECL_BITWISE_OR_OP_T(tp) \
00592 template <class X> \
00593 inline \
00594 const sc_lv_base \
00595 operator | ( tp a, const sc_proxy<X>& px );
00596
00597 DECL_BITWISE_OR_OP_T(const char*)
00598 DECL_BITWISE_OR_OP_T(const bool*)
00599 DECL_BITWISE_OR_OP_T(const sc_logic*)
00600 DECL_BITWISE_OR_OP_T(const sc_unsigned&)
00601 DECL_BITWISE_OR_OP_T(const sc_signed&)
00602 DECL_BITWISE_OR_OP_T(const sc_uint_base&)
00603 DECL_BITWISE_OR_OP_T(const sc_int_base&)
00604 DECL_BITWISE_OR_OP_T(unsigned long)
00605 DECL_BITWISE_OR_OP_T(long)
00606 DECL_BITWISE_OR_OP_T(unsigned int)
00607 DECL_BITWISE_OR_OP_T(int)
00608 DECL_BITWISE_OR_OP_T(uint64)
00609 DECL_BITWISE_OR_OP_T(int64)
00610
00611 #undef DECL_BITWISE_OR_OP_T
00612
00613
00614
00615
00616 template <class X, class Y>
00617 inline
00618 X&
00619 operator ^= ( sc_proxy<X>& px, const sc_proxy<Y>& py );
00620
00621
00622 template <class X, class Y>
00623 inline
00624 const sc_lv_base
00625 operator ^ ( const sc_proxy<X>& px, const sc_proxy<Y>& py );
00626
00627
00628 #define DECL_BITWISE_XOR_OP_T(tp) \
00629 template <class X> \
00630 inline \
00631 const sc_lv_base \
00632 operator ^ ( tp a, const sc_proxy<X>& px );
00633
00634 DECL_BITWISE_XOR_OP_T(const char*)
00635 DECL_BITWISE_XOR_OP_T(const bool*)
00636 DECL_BITWISE_XOR_OP_T(const sc_logic*)
00637 DECL_BITWISE_XOR_OP_T(const sc_unsigned&)
00638 DECL_BITWISE_XOR_OP_T(const sc_signed&)
00639 DECL_BITWISE_XOR_OP_T(const sc_uint_base&)
00640 DECL_BITWISE_XOR_OP_T(const sc_int_base&)
00641 DECL_BITWISE_XOR_OP_T(unsigned long)
00642 DECL_BITWISE_XOR_OP_T(long)
00643 DECL_BITWISE_XOR_OP_T(unsigned int)
00644 DECL_BITWISE_XOR_OP_T(int)
00645 DECL_BITWISE_XOR_OP_T(uint64)
00646 DECL_BITWISE_XOR_OP_T(int64)
00647
00648 #undef DECL_BITWISE_XOR_OP_T
00649
00650
00651
00652
00653 template <class X, class Y>
00654 inline
00655 bool
00656 operator == ( const sc_proxy<X>& px, const sc_proxy<Y>& py );
00657
00658 template <class X, class Y>
00659 inline
00660 bool
00661 operator != ( const sc_proxy<X>& px, const sc_proxy<Y>& py );
00662
00663
00664 #define DECL_REL_OP_T(tp) \
00665 template <class X> \
00666 inline \
00667 bool \
00668 operator == ( tp b, const sc_proxy<X>& px ); \
00669 \
00670 template <class X> \
00671 inline \
00672 bool \
00673 operator != ( const sc_proxy<X>& px, tp b ); \
00674 \
00675 template <class X> \
00676 inline \
00677 bool \
00678 operator != ( tp b, const sc_proxy<X>& px );
00679
00680 DECL_REL_OP_T(const char*)
00681 DECL_REL_OP_T(const bool*)
00682 DECL_REL_OP_T(const sc_logic*)
00683 DECL_REL_OP_T(const sc_unsigned&)
00684 DECL_REL_OP_T(const sc_signed&)
00685 DECL_REL_OP_T(const sc_uint_base&)
00686 DECL_REL_OP_T(const sc_int_base&)
00687 DECL_REL_OP_T(unsigned long)
00688 DECL_REL_OP_T(long)
00689 DECL_REL_OP_T(unsigned int)
00690 DECL_REL_OP_T(int)
00691 DECL_REL_OP_T(uint64)
00692 DECL_REL_OP_T(int64)
00693
00694 #undef DECL_REL_OP_T
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706 template <class X>
00707 inline
00708 void
00709 get_words_( const X& x, int wi, sc_digit& x_dw, sc_digit& x_cw )
00710 {
00711 x_dw = x.get_word( wi );
00712 x_cw = x.get_cword( wi );
00713 }
00714
00715 template <class X>
00716 inline
00717 void
00718 set_words_( X& x, int wi, sc_digit x_dw, sc_digit x_cw )
00719 {
00720 x.set_word( wi, x_dw );
00721 x.set_cword( wi, x_cw );
00722 }
00723
00724 template <class X>
00725 inline
00726 void
00727 extend_sign_w_( X& x, int wi, bool sign )
00728 {
00729 int sz = x.size();
00730 unsigned int sgn = (sign ? ~SC_DIGIT_ZERO : SC_DIGIT_ZERO);
00731 for( int i = wi; i < sz; ++ i ) {
00732 set_words_( x, i, sgn, SC_DIGIT_ZERO );
00733 }
00734 }
00735
00736
00737
00738
00739 template <class X, class Y>
00740 inline
00741 void
00742 assign_p_( sc_proxy<X>& px, const sc_proxy<Y>& py )
00743 {
00744 if( (void*) &px != (void*) &py ) {
00745 X& x = px.back_cast();
00746 const Y& y = py.back_cast();
00747 int sz = x.size();
00748 int min_sz = sc_min( sz, y.size() );
00749 int i = 0;
00750 for( ; i < min_sz; ++ i ) {
00751 set_words_( x, i, y.get_word( i ), y.get_cword( i ) );
00752 }
00753
00754 extend_sign_w_( x, i, false );
00755 x.clean_tail();
00756 }
00757 }
00758
00759
00760
00761
00762
00763
00764
00765 template <class X, class T>
00766 inline
00767 void
00768 assign_v_( sc_proxy<X>& px, const T& a )
00769 {
00770 X& x = px.back_cast();
00771 int i;
00772 int len_x = x.length();
00773 int len_a = a.length();
00774 if ( len_a > len_x ) len_a = len_x;
00775 for( i = 0 ; i < len_a; ++ i ) {
00776 x.set_bit( i, sc_logic_value_t( (bool) a[i] ) );
00777 }
00778 for( ; i < len_x; ++ i ) {
00779 x.set_bit( i, sc_logic_value_t( false ) );
00780 }
00781 }
00782
00783 template <class X>
00784 inline
00785 void
00786 assign_v_( sc_proxy<X>& px, const sc_int_base& a )
00787 {
00788 X& x = px.back_cast();
00789 int i;
00790 bool sign = a < 0;
00791 int len_x = x.length();
00792 int len_a = a.length();
00793 if ( len_a > len_x ) len_a = len_x;
00794 for( i = 0 ; i < len_a; ++ i ) {
00795 x.set_bit( i, sc_logic_value_t( (bool) a[i] ) );
00796 }
00797 for( ; i < len_x; ++ i ) {
00798 x.set_bit( i, sc_logic_value_t( sign ) );
00799 }
00800 }
00801
00802 template <class X>
00803 inline
00804 void
00805 assign_v_( sc_proxy<X>& px, const sc_signed& a )
00806 {
00807 X& x = px.back_cast();
00808 int i;
00809 bool sign = a < 0;
00810 int len_x = x.length();
00811 int len_a = a.length();
00812 if ( len_a > len_x ) len_a = len_x;
00813 for( i = 0 ; i < len_a; ++ i ) {
00814 x.set_bit( i, sc_logic_value_t( (bool) a[i] ) );
00815 }
00816 for( ; i < len_x; ++ i ) {
00817 x.set_bit( i, sc_logic_value_t( sign ) );
00818 }
00819 }
00820
00821 template <class X>
00822 inline
00823 void
00824 assign_v_( sc_proxy<X>& px, const sc_uint_base& a )
00825 {
00826 X& x = px.back_cast();
00827 int i;
00828 int len_x = x.length();
00829 int len_a = a.length();
00830 if ( len_a > len_x ) len_a = len_x;
00831 for( i = 0 ; i < len_a; ++ i ) {
00832 x.set_bit( i, sc_logic_value_t( (bool) a[i] ) );
00833 }
00834 for( ; i < len_x; ++ i ) {
00835 x.set_bit( i, sc_logic_value_t( false ) );
00836 }
00837 }
00838
00839 template <class X>
00840 inline
00841 void
00842 assign_v_( sc_proxy<X>& px, const sc_unsigned& a )
00843 {
00844 X& x = px.back_cast();
00845 int i;
00846 int len_x = x.length();
00847 int len_a = a.length();
00848 if ( len_a > len_x ) len_a = len_x;
00849 for( i = 0 ; i < len_a; ++ i ) {
00850 x.set_bit( i, sc_logic_value_t( (bool) a[i] ) );
00851 }
00852 for( ; i < len_x; ++ i ) {
00853 x.set_bit( i, sc_logic_value_t( false ) );
00854 }
00855 }
00856
00857
00858
00859
00860 template <class X>
00861 inline
00862 X&
00863 sc_proxy<X>::assign_( const char* a )
00864 {
00865 X& x = back_cast();
00866 std::string s = convert_to_bin( a );
00867 int len = x.length();
00868 int s_len = s.length() - 1;
00869 int min_len = sc_min( len, s_len );
00870 int i = 0;
00871 for( ; i < min_len; ++ i ) {
00872 char c = s[s_len - i - 1];
00873 x.set_bit( i, sc_logic::char_to_logic[(int)c] );
00874 }
00875
00876 sc_logic_value_t fill = (s[s_len] == 'F' ? sc_logic_value_t( s[0] - '0' )
00877 : sc_logic_value_t( 0 ));
00878 for( ; i < len; ++ i ) {
00879 x.set_bit( i, fill );
00880 }
00881 return x;
00882 }
00883
00884 template <class X>
00885 inline
00886 X&
00887 sc_proxy<X>::assign_( const bool* a )
00888 {
00889
00890 X& x = back_cast();
00891 int len = x.length();
00892 for( int i = 0; i < len; ++ i ) {
00893 x.set_bit( i, sc_logic_value_t( a[i] ) );
00894 }
00895 return x;
00896 }
00897
00898 template <class X>
00899 inline
00900 X&
00901 sc_proxy<X>::assign_( const sc_logic* a )
00902 {
00903
00904 X& x = back_cast();
00905 int len = x.length();
00906 for( int i = 0; i < len; ++ i ) {
00907 x.set_bit( i, a[i].value() );
00908 }
00909 return x;
00910 }
00911
00912 template <class X>
00913 inline
00914 X&
00915 sc_proxy<X>::assign_( unsigned int a )
00916 {
00917 X& x = back_cast();
00918 set_words_( x, 0, (sc_digit)a, SC_DIGIT_ZERO );
00919
00920 extend_sign_w_( x, 1, false );
00921 x.clean_tail();
00922 return x;
00923 }
00924
00925 template <class X>
00926 inline
00927 X&
00928 sc_proxy<X>::assign_( int a )
00929 {
00930 X& x = back_cast();
00931 set_words_( x, 0, (sc_digit) a, SC_DIGIT_ZERO );
00932
00933 extend_sign_w_( x, 1, (a < 0) );
00934 x.clean_tail();
00935 return x;
00936 }
00937
00938 #if defined(SC_LONG_64)
00939 template <class X>
00940 inline
00941 X&
00942 sc_proxy<X>::assign_( unsigned long a )
00943 {
00944 X& x = back_cast();
00945 set_words_( x, 0, ((sc_digit) a & ~SC_DIGIT_ZERO), SC_DIGIT_ZERO );
00946 if( x.size() > 1 ) {
00947 set_words_( x, 1,
00948 ((sc_digit) (a >> SC_DIGIT_SIZE) & ~SC_DIGIT_ZERO),
00949 SC_DIGIT_ZERO );
00950
00951 extend_sign_w_( x, 2, false );
00952 }
00953 x.clean_tail();
00954 return x;
00955 }
00956
00957 template <class X>
00958 inline
00959 X&
00960 sc_proxy<X>::assign_( long a )
00961 {
00962 X& x = back_cast();
00963 set_words_( x, 0, ((sc_digit) a & ~SC_DIGIT_ZERO), SC_DIGIT_ZERO );
00964 if( x.size() > 1 ) {
00965 set_words_( x, 1,
00966 ((sc_digit) ((uint64) a >> SC_DIGIT_SIZE) & ~SC_DIGIT_ZERO),
00967 SC_DIGIT_ZERO );
00968
00969 extend_sign_w_( x, 2, (a < 0) );
00970 }
00971 x.clean_tail();
00972 return x;
00973 }
00974
00975 #else
00976 template <class X>
00977 inline
00978 X&
00979 sc_proxy<X>::assign_( unsigned long a )
00980 {
00981 X& x = back_cast();
00982 set_words_( x, 0, (sc_digit)a, SC_DIGIT_ZERO );
00983
00984 extend_sign_w_( x, 1, false );
00985 x.clean_tail();
00986 return x;
00987 }
00988
00989 template <class X>
00990 inline
00991 X&
00992 sc_proxy<X>::assign_( long a )
00993 {
00994 X& x = back_cast();
00995 set_words_( x, 0, (sc_digit) a, SC_DIGIT_ZERO );
00996
00997 extend_sign_w_( x, 1, (a < 0) );
00998 x.clean_tail();
00999 return x;
01000 }
01001 #endif
01002 template <class X>
01003 inline
01004 X&
01005 sc_proxy<X>::assign_( uint64 a )
01006 {
01007 X& x = back_cast();
01008 set_words_( x, 0, ((sc_digit) a & ~SC_DIGIT_ZERO), SC_DIGIT_ZERO );
01009 if( x.size() > 1 ) {
01010 set_words_( x, 1,
01011 ((sc_digit) (a >> SC_DIGIT_SIZE) & ~SC_DIGIT_ZERO),
01012 SC_DIGIT_ZERO );
01013
01014 extend_sign_w_( x, 2, false );
01015 }
01016 x.clean_tail();
01017 return x;
01018 }
01019
01020 template <class X>
01021 inline
01022 X&
01023 sc_proxy<X>::assign_( int64 a )
01024 {
01025 X& x = back_cast();
01026 set_words_( x, 0, ((sc_digit) a & ~SC_DIGIT_ZERO), SC_DIGIT_ZERO );
01027 if( x.size() > 1 ) {
01028 set_words_( x, 1,
01029 ((sc_digit) ((uint64) a >> SC_DIGIT_SIZE) & ~SC_DIGIT_ZERO),
01030 SC_DIGIT_ZERO );
01031
01032 extend_sign_w_( x, 2, (a < 0) );
01033 }
01034 x.clean_tail();
01035 return x;
01036 }
01037
01038
01039
01040
01041
01042
01043 template <class X>
01044 inline
01045 X&
01046 sc_proxy<X>::b_not()
01047 {
01048 X& x = back_cast();
01049 int sz = x.size();
01050 for( int i = 0; i < sz; ++ i ) {
01051 sc_digit x_dw, x_cw;
01052 get_words_( x, i, x_dw, x_cw );
01053 x.set_word( i, x_cw | ~x_dw );
01054 }
01055 x.clean_tail();
01056 return x;
01057 }
01058
01059
01060
01061
01062 template <class X, class Y>
01063 inline
01064 X&
01065 b_and_assign_( sc_proxy<X>& px, const sc_proxy<Y>& py )
01066 {
01067 X& x = px.back_cast();
01068 const Y& y = py.back_cast();
01069 assert( x.length() == y.length() );
01070 int sz = x.size();
01071 for( int i = 0; i < sz; ++ i ) {
01072 sc_digit x_dw, x_cw, y_dw, y_cw;
01073 get_words_( x, i, x_dw, x_cw );
01074 get_words_( y, i, y_dw, y_cw );
01075 sc_digit cw = (x_dw & y_cw) | (x_cw & y_dw) | (x_cw & y_cw);
01076 sc_digit dw = cw | (x_dw & y_dw);
01077 set_words_( x, i, dw, cw );
01078 }
01079
01080 return x;
01081 }
01082
01083
01084
01085
01086 template <class X, class Y>
01087 inline
01088 X&
01089 b_or_assign_( sc_proxy<X>& px, const sc_proxy<Y>& py )
01090 {
01091 X& x = px.back_cast();
01092 const Y& y = py.back_cast();
01093 assert( x.length() == y.length() );
01094 int sz = x.size();
01095 for( int i = 0; i < sz; ++ i ) {
01096 sc_digit x_dw, x_cw, y_dw, y_cw;
01097 get_words_( x, i, x_dw, x_cw );
01098 get_words_( y, i, y_dw, y_cw );
01099 sc_digit cw = (x_cw & y_cw) | (x_cw & ~y_dw) | (~x_dw & y_cw);
01100 sc_digit dw = cw | x_dw | y_dw;
01101 set_words_( x, i, dw, cw );
01102 }
01103
01104 return x;
01105 }
01106
01107
01108
01109
01110 template <class X, class Y>
01111 inline
01112 X&
01113 b_xor_assign_( sc_proxy<X>& a, const sc_proxy<Y>& b )
01114 {
01115 X& x = a.back_cast();
01116 const Y& y = b.back_cast();
01117 assert( x.length() == y.length() );
01118 int sz = x.size();
01119 for( int i = 0; i < sz; ++ i ) {
01120 sc_digit x_dw, x_cw, y_dw, y_cw;
01121 get_words_( x, i, x_dw, x_cw );
01122 get_words_( y, i, y_dw, y_cw );
01123 sc_digit cw = x_cw | y_cw;
01124 sc_digit dw = cw | (x_dw ^ y_dw);
01125 set_words_( x, i, dw, cw );
01126 }
01127
01128 return x;
01129 }
01130
01131
01132
01133
01134 template <class X>
01135 inline
01136 X&
01137 sc_proxy<X>::operator <<= ( int n )
01138 {
01139 X& x = back_cast();
01140 if( n < 0 ) {
01141 char msg[BUFSIZ];
01142 std::sprintf( msg,
01143 "left shift operation is only allowed with positive "
01144 "shift values, shift value = %d", n );
01145 SC_REPORT_ERROR( sc_core::SC_ID_OUT_OF_BOUNDS_, msg );
01146 }
01147 if( n >= x.length() ) {
01148 extend_sign_w_( x, 0, false );
01149
01150 return x;
01151 }
01152 int sz = x.size();
01153 int wn = n / SC_DIGIT_SIZE;
01154 int bn = n % SC_DIGIT_SIZE;
01155 if( wn != 0 ) {
01156
01157 int i = sz - 1;
01158 for( ; i >= wn; -- i ) {
01159 set_words_( x, i, x.get_word( i - wn ), x.get_cword( i - wn ) );
01160 }
01161 for( ; i >= 0; -- i ) {
01162 set_words_( x, i, SC_DIGIT_ZERO, SC_DIGIT_ZERO );
01163 }
01164 }
01165 if( bn != 0 ) {
01166
01167 for( int i = sz - 1; i >= 1; -- i ) {
01168 sc_digit x_dw, x_cw;
01169 get_words_( x, i, x_dw, x_cw );
01170 x_dw <<= bn;
01171 x_dw |= x.get_word( i - 1 ) >> (SC_DIGIT_SIZE - bn);
01172 x_cw <<= bn;
01173 x_cw |= x.get_cword( i - 1 ) >> (SC_DIGIT_SIZE - bn);
01174 set_words_( x, i, x_dw, x_cw );
01175 }
01176 sc_digit x_dw, x_cw;
01177 get_words_( x, 0, x_dw, x_cw );
01178 x_dw <<= bn;
01179 x_cw <<= bn;
01180 set_words_( x, 0, x_dw, x_cw );
01181 }
01182 x.clean_tail();
01183 return x;
01184 }
01185
01186
01187
01188
01189
01190 template <class X>
01191 inline
01192 X&
01193 sc_proxy<X>::operator >>= ( int n )
01194 {
01195 X& x = back_cast();
01196 if( n < 0 ) {
01197 char msg[BUFSIZ];
01198 std::sprintf( msg,
01199 "right shift operation is only allowed with positive "
01200 "shift values, shift value = %d", n );
01201 SC_REPORT_ERROR( sc_core::SC_ID_OUT_OF_BOUNDS_, msg );
01202 }
01203 if( n >= x.length() ) {
01204 extend_sign_w_( x, 0, false );
01205
01206 return x;
01207 }
01208 int sz = x.size();
01209 int wn = n / SC_DIGIT_SIZE;
01210 int bn = n % SC_DIGIT_SIZE;
01211 if( wn != 0 ) {
01212
01213 int i = 0;
01214 for( ; i < (sz - wn); ++ i ) {
01215 set_words_( x, i, x.get_word( i + wn ), x.get_cword( i + wn ) );
01216 }
01217 for( ; i < sz; ++ i ) {
01218 set_words_( x, i, SC_DIGIT_ZERO, SC_DIGIT_ZERO );
01219 }
01220 }
01221 if( bn != 0 ) {
01222
01223 for( int i = 0; i < (sz - 1); ++ i ) {
01224 sc_digit x_dw, x_cw;
01225 get_words_( x, i, x_dw, x_cw );
01226 x_dw >>= bn;
01227 x_dw |= x.get_word( i + 1 ) << (SC_DIGIT_SIZE - bn);
01228 x_cw >>= bn;
01229 x_cw |= x.get_cword( i + 1 ) << (SC_DIGIT_SIZE - bn);
01230 set_words_( x, i, x_dw, x_cw );
01231 }
01232 sc_digit x_dw, x_cw;
01233 get_words_( x, sz - 1, x_dw, x_cw );
01234 x_dw >>= bn;
01235 x_cw >>= bn;
01236 set_words_( x, sz - 1, x_dw, x_cw );
01237 }
01238 x.clean_tail();
01239 return x;
01240 }
01241
01242
01243
01244
01245 template <class X>
01246 inline
01247 const sc_lv_base
01248 lrotate( const sc_proxy<X>& x, int n );
01249
01250
01251
01252
01253 template <class X>
01254 inline
01255 const sc_lv_base
01256 rrotate( const sc_proxy<X>& x, int n );
01257
01258
01259
01260
01261 template <class X>
01262 inline
01263 X&
01264 sc_proxy<X>::reverse()
01265 {
01266 X& x = back_cast();
01267 int len = x.length();
01268 int half_len = len / 2;
01269 for( int i = 0, j = len - 1; i < half_len; ++ i, --j ) {
01270 sc_logic_value_t t = x.get_bit( i );
01271 x.set_bit( i, x.get_bit( j ) );
01272 x.set_bit( j, t );
01273 }
01274 return x;
01275 }
01276
01277 template <class X>
01278 inline
01279 const sc_lv_base
01280 reverse( const sc_proxy<X>& a );
01281
01282
01283
01284
01285 template <class X>
01286 inline
01287 sc_logic_value_t
01288 sc_proxy<X>::and_reduce() const
01289 {
01290 const X& x = back_cast();
01291 sc_logic_value_t result = sc_logic_value_t( 1 );
01292 int len = x.length();
01293 for( int i = 0; i < len; ++ i ) {
01294 result = sc_logic::and_table[result][x.get_bit( i )];
01295 }
01296 return result;
01297 }
01298
01299 template <class X>
01300 inline
01301 sc_logic_value_t
01302 sc_proxy<X>::or_reduce() const
01303 {
01304 const X& x = back_cast();
01305 sc_logic_value_t result = sc_logic_value_t( 0 );
01306 int len = x.length();
01307 for( int i = 0; i < len; ++ i ) {
01308 result = sc_logic::or_table[result][x.get_bit( i )];
01309 }
01310 return result;
01311 }
01312
01313 template <class X>
01314 inline
01315 sc_logic_value_t
01316 sc_proxy<X>::xor_reduce() const
01317 {
01318 const X& x = back_cast();
01319 sc_logic_value_t result = sc_logic_value_t( 0 );
01320 int len = x.length();
01321 for( int i = 0; i < len; ++ i ) {
01322 result = sc_logic::xor_table[result][x.get_bit( i )];
01323 }
01324 return result;
01325 }
01326
01327
01328
01329
01330 template <class X, class Y>
01331 inline
01332 bool
01333 operator != ( const sc_proxy<X>& px, const sc_proxy<Y>& py )
01334 {
01335 return !( px == py );
01336 }
01337
01338
01339 #define DEFN_REL_OP_T(tp) \
01340 template <class X> \
01341 inline \
01342 bool \
01343 operator == ( tp b, const sc_proxy<X>& px ) \
01344 { \
01345 return ( px == b ); \
01346 } \
01347 \
01348 template <class X> \
01349 inline \
01350 bool \
01351 operator != ( const sc_proxy<X>& px, tp b ) \
01352 { \
01353 return !( px == b ); \
01354 } \
01355 \
01356 template <class X> \
01357 inline \
01358 bool \
01359 operator != ( tp b, const sc_proxy<X>& px ) \
01360 { \
01361 return !( px == b ); \
01362 }
01363
01364 DEFN_REL_OP_T(const char*)
01365 DEFN_REL_OP_T(const bool*)
01366 DEFN_REL_OP_T(const sc_logic*)
01367 DEFN_REL_OP_T(const sc_unsigned&)
01368 DEFN_REL_OP_T(const sc_signed&)
01369 DEFN_REL_OP_T(const sc_uint_base&)
01370 DEFN_REL_OP_T(const sc_int_base&)
01371 DEFN_REL_OP_T(unsigned long)
01372 DEFN_REL_OP_T(long)
01373 DEFN_REL_OP_T(unsigned int)
01374 DEFN_REL_OP_T(int)
01375 DEFN_REL_OP_T(uint64)
01376 DEFN_REL_OP_T(int64)
01377
01378 #undef DEFN_REL_OP_T
01379
01380
01381
01382
01383 template <class X>
01384 inline
01385 const std::string
01386 sc_proxy<X>::to_string() const
01387 {
01388 const X& x = back_cast();
01389 int len = x.length();
01390 std::string s;
01391 for( int i = 0; i < len; ++ i ) {
01392 s += sc_logic::logic_to_char[x.get_bit( len - i - 1 )];
01393 }
01394 return s;
01395 }
01396
01397 template <class X>
01398 inline
01399 const std::string
01400 sc_proxy<X>::to_string( sc_numrep numrep ) const
01401 {
01402 return convert_to_fmt( to_string(), numrep, true );
01403 }
01404
01405 template <class X>
01406 inline
01407 const std::string
01408 sc_proxy<X>::to_string( sc_numrep numrep, bool w_prefix ) const
01409 {
01410 return convert_to_fmt( to_string(), numrep, w_prefix );
01411 }
01412
01413
01414
01415
01416 template <class X>
01417 inline
01418 void
01419 sc_proxy<X>::scan( ::std::istream& is )
01420 {
01421 std::string s;
01422 is >> s;
01423 back_cast() = s.c_str();
01424 }
01425
01426
01427 template <class X>
01428 inline
01429 void
01430 sc_proxy<X>::check_bounds( int n ) const
01431 {
01432 if( n < 0 || n >= back_cast().length() ) {
01433 SC_REPORT_ERROR( sc_core::SC_ID_OUT_OF_BOUNDS_, 0 );
01434 }
01435 }
01436
01437 template <class X>
01438 inline
01439 void
01440 sc_proxy<X>::check_wbounds( int n ) const
01441 {
01442 if( n < 0 || n >= back_cast().size() ) {
01443 SC_REPORT_ERROR( sc_core::SC_ID_OUT_OF_BOUNDS_, 0 );
01444 }
01445 }
01446
01447
01448 template <class X>
01449 inline
01450 sc_digit
01451 sc_proxy<X>::to_anything_unsigned() const
01452 {
01453
01454
01455 const X& x = back_cast();
01456 int len = x.length();
01457 if( x.get_cword( 0 ) != SC_DIGIT_ZERO ) {
01458 SC_REPORT_WARNING( sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_, 0 );
01459 }
01460 sc_digit w = x.get_word( 0 );
01461 if( len >= SC_DIGIT_SIZE ) {
01462 return w;
01463 }
01464 return ( w & (~SC_DIGIT_ZERO >> (SC_DIGIT_SIZE - len)) );
01465 }
01466
01467 template <class X>
01468 inline
01469 uint64
01470 sc_proxy<X>::to_uint64() const
01471 {
01472
01473
01474 const X& x = back_cast();
01475 int len = x.length();
01476 if( x.get_cword( 0 ) != SC_DIGIT_ZERO ) {
01477 SC_REPORT_WARNING( sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_, 0 );
01478 }
01479 uint64 w = x.get_word( 0 );
01480 if( len > SC_DIGIT_SIZE )
01481 {
01482 if( x.get_cword( 1 ) != SC_DIGIT_ZERO ) {
01483 SC_REPORT_WARNING( sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_, 0 );
01484 }
01485 uint64 w1 = x.get_word( 1 );
01486 w = w | (w1 << SC_DIGIT_SIZE);
01487 return w;
01488 }
01489 else if( len == SC_DIGIT_SIZE )
01490 {
01491 return w;
01492 }
01493 else
01494 {
01495 return ( w & (~SC_DIGIT_ZERO >> (SC_DIGIT_SIZE - len)) );
01496 }
01497 }
01498
01499 template <class X>
01500 inline
01501 int64
01502 sc_proxy<X>::to_anything_signed() const
01503 {
01504 const X& x = back_cast();
01505 int len = x.length();
01506 int64 w = 0;
01507
01508 if( len > SC_DIGIT_SIZE )
01509 {
01510 if( x.get_cword( 1 ) != SC_DIGIT_ZERO )
01511 SC_REPORT_WARNING( sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_, 0 );
01512 w = x.get_word(1);
01513 }
01514 if( x.get_cword( 0 ) != SC_DIGIT_ZERO )
01515 SC_REPORT_WARNING( sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_, 0 );
01516 w = (w << SC_DIGIT_SIZE) | x.get_word( 0 );
01517 if( len >= 64 ) {
01518 return w;
01519 }
01520
01521 uint64 zero = 0;
01522 sc_logic_value_t sgn = x.get_bit( len - 1 );
01523 if( sgn == 0 ) {
01524 return (int64)( w & (~zero >> (64 - len)) );
01525 } else {
01526 return (int64)( w | (~zero << len) );
01527 }
01528 }
01529
01530
01531
01532
01533
01534
01535 template <class X>
01536 inline
01537 sc_logic_value_t
01538 and_reduce( const sc_proxy<X>& a )
01539 {
01540 return a.and_reduce();
01541 }
01542
01543 template <class X>
01544 inline
01545 sc_logic_value_t
01546 nand_reduce( const sc_proxy<X>& a )
01547 {
01548 return a.nand_reduce();
01549 }
01550
01551 template <class X>
01552 inline
01553 sc_logic_value_t
01554 or_reduce( const sc_proxy<X>& a )
01555 {
01556 return a.or_reduce();
01557 }
01558
01559 template <class X>
01560 inline
01561 sc_logic_value_t
01562 nor_reduce( const sc_proxy<X>& a )
01563 {
01564 return a.nor_reduce();
01565 }
01566
01567 template <class X>
01568 inline
01569 sc_logic_value_t
01570 xor_reduce( const sc_proxy<X>& a )
01571 {
01572 return a.xor_reduce();
01573 }
01574
01575 template <class X>
01576 inline
01577 sc_logic_value_t
01578 xnor_reduce( const sc_proxy<X>& a )
01579 {
01580 return a.xnor_reduce();
01581 }
01582
01583
01584
01585
01586 template <class X>
01587 inline
01588 ::std::ostream&
01589 operator << ( ::std::ostream& os, const sc_proxy<X>& a )
01590 {
01591 a.print( os );
01592 return os;
01593 }
01594
01595 template <class X>
01596 inline
01597 ::std::istream&
01598 operator >> ( ::std::istream& is, sc_proxy<X>& a )
01599 {
01600 a.scan( is );
01601 return is;
01602 }
01603
01604 }
01605
01606
01607 #endif