-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathppa.bzl
47 lines (41 loc) · 1.46 KB
/
ppa.bzl
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
"""plot ppa for top modules"""
load("@bazel-orfs//:openroad.bzl", "orfs_run")
def orfs_ppa(name, title, plot):
"""Generate PPA plots
Args:
name: name of plot target
title: title of the plot
plot:
a list of labels to plot. Names of labels are "Name_<X>_<stage>",
where X is the x value, stage is e.g. cts and Name is the
name of the series.
"""
for base in plot:
orfs_run(
name = "{base}_power".format(base = base),
src = "{base}".format(base = base),
outs = [
"{base}_stats".format(base = base),
],
arguments = {
"OUTPUT": "$(location :{base}_stats)".format(base = base),
},
script = "@bazel-orfs//:power.tcl",
)
native.filegroup(
name = "{}_stats".format(name),
srcs = ["{base}_stats".format(base = base) for base in plot],
)
native.genrule(
name = "{}_ppas".format(name),
srcs = ["{}_stats".format(name)],
outs = ["{}_ppa.pdf".format(name)],
cmd = "$(execpath @bazel-orfs//:plot_clock_period_tool) $@ \"{title}\" $(locations :{name}_stats)".format(name = name, title = title),
tools = ["@bazel-orfs//:plot_clock_period_tool"],
)
native.sh_binary(
name = name,
srcs = ["open_plots.sh"],
args = ["$(location :{}_ppas)".format(name)],
data = ["{}_ppas".format(name)],
)