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

opt_lut: Narrow LUTs with constant inputs #4002

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

povik
Copy link
Member

@povik povik commented Oct 12, 2023

No description provided.

@povik
Copy link
Member Author

povik commented Oct 12, 2023

This doesn't respect the dlogic flag.

    -dlogic <type>:<cell-port>=<LUT-input>[:<cell-port>=<LUT-input>...]
        preserve connections to dedicated logic cell <type> that has ports
        <cell-port> connected to LUT inputs <LUT-input>. this includes
        the case where both LUT and dedicated logic input are connected to
        the same constant.

Is this flag something we want to preserve?

@povik
Copy link
Member Author

povik commented Oct 12, 2023

Maybe this should go to opt_expr

@povik povik closed this Oct 12, 2023
@povik povik reopened this Oct 12, 2023
@Ravenslofty
Copy link
Collaborator

Is this flag something we want to preserve?

Yes, because of how iCE40's weird carry chain works: SB_CARRY is before the LUT, rather than after it.

@povik
Copy link
Member Author

povik commented Oct 12, 2023

But please tell me the part that says "this includes the case where both LUT and dedicated logic input are connected to the same constant." is an artifact of how the pass was written and should be fixed, rather than something of importance somewhere.

@Ravenslofty
Copy link
Collaborator

I think the fact that the iCE40 add_sub test fails suggests that yes that is a load-bearing requirement, but let me ask around.

@whitequark
Copy link
Member

I wrote the pass. The reason opt_lut exists is mostly an alternate no-abc flow, though it has since gained some additional load to bear. I think -dlogic is a weird way to do what it does and it should have -tech ice40 or something like that instead, but the function should probably be preserved, considering otherwise you basically cannot run it on iCE40 without violating all the constraints for carry chain insertion.

@povik
Copy link
Member Author

povik commented Oct 12, 2023

The reason opt_lut exists is mostly an alternate no-abc flow

Well then it's no surprise it has come up again in relation to toymap. Would there be objections to replacing -dlogic with -tech ice40 now?

@whitequark
Copy link
Member

Would there be objections to replacing -dlogic with -tech ice40 now?

Absolutely none; in fact this is how it should've been done in first place and -dlogic was a poor technical decision owing to immaturity on my part.

@povik povik marked this pull request as ready for review January 15, 2024 13:06
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.

3 participants