Skip to content

Commit

Permalink
Synthesis: Use ABC script form ORFS
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mtdudek committed Dec 18, 2023
1 parent 7a510f1 commit b54f38c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
1 change: 1 addition & 0 deletions synthesis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package(
)

exports_files(["synth.tcl"])
exports_files(["abc.script"])

pkg_tar(
name = "yosys",
Expand Down
45 changes: 45 additions & 0 deletions synthesis/abc.script
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions synthesis/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ 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)
inputs.append(verilog_flist)
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])
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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."),
},
Expand Down
4 changes: 2 additions & 2 deletions synthesis/synth.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b54f38c

Please sign in to comment.