gem5  v20.1.0.0
sc_length_param.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_length_param.h -
23 
24  Original Author: Martin Janssen, Synopsys, Inc., 2002-03-19
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_length_param.h,v $
39 // Revision 1.3 2011/08/24 22:05:46 acg
40 // Torsten Maehne: initialization changes to remove warnings.
41 //
42 // Revision 1.2 2011/02/18 20:19:15 acg
43 // Andy Goodrich: updating Copyright notice.
44 //
45 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
46 // SystemC 2.3
47 //
48 // Revision 1.4 2006/05/08 17:50:01 acg
49 // Andy Goodrich: Added David Long's declarations for friend operators,
50 // functions, and methods, to keep the Microsoft compiler happy.
51 //
52 // Revision 1.3 2006/01/13 18:49:32 acg
53 // Added $Log command so that CVS check in comments are reproduced in the
54 // source.
55 //
56 
57 #ifndef __SYSTEMC_EXT_DT_INT_SC_LENGTH_PARAM_HH__
58 #define __SYSTEMC_EXT_DT_INT_SC_LENGTH_PARAM_HH__
59 
60 #include <iostream>
61 
62 #include "../fx/sc_context.hh"
63 #include "../fx/sc_fxdefs.hh"
64 
65 namespace sc_dt
66 {
67 
68 // classes defined in this module
69 class sc_length_param;
70 
71 // friend operator declarations
72 bool operator == (const sc_length_param &, const sc_length_param &);
73 bool operator != (const sc_length_param &, const sc_length_param &);
74 
75 
76 // ----------------------------------------------------------------------------
77 // CLASS : sc_length_param
78 //
79 // Length parameter type.
80 // ----------------------------------------------------------------------------
81 
82 class sc_length_param
83 {
84  public:
86  sc_length_param(int);
88  explicit sc_length_param(sc_without_context);
89 
91 
92  friend bool operator == (const sc_length_param &, const sc_length_param &);
93  friend bool operator != (const sc_length_param &, const sc_length_param &);
94 
95  int len() const;
96  void len(int);
97 
98  const std::string to_string() const;
99 
100  void print(::std::ostream & =::std::cout) const;
101  void dump(::std::ostream & =::std::cout) const;
102 
103  private:
104  int m_len;
105 };
106 
107 } // namespace sc_dt
108 
109 // ----------------------------------------------------------------------------
110 // TYPEDEF : sc_length_context
111 //
112 // Context type for the length parameter type.
113 // ----------------------------------------------------------------------------
114 
115 namespace sc_dt
116 {
117 
118 extern template class sc_global<sc_length_param>;
119 extern template class sc_context<sc_length_param>;
120 
122 
123 
124 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
125 
127 {
129 }
130 
131 inline sc_length_param::sc_length_param(int len_) : m_len(len_)
132 {
133  SC_CHECK_WL_(len_);
134 }
135 
137  m_len(a.m_len)
138 {}
139 
141  m_len(SC_DEFAULT_WL_)
142 {}
143 
144 
145 inline sc_length_param &
147 {
148  if (&a != this) {
149  m_len = a.m_len;
150  }
151  return *this;
152 }
153 
154 
155 inline bool
157 {
158  return (a.m_len == b.m_len);
159 }
160 
161 inline bool
163 {
164  return (a.m_len != b.m_len);
165 }
166 
167 
168 inline int
170 {
171  return m_len;
172 }
173 
174 inline void
176 {
177  SC_CHECK_WL_(len_);
178  m_len = len_;
179 }
180 
181 
182 inline ::std::ostream &
183 operator << (::std::ostream &os, const sc_length_param &a)
184 {
185  a.print(os);
186  return os;
187 }
188 
189 } // namespace sc_dt
190 
191 
192 #endif // __SYSTEMC_EXT_DT_INT_SC_LENGTH_PARAM_HH__
X86ISA::os
Bitfield< 17 > os
Definition: misc.hh:803
sc_dt
Definition: sc_bit.cc:67
sc_dt::sc_length_param::operator=
sc_length_param & operator=(const sc_length_param &)
Definition: sc_length_param.hh:146
sc_dt::operator<<
sc_signed operator<<(const sc_signed &u, const sc_int_base &v)
Definition: sc_signed.cc:853
sc_dt::sc_length_param::dump
void dump(::std::ostream &=::std::cout) const
Definition: sc_length_param.cc:114
sc_dt::sc_global
Definition: sc_context.hh:104
sc_dt::sc_length_param::print
void print(::std::ostream &=::std::cout) const
Definition: sc_length_param.cc:108
sc_dt::sc_without_context
Definition: sc_context.hh:115
sc_dt::operator==
bool operator==(const sc_signed &u, const sc_int_base &v)
Definition: sc_signed.cc:879
sc_dt::SC_DEFAULT_WL_
const int SC_DEFAULT_WL_
Definition: sc_fxdefs.hh:189
sc_dt::sc_length_param::operator==
friend bool operator==(const sc_length_param &, const sc_length_param &)
Definition: sc_length_param.hh:156
sc_dt::sc_length_param::sc_length_param
sc_length_param()
Definition: sc_length_param.hh:126
ArmISA::a
Bitfield< 8 > a
Definition: miscregs_types.hh:62
sc_dt::operator!=
bool operator!=(const sc_signed &u, const sc_int_base &v)
Definition: sc_signed.cc:892
sc_dt::sc_length_param::to_string
const std::string to_string() const
Definition: sc_length_param.cc:100
sc_dt::sc_length_context
sc_context< sc_length_param > sc_length_context
Definition: sc_length_param.hh:121
ArmISA::b
Bitfield< 7 > b
Definition: miscregs_types.hh:376
sc_dt::sc_length_param::operator!=
friend bool operator!=(const sc_length_param &, const sc_length_param &)
Definition: sc_length_param.hh:162
SC_CHECK_WL_
#define SC_CHECK_WL_(wl)
Definition: sc_fxdefs.hh:253
sc_dt::sc_context::default_value
static const T & default_value()
Definition: sc_context.hh:299
sc_dt::sc_length_param
Definition: sc_length_param.hh:113
sc_dt::sc_context
Definition: sc_context.hh:106
sc_dt::sc_length_param::m_len
int m_len
Definition: sc_length_param.hh:135
sc_dt::sc_length_param::len
int len() const
Definition: sc_length_param.hh:169

Generated on Wed Sep 30 2020 14:02:16 for gem5 by doxygen 1.8.17