sensitivity.hh (13208:6703cb024823) sensitivity.hh (13260:4d18f1d20093)
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

--- 22 unchanged lines hidden (view full) ---

31#define __SYSTEMC_CORE_SENSITIVITY_HH__
32
33#include <set>
34#include <vector>
35
36#include "sim/eventq.hh"
37#include "systemc/core/sched_event.hh"
38#include "systemc/ext/core/sc_module.hh"
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

--- 22 unchanged lines hidden (view full) ---

31#define __SYSTEMC_CORE_SENSITIVITY_HH__
32
33#include <set>
34#include <vector>
35
36#include "sim/eventq.hh"
37#include "systemc/core/sched_event.hh"
38#include "systemc/ext/core/sc_module.hh"
39#include "systemc/ext/core/sc_port.hh"
39
40namespace sc_core
41{
42
43class sc_event;
44class sc_event_and_list;
45class sc_event_or_list;
46class sc_event_finder;

--- 32 unchanged lines hidden (view full) ---

79 }
80
81 public:
82 virtual void clear() = 0;
83
84 void satisfy();
85 bool notify(Event *e);
86
40
41namespace sc_core
42{
43
44class sc_event;
45class sc_event_and_list;
46class sc_event_or_list;
47class sc_event_finder;

--- 32 unchanged lines hidden (view full) ---

80 }
81
82 public:
83 virtual void clear() = 0;
84
85 void satisfy();
86 bool notify(Event *e);
87
87 virtual bool dynamic() = 0;
88 enum Category
89 {
90 Static,
91 Dynamic,
92 Reset
93 };
88
94
95 virtual Category category() = 0;
96
89 bool ofMethod();
90};
91
92
93/*
97 bool ofMethod();
98};
99
100
101/*
94 * Dynamic vs. static sensitivity.
102 * Dynamic vs. static vs. reset sensitivity.
95 */
96
97class DynamicSensitivity : virtual public Sensitivity
98{
99 protected:
100 DynamicSensitivity(Process *p) : Sensitivity(p) {}
101
102 void addToEvent(const ::sc_core::sc_event *e) override;
103 void delFromEvent(const ::sc_core::sc_event *e) override;
104
105 public:
103 */
104
105class DynamicSensitivity : virtual public Sensitivity
106{
107 protected:
108 DynamicSensitivity(Process *p) : Sensitivity(p) {}
109
110 void addToEvent(const ::sc_core::sc_event *e) override;
111 void delFromEvent(const ::sc_core::sc_event *e) override;
112
113 public:
106 bool dynamic() override { return true; }
114 Category category() override { return Dynamic; }
107};
108
109typedef std::vector<DynamicSensitivity *> DynamicSensitivities;
110
111
112class StaticSensitivity : virtual public Sensitivity
113{
114 protected:
115 StaticSensitivity(Process *p) : Sensitivity(p) {}
116
117 void addToEvent(const ::sc_core::sc_event *e) override;
118 void delFromEvent(const ::sc_core::sc_event *e) override;
119
120 public:
115};
116
117typedef std::vector<DynamicSensitivity *> DynamicSensitivities;
118
119
120class StaticSensitivity : virtual public Sensitivity
121{
122 protected:
123 StaticSensitivity(Process *p) : Sensitivity(p) {}
124
125 void addToEvent(const ::sc_core::sc_event *e) override;
126 void delFromEvent(const ::sc_core::sc_event *e) override;
127
128 public:
121 bool dynamic() override { return false; }
129 Category category() override { return Static; }
122};
123
124typedef std::vector<StaticSensitivity *> StaticSensitivities;
125
130};
131
132typedef std::vector<StaticSensitivity *> StaticSensitivities;
133
134class ResetSensitivity : virtual public Sensitivity
135{
136 private:
137 bool _val;
138 bool _sync;
126
139
140 protected:
141 ResetSensitivity(Process *p, bool _val, bool _sync) :
142 Sensitivity(p), _val(_val), _sync(_sync)
143 {}
144
145 void addToEvent(const ::sc_core::sc_event *e) override;
146 void delFromEvent(const ::sc_core::sc_event *e) override;
147
148 bool val() { return _val; }
149 bool sync() { return _sync; }
150
151 public:
152 Category category() override { return Reset; }
153};
154
155typedef std::vector<ResetSensitivity *> ResetSensitivities;
156
157
127/*
128 * Sensitivity to an event or events, which can be static or dynamic.
129 */
130
131class SensitivityEvent : virtual public Sensitivity
132{
133 protected:
134 const ::sc_core::sc_event *event;

--- 155 unchanged lines hidden (view full) ---

290 Process *p, const sc_core::sc_event_and_list *eal);
291
292 DynamicSensitivityEventAndList(
293 Process *p, const sc_core::sc_event_and_list *eal);
294
295 bool notifyWork(Event *e) override;
296};
297
158/*
159 * Sensitivity to an event or events, which can be static or dynamic.
160 */
161
162class SensitivityEvent : virtual public Sensitivity
163{
164 protected:
165 const ::sc_core::sc_event *event;

--- 155 unchanged lines hidden (view full) ---

321 Process *p, const sc_core::sc_event_and_list *eal);
322
323 DynamicSensitivityEventAndList(
324 Process *p, const sc_core::sc_event_and_list *eal);
325
326 bool notifyWork(Event *e) override;
327};
328
329/*
330 * Reset sensitivities.
331 */
332
333void newResetSensitivitySignal(
334 Process *p, const sc_core::sc_signal_in_if<bool> *signal,
335 bool val, bool sync);
336
337void newResetSensitivityPort(
338 Process *p, const sc_core::sc_in<bool> *port, bool val, bool sync);
339void newResetSensitivityPort(
340 Process *p, const sc_core::sc_inout<bool> *port, bool val, bool sync);
341void newResetSensitivityPort(
342 Process *p, const sc_core::sc_out<bool> *port, bool val, bool sync);
343
344class ResetSensitivitySignal :
345 public ResetSensitivity, public SensitivityEvent
346{
347 protected:
348 const sc_core::sc_signal_in_if<bool> *_signal;
349
350 friend void newResetSensitivitySignal(
351 Process *p, const sc_core::sc_signal_in_if<bool> *signal,
352 bool val, bool sync);
353
354 ResetSensitivitySignal(
355 Process *p, const sc_core::sc_signal_in_if<bool> *signal,
356 bool _val, bool _sync);
357
358 bool notifyWork(Event *e) override;
359};
360
361class ResetSensitivityPort : public ResetSensitivitySignal
362{
363 private:
364 friend void newResetSensitivityPort(
365 Process *p, const sc_core::sc_in<bool> *port, bool val, bool sync);
366 friend void newResetSensitivityPort(
367 Process *p, const sc_core::sc_inout<bool> *port,
368 bool val, bool sync);
369 friend void newResetSensitivityPort(
370 Process *p, const sc_core::sc_out<bool> *port,
371 bool val, bool sync);
372
373 ResetSensitivityPort(
374 Process *p, const sc_core::sc_port_base *port,
375 bool _val, bool _sync) :
376 Sensitivity(p), ResetSensitivitySignal(p, nullptr, _val, _sync)
377 {}
378
379 public:
380 void setSignal(const ::sc_core::sc_signal_in_if<bool> *signal);
381};
382
298} // namespace sc_gem5
299
300#endif //__SYSTEMC_CORE_SENSITIVITY_HH__
383} // namespace sc_gem5
384
385#endif //__SYSTEMC_CORE_SENSITIVITY_HH__