Skip to content

Commit

Permalink
Relax condition for rewriting select path for nested type
Browse files Browse the repository at this point in the history
Before the logic was only rewriting the select path when an array or
tuple object was reference from an Array or Tuple. This relaxes it
to always rewrite the select path when any object is referenced from
an Array or Tuple.

In the case of #415, a Bit was
being selected from a Tuple, but was not rewritten because it failed
the condition:

    isinstance(arrOrTuple, ArrayType) or \
    isinstance(arrOrTuple, TupleType)

However, regardless of the type of the child object that is being
selected from the tuple/array, we should be rewriting the select path
to flatten out the tuple/array
  • Loading branch information
leonardt committed Jun 25, 2019
1 parent 715d92f commit 1d6fc4f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions magma/simulator/coreir_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ def convert_to_coreir_path(bit, scope):
# Handle renaming due to flatten types
arrOrTuple = bit
while isinstance(arrOrTuple.name, ArrayRef) or isinstance(arrOrTuple.name, TupleRef):
if isinstance(arrOrTuple, ArrayType) or isinstance(arrOrTuple, TupleType):
port, idx = port.split('.', 1)
port += '_' + idx
port, idx = port.split('.', 1)
port += '_' + idx
if isinstance(arrOrTuple.name, ArrayRef):
arrOrTuple = arrOrTuple.name.array
elif isinstance(arrOrTuple.name, TupleRef):
Expand Down

0 comments on commit 1d6fc4f

Please sign in to comment.