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