32a33
> #include "systemc/core/port.hh"
40a42,45
> /*
> * Common sensitivity interface.
> */
>
55a61,64
> /*
> * Dynamic vs. static sensitivity.
> */
>
79a89,93
>
> /*
> * Static sensitivities.
> */
>
81c95
< StaticSensitivityInterface::finalize()
---
> newStaticSensitivityEvent(Process *p, const sc_core::sc_event *e)
83,84c97,99
< event = &interface->default_event();
< SensitivityEvent::finalize();
---
> auto s = new StaticSensitivityEvent(p, e);
> s->addToEvent(s->event);
> p->addStatic(s);
88c103
< StaticSensitivityPort::finalize()
---
> newStaticSensitivityInterface(Process *p, const sc_core::sc_interface *i)
90,95c105,107
< for (int i = 0; i < port->size(); i++) {
< const ::sc_core::sc_event *event =
< &port->_gem5Interface(i)->default_event();
< events.insert(event);
< addToEvent(event);
< }
---
> auto s = new StaticSensitivityInterface(p, i);
> s->addToEvent(s->event);
> p->addStatic(s);
99c111
< StaticSensitivityExport::finalize()
---
> newStaticSensitivityPort(Process *p, const sc_core::sc_port_base *pb)
101,102c113,116
< event = &exp->get_interface()->default_event();
< SensitivityEvent::finalize();
---
> auto s = new StaticSensitivityPort(p);
> Port *port = Port::fromPort(pb);
> port->sensitive(s);
> p->addStatic(s);
106c120
< StaticSensitivityFinder::finalize()
---
> newStaticSensitivityExport(Process *p, const sc_core::sc_export_base *exp)
108,115c122,124
< const ::sc_core::sc_port_base *port = finder->port();
< int size = port->size();
< for (int i = 0; i < size; i++) {
< ::sc_core::sc_interface *interface = port->_gem5Interface(i);
< const ::sc_core::sc_event *event = &finder->find_event(interface);
< events.insert(event);
< addToEvent(event);
< }
---
> auto s = new StaticSensitivityExport(p, exp);
> s->addToEvent(s->event);
> p->addStatic(s);
118,119c127,128
< bool
< DynamicSensitivityEventOrList::notifyWork(Event *e)
---
> void
> newStaticSensitivityFinder(Process *p, const sc_core::sc_event_finder *f)
121c130,134
< events.erase(e->sc_event());
---
> auto s = new StaticSensitivityFinder(p, f);
> Port *port = Port::fromPort(f->port());
> port->sensitive(s);
> p->addStatic(s);
> }
123,126d135
< // All the other events need this deleted from their lists since this
< // sensitivity has been satisfied without them triggering.
< for (auto le: events)
< delFromEvent(le);
128,130c137,141
< satisfy();
< return true;
< }
---
> StaticSensitivityInterface::StaticSensitivityInterface(
> Process *p, const sc_core::sc_interface *i) :
> Sensitivity(p), StaticSensitivity(p),
> SensitivityEvent(p, &i->default_event())
> {}
132,134c143,146
< DynamicSensitivityEventOrList::DynamicSensitivityEventOrList(
< Process *p, const sc_core::sc_event_or_list *eol) :
< Sensitivity(p), DynamicSensitivity(p), events(eol->events)
---
> StaticSensitivityExport::StaticSensitivityExport(
> Process *p, const sc_core::sc_export_base *exp) :
> Sensitivity(p), StaticSensitivity(p),
> SensitivityEvent(p, &exp->get_interface()->default_event())
136a149,159
> const ::sc_core::sc_event &
> StaticSensitivityFinder::find(::sc_core::sc_interface *i)
> {
> return finder->find_event(i);
> }
>
>
> /*
> * Dynamic sensitivities.
> */
>
138c161
< DynamicSensitivityEventOrList::finalize()
---
> newDynamicSensitivityEvent(Process *p, const sc_core::sc_event *e)
140,141c163,165
< for (auto e: events)
< addToEvent(e);
---
> auto s = new DynamicSensitivityEvent(p, e);
> s->addToEvent(s->event);
> p->setDynamic(s);
145c169,170
< DynamicSensitivityEventOrList::clear()
---
> newDynamicSensitivityEventOrList(
> Process *p, const sc_core::sc_event_or_list *eol)
147,148c172,175
< for (auto e: events)
< delFromEvent(e);
---
> auto s = new DynamicSensitivityEventOrList(p, eol);
> for (auto event: s->events)
> s->addToEvent(event);
> p->setDynamic(s);
150a178,192
> void newDynamicSensitivityEventAndList(
> Process *p, const sc_core::sc_event_and_list *eal)
> {
> auto s = new DynamicSensitivityEventAndList(p, eal);
> for (auto event: s->events)
> s->addToEvent(event);
> p->setDynamic(s);
> }
>
>
> DynamicSensitivityEventOrList::DynamicSensitivityEventOrList(
> Process *p, const sc_core::sc_event_or_list *eol) :
> Sensitivity(p), DynamicSensitivity(p), SensitivityEvents(p, eol->events)
> {}
>
152c194
< DynamicSensitivityEventAndList::notifyWork(Event *e)
---
> DynamicSensitivityEventOrList::notifyWork(Event *e)
156,158c198,201
< // This sensitivity is satisfied if all events have triggered.
< if (events.empty())
< satisfy();
---
> // All the other events need this deleted from their lists since this
> // sensitivity has been satisfied without them triggering.
> for (auto le: events)
> delFromEvent(le);
159a203
> satisfy();
165c209
< Sensitivity(p), DynamicSensitivity(p), events(eal->events)
---
> Sensitivity(p), DynamicSensitivity(p), SensitivityEvents(p, eal->events)
168,169c212,213
< void
< DynamicSensitivityEventAndList::finalize()
---
> bool
> DynamicSensitivityEventAndList::notifyWork(Event *e)
171,173c215
< for (auto e: events)
< addToEvent(e);
< }
---
> events.erase(e->sc_event());
175,179c217,221
< void
< DynamicSensitivityEventAndList::clear()
< {
< for (auto e: events)
< delFromEvent(e);
---
> // This sensitivity is satisfied if all events have triggered.
> if (events.empty())
> satisfy();
>
> return true;