src/sysc/datatypes/fx/scfx_params.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003   The following code is derived, directly or indirectly, from the SystemC
00004   source code Copyright (c) 1996-2005 by all Contributors.
00005   All Rights reserved.
00006 
00007   The contents of this file are subject to the restrictions and limitations
00008   set forth in the SystemC Open Source License Version 2.4 (the "License");
00009   You may not use this file except in compliance with such restrictions and
00010   limitations. You may obtain instructions on how to receive a copy of the
00011   License at http://www.systemc.org/. Software distributed by Contributors
00012   under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
00013   ANY KIND, either express or implied. See the License for the specific
00014   language governing rights and limitations under the License.
00015 
00016  *****************************************************************************/
00017 
00018 /*****************************************************************************
00019 
00020   scfx_params.h - 
00021 
00022   Original Author: Martin Janssen, Synopsys, Inc.
00023 
00024  *****************************************************************************/
00025 
00026 /*****************************************************************************
00027 
00028   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00029   changes you are making here.
00030 
00031       Name, Affiliation, Date:
00032   Description of Modification:
00033 
00034  *****************************************************************************/
00035 
00036 #ifndef SCFX_PARAMS_H
00037 #define SCFX_PARAMS_H
00038 
00039 
00040 #include "sysc/datatypes/fx/sc_fx_ids.h"
00041 #include "sysc/datatypes/fx/sc_fxcast_switch.h"
00042 #include "sysc/datatypes/fx/sc_fxtype_params.h"
00043 
00044 
00045 namespace sc_dt
00046 {
00047 
00048 // classes defined in this module
00049 class scfx_params;
00050 
00051 
00052 // ----------------------------------------------------------------------------
00053 //  CLASS : scfx_params
00054 //
00055 //  ...
00056 // ----------------------------------------------------------------------------
00057 
00058 class scfx_params
00059 {
00060 
00061 public:
00062 
00063     // constructor
00064 
00065     scfx_params( const sc_fxtype_params&,
00066                  sc_enc,
00067                  const sc_fxcast_switch& );
00068 
00069 
00070     // query functions
00071 
00072     const sc_fxtype_params& type_params() const;
00073     sc_enc enc() const;
00074     const sc_fxcast_switch& cast_switch() const;
00075 
00076 
00077     // shortcuts
00078 
00079     int wl() const;
00080     int iwl() const;
00081     int fwl() const;
00082     sc_q_mode q_mode() const;
00083     sc_o_mode o_mode() const;
00084     int n_bits() const;
00085 
00086 
00087     // dump content
00088 
00089     void dump( ::std::ostream& ) const;
00090 
00091 private:
00092 
00093     sc_fxtype_params m_type_params;
00094     sc_enc           m_enc;
00095     sc_fxcast_switch m_cast_switch;
00096     
00097 };
00098 
00099 
00100 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00101 
00102 // constructor
00103 
00104 inline
00105 scfx_params::scfx_params( const sc_fxtype_params& type_params_,
00106                           sc_enc enc_,
00107                           const sc_fxcast_switch& cast_sw )
00108 : m_type_params( type_params_ ),
00109   m_enc( enc_ ),
00110   m_cast_switch( cast_sw )
00111 {
00112     if( m_enc == SC_US_ && m_type_params.o_mode() == SC_WRAP_SM )
00113     {
00114         SC_REPORT_ERROR( sc_core::SC_ID_INVALID_O_MODE_,
00115                          "SC_WRAP_SM not defined for unsigned numbers" );
00116     }
00117 
00118 }
00119 
00120 
00121 // query functions
00122 
00123 inline
00124 const sc_fxtype_params&
00125 scfx_params::type_params() const
00126 {
00127     return m_type_params;
00128 }
00129 
00130 inline
00131 sc_enc
00132 scfx_params::enc() const
00133 {
00134     return m_enc;
00135 }
00136 
00137 inline
00138 const sc_fxcast_switch&
00139 scfx_params::cast_switch() const
00140 {
00141     return m_cast_switch;
00142 }
00143 
00144 
00145 // shortcuts
00146 
00147 inline
00148 int
00149 scfx_params::wl() const
00150 {
00151     return m_type_params.wl();
00152 }
00153 
00154 inline
00155 int
00156 scfx_params::iwl() const
00157 {
00158     return m_type_params.iwl();
00159 }
00160 
00161 inline
00162 int
00163 scfx_params::fwl() const
00164 {
00165     return ( m_type_params.wl() - m_type_params.iwl() );
00166 }
00167 
00168 inline
00169 sc_q_mode
00170 scfx_params::q_mode() const
00171 {
00172     return m_type_params.q_mode();
00173 }
00174 
00175 inline
00176 sc_o_mode
00177 scfx_params::o_mode() const
00178 {
00179     return m_type_params.o_mode();
00180 }
00181 
00182 inline
00183 int
00184 scfx_params::n_bits() const
00185 {
00186     return m_type_params.n_bits();
00187 }
00188 
00189 
00190 // dump content
00191 
00192 inline
00193 void
00194 scfx_params::dump( ::std::ostream& os ) const
00195 {
00196     os << "scfx_params" << ::std::endl;
00197     os << "(" << ::std::endl;
00198     os << "type_params = ";
00199     m_type_params.dump( os );
00200     os << "enc         = " << m_enc << ::std::endl;
00201     os << "cast_switch = ";
00202     m_cast_switch.dump( os );
00203     os << ")" << ::std::endl;
00204 }
00205 
00206 } // namespace sc_dt
00207 
00208 
00209 #endif
00210 
00211 // Taf!

Generated on Wed Apr 25 13:53:26 2007 for SystemC by  doxygen 1.5.1