gem5  v22.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_event_finder & pos() const
Definition: sc_in.hh:293
sc_event_finder & pos() const
Definition: sc_in.hh:453
sc_event_finder & pos() const
Definition: sc_inout.hh:332
sc_event_finder & pos() const
Definition: sc_inout.hh:522
sc_sensitive & operator<<(const sc_event &)
Definition: sc_sensitive.cc:56
::sc_gem5::Process * currentProcess
Definition: sc_sensitive.hh:94
void operator()(::sc_gem5::Process *p, const sc_signal_in_if< bool > &)
Definition: sc_sensitive.cc:96
Bitfield< 7 > b
Definition: misc_types.hh:388
Bitfield< 7 > i
Definition: misc_types.hh:67
Bitfield< 9 > e
Definition: misc_types.hh:65
Bitfield< 56 > f
Definition: pagetable.hh:53
Bitfield< 54 > p
Definition: pagetable.hh:70
const char SC_ID_MAKE_SENSITIVE_[]
Definition: messages.cc:74
bool sc_is_running()
Definition: sc_main.cc:141
void newStaticSensitivityInterface(Process *p, const sc_core::sc_interface *i)
Definition: sensitivity.cc:130
void newStaticSensitivityFinder(Process *p, const sc_core::sc_event_finder *f)
Definition: sensitivity.cc:155
void newStaticSensitivityEvent(Process *p, const sc_core::sc_event *e)
Definition: sensitivity.cc:122
void newStaticSensitivityPort(Process *p, const sc_core::sc_port_base *pb)
Definition: sensitivity.cc:138
#define SC_REPORT_ERROR(msg_type, msg)

Generated on Wed Dec 21 2022 10:22:40 for gem5 by doxygen 1.9.1