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 "systemc/ext/dt/fx/sc_fxdefs.hh" 49 50namespace sc_dt 51{ 52 53// ---------------------------------------------------------------------------- 54// ENUM : sc_enc 55// 56// Enumeration of sign encodings. 57// ---------------------------------------------------------------------------- 58 59const std::string 60to_string(sc_enc enc) 61{ 62 switch (enc) { 63 case SC_TC_: 64 return std::string("SC_TC_"); 65 case SC_US_: 66 return std::string("SC_US_"); 67 default: 68 return std::string("unknown"); 69 } 70} 71 72// ---------------------------------------------------------------------------- 73// ENUM : sc_q_mode 74// 75// Enumeration of quantization modes. 76// ---------------------------------------------------------------------------- 77 78const std::string 79to_string(sc_q_mode q_mode) 80{ 81 switch (q_mode) { 82 case SC_RND: 83 return std::string("SC_RND"); 84 case SC_RND_ZERO: 85 return std::string("SC_RND_ZERO"); 86 case SC_RND_MIN_INF: 87 return std::string("SC_RND_MIN_INF"); 88 case SC_RND_INF: 89 return std::string("SC_RND_INF"); 90 case SC_RND_CONV: 91 return std::string("SC_RND_CONV"); 92 case SC_TRN: 93 return std::string("SC_TRN"); 94 case SC_TRN_ZERO: 95 return std::string("SC_TRN_ZERO"); 96 default: 97 return std::string("unknown"); 98 } 99} 100 101// ---------------------------------------------------------------------------- 102// ENUM : sc_o_mode 103// 104// Enumeration of overflow modes. 105// ---------------------------------------------------------------------------- 106 107const std::string 108to_string(sc_o_mode o_mode) 109{ 110 switch (o_mode) { 111 case SC_SAT: 112 return std::string("SC_SAT"); 113 case SC_SAT_ZERO: 114 return std::string("SC_SAT_ZERO"); 115 case SC_SAT_SYM: 116 return std::string("SC_SAT_SYM"); 117 case SC_WRAP: 118 return std::string("SC_WRAP"); 119 case SC_WRAP_SM: 120 return std::string("SC_WRAP_SM"); 121 default: 122 return std::string("unknown"); 123 } 124} 125 126 127// ---------------------------------------------------------------------------- 128// ENUM : sc_switch 129// 130// Enumeration of switch states. 131// ---------------------------------------------------------------------------- 132 133const std::string 134to_string(sc_switch sw) 135{ 136 switch (sw) { 137 case SC_OFF: 138 return std::string("SC_OFF"); 139 case SC_ON: 140 return std::string("SC_ON"); 141 default: 142 return std::string("unknown"); 143 } 144} 145 146 147// ---------------------------------------------------------------------------- 148// ENUM : sc_fmt 149// 150// Enumeration of formats for character string conversion. 151// ---------------------------------------------------------------------------- 152 153const std::string 154to_string(sc_fmt fmt) 155{ 156 switch (fmt) { 157 case SC_F: 158 return std::string("SC_F"); 159 case SC_E: 160 return std::string("SC_E"); 161 default: 162 return std::string("unknown"); 163 } 164} 165 166} // namespace sc_dt 167