[NOT READY FOR REVIEW] config mk to py, reduce dependency on make#4014
Draft
oharboe wants to merge 9 commits intoThe-OpenROAD-Project:masterfrom
Draft
[NOT READY FOR REVIEW] config mk to py, reduce dependency on make#4014oharboe wants to merge 9 commits intoThe-OpenROAD-Project:masterfrom
oharboe wants to merge 9 commits intoThe-OpenROAD-Project:masterfrom
Conversation
config.mk files may use $(shell $(PYTHON_EXE) ...) to generate variables. PYTHON_EXE must be defined before the include directive at variables.mk:40, not after it at the former line 73. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Migrate all 6 platform configurations from Make syntax to Python: nangate45, sky130hs, sky130hd, gf180, ihp-sg13g2, asap7. Each config.py generates identical variable assignments to the original config.mk. The config.mk becomes a one-liner shim that calls config.py via $(foreach)/$(eval), the same pattern as defaults.py in variables.mk. This enables: - Unit testing of platform configurations with pytest - JSON output for bazel-orfs (--format=json) to bypass Make - Piecemeal migration per Plan E of the bazel-orfs Make dependency reduction effort Make users see zero change in behavior. variables.mk does not need porting to Python. Its logic (tool discovery, derived paths, WRAPPED_LEFS, STREAM_SYSTEM, NUM_CORES) is Make-flow plumbing that bazel-orfs replaces with Bazel-native equivalents. The only shared concern is platform config, which config.py now provides. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Tests cover all Make constructs used across the 6 platform config.mk files: unconditional/conditional assignment, +=, glob, ifeq/ifneq, variable indirection, PLACEHOLDER template expansion, foreach/eval VT loop, SDC clock extraction, corner selection, CLUSTER_FLOPS, design-config overrides, and Make shim round-trip format validation. Includes __main__ guard so Jenkins CI can run it with plain python. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
CI runs `python "$file"` on every .py in flow/test/. conftest.py and test_platform_config.py import pytest which isn't installed in the testUtilScripts CI environment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
…tput config.py now outputs $(PLATFORM_DIR)/... and $(PLATFORM) in values instead of baking in absolute paths. Consumers expand on their end: - Make: $(eval) expands naturally - bazel-orfs: Python substitution when the rule executes Glob results are expanded at runtime for filesystem access, then unexpanded in output. to_dict() still returns expanded paths for unit test assertions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Verify that config.py output (both Make and JSON) uses symbolic $(PLATFORM_DIR) and $(PLATFORM) references instead of absolute paths. Tests cover: JSON output, Make output, glob results, and $(PLATFORM) in sky130hd/sky130hs filenames. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Documents: symbolic path references, assignment semantics, glob handling, env var inputs, why variables.mk doesn't need porting, and the Make functions already resolved by config.py. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
All other test files in flow/test/ use stdlib unittest. Convert test_platform_config.py to match and remove the pytest dependency that broke CI (ModuleNotFoundError: No module named 'pytest'). Delete conftest.py which only existed for pytest marker config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Platform config.py files
Each platform directory now has a
config.pyalongsideconfig.mk.The
config.mkis a one-liner shim that callsconfig.pyand evalsthe output as Make code -- the same pattern as
defaults.pyinvariables.mk.Why
Platform
config.mkfiles use Make syntax to define ~30-100environment variables per platform. These variables flow through to
TCL scripts via
$::env(...). The Make syntax is untestable: thereis no way to write unit tests for variable resolution, especially
for asap7's
$(foreach)/$(eval)VT variant generation.Moving the logic to Python enables:
Unit testing: 137 pytest tests verify every Make construct
(conditionals, variable indirection, template expansion, globbing,
corner selection, VT loops) produces correct output.
JSON output for bazel-orfs:
config.py --format=jsonreturns aflat dict of all variables. bazel-orfs can call this directly
instead of shelling out to Make, eliminating Make as a runtime
dependency (Plan E, Phase 2).
Piecemeal migration: each platform migrated independently.
Make users see zero behavior change.
How it works
The shim in each
config.mk:This is identical to how
defaults.pyis consumed atvariables.mk:48.Why not port variables.mk too?
variables.mkcomputes tool paths (OPENROAD_EXE, YOSYS_EXE,KLAYOUT_CMD), derived output paths (LOG_DIR, RESULTS_DIR), macro
wrappers (WRAPPED_LEFS), stream system selection (GDS vs OAS), and
Make debugging introspection. All of this is Make-flow plumbing that
bazel-orfs replaces with Bazel-native equivalents. The only shared
concern between Make and bazel-orfs consumers is the platform config
variables, which
config.pynow provides.Platform migration complexity
$(sort $(wildcard ...))for GDS$(PLATFORM)in pathsDONT_USE_CELLS +=list$(abspath)$(shell sed)SDC parsing,$(origin)$(foreach)/$(eval)loop,$(addsuffix), CLUSTER_FLOPSReference
Plan E: https://github.com/The-OpenROAD-Project/bazel-orfs/blob/main/docs/plans/drop-make-dependency.md