Closed dan-fritchman closed 1 year ago
A few notes:
The fact that this happens is tied to the (generally fraught) topic of flattening bundle-valued ports. More generally, of doing anything that modifies ports during an elaboration pass.
_pre_flattening_io
field after flattening themWhy:
BundleFlattener
pass encounters HasDiff
twice - once per instance. The first time it flattens and write _pre_flattening_io
. The second time, it errantly overwrites _pre_flattening_io
, with the just-flattened IOs. I think this bug's been there forever. The sole answer would seem to be per-pass elaboration "caches"/ "done-lists", particularly for elaboration passes which are not idempotent. I think that is only bundle-flattening to date, but there are plenty more possible (e.g. "infer unspecified port directions").
And why do the generator versions work? We can just more aggressively identify, cache, and skip re-running them. I suspect that's papering over this bug, perhaps other similar ones.
Test case:
Produces: