gem5  v20.1.0.0
sc_fxtype_params.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_fxtype_params.h -
23 
24  Original Author: Martin Janssen, Synopsys, Inc.
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_fxtype_params.h,v $
39 // Revision 1.2 2011/08/24 22:05:43 acg
40 // Torsten Maehne: initialization changes to remove warnings.
41 //
42 // Revision 1.1.1.1 2006/12/15 20:20:04 acg
43 // SystemC 2.3
44 //
45 // Revision 1.3 2006/01/13 18:53:58 acg
46 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
47 // the source.
48 //
49 
50 #ifndef __SYSTEMC_EXT_DT_FX_SC_FXTYPE_PARAMS_HH__
51 #define __SYSTEMC_EXT_DT_FX_SC_FXTYPE_PARAMS_HH__
52 
53 #include <iostream>
54 
55 #include "sc_context.hh"
56 #include "sc_fxdefs.hh"
57 
58 namespace sc_dt
59 {
60 
61 // classes defined in this module
62 class sc_fxtype_params;
63 
64 // ----------------------------------------------------------------------------
65 // CLASS : sc_fxtype_params
66 //
67 // Fixed-point type parameters class.
68 // ----------------------------------------------------------------------------
69 
70 class sc_fxtype_params
71 {
72  public:
74  sc_fxtype_params(int, int);
76  sc_fxtype_params(int, int, sc_q_mode, sc_o_mode, int=0);
78  sc_fxtype_params(const sc_fxtype_params &, int, int);
80  explicit sc_fxtype_params(sc_without_context);
81 
83 
84  friend bool operator == (const sc_fxtype_params &,
85  const sc_fxtype_params &);
86  friend bool operator != (const sc_fxtype_params &,
87  const sc_fxtype_params &);
88 
89  int wl() const;
90  void wl(int);
91 
92  int iwl() const;
93  void iwl(int);
94 
95  sc_q_mode q_mode() const;
96  void q_mode(sc_q_mode);
97 
98  sc_o_mode o_mode() const;
99  void o_mode(sc_o_mode);
100 
101  int n_bits() const;
102  void n_bits(int);
103 
104  const std::string to_string() const;
105 
106  void print(::std::ostream & =::std::cout) const;
107  void dump(::std::ostream & =::std::cout) const;
108 
109  private:
110  int m_wl;
111  int m_iwl;
114  int m_n_bits;
115 };
116 
117 } // namespace sc_dt
118 
119 // ----------------------------------------------------------------------------
120 // TYPEDEF : sc_fxtype_context
121 //
122 // Context type for the fixed-point type parameters.
123 // ----------------------------------------------------------------------------
124 
125 // extern template instantiations
126 namespace sc_dt
127 {
128 
129 extern template class sc_global<sc_fxtype_params>;
130 extern template class sc_context<sc_fxtype_params>;
132 
133 
134 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
135 
137  m_wl(), m_iwl(), m_q_mode(), m_o_mode(), m_n_bits()
138 {
140 }
141 
142 inline sc_fxtype_params::sc_fxtype_params(int wl_, int iwl_) :
143  m_wl(), m_iwl(), m_q_mode(), m_o_mode(), m_n_bits()
144 {
146 
147  SC_CHECK_WL_(wl_);
148  m_wl = wl_;
149  m_iwl = iwl_;
150 }
151 
153  sc_q_mode q_mode_, sc_o_mode o_mode_, int n_bits_) :
154  m_wl(), m_iwl(), m_q_mode(), m_o_mode(), m_n_bits()
155 {
157 
158  SC_CHECK_N_BITS_(n_bits_);
159  m_q_mode = q_mode_;
160  m_o_mode = o_mode_;
161  m_n_bits = n_bits_;
162 }
163 
165  int wl_, int iwl_, sc_q_mode q_mode_, sc_o_mode o_mode_, int n_bits_) :
166  m_wl(), m_iwl(), m_q_mode(), m_o_mode(), m_n_bits()
167 {
168  SC_CHECK_WL_(wl_);
169  SC_CHECK_N_BITS_(n_bits_);
170  m_wl = wl_;
171  m_iwl = iwl_;
172  m_q_mode = q_mode_;
173  m_o_mode = o_mode_;
174  m_n_bits = n_bits_;
175 }
176 
178  m_wl(a.m_wl), m_iwl(a.m_iwl), m_q_mode(a.m_q_mode),
179  m_o_mode(a.m_o_mode), m_n_bits(a.m_n_bits)
180 {}
181 
183  const sc_fxtype_params &a, int wl_, int iwl_) :
184  m_wl(wl_), m_iwl(iwl_), m_q_mode(a.m_q_mode), m_o_mode(a.m_o_mode),
185  m_n_bits(a.m_n_bits)
186 {}
187 
189  const sc_fxtype_params &a, sc_q_mode q_mode_, sc_o_mode o_mode_,
190  int n_bits_) :
191  m_wl(a.m_wl), m_iwl(a.m_iwl), m_q_mode(q_mode_), m_o_mode(o_mode_),
192  m_n_bits(n_bits_)
193 {}
194 
196  m_wl(SC_DEFAULT_WL_), m_iwl(SC_DEFAULT_IWL_),
197  m_q_mode(SC_DEFAULT_Q_MODE_), m_o_mode(SC_DEFAULT_O_MODE_),
198  m_n_bits(SC_DEFAULT_N_BITS_)
199 {}
200 
201 inline sc_fxtype_params &
203 {
204  if (&a != this) {
205  m_wl = a.m_wl;
206  m_iwl = a.m_iwl;
207  m_q_mode = a.m_q_mode;
208  m_o_mode = a.m_o_mode;
209  m_n_bits = a.m_n_bits;
210  }
211  return *this;
212 }
213 
214 inline bool
216 {
217  return (a.m_wl == b.m_wl && a.m_iwl == b.m_iwl &&
218  a.m_q_mode == b.m_q_mode && a.m_o_mode == b.m_o_mode &&
219  a.m_n_bits == b.m_n_bits);
220 }
221 
222 inline bool
224 {
225  return (a.m_wl != b.m_wl || a.m_iwl != b.m_iwl ||
226  a.m_q_mode != b.m_q_mode || a.m_o_mode != b.m_o_mode ||
227  a.m_n_bits != b.m_n_bits );
228 }
229 
230 inline int sc_fxtype_params::wl() const { return m_wl; }
231 inline void
233 {
234  SC_CHECK_WL_(wl_);
235  m_wl = wl_;
236 }
237 
238 inline int sc_fxtype_params::iwl() const { return m_iwl; }
239 inline void sc_fxtype_params::iwl(int iwl_) { m_iwl = iwl_; }
240 
241 
242 inline sc_q_mode sc_fxtype_params::q_mode() const { return m_q_mode; }
243 inline void sc_fxtype_params::q_mode(sc_q_mode q_mode_) { m_q_mode = q_mode_; }
244 
245 inline sc_o_mode sc_fxtype_params::o_mode() const { return m_o_mode; }
246 inline void sc_fxtype_params::o_mode(sc_o_mode o_mode_) { m_o_mode = o_mode_; }
247 
248 inline int sc_fxtype_params::n_bits() const { return m_n_bits; }
249 inline void
251 {
252  SC_CHECK_N_BITS_(n_bits_);
253  m_n_bits = n_bits_;
254 }
255 
256 inline ::std::ostream &
257 operator << (::std::ostream &os, const sc_fxtype_params &a)
258 {
259  a.print(os);
260  return os;
261 }
262 
263 } // namespace sc_dt
264 
265 #endif // __SYSTEMC_EXT_DT_FX_SC_FXTYPE_PARAM_HH__
sc_dt::sc_fxtype_params::m_wl
int m_wl
Definition: sc_fxtype_params.hh:141
X86ISA::os
Bitfield< 17 > os
Definition: misc.hh:803
SC_CHECK_N_BITS_
#define SC_CHECK_N_BITS_(n_bits)
Definition: sc_fxdefs.hh:255
sc_dt
Definition: sc_bit.cc:67
sc_dt::sc_fxtype_params::dump
void dump(::std::ostream &=::std::cout) const
Definition: sc_fxtype_params.cc:116
sc_dt::sc_fxtype_params::wl
int wl() const
Definition: sc_fxtype_params.hh:230
sc_dt::SC_DEFAULT_Q_MODE_
const sc_q_mode SC_DEFAULT_Q_MODE_
Definition: sc_fxdefs.hh:191
sc_dt::sc_o_mode
sc_o_mode
Definition: sc_fxdefs.hh:117
sc_dt::operator<<
sc_signed operator<<(const sc_signed &u, const sc_int_base &v)
Definition: sc_signed.cc:853
sc_dt::sc_fxtype_params::operator!=
friend bool operator!=(const sc_fxtype_params &, const sc_fxtype_params &)
Definition: sc_fxtype_params.hh:223
sc_dt::sc_fxtype_params::print
void print(::std::ostream &=::std::cout) const
Definition: sc_fxtype_params.cc:104
sc_dt::sc_fxtype_params::operator==
friend bool operator==(const sc_fxtype_params &, const sc_fxtype_params &)
Definition: sc_fxtype_params.hh:215
sc_dt::sc_fxtype_params::m_q_mode
sc_q_mode m_q_mode
Definition: sc_fxtype_params.hh:143
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_fxdefs.hh
sc_dt::sc_fxtype_params
Definition: sc_fxtype_params.hh:101
ArmISA::a
Bitfield< 8 > a
Definition: miscregs_types.hh:62
sc_dt::sc_q_mode
sc_q_mode
Definition: sc_fxdefs.hh:91
sc_dt::SC_DEFAULT_IWL_
const int SC_DEFAULT_IWL_
Definition: sc_fxdefs.hh:190
sc_dt::sc_fxtype_params::to_string
const std::string to_string() const
Definition: sc_fxtype_params.cc:96
sc_dt::sc_fxtype_params::q_mode
sc_q_mode q_mode() const
Definition: sc_fxtype_params.hh:242
sc_dt::operator!=
bool operator!=(const sc_signed &u, const sc_int_base &v)
Definition: sc_signed.cc:892
sc_dt::sc_fxtype_params::sc_fxtype_params
sc_fxtype_params()
Definition: sc_fxtype_params.hh:136
sc_dt::sc_fxtype_params::operator=
sc_fxtype_params & operator=(const sc_fxtype_params &)
Definition: sc_fxtype_params.hh:202
sc_dt::sc_fxtype_params::o_mode
sc_o_mode o_mode() const
Definition: sc_fxtype_params.hh:245
sc_dt::sc_fxtype_params::iwl
int iwl() const
Definition: sc_fxtype_params.hh:238
sc_dt::sc_fxtype_params::n_bits
int n_bits() const
Definition: sc_fxtype_params.hh:248
ArmISA::b
Bitfield< 7 > b
Definition: miscregs_types.hh:376
sc_dt::SC_DEFAULT_O_MODE_
const sc_o_mode SC_DEFAULT_O_MODE_
Definition: sc_fxdefs.hh:192
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_fxtype_params::m_iwl
int m_iwl
Definition: sc_fxtype_params.hh:142
sc_context.hh
sc_dt::SC_DEFAULT_N_BITS_
const int SC_DEFAULT_N_BITS_
Definition: sc_fxdefs.hh:193
sc_dt::sc_fxtype_params::m_o_mode
sc_o_mode m_o_mode
Definition: sc_fxtype_params.hh:144
sc_dt::sc_context
Definition: sc_context.hh:106
sc_dt::sc_fxtype_params::m_n_bits
int m_n_bits
Definition: sc_fxtype_params.hh:145
sc_dt::sc_fxtype_context
sc_context< sc_fxtype_params > sc_fxtype_context
Definition: sc_fxtype_params.hh:131

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