Skip to content

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

@timsherwood

Description

@timsherwood

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    beginner friendlyA good target for undergrads to contribute to PyRTLenhancementProposed feature requests and improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions