modules: synth: use pathlib
Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
This commit is contained in:
parent
e4f0639f8d
commit
ab4b7a6c61
|
@ -18,6 +18,7 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
from f4pga.common import *
|
from f4pga.common import *
|
||||||
from f4pga.module import Module, ModuleContext
|
from f4pga.module import Module, ModuleContext
|
||||||
|
|
||||||
|
@ -99,20 +100,20 @@ class SynthModule(Module):
|
||||||
def execute(self, ctx: ModuleContext):
|
def execute(self, ctx: ModuleContext):
|
||||||
tcl_env = yosys_setup_tcl_env(ctx.values.yosys_tcl_env) \
|
tcl_env = yosys_setup_tcl_env(ctx.values.yosys_tcl_env) \
|
||||||
if ctx.values.yosys_tcl_env else {}
|
if ctx.values.yosys_tcl_env else {}
|
||||||
split_inouts = os.path.join(tcl_env["UTILS_PATH"], 'split_inouts.py')
|
split_inouts = Path(tcl_env["UTILS_PATH"]) / 'split_inouts.py'
|
||||||
synth_tcl = os.path.join(ctx.values.tcl_scripts, 'synth.tcl')
|
synth_tcl = Path(ctx.values.tcl_scripts) / 'synth.tcl'
|
||||||
conv_tcl = os.path.join(ctx.values.tcl_scripts, 'conv.tcl')
|
conv_tcl = Path(ctx.values.tcl_scripts) / 'conv.tcl'
|
||||||
|
|
||||||
if get_verbosity_level() >= 2:
|
if get_verbosity_level() >= 2:
|
||||||
yield f'Synthesizing sources: {ctx.takes.sources}...'
|
yield f'Synthesizing sources: {ctx.takes.sources}...'
|
||||||
else:
|
else:
|
||||||
yield f'Synthesizing sources...'
|
yield f'Synthesizing sources...'
|
||||||
|
|
||||||
yosys_synth(synth_tcl, tcl_env, ctx.takes.sources,
|
yosys_synth(str(synth_tcl), tcl_env, ctx.takes.sources,
|
||||||
ctx.values.read_verilog_args, ctx.outputs.synth_log)
|
ctx.values.read_verilog_args, ctx.outputs.synth_log)
|
||||||
|
|
||||||
yield f'Splitting in/outs...'
|
yield f'Splitting in/outs...'
|
||||||
sub('python3', split_inouts, '-i', ctx.outputs.json, '-o',
|
sub('python3', str(split_inouts), '-i', ctx.outputs.json, '-o',
|
||||||
ctx.outputs.synth_json)
|
ctx.outputs.synth_json)
|
||||||
|
|
||||||
if not os.path.isfile(ctx.produces.fasm_extra):
|
if not os.path.isfile(ctx.produces.fasm_extra):
|
||||||
|
@ -120,7 +121,7 @@ class SynthModule(Module):
|
||||||
f.write('')
|
f.write('')
|
||||||
|
|
||||||
yield f'Converting...'
|
yield f'Converting...'
|
||||||
yosys_conv(conv_tcl, tcl_env, ctx.outputs.synth_json)
|
yosys_conv(str(conv_tcl), tcl_env, ctx.outputs.synth_json)
|
||||||
|
|
||||||
def __init__(self, params):
|
def __init__(self, params):
|
||||||
self.name = 'synthesize'
|
self.name = 'synthesize'
|
||||||
|
|
Loading…
Reference in New Issue