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