112854Sgabeblack@google.com/*****************************************************************************
212854Sgabeblack@google.com
312854Sgabeblack@google.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412854Sgabeblack@google.com  more contributor license agreements.  See the NOTICE file distributed
512854Sgabeblack@google.com  with this work for additional information regarding copyright ownership.
612854Sgabeblack@google.com  Accellera licenses this file to you under the Apache License, Version 2.0
712854Sgabeblack@google.com  (the "License"); you may not use this file except in compliance with the
812854Sgabeblack@google.com  License.  You may obtain a copy of the License at
912854Sgabeblack@google.com
1012854Sgabeblack@google.com    http://www.apache.org/licenses/LICENSE-2.0
1112854Sgabeblack@google.com
1212854Sgabeblack@google.com  Unless required by applicable law or agreed to in writing, software
1312854Sgabeblack@google.com  distributed under the License is distributed on an "AS IS" BASIS,
1412854Sgabeblack@google.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512854Sgabeblack@google.com  implied.  See the License for the specific language governing
1612854Sgabeblack@google.com  permissions and limitations under the License.
1712854Sgabeblack@google.com
1812854Sgabeblack@google.com *****************************************************************************/
1912854Sgabeblack@google.com
2012854Sgabeblack@google.com/*****************************************************************************
2112854Sgabeblack@google.com
2212854Sgabeblack@google.com  sc_fxdefs.cpp -
2312854Sgabeblack@google.com
2412854Sgabeblack@google.com  Original Author: Martin Janssen, Synopsys, Inc.
2512854Sgabeblack@google.com
2612854Sgabeblack@google.com *****************************************************************************/
2712854Sgabeblack@google.com
2812854Sgabeblack@google.com/*****************************************************************************
2912854Sgabeblack@google.com
3012854Sgabeblack@google.com  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3112854Sgabeblack@google.com  changes you are making here.
3212854Sgabeblack@google.com
3312854Sgabeblack@google.com      Name, Affiliation, Date:
3412854Sgabeblack@google.com  Description of Modification:
3512854Sgabeblack@google.com
3612854Sgabeblack@google.com *****************************************************************************/
3712854Sgabeblack@google.com
3812854Sgabeblack@google.com
3912854Sgabeblack@google.com// $Log: sc_fxdefs.cpp,v $
4012854Sgabeblack@google.com// Revision 1.1.1.1  2006/12/15 20:20:04  acg
4112854Sgabeblack@google.com// SystemC 2.3
4212854Sgabeblack@google.com//
4312854Sgabeblack@google.com// Revision 1.3  2006/01/13 18:53:57  acg
4412854Sgabeblack@google.com// Andy Goodrich: added $Log command so that CVS comments are reproduced in
4512854Sgabeblack@google.com// the source.
4612854Sgabeblack@google.com//
4712854Sgabeblack@google.com
4812854Sgabeblack@google.com#include "systemc/ext/dt/fx/sc_fxdefs.hh"
4912854Sgabeblack@google.com
5012854Sgabeblack@google.comnamespace sc_dt
5112854Sgabeblack@google.com{
5212854Sgabeblack@google.com
5312854Sgabeblack@google.com// ----------------------------------------------------------------------------
5412854Sgabeblack@google.com//  ENUM : sc_enc
5512854Sgabeblack@google.com//
5612854Sgabeblack@google.com//  Enumeration of sign encodings.
5712854Sgabeblack@google.com// ----------------------------------------------------------------------------
5812854Sgabeblack@google.com
5912854Sgabeblack@google.comconst std::string
6012854Sgabeblack@google.comto_string(sc_enc enc)
6112854Sgabeblack@google.com{
6212854Sgabeblack@google.com    switch (enc) {
6312854Sgabeblack@google.com        case SC_TC_:
6412854Sgabeblack@google.com            return std::string("SC_TC_");
6512854Sgabeblack@google.com        case SC_US_:
6612854Sgabeblack@google.com            return std::string("SC_US_");
6712854Sgabeblack@google.com        default:
6812854Sgabeblack@google.com            return std::string("unknown");
6912854Sgabeblack@google.com    }
7012854Sgabeblack@google.com}
7112854Sgabeblack@google.com
7212854Sgabeblack@google.com// ----------------------------------------------------------------------------
7312854Sgabeblack@google.com//  ENUM : sc_q_mode
7412854Sgabeblack@google.com//
7512854Sgabeblack@google.com//  Enumeration of quantization modes.
7612854Sgabeblack@google.com// ----------------------------------------------------------------------------
7712854Sgabeblack@google.com
7812854Sgabeblack@google.comconst std::string
7912854Sgabeblack@google.comto_string(sc_q_mode q_mode)
8012854Sgabeblack@google.com{
8112854Sgabeblack@google.com    switch (q_mode) {
8212854Sgabeblack@google.com        case SC_RND:
8312854Sgabeblack@google.com            return std::string("SC_RND");
8412854Sgabeblack@google.com        case SC_RND_ZERO:
8512854Sgabeblack@google.com            return std::string("SC_RND_ZERO");
8612854Sgabeblack@google.com        case SC_RND_MIN_INF:
8712854Sgabeblack@google.com            return std::string("SC_RND_MIN_INF");
8812854Sgabeblack@google.com        case SC_RND_INF:
8912854Sgabeblack@google.com            return std::string("SC_RND_INF");
9012854Sgabeblack@google.com        case SC_RND_CONV:
9112854Sgabeblack@google.com            return std::string("SC_RND_CONV");
9212854Sgabeblack@google.com        case SC_TRN:
9312854Sgabeblack@google.com            return std::string("SC_TRN");
9412854Sgabeblack@google.com        case SC_TRN_ZERO:
9512854Sgabeblack@google.com            return std::string("SC_TRN_ZERO");
9612854Sgabeblack@google.com        default:
9712854Sgabeblack@google.com            return std::string("unknown");
9812854Sgabeblack@google.com    }
9912854Sgabeblack@google.com}
10012854Sgabeblack@google.com
10112854Sgabeblack@google.com// ----------------------------------------------------------------------------
10212854Sgabeblack@google.com//  ENUM : sc_o_mode
10312854Sgabeblack@google.com//
10412854Sgabeblack@google.com//  Enumeration of overflow modes.
10512854Sgabeblack@google.com// ----------------------------------------------------------------------------
10612854Sgabeblack@google.com
10712854Sgabeblack@google.comconst std::string
10812854Sgabeblack@google.comto_string(sc_o_mode o_mode)
10912854Sgabeblack@google.com{
11012854Sgabeblack@google.com    switch (o_mode) {
11112854Sgabeblack@google.com        case SC_SAT:
11212854Sgabeblack@google.com            return std::string("SC_SAT");
11312854Sgabeblack@google.com        case SC_SAT_ZERO:
11412854Sgabeblack@google.com            return std::string("SC_SAT_ZERO");
11512854Sgabeblack@google.com        case SC_SAT_SYM:
11612854Sgabeblack@google.com            return std::string("SC_SAT_SYM");
11712854Sgabeblack@google.com        case SC_WRAP:
11812854Sgabeblack@google.com            return std::string("SC_WRAP");
11912854Sgabeblack@google.com        case SC_WRAP_SM:
12012854Sgabeblack@google.com            return std::string("SC_WRAP_SM");
12112854Sgabeblack@google.com        default:
12212854Sgabeblack@google.com            return std::string("unknown");
12312854Sgabeblack@google.com    }
12412854Sgabeblack@google.com}
12512854Sgabeblack@google.com
12612854Sgabeblack@google.com
12712854Sgabeblack@google.com// ----------------------------------------------------------------------------
12812854Sgabeblack@google.com//  ENUM : sc_switch
12912854Sgabeblack@google.com//
13012854Sgabeblack@google.com//  Enumeration of switch states.
13112854Sgabeblack@google.com// ----------------------------------------------------------------------------
13212854Sgabeblack@google.com
13312854Sgabeblack@google.comconst std::string
13412854Sgabeblack@google.comto_string(sc_switch sw)
13512854Sgabeblack@google.com{
13612854Sgabeblack@google.com    switch (sw) {
13712854Sgabeblack@google.com        case SC_OFF:
13812854Sgabeblack@google.com            return std::string("SC_OFF");
13912854Sgabeblack@google.com        case SC_ON:
14012854Sgabeblack@google.com            return std::string("SC_ON");
14112854Sgabeblack@google.com        default:
14212854Sgabeblack@google.com            return std::string("unknown");
14312854Sgabeblack@google.com    }
14412854Sgabeblack@google.com}
14512854Sgabeblack@google.com
14612854Sgabeblack@google.com
14712854Sgabeblack@google.com// ----------------------------------------------------------------------------
14812854Sgabeblack@google.com//  ENUM : sc_fmt
14912854Sgabeblack@google.com//
15012854Sgabeblack@google.com//  Enumeration of formats for character string conversion.
15112854Sgabeblack@google.com// ----------------------------------------------------------------------------
15212854Sgabeblack@google.com
15312854Sgabeblack@google.comconst std::string
15412854Sgabeblack@google.comto_string(sc_fmt fmt)
15512854Sgabeblack@google.com{
15612854Sgabeblack@google.com    switch (fmt) {
15712854Sgabeblack@google.com        case SC_F:
15812854Sgabeblack@google.com            return std::string("SC_F");
15912854Sgabeblack@google.com        case SC_E:
16012854Sgabeblack@google.com            return std::string("SC_E");
16112854Sgabeblack@google.com        default:
16212854Sgabeblack@google.com            return std::string("unknown");
16312854Sgabeblack@google.com    }
16412854Sgabeblack@google.com}
16512854Sgabeblack@google.com
16612854Sgabeblack@google.com} // namespace sc_dt
167