From d6eec8e76d136d36970db4eff9351886a08d65d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Wed, 23 Oct 2024 11:08:58 +0200 Subject: [PATCH] efinix: ifacewriter: gpio: share common code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit share common code for INPUT, INOUT and OUTPUT. Signed-off-by: Fin Maaß --- litex/build/efinix/ifacewriter.py | 38 ++++--------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/litex/build/efinix/ifacewriter.py b/litex/build/efinix/ifacewriter.py index a8bf63899..e84f651ec 100644 --- a/litex/build/efinix/ifacewriter.py +++ b/litex/build/efinix/ifacewriter.py @@ -169,38 +169,9 @@ design.create("{2}", "{3}", "./../gateware", overwrite=True) for i, pad in enumerate(block["location"]): cmd += f'design.assign_pkg_pin("{name}[{i}]","{pad}")\n' - if "out_reg" in block: - cmd += f'design.set_property("{name}","OUT_REG","{block["out_reg"]}")\n' - cmd += f'design.set_property("{name}","OUT_CLK_PIN","{block["out_clk_pin"]}")\n' - if "out_delay" in block: - cmd += f'design.set_property("{name}","OUTDELAY","{block["out_delay"]}")\n' - - if "out_clk_inv" in block: - cmd += f'design.set_property("{name}","IS_OUTCLK_INVERTED","{block["out_clk_inv"]}")\n' - - if "in_reg" in block: - cmd += f'design.set_property("{name}","IN_REG","{block["in_reg"]}")\n' - cmd += f'design.set_property("{name}","IN_CLK_PIN","{block["in_clk_pin"]}")\n' - if "in_delay" in block: - cmd += f'design.set_property("{name}","INDELAY","{block["in_delay"]}")\n' - - if "in_clk_inv" in block: - cmd += f'design.set_property("{name}","IS_INCLK_INVERTED","{block["in_clk_inv"]}")\n' - if "oe_reg" in block: cmd += f'design.set_property("{name}","OE_REG","{block["oe_reg"]}")\n' - if "drive_strength" in block: - cmd += 'design.set_property("{}","DRIVE_STRENGTH","{}")\n'.format(name, block["drive_strength"]) - if "slewrate" in block: - cmd += 'design.set_property("{}","SLEWRATE","{}")\n'.format(name, block["slewrate"]) - - if prop: - for p, val in prop: - cmd += 'design.set_property("{}","{}","{}")\n'.format(name, p, val) - cmd += "\n" - return cmd - if mode == "INPUT": if len(block["location"]) == 1: cmd += f'design.create_input_gpio("{name}")\n' @@ -209,6 +180,8 @@ design.create("{2}", "{3}", "./../gateware", overwrite=True) cmd += f'design.create_input_gpio("{name}",{block["size"]-1},0)\n' for i, pad in enumerate(block["location"]): cmd += f'design.assign_pkg_pin("{name}[{i}]","{pad}")\n' + + if mode == "INPUT" or mode == "INOUT": if "in_reg" in block: in_clk_pin = block["in_clk_pin"] if isinstance(in_clk_pin, ClockSignal): @@ -225,11 +198,6 @@ design.create("{2}", "{3}", "./../gateware", overwrite=True) cmd += f'design.set_property("{name}","INDELAY","{block["in_delay"]}")\n' if "in_clk_inv" in block: cmd += f'design.set_property("{name}","IS_INCLK_INVERTED","{block["in_clk_inv"]}")\n' - if prop: - for p, val in prop: - cmd += 'design.set_property("{}","{}","{}")\n'.format(name, p, val) - cmd += "\n" - return cmd if mode == "OUTPUT": if len(block["location"]) == 1: @@ -240,6 +208,7 @@ design.create("{2}", "{3}", "./../gateware", overwrite=True) for i, pad in enumerate(block["location"]): cmd += 'design.assign_pkg_pin("{}[{}]","{}")\n'.format(name, i, pad) + if mode == "OUTPUT" or mode == "INOUT": if "out_reg" in block: cmd += 'design.set_property("{}","OUT_REG","{}")\n'.format(name, block["out_reg"]) cmd += 'design.set_property("{}","OUT_CLK_PIN","{}")\n'.format(name, block["out_clk_pin"]) @@ -254,6 +223,7 @@ design.create("{2}", "{3}", "./../gateware", overwrite=True) if "slewrate" in block: cmd += 'design.set_property("{}","SLEWRATE","{}")\n'.format(name, block["slewrate"]) + if mode == "INOUT" or mode == "INPUT" or mode == "OUTPUT": if prop: for p, val in prop: cmd += 'design.set_property("{}","{}","{}")\n'.format(name, p, val)