Skip to content

Commit

Permalink
Merge pull request #684 from phanrahan/hotfix-array-len-0
Browse files Browse the repository at this point in the history
Hotfix issue with length zero array
  • Loading branch information
leonardt authored Apr 14, 2020
2 parents f950299 + b26f91a commit 28a3cc1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion magma/backend/coreir_.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ def wrap_if_named_type(self, port, definition):
wrapped = self.wrap_if_named_type(port[0], definition)
if not wrapped:
return False
for t in port[1:]:
# TODO: Magma doesn't support length zero array, so slicing a
# length 1 array off the end doesn't work as expected in normal
# Python, so we explicilty slice port.ts
for t in port.ts[1:]:
self.wrap_if_named_type(t, definition)
return True
if not port.is_input():
Expand Down
8 changes: 6 additions & 2 deletions magma/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@ def _wire_clock_port(port, clocktype, defnclk):
# Only traverse all children circuit if first child has a clock
if not wired:
return False
for elem in port[1:]:
_wire_clock_port(elem, clocktype, defnclk)
# TODO: Magma doesn't support length zero array, so slicing a
# length 1 array off the end doesn't work as expected in normal
# Python, so we explicilty slice port.ts
for t in port.ts[1:]:
for elem in port[1:]:
_wire_clock_port(elem, clocktype, defnclk)
elif isinstance(port, clocktype) and not port.driven():
wire(defnclk, port)
wired = True
Expand Down

0 comments on commit 28a3cc1

Please sign in to comment.