10000 [ExportVerilog] Ensure DivS/ModS are signed regardless of context. by dtzSiFive · Pull Request #6966 · llvm/circt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[ExportVerilog] Ensure DivS/ModS are signed regardless of context. #6966

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

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

dtzSiFive
Copy link
Contributor

Fixes #6961.

@dtzSiFive
Copy link
Contributor Author
dtzSiFive commented Apr 30, 2024

Have not confirmed this fixes the issue in EDA playground, and would be good to confirm w/ModS (and put under test).

@dtzSiFive
Copy link
Contributor Author

Poked a bit, this maybe shows this: https://www.edaplayground.com/x/CEdZ maybe -- dropping the {1'h0, ....} part else they're the same.

Copy link
Member
@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

This looks like the right fix. 👍

Comment on lines -460 to +461
// CHECK: assign awire = 4'sh5 / -4'sh3;
// CHECK: assign awire = $signed(4'sh5 / -4'sh3);
Copy link
Member

Choose a reason for hiding this comment

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

🥲 It's unfortunate that this shows up. However, to know that this can be elided would mean teaching ExportVerilog about context sensitive widths. This would be a huge pain and it's better to just do the safe, cheap thing. (If non-obvious, this is commentary and non-blocking.)

@seldridge
Copy link
Member

Agree about a ModS test. This would be good to have under an integration test. That can be handled on the Chisel side.

Copy link
Member
@uenoku uenoku left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for fixing this. Glad that the simple change fixes the issue :)

@dtzSiFive
Copy link
Contributor Author

Mod acting similarly: https://www.edaplayground.com/x/Qzbs . Integration test Chisel-side works for me.

Change to output for ModS is included in test.

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.

[FIRRTL][ExportVerilog] Signed Division Bug
3 participants
0