Skip to content

refactor: Move tool name to FlowCfg#149

Open
rswarbrick wants to merge 1 commit intolowRISC:masterfrom
rswarbrick:tool-field-at-run-time
Open

refactor: Move tool name to FlowCfg#149
rswarbrick wants to merge 1 commit intolowRISC:masterfrom
rswarbrick:tool-field-at-run-time

Conversation

@rswarbrick
Copy link
Copy Markdown
Contributor

@rswarbrick rswarbrick commented Apr 2, 2026

This value was always actually supplied (either directly in SimCfg or
through OneShotCfg). Move it to the base class and consume it in just
one place.

A specific type looks like there might be problems where we try to run
a job without having decided on the tool. The second instance of
this (in CovReport.post_finish) can definitely never happen, but the
example in Deploy.get_job_spec is less obvious to me, so I've put in a
runtime check.

Copy link
Copy Markdown
Contributor

@AlexJones0 AlexJones0 left a comment

Choose a reason for hiding this comment

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

I agree that this is definitely an easy stop-gap for now, but I checked your strong suspcicion and can confirm that in all the different flows this attribute is defined. SimCfg and OneShotCfg set it directly from args.tool, FormalCfg, LintCfg and SyncCfg inherit it from OneShotCfg, and CdcCfg & RdcCfg inherit it from LintCfg.

So this could be added to FlowCfg.__init__ as self.tool: str | None = args.tool (since the --tool argument can be unspecified), and then this runtime check should instead be that the value is not None. If you don't mind the little extra effort, could you make this change?

This value was always actually supplied (either directly in SimCfg or
through OneShotCfg). Move it to the base class and consume it in just
one place.

A specific type looks like there might be problems where we try to run
a job without having decided on the tool. The second instance of
this (in CovReport.post_finish) can definitely never happen, but the
example in Deploy.get_job_spec is less obvious to me, so I've put in a
runtime check.

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
@rswarbrick rswarbrick force-pushed the tool-field-at-run-time branch from c86c43f to 29986b0 Compare April 3, 2026 21:55
@rswarbrick rswarbrick changed the title Move get_job_spec's check that the FlowCfg has "tool" to run-time refactor: Move tool name to FlowCfg Apr 3, 2026
@rswarbrick rswarbrick marked this pull request as ready for review April 3, 2026 21:56
@rswarbrick rswarbrick requested a review from AlexJones0 April 3, 2026 21:56
@rswarbrick
Copy link
Copy Markdown
Contributor Author

@AlexJones0: You're completely right! Thanks! I think I've tweaked everything to match now?

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