Skip to content

Commit

Permalink
add yosys.resynthesis
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Nov 20, 2024
1 parent e294b24 commit 4ef5756
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
14 changes: 13 additions & 1 deletion openlane/scripts/pyosys/synthesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ def openlane_synth(d, top, flatten, report_dir, *, booth=False, abc_dff=False):
@click.option("--config-in", type=click.Path(exists=True), required=True)
@click.option("--extra-in", type=click.Path(exists=True), required=True)
@click.option("--lighter-dff-map", type=click.Path(exists=True), required=False)
@click.argument("inputs", nargs=-1)
def synthesize(
output,
config_in,
extra_in,
lighter_dff_map,
inputs,
):
config = json.load(open(config_in))
extra = json.load(open(extra_in))
Expand Down Expand Up @@ -154,7 +156,17 @@ def synthesize(

ys.log(f"[INFO] Using SDC file '{sdc_path}' for ABC…")

if verilog_files := config.get("VERILOG_FILES"):
if len(inputs):
d.read_verilog_files(
inputs,
top=config["DESIGN_NAME"],
synth_parameters=[],
includes=includes,
defines=defines,
use_synlig=False,
synlig_defer=False,
)
elif verilog_files := config.get("VERILOG_FILES"):
d.read_verilog_files(
verilog_files,
top=config["DESIGN_NAME"],
Expand Down
24 changes: 24 additions & 0 deletions openlane/steps/pyosys.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,30 @@ class Synthesis(SynthesisCommon):
config_vars = SynthesisCommon.config_vars + verilog_rtl_cfg_vars


@Step.factory.register()
class Resynthesize(SynthesisCommon):
"""
Like ``Synthesis``, but operates on the input netlist instead of RTL files.
Useful to process/elaborate on netlists generated by tools other than Yosys.
Some metrics will also be extracted and updated, namely:
* ``design__instance__count``
* ``design__instance_unmapped__count``
* ``design__instance__area``
"""

id = "Yosys.Resynthesis"
name = "Resynthesis"

config_vars = SynthesisCommon.config_vars

inputs = [DesignFormat.NETLIST]

def get_command(self, state_in):
return super().get_command(state_in) + [state_in[DesignFormat.NETLIST]]


@Step.factory.register()
class VHDLSynthesis(SynthesisCommon):
"""
Expand Down

0 comments on commit 4ef5756

Please sign in to comment.