gem5  v20.1.0.0
sc_sensitive.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include "systemc/core/process.hh"
37 
38 namespace sc_core
39 {
40 
41 namespace
42 {
43 
44 void
45 checkIfRunning()
46 {
47  if (sc_is_running())
48  SC_REPORT_ERROR(SC_ID_MAKE_SENSITIVE_, "simulation running");
49 }
50 
51 } // anonymous namespace
52 
53 sc_sensitive::sc_sensitive() : currentProcess(nullptr) {}
54 
57 {
58  checkIfRunning();
60  return *this;
61 }
62 
65 {
66  checkIfRunning();
68  return *this;
69 }
70 
73 {
74  checkIfRunning();
76  return *this;
77 }
78 
81 {
82  checkIfRunning();
84  return *this;
85 }
86 
89 {
90  currentProcess = p;
91  return *this;
92 }
93 
94 
95 void
97  const sc_signal_in_if<bool> &i)
98 {
99  checkIfRunning();
100  sc_gem5::newStaticSensitivityEvent(p, &i.posedge_event());
101 }
102 
103 void
106 {
107  checkIfRunning();
108  sc_gem5::newStaticSensitivityEvent(p, &i.posedge_event());
109 }
110 
111 void
113 {
114  checkIfRunning();
116 }
117 
118 void
120  const sc_in<sc_dt::sc_logic> &port)
121 {
122  checkIfRunning();
124 }
125 
126 void
128 {
129  checkIfRunning();
131 }
132 
133 void
135  const sc_inout<sc_dt::sc_logic> &port)
136 {
137  checkIfRunning();
139 }
140 
141 void
143 {
144  checkIfRunning();
146 }
147 
148 } // namespace sc_core
sc_core::sc_port_base
Definition: sc_port.hh:74
sc_core::sc_in< bool >
Definition: sc_in.hh:165
sc_core::sc_signal_in_if< bool >
Definition: sc_signal_in_if.hh:74
sc_gem5::newStaticSensitivityEvent
void newStaticSensitivityEvent(Process *p, const sc_core::sc_event *e)
Definition: sensitivity.cc:122
sc_core::sc_in< sc_dt::sc_logic >::pos
sc_event_finder & pos() const
Definition: sc_in.hh:453
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
sc_core::sc_inout< sc_dt::sc_logic >
Definition: sc_inout.hh:366
sc_core
Definition: messages.cc:31
sc_inout.hh
sc_core::sc_interface
Definition: sc_interface.hh:37
sc_core::sc_inout< sc_dt::sc_logic >::pos
sc_event_finder & pos() const
Definition: sc_inout.hh:522
sc_core::sc_sensitive::sc_sensitive
sc_sensitive()
Definition: sc_sensitive.cc:53
sc_core::sc_inout< bool >::pos
sc_event_finder & pos() const
Definition: sc_inout.hh:332
sc_gem5::newStaticSensitivityFinder
void newStaticSensitivityFinder(Process *p, const sc_core::sc_event_finder *f)
Definition: sensitivity.cc:155
sc_core::sc_in< bool >::pos
sc_event_finder & pos() const
Definition: sc_in.hh:293
sc_core::sc_sensitive::currentProcess
::sc_gem5::Process * currentProcess
Definition: sc_sensitive.hh:94
sc_core::sc_sensitive
Definition: sc_sensitive.hh:63
SC_REPORT_ERROR
#define SC_REPORT_ERROR(msg_type, msg)
Definition: sc_report_handler.hh:127
sc_core::sc_in< sc_dt::sc_logic >
Definition: sc_in.hh:328
sc_core::sc_event
Definition: sc_event.hh:169
sc_main.hh
sc_signal_in_if.hh
sc_gem5::newStaticSensitivityPort
void newStaticSensitivityPort(Process *p, const sc_core::sc_port_base *pb)
Definition: sensitivity.cc:138
sc_interface.hh
messages.hh
sc_in.hh
sc_gem5::Process
Definition: process.hh:62
process.hh
ArmISA::e
Bitfield< 9 > e
Definition: miscregs_types.hh:61
sc_sensitive.hh
sc_report_handler.hh
sc_gem5::newStaticSensitivityInterface
void newStaticSensitivityInterface(Process *p, const sc_core::sc_interface *i)
Definition: sensitivity.cc:130
ArmISA::b
Bitfield< 7 > b
Definition: miscregs_types.hh:376
sc_core::sc_signal_in_if< sc_dt::sc_logic >
Definition: sc_signal_in_if.hh:108
sc_core::sc_inout< bool >
Definition: sc_inout.hh:193
sc_core::sc_sensitive::operator<<
sc_sensitive & operator<<(const sc_event &)
Definition: sc_sensitive.cc:56
sc_core::sc_event_finder
Definition: sc_event.hh:212
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
sc_core::sc_sensitive::operator()
void operator()(::sc_gem5::Process *p, const sc_signal_in_if< bool > &)
Definition: sc_sensitive.cc:96
sc_core::SC_ID_MAKE_SENSITIVE_
const char SC_ID_MAKE_SENSITIVE_[]
Definition: messages.cc:74
ArmISA::f
Bitfield< 6 > f
Definition: miscregs_types.hh:64
sc_core::sc_is_running
bool sc_is_running()
Definition: sc_main.cc:142

Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17