Skip to content

Comments

wreduce: queue traversal#5606

Open
nataliakokoromyti wants to merge 1 commit intoYosysHQ:mainfrom
nataliakokoromyti:wreduce-traversal-clean
Open

wreduce: queue traversal#5606
nataliakokoromyti wants to merge 1 commit intoYosysHQ:mainfrom
nataliakokoromyti:wreduce-traversal-clean

Conversation

@nataliakokoromyti
Copy link
Contributor

Implement iterative queue-based traversal in wreduce pass to propagate width reductions across dependent cells and wires. Previously, wreduce would process all cells once, then all wires once. The new algorithm maintains work queues for both cells and wires, processing them iteratively until no more reductions are possible. When a cell or wire is reduced, dependent cells and wires are added back to the queues for reprocessing.

Added test to verify that width reductions propagate through a chain of operations: (a + b)[3:0] + c, ensuring the first addition is reduced from 9 bits to 4 bits.

Implement iterative queue-based traversal in wreduce pass to propagate
width reductions across dependent cells and wires. Previously, wreduce
would process all cells once, then all wires once. This meant that
reductions couldn't propagate through chains of operations.

The new algorithm maintains work queues for both cells and wires,
processing them iteratively until no more reductions are possible.
When a cell or wire is reduced, dependent cells and wires are added
back to the queues for reprocessing.

Add regression test to verify that width reductions propagate through
a chain of operations: (a + b)[3:0] + c, ensuring the first addition
is reduced from 9 bits to 4 bits.
@widlarizer widlarizer self-assigned this Feb 2, 2026
@widlarizer widlarizer self-requested a review February 2, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants