f4pga/flows/yosys: support optional value 'extra_args'

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-09-23 09:43:07 +02:00
parent bacc41ddd2
commit e821a2c637
2 changed files with 8 additions and 9 deletions

View File

@ -1,7 +1,8 @@
{ {
"default_part": "ICE40UP5K-UWG30", "default_part": "ICE40UP5K-UWG30",
"values": { "values": {
"top": "top" "top": "top",
"extra_args": ["-D", "PVT=1"]
}, },
"dependencies": { "dependencies": {
"sources": [ "sources": [

View File

@ -26,9 +26,6 @@ from f4pga.flows.module import Module, ModuleContext
from f4pga.wrappers.tcl import get_script_path as get_tcl_wrapper_path from f4pga.wrappers.tcl import get_script_path as get_tcl_wrapper_path
isLattice = FPGA_FAM == "ice40"
class YosysModule(Module): class YosysModule(Module):
extra_products: "list[str]" extra_products: "list[str]"
@ -74,14 +71,14 @@ class YosysModule(Module):
# Execute YOSYS command # Execute YOSYS command
args_str = "" if ctx.values.read_verilog_args is None else " ".join(ctx.values.read_verilog_args) args_str = "" if ctx.values.read_verilog_args is None else " ".join(ctx.values.read_verilog_args)
yosys_extra_args = ["-l", ctx.outputs.synth_log] if ctx.outputs.synth_log else [] extra_args = ["-l", ctx.outputs.synth_log] if ctx.outputs.synth_log else []
if isLattice: if ctx.values.extra_args is not None:
yosys_extra_args.extend(["-D", "PVT=1"]) extra_args.extend(ctx.values.extra_args)
common_sub( common_sub(
*( *(
["yosys"] ["yosys"]
+ yosys_extra_args + extra_args
+ [ + [
"-p", "-p",
( (
@ -102,7 +99,7 @@ class YosysModule(Module):
self.name = "yosys" self.name = "yosys"
self.no_of_phases = 3 self.no_of_phases = 3
self.pnrtool = "nextpnr" if isLattice else "vpr" self.pnrtool = "nextpnr" if FPGA_FAM == "ice40" else "vpr"
self.takes = ["sources", "build_dir?"] self.takes = ["sources", "build_dir?"]
# Extra takes for use with TCL scripts # Extra takes for use with TCL scripts
@ -131,6 +128,7 @@ class YosysModule(Module):
"top", "top",
"device", "device",
"tcl_scripts?", "tcl_scripts?",
"extra_args?",
"yosys_tcl_env?", "yosys_tcl_env?",
"read_verilog_args?", "read_verilog_args?",
] ]