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-2006 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 // $Log: scfx_params.h,v $
00037 // Revision 1.1.1.1  2006/12/15 20:31:36  acg
00038 // SystemC 2.2
00039 //
00040 // Revision 1.3  2006/01/13 18:53:58  acg
00041 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
00042 // the source.
00043 //
00044 
00045 #ifndef SCFX_PARAMS_H
00046 #define SCFX_PARAMS_H
00047 
00048 
00049 #include "sysc/datatypes/fx/sc_fx_ids.h"
00050 #include "sysc/datatypes/fx/sc_fxcast_switch.h"
00051 #include "sysc/datatypes/fx/sc_fxtype_params.h"
00052 
00053 
00054 namespace sc_dt
00055 {
00056 
00057 // classes defined in this module
00058 class scfx_params;
00059 
00060 
00061 // ----------------------------------------------------------------------------
00062 //  CLASS : scfx_params
00063 //
00064 //  ...
00065 // ----------------------------------------------------------------------------
00066 
00067 class scfx_params
00068 {
00069 
00070 public:
00071 
00072     // constructor
00073 
00074     scfx_params( const sc_fxtype_params&,
00075          sc_enc,
00076          const sc_fxcast_switch& );
00077 
00078 
00079     // query functions
00080 
00081     const sc_fxtype_params& type_params() const;
00082     sc_enc enc() const;
00083     const sc_fxcast_switch& cast_switch() const;
00084 
00085 
00086     // shortcuts
00087 
00088     int wl() const;
00089     int iwl() const;
00090     int fwl() const;
00091     sc_q_mode q_mode() const;
00092     sc_o_mode o_mode() const;
00093     int n_bits() const;
00094 
00095 
00096     // dump content
00097 
00098     void dump( ::std::ostream& ) const;
00099 
00100 private:
00101 
00102     sc_fxtype_params m_type_params;
00103     sc_enc           m_enc;
00104     sc_fxcast_switch m_cast_switch;
00105     
00106 };
00107 
00108 
00109 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00110 
00111 // constructor
00112 
00113 inline
00114 scfx_params::scfx_params( const sc_fxtype_params& type_params_,
00115               sc_enc enc_,
00116               const sc_fxcast_switch& cast_sw )
00117 : m_type_params( type_params_ ),
00118   m_enc( enc_ ),
00119   m_cast_switch( cast_sw )
00120 {
00121     if( m_enc == SC_US_ && m_type_params.o_mode() == SC_WRAP_SM )
00122     {
00123     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_O_MODE_,
00124              "SC_WRAP_SM not defined for unsigned numbers" );
00125     }
00126 
00127 }
00128 
00129 
00130 // query functions
00131 
00132 inline
00133 const sc_fxtype_params&
00134 scfx_params::type_params() const
00135 {
00136     return m_type_params;
00137 }
00138 
00139 inline
00140 sc_enc
00141 scfx_params::enc() const
00142 {
00143     return m_enc;
00144 }
00145 
00146 inline
00147 const sc_fxcast_switch&
00148 scfx_params::cast_switch() const
00149 {
00150     return m_cast_switch;
00151 }
00152 
00153 
00154 // shortcuts
00155 
00156 inline
00157 int
00158 scfx_params::wl() const
00159 {
00160     return m_type_params.wl();
00161 }
00162 
00163 inline
00164 int
00165 scfx_params::iwl() const
00166 {
00167     return m_type_params.iwl();
00168 }
00169 
00170 inline
00171 int
00172 scfx_params::fwl() const
00173 {
00174     return ( m_type_params.wl() - m_type_params.iwl() );
00175 }
00176 
00177 inline
00178 sc_q_mode
00179 scfx_params::q_mode() const
00180 {
00181     return m_type_params.q_mode();
00182 }
00183 
00184 inline
00185 sc_o_mode
00186 scfx_params::o_mode() const
00187 {
00188     return m_type_params.o_mode();
00189 }
00190 
00191 inline
00192 int
00193 scfx_params::n_bits() const
00194 {
00195     return m_type_params.n_bits();
00196 }
00197 
00198 
00199 // dump content
00200 
00201 inline
00202 void
00203 scfx_params::dump( ::std::ostream& os ) const
00204 {
00205     os << "scfx_params" << ::std::endl;
00206     os << "(" << ::std::endl;
00207     os << "type_params = ";
00208     m_type_params.dump( os );
00209     os << "enc         = " << m_enc << ::std::endl;
00210     os << "cast_switch = ";
00211     m_cast_switch.dump( os );
00212     os << ")" << ::std::endl;
00213 }
00214 
00215 } // namespace sc_dt
00216 
00217 
00218 #endif
00219 
00220 // Taf!

Generated on Wed Jan 21 15:32:08 2009 for SystemC by  doxygen 1.5.5