From 1fde282291b77dd612912d15f7eec1b95cee1d6f Mon Sep 17 00:00:00 2001 From: Vamsi Vytla Date: Mon, 15 Feb 2021 09:29:00 -0800 Subject: [PATCH] build/xilinx/vivado.py: Allow a tcl script to be added as ip. These tcl scripts tend to generate .xci's on the fly. The tcl script can be looked up in the vivado console as the ip is generated --- litex/build/xilinx/vivado.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/litex/build/xilinx/vivado.py b/litex/build/xilinx/vivado.py index 64474b3f9..ab2a54be7 100644 --- a/litex/build/xilinx/vivado.py +++ b/litex/build/xilinx/vivado.py @@ -171,15 +171,18 @@ class XilinxVivadoToolchain: # Add IPs tcl.append("\n# Add IPs\n") for filename, disable_constraints in platform.ips.items(): - filename_tcl = "{" + filename + "}" - ip = os.path.splitext(os.path.basename(filename))[0] - tcl.append("read_ip " + filename_tcl) - tcl.append("upgrade_ip [get_ips {}]".format(ip)) - tcl.append("generate_target all [get_ips {}]".format(ip)) - tcl.append("synth_ip [get_ips {}] -force".format(ip)) - tcl.append("get_files -all -of_objects [get_files {}]".format(filename_tcl)) - if disable_constraints: - tcl.append("set_property is_enabled false [get_files -of_objects [get_files {}] -filter {{FILE_TYPE == XDC}}]".format(filename_tcl)) + if filename.endswith("tcl"): + tcl += open(filename, "r").read().splitlines() + else: + filename_tcl = "{" + filename + "}" + ip = os.path.splitext(os.path.basename(filename))[0] + tcl.append("read_ip " + filename_tcl) + tcl.append("upgrade_ip [get_ips {}]".format(ip)) + tcl.append("generate_target all [get_ips {}]".format(ip)) + tcl.append("synth_ip [get_ips {}] -force".format(ip)) + tcl.append("get_files -all -of_objects [get_files {}]".format(filename_tcl)) + if disable_constraints: + tcl.append("set_property is_enabled false [get_files -of_objects [get_files {}] -filter {{FILE_TYPE== XDC}}]".format(filename_tcl)) # Add constraints tcl.append("\n# Add constraints\n")