diff --git a/BUILD.bazel b/BUILD.bazel index 98ec363..aa2b8e0 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,10 +1,20 @@ load("@bazel-orfs//:openroad.bzl", "orfs_flow", "orfs_run", "orfs_synth") +load("@bazel-orfs//:orfs_libs.bzl", "orfs_libs") load("@bazel-orfs//:sweep.bzl", "orfs_sweep") +load("@rules_python//python:defs.bzl", "py_binary") +load("@rules_python//python:pip.bzl", "compile_pip_requirements") load(":snapshots/kept.bzl", "KEPT_MODULES") load(":write_binary.bzl", "write_binary") SRAM_ABSTRACT_STAGE = "cts" +compile_pip_requirements( + name = "requirements", + src = "requirements.in", + python_version = "3.13", + requirements_txt = "requirements_lock_3_13.txt", +) + filegroup( name = "io-sram", srcs = [ @@ -448,7 +458,7 @@ orfs_sweep( ], other_variants = OTHER_VARIANTS, sources = { - "SYNTH_NETLIST_FILES": [":netlists"], + "SYNTH_NETLIST_FILES": [":BoomTile_cleaned_netlist"], }, stage_sources = BOOMTILE_SOURCES, sweep = { @@ -575,3 +585,45 @@ py_binary( name = "print_python_version", srcs = ["print_python_version.py"], ) + +filegroup( + name = "BoomTile_vars", + # Pick one, they all have the same settings + srcs = [":ALU_netlist_synth"], + output_group = "1_synth.vars", +) + +py_binary( + name = "naja_clean", + srcs = ["naja_clean.py"], + deps = [ + "@megaboom-pip//najaeda", + "@megaboom-pip//pyyaml", + ], +) + +orfs_libs( + name = "BoomTile_libs", + src = ":ALU_netlist_synth", +) + +genrule( + name = "BoomTile_cleaned_netlist", + srcs = [ + ":BoomTile_libs", + ":BoomTile_vars", + ":netlists", + ] + [":" + ram + "_lib" for ram in boomtile_all_rams], + outs = ["BoomTile_cleaned_netlist.v"], + cmd = """ + set -ex + $(execpath :naja_clean) \ + --libs {libs} \ + --vars $(location :BoomTile_vars) \ + --output $(location :BoomTile_cleaned_netlist.v) \ + $(locations :netlists)""".format( + libs = " ".join(["$(location :" + ram + "_lib)" for ram in boomtile_all_rams]), + ), + tags = ["manual"], + tools = [":naja_clean"], +) diff --git a/MODULE.bazel b/MODULE.bazel index 8bcb61a..caac1ed 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -25,20 +25,28 @@ single_version_override( bazel_dep( name = "rules_python", - version = "1.2.0", + version = "1.6.3", # reduce namespace collisions by prefixing with bazel_orfs - repo_name = "megaboom_rules_python", + repo_name = "rules_python", ) # FIXME why do we need to lock down 3.13 to match bazel-orfs? Without this, 3.11 might get picked PYTHON_VERSION = "3.13" -python = use_extension("@megaboom_rules_python//python/extensions:python.bzl", "python") +python = use_extension("@rules_python//python/extensions:python.bzl", "python") python.toolchain( ignore_root_user_error = True, python_version = PYTHON_VERSION, ) +pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") +pip.parse( + hub_name = "megaboom-pip", + python_version = "3.13", + requirements_lock = "//:requirements_lock_3_13.txt", +) +use_repo(pip, "megaboom-pip") + # To test with local bazel-orfs, read: https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#usage # # 1. comment git_override() below diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 3855a4a..a086615 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -179,7 +179,6 @@ "https://bcr.bazel.build/modules/rules_python/0.33.2/MODULE.bazel": "3e036c4ad8d804a4dad897d333d8dce200d943df4827cb849840055be8d2e937", "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", "https://bcr.bazel.build/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7", - "https://bcr.bazel.build/modules/rules_python/1.2.0/MODULE.bazel": "5aeeb48b2a6c19d668b48adf2b8a2b209a6310c230db0ce77450f148a89846e4", "https://bcr.bazel.build/modules/rules_python/1.3.0/MODULE.bazel": "8361d57eafb67c09b75bf4bbe6be360e1b8f4f18118ab48037f2bd50aa2ccb13", "https://bcr.bazel.build/modules/rules_python/1.6.3/MODULE.bazel": "a7b80c42cb3de5ee2a5fa1abc119684593704fcd2fec83165ebe615dec76574f", "https://bcr.bazel.build/modules/rules_python/1.6.3/source.json": "f0be74977e5604a6526c8a416cda22985093ff7d5d380d41722d7e44015cc419",