File tree Expand file tree Collapse file tree 5 files changed +30
-6
lines changed Expand file tree Collapse file tree 5 files changed +30
-6
lines changed Original file line number Diff line number Diff line change 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 ()
Original file line number Diff line number Diff line change 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 ()
Original file line number Diff line number Diff line change 1313import dotenv
1414from amaranth import *
1515
16+ from . import StepBase
1617from .. import ChipFlowError
1718from ..platforms import SiliconPlatform , top_interfaces , load_pinlock
1819
1920
2021logger = 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
5556class 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
Original file line number Diff line number Diff line change 33from doit .cmd_base import ModuleTaskLoader
44from 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
Original file line number Diff line number Diff line change 33from doit .cmd_base import ModuleTaskLoader
44from 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 ()
You can’t perform that action at this time.
0 commit comments