SystemC  Recoding Infrastructure for SystemC v0.6.3 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
sc_value_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_value_base.h -- Base class for SystemC bit values.
21 
22  Original Author: Andy Goodrich, Forte Design Systems
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  *****************************************************************************/
35 
36 // $Log: sc_value_base.h,v $
37 // Revision 1.4 2011/08/29 18:04:32 acg
38 // Philipp A. Hartmann: miscellaneous clean ups.
39 //
40 // Revision 1.3 2011/08/24 22:05:48 acg
41 // Torsten Maehne: initialization changes to remove warnings.
42 //
43 // Revision 1.2 2011/06/28 21:23:04 acg
44 // Andy Goodrich: merging of SCV tree.
45 //
46 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
47 // SystemC 2.3
48 //
49 // Revision 1.3 2006/01/13 18:54:01 acg
50 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
51 // the source.
52 //
53 
54 #ifndef SC_VALUE_BASE_H
55 #define SC_VALUE_BASE_H
56 
57 
59 
60 namespace sc_dt
61 {
62 
63 class sc_signed;
64 class sc_unsigned;
65 
66 // ----------------------------------------------------------------------------
67 // CLASS : sc_value_base
68 //
69 // Abstract base class of all SystemC native variables. It provides
70 // support for concatenation operations via a set of virtual methods.
71 // A general description of the methods appear with their default
72 // definitions in sc_object.cpp.
73 // ----------------------------------------------------------------------------
74 
76 {
77  friend class sc_concatref;
78  private:
79  virtual void concat_clear_data( bool to_ones=false );
80  virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const;
81  virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const;
82  virtual uint64 concat_get_uint64() const;
83  virtual int concat_length(bool* xz_present_p=0) const;
84  virtual void concat_set( int64 src, int low_i );
85  virtual void concat_set( const sc_signed& src, int low_i );
86  virtual void concat_set( const sc_unsigned& src, int low_i );
87  virtual void concat_set( uint64 src, int low_i );
88  public:
89  virtual ~sc_value_base() {}
90 };
91 
92 
93 // ----------------------------------------------------------------------------
94 // CLASS : sc_generic_base
95 //
96 // Proxy class for user-defined value classes and other classes that
97 // are defined outside of SystemC.
98 // The class is utilized as a base class for the arbitrary class:
99 //
100 // class my_class : public sc_generic_base<my_class>
101 //
102 // The purpose of the class is to allow to_XXXX methods defined within that
103 // class so that assignments and casts from the arbitrary class to native
104 // SystemC types are possible. To interact correctly with the SystemC library
105 // the class derived from sc_generic_base must implement the following
106 // methods:
107 // (1) uint64 to_uint64() const
108 // (2) int64 to_int64() const
109 // (3) void to_sc_unsigned( sc_unsigned& ) const
110 // (4) void to_sc_signed( sc_signed& ) const
111 // ----------------------------------------------------------------------------
112 template< class T >
114  public:
115  inline const T* operator-> () const
116  {
117  return (const T*)this;
118  }
119  inline T* operator-> ()
120  {
121  return (T*)this;
122  }
123 };
124 
125 } // namespace sc_dt
126 
127 #endif
int64_t int64
Definition: sc_nbdefs.h:182
unsigned int sc_digit
Definition: sc_nbdefs.h:173
virtual ~sc_value_base()
Definition: sc_value_base.h:89
uint64_t uint64
Definition: sc_nbdefs.h:183
const T * operator->() const