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

[ImportVerilog] Insert missing conversions around instance ports #7647

Merged
merged 3 commits into from
Sep 28, 2024

Conversation

fabianschuiki
Copy link
Contributor

In certain corner cases, Slang does not insert the necessary conversion AST nodes around instance ports. This can be problematic if an input or output port is connected to a cast-compatible type (e.g. i32 and array<1 x i32>). To fix this, always insert conversions if the types of a port and the connected value differ.

Add a `moore.builtin.clog2` op and use it to convert `$clog2` calls in
ImportVerilog.
Allow `'{...}` assignment patterns to be used to assign integer values.
Slang already computes the value for each element in the resulting type.
All that's needed is a concat with the right operand order.
In certain corner cases, Slang does not insert the necessary conversion
AST nodes around instance ports. This can be problematic if an input or
output port is connected to a cast-compatible type (e.g. `i32` and
`array<1 x i32>`). To fix this, always insert conversions if the types
of a port and the connected value differ.
@fabianschuiki fabianschuiki added bug Something isn't working ImportVerilog labels Sep 27, 2024
Copy link
Member

@maerhart maerhart left a comment

Choose a reason for hiding this comment

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

Great catch! Thanks for the fix!

Base automatically changed from fschuiki/moore-int-patterns to main September 28, 2024 19:48
@fabianschuiki fabianschuiki merged commit b861949 into main Sep 28, 2024
4 checks passed
@fabianschuiki fabianschuiki deleted the fschuiki/moore-missing-port-casts branch September 28, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ImportVerilog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants