From 1be2558195f670fe11e641ba8042eb3a7ac6de0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Mon, 28 Oct 2024 05:51:20 +0100 Subject: [PATCH] variants: improve readability with less iffy code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit stop dissolving register files Signed-off-by: Øyvind Harboe --- BUILD.bazel | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 0ebb1a7..7a1d150 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -351,9 +351,14 @@ FAST_BUILD_SETTINGS = { SWEEP = { "base": { - "dissolve": boom_regfile_rams.keys(), }, "naja": { + "renamed_inputs": { + "floorplan": {"1_synth.v": ":naja"}, + }, + "previous_stage": { + "floorplan": "BoomTile_synth", + }, }, "1": { "variables": { @@ -365,12 +370,19 @@ SWEEP = { "SKIP_LAST_GASP": "1", "SETUP_SLACK_MARGIN": "-1300", }, + "previous_stage": { + "floorplan": "BoomTile_synth", + }, }, "2": { "variables": { "SYNTH_HIERARCHICAL": "0", "MACRO_PLACEMENT_TCL": "$(location write_macro_placement)", }, + "stage_sources": {"floorplan": ["write_macro_placement"]}, + "previous_stage": { + "floorplan": "BoomTile_synth", + }, }, } @@ -418,6 +430,14 @@ write_binary( data = str(SWEEP_JSON), ) +BOOMTILE_SOURCES = { + "synth": [":constraints-boomtile"], + "floorplan": [ + ":io-boomtile", + ], + "place": [":io-boomtile"], +} + [orfs_flow( name = "BoomTile", arguments = BOOMTILE_VARIABLES | SWEEP[variant].get("variables", {}), @@ -426,15 +446,8 @@ write_binary( for m in (boom_regfile_rams.keys() + all_srams.keys()) if m not in SWEEP[variant].get("dissolve", []) ], - previous_stage = {"floorplan": "BoomTile_synth"} if ((BOOMTILE_VARIABLES | SWEEP[variant].get("variables", {}))["SYNTH_HIERARCHICAL"] == "1" and - SWEEP[variant].get("dissolve") == SWEEP["base"].get("dissolve") and - "naja" not in variant) else {}, - # Share synthesis stage between all variants - renamed_inputs = { - "naja": { - "floorplan": {"1_synth.v": ":naja"}, - }, - }.get(variant, {}), + previous_stage = SWEEP[variant].get("previous_stage", {}), + renamed_inputs = SWEEP[variant].get("renamed_inputs", {}), # Explictily set arguments for a stage when stages are not listed in # variables.yaml or we want to explicitly set a multi-stage argument # for a specific stage, e.g. SETUP_SLACK_MARGIN could be useful to @@ -446,12 +459,14 @@ write_binary( "GLOBAL_ROUTE_ARGS": "-congestion_iterations 5 -congestion_report_iter_step 5 -verbose", }, }, + # Starlark does not have sets, nor can we define functions in BUILD files + # Use a dict to get a set of keys stage_sources = { - "synth": [":constraints-boomtile"], - "floorplan": [ - ":io-boomtile", - ] + (["write_macro_placement"] if "MACRO_PLACEMENT_TCL" in (BOOMTILE_VARIABLES | SWEEP[variant].get("variables", {})) else []), - "place": [":io-boomtile"], + key: (SWEEP[variant].get("stage_sources", {}).get(key, []) + BOOMTILE_SOURCES.get(key, [])) + for key in { + key: "dummy" + for key in (BOOMTILE_SOURCES.keys() + SWEEP[variant].get("stage_sources", {}).keys()) + }.keys() }, variant = variant, verilog_files = all_source_files,