Skip to content

Commit ca650bf

Browse files
authored
synth: Make synthesize_rtl emit a VerilogInfo provider (#362)
* synth: Make synthesize_rtl emit a VerilogInfo provider Lets you do gate level sims easier if this rule can be passed as if it were a verilog_library Signed-off-by: Ethan Mahintorabi <[email protected]> * reformat bzl Signed-off-by: Ethan Mahintorabi <[email protected]> --------- Signed-off-by: Ethan Mahintorabi <[email protected]>
1 parent 7d85930 commit ca650bf

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

synthesis/build_defs.bzl

+11-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"""Rules for synthesizing (System)Verilog code."""
1616

1717
load("@rules_hdl//pdk:build_defs.bzl", "StandardCellInfo")
18-
load("//verilog:defs.bzl", "VerilogInfo")
18+
load("//verilog:defs.bzl", "VerilogInfo", "make_dag_entry", "make_verilog_info")
1919

2020
# There are no rules to generate this provider, but it does provide the mechansim to build
2121
# rules based on surelog in the open source world.
@@ -213,6 +213,16 @@ def _synthesize_design_impl(ctx):
213213
verilog_files = verilog_files,
214214
uhdm_files = uhdm_files,
215215
),
216+
make_verilog_info(
217+
new_entries = [make_dag_entry(
218+
label = ctx.label,
219+
srcs = [output_file],
220+
hdrs = [],
221+
data = [],
222+
deps = [],
223+
tags = [],
224+
)],
225+
),
216226
]
217227

218228
def _benchmark_synth(ctx, synth_log_file):

verilog/defs.bzl

+4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
load(
44
":providers.bzl",
55
_VerilogInfo = "VerilogInfo",
6+
_make_dag_entry = "make_dag_entry",
7+
_make_verilog_info = "make_verilog_info",
68
_verilog_library = "verilog_library",
79
)
810

911
VerilogInfo = _VerilogInfo
1012
verilog_library = _verilog_library
13+
make_dag_entry = _make_dag_entry
14+
make_verilog_info = _make_verilog_info

verilog/providers.bzl

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ VerilogInfo = provider(
2424
},
2525
)
2626

27-
def make_dag_entry(srcs, hdrs, data, deps, label):
27+
def make_dag_entry(srcs, hdrs, data, deps, label, tags):
2828
"""Create a new DAG entry for use in VerilogInfo.
2929
3030
As VerilogInfo should be created via 'merge_verilog_info' (rather than directly),
@@ -42,6 +42,7 @@ def make_dag_entry(srcs, hdrs, data, deps, label):
4242
data: A list of File that are `data`.
4343
deps: A list of Label that are deps of this entry.
4444
label: A Label to use as the name for this entry.
45+
tags: A list of str. (Ideally) just the entry tags for later filelist filtering.
4546
Returns:
4647
struct with all these fields properly stored.
4748
"""
@@ -50,6 +51,7 @@ def make_dag_entry(srcs, hdrs, data, deps, label):
5051
hdrs = tuple(hdrs),
5152
data = tuple(data),
5253
deps = tuple(deps),
54+
tags = tuple(tags),
5355
label = label,
5456
)
5557

@@ -97,6 +99,7 @@ def _verilog_library_impl(ctx):
9799
hdrs = ctx.files.hdrs,
98100
deps = ctx.attr.deps,
99101
label = ctx.label,
102+
tags = [],
100103
)],
101104
old_infos = [dep[VerilogInfo] for dep in ctx.attr.deps],
102105
)

0 commit comments

Comments
 (0)