43#include "pybind11/pybind11.h"
44#include "pybind11/stl.h"
52namespace py = pybind11;
83 py::object obj = py::cast(
this);
88 panic(
"Failed to get PyBind object to increase ref count\n");
93 py::object obj = py::cast(
this);
98 panic(
"Failed to get PyBind object to decrease ref count\n");
106 py::module_
m = m_native.def_submodule(
"event");
111 m.def(
"getMaxTick", &
get_max_tick, py::return_value_policy::copy);
116 py::return_value_policy::reference);
119 py::return_value_policy::reference);
121 py::class_<EventQueue>(
m,
"EventQueue")
126 }, py::arg(
"event"), py::arg(
"when"))
130 py::arg(
"event"), py::arg(
"tick"), py::arg(
"always") =
false)
138 std::unique_ptr<GlobalSimLoopExitEvent, py::nodelete>>(
139 m,
"GlobalSimLoopExitEvent")
149 py::class_<Event> c_event(
162 py::class_<PyEvent, Event>(
m,
"PyEvent")
163 .def(py::init<Event::Priority>(),
167#define PRIO(n) c_event.attr(# n) = py::cast((int)Event::n)
170 PRIO(Debug_Enable_Pri);
171 PRIO(Debug_Break_Pri);
172 PRIO(CPU_Switch_Pri);
173 PRIO(Delayed_Writeback_Pri);
175 PRIO(DVFS_Update_Pri);
178 PRIO(Stat_Event_Pri);
179 PRIO(Progress_Event_Pri);
static const FlagsType Managed
Queue of events sorted in time order.
Event(Priority p=Default_Pri, Flags f=0)
uint64_t getHypercallId() const
const std::map< std::string, std::string > getPayload() const
const std::string getCause() const
PyBind wrapper for Events.
PyEvent(Event::Priority priority)
void acquireImpl() override
void releaseImpl() override
void dump() const
This is a debugging function which will print everything on the event queue.
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
void deschedule(Event *event)
Deschedule the specified event.
virtual const std::string name() const
bool scheduled() const
Determine if the current event is scheduled.
void squash()
Squash the current event.
void dump() const
Dump the current event data.
Priority priority() const
Get the event priority.
Tick when() const
Get the time that the event is scheduled.
static const Priority Default_Pri
Default is zero for historical reasons.
bool squashed() const
Check whether the event is squashed.
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 Arm Limited All rights reserved.
void set_max_tick(Tick tick)
Set the maximum tick.
void pybind_init_event(py::module_ &m_native)
Tick get_max_tick()
Get the maximum simulation tick.
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
The "old style" exitSimLoop functions.
uint64_t Tick
Tick count type.
void terminateEventQueueThreads()
Terminate helper threads when running in parallel mode.
GlobalSimLoopExitEvent * simulate(Tick num_cycles)
EventQueue * curEventQueue()
void exitSimulationLoop(uint64_t type_id, std::map< std::string, std::string > payload, Tick when)
The "new style" exitSimLoop functions.
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.