Skip to content

Fixed CLI override function#663

Open
rumlenordstroem wants to merge 1 commit intochipsalliance:mainfrom
rumlenordstroem:main
Open

Fixed CLI override function#663
rumlenordstroem wants to merge 1 commit intochipsalliance:mainfrom
rumlenordstroem:main

Conversation

@rumlenordstroem
Copy link
Copy Markdown

@rumlenordstroem rumlenordstroem commented Oct 1, 2023

This PR fixes a bug where you where not able to override top module from the CLI while using a flow file. For example like this:
f4pga -vv build -f basys3.json -Dsources=[Blinky.sv] -Vtop=Blinky
where basys3.json looks like this:
{ "default_part": "XC7A35TCPG236-1", "XC7A35TCPG236-1": { "default_target": "bitstream", "dependencies": { "build_dir": "build/basys3", "xdc": ["basys3.xdc"] } } }
This resulted in an error where tool would complain that no top module if no top module is defined in basys3.json. The value from the top option was never passed to the flow configuration.

Comment on lines -155 to -178
for stage_name, cli_stage_cfg in part_cfg.items():
if stage_name in KWORDS:
continue

stage_cfg = part_cfg.get(stage_name)
if stage_cfg is None:
stage_cfg = {}
part_cfg[stage_name] = stage_cfg

stage_values = stage_cfg.get("values")
stage_dependencies = stage_cfg.get("dependencies")
cli_stage_values = cli_stage_cfg.get("values")
cli_stage_dependencies = cli_stage_cfg.get("dependencies")

if cli_stage_values is not None:
if stage_values is None:
stage_values = {}
stage_cfg["values"] = stage_values
stage_values.update(cli_stage_values)
if cli_stage_dependencies is not None:
if stage_dependencies is None:
stage_dependencies = {}
stage_cfg["dependencies"] = stage_dependencies
stage_dependencies.update(cli_stage_dependencies)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I appreciate how you simplified the code for global dependency overrides, but you dropped an entire part for overriding dependencies defined per-stage.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Oops, thanks for letting me know. I was probably a little too quick to open this pull request. I will try to fix this when I have time.

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.

2 participants