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

Add a flag for disabling debug Verilog generation #694

Merged
merged 2 commits into from Apr 5, 2022

Conversation

Lunaphied
Copy link
Contributor

Currently get_override() does not have a well defined interface and is not well designed for handling things like a flag to
disable a feature cleanly. This PR implements get_override_flag() to provide this functionality while get_override() additionally gains improved type checking for keyword arguments.

This is used to implement #623 which is now possible by providing a "false-like" value ("0", "no", "n", "false", "") to it (case-insensitive).

@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2022

Codecov Report

Merging #694 (2edd6e1) into main (07c6ea5) will decrease coverage by 0.18%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #694      +/-   ##
==========================================
- Coverage   81.28%   81.09%   -0.19%     
==========================================
  Files          49       49              
  Lines        6464     6479      +15     
  Branches     1526     1530       +4     
==========================================
  Hits         5254     5254              
- Misses       1017     1032      +15     
  Partials      193      193              
Impacted Files Coverage Δ
amaranth/build/plat.py 25.97% <0.00%> (-1.47%) ⬇️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

amaranth/build/plat.py Outdated Show resolved Hide resolved
amaranth/build/plat.py Show resolved Hide resolved
amaranth/build/plat.py Outdated Show resolved Hide resolved
The existing functionality of get_override was poorly specified and
ill-purposed for boolean flags. This change extracts the core
variable retrieval logic to a helper function and adds a new handler
`get_override_flag` which special cases boolean flags.

The new behavior will also perform type checking on kwargs and inform
the user of the desired type expected.
whitequark
whitequark previously approved these changes Apr 5, 2022
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

Currently debug Verilog generation can take many 10's of seconds.
A new override can now be passed as `AMARANTH_debug_verilog`=0 on
the environment or by setting the `debug_verilog` keyword argument
to `Platform.build()` or `Platform.prepare_toolchain()` to `False`.

Fixes amaranth-lang#623.
@whitequark whitequark enabled auto-merge (rebase) April 5, 2022 21:48
@whitequark
Copy link
Member

Thank you!

@whitequark whitequark disabled auto-merge April 5, 2022 23:09
@whitequark whitequark merged commit ee9da63 into amaranth-lang:main Apr 5, 2022
@Lunaphied Lunaphied deleted the improve-platform-templates branch April 6, 2022 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants