mirror of
https://github.com/chipsalliance/f4pga.git
synced 2025-01-03 03:43:37 -05:00
58 lines
1.5 KiB
Python
58 lines
1.5 KiB
Python
|
#!/usr/bin/python3
|
||
|
|
||
|
# Symbiflow Stage Module
|
||
|
|
||
|
# ----------------------------------------------------------------------------- #
|
||
|
|
||
|
import os
|
||
|
import shutil
|
||
|
from sf_common import *
|
||
|
from sf_module import *
|
||
|
|
||
|
# ----------------------------------------------------------------------------- #
|
||
|
|
||
|
def route_place_file(eblif: str):
|
||
|
return file_noext(eblif) + '.route'
|
||
|
|
||
|
class RouteModule(Module):
|
||
|
def map_io(self, ctx: ModuleContext):
|
||
|
return {
|
||
|
'route': route_place_file(ctx.takes.eblif)
|
||
|
}
|
||
|
|
||
|
def execute(self, ctx: ModuleContext):
|
||
|
build_dir = os.path.dirname(ctx.takes.eblif)
|
||
|
|
||
|
vpr_options = []
|
||
|
if ctx.values.vpr_options:
|
||
|
vpr_options = options_dict_to_list(ctx.values.vpr_options)
|
||
|
|
||
|
|
||
|
vprargs = VprArgs(ctx.share, ctx.takes.eblif, ctx.values,
|
||
|
sdc_file=ctx.takes.sdc)
|
||
|
|
||
|
yield 'Routing with VPR...'
|
||
|
vpr('route', vprargs, cwd=build_dir)
|
||
|
|
||
|
if ctx.is_output_explicit('route'):
|
||
|
shutil.move(route_place_file(ctx.takes.eblif), ctx.outputs.route)
|
||
|
|
||
|
yield 'Saving log...'
|
||
|
save_vpr_log('route.log', build_dir=build_dir)
|
||
|
|
||
|
def __init__(self, _):
|
||
|
self.name = 'route'
|
||
|
self.no_of_phases = 2
|
||
|
self.takes = [
|
||
|
'eblif',
|
||
|
'place',
|
||
|
'sdc?'
|
||
|
]
|
||
|
self.produces = [ 'route' ]
|
||
|
self.values = [
|
||
|
'device',
|
||
|
'vpr_options?'
|
||
|
] + vpr_specific_values()
|
||
|
|
||
|
ModuleClass = RouteModule
|