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

Ensure signed constants are correctly parsed and exported in RTLIL. Add a test to check parsing and exporting #4550

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

RCoeurjoly
Copy link
Contributor

@RCoeurjoly RCoeurjoly commented Aug 19, 2024

What are the reasons/motivation for this change?

Fix #4539

Explain how this is achieved.

Updated rtlil_lexer.l to recognize constants with an optional s for signedness.
Modified rtlil_parser.y to set RTLIL::CONST_FLAG_SIGNED when appropriate.
Adjusted rtlil_backend.cc to correctly export signed constants.
Added a test (rtlil_signed_attribute.ys) for round-trip verification of signed constants.

If applicable, please suggest to reviewers how they can test the change.

I have included a test doing round trip test. I assume the rest of tests could catch relevant bugs.

@RCoeurjoly RCoeurjoly force-pushed the sign_for_attributes branch from 8119299 to 959240d Compare August 19, 2024 15:34
@RCoeurjoly RCoeurjoly force-pushed the sign_for_attributes branch from 959240d to 335c490 Compare August 19, 2024 16:57
@RCoeurjoly RCoeurjoly requested a review from mmicko as a code owner August 19, 2024 16:57
@RCoeurjoly RCoeurjoly changed the title Ensure signed constants are correctly parsed, represented, and exported in RTLIL. Add a test to check parsing and exporting Ensure signed constants are correctly parsed and exported in RTLIL. Add a test to check parsing and exporting Aug 19, 2024
@RCoeurjoly RCoeurjoly requested review from povik and whitequark August 21, 2024 10:32
Copy link
Member

@whitequark whitequark left a comment

Choose a reason for hiding this comment

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

LGTM

@whitequark whitequark merged commit 27c1432 into YosysHQ:main Aug 21, 2024
23 checks passed
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.

Preserve SIGNED flag on attribute values through RTLIL export/import
3 participants