-
Notifications
You must be signed in to change notification settings - Fork 16
orfs_synth: filter non-synth stage arguments, avoid rebuilds #490
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1151,7 +1151,7 @@ def _yosys_impl(ctx): | |
| ), | ||
| ] | ||
|
|
||
| orfs_synth = rule( | ||
| _orfs_synth = rule( | ||
| implementation = _yosys_impl, | ||
| attrs = yosys_attrs() | | ||
| synth_attrs() | | ||
|
|
@@ -1172,6 +1172,46 @@ orfs_synth = rule( | |
| executable = True, | ||
| ) | ||
|
|
||
| def _filter_stage_args( | ||
| stage, | ||
| **kwargs): | ||
| """Filter and prepare the arguments for a specific stage.""" | ||
|
|
||
| def _args(**kwargs): | ||
| return kwargs | ||
|
Comment on lines
+1180
to
+1181
|
||
|
|
||
| arguments = kwargs.pop("arguments", {}) | ||
| data = kwargs.pop("data", []) | ||
| settings = kwargs.pop("settings", {}) | ||
| extra_configs = kwargs.pop("extra_configs", {}) | ||
| sources = kwargs.pop("sources", {}) | ||
| stage_arguments = kwargs.pop("stage_arguments", {}) | ||
| stage_sources = kwargs.pop("stage_sources", {}) | ||
| stage_data = kwargs.pop("stage_data", {}) | ||
|
|
||
| return _args( | ||
| arguments = get_stage_args( | ||
| stage, | ||
| arguments = arguments, | ||
| sources = sources, | ||
| stage_arguments = stage_arguments, | ||
| ), | ||
| data = get_sources(stage, stage_sources, sources) + | ||
| stage_data.get(stage, []) + data, | ||
| extra_configs = extra_configs.get(stage, []), | ||
| settings = get_stage_args( | ||
| stage, | ||
| arguments = settings, | ||
| ), | ||
| **kwargs | ||
| ) | ||
|
|
||
| def orfs_synth(**kwargs): | ||
| return _orfs_synth(**_filter_stage_args( | ||
| "synth", | ||
| **kwargs | ||
| )) | ||
|
|
||
| def _make_impl( | ||
| ctx, | ||
| stage, | ||
|
|
@@ -1704,7 +1744,7 @@ UPDATE_RULES_IMPL = struct(stage = "update_rules", impl = orfs_update_rules) | |
| TEST_STAGE_IMPL = struct(stage = "test", impl = orfs_test) | ||
|
|
||
| STAGE_IMPLS = [ | ||
| struct(stage = "synth", impl = orfs_synth), | ||
| struct(stage = "synth", impl = _orfs_synth), | ||
| struct(stage = "floorplan", impl = orfs_floorplan), | ||
| struct(stage = "place", impl = orfs_place), | ||
| struct(stage = "cts", impl = orfs_cts), | ||
|
|
@@ -2084,28 +2124,23 @@ def _orfs_pass( | |
| synth_step = steps[0] | ||
| step_name = _step_name(name, variant, synth_step.stage) | ||
| step_names.append(step_name) | ||
| synth_step.impl( | ||
| synth_step.impl(**_filter_stage_args( | ||
| synth_step.stage, | ||
| name = step_name, | ||
| arguments = get_stage_args( | ||
| synth_step.stage, | ||
| stage_arguments, | ||
| arguments, | ||
| sources, | ||
| ), | ||
| data = get_sources(synth_step.stage, stage_sources, sources) + | ||
| stage_data.get(synth_step.stage, []), | ||
| stage_arguments = stage_arguments, | ||
| arguments = arguments, | ||
| sources = sources, | ||
| deps = macros, | ||
| extra_configs = extra_configs.get(synth_step.stage, []), | ||
| module_top = top, | ||
| settings = get_stage_args( | ||
| synth_step.stage, | ||
| arguments = settings, | ||
| ), | ||
| variant = variant, | ||
| verilog_files = verilog_files, | ||
| pdk = pdk, | ||
| stage_sources = stage_sources, | ||
| settings = settings, | ||
| extra_configs = extra_configs, | ||
| stage_data = stage_data, | ||
| **kwargs | ||
| ) | ||
| )) | ||
| orfs_deps( | ||
| name = "{}_deps".format(_step_name(name, variant, synth_step.stage)), | ||
| src = _step_name(name, variant, synth_step.stage), | ||
|
|
@@ -2122,19 +2157,19 @@ def _orfs_pass( | |
| ) | ||
| step_name = _step_name(name, stage_variant, step.stage) | ||
| src = previous_stage.get(step.stage, _step_name(name, variant, prev.stage)) | ||
| step.impl( | ||
| step.impl(**_filter_stage_args( | ||
| step.stage, | ||
| name = step_name, | ||
| stage_arguments = stage_arguments, | ||
| arguments = arguments, | ||
| sources = sources, | ||
| stage_sources = stage_sources, | ||
| settings = settings, | ||
| extra_configs = extra_configs, | ||
| src = src, | ||
| arguments = get_stage_args(step.stage, stage_arguments, arguments, sources), | ||
| data = get_sources(step.stage, stage_sources, sources) + | ||
| stage_data.get(step.stage, []) + | ||
| data, | ||
| extra_configs = extra_configs.get(step.stage, []), | ||
| variant = variant, | ||
| settings = get_stage_args( | ||
| step.stage, | ||
| arguments = settings, | ||
| ), | ||
| stage_data = stage_data, | ||
| data = data, | ||
| **( | ||
| kwargs | | ||
| _kwargs( | ||
|
|
@@ -2143,7 +2178,7 @@ def _orfs_pass( | |
| ) | | ||
| more_kwargs | ||
| ) | ||
| ) | ||
| )) | ||
| if add_deps: | ||
| orfs_deps( | ||
| name = "{}_deps".format(step_name), | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
_filter_stage_argsfunction lacks a docstring explaining its parameters and return value. While line 1178 provides a brief description, it should document thestageparameter and the**kwargsstructure including expected keys likearguments,data,settings, etc.