Go to the documentation of this file.
43 #include "pybind11/pybind11.h"
44 #include "pybind11/stl.h"
52 namespace py = pybind11;
81 py::object obj = py::cast(
this);
86 panic(
"Failed to get PyBind object to increase ref count\n");
91 py::object obj = py::cast(
this);
96 panic(
"Failed to get PyBind object to decrease ref count\n");
104 py::module
m = m_native.def_submodule(
"event");
110 py::return_value_policy::reference);
113 py::return_value_policy::reference);
115 py::class_<EventQueue>(
m,
"EventQueue")
120 }, py::arg(
"event"), py::arg(
"when"))
124 py::arg(
"event"), py::arg(
"tick"), py::arg(
"always") =
false)
132 std::unique_ptr<GlobalSimLoopExitEvent, py::nodelete>>(
133 m,
"GlobalSimLoopExitEvent")
135 #if PY_MAJOR_VERSION >= 3
143 return py::reinterpret_steal<py::object>(
144 PyInt_FromLong(
e->getCode()));
152 py::class_<Event> c_event(
165 py::class_<PyEvent, Event>(
m,
"PyEvent")
166 .def(py::init<Event::Priority>(),
170 #define PRIO(n) c_event.attr(# n) = py::cast((int)Event::n)
173 PRIO(Debug_Enable_Pri);
174 PRIO(Debug_Break_Pri);
175 PRIO(CPU_Switch_Pri);
176 PRIO(Delayed_Writeback_Pri);
178 PRIO(DVFS_Update_Pri);
181 PRIO(Stat_Event_Pri);
182 PRIO(Progress_Event_Pri);
bool scheduled() const
Determine if the current event is scheduled.
void pybind_init_event(py::module &m_native)
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
bool squashed() const
Check whether the event is squashed.
void acquireImpl() override
uint64_t Tick
Tick count type.
void dump() const
Dump the current event data.
void dump() const
This is a debugging function which will print everything on the event queue.
Tick when() const
Get the time that the event is scheduled.
PyEvent(Event::Priority priority)
static const FlagsType Managed
void releaseImpl() override
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
EventQueue * curEventQueue()
GlobalSimLoopExitEvent * simulate(Tick num_cycles)
Simulate for num_cycles additional cycles.
Priority priority() const
Get the event priority.
PyBind wrapper for Events.
const std::string getCause() const
void deschedule(Event *event)
Deschedule the specified event.
static const Priority Default_Pri
Default is zero for historical reasons.
void squash()
Squash the current event.
Queue of events sorted in time order.
virtual const std::string name() const
#define panic(...)
This implements a cprintf based panic() function.
Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17