Repository navigation
Conversation
These files were deleted in 644ff70 but the BUILD reference was not updated. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Add gf180, ihp-sg13g2, nangate45, sky130hs PDK definitions with correct lib/ext patterns matching docker.BUILD.bazel. Add synth*.v to makefile_yosys glob for synth_wrap_operators-booth.v. Export scripts/variables.yaml for local variable metadata. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Every flow/designs/src/<name>/ directory now has a BUILD.bazel with exports_files and a :verilog filegroup, enabling both single-file and glob references from orfs_flow() targets. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Python parser for the config.mk design DSL that extracts structural params (PLATFORM, DESIGN_NAME, VERILOG_FILES, SDC_FILE, BLOCKS) and flow arguments (CORE_UTILIZATION, PLACE_DENSITY, etc.) for generating orfs_flow() Bazel targets. Handles all DSL features: export/=/?=/:=, line continuations, $(wildcard), $(sort), variable resolution. Emits deprecation warnings for complex features (ifeq, $(if), $(filter)). 84 unit tests including integration tests against all real config.mk files in the repository. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
config.mk is the single source of truth for design configuration. A repository rule parses all config.mk files and generates a DESIGNS dict. Each design's BUILD.bazel calls orfs_design() which creates orfs_flow() targets with properly routed stage arguments. Key components: - bazel/designs.bzl: repo rule that watches config.mk files via repository_ctx.read() and re-parses on changes - bazel/orfs.bzl: orfs_design() macro with BLOCKS support, label filtering for Tier 2 designs, rules-base.json auto-detection - MODULE.bazel: local bazel-orfs, docker image for yosys/klayout, local scripts/PDKs, configurable variables_yaml Incremental caching verified: changing CORE_UTILIZATION rebuilds only floorplan+place (2 actions), synthesis is cached (11 cache hits). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Document the value proposition: think in Make, test with Make, get Bazel caching and parallelism. Add sections on incremental caching (changing CORE_UTILIZATION skips synthesis), quick start, and the config.mk DSL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Replaced by auto-generated orfs_design() targets from config.mk. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
@maliberty Thoughts? |
Fix several issues preventing `bazelisk test //flow/designs/asap7/...` from working: Parser fixes (config_mk_parser.py): - Add _tokenize_make_expr() to preserve $(...) nesting when splitting multi-value VERILOG_FILES (fixes wildcard resolution for ibex, cva6) - Fix _dir_to_verilog_label() to preserve subdirectory paths instead of collapsing all to top-level :verilog label - Fix _resolve_include_path() to find included files when repo rule runs from a different CWD (fixes mock-alu defaults.mk include) - Skip tab-indented Make recipe lines (fixes mock-alu MOCK_ALU_WIDTH) Bazel rule fixes (orfs.bzl): - Add VERILOG_INCLUDE_DIRS directories as stage_data for synth so include files are available in the Bazel sandbox New BUILD.bazel files: - 3 missing design dirs: aes, ethmac_lvt, swerv_wrapper - 21 cva6 src subdirectories for nested verilog/include files - ibex, jpeg include directories Disable orfs_design() for designs with pre-existing issues: - cva6, minimal, mock-cpu, riscv32i, swerv_wrapper Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
I'm still looking for comments on this, but I'll move the PR to bazel-orfs and patch up ORFS from there. |
|
config.mk is only part of the configuration. Variables may be set in other files (eg platform, Makefile, etc). You would need to parse all of them including any conditionals. We already dump all the evaluated variables in make_issue so that would seem easier than trying to recreate make in python. |
Actually, the DSL is limited to designs/**/*.mk, the rest stays in make territory. It is already working, I have all designs/**/*.mk wired up and working in bazel with linting + normal flow. so, run the below and all ORFS designs are run and tested in Bazel: bazelisk test ... Obviously, I need to run through all of them and fix some nits, but that's mainly compute and a bit of tinkering. My focus now is to create a standalone bazel-orfs PR demonstration and then queue up single concern PRs, mainly to ORFS. |
Proof of concept, run this to test:
When the remainder of the issues are ground down, test all designs by:
Problem
ORFS has two build systems that don't talk to each other:
config.mk. CI runs Make. Designers think in Make.Today, only 5 designs have Bazel BUILD files. The other 76 don't. Maintaining both is a tax nobody wants to pay.
Thesis
config.mk is already a DSL. Parse it, don't replace it.
Instead of asking designers to learn Bazel or maintain BUILD files, we parse config.mk at analysis time and generate
orfs_flow()targets automatically. Designers keep writing config.mk — the same file they test withmake— and get Bazel's caching and parallelism for free.What this PR does
Python parser reads config.mk and extracts variables into structured data (platform, design name, verilog files, flow arguments). 84 unit tests.
Repository rule runs the parser on all config.mk files at fetch time. Uses
repository_ctx.read()so Bazel watches every config.mk — edits trigger automatic re-parsing.orfs_design()macro — each design's BUILD.bazel is 3 lines:The macro loads the parsed config, routes variables to the correct stages via
variables.yamlmetadata, and callsorfs_flow().Incremental caching works at the variable level. Changing
CORE_UTILIZATIONin config.mk rebuilds floorplan→place→route→final but skips synthesis — becausevariables.yamlsaysCORE_UTILIZATIONdoesn't affect synthesis. Verified: 2 sandbox actions, 11 cache hits.Why this is low-churn
config.mk doesn't change. It's the source of truth, not a generated artifact. Designers and CI keep using it with Make exactly as before.
No new DSL to learn. The 3-line BUILD.bazel is boilerplate. The real configuration stays in config.mk.
Existing CI is unaffected. Make still works. Bazel is additive.
81 designs get Bazel targets immediately. No per-design migration work. The parser handles the existing config.mk files as-is.
Tier 2 designs degrade gracefully. Designs with complex Make features (
ifeq,$(if $(filter ...))) still get targets — the parser extracts what it can and filters unresolvable labels. The linter (python3 bazel/config_mk_parser.py --lint) shows what to simplify.Why it works well
For designers: Change config.mk, run
bazel build //flow/designs/asap7/gcd:gcd_place. Only the stages affected by your change rebuild. No Docker pull, no full rebuild.For CI: Build all designs in parallel:
bazel build //flow/designs/asap7/.... Bazel handles dependency tracking, caching, and parallelism. Shared remote cache means CI machines don't repeat work.For maintainers: One source of truth (config.mk), one parser (84 tests), one macro (orfs_design). No hand-written BUILD files to maintain per design. Adding a new design = add config.mk + 3-line BUILD.bazel.
Commits (least churn first)
Remaining work
Before
bazelisk test flow/designs/asap7/...works with no caveatsEliminate docker image dependency
tools/OpenROAD/submodule (has its own BUILD.bazel). Wire uporfs.default(openroad = "//tools/OpenROAD:openroad"). Currently uses docker image binary.tools/yosys/submodule. Wire uporfs.default(yosys = "//tools/yosys:yosys"). Currently uses docker image binary.imageandsha256from MODULE.bazel once all tools build locally.local_path_overridetogit_overridepointing to bazel-orfs branch/PR.Fix Tier 2 design analysis errors
$(SRC_HOME)verilog files reference deep subdirectories without BUILD files$(filter-out)pattern in VERILOG_FILES not fully resolvedVERILOG_INCLUDE_DIRSreferencesincludedirectories (not files)ADDITIONAL_LEFS/LIBSfrom$(PLATFORM_DIR)insideifeqconditionalsincludedirectives or don't set itFix designs that fail at build time
These need verification on a machine with enough cores/RAM:
Push bazel-orfs changes
variables_yaml,CONFIG_MAKE/CONFIG_OPENSTAin global configNice to have
bazel run //bazel:config_mk_lintas informational checkifeq,$(if $(filter ...)),$(PLATFORM_DIR)in VERILOG_FILES