46 #include "pybind11/pybind11.h"
47 #include "pybind11/stl.h"
55 namespace py = pybind11;
84 py::object obj = py::cast(
this);
89 panic(
"Failed to get PyBind object to increase ref count\n");
94 py::object obj = py::cast(
this);
99 panic(
"Failed to get PyBind object to decrease ref count\n");
107 py::module
m = m_native.def_submodule(
"event");
113 py::return_value_policy::reference);
116 py::return_value_policy::reference);
118 py::class_<EventQueue>(
m,
"EventQueue")
123 }, py::arg(
"event"), py::arg(
"when"))
127 py::arg(
"event"), py::arg(
"tick"), py::arg(
"always") =
false)
135 std::unique_ptr<GlobalSimLoopExitEvent, py::nodelete>>(
136 m,
"GlobalSimLoopExitEvent")
144 py::class_<Event> c_event(
157 py::class_<PyEvent, Event>(
m,
"PyEvent")
158 .def(py::init<Event::Priority>(),
162 #define PRIO(n) c_event.attr(# n) = py::cast((int)Event::n)
165 PRIO(Debug_Enable_Pri);
166 PRIO(Debug_Break_Pri);
167 PRIO(CPU_Switch_Pri);
168 PRIO(Delayed_Writeback_Pri);
170 PRIO(DVFS_Update_Pri);
173 PRIO(Stat_Event_Pri);
174 PRIO(Progress_Event_Pri);
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
GlobalSimLoopExitEvent * simulate(Tick num_cycles)
Simulate for num_cycles additional cycles.
PyBind wrapper for Events.
virtual const std::string name() const
void deschedule(Event *event)
Deschedule the specified event.
static const FlagsType Managed
bool scheduled() const
Determine if the current event is scheduled.
void acquireImpl() override
Priority priority() const
Get the event priority.
const std::string getCause() const
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
Queue of events sorted in time order.
Tick when() const
Get the time that the event is scheduled.
uint64_t Tick
Tick count type.
EventQueue * curEventQueue()
bool squashed() const
Check whether the event is squashed.
void squash()
Squash the current event.
PyEvent(Event::Priority priority)
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 (...
virtual const std::string name() const
void releaseImpl() override
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
void schedule(Event *event, Tick when, bool global=false)
Schedule the given event on this queue.
void dump() const
Dump the current event data.
static const Priority Default_Pri
Default is zero for historical reasons.
void pybind_init_event(py::module &m_native)