Skip to content
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
11 changes: 11 additions & 0 deletions synthesis/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def _synthesize_design_impl(ctx):
inputs.append(default_liberty_file)
inputs.extend(additional_liberty_files)

if ctx.file.early_techmap:
inputs.append(ctx.file.early_techmap)

yosys_runfiles_dir = ctx.executable.yosys_tool.path + ".runfiles"

log_file = ctx.actions.declare_file("{}_yosys_output.log".format(ctx.attr.name))
Expand Down Expand Up @@ -181,6 +184,9 @@ def _synthesize_design_impl(ctx):
"YOSYS_DATDIR": yosys_runfiles_dir + "/at_clifford_yosys/techlibs/",
}

if ctx.file.early_techmap:
script_env_files["EARLY_TECHMAP"] = ctx.file.early_techmap

for k, v in script_env_files.items():
if type(v) == "File":
env[k] = v.path
Expand Down Expand Up @@ -393,6 +399,11 @@ synthesize_rtl = rule(
executable = True,
cfg = "exec",
),
"early_techmap": attr.label(
allow_single_file = True,
mandatory = False,
doc = "verilog/system verilog file for early techmap process"
),
},
)

Expand Down
6 changes: 6 additions & 0 deletions synthesis/synth.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# LIBERTY = liberty file for the target technology library
# OUTPUT = verilog file for synthesis output
# STATS_JSON = json file for structured stats output
# EARLY_TECHMAP = verilog/system verilog file for early techmap process

yosys -import

Expand Down Expand Up @@ -56,6 +57,11 @@ foreach src $srcs {
# generic synthesis
set top $::env(TOP)
hierarchy -check -top $top

if { [info exists ::env(EARLY_TECHMAP)]} {
techmap -map $::env(EARLY_TECHMAP)
}

# Move proc_mux at the end of `yosys proc` to avoid inferred latches.
# See https://github.com/YosysHQ/yosys/issues/3456
# Ideally the bug would be solved in UHDM/Yosys.
Expand Down
Loading