Go to the documentation of this file.
42 #include "pybind11/pybind11.h"
43 #include "pybind11/stl.h"
63 namespace py = pybind11;
80 py::module_
m = py::module_::import(
"m5.SimObject");
81 auto f =
m.attr(
"resolveSimObject");
104 py::module_
m = m_native.def_submodule(
"drain");
106 py::enum_<DrainState>(
m,
"DrainState")
112 py::class_<Drainable, std::unique_ptr<Drainable, py::nodelete>>(
120 py::class_<DrainManager, std::unique_ptr<DrainManager, py::nodelete>>(
129 py::return_value_policy::reference)
136 py::module_
m = m_native.def_submodule(
"serialize");
138 py::class_<Serializable, std::unique_ptr<Serializable, py::nodelete>>(
142 py::class_<CheckpointIn>(
m,
"CheckpointIn")
149 py::module_
m = m_native.def_submodule(
"range");
151 py::class_<AddrRange>(
m,
"AddrRange")
153 .def(py::init<Addr &, Addr &>())
156 .def(py::init<Addr, Addr, uint8_t, uint8_t, uint8_t, uint8_t>())
174 py::bind_vector<std::vector<AddrRange>>(
m,
"AddrRangeVector");
184 py::module_
m = m_native.def_submodule(
"net");
186 py::class_<networking::EthAddr>(
m,
"EthAddr")
188 .def(py::init<const std::string &>())
191 py::class_<networking::IpAddress>(
m,
"IpAddress")
193 .def(py::init<uint32_t>())
196 py::class_<networking::IpNetmask, networking::IpAddress>(
m,
"IpNetmask")
198 .def(py::init<uint32_t, uint8_t>())
201 py::class_<networking::IpWithPort, networking::IpAddress>(
m,
"IpWithPort")
203 .def(py::init<uint32_t, uint16_t>())
210 py::module_
m = m_native.def_submodule(
"loader");
218 py::module_ m_core = m_native.def_submodule(
"core");
220 py::class_<Cycles>(m_core,
"Cycles")
222 .def(py::init<uint64_t>())
223 .def(
"__int__", &Cycles::operator uint64_t)
224 .def(
"__add__", &Cycles::operator+)
225 .def(
"__sub__", &Cycles::operator-)
228 py::class_<Temperature>(m_core,
"Temperature")
230 .def(py::init<double>())
237 .def(py::self == py::self)
238 .def(py::self != py::self)
239 .def(py::self < py::self)
240 .def(py::self <= py::self)
241 .def(py::self > py::self)
242 .def(py::self >= py::self)
243 .def(py::self + py::self)
244 .def(py::self - py::self)
245 .def(py::self *
float())
246 .def(
float() * py::self)
247 .def(py::self /
float())
255 s <<
"Temperature(" <<
t.toKelvin() <<
")";
260 py::class_<tm>(m_core,
"tm")
261 .def_static(
"gmtime", [](std::time_t
t) {
return *std::gmtime(&
t); })
262 .def_readwrite(
"tm_sec", &tm::tm_sec)
263 .def_readwrite(
"tm_min", &tm::tm_min)
264 .def_readwrite(
"tm_hour", &tm::tm_hour)
265 .def_readwrite(
"tm_mday", &tm::tm_mday)
266 .def_readwrite(
"tm_mon", &tm::tm_mon)
267 .def_readwrite(
"tm_wday", &tm::tm_wday)
268 .def_readwrite(
"tm_yday", &tm::tm_yday)
269 .def_readwrite(
"tm_isdst", &tm::tm_isdst)
272 py::enum_<Logger::LogLevel>(m_core,
"LogLevel")
288 .def(
"seedRandom", [](uint64_t seed) {
random_mt.
init(seed); })
300 m_core.attr(
"compileDate") = py::cast(
compileDate);
301 m_core.attr(
"gem5Version") = py::cast(
gem5Version);
303 m_core.attr(
"flag_DEBUG") = py::cast(
flag_DEBUG);
304 m_core.attr(
"flag_DEBUG") = py::cast(
flag_DEBUG);
305 m_core.attr(
"flag_NDEBUG") = py::cast(
flag_NDEBUG);
308 m_core.attr(
"MaxTick") = py::cast(
MaxTick);
315 .def(
"getCheckpoint", [](
const std::string &cpt_dir) {
constexpr double toCelsius() const
static DrainManager & instance()
Get the singleton DrainManager instance.
Tick curTick()
The universal simulation clock.
std::string to_string() const
Get a string representation of the range.
uint64_t granularity() const
Determing the interleaving granularity of the range.
Addr start() const
Get the start address of the range.
static void init_loader(py::module_ &m_native)
DrainState drainState() const
Return the current drain state of an object.
AddrRange RangeSize(Addr start, Addr size)
static void serializeAll(const std::string &cpt_dir)
Create a checkpoint by serializing all SimObjects in the system.
static void init_net(py::module_ &m_native)
static void init_serialize(py::module_ &m_native)
void setInterpDir(const std::string &dirname)
This is the interface for setting up a base path for the elf interpreter.
bool intersects(const AddrRange &r) const
Determine if another range intersects this one, i.e.
virtual void notifyFork()
Notify a child process of a fork.
The class stores temperatures in Kelvin and provides helper methods to convert to/from Celsius.
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
void pybind_init_core(py::module_ &m_native)
static void init_range(py::module_ &m_native)
AddrRange RangeIn(Addr start, Addr end)
void doExitCleanup()
Do C++ simulator exit processing.
AddrRange RangeEx(Addr start, Addr end)
void preCheckpointRestore()
Run state fixups before a checkpoint restore operation.
static Temperature fromKelvin(double _value)
static Temperature fromFahrenheit(double _value)
bool interleaved() const
Determine if the range is interleaved or not.
const bool flag_TRACING_ON
Addr size() const
Get the size of the address range.
Addr end() const
Get the end address of the range.
bool valid() const
Determine if the range is valid.
bool clockFrequencyFixed()
SimObject * resolveSimObject(const std::string &name)
Find a SimObject given a full path name.
Abstract superclass for simulation objects.
@ Drained
Buffers drained, ready for serialization/handover.
constexpr double toKelvin() const
static bool allDisabled()
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
const std::string & name()
static void init_drain(py::module_ &m_native)
bool mergesWith(const AddrRange &r) const
Determine if another range merges with the current one, i.e.
bool tryDrain()
Try to drain the system.
PybindSimObjectResolver pybindSimObjectResolver
void resume()
Resume normal simulation in a Drained system.
void setOutputDir(const std::string &dir)
Resolve a SimObject name using the Pybind configuration.
bool isDrained() const
Check if the system is drained.
Base class to wrap object resolving functionality.
void setClockFrequency(Tick tps)
static void setLevel(LogLevel ll)
static void loopbackOnly()
DrainState state() const
Get the simulators global drain state.
const FlagsType init
This Stat is Initialized.
void signalDrainDone()
Notify the DrainManager that a Drainable object has finished draining.
@ Running
Running normally.
static Temperature fromCelsius(double _value)
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
double toFahrenheit() const
static void setSimObjectResolver(SimObjectResolver *resolver)
There is a single object name resolver, and it is only set when simulation is restoring from checkpoi...
@ Draining
Draining buffers pending serialization/handover.
uint32_t stripes() const
Determine the number of interleaved address stripes this range is part of.
Generated on Tue Sep 21 2021 12:25:47 for gem5 by doxygen 1.8.17