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 __SYSTEMC_EXT_DT_FX_SCFX_PARAMS_HH__ 48#define __SYSTEMC_EXT_DT_FX_SCFX_PARAMS_HH__ 49 50#include "messages.hh" 51#include "sc_fxcast_switch.hh" 52#include "sc_fxtype_params.hh" 53 54namespace sc_dt 55{ 56 57// classes defined in this module 58class scfx_params; 59 60 61// ---------------------------------------------------------------------------- 62// CLASS : scfx_params 63// 64// ... 65// ---------------------------------------------------------------------------- 66 67class scfx_params 68{ 69 public: 70 // constructor 71 scfx_params(const sc_fxtype_params &, sc_enc, const sc_fxcast_switch &); 72 73 // query functions 74 const sc_fxtype_params &type_params() const; 75 sc_enc enc() const; 76 const sc_fxcast_switch &cast_switch() const; 77 78 // shortcuts 79 int wl() const; 80 int iwl() const; 81 int fwl() const; 82 sc_q_mode q_mode() const; 83 sc_o_mode o_mode() const; 84 int n_bits() const; 85 86 // dump content 87 void dump(::std::ostream &) const; 88 89 private: 90 sc_fxtype_params m_type_params; 91 sc_enc m_enc; 92 sc_fxcast_switch m_cast_switch; 93}; 94 95 96// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 97 98// constructor 99inline scfx_params::scfx_params(const sc_fxtype_params &type_params_, 100 sc_enc enc_, 101 const sc_fxcast_switch &cast_sw) : 102 m_type_params(type_params_), m_enc(enc_), m_cast_switch(cast_sw) 103{ 104 if (m_enc == SC_US_ && m_type_params.o_mode() == SC_WRAP_SM) { 105 SC_REPORT_ERROR(sc_core::SC_ID_INVALID_O_MODE_, 106 sc_core::SC_ID_WRAP_SM_NOT_DEFINED_); 107 // may continue, if suppressed 108 } 109} 110 111// query functions 112inline const sc_fxtype_params & 113scfx_params::type_params() const 114{ 115 return m_type_params; 116} 117 118inline sc_enc 119scfx_params::enc() const 120{ 121 return m_enc; 122} 123 124inline const sc_fxcast_switch & 125scfx_params::cast_switch() const 126{ 127 return m_cast_switch; 128} 129 130// shortcuts 131inline int 132scfx_params::wl() const 133{ 134 return m_type_params.wl(); 135} 136 137inline int 138scfx_params::iwl() const 139{ 140 return m_type_params.iwl(); 141} 142 143inline int 144scfx_params::fwl() const 145{ 146 return (m_type_params.wl() - m_type_params.iwl()); 147} 148 149inline sc_q_mode 150scfx_params::q_mode() const 151{ 152 return m_type_params.q_mode(); 153} 154 155inline sc_o_mode 156scfx_params::o_mode() const 157{ 158 return m_type_params.o_mode(); 159} 160 161inline int 162scfx_params::n_bits() const 163{ 164 return m_type_params.n_bits(); 165} 166 167// dump content 168inline void 169scfx_params::dump(::std::ostream &os) const 170{ 171 os << "scfx_params" << ::std::endl; 172 os << "(" << ::std::endl; 173 os << "type_params = "; 174 m_type_params.dump( os ); 175 os << "enc = " << m_enc << ::std::endl; 176 os << "cast_switch = "; 177 m_cast_switch.dump( os ); 178 os << ")" << ::std::endl; 179} 180 181} // namespace sc_dt 182 183#endif // __SYSTEMC_EXT_DT_FX_SCFX_PARAMS_HH__ 184