112853Sgabeblack@google.com/*****************************************************************************
212853Sgabeblack@google.com
312853Sgabeblack@google.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412853Sgabeblack@google.com  more contributor license agreements.  See the NOTICE file distributed
512853Sgabeblack@google.com  with this work for additional information regarding copyright ownership.
612853Sgabeblack@google.com  Accellera licenses this file to you under the Apache License, Version 2.0
712853Sgabeblack@google.com  (the "License"); you may not use this file except in compliance with the
812853Sgabeblack@google.com  License.  You may obtain a copy of the License at
912853Sgabeblack@google.com
1012853Sgabeblack@google.com    http://www.apache.org/licenses/LICENSE-2.0
1112853Sgabeblack@google.com
1212853Sgabeblack@google.com  Unless required by applicable law or agreed to in writing, software
1312853Sgabeblack@google.com  distributed under the License is distributed on an "AS IS" BASIS,
1412853Sgabeblack@google.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512853Sgabeblack@google.com  implied.  See the License for the specific language governing
1612853Sgabeblack@google.com  permissions and limitations under the License.
1712853Sgabeblack@google.com
1812853Sgabeblack@google.com *****************************************************************************/
1912853Sgabeblack@google.com
2012853Sgabeblack@google.com/*****************************************************************************
2112853Sgabeblack@google.com
2212853Sgabeblack@google.com  scfx_params.h -
2312853Sgabeblack@google.com
2412853Sgabeblack@google.com  Original Author: Martin Janssen, Synopsys, Inc.
2512853Sgabeblack@google.com
2612853Sgabeblack@google.com *****************************************************************************/
2712853Sgabeblack@google.com
2812853Sgabeblack@google.com/*****************************************************************************
2912853Sgabeblack@google.com
3012853Sgabeblack@google.com  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3112853Sgabeblack@google.com  changes you are making here.
3212853Sgabeblack@google.com
3312853Sgabeblack@google.com      Name, Affiliation, Date:
3412853Sgabeblack@google.com  Description of Modification:
3512853Sgabeblack@google.com
3612853Sgabeblack@google.com *****************************************************************************/
3712853Sgabeblack@google.com
3812853Sgabeblack@google.com// $Log: scfx_params.h,v $
3912853Sgabeblack@google.com// Revision 1.1.1.1  2006/12/15 20:20:04  acg
4012853Sgabeblack@google.com// SystemC 2.3
4112853Sgabeblack@google.com//
4212853Sgabeblack@google.com// Revision 1.3  2006/01/13 18:53:58  acg
4312853Sgabeblack@google.com// Andy Goodrich: added $Log command so that CVS comments are reproduced in
4412853Sgabeblack@google.com// the source.
4512853Sgabeblack@google.com//
4612853Sgabeblack@google.com
4712853Sgabeblack@google.com#ifndef __SYSTEMC_EXT_DT_FX_SCFX_PARAMS_HH__
4812853Sgabeblack@google.com#define __SYSTEMC_EXT_DT_FX_SCFX_PARAMS_HH__
4912853Sgabeblack@google.com
5013325Sgabeblack@google.com#include "messages.hh"
5112853Sgabeblack@google.com#include "sc_fxcast_switch.hh"
5212853Sgabeblack@google.com#include "sc_fxtype_params.hh"
5312853Sgabeblack@google.com
5412853Sgabeblack@google.comnamespace sc_dt
5512853Sgabeblack@google.com{
5612853Sgabeblack@google.com
5712853Sgabeblack@google.com// classes defined in this module
5812853Sgabeblack@google.comclass scfx_params;
5912853Sgabeblack@google.com
6012853Sgabeblack@google.com
6112853Sgabeblack@google.com// ----------------------------------------------------------------------------
6212853Sgabeblack@google.com//  CLASS : scfx_params
6312853Sgabeblack@google.com//
6412853Sgabeblack@google.com//  ...
6512853Sgabeblack@google.com// ----------------------------------------------------------------------------
6612853Sgabeblack@google.com
6712853Sgabeblack@google.comclass scfx_params
6812853Sgabeblack@google.com{
6912853Sgabeblack@google.com  public:
7012853Sgabeblack@google.com    // constructor
7112853Sgabeblack@google.com    scfx_params(const sc_fxtype_params &, sc_enc, const sc_fxcast_switch &);
7212853Sgabeblack@google.com
7312853Sgabeblack@google.com    // query functions
7412853Sgabeblack@google.com    const sc_fxtype_params &type_params() const;
7512853Sgabeblack@google.com    sc_enc enc() const;
7612853Sgabeblack@google.com    const sc_fxcast_switch &cast_switch() const;
7712853Sgabeblack@google.com
7812853Sgabeblack@google.com    // shortcuts
7912853Sgabeblack@google.com    int wl() const;
8012853Sgabeblack@google.com    int iwl() const;
8112853Sgabeblack@google.com    int fwl() const;
8212853Sgabeblack@google.com    sc_q_mode q_mode() const;
8312853Sgabeblack@google.com    sc_o_mode o_mode() const;
8412853Sgabeblack@google.com    int n_bits() const;
8512853Sgabeblack@google.com
8612853Sgabeblack@google.com    // dump content
8712853Sgabeblack@google.com    void dump(::std::ostream &) const;
8812853Sgabeblack@google.com
8912853Sgabeblack@google.com  private:
9012853Sgabeblack@google.com    sc_fxtype_params m_type_params;
9112853Sgabeblack@google.com    sc_enc m_enc;
9212853Sgabeblack@google.com    sc_fxcast_switch m_cast_switch;
9312853Sgabeblack@google.com};
9412853Sgabeblack@google.com
9512853Sgabeblack@google.com
9612853Sgabeblack@google.com// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
9712853Sgabeblack@google.com
9812853Sgabeblack@google.com// constructor
9912853Sgabeblack@google.cominline scfx_params::scfx_params(const sc_fxtype_params &type_params_,
10012853Sgabeblack@google.com                                sc_enc enc_,
10112853Sgabeblack@google.com                                const sc_fxcast_switch &cast_sw) :
10212853Sgabeblack@google.com    m_type_params(type_params_), m_enc(enc_), m_cast_switch(cast_sw)
10312853Sgabeblack@google.com{
10412853Sgabeblack@google.com    if (m_enc == SC_US_ && m_type_params.o_mode() == SC_WRAP_SM) {
10513325Sgabeblack@google.com        SC_REPORT_ERROR(sc_core::SC_ID_INVALID_O_MODE_,
10613325Sgabeblack@google.com                        sc_core::SC_ID_WRAP_SM_NOT_DEFINED_);
10712853Sgabeblack@google.com        // may continue, if suppressed
10812853Sgabeblack@google.com    }
10912853Sgabeblack@google.com}
11012853Sgabeblack@google.com
11112853Sgabeblack@google.com// query functions
11212853Sgabeblack@google.cominline const sc_fxtype_params &
11312853Sgabeblack@google.comscfx_params::type_params() const
11412853Sgabeblack@google.com{
11512853Sgabeblack@google.com    return m_type_params;
11612853Sgabeblack@google.com}
11712853Sgabeblack@google.com
11812853Sgabeblack@google.cominline sc_enc
11912853Sgabeblack@google.comscfx_params::enc() const
12012853Sgabeblack@google.com{
12112853Sgabeblack@google.com    return m_enc;
12212853Sgabeblack@google.com}
12312853Sgabeblack@google.com
12412853Sgabeblack@google.cominline const sc_fxcast_switch &
12512853Sgabeblack@google.comscfx_params::cast_switch() const
12612853Sgabeblack@google.com{
12712853Sgabeblack@google.com    return m_cast_switch;
12812853Sgabeblack@google.com}
12912853Sgabeblack@google.com
13012853Sgabeblack@google.com// shortcuts
13112853Sgabeblack@google.cominline int
13212853Sgabeblack@google.comscfx_params::wl() const
13312853Sgabeblack@google.com{
13412853Sgabeblack@google.com    return m_type_params.wl();
13512853Sgabeblack@google.com}
13612853Sgabeblack@google.com
13712853Sgabeblack@google.cominline int
13812853Sgabeblack@google.comscfx_params::iwl() const
13912853Sgabeblack@google.com{
14012853Sgabeblack@google.com    return m_type_params.iwl();
14112853Sgabeblack@google.com}
14212853Sgabeblack@google.com
14312853Sgabeblack@google.cominline int
14412853Sgabeblack@google.comscfx_params::fwl() const
14512853Sgabeblack@google.com{
14612853Sgabeblack@google.com    return (m_type_params.wl() - m_type_params.iwl());
14712853Sgabeblack@google.com}
14812853Sgabeblack@google.com
14912853Sgabeblack@google.cominline sc_q_mode
15012853Sgabeblack@google.comscfx_params::q_mode() const
15112853Sgabeblack@google.com{
15212853Sgabeblack@google.com    return m_type_params.q_mode();
15312853Sgabeblack@google.com}
15412853Sgabeblack@google.com
15512853Sgabeblack@google.cominline sc_o_mode
15612853Sgabeblack@google.comscfx_params::o_mode() const
15712853Sgabeblack@google.com{
15812853Sgabeblack@google.com    return m_type_params.o_mode();
15912853Sgabeblack@google.com}
16012853Sgabeblack@google.com
16112853Sgabeblack@google.cominline int
16212853Sgabeblack@google.comscfx_params::n_bits() const
16312853Sgabeblack@google.com{
16412853Sgabeblack@google.com    return m_type_params.n_bits();
16512853Sgabeblack@google.com}
16612853Sgabeblack@google.com
16712853Sgabeblack@google.com// dump content
16812853Sgabeblack@google.cominline void
16912853Sgabeblack@google.comscfx_params::dump(::std::ostream &os) const
17012853Sgabeblack@google.com{
17112853Sgabeblack@google.com    os << "scfx_params" << ::std::endl;
17212853Sgabeblack@google.com    os << "(" << ::std::endl;
17312853Sgabeblack@google.com    os << "type_params = ";
17412853Sgabeblack@google.com    m_type_params.dump( os );
17512853Sgabeblack@google.com    os << "enc         = " << m_enc << ::std::endl;
17612853Sgabeblack@google.com    os << "cast_switch = ";
17712853Sgabeblack@google.com    m_cast_switch.dump( os );
17812853Sgabeblack@google.com    os << ")" << ::std::endl;
17912853Sgabeblack@google.com}
18012853Sgabeblack@google.com
18112853Sgabeblack@google.com} // namespace sc_dt
18212853Sgabeblack@google.com
18312853Sgabeblack@google.com#endif // __SYSTEMC_EXT_DT_FX_SCFX_PARAMS_HH__
184