Commit Graph

25 Commits

Author SHA1 Message Date
George Rennie 84ee345071 pyosys: support ObjRange
* this adds support for cells(), modules() and wires() that all return
  ObjRanges, converting them into lists for python
2024-11-04 16:00:01 +01:00
Emil J. Tywoniak d5aadeae3b py_wrap: remove some debug statements 2024-10-18 11:18:34 +02:00
Emil J. Tywoniak f219bb357f py_wrap: kinda fixed 2024-10-16 23:12:41 +02:00
Emil J. Tywoniak 86630bba08 py_wrap: nested classes 2024-10-16 22:55:17 +02:00
Emil J. Tywoniak 4b9c135098 py_wrap: refactor nesting_delta 2024-10-16 22:46:23 +02:00
Martin Povišer 57db87c99f py_wrap_generator: Handle const-qualified callbacks 2024-02-05 17:25:55 +01:00
Martin Povišer bd06338172 py_wrap_generator: Fix handling of method name collisions
If two methods have the same signature but for qualifiers the Python
binding doesn't care about ('const'), do not generate a mangled name for
the method.

Fixes

    .def<Wire (Module::*)(const IdString* )>("wire__YOSYS_NAMESPACE_RTLIL_IdString", &Module::wire__YOSYS_NAMESPACE_RTLIL_IdString)
    .def<Cell (Module::*)(const IdString* )>("cell__YOSYS_NAMESPACE_RTLIL_IdString", &Module::cell__YOSYS_NAMESPACE_RTLIL_IdString)

in the output after the previous change.
2023-04-05 13:36:44 +02:00
Martin Povišer f94f544b50 Fix the python generator for a bunch of const cases
Makes the below show up in the binding.

    .def<const char * (IdString::*)(void)>("c_str", &IdString::c_str)

    .def<boost::python::list (SigSpec::*)(void)>("chunks", &SigSpec::chunks)
    .def<boost::python::list (SigSpec::*)(void)>("bits", &SigSpec::bits)
    .def<SigBit (SigSpec::*)(int, const SigBit* )>("at", &SigSpec::at)

    .def<SigSpec (Cell::*)(const IdString* )>("getPort", &Cell::getPort)
    .def<boost::python::dict (Cell::*)(void)>("connections", &Cell::connections)
    .def<Const (Cell::*)(const IdString* )>("getParam", &Cell::getParam)

    .def<boost::python::list (Module::*)(void)>("connections", &Module::connections)

    def<const char * (*)(const SigSpec* )>("log_signal", YOSYS_PYTHON::log_signal);
    def<const char * (*)(const SigSpec* , bool)>("log_signal", YOSYS_PYTHON::log_signal);
    def<const char * (*)(const Const* )>("log_const", YOSYS_PYTHON::log_const);
    def<const char * (*)(const Const* , bool)>("log_const", YOSYS_PYTHON::log_const);
    def<const char * (*)(const IdString* )>("log_id", YOSYS_PYTHON::log_id);
2023-04-05 13:36:44 +02:00
Claire Xenia Wolf 72787f52fc Fixing old e-mail addresses and deadnames
s/((Claire|Xen|Xenia|Clifford)\s+)+(Wolf|Xen)\s+<(claire|clifford)@(symbioticeda.com|clifford.at|yosyshq.com)>/Claire Xenia Wolf <claire@yosyshq.com>/gi;
s/((Nina|Nak|N\.)\s+)+Engelhardt\s+<nak@(symbioticeda.com|yosyshq.com)>/N. Engelhardt <nak@yosyshq.com>/gi;
s/((David)\s+)+Shah\s+<(dave|david)@(symbioticeda.com|yosyshq.com|ds0.me)>/David Shah <dave@ds0.me>/gi;
s/((Miodrag)\s+)+Milanovic\s+<(miodrag|micko)@(symbioticeda.com|yosyshq.com)>/Miodrag Milanovic <micko@yosyshq.com>/gi;
s,https?://www.clifford.at/yosys/,http://yosyshq.net/yosys/,g;
2021-06-08 00:39:36 +02:00
Marcelina Kościelnicka 3d2aef0bde Remove a few functions that, in fact, did not exist in the first place. 2021-03-06 01:19:49 +01:00
Xiretza a367281d30
pyosys: Use C++11 override keyword for bindings
7191dd16 dropped the YS_OVERRIDE macro, but it was still being generated
by the python bindings generator, resulting in errors like these when
compiled with ENABLE_PYOSYS=1:

kernel/python_wrappers.cc:350:21: error: expected ‘;’ at end of member declaration
  350 |   virtual void help() YS_OVERRIDE;
      |                     ^
      |                      ;
kernel/python_wrappers.cc:350:23: error: ‘YS_OVERRIDE’ does not name a type
  350 |   virtual void help() YS_OVERRIDE;
      |                       ^~~~~~~~~~~
2020-06-21 16:30:00 +02:00
Martin 43c34a7828 idict handling in wrapper
- Also, re-applied no-line-break workaround to rtlil.h to make parser
  catch all methods.
2020-05-19 11:13:49 +02:00
Stefan Biereigel 3d13b10859 remove namespace mention from inheritance information 2020-02-03 20:54:32 +01:00
Stefan Biereigel 362e3aa40f expose polymorphism through python wrappers 2020-02-03 20:21:02 +01:00
Stefan Biereigel 3c9371589d add inheritance for pywrap generators 2020-01-30 21:26:37 +01:00
Patrick Eibl 1e92e2d1de handle anonymous unions to fix #1080 2019-11-21 14:10:34 -05:00
Benedikt Tutzer 79be986e22 Fix renaming all classes to Cpp*
(This is only relevant for classes that are exposed twice, one time as a
base class and one time as a derived class that can in turn be
overridden in python, but actually all others were renamed)
2019-10-09 14:21:52 +02:00
Benedikt Tutzer 9c59a56aa4 Expose global variables and allow logging to python streams
Global variables are now accessible via the Yosys class.
To capture Yosys output, once can now register an output stream in
Pyosys.
2019-10-09 13:59:35 +02:00
Benedikt Tutzer f39269805d Generate Python wrappers for inline constructors
Fixes: #1353
2019-09-23 13:17:59 +02:00
Clifford Wolf a3de83ef4a
Merge pull request #1112 from acw1251/pyosys_sigsig_issue
Fixed pyosys commands returning RTLIL::SigSig
2019-08-25 11:22:02 +02:00
Benedikt Tutzer 3a1a41bdb1 Throw runtime exception when trying to convert a c++-pointer to a
python-object in case the pointer is a nullptr to avoid a segfault.

Fixes #1090
2019-07-04 14:20:13 +02:00
acw1251 60eaaf6e0f Fixed pyosys commands returning RTLIL::SigSig 2019-06-19 15:39:56 -04:00
Stefan Biereigel d018e02614 remove boost/log/exceptions.hpp from wrapper generator 2019-06-07 09:47:33 +02:00
Clifford Wolf dd3c333c0a Remove yosys_banner() from python wrapper init, fixes #1056
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2019-06-05 08:57:33 +02:00
Benedikt Tutzer 124a284487 Cleaned up root directory 2019-04-30 13:19:04 +02:00