From 9a21033aa4325dc5c0d7801437f79c15ecde3bc7 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Mon, 19 May 2025 19:10:23 +0100 Subject: [PATCH 1/2] Use builtin-yosys for amaranth --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 02485d8b..2df76474 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ license = {file = "LICENSE.md"} requires-python = ">=3.10" dependencies = [ - "amaranth>=0.5,<0.7", + "amaranth[builtin-yosys]>=0.5,<0.7", "amaranth-soc @ git+https://github.com/amaranth-lang/amaranth-soc", "amaranth-boards @ git+https://github.com/amaranth-lang/amaranth-boards", "yowasp-yosys>=0.41.0.0", From cb83ab87e5af145921ab8f8268e716c061667640 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Tue, 20 May 2025 14:05:42 +0100 Subject: [PATCH 2/2] Setup amaranth tools to use our yowasp build --- chipflow_lib/steps/__init__.py | 21 +++++++++++++++++++++ chipflow_lib/steps/board.py | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/chipflow_lib/steps/__init__.py b/chipflow_lib/steps/__init__.py index 82d44f47..53fd48d9 100644 --- a/chipflow_lib/steps/__init__.py +++ b/chipflow_lib/steps/__init__.py @@ -2,8 +2,29 @@ Steps provide an extensible way to modify the `chipflow` command behavior for a given design """ +import os from abc import ABC +def setup_amaranth_tools(): + _amaranth_settings = { + "AMARANTH_USE_YOSYS": "system", + "YOSYS": "yowasp-yosys", + "SBY": "yowasp-sby", + "SMTBMC": "yowasp-yosys-smtbmc", + "NEXTPNR_ICE40": "yowasp-nextpnr-ice40", + "ICEPACK": "yowasp-icepackr", + "NEXTPNR_ECP5": "yowasp-nextpnr-ecp5", + "ECPBRAM": "yowasp-ecpbram", + "ECPMULTI": "yowasp-ecpmulti", + "ECPPACK": "yowasp-ecppack", + "ECPPLL": "yowasp-ecppll", + "ECPUNPACK": "yowasp-ecpunpack", + "NEXTPNR-ECP5": "yowasp-nextpnr-ecp5", + "YOSYS-WITNESS": "yowasp-yosys-witness", + } + + os.environ |= _amaranth_settings + class StepBase(ABC): def __init__(self, config={}): ... diff --git a/chipflow_lib/steps/board.py b/chipflow_lib/steps/board.py index 439b5800..c9ba1065 100644 --- a/chipflow_lib/steps/board.py +++ b/chipflow_lib/steps/board.py @@ -1,11 +1,12 @@ # SPDX-License-Identifier: BSD-2-Clause -from . import StepBase +from . import StepBase, setup_amaranth_tools class BoardStep(StepBase): """Build the design for a board.""" def __init__(self, config, platform): self.platform = platform + setup_amaranth_tools() def build_cli_parser(self, parser): pass