Skip to content

Commit

Permalink
[vivado_synth] fix support for list strategy steps
Browse files Browse the repository at this point in the history
  • Loading branch information
kammoh committed Jul 26, 2023
1 parent 9ea87df commit fc7e422
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 14 additions & 7 deletions src/xeda/flows/vivado/vivado_alt_synth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from typing import Any, Dict, List, Union
from typing import Any, Dict, List, Optional

from ...dataclass import validator
from ...flow import FpgaSynthFlow
Expand All @@ -9,7 +9,7 @@

# curated options based on experiments and Vivado documentations
# and https://www.xilinx.com/support/documentation/sw_manuals/xilinx2022_1/ug901-vivado-synthesis.pdf
strategies: Dict[str, Dict[str, Union[None, List[str], Dict[str, Any]]]] = {
strategies: Dict[str, Dict[str, Optional[Dict[str, Any]]]] = {
"synth": {
"Debug": {
"synth": {
Expand Down Expand Up @@ -386,14 +386,21 @@ def run(self):
ss = self.settings
assert isinstance(ss, self.Settings)

if ss.out_of_context:
if "synth" in ss.synth.steps and ss.synth.steps["synth"] is not None:
ss.synth.steps["synth"]["mode"] = "out_of_context"

# always need a synth step?
synth_steps = ss.synth.steps.get("synth")
if synth_steps is None:
synth_steps = {}
if not isinstance(synth_steps, dict):
synth_steps = {s: None for s in synth_steps}

if ss.out_of_context:
if "synth" in ss.synth.steps and ss.synth.steps["synth"] is not None:
if isinstance(ss.synth.steps["synth"], dict):
ss.synth.steps["synth"]["mode"] = "out_of_context"
else:
ss.synth.steps["synth"].append("-mode out_of_context")

# always need a synth step?
ss.synth.steps["synth"] = synth_steps
if any(x in ss.blacklisted_resources for x in ("bram_tile", "bram")):
# FIXME also add "max_uram 0", only for UltraScale+ devices
synth_steps["max_bram"] = 0
Expand Down
2 changes: 1 addition & 1 deletion src/xeda/flows/vivado/vivado_synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def run(self):

if settings.synth.steps["SYNTH_DESIGN"] is None:
settings.synth.steps["SYNTH_DESIGN"] = {}
assert settings.synth.steps["SYNTH_DESIGN"] is not None
assert isinstance(settings.synth.steps["SYNTH_DESIGN"], dict)
if any(item in settings.blacklisted_resources for item in ("bram_tile", "bram")):
# FIXME also add -max_uram 0 for ultrascale+
settings.synth.steps["SYNTH_DESIGN"]["MAX_BRAM"] = 0
Expand Down

0 comments on commit fc7e422

Please sign in to comment.