Commit Graph

8 Commits

Author SHA1 Message Date
Akash Levy db1e0701b0
Apply suggestions from code review
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-30 17:31:59 -07:00
Abhinav Tondapu df43a3097a [ENG-1692] negopt runtime fix + small cleanup 2026-03-30 16:30:46 -07:00
Abhinav Tondapu 510ef01b09 adding temp debug logs to fix runtime issue 2026-03-25 16:55:29 -07:00
tondapusili b438fd1fe9 negopt: fix quadratic blowup by adding index hints and deferring nusers to filter 2026-03-02 19:33:25 -08:00
tondapusili 2f276d0723 Added log flushes after each negopt pass for clearer logging 2026-02-25 12:15:46 -08:00
Akash Levy ee46f498e1
Update negopt.cc 2026-02-07 17:54:16 -08:00
tondapusili 6bb43f109c fixed edge cases in negopt passes, fixed cell naming inconsistencies 2026-02-06 16:38:55 -08:00
tondapusili 643427d9c9 Add negopt pass with comprehensive pattern matching
This commit introduces the negopt pass with pre/post optimization modes
for handling negation patterns in arithmetic circuits.

Pre-optimization patterns (expose for tree balancing):
- manual2sub: (a + ~b) + 1 → a - b
- sub2neg: a - b → a + (-b)
- negexpand: -(a + b) → (-a) + (-b) [with output width fix]
- negneg: -(-a) → a
- negmux: -(s ? a : b) → s ? (-a) : (-b)

Post-optimization patterns (cleanup/rebuild):
- negrebuild: (-a) + (-b) → -(a + b)
- muxneg: s ? (-a) : (-b) → -(s ? a : b)
- neg2sub: a + (-b) → a - b

All patterns use nusers() for fanout checking (standard Yosys style).
Comprehensive test coverage with positive/negative cases and formal
verification via equiv_opt.
2026-02-03 17:21:21 -08:00