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

Generated on Sat Jun 18 2022 08:12:34 for gem5 by doxygen 1.8.17