sc_fxdefs.cpp revision 12027
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 sc_fxdefs.cpp - 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 39// $Log: sc_fxdefs.cpp,v $ 40// Revision 1.1.1.1 2006/12/15 20:20:04 acg 41// SystemC 2.3 42// 43// Revision 1.3 2006/01/13 18:53:57 acg 44// Andy Goodrich: added $Log command so that CVS comments are reproduced in 45// the source. 46// 47 48#include "sysc/datatypes/fx/sc_fxdefs.h" 49 50 51namespace sc_dt 52{ 53 54// ---------------------------------------------------------------------------- 55// ENUM : sc_enc 56// 57// Enumeration of sign encodings. 58// ---------------------------------------------------------------------------- 59 60const std::string 61to_string( sc_enc enc ) 62{ 63 switch( enc ) 64 { 65 case SC_TC_: 66 return std::string( "SC_TC_" ); 67 case SC_US_: 68 return std::string( "SC_US_" ); 69 default: 70 return std::string( "unknown" ); 71 } 72} 73 74 75// ---------------------------------------------------------------------------- 76// ENUM : sc_q_mode 77// 78// Enumeration of quantization modes. 79// ---------------------------------------------------------------------------- 80 81const std::string 82to_string( sc_q_mode q_mode ) 83{ 84 switch( q_mode ) 85 { 86 case SC_RND: 87 return std::string( "SC_RND" ); 88 case SC_RND_ZERO: 89 return std::string( "SC_RND_ZERO" ); 90 case SC_RND_MIN_INF: 91 return std::string( "SC_RND_MIN_INF" ); 92 case SC_RND_INF: 93 return std::string( "SC_RND_INF" ); 94 case SC_RND_CONV: 95 return std::string( "SC_RND_CONV" ); 96 case SC_TRN: 97 return std::string( "SC_TRN" ); 98 case SC_TRN_ZERO: 99 return std::string( "SC_TRN_ZERO" ); 100 default: 101 return std::string( "unknown" ); 102 } 103} 104 105 106// ---------------------------------------------------------------------------- 107// ENUM : sc_o_mode 108// 109// Enumeration of overflow modes. 110// ---------------------------------------------------------------------------- 111 112const std::string 113to_string( sc_o_mode o_mode ) 114{ 115 switch( o_mode ) 116 { 117 case SC_SAT: 118 return std::string( "SC_SAT" ); 119 case SC_SAT_ZERO: 120 return std::string( "SC_SAT_ZERO" ); 121 case SC_SAT_SYM: 122 return std::string( "SC_SAT_SYM" ); 123 case SC_WRAP: 124 return std::string( "SC_WRAP" ); 125 case SC_WRAP_SM: 126 return std::string( "SC_WRAP_SM" ); 127 default: 128 return std::string( "unknown" ); 129 } 130} 131 132 133// ---------------------------------------------------------------------------- 134// ENUM : sc_switch 135// 136// Enumeration of switch states. 137// ---------------------------------------------------------------------------- 138 139const std::string 140to_string( sc_switch sw ) 141{ 142 switch( sw ) { 143 case SC_OFF: 144 return std::string( "SC_OFF" ); 145 case SC_ON: 146 return std::string( "SC_ON" ); 147 default: 148 return std::string( "unknown" ); 149 } 150} 151 152 153// ---------------------------------------------------------------------------- 154// ENUM : sc_fmt 155// 156// Enumeration of formats for character string conversion. 157// ---------------------------------------------------------------------------- 158 159const std::string 160to_string( sc_fmt fmt ) 161{ 162 switch( fmt ) { 163 case SC_F: 164 return std::string( "SC_F" ); 165 case SC_E: 166 return std::string( "SC_E" ); 167 default: 168 return std::string( "unknown" ); 169 } 170} 171 172} // namespace sc_dt 173 174 175// Taf! 176