00001 /***************************************************************************** 00002 00003 The following code is derived, directly or indirectly, from the SystemC 00004 source code Copyright (c) 1996-2004 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.3 (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 #include "systemc/datatypes/fx/sc_fxdefs.h" 00038 00039 00040 namespace sc_dt 00041 { 00042 00043 // ---------------------------------------------------------------------------- 00044 // ENUM : sc_enc 00045 // 00046 // Enumeration of sign encodings. 00047 // ---------------------------------------------------------------------------- 00048 00049 const sc_string 00050 to_string( sc_enc enc ) 00051 { 00052 switch( enc ) 00053 { 00054 case SC_TC_: 00055 return sc_string( "SC_TC_" ); 00056 case SC_US_: 00057 return sc_string( "SC_US_" ); 00058 default: 00059 return sc_string( "unknown" ); 00060 } 00061 } 00062 00063 00064 // ---------------------------------------------------------------------------- 00065 // ENUM : sc_q_mode 00066 // 00067 // Enumeration of quantization modes. 00068 // ---------------------------------------------------------------------------- 00069 00070 const sc_string 00071 to_string( sc_q_mode q_mode ) 00072 { 00073 switch( q_mode ) 00074 { 00075 case SC_RND: 00076 return sc_string( "SC_RND" ); 00077 case SC_RND_ZERO: 00078 return sc_string( "SC_RND_ZERO" ); 00079 case SC_RND_MIN_INF: 00080 return sc_string( "SC_RND_MIN_INF" ); 00081 case SC_RND_INF: 00082 return sc_string( "SC_RND_INF" ); 00083 case SC_RND_CONV: 00084 return sc_string( "SC_RND_CONV" ); 00085 case SC_TRN: 00086 return sc_string( "SC_TRN" ); 00087 case SC_TRN_ZERO: 00088 return sc_string( "SC_TRN_ZERO" ); 00089 default: 00090 return sc_string( "unknown" ); 00091 } 00092 } 00093 00094 00095 // ---------------------------------------------------------------------------- 00096 // ENUM : sc_o_mode 00097 // 00098 // Enumeration of overflow modes. 00099 // ---------------------------------------------------------------------------- 00100 00101 const sc_string 00102 to_string( sc_o_mode o_mode ) 00103 { 00104 switch( o_mode ) 00105 { 00106 case SC_SAT: 00107 return sc_string( "SC_SAT" ); 00108 case SC_SAT_ZERO: 00109 return sc_string( "SC_SAT_ZERO" ); 00110 case SC_SAT_SYM: 00111 return sc_string( "SC_SAT_SYM" ); 00112 case SC_WRAP: 00113 return sc_string( "SC_WRAP" ); 00114 case SC_WRAP_SM: 00115 return sc_string( "SC_WRAP_SM" ); 00116 default: 00117 return sc_string( "unknown" ); 00118 } 00119 } 00120 00121 00122 // ---------------------------------------------------------------------------- 00123 // ENUM : sc_switch 00124 // 00125 // Enumeration of switch states. 00126 // ---------------------------------------------------------------------------- 00127 00128 const sc_string 00129 to_string( sc_switch sw ) 00130 { 00131 switch( sw ) { 00132 case SC_OFF: 00133 return sc_string( "SC_OFF" ); 00134 case SC_ON: 00135 return sc_string( "SC_ON" ); 00136 default: 00137 return sc_string( "unknown" ); 00138 } 00139 } 00140 00141 00142 // ---------------------------------------------------------------------------- 00143 // ENUM : sc_fmt 00144 // 00145 // Enumeration of formats for character string conversion. 00146 // ---------------------------------------------------------------------------- 00147 00148 const sc_string 00149 to_string( sc_fmt fmt ) 00150 { 00151 switch( fmt ) { 00152 case SC_F: 00153 return sc_string( "SC_F" ); 00154 case SC_E: 00155 return sc_string( "SC_E" ); 00156 default: 00157 return sc_string( "unknown" ); 00158 } 00159 } 00160 00161 } // namespace sc_dt 00162 00163 00164 // Taf!
1.2.18