From ab6bb331fdd051b3e98f21a3277d4b1705e9f07e Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sat, 29 Oct 2022 09:08:19 +0200 Subject: [PATCH 1/6] build/generic_toolchain: space before = --- litex/build/generic_toolchain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/build/generic_toolchain.py b/litex/build/generic_toolchain.py index 998f66576..2728bc333 100644 --- a/litex/build/generic_toolchain.py +++ b/litex/build/generic_toolchain.py @@ -122,7 +122,7 @@ class GenericToolchain: from edalize import get_edatool # Get tool name and options - (tool, tool_options)= self.get_tool_options() + (tool, tool_options) = self.get_tool_options() # Files list files = [] From 79cc3698b81ac96183c49d09a185d0b2a888453e Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sat, 29 Oct 2022 09:12:51 +0200 Subject: [PATCH 2/6] build/generic_toolchain, build/lattice/icestorm: tool_options is now a dict {key, value} (with value can be a dict) => edaflow compat --- litex/build/generic_toolchain.py | 2 +- litex/build/lattice/icestorm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litex/build/generic_toolchain.py b/litex/build/generic_toolchain.py index 2728bc333..f7b832ad8 100644 --- a/litex/build/generic_toolchain.py +++ b/litex/build/generic_toolchain.py @@ -144,7 +144,7 @@ class GenericToolchain: edam = { 'name' : self._build_name, 'files' : files, - 'tool_options' : {tool: tool_options}, + **tool_options, 'toplevel' : self._build_name, } diff --git a/litex/build/lattice/icestorm.py b/litex/build/lattice/icestorm.py index c1a676137..50a7df4ea 100644 --- a/litex/build/lattice/icestorm.py +++ b/litex/build/lattice/icestorm.py @@ -102,7 +102,7 @@ class LatticeIceStormToolchain(YosysNextPNRToolchain): "yosys_synth_options": self._synth_opts.split(' '), "nextpnr_options": self._pnr_opts.split(' '), } - return ("icestorm", tool_options) + return ("icestorm", {"tool_options": {"icestorm": tool_options}}) def icestorm_args(parser): From 949f262ce919bbc9994c2586b76643d3f3d55e03 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sat, 29 Oct 2022 09:14:05 +0200 Subject: [PATCH 3/6] build/xilinx/f4pga: XDC -> xdc --- litex/build/xilinx/f4pga.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/build/xilinx/f4pga.py b/litex/build/xilinx/f4pga.py index cba6bccd4..8c8994296 100644 --- a/litex/build/xilinx/f4pga.py +++ b/litex/build/xilinx/f4pga.py @@ -64,7 +64,7 @@ class F4PGAToolchain(GenericToolchain): def build_io_constraints(self): # Generate design constraints tools.write_to_file(self._build_name + ".xdc", _build_xdc(self.named_sc, self.named_pc)) - return (self._build_name + ".xdc", "XDC") + return (self._build_name + ".xdc", "xdc") def build_timing_constraints(self, vns): self.platform.add_platform_command(_xdc_separator("Clock constraints")) From 50cf037bef3111a921022ffb58bc1477a9babd1e Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sat, 29 Oct 2022 09:14:49 +0200 Subject: [PATCH 4/6] build/xilinx/f4pga: adding edalize backend support --- litex/build/xilinx/f4pga.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/litex/build/xilinx/f4pga.py b/litex/build/xilinx/f4pga.py index 8c8994296..1ce6f9b4c 100644 --- a/litex/build/xilinx/f4pga.py +++ b/litex/build/xilinx/f4pga.py @@ -40,6 +40,7 @@ class F4PGAToolchain(GenericToolchain): "ars_ff2": ("ars_ff2", "true"), # user-defined attribute "no_shreg_extract": None } + supported_build_backend = ["litex", "edalize"] def __init__(self): super().__init__() @@ -130,3 +131,20 @@ class F4PGAToolchain(GenericToolchain): def add_false_path_constraint(self, platform, from_, to): # FIXME: false path constraints are currently not supported by the F4PGA toolchain return + + # Edalize tool name and tool options ----------------------------------------------------------- + def get_tool_options(self): + device_name = { + "xc7a10": "xc7a100t_test", + "xc7a20": "xc7a200t_test", + "xc7z01": "xc7z010_test", + "xc7z02": "xc7z020_test", + }.get(self.platform.device[0:6], "xc7a50t_test") + + tool_options = { + "arch" : "xilinx", + "chip" : device_name, + "device" : "artix7" if self.platform.device.startswith("xc7a") else "zynq", + "part" : self._partname, + } + return ("f4pga", {"flow_options": tool_options}) From 50ffd0cd023b3080171fad7ea9b2d869b8b63478 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sat, 29 Oct 2022 11:15:52 +0200 Subject: [PATCH 5/6] build/{nextpnr_wrapper, yosys_nextpnr_toolchain}: adding getter to retrieve pnr configuration --- litex/build/nextpnr_wrapper.py | 9 +++++++++ litex/build/yosys_nextpnr_toolchain.py | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/litex/build/nextpnr_wrapper.py b/litex/build/nextpnr_wrapper.py index 91cdb3a6a..7c865a8c2 100755 --- a/litex/build/nextpnr_wrapper.py +++ b/litex/build/nextpnr_wrapper.py @@ -62,6 +62,15 @@ class NextPNRWrapper(): if value != "": self._pnr_opts += f"--{key} {value} " + @property + def pnr_opts(self): + """return PNR configuration options + Returns + ======= + str containing configuration options passed to nextpnr-xxx + """ + return self._pnr_opts + def get_call(self, target="script"): """built a script command or a Makefile rule + command diff --git a/litex/build/yosys_nextpnr_toolchain.py b/litex/build/yosys_nextpnr_toolchain.py index e875bf3e0..e649b4612 100644 --- a/litex/build/yosys_nextpnr_toolchain.py +++ b/litex/build/yosys_nextpnr_toolchain.py @@ -157,6 +157,19 @@ class YosysNextPNRToolchain(GenericToolchain): seed = self.seed ) + @property + def pnr_opts(self): + """return PNR configuration options + Returns + ======= + str containing configuration options passed to nextpnr-xxx or None if + _nextpnr is not already instanciated + """ + if self._nextpnr is None: + return None + else: + return self._nextpnr.pnr_opts + def build_project(self): """ create project files (mainly Yosys ys file) """ From 0855612b6db763f5361cb80722bab3d1b788d6b0 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sat, 29 Oct 2022 11:16:55 +0200 Subject: [PATCH 6/6] build/lattice/icestorm: use PNR getter to fill edalize dict --- litex/build/lattice/icestorm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/build/lattice/icestorm.py b/litex/build/lattice/icestorm.py index 50a7df4ea..597e09003 100644 --- a/litex/build/lattice/icestorm.py +++ b/litex/build/lattice/icestorm.py @@ -100,7 +100,7 @@ class LatticeIceStormToolchain(YosysNextPNRToolchain): tool_options = { "icepack_options": ["-s"], "yosys_synth_options": self._synth_opts.split(' '), - "nextpnr_options": self._pnr_opts.split(' '), + "nextpnr_options": self.pnr_opts.split(' '), } return ("icestorm", {"tool_options": {"icestorm": tool_options}})