Go to the documentation of this file.
42 #include "pybind11/operators.h"
43 #include "pybind11/pybind11.h"
44 #include "pybind11/stl.h"
62 namespace py = pybind11;
79 py::module_
m = py::module_::import(
"m5.SimObject");
80 auto f =
m.attr(
"resolveSimObject");
91 py::module_
m = m_native.def_submodule(
"drain");
93 py::enum_<DrainState>(
m,
"DrainState")
99 py::class_<Drainable, std::unique_ptr<Drainable, py::nodelete>>(
107 py::class_<DrainManager, std::unique_ptr<DrainManager, py::nodelete>>(
116 py::return_value_policy::reference)
123 py::module_
m = m_native.def_submodule(
"serialize");
125 py::class_<Serializable, std::unique_ptr<Serializable, py::nodelete>>(
129 py::class_<CheckpointIn>(
m,
"CheckpointIn")
136 py::module_
m = m_native.def_submodule(
"range");
138 py::class_<AddrRange>(
m,
"AddrRange")
140 .def(py::init<Addr &, Addr &>())
143 .def(py::init<Addr, Addr, uint8_t, uint8_t, uint8_t, uint8_t>())
169 py::module_
m = m_native.def_submodule(
"net");
171 py::class_<networking::EthAddr>(
m,
"EthAddr")
173 .def(py::init<const std::string &>())
176 py::class_<networking::IpAddress>(
m,
"IpAddress")
178 .def(py::init<uint32_t>())
181 py::class_<networking::IpNetmask, networking::IpAddress>(
m,
"IpNetmask")
183 .def(py::init<uint32_t, uint8_t>())
186 py::class_<networking::IpWithPort, networking::IpAddress>(
m,
"IpWithPort")
188 .def(py::init<uint32_t, uint16_t>())
195 py::module_
m = m_native.def_submodule(
"loader");
203 py::module_ m_core = m_native.def_submodule(
"core");
205 py::class_<Cycles>(m_core,
"Cycles")
207 .def(py::init<uint64_t>())
208 .def(
"__int__", &Cycles::operator uint64_t)
209 .def(
"__add__", &Cycles::operator+)
210 .def(
"__sub__", &Cycles::operator-)
213 py::class_<Temperature>(m_core,
"Temperature")
215 .def(py::init<double>())
222 .def(py::self == py::self)
223 .def(py::self != py::self)
224 .def(py::self < py::self)
225 .def(py::self <= py::self)
226 .def(py::self > py::self)
227 .def(py::self >= py::self)
228 .def(py::self + py::self)
229 .def(py::self - py::self)
230 .def(py::self *
float())
231 .def(
float() * py::self)
232 .def(py::self /
float())
240 s <<
"Temperature(" <<
t.toKelvin() <<
")";
245 py::class_<tm>(m_core,
"tm")
246 .def_static(
"gmtime", [](std::time_t
t) {
return *std::gmtime(&
t); })
247 .def_readwrite(
"tm_sec", &tm::tm_sec)
248 .def_readwrite(
"tm_min", &tm::tm_min)
249 .def_readwrite(
"tm_hour", &tm::tm_hour)
250 .def_readwrite(
"tm_mday", &tm::tm_mday)
251 .def_readwrite(
"tm_mon", &tm::tm_mon)
252 .def_readwrite(
"tm_wday", &tm::tm_wday)
253 .def_readwrite(
"tm_yday", &tm::tm_yday)
254 .def_readwrite(
"tm_isdst", &tm::tm_isdst)
257 py::enum_<Logger::LogLevel>(m_core,
"LogLevel")
273 .def(
"seedRandom", [](uint64_t seed) {
random_mt.
init(seed); })
285 m_core.attr(
"compileDate") = py::cast(
compileDate);
286 m_core.attr(
"gem5Version") = py::cast(
gem5Version);
288 m_core.attr(
"TRACING_ON") = py::cast(TRACING_ON);
290 m_core.attr(
"MaxTick") = py::cast(
MaxTick);
297 .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.
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)
AddrRangeList exclude(const AddrRangeList &exclude_ranges) const
Subtract a list of intervals from the range and return the resulting collection of ranges,...
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)
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
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 Feb 8 2022 11:47:13 for gem5 by doxygen 1.8.17