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")
138 #if PY_MAJOR_VERSION >= 3 145 .def(
"getCode", [](GlobalSimLoopExitEvent *e) {
146 return py::reinterpret_steal<py::object>(
155 py::class_<Event> c_event(
168 py::class_<PyEvent, Event>(
m,
"PyEvent")
169 .def(py::init<Event::Priority>(),
173 #define PRIO(n) c_event.attr(# n) = py::cast((int)Event::n) #define panic(...)
This implements a cprintf based panic() function.
static const Priority Progress_Event_Pri
Progress events come at the end.
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
void dump() const
Dump the current event data.
GlobalSimLoopExitEvent * simulate(Tick num_cycles)
Simulate for num_cycles additional cycles.
PyBind wrapper for Events.
void deschedule(Event *event)
Deschedule the specified event.
Tick when() const
Get the time that the event is scheduled.
static const FlagsType Managed
void pybind_init_event(py::module &m_native)
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
static const Priority CPU_Switch_Pri
CPU switches schedule the new CPU's tick event for the same cycle (after unscheduling the old CPU's t...
virtual const std::string name() const
static const Priority Debug_Break_Pri
Breakpoints should happen before anything else (except enabling trace output), so we don't miss any a...
void acquireImpl() override
bool squashed() const
Check whether the event is squashed.
static const Priority Serialize_Pri
Serailization needs to occur before tick events also, so that a serialize/unserialize is identical to...
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
bool scheduled() const
Determine if the current event is scheduled.
Queue of events sorted in time order.
uint64_t Tick
Tick count type.
static const Priority Sim_Exit_Pri
If we want to exit on this cycle, it's the very last thing we do.
EventQueue * curEventQueue()
void squash()
Squash the current event.
Priority priority() const
Get the event priority.
PyEvent(Event::Priority priority)
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
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 (...
const std::string getCause() const
void releaseImpl() override
void schedule(Event *event, Tick when, bool global=false)
Schedule the given event on this queue.
static const Priority Default_Pri
Default is zero for historical reasons.
static const Priority Minimum_Pri
Event priorities, to provide tie-breakers for events scheduled at the same cycle. ...
virtual const std::string name() const
static const Priority DVFS_Update_Pri
DVFS update event leads to stats dump therefore given a lower priority to ensure all relevant states ...
static const Priority Delayed_Writeback_Pri
For some reason "delayed" inter-cluster writebacks are scheduled before regular writebacks (which hav...
static const Priority Debug_Enable_Pri
If we enable tracing on a particular cycle, do that as the very first thing so we don't miss any of t...
static const Priority Stat_Event_Pri
Statistics events (dump, reset, etc.) come after everything else, but before exit.
static const Priority Maximum_Pri
Maximum priority.