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

Update ALU MULT mode in gowin to match nextpnr #4827

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aerkiaga
Copy link

nextpnr currently wires an ALU in MULT mode in a different fashion than expected. Instead of I2 to GND, it is connected to VCC. This has been mentioned in YosysHQ/nextpnr#1407. While fixing this in nextpnr would work, leaving it as-is is arguably a better option, since it can perform the same operations plus being able to take a second operand. This would have a profound impact if choosing to synthesize multiplication using this mode.

So, instead of fixing the wiring in nextpnr, this PR seeks to update the expected behavior of the cell to reflect the current wiring.

yosys doesn't use this mode yet, and therefore no tests or workflows should be impacted.

@widlarizer
Copy link
Collaborator

I don't see I2 mentioned in the apicula docs for the ALU primitive, could you explain where I can take a look to see how this affects the function?

@aerkiaga
Copy link
Author

aerkiaga commented Jan 8, 2025

@widlarizer the documentation I was referring to is this. The first table describes connections in different ALU modes. The MULT mode does not correspond to what nextpnr actually does, which corresponds to the functionality described in the last paragraph of the document. This is a superset of what the "regular" connection pattern would do, and is much more useful in practice (e.g. for implementing a Dadda tree).

Copy link
Collaborator

@widlarizer widlarizer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So by wiring I2 to a different constant, we gain an extra use for the I3 given the fixed LUT4 config right? Sounds like a cool trick and I get how this lines up with what nextpnr is already doing now

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