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