File size: 7,459 Bytes
784ee2c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | """ORFS bazel setup."""
module(
name = "orfs",
version = "0.0.1",
)
# --- Regular dependencies (propagated to downstream consumers) ---
bazel_dep(name = "rules_python", version = "2.0.0")
bazel_dep(name = "rules_shell", version = "0.6.1")
# --- Dev dependencies (only honoured when @orfs is the root module) ---
#
# When @orfs is consumed as a non-root dep (e.g. by tools/OpenROAD), the
# downstream module brings its own openroad/qt-bazel/bazel-orfs/yosys-slang
# pins and orfs.default() configuration. Marking everything below as
# dev_dependency = True makes those declarations no-ops in that case, so
# our MODULE.bazel doesn't need to be patched at non-root consumption
# time.
# hermetic-llvm (BCR module "llvm") provides statically linked LLVM
# binaries and a zero-sysroot cc_toolchain: no host compiler, linker or
# /usr/include involved, so host glibc changes cannot break the build.
# Mirrors tools/OpenROAD/MODULE.bazel (its llvm dep is dev-only, so it
# does not propagate here).
bazel_dep(name = "llvm", version = "0.8.11", dev_dependency = True)
# The gnulib-based GNU tools (sed, gawk, m4, bison) vendor wrapper
# headers that must shadow libc headers, which breaks against
# hermetic-llvm's explicit libc -isystem entries (BCR #7642). Mirror
# tools/OpenROAD's fixed-version overrides (single_version_override is
# root-honored only); drop each when tools/OpenROAD drops its copy.
#
# sed is transitive (bazel-orfs -> abc -> readline -> ncurses -> sed);
# 4.9.bcr.5 carries the upstream fix (BCR #7915).
single_version_override(
module_name = "sed",
version = "4.9.bcr.5",
)
# gawk is transitive (abc -> ncurses -> gawk; yosys -> gawk);
# 5.3.2.bcr.7 carries the upstream fix (BCR #7989).
single_version_override(
module_name = "gawk",
version = "5.3.2.bcr.7",
)
# m4 is transitive (rules_bison/rules_flex -> m4).
single_version_override(
module_name = "m4",
version = "1.4.21.bcr.4",
)
# bison is transitive (rules_bison -> bison). 3.8.2.bcr.7 fixes lib/
# but src/ still picks up raw libc headers; the patch restores gnulib
# wrapper-header precedence via -I (to be proposed upstream as
# 3.8.2.bcr.8, then drop).
single_version_override(
module_name = "bison",
patch_strip = 1,
patches = [
"//patches/bison:0001-gnulib-wrapper-headers-use-I-not-isystem.patch",
],
version = "3.8.2.bcr.7",
)
bazel_dep(name = "openroad", dev_dependency = True)
local_path_override(
module_name = "openroad",
path = "tools/OpenROAD",
)
bazel_dep(name = "qt-bazel", dev_dependency = True)
git_override(
module_name = "qt-bazel",
commit = "886104974c2fd72439f2c33b5deebf0fe4649df7",
remote = "https://github.com/The-OpenROAD-Project/qt_bazel_prebuilts",
)
# icu is transitive (qt-bazel -> icu). The BCR overlay patches
# u_getDataDirectory() to locate icudt*.dat via
# rules_cc::cc::runfiles::Runfiles::Rlocation(), but Runfiles::Create()
# returns nullptr whenever no runfiles tree is reachable and the overlay
# dereferences it unconditionally. A binary that a bazel/install.sh-style
# step copies out of bazel-bin loses its .runfiles directory, so the first
# locale-aware compare (QCollator, std::locale, ...) anywhere in the process
# segfaults -- e.g. QFileDialog listing a directory, or a sortable Qt list/
# table. Mirrors tools/OpenROAD's fixed-version override (single_version_
# override is root-honored only); drop when tools/OpenROAD drops its copy.
single_version_override(
module_name = "icu",
patch_strip = 1,
patches = [
"//patches/icu:0001-putil-null-check-bazel-runfiles-before-dereference.patch",
],
version = "76.1.bcr.3",
)
# Exception to the dev-only rule above: flow/BUILD has
# load("@bazel-orfs//:openroad.bzl", "orfs_pdk"), so @bazel-orfs must stay
# visible from @orfs even at non-root consumption; a dev-only bazel_dep
# suppresses that visibility. Only the git_override below (implicitly
# root-only) is dev-conditional — at non-root the consumer's own bazel-orfs
# satisfies this dep. When @orfs is root, dev deps are honoured anyway, so
# the resolved module graph is unchanged.
bazel_dep(name = "bazel-orfs", version = "0.0.1")
bazel_dep(name = "bazel-orfs-verilog", dev_dependency = True)
BAZEL_ORFS_COMMIT = "6ebadeb4be5c9ada103081c9a5e668c014126616"
BAZEL_ORFS_REMOTE = "https://github.com/The-OpenROAD-Project/bazel-orfs.git"
# To bump version, run: bazelisk run @bazel-orfs//:bump
git_override(
module_name = "bazel-orfs",
commit = BAZEL_ORFS_COMMIT,
remote = BAZEL_ORFS_REMOTE,
)
git_override(
module_name = "bazel-orfs-verilog",
commit = BAZEL_ORFS_COMMIT,
remote = BAZEL_ORFS_REMOTE,
strip_prefix = "verilog",
)
# yosys-slang is not on BCR. Pin to a commit on povik/yosys-slang master
# that has the upstream Bazel build (povik/yosys-slang#310) and the
# slang.so visibility fix (povik/yosys-slang#311). Submodules pull in
# vendored slang and fmt sources.
bazel_dep(name = "yosys-slang", dev_dependency = True)
git_override(
module_name = "yosys-slang",
commit = "7753ea70431d85929292b90c33b32f6dbdb3b048",
init_submodules = True,
remote = "https://github.com/povik/yosys-slang.git",
)
bazel_dep(name = "fakeram", dev_dependency = True)
git_override(
module_name = "fakeram",
commit = "6f62c655952b683cda679d80850cb557cc3c262e",
patch_strip = 1,
patches = [
"//patches/fakeram:0001-Add-ORFS-ASAP7-backend.patch",
],
remote = "https://github.com/The-OpenROAD-Project/FakeRAM2.0.git",
)
# --- Extensions ---
register_toolchains(
"@llvm//toolchain:all",
dev_dependency = True,
)
# sv-lang (via tools/OpenROAD) pulls in rules_pycross, whose toolchain
# extension fails on Python 3.8 (transitively registered via or-tools ->
# pybind11_abseil, dropped from rules_python 2.0.0's MINOR_MAPPING).
# pycross.configure_environments is root-honored only, so the workaround
# must be mirrored here from tools/OpenROAD/MODULE.bazel.
bazel_dep(name = "rules_pycross", version = "0.8.1", dev_dependency = True)
pycross = use_extension(
"@rules_pycross//pycross/extensions:pycross.bzl",
"pycross",
dev_dependency = True,
)
pycross.configure_environments(python_versions = ["3.13"])
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
ignore_root_user_error = True,
python_version = "3.13",
)
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "orfs-pip",
python_version = "3.13",
quiet = True,
requirements_lock = "//flow:util/requirements_lock.txt",
)
use_repo(pip, "orfs-pip")
orfs = use_extension(
"@bazel-orfs//:extension.bzl",
"orfs_repositories",
dev_dependency = True,
)
orfs.default(
# Expose the yosys-slang plugin via YOSYS_PLUGIN_PATH so
# SYNTH_HDL_FRONTEND=slang works for ibex, cva6, uart, etc.
yosys_plugins = ["@yosys-slang//src/yosys_plugin:slang.so"],
)
use_repo(orfs, "config")
use_repo(orfs, "gnumake")
use_repo(orfs, "orfs_variable_metadata")
# Auto-generate orfs_flow() targets from config.mk files.
# See flow/README.md for usage.
orfs_designs = use_repo_rule("@bazel-orfs//private:designs.bzl", "orfs_designs")
orfs_designs(
name = "orfs_designs",
designs_dir = "//flow/designs:BUILD",
platforms = [
"asap7",
"gf180",
"ihp-sg13g2",
"nangate45",
"sky130hd",
"sky130hs",
],
)
|