Skip to content

Commit

Permalink
gateware/platform: Implemented a nextpnr seed specification CLI option
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonmux committed Oct 19, 2023
1 parent 3c33622 commit dfd21d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion gateware/dragonBoot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def cli():
platforms = listPlatforms()
buildAction.add_argument('--target', action = 'store', required = True, choices = platforms.keys())

# Allow the user to pick a seed if their toolchain is not giving good nextpnr runs
buildAction.add_argument('--seed', action = 'store', type = int, default = 0,
help = 'The nextpnr seed to use for the gateware build (default 0)')

# Parse the command line and, if `-v` is specified, bump the logging level
args = parser.parse_args()
if args.verbose:
Expand All @@ -46,5 +50,5 @@ def cli():
return 0
elif args.action == 'build':
platform = platforms[args.target]()
platform.build(DragonBoot(), name = 'dragonBoot')
platform.build(DragonBoot(), name = 'dragonBoot', pnrSeed = args.seed)
return 0
4 changes: 2 additions & 2 deletions gateware/dragonBoot/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(self, toolchain = 'IceStorm'):
self.flash.platform(self)

def build(self, elaboratable, name = "top", build_dir = "build", do_build = True,
program_opts = None, do_program = False, **kwargs
program_opts = None, do_program = False, pnrSeed = 0, **kwargs
) -> Union[BuildPlan, BuildProducts, None]:
""" This is called automatically by the bootloader CLI.
Expand All @@ -169,7 +169,7 @@ def build(self, elaboratable, name = "top", build_dir = "build", do_build = True
"""
products : LocalBuildProducts = super().build(
elaboratable, name, build_dir, do_build, do_program = False,
synth_opts = '-abc9', nextpnr_opts = '--tmg-ripup --seed=0',
synth_opts = '-abc9', nextpnr_opts = ['--tmg-ripup', f'--seed={pnrSeed}'],
**kwargs
)

Expand Down

0 comments on commit dfd21d3

Please sign in to comment.