sensitivities.clear();
}
+void
+Port::regPort()
+{
+ if (!regPortNeeded)
+ return;
+
+ for (int i = 0; i < size(); i++)
+ getInterface(i)->register_port(*portBase, portBase->_ifTypeName());
+}
+
std::list<Port *> allPorts;
} // namespace sc_gem5
#define __SYSTEMC_CORE_PORT_HH__
#include <list>
+#include <typeinfo>
#include <vector>
#include "base/cprintf.hh"
int _maxSize;
int _size;
+ bool regPortNeeded;
+
void finalizePort(StaticSensitivityPort *port);
void finalizeFinder(StaticSensitivityFinder *finder);
void finalizeReset(ResetSensitivityPort *reset);
void
addInterfaces(::sc_core::sc_port_base *pb)
{
+ // Only the ports farthest from the interfaces call register_port.
+ pb->_gem5Port->regPortNeeded = false;
for (int i = 0; i < pb->size(); i++)
addInterface(pb->_gem5Interface(i));
}
::sc_core::sc_port_base *sc_port_base() { return portBase; }
Port(::sc_core::sc_port_base *port_base, int max) :
- portBase(port_base), finalized(false), _maxSize(max), _size(0)
+ portBase(port_base), finalized(false), _maxSize(max), _size(0),
+ regPortNeeded(true)
{
allPorts.push_front(this);
}
void sensitive(ResetSensitivityPort *reset);
void finalize();
+ void regPort();
int size() { return _size; }
int maxSize() { return _maxSize; }
#ifndef __SYSTEMC_EXT_CORE_SC_PORT_HH__
#define __SYSTEMC_EXT_CORE_SC_PORT_HH__
+#include <typeinfo>
#include <vector>
#include "../utils/sc_report_handler.hh"
virtual void _gem5AddInterface(sc_interface *i) = 0;
::sc_gem5::Port *_gem5Port;
+ virtual const char *_ifTypeName() const = 0;
};
template <class IF>
_interfaces.push_back(interface);
}
+ const char *_ifTypeName() const { return typeid(IF).name(); }
+
// Disabled
sc_port_b() {}
sc_port_b(const sc_port_b<IF> &) {}