Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
build --incompatible_strict_action_env
build --cxxopt "-std=c++20" --host_cxxopt "-std=c++20"

# Don't track MODULE.bazel.lock. Resolved versions ride along with the
# pinned BCR + git_override(commit=…) coordinates in MODULE.bazel and
# downstream cache hits are what we actually care about. Tracking the
# lockfile just means every bazel-orfs / yosys / openroad bump produces
# a 1000-line lock diff that buries the real change. Matches what
# bazel-orfs itself does (its own .bazelrc:7).
common --lockfile_mode=off

try-import %workspace%/user.bazelrc
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ bazel-bin
bazel-out
bazel-OpenROAD-flow-scripts
bazel-testlogs
MODULE.bazel.lock

# python venv
venv/
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ git_override(
bazel_dep(name = "bazel-orfs", dev_dependency = True)
bazel_dep(name = "bazel-orfs-verilog", dev_dependency = True)

BAZEL_ORFS_COMMIT = "717655415dd4446ca4e2fc09907465c75cb23912"
BAZEL_ORFS_COMMIT = "ce6efd96dfe39a9c4ef244f8712386f071545d77"

BAZEL_ORFS_REMOTE = "https://github.com/The-OpenROAD-Project/bazel-orfs.git"

Expand Down
5,190 changes: 0 additions & 5,190 deletions MODULE.bazel.lock

This file was deleted.

6 changes: 6 additions & 0 deletions docs/user/FlowVariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ configuration file.
| <a name="LEC_AUX_VERILOG_FILES"></a>LEC_AUX_VERILOG_FILES| Additional Verilog files (e.g. blackbox stubs) to include in LEC equivalence checks. Appended to the generated Verilog netlist before running the formal equivalence check.| |
| <a name="LEC_CHECK"></a>LEC_CHECK| Perform a formal equivalence check between before and after netlists. If this fails, report an issue to OpenROAD.| 0|
| <a name="LIB_FILES"></a>LIB_FILES| A Liberty file of the standard cell library with PVT characterization, input and output characteristics, timing and power definitions for each cell.| |
| <a name="LIB_MODEL"></a>LIB_MODEL| Selects between NLDM and CCS timing models for the ASAP7 platform. Valid values: NLDM (default), CCS. Used in flow/platforms/asap7/config.mk to pick the LIB_DIR subdirectory and accumulate the corresponding $(CORNER)_$(LIB_MODEL)_LIB_FILES list, and in flow/scripts/load.tcl to gate CCS-specific Tcl branches.| NLDM|
| <a name="MACRO_BLOCKAGE_HALO"></a>MACRO_BLOCKAGE_HALO| Distance beyond the edges of a macro that will also be covered by the blockage generated for that macro. Note that the default macro blockage halo comes from the largest of the specified MACRO_PLACE_HALO x or y values. This variable overrides that calculation.| |
| <a name="MACRO_EXTENSION"></a>MACRO_EXTENSION| Sets the number of GCells added to the blockages boundaries from macros.| |
| <a name="MACRO_PLACEMENT_TCL"></a>MACRO_PLACEMENT_TCL| Specifies the path of a TCL file on how to place macros manually. The user may choose to place just some of the macros in the design. The macro placer will handle the remaining unplaced macros.| |
Expand All @@ -188,6 +189,7 @@ configuration file.
| <a name="MAX_REPAIR_TIMING_ITER"></a>MAX_REPAIR_TIMING_ITER| Maximum number of iterations for repair setup and repair hold.| |
| <a name="MAX_ROUTING_LAYER"></a>MAX_ROUTING_LAYER| The highest metal layer name to be used in routing.| |
| <a name="MIN_BUF_CELL_AND_PORTS"></a>MIN_BUF_CELL_AND_PORTS| Used to insert a buffer cell to pass through wires. Used in synthesis.| |
| <a name="MIN_CLK_ROUTING_LAYER"></a>MIN_CLK_ROUTING_LAYER| The lowest metal layer name to be used for clock-net routing in global routing. Used in flow/platforms/*/fastroute.tcl as the lower bound of `set_routing_layers -clock`. Typically higher than MIN_ROUTING_LAYER so clock nets prefer the upper, lower-RC layers. No `stages:` list because floorplan.tcl also `source`s the platform fastroute.tcl.| |
| <a name="MIN_PLACE_STEP_COEF"></a>MIN_PLACE_STEP_COEF| Sets the minimum phi coefficient (pcof_min / µ_k Lower Bound) for global placement optimization. This parameter controls the step size lower bound in the RePlAce Nesterov optimization algorithm. Lower values may improve convergence but can increase runtime. Valid range: 0.95-1.05| 0.95|
| <a name="MIN_ROUTING_LAYER"></a>MIN_ROUTING_LAYER| The lowest metal layer name to be used in routing.| |
| <a name="NUM_CORES"></a>NUM_CORES| Passed to `openroad -threads $(NUM_CORES)`, defaults to numbers of cores in system as determined by system specific code in Makefile, `nproc` is tried first. OpenROAD does not limit itself to this number of cores across OpenROAD running instances, which can lead to overprovisioning in contexts such as bazel-orfs where there could be many routing, or place jobs running at the same time.| |
Expand Down Expand Up @@ -266,6 +268,7 @@ configuration file.
| <a name="RUN_SCRIPT"></a>RUN_SCRIPT| Path to script to run from `make run`, python or tcl script detected by .py or .tcl extension.| |
| <a name="SC_LEF"></a>SC_LEF| Path to technology standard cell LEF file.| |
| <a name="SDC_FILE"></a>SDC_FILE| The path to design constraint (SDC) file.| |
| <a name="SDC_FILE_EXTRA"></a>SDC_FILE_EXTRA| Path to an extra Tcl file the design's own SDC / io.tcl can `source` for per-design hooks (constraints that don't fit cleanly in the shared SDC_FILE). bazel-orfs classifies this as a source-typed variable (path label), so the value is staged into the sandbox. Used by flow/designs/asap7/mock-cpu.| |
| <a name="SDC_GUT"></a>SDC_GUT| Load design and remove all internal logic before doing synthesis. This is useful when creating a mock .lef abstract that has a smaller area than the amount of logic would allow. bazel-orfs uses this to mock SRAMs, for instance.| |
| <a name="SEAL_GDS"></a>SEAL_GDS| Seal macro to place around the design.| |
| <a name="SETUP_MOVE_SEQUENCE"></a>SETUP_MOVE_SEQUENCE| Passed as -sequence to repair_timing. This should be a string of move keywords separated by commas.| |
Expand Down Expand Up @@ -643,7 +646,9 @@ configuration file.
- [KLAYOUT_TECH_FILE](#KLAYOUT_TECH_FILE)
- [LAYER_PARASITICS_FILE](#LAYER_PARASITICS_FILE)
- [LIB_FILES](#LIB_FILES)
- [LIB_MODEL](#LIB_MODEL)
- [MACRO_EXTENSION](#MACRO_EXTENSION)
- [MIN_CLK_ROUTING_LAYER](#MIN_CLK_ROUTING_LAYER)
- [PLATFORM](#PLATFORM)
- [PLATFORM_TCL](#PLATFORM_TCL)
- [PROCESS](#PROCESS)
Expand All @@ -654,6 +659,7 @@ configuration file.
- [RUN_LOG_NAME_STEM](#RUN_LOG_NAME_STEM)
- [RUN_SCRIPT](#RUN_SCRIPT)
- [SC_LEF](#SC_LEF)
- [SDC_FILE_EXTRA](#SDC_FILE_EXTRA)
- [SEAL_GDS](#SEAL_GDS)
- [SET_RC_TCL](#SET_RC_TCL)
- [SLEW_MARGIN](#SLEW_MARGIN)
Expand Down
107 changes: 97 additions & 10 deletions flow/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
load("@bazel-orfs//:openroad.bzl", "orfs_pdk")

# Expose every individual file under platforms/ as a public source-file
# target, so designs in other packages can refer to e.g.
# //flow:platforms/asap7/verilog/fakeram7_64x28.sv directly. This is the
# label form bazel-orfs's config_mk_parser produces for VERILOG_FILES /
# ADDITIONAL_LEFS / ADDITIONAL_LIBS that point at platform-provided files.
# Exclude package BUILD files so they aren't claimed as source labels by
# any future sub-package under platforms/.
exports_files(
glob(
["platforms/**/*"],
exclude = [
"platforms/**/BUILD",
"platforms/**/BUILD.bazel",
],
),
visibility = ["//visibility:public"],
)

# files shared between scripts/synth.sh and scripts/flow.sh steps
MAKEFILE_SHARED = [
"scripts/variables.json",
Expand Down Expand Up @@ -47,27 +65,96 @@ filegroup(
pdk = pdk,
)
for ext in {
"asap7": ["cfg", "gds", "lef", "lib", "lib.gz", "lyt", "mk", "rules", "sdc", "sv", "tcl", "v"],
"gf180": ["cfg", "gds", "lef", "lib.gz", "lyt", "mk", "rules", "tcl", "v"],
"ihp-sg13g2": ["gds", "json", "lef", "lib", "lyt", "mk", "rules", "tcl", "v"],
"nangate45": ["cfg", "gds", "lef", "lib", "lyt", "mk", "rules", "tcl", "v"],
"sky130hd": ["gds", "lef", "lib", "lyt", "mk", "rules", "tcl", "tlef", "v"],
"sky130hs": ["gds", "lef", "lib", "lyt", "mk", "rules", "tcl", "tlef", "v"],
"asap7": [
"cfg",
"gds",
"lef",
"lib",
"lib.gz",
"lyt",
"mk",
"rules",
"sdc",
"sv",
"tcl",
"v",
],
"gf180": [
"cfg",
"gds",
"lef",
"lib.gz",
"lyt",
"mk",
"rules",
"tcl",
"v",
],
"ihp-sg13g2": [
"gds",
"json",
"lef",
"lib",
"lyt",
"mk",
"rules",
"tcl",
"v",
],
"nangate45": [
"cfg",
"gds",
"lef",
"lib",
"lyt",
"mk",
"rules",
"tcl",
"v",
],
"sky130hd": [
"gds",
"lef",
"lib",
"lyt",
"mk",
"rules",
"tcl",
"tlef",
"v",
],
"sky130hs": [
"gds",
"lef",
"lib",
"lyt",
"mk",
"rules",
"tcl",
"tlef",
"v",
],
}.get(pdk, [])
] + [
"platforms/common/**/*.v",
]),
config = ":platforms/{pdk}/config.mk".format(pdk = pdk),
libs = glob([
"platforms/{pdk}/**/*.{ext}".format(
pdk = pdk,
ext = ext,
pdk = pdk,
)
for ext in {
"asap7": ["lib", "lib.gz"],
"asap7": [
"lib",
"lib.gz",
],
"gf180": ["lib.gz"],
}.get(pdk, ["lib"])
}.get(
pdk,
["lib"],
)
]),
config = ":platforms/{pdk}/config.mk".format(pdk = pdk),
visibility = ["//visibility:public"],
) for pdk in [
"asap7",
Expand Down
8 changes: 7 additions & 1 deletion flow/designs/asap7/mock-alu/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
load("//flow/designs:design.bzl", "design")

design(config = "config.mk")
design(
config = "config.mk",
user_arguments = [
"MOCK_ALU_OPERATIONS",
"MOCK_ALU_WIDTH",
],
)
38 changes: 35 additions & 3 deletions flow/designs/design.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ _GROUPS = {
"gds": ["gds", "gds.gz"],
}

# Extensions exported as individual labels so bazel-orfs's per-file
# cross-package references resolve. Kept tight on purpose: globbing "*"
# silently exposes LICENSE/.gitignore/etc. as the public API surface.
# gds/gds.gz are inputs in hierarchical flows via ADDITIONAL_GDS.
_EXPORTED_EXTS = ["v", "sv", "svh", "tcl", "sdc", "def", "cfg", "lef", "lib", "gds", "gds.gz"]
Comment thread
oharboe marked this conversation as resolved.

def _export_design_files():
"""Publicly export per-file labels for cross-package references.

bazel-orfs's config_mk_parser turns $(DESIGN_HOME)/... and
$(PLATFORM_DIR)/... paths in a config.mk into per-file bazel labels
like //flow/designs/<plat>/<other>:constraint.sdc. Those labels
resolve only if the source package calls exports_files() on the
individual files — being part of a public filegroup is not
sufficient.
"""
exported = native.glob(
["*.{}".format(e) for e in _EXPORTED_EXTS],
allow_empty = True,
)
if exported:
native.exports_files(exported, visibility = ["//visibility:public"])
Comment thread
oharboe marked this conversation as resolved.

def design(config = "config.mk", user_arguments = [], local_arguments = []):
"""Standard BUILD body for flow/designs/<platform>/<design>/.

Expand All @@ -26,18 +49,27 @@ def design(config = "config.mk", user_arguments = [], local_arguments = []):
within the same config.mk, never read by ORFS or by user
.tcl/.mk). Dropped entirely before orfs_flow() is invoked.
"""
_export_design_files()
orfs_design(
config = config,
user_arguments = user_arguments,
local_arguments = local_arguments,
)

def files(group, extra_srcs = None):
"""Named filegroup over conventional extensions."""
"""Named filegroup over conventional extensions.

Also exports the same files individually so per-file labels
(e.g. //flow/designs/src/gcd:gcd.v) resolve from sibling packages.
bazel-orfs's config_mk_parser emits such labels for
$(DESIGN_HOME)/src/<name>/<file> references.
"""
exts = _GROUPS[group]
srcs = native.glob(["*.{}".format(e) for e in exts], allow_empty = True) + \
(extra_srcs or [])
native.filegroup(
name = group,
srcs = native.glob(["*.{}".format(e) for e in exts], allow_empty = True) +
(extra_srcs or []),
srcs = srcs,
visibility = ["//visibility:public"],
)
_export_design_files()
32 changes: 30 additions & 2 deletions flow/designs/src/cva6/core/include/BUILD
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
filegroup(
name = "include",
srcs = glob(["*.v", "*.sv", "*.svh"], allow_empty = True),
srcs = glob(
[
"*.v",
"*.sv",
"*.svh",
],
allow_empty = True,
),
visibility = ["//visibility:public"],
)

filegroup(
name = "verilog",
srcs = glob(["*.v", "*.sv"], allow_empty = True),
srcs = glob(
[
"*.v",
"*.sv",
],
allow_empty = True,
),
visibility = ["//visibility:public"],
)

# bazel-orfs may translate $(DESIGN_HOME)/src/cva6/core/include/<file>
# references in a config.mk into per-file labels. Export individual
# files so cross-package label references resolve.
exports_files(
glob(
[
"*.v",
"*.sv",
"*.svh",
],
allow_empty = True,
),
visibility = ["//visibility:public"],
)
12 changes: 12 additions & 0 deletions flow/scripts/synth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@ touch $2
$YOSYS_EXE -V > $(realpath $2)
$PYTHON_EXE "$SCRIPTS_DIR/run_command.py" --log "$(realpath $2)" --append --tee -- \
$YOSYS_EXE $YOSYS_FLAGS -c $1

# Log result hash, mirroring flow.sh's epilogue for OpenROAD stages.
# genElapsedTime.py understands .odb/.rtlil/.v so it hashes the yosys
# output (1_2_yosys.v, 1_1_yosys_canonicalize.rtlil) automatically.
# Informational; sandbox edge-cases (no matching log, result not declared
# as a bazel action output) must not fail the synth action — but route
# stderr into the log rather than silently dropping it, so a real bug
# in the helper is still discoverable after the fact.
stage=$(basename "$2" .log)
"$PYTHON_EXE" "$UTILS_DIR/genElapsedTime.py" --match "$stage" -d "$LOG_DIR" \
Comment thread
oharboe marked this conversation as resolved.
2>>"$(realpath "$2")" \
| tee -a "$(realpath "$2")" || true
Comment thread
oharboe marked this conversation as resolved.
Outdated
10 changes: 10 additions & 0 deletions flow/scripts/variables.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading