Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize is currently missing the elimination of "double not" #447

Open
timsherwood opened this issue May 27, 2024 · 0 comments
Open

Optimize is currently missing the elimination of "double not" #447

timsherwood opened this issue May 27, 2024 · 0 comments
Labels
beginner friendly A good target for undergrads to contribute to PyRTL enhancement Proposed feature requests and improvements

Comments

@timsherwood
Copy link
Contributor

The pyrtl.optimize code is not eliminating "double not" conditions (reducing them to a single wire). Right now it does some more complex optimizations including CSE but this very simple case gets missed. You can see very clearly from the code below.

import pyrtl

a = pyrtl.Input(1,'a')
q = pyrtl.Output(1,'q')
q <<= ~(~(a))

pyrtl.synthesize()

with open('pre-optimize.svg','w') as f:
    pyrtl.output_to_svg(f)

pyrtl.optimize()

with open('post-optimize.svg','w') as f:
    pyrtl.output_to_svg(f)
@timsherwood timsherwood added enhancement Proposed feature requests and improvements beginner friendly A good target for undergrads to contribute to PyRTL labels May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner friendly A good target for undergrads to contribute to PyRTL enhancement Proposed feature requests and improvements
Projects
None yet
Development

No branches or pull requests

1 participant