From 90c1a8fa00a2edb0528e534f2ca74b5b7ebbeb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Fri, 30 Aug 2024 18:35:13 +0200 Subject: [PATCH 01/21] makefile: make memory now lists names of instances of memories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/scripts/mem_dump.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/flow/scripts/mem_dump.py b/flow/scripts/mem_dump.py index 90235bb0fe..01390d21d0 100644 --- a/flow/scripts/mem_dump.py +++ b/flow/scripts/mem_dump.py @@ -4,20 +4,28 @@ def format_ram_table_from_json(data, max_bits=None): - formatting = "{:<15} | {:<15} | {:<15} | {:<50}\n" - table = formatting.format("Rows", "Width", "Total bits", "Name") + formatting = "{:>5} | {:>5} | {:>6} | {:<20} | {:<80}\n" + table = formatting.format("Rows", "Width", "Bits", "Module", "Instances") table += "-" * len(table) + "\n" max_ok = True for module_name, module_info in data["modules"].items(): cells = module_info["cells"] - for memory, cell in cells.items(): + for cell in cells.values(): if not cell["type"].startswith("$mem"): continue parameters = cell["parameters"] size = int(parameters["SIZE"], 2) width = int(parameters["WIDTH"], 2) - bits = size * width - table += formatting.format(size, width, bits, module_name + "." + memory) + instances = [ + mname + "." + cell_name + for mname, minfo in data["modules"].items() + for cell_name, cell in minfo["cells"].items() + if cell["type"] == module_name + ] + bits = size * width * len(instances) + table += formatting.format( + size, width, bits, module_name, ", ".join(instances) + ) if max_bits is not None and bits > max_bits: max_ok = False return table, max_ok From 5e796484216a1e305a12eceaaf1cab5039e4a749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Tue, 3 Sep 2024 02:28:19 +0200 Subject: [PATCH 02/21] makefile: make memory now lists full path to all instantiations of memories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/scripts/mem_dump.py | 58 +++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/flow/scripts/mem_dump.py b/flow/scripts/mem_dump.py index 01390d21d0..40e8d31ffc 100644 --- a/flow/scripts/mem_dump.py +++ b/flow/scripts/mem_dump.py @@ -3,6 +3,57 @@ import sys +def find_top_module(data): + # There can be some cruft in the modules list so that + # we have multiple top level candidates. + top_module = [] + instantiations = set( + [ + cell["type"] + for minfo2 in data["modules"].values() + for cell in minfo2["cells"].values() + ] + ) + for mname, minfo in data["modules"].items(): + if mname not in instantiations: + top_module.append(mname) + return top_module + + +def find_cells_by_type_in_module( + module_name, data, target_type, current_path, matching_cells +): + for cell_name, cell in data["modules"][module_name]["cells"].items(): + cell_path = ( + f"{current_path}.{module_name}.{cell_name}" + if current_path + else f"{module_name}.{cell_name}" + ) + if cell["type"] == target_type: + matching_cells.append(cell_path) + elif cell["type"] in data["modules"]: + # Recursively search within the module + matching_cells.extend( + find_cells_by_type_in_module( + cell["type"], data, target_type, cell_path, [] + ) + ) + + return matching_cells + + +def find_cells_by_type(data, module_name, current_path=""): + # first find top module, the module without any submodules + names = [] + for top_module in find_top_module(data): + names.extend( + find_cells_by_type_in_module( + top_module, data, module_name, current_path, [] + ) + ) + return names + + def format_ram_table_from_json(data, max_bits=None): formatting = "{:>5} | {:>5} | {:>6} | {:<20} | {:<80}\n" table = formatting.format("Rows", "Width", "Bits", "Module", "Instances") @@ -16,12 +67,7 @@ def format_ram_table_from_json(data, max_bits=None): parameters = cell["parameters"] size = int(parameters["SIZE"], 2) width = int(parameters["WIDTH"], 2) - instances = [ - mname + "." + cell_name - for mname, minfo in data["modules"].items() - for cell_name, cell in minfo["cells"].items() - if cell["type"] == module_name - ] + instances = find_cells_by_type(data, module_name) bits = size * width * len(instances) table += formatting.format( size, width, bits, module_name, ", ".join(instances) From 0816ffc40a50f890e6c40d3b67322a662a0baec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Tue, 3 Sep 2024 02:36:56 +0200 Subject: [PATCH 03/21] makefile: make memory now sorts memories descending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/scripts/mem_dump.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/flow/scripts/mem_dump.py b/flow/scripts/mem_dump.py index 40e8d31ffc..07e33852c9 100644 --- a/flow/scripts/mem_dump.py +++ b/flow/scripts/mem_dump.py @@ -59,6 +59,9 @@ def format_ram_table_from_json(data, max_bits=None): table = formatting.format("Rows", "Width", "Bits", "Module", "Instances") table += "-" * len(table) + "\n" max_ok = True + entries = [] + + # Collect the entries in a list for module_name, module_info in data["modules"].items(): cells = module_info["cells"] for cell in cells.values(): @@ -69,11 +72,17 @@ def format_ram_table_from_json(data, max_bits=None): width = int(parameters["WIDTH"], 2) instances = find_cells_by_type(data, module_name) bits = size * width * len(instances) - table += formatting.format( - size, width, bits, module_name, ", ".join(instances) - ) + entries.append((size, width, bits, module_name, ", ".join(instances))) if max_bits is not None and bits > max_bits: max_ok = False + + # Sort the entries by descending bits + entries.sort(key=lambda x: x[2], reverse=True) + + # Format the sorted entries into the table + for entry in entries: + table += formatting.format(*entry) + return table, max_ok From 61e3af2e7365b03b340c3160e96487f8ac2d83a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Tue, 13 Aug 2024 20:14:43 +0200 Subject: [PATCH 04/21] bazel: test bazel configuration on a few designs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/.bazelrc | 2 + flow/.bazelversion | 1 + flow/BUILD.bazel | 29 +++++++++ flow/MODULE.bazel | 29 +++++++++ flow/MODULE.bazel.lock | 142 +++++++++++++++++++++++++++++++++++++++++ flow/WORKSPACE.bazel | 2 + 6 files changed, 205 insertions(+) create mode 100644 flow/.bazelrc create mode 100644 flow/.bazelversion create mode 100644 flow/BUILD.bazel create mode 100644 flow/MODULE.bazel create mode 100644 flow/MODULE.bazel.lock create mode 100644 flow/WORKSPACE.bazel diff --git a/flow/.bazelrc b/flow/.bazelrc new file mode 100644 index 0000000000..3e07f6a46f --- /dev/null +++ b/flow/.bazelrc @@ -0,0 +1,2 @@ +build --incompatible_strict_action_env +try-import %workspace%/.user-bazelrc diff --git a/flow/.bazelversion b/flow/.bazelversion new file mode 100644 index 0000000000..468c41f93c --- /dev/null +++ b/flow/.bazelversion @@ -0,0 +1 @@ +7.2.1 \ No newline at end of file diff --git a/flow/BUILD.bazel b/flow/BUILD.bazel new file mode 100644 index 0000000000..ab4f1990ab --- /dev/null +++ b/flow/BUILD.bazel @@ -0,0 +1,29 @@ +load("@bazel-orfs//:openroad.bzl", "orfs_flow") + +filegroup( + name = "constraints-sdc", + srcs = [ + "designs/asap7/gcd/constraint.sdc", + ], + visibility = [":__subpackages__"], +) + +orfs_flow( + name = "gcd", + stage_args = { + "synth": { + "SDC_FILE": "$(location :constraints-sdc)", + }, + "floorplan": { + "DIE_AREA": "0 0 16.2 16.2", + "CORE_AREA": "1.08 1.08 15.12 15.12", + }, + "place": { + "PLACE_DENSITY": "0.35", + }, + }, + stage_sources = { + "synth": [":constraints-sdc"], + }, + verilog_files = glob(include=["designs/src/gcd/*.v"]), +) diff --git a/flow/MODULE.bazel b/flow/MODULE.bazel new file mode 100644 index 0000000000..e599d120ab --- /dev/null +++ b/flow/MODULE.bazel @@ -0,0 +1,29 @@ +module( + name = "orfs", + version = "0.0.1", + compatibility_level = 1, +) + +bazel_dep(name = "bazel-orfs") +git_override( + module_name = "bazel-orfs", + commit = "16eb5dd5b31bdeacc0b3006a71dbce29076e9850", + remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git", +) + +# Read: https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#usage +# +# TL;DR +# +# 1. uncomment below +# 2. comment git_override() above +# +#local_path_override( +# module_name = "bazel-orfs", path = "../bazel-orfs" +#) + +orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories") +orfs.default( + image = "openroad/orfs:v3.0-1114-g46acc762", + sha256 = "ae4df23391c26bcc48a506f8e0d0da73742d1b6cb3b1dc02f4d5ea71170195b5", +) diff --git a/flow/MODULE.bazel.lock b/flow/MODULE.bazel.lock new file mode 100644 index 0000000000..c1a25987d3 --- /dev/null +++ b/flow/MODULE.bazel.lock @@ -0,0 +1,142 @@ +{ + "lockFileVersion": 11, + "registryFileHashes": { + "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", + "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", + "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", + "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/source.json": "7e3a9adf473e9af076ae485ed649d5641ad50ec5c11718103f34de03170d94ad", + "https://bcr.bazel.build/modules/apple_support/1.5.0/MODULE.bazel": "50341a62efbc483e8a2a6aec30994a58749bd7b885e18dd96aa8c33031e558ef", + "https://bcr.bazel.build/modules/apple_support/1.5.0/source.json": "eb98a7627c0bc486b57f598ad8da50f6625d974c8f723e9ea71bd39f709c9862", + "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", + "https://bcr.bazel.build/modules/bazel_features/1.11.0/source.json": "c9320aa53cd1c441d24bd6b716da087ad7e4ff0d9742a9884587596edfe53015", + "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", + "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", + "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", + "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/source.json": "082ed5f9837901fada8c68c2f3ddc958bb22b6d654f71dd73f3df30d45d4b749", + "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", + "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", + "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", + "https://bcr.bazel.build/modules/googletest/1.11.0/source.json": "c73d9ef4268c91bd0c1cd88f1f9dfa08e814b1dbe89b5f594a9f08ba0244d206", + "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", + "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", + "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", + "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", + "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", + "https://bcr.bazel.build/modules/platforms/0.0.9/source.json": "cd74d854bf16a9e002fb2ca7b1a421f4403cda29f824a765acd3a8c56f8d43e6", + "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", + "https://bcr.bazel.build/modules/protobuf/21.7/source.json": "bbe500720421e582ff2d18b0802464205138c06056f443184de39fbb8187b09b", + "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", + "https://bcr.bazel.build/modules/protobuf/3.19.6/MODULE.bazel": "9233edc5e1f2ee276a60de3eaa47ac4132302ef9643238f23128fea53ea12858", + "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", + "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", + "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", + "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", + "https://bcr.bazel.build/modules/rules_cc/0.0.9/source.json": "1f1ba6fea244b616de4a554a0f4983c91a9301640c8fe0dd1d410254115c8430", + "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", + "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", + "https://bcr.bazel.build/modules/rules_java/7.6.1/source.json": "8f3f3076554e1558e8e468b2232991c510ecbcbed9e6f8c06ac31c93bcf38362", + "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", + "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/source.json": "a075731e1b46bc8425098512d038d416e966ab19684a10a34f4741295642fc35", + "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", + "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", + "https://bcr.bazel.build/modules/rules_license/0.0.7/source.json": "355cc5737a0f294e560d52b1b7a6492d4fff2caf0bef1a315df5a298fca2d34a", + "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", + "https://bcr.bazel.build/modules/rules_pkg/0.7.0/source.json": "c2557066e0c0342223ba592510ad3d812d4963b9024831f7f66fd0584dd8c66c", + "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", + "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", + "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/source.json": "d57902c052424dfda0e71646cb12668d39c4620ee0544294d9d941e7d12bc3a9", + "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", + "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel": "26114f0c0b5e93018c0c066d6673f1a2c3737c7e90af95eff30cfee38d0bbac7", + "https://bcr.bazel.build/modules/rules_python/0.22.1/source.json": "57226905e783bae7c37c2dd662be078728e48fa28ee4324a7eabcafb5a43d014", + "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", + "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", + "https://bcr.bazel.build/modules/stardoc/0.5.1/source.json": "a96f95e02123320aa015b956f29c00cb818fa891ef823d55148e1a362caacf29", + "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", + "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/source.json": "f1ef7d3f9e0e26d4b23d1c39b5f5de71f584dd7d1b4ef83d9bbba6ec7a6a6459", + "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", + "https://bcr.bazel.build/modules/zlib/1.2.12/MODULE.bazel": "3b1a8834ada2a883674be8cbd36ede1b6ec481477ada359cd2d3ddc562340b27", + "https://bcr.bazel.build/modules/zlib/1.3/MODULE.bazel": "6a9c02f19a24dcedb05572b2381446e27c272cd383aed11d41d99da9e3167a72", + "https://bcr.bazel.build/modules/zlib/1.3/source.json": "b6b43d0737af846022636e6e255fd4a96fee0d34f08f3830e6e0bac51465c37c" + }, + "selectedYankedVersions": {}, + "moduleExtensions": { + "@@bazel-orfs~//:extension.bzl%orfs_repositories": { + "general": { + "bzlTransitiveDigest": "42x9Wez2cJ4mcTzytkWEzBr9ilyB80Y3HGoSJdZwb6w=", + "usagesDigest": "Gm0+3Dl8SF2RuxlljVbGIkux4jFOBVAe5f0GmuKYgk4=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "docker_orfs": { + "bzlFile": "@@bazel-orfs~//:docker.bzl", + "ruleClassName": "docker_pkg", + "attributes": { + "image": "openroad/orfs:v3.0-1114-g46acc762", + "sha256": "ae4df23391c26bcc48a506f8e0d0da73742d1b6cb3b1dc02f4d5ea71170195b5", + "build_file": "@@bazel-orfs~//:docker.BUILD.bazel", + "timeout": 3600 + } + }, + "com_github_nixos_patchelf_download": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "\n export_files(\n [\"bin/patchelf\"],\n visibility = [\"//visibility:public\"],\n )\n ", + "sha256": "ce84f2447fb7a8679e58bc54a20dc2b01b37b5802e12c57eece772a6f14bf3f0", + "urls": [ + "https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0-x86_64.tar.gz" + ] + } + }, + "com_github_docker_buildx_file": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "executable": true, + "sha256": "8d486f0088b7407a90ad675525ba4a17d0a537741b9b33fe3391a88cafa2dd0b", + "urls": [ + "https://github.com/docker/buildx/releases/download/v0.15.1/buildx-v0.15.1.linux-amd64" + ] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "bazel-orfs~", + "bazel_tools", + "bazel_tools" + ], + [ + "bazel-orfs~", + "com_github_docker_buildx_file", + "bazel-orfs~~orfs_repositories~com_github_docker_buildx_file" + ], + [ + "bazel-orfs~", + "com_github_nixos_patchelf_download", + "bazel-orfs~~orfs_repositories~com_github_nixos_patchelf_download" + ] + ] + } + }, + "@@platforms//host:extension.bzl%host_platform": { + "general": { + "bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=", + "usagesDigest": "meSzxn3DUCcYEhq4HQwExWkWtU4EjriRBQLsZN+Q0SU=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "host_platform": { + "bzlFile": "@@platforms//host:extension.bzl", + "ruleClassName": "host_platform_repo", + "attributes": {} + } + }, + "recordedRepoMappingEntries": [] + } + } + } +} diff --git a/flow/WORKSPACE.bazel b/flow/WORKSPACE.bazel new file mode 100644 index 0000000000..6ba4a02382 --- /dev/null +++ b/flow/WORKSPACE.bazel @@ -0,0 +1,2 @@ +# This file marks the root of the Bazel workspace. +# See MODULE.bazel for external dependencies setup. From f4b09b73d3e6a468f0c9e22ac4be9dcad275ec1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Tue, 13 Aug 2024 21:08:21 +0200 Subject: [PATCH 05/21] bazel: add designs/asap7/swerv_wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/BUILD.bazel | 83 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 3 deletions(-) diff --git a/flow/BUILD.bazel b/flow/BUILD.bazel index ab4f1990ab..31e73271d6 100644 --- a/flow/BUILD.bazel +++ b/flow/BUILD.bazel @@ -1,7 +1,7 @@ load("@bazel-orfs//:openroad.bzl", "orfs_flow") filegroup( - name = "constraints-sdc", + name = "constraints-gcd", srcs = [ "designs/asap7/gcd/constraint.sdc", ], @@ -12,7 +12,7 @@ orfs_flow( name = "gcd", stage_args = { "synth": { - "SDC_FILE": "$(location :constraints-sdc)", + "SDC_FILE": "$(location :constraints-gcd)", }, "floorplan": { "DIE_AREA": "0 0 16.2 16.2", @@ -23,7 +23,84 @@ orfs_flow( }, }, stage_sources = { - "synth": [":constraints-sdc"], + "synth": [":constraints-gcd"], }, verilog_files = glob(include=["designs/src/gcd/*.v"]), ) + + +filegroup( + name = "constraints-swerv", + srcs = [ + "designs/asap7/swerv_wrapper/constraint.sdc", + ], + visibility = [":__subpackages__"], +) + +filegroup( + name = "swerv-fastroute", + srcs = [ + "designs/asap7/swerv_wrapper/fastroute.tcl", + ], + visibility = [":__subpackages__"], +) + +filegroup( + name = "additional_lefs", + srcs = glob(include=["designs/asap7/swerv_wrapper/lef/*.lef"]) +) +filegroup( + name = "additional_libs", + srcs = glob(include=["designs/asap7/swerv_wrapper/lib/*.lib"]) +) + +SWERV_ALL = {"LIB_MODEL":"CCS", +"ADDITIONAL_LEFS": "$(locations :additional_lefs)", +"ADDITIONAL_LIBS": "$(locations :additional_libs)", +} + +all_sources = [":additional_lefs", ":additional_libs"] + +orfs_flow( + name = "swerv_wrapper", + stage_args = { + "synth": SWERV_ALL | { + "SYNTH_HIERARCHICAL": "1", + "SDC_FILE": "$(location :constraints-swerv)", + }, + "floorplan": SWERV_ALL | { + "RTLMP_FLOW": "1", + "RTLMP_MAX_INST": "30000", + "RTLMP_MIN_INST": "5000", + "RTLMP_MAX_MACRO": "30", + "RTLMP_MIN_MACRO": "4", + "DIE_AREA": "0 0 550 600", + "CORE_AREA": "5 5 545 595", + "PLACE_PINS_ARGS": "-exclude left:* -exclude right:*" + }, + "place": SWERV_ALL | { + "PLACE_PINS_ARGS": "-exclude left:* -exclude right:*", + "PLACE_DENSITY_LB_ADDON": "0.20", + }, + "cts": SWERV_ALL | { + "TNS_END_PERCENT": "100", + }, + "route": SWERV_ALL | { + "FASTROUTE_TCL": "$(location :swerv-fastroute)", + }, + "final": SWERV_ALL | { + "PWR_NETS_VOLTAGEsS": "", + "GND_NETS_VOLTAGES": "", + } + }, + verilog_files = glob(include=["designs/src/swerv/swerv_wrapper.sv2v.v", + "designs/asap7/swerv_wrapper/macros.v"]), + stage_sources = { + "synth": all_sources + [":constraints-swerv"], + "floorplan": all_sources, + "place": all_sources, + "cts": all_sources, + "route": all_sources + [":swerv-fastroute"], + "final": all_sources, + }, +) From f0f19073bb7af7a2d2e96f29cf8b333da50a1415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Wed, 14 Aug 2024 14:05:52 +0200 Subject: [PATCH 06/21] bazel: MockArray configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/BUILD.bazel | 165 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) diff --git a/flow/BUILD.bazel b/flow/BUILD.bazel index 31e73271d6..a29d6fab35 100644 --- a/flow/BUILD.bazel +++ b/flow/BUILD.bazel @@ -104,3 +104,168 @@ orfs_flow( "final": all_sources, }, ) + + + + + + +filegroup( + name = "mock-array-constraints", + srcs = [ + "designs/asap7/mock-array/constraints.sdc", + ], + visibility = [":__subpackages__"], +) + +filegroup( + name = "mock-array-io", + srcs = [ + "designs/asap7/mock-array/io.tcl" + ], + data = [ + "designs/src/mock-array/util.tcl", + ], + visibility = [":__subpackages__"], +) + +filegroup( + name = "mock-array-fastroute", + srcs = [ + "designs/asap7/mock-array/fastroute.tcl", + ], + visibility = [":__subpackages__"], +) +MOCK_ARRAY_ALL = { +} + +MOCK_ARRAY_FLOORPLAN_PLACE = { + "PLACE_PINS_ARGS": "-annealing", + "IO_CONSTRAINTS": "$(location :mock-array-io)", + "PLACE_DENSITY": "0.30", + "DIE_AREA": "0 0 358.56 388.8", + "CORE_AREA": "2.16 2.16 356.40000000000003 386.64000000000004", + "MACRO_PLACE_HALO": "0 2.16", + "RTLMP_BOUNDARY_WT": "0", + "RTLMP_FLOW": "1", + "PDN_TCL": "$(PLATFORM_DIR)/openRoad/pdn/BLOCKS_grid_strategy.tcl", + "MACRO_HALO_X": "0.5", + "MACRO_HALO_Y": "0.5", + "MACRO_BLOCKAGE_HALO": "0", + "ADDITIONAL_FILES": "$(locations :mock-array-io)", +} + +orfs_flow( + name = "MockArray", + macros = ["Element_generate_abstract"], + stage_args = { + "synth": MOCK_ARRAY_ALL | { + "SDC_FILE": "$(location :mock-array-constraints)", + }, + "floorplan": MOCK_ARRAY_ALL | MOCK_ARRAY_FLOORPLAN_PLACE | { + }, + "place": MOCK_ARRAY_ALL | MOCK_ARRAY_FLOORPLAN_PLACE | { + }, + "cts": MOCK_ARRAY_ALL | { + "CTS_BUF_DISTANCE": "60" + }, + "route": MOCK_ARRAY_ALL | { + "FASTROUTE_TCL": "$(location :mock-array-fastroute)", + # works with 28 or more iterations as of writing, so give it a few more. + "GLOBAL_ROUTE_ARGS" : "-congestion_iterations 40 -verbose", + # If this design isn't quickly done in detailed routing, something is wrong. + # At time of adding this option, only 12 iterations were needed for 0 + # violations. + "DETAILED_ROUTE_ARGS": "-bottom_routing_layer M2 -top_routing_layer M7 -save_guide_updates -verbose 1 -droute_end_iter 15", + # since we are specifying DETAILED_ROUTE_ARGS, we need to communicate the + # same information to other stages in the flow. + "MIN_ROUTING_LAYER": "M2", + "MAX_ROUTING_LAYER": "M7", + }, + "final": MOCK_ARRAY_ALL | { + "GDS_ALLOW_EMPTY": "Element", + "PWR_NETS_VOLTAGEsS": "", + "GND_NETS_VOLTAGES": "", + } + }, + verilog_files = glob(include=["designs/src/mock-array/*.v"]), + stage_sources = { + "synth": all_sources + [":mock-array-constraints"] + [":mock-array-io"], + "floorplan": all_sources + [":mock-array-io"], + "place": all_sources + [":mock-array-io"], + "cts": all_sources, + "route": all_sources + [":mock-array-fastroute"], + "final": all_sources, + }, +) + + +filegroup( + name = "mock-array-element-io", + srcs = [ + "designs/asap7/mock-array/Element/io.tcl" + ], + data = [ + "designs/src/mock-array/util.tcl", + ], + visibility = [":__subpackages__"], +) + + +MOCK_ARRAY_ELEMENT_FLOORPLAN_PLACE = { + "IO_CONSTRAINTS": "$(location :mock-array-element-io)", + "PLACE_DENSITY": "0.50", + "PLACE_PINS_ARGS": "-annealing", +} + +MOCK_ARRAY_ELEMENT_ALL = { +"MOCK_ARRAY_ROWS" : "8", +"MOCK_ARRAY_COLS" : "8", +} + + +mock_array_all_sources = ["designs/src/mock-array/util.tcl"] + +orfs_flow( + name = "Element", + abstract_stage = "route", + stage_args = { + "synth": MOCK_ARRAY_ELEMENT_ALL | { + "SDC_FILE": "$(location :mock-array-constraints)", + }, + "floorplan": MOCK_ARRAY_ELEMENT_ALL | MOCK_ARRAY_ELEMENT_FLOORPLAN_PLACE | { + "DIE_AREA": "0 0 43.2 43.2", + "CORE_AREA": "1.08 1.08 42.120000000000005 42.120000000000005", + "PDN_TCL": "$(PLATFORM_DIR)/openRoad/pdn/BLOCK_grid_strategy.tcl", + }, + "place": MOCK_ARRAY_ELEMENT_ALL | MOCK_ARRAY_ELEMENT_FLOORPLAN_PLACE | { + }, + "cts": MOCK_ARRAY_ELEMENT_ALL | { + }, + "route": MOCK_ARRAY_ELEMENT_ALL | { + # If this design isn't quickly done in detailed routing, something is wrong. + # At time of adding this option, only 3 iterations were needed for 0 + # violations. + "DETAILED_ROUTE_ARGS": "-bottom_routing_layer M2 -top_routing_layer M5 -save_guide_updates -verbose 1 -droute_end_iter 10", + # since we are specifying DETAILED_ROUTE_ARGS, we need to communicate the + # same information to other stages in the flow. + "MIN_ROUTING_LAYER": "M2", + "MAX_ROUTING_LAYER": "M5", + }, + "final": MOCK_ARRAY_ELEMENT_ALL | { + "PWR_NETS_VOLTAGES": "", + "GND_NETS_VOLTAGES": "", + } + }, + verilog_files = glob(include=["designs/src/mock-array/*.v"]), + stage_sources = { + "synth": mock_array_all_sources + [":mock-array-constraints"], + "floorplan": mock_array_all_sources + [":mock-array-element-io"], + "place": mock_array_all_sources + [":mock-array-element-io"], + "cts": mock_array_all_sources, + "route": mock_array_all_sources + [":mock-array-fastroute"], + "final": mock_array_all_sources, + }, +) + + From ac73caa197514551e3124d94e2bf22f432dc545a Mon Sep 17 00:00:00 2001 From: Jan Bylicki Date: Wed, 28 Aug 2024 17:05:56 +0200 Subject: [PATCH 07/21] flow/MODULE.bazel: Change the default docker container version to follow bazel-orfs Signed-off-by: Jan Bylicki --- flow/MODULE.bazel | 5 ----- 1 file changed, 5 deletions(-) diff --git a/flow/MODULE.bazel b/flow/MODULE.bazel index e599d120ab..a508d30f18 100644 --- a/flow/MODULE.bazel +++ b/flow/MODULE.bazel @@ -22,8 +22,3 @@ git_override( # module_name = "bazel-orfs", path = "../bazel-orfs" #) -orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories") -orfs.default( - image = "openroad/orfs:v3.0-1114-g46acc762", - sha256 = "ae4df23391c26bcc48a506f8e0d0da73742d1b6cb3b1dc02f4d5ea71170195b5", -) From 821ee81ae8b22449a8c4e0c61d5cba16aaa2b666 Mon Sep 17 00:00:00 2001 From: Jan Bylicki Date: Wed, 4 Sep 2024 12:31:16 +0200 Subject: [PATCH 08/21] bazel/README: Add bazel/README Signed-off-by: Jan Bylicki --- bazel/README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 bazel/README.md diff --git a/bazel/README.md b/bazel/README.md new file mode 100644 index 0000000000..81f90b86fb --- /dev/null +++ b/bazel/README.md @@ -0,0 +1,60 @@ +# OpenROAD-flow-scripts and Bazel integration + +`bazel-orfs` is a Bazel package containing the definitions and logic governing the build process of ORFS designs. +The module uses the `openroad/orfs` docker image to extract the flow scripts with dependencies, builds the Bazel environment around them and defines the methods of calling the ORFS Makefiles with selected designs. + +## Run examples + +`flow/BUILD.bazel` contains definitions for various flows to serve as examples. + +It is recommended to run the utility [Bazelisk](https://github.com/bazelbuild/bazelisk) to manage the version of `bazel` installed on the system. +Details on installation can be found in the `bazel-orfs` [README](https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#requirements) + +The flow can be ran with the following call structure: + +```bash +bazel build _ +``` + +For example, to run the stage `final`, along with all the dependent stages, call: +```bash +bazel build gcd_final +``` + +Details on usage and defining of the flows are presented in the Usage section of the `bazel-orfs` [README](https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#usage) + +## Dependency version management + +In the flow scipts, the `bazel-orfs` version is defined as + +```starlark +bazel_dep(name = "bazel-orfs") +git_override( + module_name = "bazel-orfs", + commit = "", + remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git", +) +``` +However, as the referenced documentation shows, the git-based dependency can be overridden with a local repository. +First, remove the `git_override` call entirely and replace it with a `local_path_override` call following this convention: + +```starlark +local_path_override( + module_name = "bazel-orfs", + path = "/replace/with/path/to/local/orfs/repository" +) +``` + +`bazel-orfs` sets a default version of the docker image used to create the Bazel environment. +This selection can be overridden by a following snippet inserted below the `bazel-orfs` declaration and override. + +```starlark +orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories") +orfs.default( + image = "tag-name", + sha256 = "the-hash", +) +``` + +Substitute `tag-name` with the tag of the version needed and `the-hash` with the digest corresponding to the selected tag (without the `sha256:` prefix). + From 4a2d93819cd464df3d25bd05ad32a589d534bb4b Mon Sep 17 00:00:00 2001 From: Jan Bylicki Date: Wed, 4 Sep 2024 13:33:06 +0200 Subject: [PATCH 09/21] flow/BUILD.bazel: Minor style changes Signed-off-by: Jan Bylicki --- flow/BUILD.bazel | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/flow/BUILD.bazel b/flow/BUILD.bazel index a29d6fab35..95e97751e3 100644 --- a/flow/BUILD.bazel +++ b/flow/BUILD.bazel @@ -54,9 +54,10 @@ filegroup( srcs = glob(include=["designs/asap7/swerv_wrapper/lib/*.lib"]) ) -SWERV_ALL = {"LIB_MODEL":"CCS", -"ADDITIONAL_LEFS": "$(locations :additional_lefs)", -"ADDITIONAL_LIBS": "$(locations :additional_libs)", +SWERV_ALL = { + "LIB_MODEL":"CCS", + "ADDITIONAL_LEFS": "$(locations :additional_lefs)", + "ADDITIONAL_LIBS": "$(locations :additional_libs)", } all_sources = [":additional_lefs", ":additional_libs"] @@ -93,8 +94,10 @@ orfs_flow( "GND_NETS_VOLTAGES": "", } }, - verilog_files = glob(include=["designs/src/swerv/swerv_wrapper.sv2v.v", - "designs/asap7/swerv_wrapper/macros.v"]), + verilog_files = glob(include=[ + "designs/src/swerv/swerv_wrapper.sv2v.v", + "designs/asap7/swerv_wrapper/macros.v" + ]), stage_sources = { "synth": all_sources + [":constraints-swerv"], "floorplan": all_sources, @@ -106,10 +109,6 @@ orfs_flow( ) - - - - filegroup( name = "mock-array-constraints", srcs = [ @@ -136,8 +135,6 @@ filegroup( ], visibility = [":__subpackages__"], ) -MOCK_ARRAY_ALL = { -} MOCK_ARRAY_FLOORPLAN_PLACE = { "PLACE_PINS_ARGS": "-annealing", @@ -159,17 +156,17 @@ orfs_flow( name = "MockArray", macros = ["Element_generate_abstract"], stage_args = { - "synth": MOCK_ARRAY_ALL | { + "synth": { "SDC_FILE": "$(location :mock-array-constraints)", }, - "floorplan": MOCK_ARRAY_ALL | MOCK_ARRAY_FLOORPLAN_PLACE | { + "floorplan": MOCK_ARRAY_FLOORPLAN_PLACE | { }, - "place": MOCK_ARRAY_ALL | MOCK_ARRAY_FLOORPLAN_PLACE | { + "place": MOCK_ARRAY_FLOORPLAN_PLACE | { }, - "cts": MOCK_ARRAY_ALL | { + "cts": { "CTS_BUF_DISTANCE": "60" }, - "route": MOCK_ARRAY_ALL | { + "route": { "FASTROUTE_TCL": "$(location :mock-array-fastroute)", # works with 28 or more iterations as of writing, so give it a few more. "GLOBAL_ROUTE_ARGS" : "-congestion_iterations 40 -verbose", @@ -182,7 +179,7 @@ orfs_flow( "MIN_ROUTING_LAYER": "M2", "MAX_ROUTING_LAYER": "M7", }, - "final": MOCK_ARRAY_ALL | { + "final": { "GDS_ALLOW_EMPTY": "Element", "PWR_NETS_VOLTAGEsS": "", "GND_NETS_VOLTAGES": "", @@ -211,7 +208,6 @@ filegroup( visibility = [":__subpackages__"], ) - MOCK_ARRAY_ELEMENT_FLOORPLAN_PLACE = { "IO_CONSTRAINTS": "$(location :mock-array-element-io)", "PLACE_DENSITY": "0.50", @@ -223,7 +219,6 @@ MOCK_ARRAY_ELEMENT_ALL = { "MOCK_ARRAY_COLS" : "8", } - mock_array_all_sources = ["designs/src/mock-array/util.tcl"] orfs_flow( @@ -268,4 +263,3 @@ orfs_flow( }, ) - From 0ee8d9961852093acd459fba1d9033760083ddee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Wed, 4 Sep 2024 19:26:44 +0200 Subject: [PATCH 10/21] dependencyinstaller: do not reinstall docker if it is installed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- etc/DependencyInstaller.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etc/DependencyInstaller.sh b/etc/DependencyInstaller.sh index 79617c94dc..c21ae533b2 100755 --- a/etc/DependencyInstaller.sh +++ b/etc/DependencyInstaller.sh @@ -160,6 +160,14 @@ _installUbuntuPackages() { rm -rf "${baseDir}" fi + if command -v docker &> /dev/null; then + # The user can uninstall docker if they want to reinstall it, + # and also this allows the user to choose drop in replacements + # for docker, such as podman-docker + echo "Docker is already installed, skip docker reinstall." + return 0 + fi + # Add Docker's official GPG key: install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ From e15a33e49fce825a72eafc859022c92df51689c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Wed, 4 Sep 2024 19:38:04 +0200 Subject: [PATCH 11/21] makefile: make memory report review tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/scripts/mem_dump.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/flow/scripts/mem_dump.py b/flow/scripts/mem_dump.py index 07e33852c9..b5ef91a28d 100644 --- a/flow/scripts/mem_dump.py +++ b/flow/scripts/mem_dump.py @@ -3,7 +3,7 @@ import sys -def find_top_module(data): +def find_top_modules(data): # There can be some cruft in the modules list so that # we have multiple top level candidates. top_module = [] @@ -23,6 +23,16 @@ def find_top_module(data): def find_cells_by_type_in_module( module_name, data, target_type, current_path, matching_cells ): + """ + Searches through hierarchy starting at module_name to find all instances of + the given module/type in the hierarchy. + + Returns list of cell paths, which are constructed as: + + .(.+). + + where the child_inst_name/child_module_name pairs are repeated for each level of the hierarchy. + """ for cell_name, cell in data["modules"][module_name]["cells"].items(): cell_path = ( f"{current_path}.{module_name}.{cell_name}" @@ -42,10 +52,10 @@ def find_cells_by_type_in_module( return matching_cells -def find_cells_by_type(data, module_name, current_path=""): +def find_cells_by_type(top_modules, data, module_name, current_path=""): # first find top module, the module without any submodules names = [] - for top_module in find_top_module(data): + for top_module in top_modules: names.extend( find_cells_by_type_in_module( top_module, data, module_name, current_path, [] @@ -55,6 +65,7 @@ def find_cells_by_type(data, module_name, current_path=""): def format_ram_table_from_json(data, max_bits=None): + top_modules = find_top_modules(data) formatting = "{:>5} | {:>5} | {:>6} | {:<20} | {:<80}\n" table = formatting.format("Rows", "Width", "Bits", "Module", "Instances") table += "-" * len(table) + "\n" @@ -70,7 +81,7 @@ def format_ram_table_from_json(data, max_bits=None): parameters = cell["parameters"] size = int(parameters["SIZE"], 2) width = int(parameters["WIDTH"], 2) - instances = find_cells_by_type(data, module_name) + instances = find_cells_by_type(top_modules, data, module_name) bits = size * width * len(instances) entries.append((size, width, bits, module_name, ", ".join(instances))) if max_bits is not None and bits > max_bits: From 216f5166cac187e1291813c085d90d99a0b13a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Thu, 5 Sep 2024 04:31:08 +0200 Subject: [PATCH 12/21] genMetrics.py: fix warnings for Python escape sequences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/util/genMetrics.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/flow/util/genMetrics.py b/flow/util/genMetrics.py index 400e473756..a937b3a26b 100755 --- a/flow/util/genMetrics.py +++ b/flow/util/genMetrics.py @@ -143,17 +143,17 @@ def extractGnuTime(prefix, jsonFile, file): extractTagFromFile( prefix + "__runtime__total", jsonFile, - "^Elapsed time: (\S+)\[h:\]min:sec.*", + "^Elapsed time: (\\S+)\\[h:\\]min:sec.*", file, ) extractTagFromFile( prefix + "__cpu__total", jsonFile, - "^Elapsed time:.*CPU time: user (\S+) .*", + "^Elapsed time:.*CPU time: user (\\S+) .*", file, ) extractTagFromFile( - prefix + "__mem__peak", jsonFile, "^Elapsed time:.*Peak memory: (\S+)KB.", file + prefix + "__mem__peak", jsonFile, "^Elapsed time:.*Peak memory: (\\S+)KB.", file ) @@ -256,14 +256,14 @@ def extract_metrics(cwd, platform, design, flow_variant, output, hier_json): extractTagFromFile( "synth__design__instance__count__stdcell", metrics_dict, - "Number of cells: +(\S+)", + "Number of cells: +(\\S+)", rptPath + "/synth_stat.txt", ) extractTagFromFile( "synth__design__instance__area__stdcell", metrics_dict, - "Chip area for (?:top )?module.*: +(\S+)", + "Chip area for (?:top )?module.*: +(\\S+)", rptPath + "/synth_stat.txt", ) @@ -291,7 +291,7 @@ def extract_metrics(cwd, platform, design, flow_variant, output, hier_json): extractTagFromFile( "globalroute__timing__clock__slack", metrics_dict, - "^\[INFO FLW-....\] Clock .* slack (\S+)", + "^\\[INFO FLW-....\\] Clock .* slack (\\S+)", logPath + "/5_1_grt.log", ) @@ -301,7 +301,7 @@ def extract_metrics(cwd, platform, design, flow_variant, output, hier_json): extractTagFromFile( "finish__timing__wns_percent_delay", metrics_dict, - baseRegEx.format("finish slack div critical path delay", "(\S+)"), + baseRegEx.format("finish slack div critical path delay", "(\\S+)"), rptPath + "/6_finish.rpt", ) From 3ce7ed64da6cef77fa46892d5e829d81f2e93b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Thu, 5 Sep 2024 04:50:20 +0200 Subject: [PATCH 13/21] asap7: tapcell.tcl typo fix for -halo_width_y, was using MACRO_HALO_X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/platforms/asap7/openRoad/tapcell.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/platforms/asap7/openRoad/tapcell.tcl b/flow/platforms/asap7/openRoad/tapcell.tcl index 33398341cf..6a14638ef6 100644 --- a/flow/platforms/asap7/openRoad/tapcell.tcl +++ b/flow/platforms/asap7/openRoad/tapcell.tcl @@ -10,4 +10,4 @@ tapcell \ -tapcell_master "$::env(TAP_CELL_NAME)" \ -endcap_master "$::env(TAP_CELL_NAME)" \ -halo_width_x $::env(MACRO_HALO_X) \ - -halo_width_y $::env(MACRO_HALO_X) + -halo_width_y $::env(MACRO_HALO_Y) From 4fc987db941e455338d05fb291909ec5de4e2d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Fri, 6 Sep 2024 09:53:15 +0200 Subject: [PATCH 14/21] makefile: make STDBUF_CMD optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit originally added for Mac in 4fa7b95bb, solves problems that don't exist on x86 Linux distributions normally. Removing stdbuf dependency is helpful when running in some containerized environments, like Bazel. Signed-off-by: Øyvind Harboe --- flow/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/Makefile b/flow/Makefile index b37f69e855..bcaf6f2295 100644 --- a/flow/Makefile +++ b/flow/Makefile @@ -332,7 +332,7 @@ endif KLAYOUT_FOUND = $(if $(KLAYOUT_CMD),,$(error KLayout not found in PATH)) ifneq ($(shell command -v stdbuf),) - STDBUF_CMD = stdbuf -o L + STDBUF_CMD ?= stdbuf -o L endif #------------------------------------------------------------------------------- From c0fc69c30e743c7e2f67e3882560589e549fbf51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Thu, 5 Sep 2024 03:49:58 +0200 Subject: [PATCH 15/21] fast route: avoid repetition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/Makefile | 3 +++ flow/designs/asap7/mock-array/config.mk | 4 +--- flow/designs/asap7/mock-array/fastroute.tcl | 3 --- flow/scripts/global_place.tcl | 11 +---------- flow/scripts/global_route.tcl | 10 +--------- flow/scripts/gui.tcl | 10 +--------- flow/scripts/util.tcl | 12 ++++++++++++ 7 files changed, 19 insertions(+), 34 deletions(-) delete mode 100644 flow/designs/asap7/mock-array/fastroute.tcl diff --git a/flow/Makefile b/flow/Makefile index b37f69e855..6dfde03f41 100644 --- a/flow/Makefile +++ b/flow/Makefile @@ -134,6 +134,9 @@ export GENERATE_ARTIFACTS_ON_FAILURE ?= 0 # Try fixing all violating endpoints by default (reduce to 5% for runtime) export TNS_END_PERCENT ?=100 +# Default routing layer adjustment +export ROUTING_LAYER_ADJUSTMENT ?= 0.5 + # If we are running headless use offscreen rendering for save_image ifndef DISPLAY export QT_QPA_PLATFORM ?= offscreen diff --git a/flow/designs/asap7/mock-array/config.mk b/flow/designs/asap7/mock-array/config.mk index f56a33a488..a7ff28c8b9 100644 --- a/flow/designs/asap7/mock-array/config.mk +++ b/flow/designs/asap7/mock-array/config.mk @@ -61,14 +61,12 @@ power: # violations. export DETAILED_ROUTE_ARGS = -bottom_routing_layer M2 -top_routing_layer M7 -save_guide_updates -verbose 1 -droute_end_iter 15 -# since we are specifying DETAILED_ROUTE_ARGS, we need to communicate the -# same information to other stages in the flow. export MIN_ROUTING_LAYER = M2 export MAX_ROUTING_LAYER = M7 +export ROUTING_LAYER_ADJUSTMENT = 0.45 # works with 28 or more iterations as of writing, so give it a few more. export GLOBAL_ROUTE_ARGS=-congestion_iterations 40 -verbose -export FASTROUTE_TCL = ./designs/$(PLATFORM)/mock-array/fastroute.tcl # ensure we have some rows, so we don't get a bad clock skew. export MACRO_HALO_X = 0.5 diff --git a/flow/designs/asap7/mock-array/fastroute.tcl b/flow/designs/asap7/mock-array/fastroute.tcl deleted file mode 100644 index 03069bc2dd..0000000000 --- a/flow/designs/asap7/mock-array/fastroute.tcl +++ /dev/null @@ -1,3 +0,0 @@ -# set custom layer ajustment to avoid congestion -set_global_routing_layer_adjustment $env(MIN_ROUTING_LAYER)-$env(MAX_ROUTING_LAYER) 0.45 -set_routing_layers -signal $env(MIN_ROUTING_LAYER)-$env(MAX_ROUTING_LAYER) diff --git a/flow/scripts/global_place.tcl b/flow/scripts/global_place.tcl index 0bcbaf6391..4fad617485 100644 --- a/flow/scripts/global_place.tcl +++ b/flow/scripts/global_place.tcl @@ -4,16 +4,7 @@ load_design 3_2_place_iop.odb 2_floorplan.sdc set_dont_use $::env(DONT_USE_CELLS) -# set fastroute layer reduction -if {[info exist env(FASTROUTE_TCL)]} { - source $env(FASTROUTE_TCL) -} else { - set_global_routing_layer_adjustment $env(MIN_ROUTING_LAYER)-$env(MAX_ROUTING_LAYER) 0.5 - set_routing_layers -signal $env(MIN_ROUTING_LAYER)-$env(MAX_ROUTING_LAYER) - if {[info exist env(MACRO_EXTENSION)]} { - set_macro_extension $env(MACRO_EXTENSION) - } -} +fast_route source $::env(SCRIPTS_DIR)/set_place_density.tcl diff --git a/flow/scripts/global_route.tcl b/flow/scripts/global_route.tcl index b3616458b3..4398eaa2e8 100644 --- a/flow/scripts/global_route.tcl +++ b/flow/scripts/global_route.tcl @@ -10,15 +10,7 @@ proc global_route_helper {} { source $::env(PRE_GLOBAL_ROUTE) } - if {[info exist ::env(FASTROUTE_TCL)]} { - source $::env(FASTROUTE_TCL) - } else { - set_global_routing_layer_adjustment $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) 0.5 - set_routing_layers -signal $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) - if {[info exist ::env(MACRO_EXTENSION)]} { - set_macro_extension $::env(MACRO_EXTENSION) - } - } + fast_route # The default behavior if the user didn't specify GLOBAL_ROUTE_ARGS is to # produce a drc report every 5 iterations. diff --git a/flow/scripts/gui.tcl b/flow/scripts/gui.tcl index dd14066d2f..69855b178e 100644 --- a/flow/scripts/gui.tcl +++ b/flow/scripts/gui.tcl @@ -53,15 +53,7 @@ if {![info exist ::env(GUI_NO_TIMING)]} { log_cmd estimate_parasitics -placement } - if {[info exist env(FASTROUTE_TCL)]} { - source $env(FASTROUTE_TCL) - } else { - set_global_routing_layer_adjustment $env(MIN_ROUTING_LAYER)-$env(MAX_ROUTING_LAYER) 0.5 - set_routing_layers -signal $env(MIN_ROUTING_LAYER)-$env(MAX_ROUTING_LAYER) - if {[info exist env(MACRO_EXTENSION)]} { - set_macro_extension $env(MACRO_EXTENSION) - } - } + fast_route # Cleanup temporary variables unset sdc_file s design_stage diff --git a/flow/scripts/util.tcl b/flow/scripts/util.tcl index b54a0541ac..2033b3a558 100644 --- a/flow/scripts/util.tcl +++ b/flow/scripts/util.tcl @@ -2,3 +2,15 @@ proc log_cmd {cmd args} { puts "$cmd [join $args " "]" $cmd {*}$args } + +proc fast_route {} { + if {[info exist env(FASTROUTE_TCL)]} { + source $::env(FASTROUTE_TCL) + } else { + set_global_routing_layer_adjustment $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) $::env(ROUTING_LAYER_ADJUSTMENT) + set_routing_layers -signal $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) + if {[info exist env(MACRO_EXTENSION)]} { + set_macro_extension $::env(MACRO_EXTENSION) + } + } +} From 2c4ed6355010a42f7b950b2e20301221972d6fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Thu, 5 Sep 2024 21:57:53 +0200 Subject: [PATCH 16/21] asap7: FASTROUTE_TCL simplification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/designs/asap7/mock-alu/config.mk | 2 +- flow/designs/asap7/mock-alu/fastroute.tcl | 3 --- flow/designs/asap7/swerv_wrapper/config.mk | 2 +- flow/designs/asap7/swerv_wrapper/fastroute.tcl | 2 -- 4 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 flow/designs/asap7/mock-alu/fastroute.tcl delete mode 100644 flow/designs/asap7/swerv_wrapper/fastroute.tcl diff --git a/flow/designs/asap7/mock-alu/config.mk b/flow/designs/asap7/mock-alu/config.mk index ca21897b5f..434bbc0065 100644 --- a/flow/designs/asap7/mock-alu/config.mk +++ b/flow/designs/asap7/mock-alu/config.mk @@ -6,4 +6,4 @@ export PLACE_DENSITY = 0.75 export CORE_UTILIZATION = 50 export CORNER = BC -export FASTROUTE_TCL = ./designs/$(PLATFORM)/mock-alu/fastroute.tcl +export ROUTING_LAYER_ADJUSTMENT = 0.45 diff --git a/flow/designs/asap7/mock-alu/fastroute.tcl b/flow/designs/asap7/mock-alu/fastroute.tcl deleted file mode 100644 index 7bfaf5463f..0000000000 --- a/flow/designs/asap7/mock-alu/fastroute.tcl +++ /dev/null @@ -1,3 +0,0 @@ -# set custom layer ajustment to avoid congestion -set_global_routing_layer_adjustment $env(MIN_ROUTING_LAYER)-$env(MAX_ROUTING_LAYER) 0.40 -set_routing_layers -signal $env(MIN_ROUTING_LAYER)-$env(MAX_ROUTING_LAYER) diff --git a/flow/designs/asap7/swerv_wrapper/config.mk b/flow/designs/asap7/swerv_wrapper/config.mk index f3b0942929..2c2cb6e1ec 100644 --- a/flow/designs/asap7/swerv_wrapper/config.mk +++ b/flow/designs/asap7/swerv_wrapper/config.mk @@ -24,4 +24,4 @@ export CORE_AREA = 5 5 545 595 export PLACE_PINS_ARGS = -exclude left:* -exclude right:* export PLACE_DENSITY_LB_ADDON = 0.20 -export FASTROUTE_TCL = ./designs/$(PLATFORM)/swerv_wrapper/fastroute.tcl +export ROUTING_LAYER_ADJUSTMENT = 0.2 diff --git a/flow/designs/asap7/swerv_wrapper/fastroute.tcl b/flow/designs/asap7/swerv_wrapper/fastroute.tcl deleted file mode 100644 index d7d336fb57..0000000000 --- a/flow/designs/asap7/swerv_wrapper/fastroute.tcl +++ /dev/null @@ -1,2 +0,0 @@ -set_global_routing_layer_adjustment M2-M7 0.2 -set_routing_layers -signal $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) From ea3b7c2cd25195e5b18b1a0522a8a3d130b29e5d Mon Sep 17 00:00:00 2001 From: Matt Liberty Date: Thu, 5 Sep 2024 18:50:22 +0000 Subject: [PATCH 17/21] Handle gLinux (rodete) in the DependencyInstaller.sh Signed-off-by: Matt Liberty --- etc/DependencyInstaller.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/etc/DependencyInstaller.sh b/etc/DependencyInstaller.sh index c21ae533b2..7a7711ccb5 100755 --- a/etc/DependencyInstaller.sh +++ b/etc/DependencyInstaller.sh @@ -126,7 +126,7 @@ _installUbuntuPackages() { zlib1g-dev # install KLayout - if _versionCompare $1 -ge 23.04; then + if [[ $1 == "rodete" || $(_versionCompare "$1") -ge 23.04 ]]; then apt-get -y install --no-install-recommends klayout python3-pandas else arch=$(uname -m) @@ -180,11 +180,13 @@ _installUbuntuPackages() { tee /etc/apt/sources.list.d/docker.list > /dev/null apt-get -y update - apt-get -y install --no-install-recommends \ - docker-ce \ - docker-ce-cli \ - containerd.io \ - docker-buildx-plugin + if [[ $1 != "rodete" ]]; then + apt-get -y install --no-install-recommends \ + docker-ce \ + docker-ce-cli \ + containerd.io \ + docker-buildx-plugin + fi } _installDarwinPackages() { @@ -323,8 +325,11 @@ case "${os}" in _installCommon fi ;; - "Ubuntu" ) + "Ubuntu" | "Debian GNU/Linux rodete" ) version=$(awk -F= '/^VERSION_ID/{print $2}' /etc/os-release | sed 's/"//g') + if [[ -z ${version} ]]; then + version=$(awk -F= '/^VERSION_CODENAME/{print $2}' /etc/os-release | sed 's/"//g') + fi if [[ ${CI} == "yes" ]]; then echo "Installing CI Tools" _installCI @@ -335,7 +340,9 @@ case "${os}" in _installUbuntuCleanUp fi if [[ "${option}" == "common" || "${option}" == "all" ]]; then - if _versionCompare ${version} -lt 23.04 ; then + if [[ $version == "rodete" ]]; then + echo "Skip common for rodete" + elif _versionCompare ${version} -lt 23.04 ; then _installCommon fi fi From 68c540a166bbe75639aa5f77df552b5cbb4afba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Fri, 6 Sep 2024 15:25:09 +0200 Subject: [PATCH 18/21] Update flow/scripts/util.tcl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix scoping Co-authored-by: Matt Liberty Signed-off-by: Øyvind Harboe --- flow/scripts/util.tcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flow/scripts/util.tcl b/flow/scripts/util.tcl index 2033b3a558..7a6f275d1e 100644 --- a/flow/scripts/util.tcl +++ b/flow/scripts/util.tcl @@ -4,12 +4,12 @@ proc log_cmd {cmd args} { } proc fast_route {} { - if {[info exist env(FASTROUTE_TCL)]} { + if {[info exist ::env(FASTROUTE_TCL)]} { source $::env(FASTROUTE_TCL) } else { set_global_routing_layer_adjustment $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) $::env(ROUTING_LAYER_ADJUSTMENT) set_routing_layers -signal $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) - if {[info exist env(MACRO_EXTENSION)]} { + if {[info exist ::env(MACRO_EXTENSION)]} { set_macro_extension $::env(MACRO_EXTENSION) } } From ad2450a00f3691094e573ab35854e22031be50b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Mon, 9 Sep 2024 02:26:15 +0200 Subject: [PATCH 19/21] makefile: make memory mem_dump.py regression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit accidentially checked total memory size for all instances of a type of memory, instead of the maximum size of a memory instance, like before. Signed-off-by: Øyvind Harboe --- flow/scripts/mem_dump.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flow/scripts/mem_dump.py b/flow/scripts/mem_dump.py index b5ef91a28d..0104ae19c9 100644 --- a/flow/scripts/mem_dump.py +++ b/flow/scripts/mem_dump.py @@ -82,9 +82,10 @@ def format_ram_table_from_json(data, max_bits=None): size = int(parameters["SIZE"], 2) width = int(parameters["WIDTH"], 2) instances = find_cells_by_type(top_modules, data, module_name) - bits = size * width * len(instances) + instance_bits = size * width + bits = instance_bits * len(instances) entries.append((size, width, bits, module_name, ", ".join(instances))) - if max_bits is not None and bits > max_bits: + if max_bits is not None and instance_bits > max_bits: max_ok = False # Sort the entries by descending bits From 37b8614f36e92fbabd90730f43ab38dd04c15df8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Mon, 9 Sep 2024 21:24:07 +0200 Subject: [PATCH 20/21] scripts: less repetition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- flow/scripts/cts.tcl | 12 +----------- flow/scripts/floorplan.tcl | 8 +------- flow/scripts/global_route.tcl | 11 +---------- flow/scripts/util.tcl | 15 +++++++++++++++ 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/flow/scripts/cts.tcl b/flow/scripts/cts.tcl index 3f13d7d0ee..f15a4b1b2a 100644 --- a/flow/scripts/cts.tcl +++ b/flow/scripts/cts.tcl @@ -71,22 +71,12 @@ if {[info exist ::env(CTS_SNAPSHOTS)]} { save_progress 4_1_pre_repair_hold_setup } -# process user settings -set additional_args "-verbose" -append_env_var additional_args SETUP_SLACK_MARGIN -setup_margin 1 -append_env_var additional_args HOLD_SLACK_MARGIN -hold_margin 1 -append_env_var additional_args TNS_END_PERCENT -repair_tns 1 -append_env_var additional_args SKIP_PIN_SWAP -skip_pin_swap 0 -append_env_var additional_args SKIP_GATE_CLONING -skip_gate_cloning 0 -append_env_var additional_args SKIP_BUFFER_REMOVAL -skip_buffer_removal 0 - if {[info exists ::env(SKIP_CTS_REPAIR_TIMING)] == 0 || $::env(SKIP_CTS_REPAIR_TIMING) == 0} { if {[info exists ::env(EQUIVALENCE_CHECK)] && $::env(EQUIVALENCE_CHECK) == 1} { write_eqy_verilog 4_before_rsz.v } - puts "repair_timing [join $additional_args " "]" - repair_timing {*}$additional_args + repair_timing_helper if {[info exists ::env(EQUIVALENCE_CHECK)] && $::env(EQUIVALENCE_CHECK) == 1} { run_equivalence_test diff --git a/flow/scripts/floorplan.tcl b/flow/scripts/floorplan.tcl index 0936fbcad4..2b235655dc 100644 --- a/flow/scripts/floorplan.tcl +++ b/flow/scripts/floorplan.tcl @@ -104,13 +104,7 @@ if {[info exists ::env(FOOTPRINT_TCL)]} { if { [info exists ::env(REMOVE_ABC_BUFFERS)] && $::env(REMOVE_ABC_BUFFERS) == 1 } { remove_buffers } else { - set additional_args "-verbose" - append_env_var additional_args SETUP_SLACK_MARGIN -setup_margin 1 - append_env_var additional_args TNS_END_PERCENT -repair_tns 1 - append_env_var additional_args SKIP_PIN_SWAP -skip_pin_swap 0 - append_env_var additional_args SKIP_GATE_CLONING -skip_gate_cloning 0 - append_env_var additional_args SKIP_BUFFER_REMOVAL -skip_buffer_removal 0 - repair_timing {*}$additional_args + repair_timing_helper 0 } ##### Restructure for timing ######### diff --git a/flow/scripts/global_route.tcl b/flow/scripts/global_route.tcl index 4398eaa2e8..7b37aff513 100644 --- a/flow/scripts/global_route.tcl +++ b/flow/scripts/global_route.tcl @@ -72,16 +72,7 @@ proc global_route_helper {} { puts "Repair setup and hold violations..." estimate_parasitics -global_routing - # process user settings - set additional_args "-verbose" - append_env_var additional_args SETUP_SLACK_MARGIN -setup_margin 1 - append_env_var additional_args HOLD_SLACK_MARGIN -hold_margin 1 - append_env_var additional_args TNS_END_PERCENT -repair_tns 1 - append_env_var additional_args SKIP_PIN_SWAP -skip_pin_swap 0 - append_env_var additional_args SKIP_GATE_CLONING -skip_gate_cloning 0 - append_env_var additional_args SKIP_BUFFER_REMOVAL -skip_buffer_removal 0 - puts "repair_timing [join $additional_args " "]" - repair_timing {*}$additional_args + repair_timing_helper if {[info exist ::env(DETAILED_METRICS)]} { report_metrics 5 "global route post repair timing" diff --git a/flow/scripts/util.tcl b/flow/scripts/util.tcl index 7a6f275d1e..ef3bd1d218 100644 --- a/flow/scripts/util.tcl +++ b/flow/scripts/util.tcl @@ -14,3 +14,18 @@ proc fast_route {} { } } } + +# -hold_margin is only set when hold_margin is set, default 1 +proc repair_timing_helper { {hold_margin 1} } { + set additional_args "-verbose" + append_env_var additional_args SETUP_SLACK_MARGIN -setup_margin 1 + if {$hold_margin} { + append_env_var additional_args HOLD_SLACK_MARGIN -hold_margin 1 + } + append_env_var additional_args TNS_END_PERCENT -repair_tns 1 + append_env_var additional_args SKIP_PIN_SWAP -skip_pin_swap 0 + append_env_var additional_args SKIP_GATE_CLONING -skip_gate_cloning 0 + append_env_var additional_args SKIP_BUFFER_REMOVAL -skip_buffer_removal 0 + puts "repair_timing [join $additional_args " "]" + repair_timing {*}$additional_args +} From 42e17b0f9fad74915ca1553e104b6f0056c01204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Wed, 11 Sep 2024 01:26:33 +0200 Subject: [PATCH 21/21] makefile: fewer surprises with variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A few driveby fixes of the same... move towards a default value of a variables instead of checking of the existence. For example `make SKIP_INCREMENTAL_REPAIR=0` will disable that option, as opposed to enable it. Signed-off-by: Øyvind Harboe --- flow/Makefile | 3 +++ flow/scripts/cts.tcl | 4 ++-- flow/scripts/global_route.tcl | 20 +++++--------------- flow/scripts/util.tcl | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/flow/Makefile b/flow/Makefile index c4cb53a297..bf6842a730 100644 --- a/flow/Makefile +++ b/flow/Makefile @@ -136,6 +136,9 @@ export TNS_END_PERCENT ?=100 # Default routing layer adjustment export ROUTING_LAYER_ADJUSTMENT ?= 0.5 +export RECOVER_POWER ?= 0 +export SKIP_INCREMENTAL_REPAIR ?= 0 +export DETAILED_METRICS ?= 0 # If we are running headless use offscreen rendering for save_image ifndef DISPLAY diff --git a/flow/scripts/cts.tcl b/flow/scripts/cts.tcl index f15a4b1b2a..63bf917ab2 100644 --- a/flow/scripts/cts.tcl +++ b/flow/scripts/cts.tcl @@ -46,7 +46,7 @@ set_dont_use $::env(DONT_USE_CELLS) utl::push_metrics_stage "cts__{}__pre_repair" estimate_parasitics -placement -if {[info exist ::env(DETAILED_METRICS)]} { +if { $::env(DETAILED_METRICS) } { report_metrics 4 "cts pre-repair" } utl::pop_metrics_stage @@ -55,7 +55,7 @@ repair_clock_nets utl::push_metrics_stage "cts__{}__post_repair" estimate_parasitics -placement -if {[info exist ::env(DETAILED_METRICS)]} { +if { $::env(DETAILED_METRICS) } { report_metrics 4 "cts post-repair" } utl::pop_metrics_stage diff --git a/flow/scripts/global_route.tcl b/flow/scripts/global_route.tcl index 7b37aff513..7b4e0628e7 100644 --- a/flow/scripts/global_route.tcl +++ b/flow/scripts/global_route.tcl @@ -49,15 +49,15 @@ proc global_route_helper {} { set_dont_use $::env(DONT_USE_CELLS) } - if { ![info exists ::env(SKIP_INCREMENTAL_REPAIR)] } { - if {[info exist ::env(DETAILED_METRICS)]} { + if { !$::env(SKIP_INCREMENTAL_REPAIR) } { + if { $::env(DETAILED_METRICS) } { report_metrics 5 "global route pre repair design" } # Repair design using global route parasitics puts "Perform buffer insertion..." repair_design - if {[info exist ::env(DETAILED_METRICS)]} { + if { $::env(DETAILED_METRICS) } { report_metrics 5 "global route post repair design" } @@ -74,7 +74,7 @@ proc global_route_helper {} { repair_timing_helper - if {[info exist ::env(DETAILED_METRICS)]} { + if { $::env(DETAILED_METRICS) } { report_metrics 5 "global route post repair timing" } @@ -86,17 +86,7 @@ proc global_route_helper {} { global_route -end_incremental -congestion_report_file $::env(REPORTS_DIR)/congestion_post_repair_timing.rpt } - if { [info exists ::env(RECOVER_POWER)] } { - puts "Downsizing/switching to higher Vt for non critical gates for power recovery" - puts "Percent of paths optimized $::env(RECOVER_POWER)" - report_tns - report_wns - report_power - repair_timing -recover_power $::env(RECOVER_POWER) - report_tns - report_wns - report_power - } + recover_power if {![info exist ::env(SKIP_ANTENNA_REPAIR)]} { puts "Repair antennas..." diff --git a/flow/scripts/util.tcl b/flow/scripts/util.tcl index ef3bd1d218..7ad12f6dcc 100644 --- a/flow/scripts/util.tcl +++ b/flow/scripts/util.tcl @@ -29,3 +29,18 @@ proc repair_timing_helper { {hold_margin 1} } { puts "repair_timing [join $additional_args " "]" repair_timing {*}$additional_args } + +proc recover_power {} { + if { $::env(RECOVER_POWER) == 0 } { + return + } + puts "Downsizing/switching to higher Vt for non critical gates for power recovery" + puts "Percent of paths optimized $::env(RECOVER_POWER)" + report_tns + report_wns + report_power + repair_timing -recover_power $::env(RECOVER_POWER) + report_tns + report_wns + report_power +}