forked from M-Labs/artiq
1
0
Fork 0

transforms.iodelay_estimator: correctly handle functions with empty body.

This commit is contained in:
whitequark 2015-11-24 00:46:26 +08:00
parent e53f26dba0
commit 9bc62fa3d2
2 changed files with 3 additions and 1 deletions

View File

@ -208,6 +208,7 @@ class Max(Expr):
def __init__(self, operands): def __init__(self, operands):
assert isinstance(operands, list) assert isinstance(operands, list)
assert all([isinstance(operand, Expr) for operand in operands]) assert all([isinstance(operand, Expr) for operand in operands])
assert operands != []
self.operands = operands self.operands = operands
def __str__(self): def __str__(self):

View File

@ -220,7 +220,8 @@ class IODelayEstimator(algorithm.Visitor):
delays.append(self.current_delay) delays.append(self.current_delay)
self.current_delay = old_delay self.current_delay = old_delay
self.current_delay += iodelay.Max(delays) if any(delays):
self.current_delay += iodelay.Max(delays)
except _IndeterminateDelay as error: except _IndeterminateDelay as error:
# Interleave failures inside `with` statements are hard failures, # Interleave failures inside `with` statements are hard failures,
# since there's no chance that the code will never actually execute # since there's no chance that the code will never actually execute