SystemC  2.3.1
Accellera SystemC proof-of-concept library
scfx_params.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  scfx_params.h -
21 
22  Original Author: Martin Janssen, Synopsys, Inc.
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: scfx_params.h,v $
37 // Revision 1.1.1.1 2006/12/15 20:20:04 acg
38 // SystemC 2.3
39 //
40 // Revision 1.3 2006/01/13 18:53:58 acg
41 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
42 // the source.
43 //
44 
45 #ifndef SCFX_PARAMS_H
46 #define SCFX_PARAMS_H
47 
48 
52 
53 
54 namespace sc_dt
55 {
56 
57 // classes defined in this module
58 class scfx_params;
59 
60 
61 // ----------------------------------------------------------------------------
62 // CLASS : scfx_params
63 //
64 // ...
65 // ----------------------------------------------------------------------------
66 
68 {
69 
70 public:
71 
72  // constructor
73 
75  sc_enc,
76  const sc_fxcast_switch& );
77 
78 
79  // query functions
80 
81  const sc_fxtype_params& type_params() const;
82  sc_enc enc() const;
83  const sc_fxcast_switch& cast_switch() const;
84 
85 
86  // shortcuts
87 
88  int wl() const;
89  int iwl() const;
90  int fwl() const;
91  sc_q_mode q_mode() const;
92  sc_o_mode o_mode() const;
93  int n_bits() const;
94 
95 
96  // dump content
97 
98  void dump( ::std::ostream& ) const;
99 
100 private:
101 
102  sc_fxtype_params m_type_params;
103  sc_enc m_enc;
104  sc_fxcast_switch m_cast_switch;
105 
106 };
107 
108 
109 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
110 
111 // constructor
112 
113 inline
115  sc_enc enc_,
116  const sc_fxcast_switch& cast_sw )
117 : m_type_params( type_params_ ),
118  m_enc( enc_ ),
119  m_cast_switch( cast_sw )
120 {
121  if( m_enc == SC_US_ && m_type_params.o_mode() == SC_WRAP_SM )
122  {
123  SC_REPORT_ERROR( sc_core::SC_ID_INVALID_O_MODE_,
124  "SC_WRAP_SM not defined for unsigned numbers" );
125  }
126 
127 }
128 
129 
130 // query functions
131 
132 inline
133 const sc_fxtype_params&
135 {
136  return m_type_params;
137 }
138 
139 inline
140 sc_enc
142 {
143  return m_enc;
144 }
145 
146 inline
147 const sc_fxcast_switch&
149 {
150  return m_cast_switch;
151 }
152 
153 
154 // shortcuts
155 
156 inline
157 int
159 {
160  return m_type_params.wl();
161 }
162 
163 inline
164 int
166 {
167  return m_type_params.iwl();
168 }
169 
170 inline
171 int
173 {
174  return ( m_type_params.wl() - m_type_params.iwl() );
175 }
176 
177 inline
178 sc_q_mode
180 {
181  return m_type_params.q_mode();
182 }
183 
184 inline
185 sc_o_mode
187 {
188  return m_type_params.o_mode();
189 }
190 
191 inline
192 int
194 {
195  return m_type_params.n_bits();
196 }
197 
198 
199 // dump content
200 
201 inline
202 void
203 scfx_params::dump( ::std::ostream& os ) const
204 {
205  os << "scfx_params" << ::std::endl;
206  os << "(" << ::std::endl;
207  os << "type_params = ";
208  m_type_params.dump( os );
209  os << "enc = " << m_enc << ::std::endl;
210  os << "cast_switch = ";
211  m_cast_switch.dump( os );
212  os << ")" << ::std::endl;
213 }
214 
215 } // namespace sc_dt
216 
217 
218 #endif
219 
220 // Taf!
int wl() const
Definition: scfx_params.h:158
sc_enc
Definition: sc_fxdefs.h:63
const sc_fxcast_switch & cast_switch() const
Definition: scfx_params.h:148
void dump(::std::ostream &=::std::cout) const
int iwl() const
Definition: scfx_params.h:165
scfx_params(const sc_fxtype_params &, sc_enc, const sc_fxcast_switch &)
Definition: scfx_params.h:114
sc_enc enc() const
Definition: scfx_params.h:141
sc_o_mode o_mode() const
sc_q_mode q_mode() const
Definition: scfx_params.h:179
sc_o_mode
Definition: sc_fxdefs.h:116
sc_q_mode q_mode() const
void dump(::std::ostream &) const
Definition: scfx_params.h:203
const sc_fxtype_params & type_params() const
Definition: scfx_params.h:134
int fwl() const
Definition: scfx_params.h:172
int n_bits() const
Definition: scfx_params.h:193
#define SC_REPORT_ERROR(msg_type, msg)
Definition: sc_report.h:213
sc_q_mode
Definition: sc_fxdefs.h:87
sc_o_mode o_mode() const
Definition: scfx_params.h:186
void dump(::std::ostream &=::std::cout) const