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 sc_fxtype_params.cpp - 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 00037 // $Log: sc_fxtype_params.cpp,v $ 00038 // Revision 1.1.1.1 2006/12/15 20:31:36 acg 00039 // SystemC 2.2 00040 // 00041 // Revision 1.3 2006/01/13 18:53:58 acg 00042 // Andy Goodrich: added $Log command so that CVS comments are reproduced in 00043 // the source. 00044 // 00045 00046 #include "sysc/datatypes/fx/sc_fxtype_params.h" 00047 00048 00049 namespace sc_dt 00050 { 00051 00052 // ---------------------------------------------------------------------------- 00053 // CLASS : sc_fxtype_params 00054 // 00055 // Fixed-point type parameters class. 00056 // ---------------------------------------------------------------------------- 00057 00058 const std::string 00059 sc_fxtype_params::to_string() const 00060 { 00061 std::string s; 00062 00063 char buf[BUFSIZ]; 00064 00065 s += "("; 00066 std::sprintf( buf, "%d", m_wl ); 00067 s += buf; 00068 s += ","; 00069 std::sprintf( buf, "%d", m_iwl ); 00070 s += buf; 00071 s += ","; 00072 s += sc_dt::to_string( m_q_mode ); 00073 s += ","; 00074 s += sc_dt::to_string( m_o_mode ); 00075 s += ","; 00076 std::sprintf( buf, "%d", m_n_bits ); 00077 s += buf; 00078 s += ")"; 00079 00080 return s; 00081 } 00082 00083 00084 void 00085 sc_fxtype_params::print( ::std::ostream& os ) const 00086 { 00087 os << to_string(); 00088 } 00089 00090 void 00091 sc_fxtype_params::dump( ::std::ostream& os ) const 00092 { 00093 os << "sc_fxtype_params" << ::std::endl; 00094 os << "(" << ::std::endl; 00095 os << "wl = " << m_wl << ::std::endl; 00096 os << "iwl = " << m_iwl << ::std::endl; 00097 os << "q_mode = " << m_q_mode << ::std::endl; 00098 os << "o_mode = " << m_o_mode << ::std::endl; 00099 os << "n_bits = " << m_n_bits << ::std::endl; 00100 os << ")" << ::std::endl; 00101 } 00102 00103 } // namespace sc_dt 00104 00105 00106 // Taf!