Skip to content

Commit 28bcf43

Browse files
committed
synth: add parameter for synth pass additional args
1 parent defad2a commit 28bcf43

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

synthesis/build_defs.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def _synthesize_design_impl(ctx):
160160
"LIBERTY": default_liberty_file,
161161
"OUTPUT": output_file,
162162
"STANDARD_CELL_BLACK_BOX": standard_cell_black_box,
163+
"SYNTH_ADDITIONAL_ARGS": ctx.attr.synth_additional_args,
163164
"TOP": ctx.attr.top_module,
164165
"UHDM_FLIST": uhdm_flist,
165166
}
@@ -385,6 +386,11 @@ synthesize_rtl = rule(
385386
providers = [StandardCellInfo],
386387
default = "@com_google_skywater_pdk_sky130_fd_sc_hd//:sky130_fd_sc_hd",
387388
),
389+
"synth_additional_args": attr.string(
390+
mandatory = False,
391+
doc = "Additional args for the Yosys synth pass",
392+
default = "",
393+
),
388394
"synth_tcl": attr.label(
389395
default = Label("//synthesis:synth.tcl"),
390396
allow_single_file = True,

synthesis/synth.tcl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# OUTPUT = verilog file for synthesis output
1111
# STATS_JSON = json file for structured stats output
1212
# EARLY_TECHMAP = verilog/system verilog file for early techmap process
13+
# SYNTH_ADDITIONAL_ARGS = Additional args for the Yosys synth pass
1314

1415
yosys -import
1516

@@ -79,7 +80,12 @@ yosys delete {*/t:$print}
7980
# pass.
8081
yosys opt_clean -purge
8182

82-
yosys synth -top $top -noshare
83+
set synth_args "-noshare"
84+
if { [info exists ::env(SYNTH_ADDITIONAL_ARGS)] && ![string equal $::env(SYNTH_ADDITIONAL_ARGS) ""] } {
85+
set synth_args "$synth_args $::env(SYNTH_ADDITIONAL_ARGS)"
86+
}
87+
88+
yosys synth -top $top {*}$synth_args
8389

8490
# Remove internal only aliases for public nets and then give created instances
8591
# useful names. At this stage it is all the other synthesizable constructs.

0 commit comments

Comments
 (0)