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