00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef SC_FXTYPE_PARAMS_H
00049 #define SC_FXTYPE_PARAMS_H
00050
00051
00052 #include "sysc/datatypes/fx/sc_context.h"
00053
00054
00055 namespace sc_dt
00056 {
00057
00058
00059 class sc_fxtype_params;
00060
00061
00062
00063
00064
00065
00066
00067
00068 class sc_fxtype_params
00069 {
00070 public:
00071
00072 sc_fxtype_params();
00073 sc_fxtype_params( int, int );
00074 sc_fxtype_params( sc_q_mode, sc_o_mode, int = 0 );
00075 sc_fxtype_params( int, int, sc_q_mode, sc_o_mode, int = 0 );
00076 sc_fxtype_params( const sc_fxtype_params& );
00077 sc_fxtype_params( const sc_fxtype_params&,
00078 int, int );
00079 sc_fxtype_params( const sc_fxtype_params&,
00080 sc_q_mode, sc_o_mode, int = 0 );
00081 explicit sc_fxtype_params( sc_without_context );
00082
00083 sc_fxtype_params& operator = ( const sc_fxtype_params& );
00084
00085 friend bool operator == ( const sc_fxtype_params&,
00086 const sc_fxtype_params& );
00087 friend bool operator != ( const sc_fxtype_params&,
00088 const sc_fxtype_params& );
00089
00090 int wl() const;
00091 void wl( int );
00092
00093 int iwl() const;
00094 void iwl( int );
00095
00096 sc_q_mode q_mode() const;
00097 void q_mode( sc_q_mode );
00098
00099 sc_o_mode o_mode() const;
00100 void o_mode( sc_o_mode );
00101
00102 int n_bits() const;
00103 void n_bits( int );
00104
00105 const std::string to_string() const;
00106
00107 void print( ::std::ostream& = ::std::cout ) const;
00108 void dump( ::std::ostream& = ::std::cout ) const;
00109
00110 private:
00111
00112 int m_wl;
00113 int m_iwl;
00114 sc_q_mode m_q_mode;
00115 sc_o_mode m_o_mode;
00116 int m_n_bits;
00117 };
00118
00119
00120
00121
00122
00123
00124
00125
00126 typedef sc_context<sc_fxtype_params> sc_fxtype_context;
00127
00128
00129
00130
00131 inline
00132 sc_fxtype_params::sc_fxtype_params()
00133 : m_wl(), m_iwl(), m_q_mode(), m_o_mode(), m_n_bits()
00134 {
00135 *this = sc_fxtype_context::default_value();
00136 }
00137
00138 inline
00139 sc_fxtype_params::sc_fxtype_params( int wl_, int iwl_ )
00140 : m_wl(), m_iwl(), m_q_mode(), m_o_mode(), m_n_bits()
00141 {
00142 *this = sc_fxtype_context::default_value();
00143
00144 SC_CHECK_WL_( wl_ );
00145 m_wl = wl_;
00146 m_iwl = iwl_;
00147 }
00148
00149 inline
00150 sc_fxtype_params::sc_fxtype_params( sc_q_mode q_mode_,
00151 sc_o_mode o_mode_, int n_bits_ )
00152 : m_wl(), m_iwl(), m_q_mode(), m_o_mode(), m_n_bits()
00153 {
00154 *this = sc_fxtype_context::default_value();
00155
00156 SC_CHECK_N_BITS_( n_bits_ );
00157 m_q_mode = q_mode_;
00158 m_o_mode = o_mode_;
00159 m_n_bits = n_bits_;
00160 }
00161
00162 inline
00163 sc_fxtype_params::sc_fxtype_params( int wl_, int iwl_,
00164 sc_q_mode q_mode_,
00165 sc_o_mode o_mode_, int n_bits_ )
00166 : m_wl(), m_iwl(), m_q_mode(), m_o_mode(), m_n_bits()
00167 {
00168 SC_CHECK_WL_( wl_ );
00169 SC_CHECK_N_BITS_( n_bits_ );
00170 m_wl = wl_;
00171 m_iwl = iwl_;
00172 m_q_mode = q_mode_;
00173 m_o_mode = o_mode_;
00174 m_n_bits = n_bits_;
00175 }
00176
00177 inline
00178 sc_fxtype_params::sc_fxtype_params( const sc_fxtype_params& a )
00179 : m_wl( a.m_wl ), m_iwl( a.m_iwl ),
00180 m_q_mode( a.m_q_mode ),
00181 m_o_mode( a.m_o_mode ), m_n_bits( a.m_n_bits )
00182 {}
00183
00184 inline
00185 sc_fxtype_params::sc_fxtype_params( const sc_fxtype_params& a,
00186 int wl_, int iwl_ )
00187 : m_wl( wl_ ), m_iwl( iwl_ ),
00188 m_q_mode( a.m_q_mode ),
00189 m_o_mode( a.m_o_mode ), m_n_bits( a.m_n_bits )
00190 {}
00191
00192 inline
00193 sc_fxtype_params::sc_fxtype_params( const sc_fxtype_params& a,
00194 sc_q_mode q_mode_,
00195 sc_o_mode o_mode_, int n_bits_ )
00196 : m_wl( a.m_wl ), m_iwl( a.m_iwl ),
00197 m_q_mode( q_mode_ ),
00198 m_o_mode( o_mode_ ), m_n_bits( n_bits_ )
00199 {}
00200
00201 inline
00202 sc_fxtype_params::sc_fxtype_params( sc_without_context )
00203 : m_wl ( SC_DEFAULT_WL_ ),
00204 m_iwl ( SC_DEFAULT_IWL_ ),
00205 m_q_mode( SC_DEFAULT_Q_MODE_ ),
00206 m_o_mode( SC_DEFAULT_O_MODE_ ),
00207 m_n_bits( SC_DEFAULT_N_BITS_ )
00208 {}
00209
00210
00211 inline
00212 sc_fxtype_params&
00213 sc_fxtype_params::operator = ( const sc_fxtype_params& a )
00214 {
00215 if( &a != this )
00216 {
00217 m_wl = a.m_wl;
00218 m_iwl = a.m_iwl;
00219 m_q_mode = a.m_q_mode;
00220 m_o_mode = a.m_o_mode;
00221 m_n_bits = a.m_n_bits;
00222 }
00223 return *this;
00224 }
00225
00226
00227 inline
00228 bool
00229 operator == ( const sc_fxtype_params& a, const sc_fxtype_params& b )
00230 {
00231 return ( a.m_wl == b.m_wl &&
00232 a.m_iwl == b.m_iwl &&
00233 a.m_q_mode == b.m_q_mode &&
00234 a.m_o_mode == b.m_o_mode &&
00235 a.m_n_bits == b.m_n_bits );
00236 }
00237
00238 inline
00239 bool
00240 operator != ( const sc_fxtype_params& a, const sc_fxtype_params& b )
00241 {
00242 return ( a.m_wl != b.m_wl ||
00243 a.m_iwl != b.m_iwl ||
00244 a.m_q_mode != b.m_q_mode ||
00245 a.m_o_mode != b.m_o_mode ||
00246 a.m_n_bits != b.m_n_bits );
00247 }
00248
00249
00250 inline
00251 int
00252 sc_fxtype_params::wl() const
00253 {
00254 return m_wl;
00255 }
00256
00257 inline
00258 void
00259 sc_fxtype_params::wl( int wl_ )
00260 {
00261 SC_CHECK_WL_( wl_ );
00262 m_wl = wl_;
00263 }
00264
00265
00266 inline
00267 int
00268 sc_fxtype_params::iwl() const
00269 {
00270 return m_iwl;
00271 }
00272
00273 inline
00274 void
00275 sc_fxtype_params::iwl( int iwl_ )
00276 {
00277 m_iwl = iwl_;
00278 }
00279
00280
00281 inline
00282 sc_q_mode
00283 sc_fxtype_params::q_mode() const
00284 {
00285 return m_q_mode;
00286 }
00287
00288 inline
00289 void
00290 sc_fxtype_params::q_mode( sc_q_mode q_mode_ )
00291 {
00292 m_q_mode = q_mode_;
00293 }
00294
00295
00296 inline
00297 sc_o_mode
00298 sc_fxtype_params::o_mode() const
00299 {
00300 return m_o_mode;
00301 }
00302
00303 inline
00304 void
00305 sc_fxtype_params::o_mode( sc_o_mode o_mode_ )
00306 {
00307 m_o_mode = o_mode_;
00308 }
00309
00310
00311 inline
00312 int
00313 sc_fxtype_params::n_bits() const
00314 {
00315 return m_n_bits;
00316 }
00317
00318 inline
00319 void
00320 sc_fxtype_params::n_bits( int n_bits_ )
00321 {
00322 SC_CHECK_N_BITS_( n_bits_ );
00323 m_n_bits = n_bits_;
00324 }
00325
00326
00327 inline
00328 ::std::ostream&
00329 operator << ( ::std::ostream& os, const sc_fxtype_params& a )
00330 {
00331 a.print( os );
00332 return os;
00333 }
00334
00335 }
00336
00337
00338 #endif
00339
00340