commands can now be run on arbitrary designs, not only on the active one
authorBenedikt Tutzer <e1225461@student.tuwien.ac.at>
Mon, 9 Jul 2018 14:01:56 +0000 (16:01 +0200)
committerBenedikt Tutzer <e1225461@student.tuwien.ac.at>
Mon, 9 Jul 2018 14:01:56 +0000 (16:01 +0200)
kernel/python_wrappers.cc

index c778f391975136b28ca79f1c2b1bd49a04673e5d..04aebb1b87c6b7a21d605b433cbb5f229be8f815 100644 (file)
@@ -161,6 +161,13 @@ namespace YOSYS_PYTHON {
                        }
                        return result;
                }
+
+               void run(std::string command)
+               {
+                       Yosys::RTLIL::Design* cpp_design = get_cpp_obj();
+                       if(cpp_design != NULL)
+                               Yosys::run_pass(command, cpp_design);
+               }
        };
 
        std::ostream &operator<<(std::ostream &ostr, const Design &design)
@@ -184,8 +191,11 @@ namespace YOSYS_PYTHON {
                using namespace boost::python;
 
                class_<Design>("Design", init<unsigned int>())
+                       .def(boost::python::self_ns::str(boost::python::self_ns::self))
+                       .def(boost::python::self_ns::repr(boost::python::self_ns::self))
                        .def(init<>())
                        .def("get_modules", &Design::get_modules)
+                       .def("run",&Design::run)
                        ;
 
                class_<Module>("Module", no_init)