gem5
v20.1.0.0
systemc
dt
bit
sc_bit.cc
Go to the documentation of this file.
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_bit.cpp -- Bit class.
23
24
Original Author: Gene Bushuyev, 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_bit.cpp,v $
40
// Revision 1.1.1.1 2006/12/15 20:20:04 acg
41
// SystemC 2.3
42
//
43
// Revision 1.6 2006/04/12 20:17:52 acg
44
// Andy Goodrich: enabled deprecation message for sc_bit.
45
//
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.
49
//
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.
53
//
54
// Revision 1.3 2006/01/13 18:53:53 acg
55
// Andy Goodrich: added $Log command so that CVS comments are reproduced in
56
// the source.
57
//
58
59
#include <sstream>
60
61
#include "
systemc/ext/dt/bit/messages.hh
"
62
#include "
systemc/ext/dt/bit/sc_bit.hh
"
63
#include "
systemc/ext/dt/bit/sc_logic.hh
"
64
#include "
systemc/ext/utils/messages.hh
"
65
#include "
systemc/ext/utils/sc_report_handler.hh
"
66
67
namespace
sc_dt
68
{
69
70
// ----------------------------------------------------------------------------
71
// CLASS : sc_bit
72
//
73
// Bit class.
74
// Note: VSIA compatibility indicated.
75
// ----------------------------------------------------------------------------
76
77
// support methods
78
void
79
sc_bit::invalid_value
(
char
c
)
80
{
81
std::stringstream msg;
82
msg <<
"sc_bit( '"
<<
c
<<
"' )"
;
83
SC_REPORT_ERROR
(
sc_core::SC_ID_VALUE_NOT_VALID_
, msg.str().c_str());
84
sc_core::sc_abort
();
// can't recover from here
85
}
86
87
void
88
sc_bit::invalid_value
(
int
i
)
89
{
90
std::stringstream msg;
91
msg <<
"sc_bit( "
<<
i
<<
" )"
;
92
SC_REPORT_ERROR
(
sc_core::SC_ID_VALUE_NOT_VALID_
, msg.str().c_str());
93
sc_core::sc_abort
();
// can't recover from here
94
}
95
96
// constructors
97
sc_bit::sc_bit
(
const
sc_logic
&
a
) : m_val(
a
.to_bool())
// non-VSIA
98
{
99
sc_deprecated_sc_bit
();
100
}
101
102
// assignment operators
103
sc_bit
&
104
sc_bit::operator =
(
const
sc_logic
&
b
)
// non-VSIA
105
{
106
return
(*
this
=
sc_bit
(
b
));
107
}
108
109
// other methods
110
void
111
sc_bit::scan
(::std::istream &
is
)
112
{
113
bool
b
;
114
is
>>
b
;
115
*
this
=
b
;
116
}
117
118
void
119
sc_deprecated_sc_bit
()
120
{
121
static
bool
warn_sc_bit_deprecated =
true
;
122
if
(warn_sc_bit_deprecated) {
123
warn_sc_bit_deprecated =
false
;
124
SC_REPORT_INFO
(
sc_core::SC_ID_IEEE_1666_DEPRECATION_
,
125
"sc_bit is deprecated, use bool instead"
);
126
}
127
}
128
129
}
// namespace sc_dt
sc_core::SC_ID_VALUE_NOT_VALID_
const char SC_ID_VALUE_NOT_VALID_[]
Definition:
messages.cc:39
sc_core::SC_ID_IEEE_1666_DEPRECATION_
const char SC_ID_IEEE_1666_DEPRECATION_[]
Definition:
messages.cc:48
messages.hh
sc_dt::sc_deprecated_sc_bit
void sc_deprecated_sc_bit()
Definition:
sc_bit.cc:150
sc_dt
Definition:
sc_bit.cc:67
ArmISA::i
Bitfield< 7 > i
Definition:
miscregs_types.hh:63
sc_dt::sc_bit::invalid_value
static void invalid_value(char)
Definition:
sc_bit.cc:110
sc_dt::sc_logic
Definition:
sc_logic.hh:130
MipsISA::is
Bitfield< 24, 22 > is
Definition:
pra_constants.hh:232
sc_bit.hh
sc_dt::sc_bit::operator=
sc_bit & operator=(const sc_bit &b)
Definition:
sc_bit.hh:187
ArmISA::a
Bitfield< 8 > a
Definition:
miscregs_types.hh:62
SC_REPORT_ERROR
#define SC_REPORT_ERROR(msg_type, msg)
Definition:
sc_report_handler.hh:127
messages.hh
sc_dt::sc_bit::scan
void scan(::std::istream &=::std::cin)
Definition:
sc_bit.cc:142
sc_dt::sc_bit
Definition:
sc_bit.hh:118
sc_dt::sc_bit::sc_bit
sc_bit()
Definition:
sc_bit.hh:158
SC_REPORT_INFO
#define SC_REPORT_INFO(msg_type, msg)
Definition:
sc_report_handler.hh:119
sc_report_handler.hh
ArmISA::b
Bitfield< 7 > b
Definition:
miscregs_types.hh:376
sc_core::sc_abort
void sc_abort()
Definition:
sc_report.cc:178
ArmISA::c
Bitfield< 29 > c
Definition:
miscregs_types.hh:50
sc_logic.hh
Generated on Wed Sep 30 2020 14:02:14 for gem5 by
doxygen
1.8.17