From b54f38ccad8fe2dcf69fe7238436dfeca6264e4a Mon Sep 17 00:00:00 2001 From: Maciej Dudek Date: Mon, 18 Dec 2023 15:42:29 +0100 Subject: [PATCH] Synthesis: Use ABC script form ORFS This commit adds abc script from ORFS as a default abc script. User can provide custom script using `abc_script` attr in the `synthesize_rtl` rule Signed-off-by: Maciej Dudek --- synthesis/BUILD | 1 + synthesis/abc.script | 45 ++++++++++++++++++++++++++++++++++++++++ synthesis/build_defs.bzl | 8 +++++++ synthesis/synth.tcl | 4 ++-- 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 synthesis/abc.script diff --git a/synthesis/BUILD b/synthesis/BUILD index 739c70ea..36aae206 100644 --- a/synthesis/BUILD +++ b/synthesis/BUILD @@ -22,6 +22,7 @@ package( ) exports_files(["synth.tcl"]) +exports_files(["abc.script"]) pkg_tar( name = "yosys", diff --git a/synthesis/abc.script b/synthesis/abc.script new file mode 100644 index 00000000..c0f2406d --- /dev/null +++ b/synthesis/abc.script @@ -0,0 +1,45 @@ +&get -n +&st +&dch +&nf +&put +&get -n +&st +&syn2 +&if -g -K 6 +&synch2 +&nf +&put +&get -n +&st +&syn2 +&if -g -K 6 +&synch2 +&nf +&put +&get -n +&st +&syn2 +&if -g -K 6 +&synch2 +&nf +&put +&get -n +&st +&syn2 +&if -g -K 6 +&synch2 +&nf +&put +&get -n +&st +&syn2 +&if -g -K 6 +&synch2 +&nf +&put +buffer -c +topo +stime -c +upsize -c +dnsize -c diff --git a/synthesis/build_defs.bzl b/synthesis/build_defs.bzl index d8934fcc..1c586ec2 100644 --- a/synthesis/build_defs.bzl +++ b/synthesis/build_defs.bzl @@ -90,6 +90,7 @@ def _synthesize_design_impl(ctx): default_liberty_file = ctx.attr.standard_cells[StandardCellInfo].default_corner.liberty synth_tcl = ctx.file.synth_tcl + abc_script = ctx.file.abc_script inputs = [] inputs.extend(verilog_files) @@ -97,6 +98,7 @@ def _synthesize_design_impl(ctx): inputs.append(uhdm_flist) inputs.extend(uhdm_files) inputs.append(synth_tcl) + inputs.append(abc_script) inputs.append(default_liberty_file) (tool_inputs, input_manifests) = ctx.resolve_tools(tools = [ctx.attr.yosys_tool]) @@ -125,6 +127,7 @@ def _synthesize_design_impl(ctx): "OUTPUT": output_file, "LIBERTY": default_liberty_file, "DONT_USE_ARGS": dont_use_args, + "ABC_SCRIPT": abc_script, } if ctx.attr.target_clock_period_pico_seconds: @@ -253,6 +256,11 @@ synthesize_rtl = rule( allow_single_file = True, doc = "Tcl synthesis script compatible with the environment-variable API of synth.tcl", ), + "abc_script": attr.label( + default = Label("//synthesis:abc.script"), + allow_single_file = True, + doc = "ABC script", + ), "target_clock_period_pico_seconds": attr.int(doc = "target clock period in picoseconds"), "output_file_name": attr.string(doc = "The output file name."), }, diff --git a/synthesis/synth.tcl b/synthesis/synth.tcl index 3186f288..472a18f7 100644 --- a/synthesis/synth.tcl +++ b/synthesis/synth.tcl @@ -77,9 +77,9 @@ set liberty $::env(LIBERTY) dfflibmap -liberty $liberty if { [info exists ::env(CLOCK_PERIOD) ] } { - abc -liberty $liberty -dff -g aig -D $::env(CLOCK_PERIOD) {*}$::env(DONT_USE_ARGS) + abc -liberty $liberty -dff -script $::env(ABC_SCRIPT) -g aig -D $::env(CLOCK_PERIOD) {*}$::env(DONT_USE_ARGS) } else { - abc -liberty $liberty -dff -g aig {*}$::env(DONT_USE_ARGS) + abc -liberty $liberty -dff -script $::env(ABC_SCRIPT) -g aig {*}$::env(DONT_USE_ARGS) } # Remove internal only aliases for public nets and then give created instances