Skip to content

Commit f5c653d

Browse files
Put maps in a folder for yosys also
1 parent 46d3987 commit f5c653d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tools/yosys.bzl

+20-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,25 @@ def yosys_vhdl_synth(ctx):
4747
}
4848
in_json_file = ctx.actions.write_json("yosys_synth_input.json", out_json, with_inputs=True)
4949

50+
# Dump some register map stuff
51+
maps = []
52+
json_maps = ctx.attrs.top.get(RDLJsonMaps)
53+
if json_maps != None:
54+
for file in json_maps.files:
55+
new_file = ctx.actions.declare_output("maps", file.basename)
56+
maps.append(ctx.actions.copy_file(new_file, file))
57+
html_maps = ctx.attrs.top.get(RDLHtmlMaps)
58+
if html_maps != None:
59+
for file in html_maps.files:
60+
new_file = ctx.actions.declare_output("maps", file.basename)
61+
maps.append(ctx.actions.copy_file(new_file, file))
62+
63+
# This is a bit sketchy but we're declaring any maps as hidden inputs
64+
# here to force the generation of these files since nothing downstream
65+
# depends on them. Buck2 is too smart such that since nothing depends
66+
# on them, it doesn't even build them
67+
# This is a bit of a hack but it works for now.
68+
5069
yosys_py = ctx.actions.declare_output("synth.py")
5170

5271
yosys_gen = ctx.attrs._yosys_gen[RunInfo]
@@ -57,7 +76,7 @@ def yosys_vhdl_synth(ctx):
5776

5877
ctx.actions.run(cmd, category="yosys_synth_gen")
5978

60-
yosys_synth_cmd = cmd_args(hidden=in_json_file)
79+
yosys_synth_cmd = cmd_args(hidden=[in_json_file, maps])
6180
yosys_synth_cmd.add(ctx.attrs._python[PythonToolchainInfo].interpreter)
6281
yosys_synth_cmd.add(yosys_py)
6382
yosys_synth_cmd.add("--output", yosys_json.as_output())

0 commit comments

Comments
 (0)