mirror of
https://github.com/YosysHQ/yosys
synced 2025-10-09 17:31:59 +00:00
pyosys: rewrite wrapper generator
[skip ci]
This commit is contained in:
parent
88be728353
commit
384f7431fd
7 changed files with 738 additions and 2011 deletions
|
@ -26,7 +26,12 @@
|
|||
|
||||
USING_YOSYS_NAMESPACE
|
||||
|
||||
// <!-- generated top-level code -->
|
||||
using std::set;
|
||||
using std::regex;
|
||||
using std::ostream;
|
||||
using namespace RTLIL;
|
||||
|
||||
#include "wrappers.inc.cc"
|
||||
|
||||
namespace YOSYS_PYTHON {
|
||||
|
||||
|
@ -37,8 +42,6 @@ namespace YOSYS_PYTHON {
|
|||
|
||||
struct YosysStatics{};
|
||||
|
||||
// <!-- generated YOSYS_PYTHON namespace-level code -->
|
||||
|
||||
// Trampolines for Classes with Python-Overridable Virtual Methods
|
||||
// https://pybind11.readthedocs.io/en/stable/advanced/classes.html#overriding-virtual-functions-in-python
|
||||
class PassTrampoline : public Pass {
|
||||
|
@ -182,7 +185,18 @@ namespace YOSYS_PYTHON {
|
|||
}));
|
||||
}
|
||||
|
||||
m.def("log_to_stream", &log_to_stream, "pipes yosys logs to a Python stream");
|
||||
// Logging Methods
|
||||
m.def("log_header", [](Design *d, std::string s) { log_formatted_header(d, "%s", s); });
|
||||
m.def("log", [](std::string s) { log_formatted_string("%s", s); });
|
||||
m.def("log_file_info", [](std::string_view file, int line, std::string s) { log_formatted_file_info(file, line, s); });
|
||||
m.def("log_warning", [](std::string s) { log_formatted_warning("Warning: ", s); });
|
||||
m.def("log_warning_noprefix", [](std::string s) { log_formatted_warning("", s); });
|
||||
m.def("log_file_warning", [](std::string_view file, int line, std::string s) { log_formatted_file_warning(file, line, s); });
|
||||
m.def("log_error", [](std::string s) { log_formatted_error(s); });
|
||||
m.def("log_file_error", [](std::string_view file, int line, std::string s) { log_formatted_file_error(file, line, s); });
|
||||
|
||||
// Namespace to host global objects
|
||||
auto global_variables = py::class_<YosysStatics>(m, "Yosys");
|
||||
|
||||
// Trampoline Classes
|
||||
py::class_<Pass, YOSYS_PYTHON::PassTrampoline, std::unique_ptr<Pass, py::nodelete>>(m, "Pass")
|
||||
|
@ -241,6 +255,9 @@ namespace YOSYS_PYTHON {
|
|||
.def("notify_blackout", &RTLIL::Monitor::notify_blackout)
|
||||
;
|
||||
|
||||
// Bind Opaque Containers
|
||||
bind_autogenerated_opaque_containers(m);
|
||||
|
||||
// <!-- generated pymod-level code -->
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue