Constrain use of 'delay' with zero delay time #3724
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a new take on #3245, picking up where it was left with the comment #3245 (comment). (I am revisiting this now because of my ongoing test implementation of
delay
with event generation.)I think this solves the issue with an acceptable tradeoff between backwards compatibility and feasibility of actually implementing according to specification:
delayTime = 0
is forbidden for time-varyingdelayTime
.delay(u, delayTime)
, the "new" evaluable variability is used to constraindelayTime
, making it possible for tools to determine at translation time whetherdelayTime
has been set to zero, but not forcing tools to evaluate.delayTime = 0
in the two argument form, we avoid the need to give complicated rules for when it is an error to havedelayTime = 0
in guarded expressions such asif tau > 0 then delay(u, tau) else u
.delayTime
when the value would be zero can be avoided by generating different equation systems for the two cases, and make an initialization time decision of which case to use. (Not expecting any tool to actually do it this way.)