Skip to content

Commit 1f962b8

Browse files
authored
Merge pull request #408 from antmicro/mgan/arith-ops-preservation
Modify synthesis rule to allow operations preservation
2 parents 0572d0d + 44d9c03 commit 1f962b8

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

synthesis/build_defs.bzl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def _synthesize_design_impl(ctx):
109109
inputs.append(default_liberty_file)
110110
inputs.extend(additional_liberty_files)
111111

112+
if ctx.file.early_techmap:
113+
inputs.append(ctx.file.early_techmap)
114+
112115
yosys_runfiles_dir = ctx.executable.yosys_tool.path + ".runfiles"
113116

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

187+
if ctx.file.early_techmap:
188+
script_env_files["EARLY_TECHMAP"] = ctx.file.early_techmap
189+
184190
for k, v in script_env_files.items():
185191
if type(v) == "File":
186192
env[k] = v.path
@@ -393,6 +399,11 @@ synthesize_rtl = rule(
393399
executable = True,
394400
cfg = "exec",
395401
),
402+
"early_techmap": attr.label(
403+
allow_single_file = True,
404+
mandatory = False,
405+
doc = "verilog/system verilog file for early techmap process"
406+
),
396407
},
397408
)
398409

synthesis/synth.tcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# LIBERTY = liberty file for the target technology library
1010
# OUTPUT = verilog file for synthesis output
1111
# STATS_JSON = json file for structured stats output
12+
# EARLY_TECHMAP = verilog/system verilog file for early techmap process
1213

1314
yosys -import
1415

@@ -56,6 +57,11 @@ foreach src $srcs {
5657
# generic synthesis
5758
set top $::env(TOP)
5859
hierarchy -check -top $top
60+
61+
if { [info exists ::env(EARLY_TECHMAP)]} {
62+
techmap -map $::env(EARLY_TECHMAP)
63+
}
64+
5965
# Move proc_mux at the end of `yosys proc` to avoid inferred latches.
6066
# See https://github.com/YosysHQ/yosys/issues/3456
6167
# Ideally the bug would be solved in UHDM/Yosys.

0 commit comments

Comments
 (0)