Closed tpwrules closed 1 year ago
I didn't investigate this in detail and I'll take you at your word that there is a bug; currently, clock/reset signals and domain renames are done via term rewriting, which is unfortunately as you're discovering now error-prone (and also quite slow).
It would probably be possible to add a workaround here but I would much rather prefer to use a different approach that systematically eliminates all similar issues, but would take more time to implement. Are you in a rush?
I'm not in a rush. I just avoided using Past in this situation instead. When you change the underlying approach and close the issue, this comment is me reminding myself to go back and re-add it.
Past
is going to be deprecated and removed (#526). Closing this issue in favor of that one.
DomainRenamers don't seem to change the domain that
Past
looks at. Below is a minimal example that demonstrates the problem and the correct behavior.The
Toggle
module flips its internal toggle every clock cycle, then usesPast
to output it delayed by one cycle. Both toggles are DomainRenamed to the "fast" domain. Togglet1
usesPast(domain=None)
and generates an incorrect output becausePast
samples the toggle from thesync
domain; the DomainRenamer didn't change it to "fast". Togglet2
, on the other hand, usesPast(domain="fast")
to ensure the sample is taken from the correct clock domain and so generates the correct output.GTKWave output is shown below. The top trace is the output of
t1
and the bottom is the output oft2
.