SystemC  2.3.1
Accellera SystemC proof-of-concept library
sc_lv_base.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  sc_lv_base.h -- Arbitrary size logic vector class.
21 
22  Original Author: Gene Bushuyev, Synopsys, Inc.
23 
24  *****************************************************************************/
25 
26 /*****************************************************************************
27 
28  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
29  changes you are making here.
30 
31  Name, Affiliation, Date:
32  Description of Modification:
33  Andy Goodrich, Forte Design Systems
34  Fixed bug in clean_tail for sizes that are modulo 32, which caused
35  zeroing of values.
36 
37  *****************************************************************************/
38 
39 // $Log: sc_lv_base.h,v $
40 // Revision 1.4 2011/08/26 22:32:00 acg
41 // Torsten Maehne: added parentheses to make opearator ordering more obvious.
42 //
43 // Revision 1.3 2010/01/27 19:41:29 acg
44 // Andy Goodrich: fix 8 instances of sc_concref constructor invocations
45 // that failed to indicate that their arguments should be freed when the
46 // object was freed.
47 //
48 // Revision 1.2 2009/02/28 00:26:14 acg
49 // Andy Goodrich: bug fixes.
50 //
51 // Revision 1.2 2007/03/14 17:47:49 acg
52 // Andy Goodrich: Formatting.
53 //
54 // Revision 1.1.1.1 2006/12/15 20:31:36 acg
55 // SystemC 2.2
56 //
57 // Revision 1.3 2006/01/13 18:53:53 acg
58 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
59 // the source.
60 //
61 
62 #ifndef SC_LV_BASE_H
63 #define SC_LV_BASE_H
64 
65 
70 
71 
72 namespace sc_dt
73 {
74 
75 // classes defined in this module
76 class sc_lv_base;
77 
78 
79 // ----------------------------------------------------------------------------
80 // CLASS : sc_lv_base
81 //
82 // Arbitrary size logic vector base class.
83 // ----------------------------------------------------------------------------
84 
86  : public sc_proxy<sc_lv_base>
87 {
88  friend class sc_bv_base;
89 
90 
91  void init( int length_, const sc_logic& init_value = SC_LOGIC_X );
92 
93  void assign_from_string( const std::string& );
94 
95 public:
96 
97  // typedefs
98 
100 
101 
102  // constructors
103 
104  explicit sc_lv_base( int length_ = sc_length_param().len() )
105  : m_len( 0 ), m_size( 0 ), m_data( 0 ), m_ctrl( 0 )
106  { init( length_ ); }
107 
108  explicit sc_lv_base( const sc_logic& a,
109  int length_ = sc_length_param().len() )
110  : m_len( 0 ), m_size( 0 ), m_data( 0 ), m_ctrl( 0 )
111  { init( length_, a ); }
112 
113  sc_lv_base( const char* a );
114 
115  sc_lv_base( const char* a, int length_ );
116 
117  template <class X>
119  : m_len( 0 ), m_size( 0 ), m_data( 0 ), m_ctrl( 0 )
120  { init( a.back_cast().length() ); base_type::assign_( a ); }
121 
122  sc_lv_base( const sc_lv_base& a );
123 
124 #ifdef SC_DT_DEPRECATED
125 
126  explicit sc_lv_base( const sc_unsigned& a )
127  : m_len( 0 ), m_size( 0 ), m_data( 0 ), m_ctrl( 0 )
128  { init( a.length() ); base_type::assign_( a ); }
129 
130  explicit sc_lv_base( const sc_signed& a )
131  : m_len( 0 ), m_size( 0 ), m_data( 0 ), m_ctrl( 0 )
132  { init( a.length() ); base_type::assign_( a ); }
133 
134  explicit sc_lv_base( const sc_uint_base& a )
135  : m_len( 0 ), m_size( 0 ), m_data( 0 ), m_ctrl( 0 )
136  { init( a.length() ); base_type::assign_( a ); }
137 
138  explicit sc_lv_base( const sc_int_base& a )
139  : m_len( 0 ), m_size( 0 ), m_data( 0 ), m_ctrl( 0 )
140  { init( a.length() ); base_type::assign_( a ); }
141 
142 #endif
143 
144 
145  // destructor
146 
147  virtual ~sc_lv_base()
148  { delete [] m_data; }
149 
150 
151  // assignment operators
152 
153  template <class X>
155  { assign_p_( *this, a ); return *this; }
156 
158  { assign_p_( *this, a ); return *this; }
159 
160  sc_lv_base& operator = ( const char* a );
161 
162  sc_lv_base& operator = ( const bool* a )
163  { base_type::assign_( a ); return *this; }
164 
166  { base_type::assign_( a ); return *this; }
167 
169  { base_type::assign_( a ); return *this; }
170 
172  { base_type::assign_( a ); return *this; }
173 
175  { base_type::assign_( a ); return *this; }
176 
178  { base_type::assign_( a ); return *this; }
179 
180  sc_lv_base& operator = ( unsigned long a )
181  { base_type::assign_( a ); return *this; }
182 
184  { base_type::assign_( a ); return *this; }
185 
186  sc_lv_base& operator = ( unsigned int a )
187  { base_type::assign_( a ); return *this; }
188 
190  { base_type::assign_( a ); return *this; }
191 
193  { base_type::assign_( a ); return *this; }
194 
196  { base_type::assign_( a ); return *this; }
197 
198 
199 #if 0
200 
201  // bitwise complement
202 
203  sc_lv_base& b_not()
204  { return sc_proxy<sc_lv_base>::b_not(); }
205 
206  const sc_lv_base operator ~ () const
207  { sc_lv_base a( *this ); return a.b_not(); }
208 
209 
210  // bitwise left shift
211 
212  sc_lv_base& operator <<= ( int n )
213  { return sc_proxy<sc_lv_base>::operator <<= ( n ); }
214 
215  const sc_lv_base operator << ( int n ) const
216  { sc_lv_base a( *this ); return ( a <<= n ); }
217 
218 
219  // bitwise right shift
220 
221  sc_lv_base& operator >>= ( int n )
222  { return sc_proxy<sc_lv_base>::operator >>= ( n ); }
223 
224  const sc_lv_base operator >> ( int n ) const
225  { sc_lv_base a( *this ); return ( a >>= n ); }
226 
227 
228  // bitwise left rotate
229 
230  sc_lv_base& lrotate( int n )
231  { return sc_proxy<sc_lv_base>::lrotate( n ); }
232 
233 
234  // bitwise right rotate
235 
236  sc_lv_base& rrotate( int n )
237  { return sc_proxy<sc_lv_base>::rrotate( n ); }
238 
239 #endif
240 
241 
242  // common methods
243 
244  int length() const
245  { return m_len; }
246 
247  int size() const
248  { return m_size; }
249 
250  sc_logic_value_t get_bit( int i ) const;
251  void set_bit( int i, sc_logic_value_t value );
252 
253  sc_digit get_word( int wi ) const
254  { return m_data[wi]; }
255 
256  // note the test for out of range access here. this is necessary
257  // because of the hair-brained way concatenations are set up.
258  // an extend_sign on a concatenation uses the whole length of
259  // the concatenation to determine how many words to set.
260  void set_word( int wi, sc_digit w )
261  { assert ( wi < m_size ); m_data[wi] = w; }
262 
263 
264  sc_digit get_cword( int wi ) const
265  { return m_ctrl[wi]; }
266 
267  void set_cword( int wi, sc_digit w )
268  { assert ( wi < m_size ); m_ctrl[wi] = w; }
269 
270  void clean_tail();
271 
272 
273  // other methods
274 
275  bool is_01() const;
276 
277 protected:
278 
279  int m_len; // length in bits
280  int m_size; // size of the data array
281  sc_digit* m_data; // data array
282  sc_digit* m_ctrl; // dito (control part)
283 };
284 
285 
286 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
287 
288 #if 0
289 
290 // bitwise left rotate
291 
292 inline
293 const sc_lv_base
294 lrotate( const sc_lv_base& x, int n )
295 {
296  sc_lv_base a( x );
297  return a.lrotate( n );
298 }
299 
300 
301 // bitwise right rotate
302 
303 inline
304 const sc_lv_base
305 rrotate( const sc_lv_base& x, int n )
306 {
307  sc_lv_base a( x );
308  return a.rrotate( n );
309 }
310 
311 #endif
312 
313 
314 inline
316 sc_lv_base::get_bit( int i ) const
317 {
318  int wi = i / SC_DIGIT_SIZE;
319  int bi = i % SC_DIGIT_SIZE;
320  return sc_logic_value_t( ((m_data[wi] >> bi) & SC_DIGIT_ONE) |
321  (((m_ctrl[wi] >> bi) << 1) & SC_DIGIT_TWO) );
322 }
323 
324 inline
325 void
327 {
328  int wi = i / SC_DIGIT_SIZE; // word index
329  int bi = i % SC_DIGIT_SIZE; // bit index
330  sc_digit mask = SC_DIGIT_ONE << bi;
331  m_data[wi] |= mask; // set bit to 1
332  m_ctrl[wi] |= mask; // set bit to 1
333  m_data[wi] &= value << bi | ~mask;
334  m_ctrl[wi] &= value >> 1 << bi | ~mask;
335 }
336 
337 
338 inline
339 void
341 {
342  int wi = m_size - 1;
343  int bi = m_len % SC_DIGIT_SIZE;
344  sc_digit mask = ~SC_DIGIT_ZERO >> (SC_DIGIT_SIZE - bi);
345  if ( mask )
346  {
347  m_data[wi] &= mask;
348  m_ctrl[wi] &= mask;
349  }
350 }
351 
352 
353 // ----------------------------------------------------------------------------
354 // CLASS TEMPLATE : sc_proxy
355 //
356 // Base class template for bit/logic vector classes.
357 // (Barton/Nackmann implementation)
358 // ----------------------------------------------------------------------------
359 
360 // bitwise operators and functions
361 
362 // bitwise complement
363 
364 template <class X>
365 inline
366 const sc_lv_base
368 {
369  sc_lv_base a( back_cast() );
370  return a.b_not();
371 }
372 
373 
374 // bitwise and
375 
376 template <class X, class Y>
377 inline
378 X&
380 {
381  X& x = px.back_cast();
382  sc_lv_base a( x.length() );
383  a = py.back_cast();
384  return b_and_assign_( x, a );
385 }
386 
387 
388 #define DEFN_BITWISE_AND_ASN_OP_T(tp) \
389 template <class X> \
390 inline \
391 X& \
392 sc_proxy<X>::operator &= ( tp b ) \
393 { \
394  X& x = back_cast(); \
395  sc_lv_base a( x.length() ); \
396  a = b; \
397  return b_and_assign_( x, a ); \
398 }
399 
400 DEFN_BITWISE_AND_ASN_OP_T(const char*)
401 DEFN_BITWISE_AND_ASN_OP_T(const bool*)
402 DEFN_BITWISE_AND_ASN_OP_T(const sc_logic*)
403 DEFN_BITWISE_AND_ASN_OP_T(const sc_unsigned&)
404 DEFN_BITWISE_AND_ASN_OP_T(const sc_signed&)
405 DEFN_BITWISE_AND_ASN_OP_T(unsigned long)
409 
410 #undef DEFN_BITWISE_AND_ASN_OP_T
411 
412 
413 template <class X, class Y>
414 inline
415 const sc_lv_base
416 operator & ( const sc_proxy<X>& px, const sc_proxy<Y>& py )
417 {
418  sc_lv_base a( px.back_cast() );
419  return ( a &= py.back_cast() );
420 }
421 
422 
423 #define DEFN_BITWISE_AND_OP_T_A(tp) \
424 template <class X> \
425 inline \
426 const sc_lv_base \
427 sc_proxy<X>::operator & ( tp b ) const \
428 { \
429  sc_lv_base a( back_cast() ); \
430  return ( a &= b ); \
431 }
432 
433 DEFN_BITWISE_AND_OP_T_A(const char*)
434 DEFN_BITWISE_AND_OP_T_A(const bool*)
435 DEFN_BITWISE_AND_OP_T_A(const sc_logic*)
436 DEFN_BITWISE_AND_OP_T_A(const sc_unsigned&)
437 DEFN_BITWISE_AND_OP_T_A(const sc_signed&)
438 DEFN_BITWISE_AND_OP_T_A(const sc_uint_base&)
439 DEFN_BITWISE_AND_OP_T_A(const sc_int_base&)
440 DEFN_BITWISE_AND_OP_T_A(unsigned long)
442 DEFN_BITWISE_AND_OP_T_A(unsigned int)
446 
447 #undef DEFN_BITWISE_AND_OP_T_A
448 
449 
450 #define DEFN_BITWISE_AND_OP_T_B(tp) \
451 template <class X> \
452 inline \
453 const sc_lv_base \
454 operator & ( tp b, const sc_proxy<X>& px ) \
455 { \
456  return ( px & b ); \
457 }
458 
459 DEFN_BITWISE_AND_OP_T_B(const char*)
460 DEFN_BITWISE_AND_OP_T_B(const bool*)
461 DEFN_BITWISE_AND_OP_T_B(const sc_logic*)
462 DEFN_BITWISE_AND_OP_T_B(const sc_unsigned&)
463 DEFN_BITWISE_AND_OP_T_B(const sc_signed&)
464 DEFN_BITWISE_AND_OP_T_B(const sc_uint_base&)
465 DEFN_BITWISE_AND_OP_T_B(const sc_int_base&)
466 DEFN_BITWISE_AND_OP_T_B(unsigned long)
468 DEFN_BITWISE_AND_OP_T_B(unsigned int)
472 
473 #undef DEFN_BITWISE_AND_OP_T_B
474 
475 
476 // bitwise or
477 
478 template <class X, class Y>
479 inline
480 X&
482 {
483  X& x = px.back_cast();
484  sc_lv_base a( x.length() );
485  a = py.back_cast();
486  return b_or_assign_( x, a );
487 }
488 
489 
490 #define DEFN_BITWISE_OR_ASN_OP_T(tp) \
491 template <class X> \
492 inline \
493 X& \
494 sc_proxy<X>::operator |= ( tp b ) \
495 { \
496  X& x = back_cast(); \
497  sc_lv_base a( x.length() ); \
498  a = b; \
499  return b_or_assign_( x, a ); \
500 }
501 
502 DEFN_BITWISE_OR_ASN_OP_T(const char*)
503 DEFN_BITWISE_OR_ASN_OP_T(const bool*)
504 DEFN_BITWISE_OR_ASN_OP_T(const sc_logic*)
505 DEFN_BITWISE_OR_ASN_OP_T(const sc_unsigned&)
506 DEFN_BITWISE_OR_ASN_OP_T(const sc_signed&)
507 DEFN_BITWISE_OR_ASN_OP_T(unsigned long)
511 
512 #undef DEFN_BITWISE_OR_ASN_OP_T
513 
514 
515 template <class X, class Y>
516 inline
517 const sc_lv_base
518 operator | ( const sc_proxy<X>& px, const sc_proxy<Y>& py )
519 {
520  sc_lv_base a( px.back_cast() );
521  return ( a |= py.back_cast() );
522 }
523 
524 
525 #define DEFN_BITWISE_OR_OP_T_A(tp) \
526 template <class X> \
527 inline \
528 const sc_lv_base \
529 sc_proxy<X>::operator | ( tp b ) const \
530 { \
531  sc_lv_base a( back_cast() ); \
532  return ( a |= b ); \
533 }
534 
535 DEFN_BITWISE_OR_OP_T_A(const char*)
536 DEFN_BITWISE_OR_OP_T_A(const bool*)
537 DEFN_BITWISE_OR_OP_T_A(const sc_logic*)
538 DEFN_BITWISE_OR_OP_T_A(const sc_unsigned&)
539 DEFN_BITWISE_OR_OP_T_A(const sc_signed&)
540 DEFN_BITWISE_OR_OP_T_A(const sc_uint_base&)
541 DEFN_BITWISE_OR_OP_T_A(const sc_int_base&)
542 DEFN_BITWISE_OR_OP_T_A(unsigned long)
544 DEFN_BITWISE_OR_OP_T_A(unsigned int)
548 
549 #undef DEFN_BITWISE_OR_OP_T_A
550 
551 
552 #define DEFN_BITWISE_OR_OP_T_B(tp) \
553 template <class X> \
554 inline \
555 const sc_lv_base \
556 operator | ( tp b, const sc_proxy<X>& px ) \
557 { \
558  return ( px | b ); \
559 }
560 
561 DEFN_BITWISE_OR_OP_T_B(const char*)
562 DEFN_BITWISE_OR_OP_T_B(const bool*)
563 DEFN_BITWISE_OR_OP_T_B(const sc_logic*)
564 DEFN_BITWISE_OR_OP_T_B(const sc_unsigned&)
565 DEFN_BITWISE_OR_OP_T_B(const sc_signed&)
566 DEFN_BITWISE_OR_OP_T_B(const sc_uint_base&)
567 DEFN_BITWISE_OR_OP_T_B(const sc_int_base&)
568 DEFN_BITWISE_OR_OP_T_B(unsigned long)
570 DEFN_BITWISE_OR_OP_T_B(unsigned int)
574 
575 #undef DEFN_BITWISE_OR_OP_T_B
576 
577 
578 // bitwise xor
579 
580 template <class X, class Y>
581 inline
582 X&
584 {
585  X& x = px.back_cast();
586  sc_lv_base a( x.length() );
587  a = py.back_cast();
588  return b_xor_assign_( x, a );
589 }
590 
591 
592 #define DEFN_BITWISE_XOR_ASN_OP_T(tp) \
593 template <class X> \
594 inline \
595 X& \
596 sc_proxy<X>::operator ^= ( tp b ) \
597 { \
598  X& x = back_cast(); \
599  sc_lv_base a( x.length() ); \
600  a = b; \
601  return b_xor_assign_( x, a ); \
602 }
603 
604 DEFN_BITWISE_XOR_ASN_OP_T(const char*)
605 DEFN_BITWISE_XOR_ASN_OP_T(const bool*)
606 DEFN_BITWISE_XOR_ASN_OP_T(const sc_logic*)
607 DEFN_BITWISE_XOR_ASN_OP_T(const sc_unsigned&)
608 DEFN_BITWISE_XOR_ASN_OP_T(const sc_signed&)
609 DEFN_BITWISE_XOR_ASN_OP_T(unsigned long)
613 
614 #undef DEFN_BITWISE_XOR_ASN_OP_T
615 
616 
617 template <class X, class Y>
618 inline
619 const sc_lv_base
620 operator ^ ( const sc_proxy<X>& px, const sc_proxy<Y>& py )
621 {
622  sc_lv_base a( px.back_cast() );
623  return ( a ^= py.back_cast() );
624 }
625 
626 
627 #define DEFN_BITWISE_XOR_OP_T_A(tp) \
628 template <class X> \
629 inline \
630 const sc_lv_base \
631 sc_proxy<X>::operator ^ ( tp b ) const \
632 { \
633  sc_lv_base a( back_cast() ); \
634  return ( a ^= b ); \
635 }
636 
637 DEFN_BITWISE_XOR_OP_T_A(const char*)
638 DEFN_BITWISE_XOR_OP_T_A(const bool*)
639 DEFN_BITWISE_XOR_OP_T_A(const sc_logic*)
640 DEFN_BITWISE_XOR_OP_T_A(const sc_unsigned&)
641 DEFN_BITWISE_XOR_OP_T_A(const sc_signed&)
642 DEFN_BITWISE_XOR_OP_T_A(const sc_uint_base&)
643 DEFN_BITWISE_XOR_OP_T_A(const sc_int_base&)
644 DEFN_BITWISE_XOR_OP_T_A(unsigned long)
646 DEFN_BITWISE_XOR_OP_T_A(unsigned int)
650 
651 #undef DEFN_BITWISE_XOR_OP_T_A
652 
653 
654 #define DEFN_BITWISE_XOR_OP_T_B(tp) \
655 template <class X> \
656 inline \
657 const sc_lv_base \
658 operator ^ ( tp b, const sc_proxy<X>& px ) \
659 { \
660  return ( px ^ b ); \
661 }
662 
663 DEFN_BITWISE_XOR_OP_T_B(const char*)
664 DEFN_BITWISE_XOR_OP_T_B(const bool*)
665 DEFN_BITWISE_XOR_OP_T_B(const sc_logic*)
666 DEFN_BITWISE_XOR_OP_T_B(const sc_unsigned&)
667 DEFN_BITWISE_XOR_OP_T_B(const sc_signed&)
668 DEFN_BITWISE_XOR_OP_T_B(const sc_uint_base&)
669 DEFN_BITWISE_XOR_OP_T_B(const sc_int_base&)
670 DEFN_BITWISE_XOR_OP_T_B(unsigned long)
672 DEFN_BITWISE_XOR_OP_T_B(unsigned int)
676 
677 #undef DEFN_BITWISE_XOR_OP_T_B
678 
679 
680 // bitwise left shift
681 
682 template <class X>
683 inline
684 const sc_lv_base
686 {
687  sc_lv_base a( back_cast().length()+n );
688  a = back_cast();
689  return ( a <<= n );
690 }
691 
692 
693 // bitwise right shift
694 
695 template <class X>
696 inline
697 const sc_lv_base
699 {
700  sc_lv_base a( back_cast() );
701  return ( a >>= n );
702 }
703 
704 
705 // bitwise left rotate
706 
707 template <class X>
708 inline
709 X&
711 {
712  X& x = back_cast();
713  if( n < 0 ) {
714  char msg[BUFSIZ];
715  std::sprintf( msg,
716  "left rotate operation is only allowed with positive "
717  "rotate values, rotate value = %d", n );
719  }
720  int len = x.length();
721  n %= len;
722  // x = (x << n) | (x >> (len - n));
723  sc_lv_base a( x << n );
724  sc_lv_base b( x >> (len - n) );
725  int sz = x.size();
726  for( int i = 0; i < sz; ++ i ) {
727  x.set_word( i, a.get_word( i ) | b.get_word( i ) );
728  x.set_cword( i, a.get_cword( i ) | b.get_cword( i ) );
729  }
730  x.clean_tail();
731  return x;
732 }
733 
734 template <class X>
735 inline
736 const sc_lv_base
737 lrotate( const sc_proxy<X>& x, int n )
738 {
739  sc_lv_base a( x.back_cast() );
740  return a.lrotate( n );
741 }
742 
743 
744 // bitwise right rotate
745 
746 template <class X>
747 inline
748 X&
750 {
751  X& x = back_cast();
752  if( n < 0 ) {
753  char msg[BUFSIZ];
754  std::sprintf( msg,
755  "right rotate operation is only allowed with positive "
756  "rotate values, rotate value = %d", n );
758  }
759  int len = x.length();
760  n %= len;
761  // x = (x >> n) | (x << (len - n));
762  sc_lv_base a( x >> n );
763  sc_lv_base b( x << (len - n) );
764  int sz = x.size();
765  for( int i = 0; i < sz; ++ i ) {
766  x.set_word( i, a.get_word( i ) | b.get_word( i ) );
767  x.set_cword( i, a.get_cword( i ) | b.get_cword( i ) );
768  }
769  x.clean_tail();
770  return x;
771 }
772 
773 template <class X>
774 inline
775 const sc_lv_base
776 rrotate( const sc_proxy<X>& x, int n )
777 {
778  sc_lv_base a( x.back_cast() );
779  return a.rrotate( n );
780 }
781 
782 
783 // bitwise reverse
784 
785 template <class X>
786 inline
787 const sc_lv_base
788 reverse( const sc_proxy<X>& x )
789 {
790  sc_lv_base a( x.back_cast() );
791  return a.reverse();
792 }
793 
794 
795 // relational operators
796 
797 template <class X, class Y>
798 inline
799 bool
800 operator == ( const sc_proxy<X>& px, const sc_proxy<Y>& py )
801 {
802  const X& x = px.back_cast();
803  const Y& y = py.back_cast();
804  int x_len = x.length();
805  int y_len = y.length();
806  if( x_len != y_len ) {
807  return false;
808  }
809  int sz = x.size();
810  for( int i = 0; i < sz; ++ i ) {
811  if( x.get_word( i ) != y.get_word( i ) ||
812  x.get_cword( i ) != y.get_cword( i ) ) {
813  return false;
814  }
815  }
816  return true;
817 }
818 
819 
820 #define DEFN_REL_OP_T(tp) \
821 template <class X> \
822 inline \
823 bool \
824 sc_proxy<X>::operator == ( tp b ) const \
825 { \
826  const X& x = back_cast(); \
827  sc_lv_base y( x.length() ); \
828  y = b; \
829  return ( x == y ); \
830 }
831 
832 DEFN_REL_OP_T(const char*)
833 DEFN_REL_OP_T(const bool*)
834 DEFN_REL_OP_T(const sc_logic*)
835 DEFN_REL_OP_T(const sc_unsigned&)
836 DEFN_REL_OP_T(const sc_signed&)
837 DEFN_REL_OP_T(const sc_uint_base&)
838 DEFN_REL_OP_T(const sc_int_base&)
839 DEFN_REL_OP_T(unsigned long)
840 DEFN_REL_OP_T(long)
841 DEFN_REL_OP_T(unsigned int)
842 DEFN_REL_OP_T(int)
845 
846 #undef DEFN_REL_OP_T
847 
848 
849 // ----------------------------------------------------------------------------
850 // CLASS TEMPLATE : sc_bitref_r<X>
851 //
852 // Proxy class for sc_proxy bit selection (r-value only).
853 // ----------------------------------------------------------------------------
854 
855 // r-value concatenation operators and functions
856 
857 template <class T>
858 inline
859 sc_concref_r<sc_bitref_r<T>,sc_lv_base>
860 operator , ( sc_bitref_r<T> a, const char* b )
861 {
863  *a.clone(), *new sc_lv_base( b ), 3 );
864 }
865 
866 template <class T>
867 inline
868 sc_concref_r<sc_lv_base,sc_bitref_r<T> >
869 operator , ( const char* a, sc_bitref_r<T> b )
870 {
872  *new sc_lv_base( a ), *b.clone(), 3 );
873 }
874 
875 template <class T>
876 inline
877 sc_concref_r<sc_bitref_r<T>,sc_lv_base>
879 {
881  *a.clone(), *new sc_lv_base( b, 1 ), 3 );
882 }
883 
884 template <class T>
885 inline
886 sc_concref_r<sc_lv_base,sc_bitref_r<T> >
888 {
890  *new sc_lv_base( a, 1 ), *b.clone(), 3 );
891 }
892 
893 template <class T>
894 inline
895 sc_concref_r<sc_bitref_r<T>,sc_bv_base>
897 {
899  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
900 }
901 
902 template <class T>
903 inline
904 sc_concref_r<sc_bv_base,sc_bitref_r<T> >
906 {
908  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
909 }
910 
911 
912 template <class T>
913 inline
914 sc_concref_r<sc_bitref_r<T>,sc_lv_base>
915 concat( sc_bitref_r<T> a, const char* b )
916 {
918  *a.clone(), *new sc_lv_base( b ), 3 );
919 }
920 
921 template <class T>
922 inline
923 sc_concref_r<sc_lv_base,sc_bitref_r<T> >
924 concat( const char* a, sc_bitref_r<T> b )
925 {
927  *new sc_lv_base( a ), *b.clone(), 3 );
928 }
929 
930 template <class T>
931 inline
932 sc_concref_r<sc_bitref_r<T>,sc_lv_base>
934 {
936  *a.clone(), *new sc_lv_base( b, 1 ), 3 );
937 }
938 
939 template <class T>
940 inline
941 sc_concref_r<sc_lv_base,sc_bitref_r<T> >
943 {
945  *new sc_lv_base( a, 1 ), *b.clone(), 3 );
946 }
947 
948 template <class T>
949 inline
950 sc_concref_r<sc_bitref_r<T>,sc_bv_base>
952 {
954  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
955 }
956 
957 template <class T>
958 inline
959 sc_concref_r<sc_bv_base,sc_bitref_r<T> >
961 {
963  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
964 }
965 
966 
967 #ifdef SC_DT_MIXED_COMMA_OPERATORS
968 
969 template <class T>
970 inline
971 sc_concref_r<sc_bitref_r<T>,sc_lv_base>
972 operator , ( sc_bitref<T> a, const char* b )
973 {
975  *a.clone(), *new sc_lv_base( b ), 3 );
976 }
977 
978 template <class T>
979 inline
980 sc_concref_r<sc_lv_base,sc_bitref_r<T> >
981 operator , ( const char* a, sc_bitref<T> b )
982 {
984  *new sc_lv_base( a ), *b.clone(), 3 );
985 }
986 
987 template <class T>
988 inline
989 sc_concref_r<sc_bitref_r<T>,sc_lv_base>
991 {
993  *a.clone(), *new sc_lv_base( b, 1 ), 3 );
994 }
995 
996 template <class T>
997 inline
998 sc_concref_r<sc_lv_base,sc_bitref_r<T> >
1000 {
1002  *new sc_lv_base( a, 1 ), *b.clone(), 3 );
1003 }
1004 
1005 template <class T>
1006 inline
1007 sc_concref_r<sc_bitref_r<T>,sc_bv_base>
1009 {
1011  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
1012 }
1013 
1014 template <class T>
1015 inline
1016 sc_concref_r<sc_bv_base,sc_bitref_r<T> >
1018 {
1020  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
1021 }
1022 
1023 
1024 template <class T>
1025 inline
1026 sc_concref_r<sc_bitref_r<T>,sc_lv_base>
1027 concat( sc_bitref<T> a, const char* b )
1028 {
1030  *a.clone(), *new sc_lv_base( b ), 3 );
1031 }
1032 
1033 template <class T>
1034 inline
1035 sc_concref_r<sc_lv_base,sc_bitref_r<T> >
1036 concat( const char* a, sc_bitref<T> b )
1037 {
1039  *new sc_lv_base( a ), *b.clone(), 3 );
1040 }
1041 
1042 template <class T>
1043 inline
1044 sc_concref_r<sc_bitref_r<T>,sc_lv_base>
1046 {
1048  *a.clone(), *new sc_lv_base( b, 1 ), 3 );
1049 }
1050 
1051 template <class T>
1052 inline
1053 sc_concref_r<sc_lv_base,sc_bitref_r<T> >
1055 {
1057  *new sc_lv_base( a, 1 ), *b.clone(), 3 );
1058 }
1059 
1060 template <class T>
1061 inline
1062 sc_concref_r<sc_bitref_r<T>,sc_bv_base>
1064 {
1066  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
1067 }
1068 
1069 template <class T>
1070 inline
1071 sc_concref_r<sc_bv_base,sc_bitref_r<T> >
1073 {
1075  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
1076 }
1077 
1078 #endif
1079 
1080 
1081 // ----------------------------------------------------------------------------
1082 // CLASS TEMPLATE : sc_subref_r<X>
1083 //
1084 // Proxy class for sc_proxy part selection (r-value only).
1085 // ----------------------------------------------------------------------------
1086 
1087 // r-value concatenation operators and functions
1088 
1089 template <class T>
1090 inline
1091 sc_concref_r<sc_subref_r<T>,sc_lv_base>
1092 operator , ( sc_subref_r<T> a, const char* b )
1093 {
1095  *a.clone(), *new sc_lv_base( b ), 3 );
1096 }
1097 
1098 template <class T>
1099 inline
1100 sc_concref_r<sc_lv_base,sc_subref_r<T> >
1101 operator , ( const char* a, sc_subref_r<T> b )
1102 {
1104  *new sc_lv_base( a ), *b.clone(), 3 );
1105 }
1106 
1107 template <class T>
1108 inline
1109 sc_concref_r<sc_subref_r<T>,sc_lv_base>
1111 {
1113  *a.clone(), *new sc_lv_base( b, 1 ), 3 );
1114 }
1115 
1116 template <class T>
1117 inline
1118 sc_concref_r<sc_lv_base,sc_subref_r<T> >
1120 {
1122  *new sc_lv_base( a, 1 ), *b.clone(), 3 );
1123 }
1124 
1125 template <class T>
1126 inline
1127 sc_concref_r<sc_subref_r<T>,sc_bv_base>
1129 {
1131  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
1132 }
1133 
1134 template <class T>
1135 inline
1136 sc_concref_r<sc_bv_base,sc_subref_r<T> >
1138 {
1140  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
1141 }
1142 
1143 
1144 template <class T>
1145 inline
1146 sc_concref_r<sc_subref_r<T>,sc_lv_base>
1147 concat( sc_subref_r<T> a, const char* b )
1148 {
1150  *a.clone(), *new sc_lv_base( b ), 3 );
1151 }
1152 
1153 template <class T>
1154 inline
1155 sc_concref_r<sc_lv_base,sc_subref_r<T> >
1156 concat( const char* a, sc_subref_r<T> b )
1157 {
1159  *new sc_lv_base( a ), *b.clone(), 3 );
1160 }
1161 
1162 template <class T>
1163 inline
1164 sc_concref_r<sc_subref_r<T>,sc_lv_base>
1166 {
1168  *a.clone(), *new sc_lv_base( b, 1 ), 3 );
1169 }
1170 
1171 template <class T>
1172 inline
1173 sc_concref_r<sc_lv_base,sc_subref_r<T> >
1175 {
1177  *new sc_lv_base( a, 1 ), *b.clone(), 3 );
1178 }
1179 
1180 template <class T>
1181 inline
1182 sc_concref_r<sc_subref_r<T>,sc_bv_base>
1184 {
1186  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
1187 }
1188 
1189 template <class T>
1190 inline
1191 sc_concref_r<sc_bv_base,sc_subref_r<T> >
1193 {
1195  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
1196 }
1197 
1198 
1199 #ifdef SC_DT_MIXED_COMMA_OPERATORS
1200 
1201 template <class T>
1202 inline
1203 sc_concref_r<sc_subref_r<T>,sc_lv_base>
1204 operator , ( sc_subref<T> a, const char* b )
1205 {
1207  *a.clone(), *new sc_lv_base( b ), 3 );
1208 }
1209 
1210 template <class T>
1211 inline
1212 sc_concref_r<sc_lv_base,sc_subref_r<T> >
1213 operator , ( const char* a, sc_subref<T> b )
1214 {
1216  *new sc_lv_base( a ), *b.clone(), 3 );
1217 }
1218 
1219 template <class T>
1220 inline
1221 sc_concref_r<sc_subref_r<T>,sc_lv_base>
1223 {
1225  *a.clone(), *new sc_lv_base( b, 1 ), 3 );
1226 }
1227 
1228 template <class T>
1229 inline
1230 sc_concref_r<sc_lv_base,sc_subref_r<T> >
1232 {
1234  *new sc_lv_base( a, 1 ), *b.clone(), 3 );
1235 }
1236 
1237 template <class T>
1238 inline
1239 sc_concref_r<sc_subref_r<T>,sc_bv_base>
1241 {
1243  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
1244 }
1245 
1246 template <class T>
1247 inline
1248 sc_concref_r<sc_bv_base,sc_subref_r<T> >
1250 {
1252  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
1253 }
1254 
1255 
1256 template <class T>
1257 inline
1258 sc_concref_r<sc_subref_r<T>,sc_lv_base>
1259 concat( sc_subref<T> a, const char* b )
1260 {
1262  *a.clone(), *new sc_lv_base( b ), 3 );
1263 }
1264 
1265 template <class T>
1266 inline
1267 sc_concref_r<sc_lv_base,sc_subref_r<T> >
1268 concat( const char* a, sc_subref<T> b )
1269 {
1271  *new sc_lv_base( a ), *b.clone(), 3 );
1272 }
1273 
1274 template <class T>
1275 inline
1276 sc_concref_r<sc_subref_r<T>,sc_lv_base>
1278 {
1280  *a.clone(), *new sc_lv_base( b, 1 ), 3 );
1281 }
1282 
1283 template <class T>
1284 inline
1285 sc_concref_r<sc_lv_base,sc_subref_r<T> >
1287 {
1289  *new sc_lv_base( a, 1 ), *b.clone(), 3 );
1290 }
1291 
1292 template <class T>
1293 inline
1294 sc_concref_r<sc_subref_r<T>,sc_bv_base>
1296 {
1298  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
1299 }
1300 
1301 template <class T>
1302 inline
1303 sc_concref_r<sc_bv_base,sc_subref_r<T> >
1305 {
1307  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
1308 }
1309 
1310 #endif
1311 
1312 
1313 // ----------------------------------------------------------------------------
1314 // CLASS TEMPLATE : sc_subref<X>
1315 //
1316 // Proxy class for sc_proxy part selection (r-value and l-value).
1317 // ----------------------------------------------------------------------------
1318 
1319 template <class X>
1320 inline
1321 sc_subref<X>&
1323 {
1324  sc_lv_base t( b ); // (partial) self assignment protection
1325  int len = sc_min( this->length(), t.length() );
1326  if( ! this->reversed() ) {
1327  for( int i = len - 1; i >= 0; -- i ) {
1328  this->m_obj.set_bit( this->m_lo + i, t[i].value() );
1329  }
1330  } else {
1331  for( int i = len - 1; i >= 0; -- i ) {
1332  this->m_obj.set_bit( this->m_lo - i, t[i].value() );
1333  }
1334  }
1335  return *this;
1336 }
1337 
1338 template <class X>
1339 inline
1340 sc_subref<X>&
1342 {
1343  sc_lv_base t( b ); // (partial) self assignment protection
1344  int len = sc_min( this->length(), t.length() );
1345  if( ! this->reversed() ) {
1346  for( int i = len - 1; i >= 0; -- i ) {
1347  this->m_obj.set_bit( this->m_lo + i, t[i].value() );
1348  }
1349  } else {
1350  for( int i = len - 1; i >= 0; -- i ) {
1351  this->m_obj.set_bit( this->m_lo - i, t[i].value() );
1352  }
1353  }
1354  return *this;
1355 }
1356 
1357 
1358 // ----------------------------------------------------------------------------
1359 // CLASS TEMPLATE : sc_concref_r<X,Y>
1360 //
1361 // Proxy class for sc_proxy concatenation (r-value only).
1362 // ----------------------------------------------------------------------------
1363 
1364 // r-value concatenation operators and functions
1365 
1366 template <class T1, class T2>
1367 inline
1370 {
1372  *a.clone(), *new sc_lv_base( b ), 3 );
1373 }
1374 
1375 template <class T1, class T2>
1376 inline
1377 sc_concref_r<sc_lv_base,sc_concref_r<T1,T2> >
1379 {
1381  *new sc_lv_base( a ), *b.clone(), 3 );
1382 }
1383 
1384 template <class T1, class T2>
1385 inline
1386 sc_concref_r<sc_concref_r<T1,T2>,sc_lv_base>
1388 {
1390  *a.clone(), *new sc_lv_base( b, 1 ), 3 );
1391 }
1392 
1393 template <class T1, class T2>
1394 inline
1395 sc_concref_r<sc_lv_base,sc_concref_r<T1,T2> >
1397 {
1399  *new sc_lv_base( a, 1 ), *b.clone(), 3 );
1400 }
1401 
1402 template <class T1, class T2>
1403 inline
1404 sc_concref_r<sc_concref_r<T1,T2>,sc_bv_base>
1406 {
1408  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
1409 }
1410 
1411 template <class T1, class T2>
1412 inline
1413 sc_concref_r<sc_bv_base,sc_concref_r<T1,T2> >
1415 {
1417  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
1418 }
1419 
1420 
1421 template <class T1, class T2>
1422 inline
1423 sc_concref_r<sc_concref_r<T1,T2>,sc_lv_base>
1424 concat( sc_concref_r<T1,T2> a, const char* b )
1425 {
1427  ( *a.clone(), *new sc_lv_base( b ), 3 );
1428 }
1429 
1430 template <class T1, class T2>
1431 inline
1432 sc_concref_r<sc_lv_base,sc_concref_r<T1,T2> >
1433 concat( const char* a, sc_concref_r<T1,T2> b )
1434 {
1436  ( *new sc_lv_base( a ), *b.clone(), 3 );
1437 }
1438 
1439 template <class T1, class T2>
1440 inline
1441 sc_concref_r<sc_concref_r<T1,T2>,sc_lv_base>
1443 {
1445  ( *a.clone(), *new sc_lv_base( b, 1 ), 3 );
1446 }
1447 
1448 template <class T1, class T2>
1449 inline
1450 sc_concref_r<sc_lv_base,sc_concref_r<T1,T2> >
1452 {
1454  ( *new sc_lv_base( a, 1 ), *b.clone(), 3 );
1455 }
1456 
1457 template <class T1, class T2>
1458 inline
1459 sc_concref_r<sc_concref_r<T1,T2>,sc_bv_base>
1461 {
1463  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
1464 }
1465 
1466 template <class T1, class T2>
1467 inline
1468 sc_concref_r<sc_bv_base,sc_concref_r<T1,T2> >
1470 {
1472  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
1473 }
1474 
1475 
1476 #ifdef SC_DT_MIXED_COMMA_OPERATORS
1477 
1478 template <class T1, class T2>
1479 inline
1480 sc_concref_r<sc_concref_r<T1,T2>,sc_lv_base>
1482 {
1484  ( *a.clone(), *new sc_lv_base( b ), 3 );
1485 }
1486 
1487 template <class T1, class T2>
1488 inline
1489 sc_concref_r<sc_lv_base,sc_concref_r<T1,T2> >
1491 {
1493  ( *new sc_lv_base( a ), *b.clone(), 3 );
1494 }
1495 
1496 template <class T1, class T2>
1497 inline
1498 sc_concref_r<sc_concref_r<T1,T2>,sc_lv_base>
1500 {
1502  ( *a.clone(), *new sc_lv_base( b, 1 ), 3 );
1503 }
1504 
1505 template <class T1, class T2>
1506 inline
1507 sc_concref_r<sc_lv_base,sc_concref_r<T1,T2> >
1509 {
1511  ( *new sc_lv_base( a, 1 ), *b.clone(), 3 );
1512 }
1513 
1514 template <class T1, class T2>
1515 inline
1516 sc_concref_r<sc_concref_r<T1,T2>,sc_bv_base>
1518 {
1520  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
1521 }
1522 
1523 template <class T1, class T2>
1524 inline
1525 sc_concref_r<sc_bv_base,sc_concref_r<T1,T2> >
1527 {
1529  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
1530 }
1531 
1532 
1533 template <class T1, class T2>
1534 inline
1535 sc_concref_r<sc_concref_r<T1,T2>,sc_lv_base>
1536 concat( sc_concref<T1,T2> a, const char* b )
1537 {
1539  ( *a.clone(), *new sc_lv_base( b ), 3 );
1540 }
1541 
1542 template <class T1, class T2>
1543 inline
1544 sc_concref_r<sc_lv_base,sc_concref_r<T1,T2> >
1545 concat( const char* a, sc_concref<T1,T2> b )
1546 {
1548  ( *new sc_lv_base( a ), *b.clone(), 3 );
1549 }
1550 
1551 template <class T1, class T2>
1552 inline
1553 sc_concref_r<sc_concref_r<T1,T2>,sc_lv_base>
1555 {
1557  ( *a.clone(), *new sc_lv_base( b, 1 ), 3 );
1558 }
1559 
1560 template <class T1, class T2>
1561 inline
1562 sc_concref_r<sc_lv_base,sc_concref_r<T1,T2> >
1564 {
1566  ( *new sc_lv_base( a, 1 ), *b.clone(), 3 );
1567 }
1568 
1569 template <class T1, class T2>
1570 inline
1571 sc_concref_r<sc_concref_r<T1,T2>,sc_bv_base>
1573 {
1575  ( *a.clone(), *new sc_bv_base( b, 1 ), 3 );
1576 }
1577 
1578 template <class T1, class T2>
1579 inline
1580 sc_concref_r<sc_bv_base,sc_concref_r<T1,T2> >
1582 {
1584  ( *new sc_bv_base( a, 1 ), *b.clone(), 3 );
1585 }
1586 
1587 #endif
1588 
1589 
1590 // ----------------------------------------------------------------------------
1591 // CLASS TEMPLATE : sc_proxy<T>
1592 //
1593 // Base class template for bit/logic vector classes.
1594 // (Barton/Nackmann implementation)
1595 // ----------------------------------------------------------------------------
1596 
1597 // r-value concatenation operators and functions
1598 
1599 template <class T>
1600 inline
1601 sc_concref_r<T,sc_lv_base>
1602 operator , ( const sc_proxy<T>& a, const char* b )
1603 {
1605  ( a.back_cast(), *new sc_lv_base( b ), 2 );
1606 }
1607 
1608 template <class T>
1609 inline
1610 sc_concref_r<sc_lv_base,T>
1611 operator , ( const char* a, const sc_proxy<T>& b )
1612 {
1614  ( *new sc_lv_base( a ), b.back_cast(), 1 );
1615 }
1616 
1617 template <class T>
1618 inline
1619 sc_concref_r<T,sc_lv_base>
1620 operator , ( const sc_proxy<T>& a, const sc_logic& b )
1621 {
1623  ( a.back_cast(), *new sc_lv_base( b, 1 ), 2 );
1624 }
1625 
1626 template <class T>
1627 inline
1628 sc_concref_r<sc_lv_base,T>
1629 operator , ( const sc_logic& a, const sc_proxy<T>& b )
1630 {
1632  ( *new sc_lv_base( a, 1 ), b.back_cast(), 1 );
1633 }
1634 
1635 template <class T>
1636 inline
1637 sc_concref_r<T,sc_bv_base>
1638 operator , ( const sc_proxy<T>& a, bool b )
1639 {
1641  ( a.back_cast(), *new sc_bv_base( b, 1 ), 2 );
1642 }
1643 
1644 template <class T>
1645 inline
1646 sc_concref_r<sc_bv_base,T>
1647 operator , ( bool a, const sc_proxy<T>& b )
1648 {
1650  ( *new sc_bv_base( a, 1 ), b.back_cast(), 1 );
1651 }
1652 
1653 
1654 template <class T>
1655 inline
1656 sc_concref_r<T,sc_lv_base>
1657 concat( const sc_proxy<T>& a, const char* b )
1658 {
1660  ( a.back_cast(), *new sc_lv_base( b ), 2 );
1661 }
1662 
1663 template <class T>
1664 inline
1665 sc_concref_r<sc_lv_base,T>
1666 concat( const char* a, const sc_proxy<T>& b )
1667 {
1669  ( *new sc_lv_base( a ), b.back_cast(), 1 );
1670 }
1671 
1672 template <class T>
1673 inline
1674 sc_concref_r<T,sc_lv_base>
1675 concat( const sc_proxy<T>& a, const sc_logic& b )
1676 {
1678  ( a.back_cast(), *new sc_lv_base( b, 1 ), 2 );
1679 }
1680 
1681 template <class T>
1682 inline
1683 sc_concref_r<sc_lv_base,T>
1684 concat( const sc_logic& a, const sc_proxy<T>& b )
1685 {
1687  ( *new sc_lv_base( a, 1 ), b.back_cast(), 1 );
1688 }
1689 
1690 template <class T>
1691 inline
1692 sc_concref_r<T,sc_bv_base>
1693 concat( const sc_proxy<T>& a, bool b )
1694 {
1696  ( a.back_cast(), *new sc_bv_base( b, 1 ), 2 );
1697 }
1698 
1699 template <class T>
1700 inline
1701 sc_concref_r<sc_bv_base,T>
1702 concat( bool a, const sc_proxy<T>& b )
1703 {
1705  ( *new sc_bv_base( a, 1 ), b.back_cast(), 1 );
1706 }
1707 
1708 
1709 #ifdef SC_DT_MIXED_COMMA_OPERATORS
1710 
1711 template <class T>
1712 inline
1713 sc_concref_r<T,sc_lv_base>
1714 operator , ( sc_proxy<T>& a, const char* b )
1715 {
1717  ( a.back_cast(), *new sc_lv_base( b ), 2 );
1718 }
1719 
1720 template <class T>
1721 inline
1722 sc_concref_r<sc_lv_base,T>
1723 operator , ( const char* a, sc_proxy<T>& b )
1724 {
1726  ( *new sc_lv_base( a ), b.back_cast(), 1 );
1727 }
1728 
1729 template <class T>
1730 inline
1731 sc_concref_r<T,sc_lv_base>
1733 {
1735  ( a.back_cast(), *new sc_lv_base( b, 1 ), 2 );
1736 }
1737 
1738 template <class T>
1739 inline
1740 sc_concref_r<sc_lv_base,T>
1742 {
1744  ( *new sc_lv_base( a, 1 ), b.back_cast(), 1 );
1745 }
1746 
1747 template <class T>
1748 inline
1749 sc_concref_r<T,sc_bv_base>
1751 {
1753  ( a.back_cast(), *new sc_bv_base( b, 1 ), 2 );
1754 }
1755 
1756 template <class T>
1757 inline
1758 sc_concref_r<sc_bv_base,T>
1760 {
1762  ( *new sc_bv_base( a, 1 ), b.back_cast(), 1 );
1763 }
1764 
1765 
1766 template <class T>
1767 inline
1768 sc_concref_r<T,sc_lv_base>
1769 concat( sc_proxy<T>& a, const char* b )
1770 {
1772  ( a.back_cast(), *new sc_lv_base( b ), 2 );
1773 }
1774 
1775 template <class T>
1776 inline
1777 sc_concref_r<sc_lv_base,T>
1778 concat( const char* a, sc_proxy<T>& b )
1779 {
1781  ( *new sc_lv_base( a ), b.back_cast(), 1 );
1782 }
1783 
1784 template <class T>
1785 inline
1786 sc_concref_r<T,sc_lv_base>
1788 {
1790  ( a.back_cast(), *new sc_lv_base( b, 1 ), 2 );
1791 }
1792 
1793 template <class T>
1794 inline
1795 sc_concref_r<sc_lv_base,T>
1797 {
1799  ( *new sc_lv_base( a, 1 ), b.back_cast(), 1 );
1800 }
1801 
1802 template <class T>
1803 inline
1804 sc_concref_r<T,sc_bv_base>
1805 concat( sc_proxy<T>& a, bool b )
1806 {
1808  ( a.back_cast(), *new sc_bv_base( b, 1 ), 2 );
1809 }
1810 
1811 template <class T>
1812 inline
1813 sc_concref_r<sc_bv_base,T>
1814 concat( bool a, sc_proxy<T>& b )
1815 {
1817  ( *new sc_bv_base( a, 1 ), b.back_cast(), 1 );
1818 }
1819 
1820 #endif
1821 
1822 } // namespace sc_dt
1823 
1824 
1825 #endif
#define DEFN_BITWISE_XOR_OP_T_B(tp)
Definition: sc_lv_base.h:654
const sc_lv_base rrotate(const sc_proxy< X > &x, int n)
Definition: sc_lv_base.h:776
sc_lv_base & assign_(const sc_proxy< Y > &a)
Definition: sc_proxy.h:218
const sc_bit operator|(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:332
int size() const
Definition: sc_lv_base.h:247
const sc_lv_base operator~() const
sc_concref_r< X, Y > * clone() const
#define DEFN_BITWISE_AND_OP_T_A(tp)
Definition: sc_lv_base.h:423
sc_bitref_r< T > * clone() const
void set_bit(int i, sc_logic_value_t value)
Definition: sc_lv_base.h:326
unsigned int sc_digit
Definition: sc_nbdefs.h:173
const sc_digit SC_DIGIT_ONE
Definition: sc_proxy.h:95
virtual ~sc_lv_base()
Definition: sc_lv_base.h:147
#define DEFN_REL_OP_T(tp)
Definition: sc_lv_base.h:820
sc_logic_value_t get_bit(int i) const
Definition: sc_lv_base.h:316
uint64_t uint64
Definition: sc_nbdefs.h:183
#define DEFN_BITWISE_AND_OP_T_B(tp)
Definition: sc_lv_base.h:450
const int SC_DIGIT_SIZE
Definition: sc_proxy.h:92
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
Definition: sc_lv_base.h:379
sc_concref_r< sc_bitref_r< T1 >, sc_bitref_r< T2 > > concat(sc_bitref_r< T1 >, sc_bitref_r< T2 >)
sc_digit get_cword(int wi) const
Definition: sc_lv_base.h:264
sc_clock period is zero sc_clock low time is zero sc_fifo< T > cannot have more than one writer bind interface to port failed complete binding failed remove port failed insert primitive channel failed sc_signal< T > cannot have more than one driver resolved port not bound to resolved signal sc_semaphore requires an initial value
uint64 const sc_uint_base int b
Definition: sc_fxval.h:1003
sc_concref< X, Y > * clone() const
#define DEFN_BITWISE_OR_ASN_OP_T(tp)
Definition: sc_lv_base.h:490
const sc_logic SC_LOGIC_X
sc_lv_base(const sc_logic &a, int length_=sc_length_param().len())
Definition: sc_lv_base.h:108
const sc_lv_base lrotate(const sc_proxy< X > &x, int n)
Definition: sc_lv_base.h:737
int64_t int64
Definition: sc_nbdefs.h:182
const sc_bit operator&(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:329
sc_digit * m_ctrl
Definition: sc_lv_base.h:282
bool is_01() const
const sc_lv_base operator<<(int n) const
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
Definition: sc_lv_base.h:481
const T sc_min(const T &a, const T &b)
Definition: sc_macros.h:37
sc_lv_base & operator>>=(int n)
X & b_and_assign_(sc_proxy< X > &px, const sc_proxy< Y > &py)
Definition: sc_proxy.h:1065
void assign_p_(sc_proxy< X > &px, const sc_proxy< Y > &py)
Definition: sc_proxy.h:742
const sc_bit operator^(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:335
sc_lv_base & operator<<=(int n)
sc_lv_base(int length_=sc_length_param().len())
Definition: sc_lv_base.h:104
#define DEFN_BITWISE_AND_ASN_OP_T(tp)
Definition: sc_lv_base.h:388
sc_logic_value_t
Definition: sc_logic.h:85
sc_bitref< X > * clone() const
#define DEFN_BITWISE_OR_OP_T_A(tp)
Definition: sc_lv_base.h:525
#define DEFN_BITWISE_OR_OP_T_B(tp)
Definition: sc_lv_base.h:552
void set_cword(int wi, sc_digit w)
Definition: sc_lv_base.h:267
const sc_lv_base operator>>(int n) const
const sc_lv_base reverse(const sc_proxy< X > &x)
Definition: sc_lv_base.h:788
const char SC_ID_OUT_OF_BOUNDS_[]
sc_subref< X > * clone() const
X & b_xor_assign_(sc_proxy< X > &a, const sc_proxy< Y > &b)
Definition: sc_proxy.h:1113
sc_concref_r< sc_bitref_r< T1 >, sc_bitref_r< T2 > > operator,(sc_bitref_r< T1 >, sc_bitref_r< T2 >)
X & b_or_assign_(sc_proxy< X > &px, const sc_proxy< Y > &py)
Definition: sc_proxy.h:1089
sc_lv_base(const sc_proxy< X > &a)
Definition: sc_lv_base.h:118
int length() const
Definition: sc_unsigned.h:1226
int length() const
Definition: sc_lv_base.h:244
sc_lv_base & lrotate(int n)
sc_lv_base & operator=(const sc_proxy< X > &a)
Definition: sc_lv_base.h:154
#define SC_REPORT_ERROR(msg_type, msg)
Definition: sc_report.h:213
sc_lv_base & rrotate(int n)
bool operator==(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:283
#define DEFN_BITWISE_XOR_ASN_OP_T(tp)
Definition: sc_lv_base.h:592
#define DEFN_BITWISE_XOR_OP_T_A(tp)
Definition: sc_lv_base.h:627
X & back_cast()
Definition: sc_proxy.h:208
const sc_digit SC_DIGIT_TWO
Definition: sc_proxy.h:96
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
Definition: sc_lv_base.h:583
void set_word(int wi, sc_digit w)
Definition: sc_lv_base.h:260
sc_subref< X > & operator=(const sc_proxy< Y > &a)
const sc_digit SC_DIGIT_ZERO
Definition: sc_proxy.h:94
sc_proxy< sc_lv_base > base_type
Definition: sc_lv_base.h:99
sc_digit * m_data
Definition: sc_lv_base.h:281
sc_subref_r< X > * clone() const
sc_digit get_word(int wi) const
Definition: sc_lv_base.h:253