Skip to content

Commit f0e0f3a

Browse files
committed
Start adding some documentation for steps. Don't expose for now as interfaces need fixing for boards, sim etc
1 parent 64c83b9 commit f0e0f3a

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

chipflow_lib/steps/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
Steps provide an extensible way to modify the `chipflow` command behavior for a given design
3+
"""
4+
5+
from abc import ABC
6+
7+
class StepBase(ABC):
8+
def __init__(self, config={}):
9+
...
10+
11+
def build_cli_parser(self, parser):
12+
"Build the cli parser for this step"
13+
...
14+
15+
def run_cli(self, args):
16+
"Called when this step's is used from `chipflow` command"
17+
self.build()

chipflow_lib/steps/board.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: BSD-2-Clause
2+
from . import StepBase
23

3-
class BoardStep:
4+
class BoardStep(StepBase):
45
"""Build the design for a board."""
56

67
def __init__(self, config, platform):
@@ -13,4 +14,5 @@ def run_cli(self, args):
1314
self.build()
1415

1516
def build(self):
17+
"Build for the given platform"
1618
self.platform.build()

chipflow_lib/steps/silicon.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
import dotenv
1414
from amaranth import *
1515

16+
from . import StepBase
1617
from .. import ChipFlowError
1718
from ..platforms import SiliconPlatform, top_interfaces, load_pinlock
1819

1920

2021
logger = logging.getLogger(__name__)
2122

2223

23-
class SiliconTop(Elaboratable):
24+
class SiliconTop(StepBase, Elaboratable):
2425
def __init__(self, config={}):
2526
self._config = config
2627

@@ -53,7 +54,7 @@ def elaborate(self, platform: SiliconPlatform):
5354

5455

5556
class SiliconStep:
56-
"""Prepare and submit the design for an ASIC."""
57+
"""Step to Prepare and submit the design for an ASIC."""
5758
def __init__(self, config):
5859
self.config = config
5960

chipflow_lib/steps/sim.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
from doit.cmd_base import ModuleTaskLoader
44
from doit.doit_cmd import DoitMain
55

6+
from . import StepBase
67

7-
class SimStep:
8+
class SimStep(StepBase):
89
"""Simulate the design."""
910

1011
doit_build_module = None

chipflow_lib/steps/software.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
from doit.cmd_base import ModuleTaskLoader
44
from doit.doit_cmd import DoitMain
55

6+
from . import StepBase
67

7-
class SoftwareStep:
8-
"""Build the software."""
8+
class SoftwareStep(StepBase):
9+
"""Base step to build the software."""
910

1011
doit_build_module = None
1112

@@ -19,7 +20,9 @@ def run_cli(self, args):
1920
self.build()
2021

2122
def doit_build(self):
23+
"Run the overridden doit_build_module"
2224
DoitMain(ModuleTaskLoader(self.doit_build_module)).run(["build_software"])
2325

2426
def build(self):
27+
"Build the software for your design"
2528
self.doit_build()

0 commit comments

Comments
 (0)