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_fxdefs.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_fxdefs.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:57 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_fxdefs.h" 00047 00048 00049 namespace sc_dt 00050 { 00051 00052 // ---------------------------------------------------------------------------- 00053 // ENUM : sc_enc 00054 // 00055 // Enumeration of sign encodings. 00056 // ---------------------------------------------------------------------------- 00057 00058 const std::string 00059 to_string( sc_enc enc ) 00060 { 00061 switch( enc ) 00062 { 00063 case SC_TC_: 00064 return std::string( "SC_TC_" ); 00065 case SC_US_: 00066 return std::string( "SC_US_" ); 00067 default: 00068 return std::string( "unknown" ); 00069 } 00070 } 00071 00072 00073 // ---------------------------------------------------------------------------- 00074 // ENUM : sc_q_mode 00075 // 00076 // Enumeration of quantization modes. 00077 // ---------------------------------------------------------------------------- 00078 00079 const std::string 00080 to_string( sc_q_mode q_mode ) 00081 { 00082 switch( q_mode ) 00083 { 00084 case SC_RND: 00085 return std::string( "SC_RND" ); 00086 case SC_RND_ZERO: 00087 return std::string( "SC_RND_ZERO" ); 00088 case SC_RND_MIN_INF: 00089 return std::string( "SC_RND_MIN_INF" ); 00090 case SC_RND_INF: 00091 return std::string( "SC_RND_INF" ); 00092 case SC_RND_CONV: 00093 return std::string( "SC_RND_CONV" ); 00094 case SC_TRN: 00095 return std::string( "SC_TRN" ); 00096 case SC_TRN_ZERO: 00097 return std::string( "SC_TRN_ZERO" ); 00098 default: 00099 return std::string( "unknown" ); 00100 } 00101 } 00102 00103 00104 // ---------------------------------------------------------------------------- 00105 // ENUM : sc_o_mode 00106 // 00107 // Enumeration of overflow modes. 00108 // ---------------------------------------------------------------------------- 00109 00110 const std::string 00111 to_string( sc_o_mode o_mode ) 00112 { 00113 switch( o_mode ) 00114 { 00115 case SC_SAT: 00116 return std::string( "SC_SAT" ); 00117 case SC_SAT_ZERO: 00118 return std::string( "SC_SAT_ZERO" ); 00119 case SC_SAT_SYM: 00120 return std::string( "SC_SAT_SYM" ); 00121 case SC_WRAP: 00122 return std::string( "SC_WRAP" ); 00123 case SC_WRAP_SM: 00124 return std::string( "SC_WRAP_SM" ); 00125 default: 00126 return std::string( "unknown" ); 00127 } 00128 } 00129 00130 00131 // ---------------------------------------------------------------------------- 00132 // ENUM : sc_switch 00133 // 00134 // Enumeration of switch states. 00135 // ---------------------------------------------------------------------------- 00136 00137 const std::string 00138 to_string( sc_switch sw ) 00139 { 00140 switch( sw ) { 00141 case SC_OFF: 00142 return std::string( "SC_OFF" ); 00143 case SC_ON: 00144 return std::string( "SC_ON" ); 00145 default: 00146 return std::string( "unknown" ); 00147 } 00148 } 00149 00150 00151 // ---------------------------------------------------------------------------- 00152 // ENUM : sc_fmt 00153 // 00154 // Enumeration of formats for character string conversion. 00155 // ---------------------------------------------------------------------------- 00156 00157 const std::string 00158 to_string( sc_fmt fmt ) 00159 { 00160 switch( fmt ) { 00161 case SC_F: 00162 return std::string( "SC_F" ); 00163 case SC_E: 00164 return std::string( "SC_E" ); 00165 default: 00166 return std::string( "unknown" ); 00167 } 00168 } 00169 00170 } // namespace sc_dt 00171 00172 00173 // Taf!