Skip to content

Commit

Permalink
pyosys: support ObjRange
Browse files Browse the repository at this point in the history
* this adds support for cells(), modules() and wires() that all return
  ObjRanges, converting them into lists for python
  • Loading branch information
georgerennie committed Nov 4, 2024
1 parent b2d7858 commit 62954e9
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions misc/py_wrap_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ class PoolTranslator(PythonListTranslator):
insert_name = ".insert"
orig_name = "pool"

#Sub-type for ObjRange
class ObjRangeTranslator(PythonListTranslator):
orig_name = "RTLIL::ObjRange"

#Translates dict-types (dict, std::map), that only differ in their name and
#the name of the insertion function
class PythonDictTranslator(Translator):
Expand Down Expand Up @@ -536,13 +540,14 @@ def translate_cpp(c, varname, types, prefix, ref):

#Associate the Translators with their c++ type
known_containers = {
"std::set" : SetTranslator,
"std::vector" : VectorTranslator,
"pool" : PoolTranslator,
"idict" : IDictTranslator,
"dict" : DictTranslator,
"std::pair" : TupleTranslator,
"std::map" : MapTranslator
"std::set" : SetTranslator,
"std::vector" : VectorTranslator,
"pool" : PoolTranslator,
"idict" : IDictTranslator,
"dict" : DictTranslator,
"std::pair" : TupleTranslator,
"std::map" : MapTranslator,
"RTLIL::ObjRange": ObjRangeTranslator
}

class Attribute:
Expand Down

0 comments on commit 62954e9

Please sign in to comment.