Skip to content

Commit 13c60ba

Browse files
committed
bazel: Yosys netlist canonicalization at home example
Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 851d918 commit 13c60ba

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

flow/designs/asap7/swerv_wrapper/BUILD.bazel

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ filegroup(
7373
srcs = [":{}_netlist".format(name) for name in BLACKBOXES],
7474
)
7575

76+
# Canonicalize the netlists to avoid rebuilds unecessarily.
77+
#
78+
# This is more a demonstration than a practical solution.
79+
#
80+
# Other things could be done here, like get a netlist from git lfs,
81+
# process the netlist in some other way, with Naja, etc.
82+
genrule(
83+
name = "netlists_canonicalized",
84+
srcs = [":netlists"],
85+
outs = ["netlists_canonicalized.v"],
86+
cmd = """
87+
cat $(locations :netlists) | grep -v -E '\\(\\* src = "|Generated by Yosys' > $@
88+
""",
89+
)
90+
7691
[orfs_macro(
7792
name = top,
7893
lef = "lef/{}.lef".format(top),
@@ -100,7 +115,7 @@ orfs_flow(
100115
macros = FAKERAMS,
101116
sources = {
102117
"SDC_FILE": [":constraint.sdc"],
103-
"SYNTH_NETLIST_FILES": [":netlists"],
118+
"SYNTH_NETLIST_FILES": [":netlists_canonicalized"],
104119
},
105120
verilog_files = [],
106121
)

0 commit comments

Comments
 (0)