gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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  * Authors: Gabe Black
28  */
29 
30 #include "systemc/core/process.hh"
39 
40 namespace sc_core
41 {
42 
43 namespace
44 {
45 
46 void
47 checkIfRunning()
48 {
49  if (sc_is_running())
50  SC_REPORT_ERROR(SC_ID_MAKE_SENSITIVE_, "simulation running");
51 }
52 
53 } // anonymous namespace
54 
55 sc_sensitive::sc_sensitive() : currentProcess(nullptr) {}
56 
59 {
60  checkIfRunning();
62  return *this;
63 }
64 
67 {
68  checkIfRunning();
70  return *this;
71 }
72 
75 {
76  checkIfRunning();
78  return *this;
79 }
80 
83 {
84  checkIfRunning();
86  return *this;
87 }
88 
91 {
92  currentProcess = p;
93  return *this;
94 }
95 
96 
97 void
99  const sc_signal_in_if<bool> &i)
100 {
101  checkIfRunning();
103 }
104 
105 void
108 {
109  checkIfRunning();
111 }
112 
113 void
115 {
116  checkIfRunning();
118 }
119 
120 void
122  const sc_in<sc_dt::sc_logic> &port)
123 {
124  checkIfRunning();
126 }
127 
128 void
130 {
131  checkIfRunning();
133 }
134 
135 void
137  const sc_inout<sc_dt::sc_logic> &port)
138 {
139  checkIfRunning();
141 }
142 
143 void
145 {
146  checkIfRunning();
148 }
149 
150 } // namespace sc_core
sc_sensitive & operator<<(const sc_event &)
Definition: sc_sensitive.cc:58
virtual const sc_event & posedge_event() const =0
bool sc_is_running()
Definition: sc_main.cc:144
Bitfield< 7 > i
void newStaticSensitivityInterface(Process *p, const sc_core::sc_interface *i)
Definition: sensitivity.cc:132
sc_event_finder & pos() const
Definition: sc_in.hh:455
sc_event_finder & pos() const
Definition: sc_inout.hh:524
const char SC_ID_MAKE_SENSITIVE_[]
Definition: messages.cc:76
Bitfield< 6 > f
virtual const sc_event & posedge_event() const =0
void newStaticSensitivityPort(Process *p, const sc_core::sc_port_base *pb)
Definition: sensitivity.cc:140
Bitfield< 7 > b
sc_event_finder & pos() const
Definition: sc_inout.hh:334
sc_event_finder & pos() const
Definition: sc_in.hh:295
::sc_gem5::Process * currentProcess
Definition: sc_sensitive.hh:96
void newStaticSensitivityFinder(Process *p, const sc_core::sc_event_finder *f)
Definition: sensitivity.cc:157
void operator()(::sc_gem5::Process *p, const sc_signal_in_if< bool > &)
Definition: sc_sensitive.cc:98
void newStaticSensitivityEvent(Process *p, const sc_core::sc_event *e)
Definition: sensitivity.cc:124
Bitfield< 9 > e
#define SC_REPORT_ERROR(msg_type, msg)
Bitfield< 0 > p

Generated on Fri Feb 28 2020 16:27:03 for gem5 by doxygen 1.8.13