1 /*****************************************************************************
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
10 http://www.apache.org/licenses/LICENSE-2.0
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.
18 *****************************************************************************/
20 /*****************************************************************************
22 sc_bit.cpp -- Bit class.
24 Original Author: Gene Bushuyev, Synopsys, Inc.
26 *****************************************************************************/
28 /*****************************************************************************
30 MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31 changes you are making here.
33 Name, Affiliation, Date:
34 Description of Modification:
36 *****************************************************************************/
39 // $Log: sc_bit.cpp,v $
40 // Revision 1.1.1.1 2006/12/15 20:20:04 acg
43 // Revision 1.6 2006/04/12 20:17:52 acg
44 // Andy Goodrich: enabled deprecation message for sc_bit.
46 // Revision 1.5 2006/01/25 00:31:15 acg
47 // Andy Goodrich: Changed over to use a standard message id of
48 // SC_ID_IEEE_1666_DEPRECATION for all deprecation messages.
50 // Revision 1.4 2006/01/24 20:50:55 acg
51 // Andy Goodrich: added warnings indicating that sc_bit is deprecated and that
52 // the C bool data type should be used in its place.
54 // Revision 1.3 2006/01/13 18:53:53 acg
55 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
61 #include "systemc/ext/dt/bit/sc_bit.hh"
62 #include "systemc/ext/dt/bit/sc_logic.hh"
63 #include "systemc/ext/utils/sc_report_handler.hh"
68 // ----------------------------------------------------------------------------
72 // Note: VSIA compatibility indicated.
73 // ----------------------------------------------------------------------------
77 sc_bit::invalid_value(char c
)
79 std::stringstream msg
;
80 msg
<< "sc_bit('" << c
<< "')";
81 SC_REPORT_ERROR("value is not valid", msg
.str().c_str());
82 sc_core::sc_abort(); // can't recover from here
86 sc_bit::invalid_value(int i
)
88 std::stringstream msg
;
89 msg
<< "sc_bit(" << i
<< ")";
90 SC_REPORT_ERROR("value is not valid", msg
.str().c_str());
91 sc_core::sc_abort(); // can't recover from here
95 sc_bit::sc_bit(const sc_logic
&a
) : m_val(a
.to_bool()) // non-VSIA
97 sc_deprecated_sc_bit();
100 // assignment operators
102 sc_bit::operator = (const sc_logic
&b
) // non-VSIA
104 return (*this = sc_bit(b
));
109 sc_bit::scan(::std::istream
&is
)
117 sc_deprecated_sc_bit()
119 static bool warn_sc_bit_deprecated
= true;
120 if (warn_sc_bit_deprecated
) {
121 warn_sc_bit_deprecated
= false;
122 SC_REPORT_INFO("/IEEE_Std_1666/deprecated",
123 "sc_bit is deprecated, use bool instead");