SystemC  2.3.1
Accellera SystemC proof-of-concept library
sc_concatref.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_concatref.h -- Concatenation support.
21 
22  Original Author: Andy Goodrich, Forte Design, 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 
34  Andy Goodrich, Forte Design Systems, 17 Nov 2002
35  Creation of sc_concatref class by merging the capabilities of
36  sc_int_concref, sc_int_concref, sc_uint_concref, sc_uint_concref,
37  and implementing the capabilities of sc_signed_concref, sc_signed_concref,
38  sc_unsigned_concref, and sc_unsigned_concref. The resultant class allows
39  mixed mode concatenations on the left and right sides of an assignment.
40 
41  *****************************************************************************/
42 
43 // $Log: sc_concatref.h,v $
44 // Revision 1.6 2011/08/24 22:05:48 acg
45 // Torsten Maehne: initialization changes to remove warnings.
46 //
47 // Revision 1.5 2009/11/17 19:58:15 acg
48 // Andy Goodrich: fix of shift rhs possibilities to include "int".
49 //
50 // Revision 1.4 2009/02/28 00:26:29 acg
51 // Andy Goodrich: bug fixes.
52 //
53 // Revision 1.3 2008/04/29 20:23:55 acg
54 // Andy Goodrich: fixed the code that assigns the value of a string to
55 // an sc_concatref instance.
56 //
57 // Revision 1.2 2008/02/14 20:57:26 acg
58 // Andy Goodrich: added casts to ~0 instances to keep MSVC compiler happy.
59 //
60 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
61 // SystemC 2.3
62 //
63 // Revision 1.4 2006/10/23 19:36:59 acg
64 // Andy Goodrich: changed casts for operations on concatenation values to
65 // mirror those of sc_unsigned. For instance, an sc_unsigned minus a value
66 // returns an sc_signed result, whereas an sc_concatref minus a value was
67 // returning an sc_unsigned result. Now both sc_unsigned and sc_concatref
68 // minus a value return an sc_signed result.
69 //
70 // Revision 1.3 2006/01/13 18:54:01 acg
71 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
72 // the source.
73 //
74 
75 #ifndef SC_CONCATREF_H
76 #define SC_CONCATREF_H
77 
78 #include "sysc/kernel/sc_object.h"
87 
88 namespace sc_core {
89  extern sc_byte_heap sc_temp_heap; // Temporary storage.
90 } // namespace sc_core
91 
92 namespace sc_dt
93 {
94 
95 // ----------------------------------------------------------------------------
96 // CLASS TEMPLATE : sc_concatref
97 //
98 // Proxy class for sized bit concatenation.
99 // ----------------------------------------------------------------------------
100 
101 class sc_concatref : public sc_generic_base<sc_concatref>, public sc_value_base
102 {
103 public:
105 
106  inline void initialize(
107  sc_value_base& left, sc_value_base& right )
108  {
109  bool left_xz; // True if x's and/or z's found in left.
110  bool right_xz; // True if x's and/or z's found in right.
111 
112  m_left_p = (sc_value_base*)&left;
113  m_right_p = (sc_value_base*)&right;
114  m_len_r = right.concat_length(&right_xz);
115  m_len = left.concat_length(&left_xz) + m_len_r;
116  m_flags = ( left_xz || right_xz ) ? cf_xz_present : cf_none;
117  }
118 
119 
120  inline void initialize(
121  const sc_value_base& left, const sc_value_base& right )
122  {
123  bool left_xz; // True if x's and/or z's found in left.
124  bool right_xz; // True if x's and/or z's found in right.
125 
126  m_left_p = (sc_value_base*)&left;
127  m_right_p = (sc_value_base*)&right;
128  m_len_r = right.concat_length(&right_xz);
129  m_len = left.concat_length(&left_xz) + m_len_r;
130  m_flags = ( left_xz || right_xz ) ? cf_xz_present : cf_none;
131  }
132 
133  // destructor
134 
135  virtual ~sc_concatref()
136  {}
137 
138 
139  // capacity
140 
141  unsigned int length() const
142  { return m_len; }
143 
144 #ifdef SC_DT_DEPRECATED
145  int bitwidth() const
146  { return length(); }
147 #endif
148 
149  // concatenation
150 
151  virtual int concat_length( bool* xz_present_p ) const
152  {
153  if ( xz_present_p )
154  *xz_present_p = m_flags & cf_xz_present ? true : false;
155  return m_len;
156  }
157 
158  virtual void concat_clear_data( bool to_ones )
159  {
160  m_left_p->concat_clear_data(to_ones);
161  m_right_p->concat_clear_data(to_ones);
162  }
163 
164  virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const
165  {
166  bool rnz = m_right_p->concat_get_ctrl( dst_p, low_i );
167  bool lnz = m_left_p->concat_get_ctrl( dst_p, low_i+m_len_r );
168  return rnz || lnz;
169  }
170 
171  virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const
172  {
173  bool rnz = m_right_p->concat_get_data( dst_p, low_i );
174  bool lnz = m_left_p->concat_get_data( dst_p, low_i+m_len_r );
175  return rnz || lnz;
176  }
177 
178  virtual uint64 concat_get_uint64() const
179  {
180  if ( m_len_r >= 64 )
181  return m_right_p->concat_get_uint64();
182  else
183  {
184  return (m_left_p->concat_get_uint64() << m_len_r) |
185  m_right_p->concat_get_uint64();
186  }
187  }
188 
189  virtual void concat_set( int64 src, int low_i )
190  {
191  m_right_p->concat_set( src, low_i );
192  m_left_p->concat_set( src, low_i+m_len_r);
193  }
194 
195  virtual void concat_set( const sc_signed& src, int low_i )
196  {
197  m_right_p->concat_set( src, low_i );
198  m_left_p->concat_set( src, low_i+m_len_r);
199  }
200 
201  virtual void concat_set( const sc_unsigned& src, int low_i )
202  {
203  m_right_p->concat_set( src, low_i );
204  m_left_p->concat_set( src, low_i+m_len_r);
205  }
206 
207  virtual void concat_set( uint64 src, int low_i )
208  {
209  m_right_p->concat_set( src, low_i );
210  m_left_p->concat_set( src, low_i+m_len_r);
211  }
212 
213 
214  // explicit conversions
215 
216  uint64 to_uint64() const
217  {
218  uint64 mask;
219  uint64 result;
220 
221  result = m_right_p->concat_get_uint64();
222  if ( m_len_r < 64 )
223  {
224  mask = (uint64)~0;
225  result = (m_left_p->concat_get_uint64() << m_len_r) |
226  (result & ~(mask << m_len_r));
227  }
228  if ( m_len < 64 )
229  {
230  mask = (uint64)~0;
231  result = result & ~(mask << m_len);
232  }
233  return result;
234  }
235 
236  const sc_unsigned& value() const
237  {
238  bool left_non_zero;
239  sc_unsigned* result_p = sc_unsigned::m_pool.allocate();
240  bool right_non_zero;
241 
242  result_p->nbits = result_p->num_bits(m_len);
243  result_p->ndigits = DIV_CEIL(result_p->nbits);
244  result_p->digit = (sc_digit*)sc_core::sc_temp_heap.allocate(
245  sizeof(sc_digit)*result_p->ndigits );
246 #if defined(_MSC_VER)
247  // workaround spurious initialisation issue on MS Visual C++
248  memset( result_p->digit, 0, sizeof(sc_digit)*result_p->ndigits );
249 #else
250  result_p->digit[result_p->ndigits-1] = 0;
251 #endif
252  right_non_zero = m_right_p->concat_get_data( result_p->digit, 0 );
253  left_non_zero = m_left_p->concat_get_data(result_p->digit, m_len_r);
254  if ( left_non_zero || right_non_zero )
255  result_p->sgn = SC_POS;
256  else
257  result_p->sgn = SC_ZERO;
258  return *result_p;
259  }
260 
261  int64 to_int64() const
262  {
263  return (int64)to_uint64();
264  }
265  int to_int() const
266  { return (int)to_int64(); }
267  unsigned int to_uint() const
268  { return (unsigned int)to_uint64(); }
269  long to_long() const
270  { return (long)to_int64(); }
271  unsigned long to_ulong() const
272  { return (unsigned long)to_uint64(); }
273  double to_double() const
274  { return value().to_double(); }
275 
276  void to_sc_signed( sc_signed& target ) const
277  { target = value(); }
278 
279  void to_sc_unsigned( sc_unsigned& target ) const
280  { target = value(); }
281 
282  // implicit conversions:
283 
284  operator uint64 () const
285  { return to_uint64(); }
286 
287  operator const sc_unsigned& () const
288  { return value(); }
289 
290  // unary operators:
291 
293  { return value(); }
294 
296  { return -value(); }
297 
299  { return ~value(); }
300 
301  // explicit conversion to character string
302 
303  const std::string to_string( sc_numrep numrep = SC_DEC ) const
304  { return value().to_string(numrep); }
305 
306  const std::string to_string( sc_numrep numrep, bool w_prefix ) const
307  { return value().to_string(numrep,w_prefix); }
308 
309 
310 
311  // assignments
312 
313  inline const sc_concatref& operator = ( int v )
314  {
315  m_right_p->concat_set((int64)v, 0);
316  m_left_p->concat_set((int64)v, m_len_r);
317  return *this;
318  }
319 
320  inline const sc_concatref& operator = ( long v )
321  {
322  m_right_p->concat_set((int64)v, 0);
323  m_left_p->concat_set((int64)v, m_len_r);
324  return *this;
325  }
326 
327  inline const sc_concatref& operator = ( int64 v )
328  {
329  m_right_p->concat_set(v, 0);
330  m_left_p->concat_set(v, m_len_r);
331  return *this;
332  }
333 
334  inline const sc_concatref& operator = ( unsigned int v )
335  {
336  m_right_p->concat_set((uint64)v, 0);
337  m_left_p->concat_set((uint64)v, m_len_r);
338  return *this;
339  }
340 
341  inline const sc_concatref& operator = ( unsigned long v )
342  {
343  m_right_p->concat_set((uint64)v, 0);
344  m_left_p->concat_set((uint64)v, m_len_r);
345  return *this;
346  }
347 
348  inline const sc_concatref& operator = ( uint64 v )
349  {
350  m_right_p->concat_set(v, 0);
351  m_left_p->concat_set(v, m_len_r);
352  return *this;
353  }
354 
356  {
357  sc_unsigned temp(v.length());
358  temp = v.value();
359  m_right_p->concat_set(temp, 0);
360  m_left_p->concat_set(temp, m_len_r);
361  return *this;
362  }
363 
364  const sc_concatref& operator = ( const sc_signed& v )
365  {
366  m_right_p->concat_set(v, 0);
367  m_left_p->concat_set(v, m_len_r);
368  return *this;
369  }
370 
372  {
373  m_right_p->concat_set(v, 0);
374  m_left_p->concat_set(v, m_len_r);
375  return *this;
376  }
377 
378  const sc_concatref& operator = ( const char* v_p )
379  {
380  sc_unsigned v(m_len);
381  v = v_p;
382  m_right_p->concat_set(v, 0);
383  m_left_p->concat_set(v, m_len_r);
384  return *this;
385  }
386 
388  {
389  sc_unsigned temp(v.length());
390  temp = v;
391  m_right_p->concat_set(temp, 0);
392  m_left_p->concat_set(temp, m_len_r);
393  return *this;
394  }
395 
397  {
398  sc_unsigned data(v.length());
399  data = v;
400  m_right_p->concat_set(data, 0);
401  m_left_p->concat_set(data, m_len_r);
402  return *this;
403  }
404 
405 
406  // reduce methods
407 
408  bool and_reduce() const
409  { return value().and_reduce(); }
410 
411  bool nand_reduce() const
412  { return value().nand_reduce(); }
413 
414  bool or_reduce() const
415  { return value().or_reduce(); }
416 
417  bool nor_reduce() const
418  { return value().nor_reduce(); }
419 
420  bool xor_reduce() const
421  { return value().xor_reduce(); }
422 
423  bool xnor_reduce() const
424  { return value().xnor_reduce(); }
425 
426  // other methods
427 
428  void print( ::std::ostream& os = ::std::cout ) const
429  { os << this->value(); }
430 
431  void scan( ::std::istream& is )
432  {
433  std::string s;
434  is >> s;
435  *this = s.c_str();
436  }
437 
438 public:
439  static sc_core::sc_vpool<sc_concatref> m_pool; // Pool of temporary objects.
440 
441 public:
443  cf_none = 0, // Normal value.
444  cf_xz_present = 1 // X and/or Z values present.
445  };
446 
447 protected:
448  sc_value_base* m_left_p; // Left hand operand of concatenation.
449  sc_value_base* m_right_p; // Right hand operand of concatenation.
450  int m_len; // Length of concatenation.
451  int m_len_r; // Length of m_rightt_p.
452  concat_flags m_flags; // Value is read only.
453 
454 private:
455  sc_concatref(const sc_concatref&);
456  sc_concatref() : m_left_p(0), m_right_p(0), m_len(0), m_len_r(0), m_flags()
457  {}
458 };
459 
460 
461 // functional notation for the reduce methods
462 
463 inline
464 bool
466 {
467  return a.and_reduce();
468 }
469 
470 inline
471 bool
473 {
474  return a.nand_reduce();
475 }
476 
477 inline
478 bool
480 {
481  return a.or_reduce();
482 }
483 
484 inline
485 bool
487 {
488  return a.nor_reduce();
489 }
490 
491 inline
492 bool
494 {
495  return a.xor_reduce();
496 }
497 
498 inline
499 bool
501 {
502  return a.xnor_reduce();
503 }
504 
505 
506 // SHIFT OPERATORS FOR sc_concatref OBJECT INSTANCES:
507 //
508 // Because sc_concatref has implicit casts to both uint64 and sc_unsigned
509 // it is necessary to disambiguate the use of the shift operators. We do
510 // this in favor of sc_unsigned so that precision is not lost. To get an
511 // integer-based result use a cast to uint64 before performing the shift.
512 
513 inline const sc_unsigned operator << (const sc_concatref& target, uint64 shift)
514 {
515  return target.value() << (int)shift;
516 }
517 
518 inline const sc_unsigned operator << (const sc_concatref& target, int64 shift)
519 {
520  return target.value() << (int)shift;
521 }
522 
523 inline const sc_unsigned operator << (
524  const sc_concatref& target, unsigned long shift )
525 {
526  return target.value() << (int)shift;
527 }
528 
529 inline const sc_unsigned operator << (
530  const sc_concatref& target, int shift )
531 {
532  return target.value() << shift;
533 }
534 
535 inline const sc_unsigned operator << (
536  const sc_concatref& target, unsigned int shift )
537 {
538  return target.value() << (int)shift;
539 }
540 
541 inline const sc_unsigned operator << ( const sc_concatref& target, long shift )
542 {
543  return target.value() << (int)shift;
544 }
545 
546 inline const sc_unsigned operator >> (const sc_concatref& target, uint64 shift)
547 {
548  return target.value() >> (int)shift;
549 }
550 
551 inline const sc_unsigned operator >> (const sc_concatref& target, int64 shift)
552 {
553  return target.value() >> (int)shift;
554 }
555 
556 inline const sc_unsigned operator >> (
557  const sc_concatref& target, unsigned long shift )
558 {
559  return target.value() >> (int)shift;
560 }
561 
562 inline const sc_unsigned operator >> (
563  const sc_concatref& target, int shift )
564 {
565  return target.value() >> shift;
566 }
567 
568 inline const sc_unsigned operator >> (
569  const sc_concatref& target, unsigned int shift )
570 {
571  return target.value() >> (int)shift;
572 }
573 
574 inline const sc_unsigned operator >> ( const sc_concatref& target, long shift )
575 {
576  return target.value() >> (int)shift;
577 }
578 
579 
580 // STREAM OPERATORS FOR sc_concatref OBJECT INSTANCES:
581 
582 inline
583 ::std::ostream&
584 operator << ( ::std::ostream& os, const sc_concatref& v )
585 {
586  return os << v.value();
587 }
588 
589 inline
590 ::std::istream&
591 operator >> ( ::std::istream& is, sc_concatref& a )
592 {
593  sc_unsigned temp(a.concat_length(0));
594  temp.scan( is );
595  a = temp;
596  return is;
597 }
598 
599 
600 // ----------------------------------------------------------------------------
601 // CLASS TEMPLATE : sc_concat_bool
602 //
603 // Proxy class for read-only boolean values in concatenations.
604 // ----------------------------------------------------------------------------
605 
607 {
608  protected:
609  static sc_core::sc_vpool<sc_concat_bool> m_pool; // Temporaries pool.
610  bool m_value; // Value for this obj.
611 
612  public:
613 
614  // constructor:
615 
617  : sc_value_base(), m_value()
618  {}
619 
620  // destructor:
621 
622  virtual ~sc_concat_bool()
623  { }
624 
625  // allocation of temporary object:
626 
627  static inline sc_concat_bool* allocate( bool v )
628  {
629  sc_concat_bool* result_p = m_pool.allocate();
630  result_p->m_value = v;
631  return result_p;
632  }
633 
634  // concatenation:
635 
636  virtual int concat_length( bool* xz_present_p ) const
637  {
638  if ( xz_present_p ) *xz_present_p = false;
639  return 1;
640  }
641 
642  virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const
643  {
644  int bit = 1 << (low_i % BITS_PER_DIGIT);
645  int word_i = low_i / BITS_PER_DIGIT;
646  dst_p[word_i] &= ~bit;
647  return false;
648  }
649 
650  virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const
651  {
652  int bit = 1 << (low_i % BITS_PER_DIGIT);
653  int word_i = low_i / BITS_PER_DIGIT;
654  if ( m_value )
655  dst_p[word_i] |= bit;
656  else
657  dst_p[word_i] &= ~bit;
658  return m_value;
659  }
660 
661  virtual uint64 concat_get_uint64() const
662  {
663  return m_value ? 1 : 0;
664  }
665 };
666 
667 
668 // ----------------------------------------------------------------------------
669 // ARITHMETIC AND LOGIC OPERATORS FOR sc_concatref
670 // ----------------------------------------------------------------------------
671 
672 #define SC_CONCAT_OP_TYPE(RESULT,OP,OTHER_TYPE) \
673  inline RESULT operator OP ( const sc_concatref& a, OTHER_TYPE b ) \
674  { \
675  return a.value() OP b; \
676  } \
677  inline RESULT operator OP ( OTHER_TYPE a, const sc_concatref& b ) \
678  { \
679  return a OP b.value(); \
680  }
681 
682 
683 #define SC_CONCAT_OP(RESULT,OP) \
684  inline RESULT operator OP ( const sc_concatref& a, const sc_concatref& b ) \
685  { \
686  return a.value() OP b.value(); \
687  } \
688  SC_CONCAT_OP_TYPE(const sc_signed,OP,int) \
689  SC_CONCAT_OP_TYPE(const sc_signed,OP,long) \
690  SC_CONCAT_OP_TYPE(const sc_signed,OP,int64) \
691  SC_CONCAT_OP_TYPE(RESULT,OP,unsigned int) \
692  SC_CONCAT_OP_TYPE(RESULT,OP,unsigned long) \
693  SC_CONCAT_OP_TYPE(RESULT,OP,uint64) \
694  SC_CONCAT_OP_TYPE(const sc_signed,OP,const sc_int_base&) \
695  SC_CONCAT_OP_TYPE(RESULT,OP,const sc_uint_base&) \
696  SC_CONCAT_OP_TYPE(const sc_signed,OP,const sc_signed&) \
697  SC_CONCAT_OP_TYPE(RESULT,OP,const sc_unsigned&) \
698  inline RESULT operator OP ( const sc_concatref& a, bool b ) \
699  { \
700  return a.value() OP (int)b; \
701  } \
702  inline RESULT operator OP ( bool a, const sc_concatref& b ) \
703  { \
704  return (int)a OP b.value(); \
705  }
706 
707 #define SC_CONCAT_BOOL_OP(OP) \
708  inline bool operator OP ( const sc_concatref& a, const sc_concatref& b ) \
709  { \
710  return a.value() OP b.value(); \
711  } \
712  SC_CONCAT_OP_TYPE(bool,OP,int) \
713  SC_CONCAT_OP_TYPE(bool,OP,long) \
714  SC_CONCAT_OP_TYPE(bool,OP,int64) \
715  SC_CONCAT_OP_TYPE(bool,OP,unsigned int) \
716  SC_CONCAT_OP_TYPE(bool,OP,unsigned long) \
717  SC_CONCAT_OP_TYPE(bool,OP,uint64) \
718  SC_CONCAT_OP_TYPE(bool,OP,const sc_int_base&) \
719  SC_CONCAT_OP_TYPE(bool,OP,const sc_uint_base&) \
720  SC_CONCAT_OP_TYPE(bool,OP,const sc_signed&) \
721  SC_CONCAT_OP_TYPE(bool,OP,const sc_unsigned&) \
722  inline bool operator OP ( const sc_concatref& a, bool b ) \
723  { \
724  return a.value() OP (int)b; \
725  } \
726  inline bool operator OP ( bool a, const sc_concatref& b ) \
727  { \
728  return (int)a OP b.value(); \
729  }
730 
731 SC_CONCAT_OP(const sc_unsigned,+)
732 SC_CONCAT_OP(const sc_signed,-)
733 SC_CONCAT_OP(const sc_unsigned,*)
734 SC_CONCAT_OP(const sc_unsigned,/)
735 SC_CONCAT_OP(const sc_unsigned,%)
736 SC_CONCAT_OP(const sc_unsigned,&)
737 SC_CONCAT_OP(const sc_unsigned,|)
738 SC_CONCAT_OP(const sc_unsigned,^)
745 
746 #undef SC_CONCAT_OP
747 #undef SC_CONCAT_OP_TYPE
748 
749 
750 // ----------------------------------------------------------------------------
751 // CONCATENATION FUNCTION AND OPERATOR FOR STANDARD SYSTEM C DATA TYPES:
752 // ----------------------------------------------------------------------------
753 
756 {
757  sc_dt::sc_concatref* result_p; // Proxy for the concatenation.
758 
759  result_p = sc_dt::sc_concatref::m_pool.allocate();
760  result_p->initialize( a, b );
761  return *result_p;
762 }
763 
764 inline
765 const
768 {
769  sc_dt::sc_concatref* result_p; // Proxy for the concatenation.
770 
771  result_p = sc_dt::sc_concatref::m_pool.allocate();
772  result_p->initialize( a, b );
773  return *result_p;
774 }
775 
776 inline
777 const
779 {
780  const sc_dt::sc_concat_bool* b_p; // Proxy for boolean value.
781  sc_dt::sc_concatref* result_p; // Proxy for the concatenation.
782 
784  result_p = sc_dt::sc_concatref::m_pool.allocate();
785  result_p->initialize( a, *b_p );
786  return *result_p;
787 }
788 
789 inline
790 const
792 {
793  const sc_dt::sc_concat_bool* a_p; // Proxy for boolean value.
794  sc_dt::sc_concatref* result_p; // Proxy for the concatenation.
795 
797  result_p = sc_dt::sc_concatref::m_pool.allocate();
798  result_p->initialize( *a_p, b );
799  return *result_p;
800 }
801 
804 {
805  sc_dt::sc_concatref* result_p; // Proxy for the concatenation.
806 
807  result_p = sc_dt::sc_concatref::m_pool.allocate();
808  result_p->initialize( a, b );
809  return *result_p;
810 }
811 
812 inline
813 const
816 {
817  sc_dt::sc_concatref* result_p; // Proxy for the concatenation.
818 
819  result_p = sc_dt::sc_concatref::m_pool.allocate();
820  result_p->initialize( a, b );
821  return *result_p;
822 }
823 
824 inline
825 const
827 {
828  const sc_dt::sc_concat_bool* b_p; // Proxy for boolean value.
829  sc_dt::sc_concatref* result_p; // Proxy for the concatenation.
830 
832  result_p = sc_dt::sc_concatref::m_pool.allocate();
833  result_p->initialize( a, *b_p );
834  return *result_p;
835 }
836 
837 inline
838 const
840 {
841  const sc_dt::sc_concat_bool* a_p; // Proxy for boolean value.
842  sc_dt::sc_concatref* result_p; // Proxy for the concatenation.
843 
845  result_p = sc_dt::sc_concatref::m_pool.allocate();
846  result_p->initialize( *a_p, b );
847  return *result_p;
848 }
849 
850 } // namespace sc_dt
851 
852 #endif // SC_CONCATREF_H
853 
#define SC_POS
Definition: sc_nbdefs.h:111
sc_logic_value_t nand_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1546
bool or_reduce() const
Definition: sc_concatref.h:414
bool nand_reduce() const
Definition: sc_unsigned.h:1234
void initialize(const sc_value_base &left, const sc_value_base &right)
Definition: sc_concatref.h:120
long to_long() const
Definition: sc_concatref.h:269
sc_numrep
Definition: sc_nbdefs.h:91
unsigned int sc_digit
Definition: sc_nbdefs.h:173
sc_logic_value_t or_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1554
void scan(::std::istream &is)
Definition: sc_concatref.h:431
bool and_reduce() const
uint64_t uint64
Definition: sc_nbdefs.h:183
bool xnor_reduce() const
Definition: sc_concatref.h:423
sc_concref_r< sc_bitref_r< T1 >, sc_bitref_r< T2 > > concat(sc_bitref_r< T1 >, sc_bitref_r< T2 >)
void initialize(sc_value_base &left, sc_value_base &right)
Definition: sc_concatref.h:106
sc_signed operator-() const
Definition: sc_concatref.h:295
void print(::std::ostream &os=::std::cout) const
Definition: sc_concatref.h:428
bool or_reduce() const
inline::std::istream & operator>>(::std::istream &is, sc_bit &a)
Definition: sc_bit.h:394
bool xor_reduce() const
#define BITS_PER_DIGIT
Definition: sc_nbdefs.h:137
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
Definition: sc_concatref.h:164
const std::string to_string(sc_numrep numrep=SC_DEC) const
Definition: sc_concatref.h:303
uint64 const sc_uint_base int b
Definition: sc_fxval.h:1003
sc_byte_heap sc_temp_heap
bool and_reduce() const
Definition: sc_concatref.h:408
sc_logic_value_t nor_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1562
void scan(::std::istream &is=::std::cin)
concat_flags m_flags
Definition: sc_concatref.h:452
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
Definition: sc_concatref.h:171
int length() const
Definition: sc_bv_base.h:228
int64_t int64
Definition: sc_nbdefs.h:182
virtual void concat_set(int64 src, int low_i)
Definition: sc_concatref.h:189
const std::string to_string(sc_numrep numrep, bool w_prefix) const
Definition: sc_concatref.h:306
sc_logic_value_t and_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1538
unsigned long to_ulong() const
Definition: sc_concatref.h:271
virtual void concat_set(uint64 src, int low_i)
Definition: sc_concatref.h:207
virtual uint64 concat_get_uint64() const
Definition: sc_concatref.h:661
virtual void concat_clear_data(bool to_ones)
Definition: sc_concatref.h:158
double to_double() const
bool nor_reduce() const
Definition: sc_unsigned.h:1239
virtual int concat_length(bool *xz_present_p) const
Definition: sc_concatref.h:636
uint64 to_uint64() const
Definition: sc_concatref.h:216
sc_value_base * m_right_p
Definition: sc_concatref.h:449
virtual ~sc_concatref()
Definition: sc_concatref.h:135
sc_unsigned operator~() const
Definition: sc_concatref.h:298
#define DIV_CEIL(x)
Definition: sc_nbdefs.h:154
bool xor_reduce() const
Definition: sc_concatref.h:420
const sc_unsigned & value() const
Definition: sc_concatref.h:236
sc_logic_value_t xnor_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1578
sc_concref_r< sc_bitref_r< T1 >, sc_bitref_r< T2 > > operator,(sc_bitref_r< T1 >, sc_bitref_r< T2 >)
bool xnor_reduce() const
Definition: sc_unsigned.h:1244
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
Definition: sc_concatref.h:642
static sc_core::sc_vpool< sc_concatref > m_pool
Definition: sc_concatref.h:439
int length() const
Definition: sc_lv_base.h:244
void to_sc_signed(sc_signed &target) const
Definition: sc_concatref.h:276
const sc_concatref & operator=(int v)
Definition: sc_concatref.h:313
virtual void concat_set(const sc_signed &src, int low_i)
Definition: sc_concatref.h:195
sc_unsigned operator+() const
Definition: sc_concatref.h:292
bool nand_reduce() const
Definition: sc_concatref.h:411
static sc_concat_bool * allocate(bool v)
Definition: sc_concatref.h:627
void to_sc_unsigned(sc_unsigned &target) const
Definition: sc_concatref.h:279
virtual uint64 concat_get_uint64() const
Definition: sc_concatref.h:178
const std::string to_string(sc_numrep numrep=SC_DEC) const
int to_int() const
Definition: sc_concatref.h:265
virtual int concat_length(bool *xz_present_p) const
Definition: sc_concatref.h:151
#define SC_CONCAT_BOOL_OP(OP)
Definition: sc_concatref.h:707
static sc_core::sc_vpool< sc_concat_bool > m_pool
Definition: sc_concatref.h:609
unsigned int to_uint() const
Definition: sc_concatref.h:267
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
Definition: sc_concatref.h:650
bool nor_reduce() const
Definition: sc_concatref.h:417
int64 to_int64() const
Definition: sc_concatref.h:261
unsigned int length() const
Definition: sc_concatref.h:141
sc_logic_value_t xor_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1570
double to_double() const
Definition: sc_concatref.h:273
#define SC_ZERO
Definition: sc_nbdefs.h:110
virtual void concat_set(const sc_unsigned &src, int low_i)
Definition: sc_concatref.h:201
sc_value_base * m_left_p
Definition: sc_concatref.h:448
#define SC_CONCAT_OP(RESULT, OP)
Definition: sc_concatref.h:683
static sc_core::sc_vpool< sc_unsigned > m_pool
Definition: sc_unsigned.h:1944
inline::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
Definition: sc_bit.h:386