aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-08-25 11:22:02 +0200
committerGitHub <noreply@github.com>2019-08-25 11:22:02 +0200
commita3de83ef4af789398ff8c511325f0ba7ad32e850 (patch)
treecc3e102b9451bc62ce5cf2622ef3db60d99d9398 /misc
parentdc9c47b5afebbbb721b5f589166e09b063430519 (diff)
parent60eaaf6e0f7bf1020ee62f8b77e8ead5dcbb8f99 (diff)
downloadyosys-a3de83ef4af789398ff8c511325f0ba7ad32e850.tar.gz
yosys-a3de83ef4af789398ff8c511325f0ba7ad32e850.tar.bz2
yosys-a3de83ef4af789398ff8c511325f0ba7ad32e850.zip
Merge pull request #1112 from acw1251/pyosys_sigsig_issue
Fixed pyosys commands returning RTLIL::SigSig
Diffstat (limited to 'misc')
-rw-r--r--misc/py_wrap_generator.py26
1 files changed, 10 insertions, 16 deletions
diff --git a/misc/py_wrap_generator.py b/misc/py_wrap_generator.py
index 66d661fa1..2bf364470 100644
--- a/misc/py_wrap_generator.py
+++ b/misc/py_wrap_generator.py
@@ -508,23 +508,17 @@ class TupleTranslator(PythonDictTranslator):
#Generate c++ code to translate to a boost::python::tuple
@classmethod
def translate_cpp(c, varname, types, prefix, ref):
- text = prefix + TupleTranslator.typename + " " + varname + "___tmp = boost::python::make_tuple(" + varname + ".first, " + varname + ".second);"
- return text
- tmp_name = "tmp_" + str(Translator.tmp_cntr)
- Translator.tmp_cntr = Translator.tmp_cntr + 1
- if ref:
- text += prefix + "for(auto " + tmp_name + " : *" + varname + ")"
+ # if the tuple is a pair of SigSpecs (aka SigSig), then we need
+ # to call get_py_obj() on each item in the tuple
+ if types[0].name in classnames:
+ first_var = types[0].name + "::get_py_obj(" + varname + ".first)"
else:
- text += prefix + "for(auto " + tmp_name + " : " + varname + ")"
- text += prefix + "{"
- if types[0].name.split(" ")[-1] in primitive_types or types[0].name in enum_names:
- text += prefix + "\t" + varname + "___tmp.append(" + tmp_name + ");"
- elif types[0].name in known_containers:
- text += known_containers[types[0].name].translate_cpp(tmp_name, types[0].cont.args, prefix + "\t", types[1].attr_type == attr_types.star)
- text += prefix + "\t" + varname + "___tmp.append(" + types[0].name + "::get_py_obj(" + tmp_name + "___tmp);"
- elif types[0].name in classnames:
- text += prefix + "\t" + varname + "___tmp.append(" + types[0].name + "::get_py_obj(" + tmp_name + "));"
- text += prefix + "}"
+ first_var = varname + ".first"
+ if types[1].name in classnames:
+ second_var = types[1].name + "::get_py_obj(" + varname + ".second)"
+ else:
+ second_var = varname + ".second"
+ text = prefix + TupleTranslator.typename + " " + varname + "___tmp = boost::python::make_tuple(" + first_var + ", " + second_var + ");"
return text
#Associate the Translators with their c++ type