Skip to content

Commit

Permalink
Merge pull request hdl#281 from hdl/add_constr
Browse files Browse the repository at this point in the history
Adds support for default driving cell in ABC
  • Loading branch information
QuantamHD authored Feb 27, 2024
2 parents 08d5875 + e0f35ed commit a9a960d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions pdk/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ StandardCellInfo = provider(
"ha_fa_mapping": "HA/FA techmapping file",
"parasitic_extraction_benchmark": "Optional calibration file for OpenRCX.",
"open_road_configuration": "OpenROAD PDK configuration.",
"default_input_driver_cell": "The cell to assume is driving primary input nets (very useful for synthesis)",
},
)

Expand Down
10 changes: 10 additions & 0 deletions synthesis/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ def _synthesize_design_impl(ctx):

log_file = ctx.actions.declare_file("{}_yosys_output.log".format(ctx.attr.name))

constr = ctx.actions.declare_file("{}_abc_constraints.constr".format(ctx.attr.name))
constr_contents = ""
default_driver_cell = getattr(ctx.attr.standard_cells[StandardCellInfo], "default_input_driver_cell", "")
if default_driver_cell:
constr_contents = "set_driving_cell {}\n".format(default_driver_cell)

ctx.actions.write(constr, constr_contents)
inputs.append(constr)

args = ctx.actions.args()
args.add("-q") # quiet mode only errors printed to stderr
args.add("-q") # second q don't print warnings
Expand All @@ -131,6 +140,7 @@ def _synthesize_design_impl(ctx):
"LIBERTY": default_liberty_file,
"DONT_USE_ARGS": dont_use_args,
"ABC_SCRIPT": abc_script,
"CONSTR": constr,
}

if ctx.attr.target_clock_period_pico_seconds:
Expand Down
4 changes: 2 additions & 2 deletions synthesis/synth.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ dfflibmap -liberty $liberty
opt

if { [info exists ::env(CLOCK_PERIOD) ] } {
abc -liberty $liberty -dff -script $::env(ABC_SCRIPT) -g aig -D $::env(CLOCK_PERIOD) {*}$::env(DONT_USE_ARGS)
abc -liberty $liberty -dff -script $::env(ABC_SCRIPT) -constr $::env(CONSTR) -g aig -D $::env(CLOCK_PERIOD) {*}$::env(DONT_USE_ARGS)
} else {
abc -liberty $liberty -dff -script $::env(ABC_SCRIPT) -g aig {*}$::env(DONT_USE_ARGS)
abc -liberty $liberty -dff -script $::env(ABC_SCRIPT) -constr $::env(CONSTR) -g aig {*}$::env(DONT_USE_ARGS)
}

setundef -zero
Expand Down

0 comments on commit a9a960d

Please sign in to comment.