Skip to content

Commit

Permalink
Add more support for nested clocks (tuples)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardt committed Aug 6, 2018
1 parent c7d683e commit 3ea9659
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions magma/backend/coreir_.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ def to_string(k):
zip(port.Ks, port.Ts)
})
elif is_input:
if isinstance(port, ClockType):
if isinstance(port, (ClockType, ClockKind)):
_type = self.context.named_types[("coreir", "clk")]
elif isinstance(port, AsyncResetType):
elif isinstance(port, (AsyncResetType, AsyncResetKind)):
_type = self.context.named_types[("coreir", "arst")]
else:
_type = self.context.Bit()
else:
if isinstance(port, ClockType):
if isinstance(port, (ClockType, ClockKind)):
_type = self.context.named_types[("coreir", "clkIn")]
elif isinstance(port, AsyncResetType):
elif isinstance(port, (AsyncResetType, AsyncResetKind)):
_type = self.context.named_types[("coreir", "arstIn")]
else:
_type = self.context.BitIn()
Expand Down Expand Up @@ -262,8 +262,11 @@ def is_clock_or_nested_clock(p):
return True
elif isinstance(p, (ArrayType, ArrayKind)):
return is_clock_or_nested_clock(p.T)
else:
return False
elif isinstance(p, (TupleType, TupleKind)):
for item in p.Ts:
if is_clock_or_nested_clock(item):
return True
return False

if value is None and is_clock_or_nested_clock(port):
return
Expand Down

0 comments on commit 3ea9659

Please sign in to comment.