Go to the documentation of this file.
42 #include "pybind11/pybind11.h"
43 #include "pybind11/stl.h"
61 namespace py = pybind11;
75 py::module
m = py::module::import(
"m5.SimObject");
76 auto f =
m.attr(
"resolveSimObject");
99 py::module
m = m_native.def_submodule(
"drain");
101 py::enum_<DrainState>(
m,
"DrainState")
107 py::class_<Drainable, std::unique_ptr<Drainable, py::nodelete>>(
115 py::class_<DrainManager, std::unique_ptr<DrainManager, py::nodelete>>(
124 py::return_value_policy::reference)
131 py::module
m = m_native.def_submodule(
"serialize");
133 py::class_<Serializable, std::unique_ptr<Serializable, py::nodelete>>(
137 py::class_<CheckpointIn>(
m,
"CheckpointIn")
144 py::module
m = m_native.def_submodule(
"range");
146 py::class_<AddrRange>(
m,
"AddrRange")
148 .def(py::init<Addr &, Addr &>())
151 .def(py::init<Addr, Addr, uint8_t, uint8_t, uint8_t, uint8_t>())
169 py::bind_vector<std::vector<AddrRange>>(
m,
"AddrRangeVector");
179 py::module
m = m_native.def_submodule(
"net");
181 py::class_<Net::EthAddr>(
m,
"EthAddr")
183 .def(py::init<const std::string &>())
186 py::class_<Net::IpAddress>(
m,
"IpAddress")
188 .def(py::init<uint32_t>())
191 py::class_<Net::IpNetmask, Net::IpAddress>(
m,
"IpNetmask")
193 .def(py::init<uint32_t, uint8_t>())
196 py::class_<Net::IpWithPort, Net::IpAddress>(
m,
"IpWithPort")
198 .def(py::init<uint32_t, uint16_t>())
205 py::module
m = m_native.def_submodule(
"loader");
213 py::module m_core = m_native.def_submodule(
"core");
215 py::class_<Cycles>(m_core,
"Cycles")
217 .def(py::init<uint64_t>())
218 .def(
"__int__", &Cycles::operator uint64_t)
219 .def(
"__add__", &Cycles::operator+)
220 .def(
"__sub__", &Cycles::operator-)
223 py::class_<tm>(m_core,
"tm")
224 .def_static(
"gmtime", [](std::time_t
t) {
return *std::gmtime(&
t); })
225 .def_readwrite(
"tm_sec", &tm::tm_sec)
226 .def_readwrite(
"tm_min", &tm::tm_min)
227 .def_readwrite(
"tm_hour", &tm::tm_hour)
228 .def_readwrite(
"tm_mday", &tm::tm_mday)
229 .def_readwrite(
"tm_mon", &tm::tm_mon)
230 .def_readwrite(
"tm_wday", &tm::tm_wday)
231 .def_readwrite(
"tm_yday", &tm::tm_yday)
232 .def_readwrite(
"tm_isdst", &tm::tm_isdst)
235 py::enum_<Logger::LogLevel>(m_core,
"LogLevel")
251 .def(
"seedRandom", [](uint64_t seed) {
random_mt.
init(seed); })
263 m_core.attr(
"compileDate") = py::cast(
compileDate);
264 m_core.attr(
"gem5Version") = py::cast(
gem5Version);
266 m_core.attr(
"flag_DEBUG") = py::cast(
flag_DEBUG);
267 m_core.attr(
"flag_DEBUG") = py::cast(
flag_DEBUG);
268 m_core.attr(
"flag_NDEBUG") = py::cast(
flag_NDEBUG);
271 m_core.attr(
"MaxTick") = py::cast(
MaxTick);
279 .def(
"getCheckpoint", [](
const std::string &cpt_dir) {
Base class to wrap object resolving functionality.
const FlagsType init
This Stat is Initialized.
void doExitCleanup()
Do C++ simulator exit processing.
void signalDrainDone()
Notify the DrainManager that a Drainable object has finished draining.
static void init_net(py::module &m_native)
@ Running
Running normally.
bool tryDrain()
Try to drain the system.
bool interleaved() const
Determine if the range is interleaved or not.
void setClockFrequency(Tick tps)
uint32_t stripes() const
Determine the number of interleaved address stripes this range is part of.
Addr end() const
Get the end address of the range.
bool isDrained() const
Check if the system is drained.
void resume()
Resume normal simulation in a Drained system.
static void init_loader(py::module &m_native)
virtual void notifyFork()
Notify a child process of a fork.
static void setLevel(LogLevel ll)
void setOutputDir(const string &dir)
void setInterpDir(const std::string &dirname)
This is the interface for setting up a base path for the elf interpreter.
@ Drained
Buffers drained, ready for serialization/handover.
const bool flag_TRACING_ON
PybindSimObjectResolver pybindSimObjectResolver
static void init_drain(py::module &m_native)
static void unserializeGlobals(CheckpointIn &cp)
bool valid() const
Determine if the range is valid.
AddrRange RangeSize(Addr start, Addr size)
bool clockFrequencyFixed()
bool intersects(const AddrRange &r) const
Determine if another range intersects this one, i.e.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
SimObject * resolveSimObject(const std::string &name)
Find a SimObject given a full path name.
const std::string & name()
static void init_serialize(py::module &m_native)
DrainState drainState() const
Return the current drain state of an object.
static DrainManager & instance()
Get the singleton DrainManager instance.
static bool allDisabled()
DrainState state() const
Get the simulators global drain state.
Resolve a SimObject name using the Pybind configuration.
uint64_t granularity() const
Determing the interleaving granularity of the range.
Addr start() const
Get the start address of the range.
void pybind_init_core(py::module &m_native)
std::string to_string() const
Get a string representation of the range.
void preCheckpointRestore()
Run state fixups before a checkpoint restore operation.
static void loopbackOnly()
bool mergesWith(const AddrRange &r) const
Determine if another range merges with the current one, i.e.
static void serializeAll(const std::string &cpt_dir)
Serializes all the SimObjects.
AddrRange RangeEx(Addr start, Addr end)
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
AddrRange RangeIn(Addr start, Addr end)
static void init_range(py::module &m_native)
Addr size() const
Get the size of the address range.
@ Draining
Draining buffers pending serialization/handover.
Tick curTick()
The current simulated tick.
Abstract superclass for simulation objects.
Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17