From d17041e07619dc6df01a7d01b4ca5d757394d4ee Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Wed, 14 Dec 2022 21:46:08 +0100 Subject: [PATCH] build/nextpnr_wrapper,yosys_nextpnr_toolchain,yosys_wrapper: fix LF for windows (#1536) --- litex/build/lattice/radiant.py | 2 +- litex/build/nextpnr_wrapper.py | 4 ++-- litex/build/xilinx/common.py | 2 +- litex/build/yosys_nextpnr_toolchain.py | 3 ++- litex/build/yosys_wrapper.py | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/litex/build/lattice/radiant.py b/litex/build/lattice/radiant.py index 9cb54b730..0cce1d78d 100644 --- a/litex/build/lattice/radiant.py +++ b/litex/build/lattice/radiant.py @@ -203,7 +203,7 @@ class LatticeRadiantToolchain(GenericToolchain): fail_stmt = "" if self._synth_mode == "yosys": - script_contents += self._yosys.get_yosys_call(target="script") + script_contents += self._yosys.get_yosys_call(target="script") + "\n" script_contents += "{tool} {tcl_script}{fail_stmt}\n".format( tool = tool, diff --git a/litex/build/nextpnr_wrapper.py b/litex/build/nextpnr_wrapper.py index 7c865a8c2..451e2ec0e 100644 --- a/litex/build/nextpnr_wrapper.py +++ b/litex/build/nextpnr_wrapper.py @@ -85,7 +85,7 @@ class NextPNRWrapper(): """ cmd = "{pnr_name} --{in_fmt} {build_name}.{in_fmt} --{constr_fmt}" + \ " {build_name}.{constr_fmt}" + \ - " --{out_fmt} {build_name}.{out_ext} {pnr_opts}\n" + " --{out_fmt} {build_name}.{out_ext} {pnr_opts}" base_cmd = cmd.format( pnr_name = self.name, build_name = self._build_name, @@ -96,7 +96,7 @@ class NextPNRWrapper(): pnr_opts = self._pnr_opts ) if target == "makefile": - return f"{self._build_name}.{self._out_format}:\n\t" + base_cmd + return f"{self._build_name}.{self._out_format}:\n\t" + base_cmd + "\n" elif target == "script": return base_cmd else: diff --git a/litex/build/xilinx/common.py b/litex/build/xilinx/common.py index ed6c7917c..fb40cd3df 100644 --- a/litex/build/xilinx/common.py +++ b/litex/build/xilinx/common.py @@ -452,4 +452,4 @@ def _build_yosys_project(platform, synth_opts="", build_name=""): synth_format = "edif" ) yosys.build_script() - return yosys.get_yosys_call("script") + return yosys.get_yosys_call("script") + "\n" diff --git a/litex/build/yosys_nextpnr_toolchain.py b/litex/build/yosys_nextpnr_toolchain.py index e649b4612..1c637b94b 100644 --- a/litex/build/yosys_nextpnr_toolchain.py +++ b/litex/build/yosys_nextpnr_toolchain.py @@ -194,6 +194,7 @@ class YosysNextPNRToolchain(GenericToolchain): script_ext = ".sh" script_contents = "# Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\nset -e\n" fail_stmt = "" + fail_stmt += "\n" # yosys call script_contents += self._yosys.get_yosys_call("script") + fail_stmt @@ -201,7 +202,7 @@ class YosysNextPNRToolchain(GenericToolchain): script_contents += self._nextpnr.get_call("script") + fail_stmt # pre packer (command to use after PNR step and before packer step) for pre_packer in self._pre_packer_cmd: - script_contents += f"{pre_packer} {self._pre_packer_opts[pre_packer]} {fail_stmt}\n" + script_contents += f"{pre_packer} {self._pre_packer_opts[pre_packer]} {fail_stmt}" # packer call script_contents += f"{self.packer_cmd} {self._packer_opts} {fail_stmt}" diff --git a/litex/build/yosys_wrapper.py b/litex/build/yosys_wrapper.py index bd85147bd..504bd9e5b 100644 --- a/litex/build/yosys_wrapper.py +++ b/litex/build/yosys_wrapper.py @@ -130,9 +130,9 @@ class YosysWrapper(): ======= str containing instruction and/or rule """ - base_cmd = f"yosys -l {self._build_name}.rpt {self._build_name}.ys\n" + base_cmd = f"yosys -l {self._build_name}.rpt {self._build_name}.ys" if target == "makefile": - return f"{self._build_name}.{self._synth_format}:\n\t" + base_cmd + return f"{self._build_name}.{self._synth_format}:\n\t" + base_cmd + "\n" elif target == "script": return base_cmd else: