gem5  v22.0.0.2
sc_logic.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_logic.cpp -- C++ implementation of logic type. Behaves
23  pretty much the same way as HDLs logic type.
24 
25  Original Author: Stan Y. Liao, Synopsys, Inc.
26 
27  *****************************************************************************/
28 
29 /*****************************************************************************
30 
31  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
32  changes you are making here.
33 
34  Name, Affiliation, Date:
35  Description of Modification:
36 
37  *****************************************************************************/
38 
39 
40 // $Log: sc_logic.cpp,v $
41 // Revision 1.1.1.1 2006/12/15 20:20:04 acg
42 // SystemC 2.3
43 //
44 // Revision 1.3 2006/01/13 18:53:53 acg
45 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
46 // the source.
47 //
48 
49 #include <sstream>
50 
54 
55 namespace sc_dt
56 {
57 
58 // ----------------------------------------------------------------------------
59 // CLASS : sc_logic
60 //
61 // Four-valued logic type.
62 // ----------------------------------------------------------------------------
63 
64 // support methods
65 void
67 {
68  invalid_value((int)v);
69 }
70 
71 void
73 {
74  std::stringstream msg;
75  msg << "sc_logic('" << c << "')";
77 }
78 
79 void
81 {
82  std::stringstream msg;
83  msg << "sc_logic(" << i << ")";
85 }
86 
87 
88 void
90 {
91  if ((int)m_val == Log_Z)
93  else
95 }
96 
97 
98 // conversion tables
116 };
117 
118 const char sc_logic::logic_to_char[4] = { '0', '1', 'Z', 'X' };
119 
122  { Log_0, Log_1, Log_X, Log_X },
123  { Log_0, Log_X, Log_X, Log_X },
124  { Log_0, Log_X, Log_X, Log_X }
125 };
126 
127 const sc_logic_value_t sc_logic::or_table[4][4] = {
128  { Log_0, Log_1, Log_X, Log_X },
129  { Log_1, Log_1, Log_1, Log_1 },
130  { Log_X, Log_1, Log_X, Log_X },
131  { Log_X, Log_1, Log_X, Log_X }
132 };
133 
135  { Log_0, Log_1, Log_X, Log_X },
136  { Log_1, Log_0, Log_X, Log_X },
137  { Log_X, Log_X, Log_X, Log_X },
138  { Log_X, Log_X, Log_X, Log_X }
139 };
140 
143 };
144 
145 // other methods
146 void
147 sc_logic::scan(::std::istream &is)
148 {
149  char c;
150  is >> c;
151  *this = c;
152 }
153 
154 // #ifdef SC_DT_DEPRECATED
155 const sc_logic sc_logic_0(Log_0);
156 const sc_logic sc_logic_1(Log_1);
157 const sc_logic sc_logic_Z(Log_Z);
158 const sc_logic sc_logic_X(Log_X);
159 // #endif
160 
161 const sc_logic SC_LOGIC_0(Log_0);
162 const sc_logic SC_LOGIC_1(Log_1);
163 const sc_logic SC_LOGIC_Z(Log_Z);
164 const sc_logic SC_LOGIC_X(Log_X);
165 
166 } // namespace sc_dt
sc_core::SC_ID_VALUE_NOT_VALID_
const char SC_ID_VALUE_NOT_VALID_[]
Definition: messages.cc:39
sc_dt
Definition: sc_bit.cc:67
sc_dt::sc_logic::logic_to_char
static const char logic_to_char[4]
Definition: sc_logic.hh:179
sc_dt::sc_logic::and_table
static const sc_logic_value_t and_table[4][4]
Definition: sc_logic.hh:180
sc_core::SC_ID_LOGIC_X_TO_BOOL_
const char SC_ID_LOGIC_X_TO_BOOL_[]
Definition: messages.cc:50
sc_dt::sc_logic_0
const sc_logic sc_logic_0(Log_0)
Definition: sc_logic.hh:405
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:67
sc_dt::sc_logic::invalid_value
static void invalid_value(sc_logic_value_t)
Definition: sc_logic.cc:98
sc_dt::sc_logic_Z
const sc_logic sc_logic_Z(Log_Z)
Definition: sc_logic.hh:407
sc_dt::sc_logic_value_t
sc_logic_value_t
Definition: sc_logic.hh:116
sc_dt::sc_logic::char_to_logic
static const sc_logic_value_t char_to_logic[128]
Definition: sc_logic.hh:178
sc_dt::sc_logic::scan
void scan(::std::istream &is=::std::cin)
Definition: sc_logic.cc:179
gem5::MipsISA::is
Bitfield< 24, 22 > is
Definition: pra_constants.hh:235
sc_dt::sc_logic::invalid_01
void invalid_01() const
Definition: sc_logic.cc:121
sc_core::SC_ID_LOGIC_Z_TO_BOOL_
const char SC_ID_LOGIC_Z_TO_BOOL_[]
Definition: messages.cc:48
gem5::VegaISA::c
Bitfield< 2 > c
Definition: pagetable.hh:63
SC_REPORT_ERROR
#define SC_REPORT_ERROR(msg_type, msg)
Definition: sc_report_handler.hh:127
messages.hh
sc_dt::SC_LOGIC_X
const sc_logic SC_LOGIC_X(Log_X)
Definition: sc_logic.hh:402
sc_dt::Log_Z
@ Log_Z
Definition: sc_logic.hh:120
sc_dt::sc_logic::or_table
static const sc_logic_value_t or_table[4][4]
Definition: sc_logic.hh:181
sc_dt::SC_LOGIC_0
const sc_logic SC_LOGIC_0(Log_0)
Definition: sc_logic.hh:399
sc_dt::SC_LOGIC_Z
const sc_logic SC_LOGIC_Z(Log_Z)
Definition: sc_logic.hh:401
SC_REPORT_WARNING
#define SC_REPORT_WARNING(msg_type, msg)
Definition: sc_report_handler.hh:123
sc_report_handler.hh
gem5::VegaISA::v
Bitfield< 0 > v
Definition: pagetable.hh:65
sc_dt::sc_logic_1
const sc_logic sc_logic_1(Log_1)
Definition: sc_logic.hh:406
sc_dt::sc_logic::xor_table
static const sc_logic_value_t xor_table[4][4]
Definition: sc_logic.hh:182
sc_dt::Log_X
@ Log_X
Definition: sc_logic.hh:121
sc_dt::Log_0
@ Log_0
Definition: sc_logic.hh:118
sc_dt::sc_logic::not_table
static const sc_logic_value_t not_table[4]
Definition: sc_logic.hh:183
sc_dt::sc_logic_X
const sc_logic sc_logic_X(Log_X)
Definition: sc_logic.hh:408
sc_dt::Log_1
@ Log_1
Definition: sc_logic.hh:119
sc_dt::sc_logic::m_val
sc_logic_value_t m_val
Definition: sc_logic.hh:311
sc_dt::SC_LOGIC_1
const sc_logic SC_LOGIC_1(Log_1)
Definition: sc_logic.hh:400
sc_logic.hh

Generated on Thu Jul 28 2022 13:32:37 for gem5 by doxygen 1.8.17