-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdefs.bzl
More file actions
94 lines (80 loc) · 3.03 KB
/
Copy pathdefs.bzl
File metadata and controls
94 lines (80 loc) · 3.03 KB
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
"""Shared Starlark helpers for HighTide design definitions."""
load("@bazel-orfs//:openroad.bzl", "orfs_flow", "orfs_run")
# PDK label mapping per platform
PDKS = {
"asap7": "@orfs//flow:asap7",
"nangate45": "@orfs//flow:nangate45",
"sky130hd": "@orfs//flow:sky130hd",
}
def _gallery_image(name, src):
"""Render a final-stage screenshot from a routed ODB.
Produces <name>.png via xvfb-run + OpenROAD GUI.
"""
orfs_run(
name = name,
src = src,
outs = [name + ".png"],
arguments = {
"GALLERY_IMAGE": "$(location :" + name + ".png)",
"OR_ARGS": "-gui",
},
extra_args = "OPENROAD_CMD='xvfb-run -a $(OPENROAD_EXE) -exit $(OPENROAD_ARGS)'",
script = "//tools/gallery:final_image.tcl",
)
# Stages for which we emit a <name>_gui_<stage> bazel-run launcher.
# Mirrors orfs_flow's per-stage output targets (synth … final).
_GUI_STAGES = ("synth", "floorplan", "place", "cts", "grt", "route", "final")
def _gui_launcher(name, stage):
"""Emit a `bazel run :<name>_gui_<stage>` shortcut.
Loads the stage ODB (and matching SDC, if any) into the OpenROAD GUI
directly — no ORFS Makefile, no `bazel run @bazel-orfs//:deps -- …`
incantation. The launcher works as long as the stage target has been
built (or is buildable as a runfiles dep).
"""
native.sh_binary(
name = name + "_gui_" + stage,
srcs = ["//tools/gui:launch_gui.sh"],
data = [
":" + name + "_" + stage,
"//tools/gui:open_db.tcl",
"@openroad//:openroad",
],
args = [
"$(rootpath @openroad//:openroad)",
"$(rootpath //tools/gui:open_db.tcl)",
],
tags = ["manual"],
)
def hightide_design(name, platform, verilog_files, top = None, arguments = {}, sources = {}, **kwargs):
"""Wraps orfs_flow with HighTide defaults.
Automatically sets GDS_ALLOW_EMPTY for FakeRAM, maps platform
names to PDK labels, and emits a <name>_gallery target rendering
a final-stage screenshot from the routed ODB.
Args:
name: Base name for Bazel targets.
platform: Target platform (asap7, nangate45, sky130hd).
verilog_files: Verilog source file labels.
top: Verilog top-level module name. Defaults to name.
arguments: ORFS flow arguments dict.
sources: ORFS source file mappings (SDC_FILE, ADDITIONAL_LEFS, etc.).
**kwargs: Additional arguments passed to orfs_flow.
"""
merged_arguments = dict(arguments)
merged_arguments.setdefault("GDS_ALLOW_EMPTY", "fakeram.*")
flow_kwargs = dict(
name = name,
verilog_files = verilog_files,
arguments = merged_arguments,
sources = sources,
pdk = PDKS[platform],
)
if top:
flow_kwargs["top"] = top
flow_kwargs.update(kwargs)
orfs_flow(**flow_kwargs)
_gallery_image(
name = name + "_gallery",
src = ":" + name + "_final",
)
for stage in _GUI_STAGES:
_gui_launcher(name, stage)