Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synth: Make synthesize_rtl emit a VerilogInfo provider #362

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion synthesis/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""Rules for synthesizing (System)Verilog code."""

load("@rules_hdl//pdk:build_defs.bzl", "StandardCellInfo")
load("//verilog:defs.bzl", "VerilogInfo")
load("//verilog:defs.bzl", "VerilogInfo", "make_dag_entry", "make_verilog_info")

# There are no rules to generate this provider, but it does provide the mechansim to build
# rules based on surelog in the open source world.
Expand Down Expand Up @@ -213,6 +213,16 @@ def _synthesize_design_impl(ctx):
verilog_files = verilog_files,
uhdm_files = uhdm_files,
),
make_verilog_info(
new_entries = [make_dag_entry(
label = ctx.label,
srcs = [output_file],
hdrs = [],
data = [],
deps = [],
tags = [],
)],
),
]

def _benchmark_synth(ctx, synth_log_file):
Expand Down
4 changes: 4 additions & 0 deletions verilog/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
load(
":providers.bzl",
_VerilogInfo = "VerilogInfo",
_make_dag_entry = "make_dag_entry",
_make_verilog_info = "make_verilog_info",
_verilog_library = "verilog_library",
)

VerilogInfo = _VerilogInfo
verilog_library = _verilog_library
make_dag_entry = _make_dag_entry
make_verilog_info = _make_verilog_info
5 changes: 4 additions & 1 deletion verilog/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ VerilogInfo = provider(
},
)

def make_dag_entry(srcs, hdrs, data, deps, label):
def make_dag_entry(srcs, hdrs, data, deps, label, tags):
"""Create a new DAG entry for use in VerilogInfo.

As VerilogInfo should be created via 'merge_verilog_info' (rather than directly),
Expand All @@ -42,6 +42,7 @@ def make_dag_entry(srcs, hdrs, data, deps, label):
data: A list of File that are `data`.
deps: A list of Label that are deps of this entry.
label: A Label to use as the name for this entry.
tags: A list of str. (Ideally) just the entry tags for later filelist filtering.
Returns:
struct with all these fields properly stored.
"""
Expand All @@ -50,6 +51,7 @@ def make_dag_entry(srcs, hdrs, data, deps, label):
hdrs = tuple(hdrs),
data = tuple(data),
deps = tuple(deps),
tags = tuple(tags),
label = label,
)

Expand Down Expand Up @@ -97,6 +99,7 @@ def _verilog_library_impl(ctx):
hdrs = ctx.files.hdrs,
deps = ctx.attr.deps,
label = ctx.label,
tags = [],
)],
old_infos = [dep[VerilogInfo] for dep in ctx.attr.deps],
)
Expand Down
Loading