diff --git a/zynq_sym_gen.py b/zynq_sym_gen.py deleted file mode 100644 index 83d48d5..0000000 --- a/zynq_sym_gen.py +++ /dev/null @@ -1,77 +0,0 @@ -from pathlib import Path - -dir_root = Path(__file__).parent / ".." - - -def csv2kisym(infile, out, name=None): - with open(infile, "r") as f: - lines = f.readlines() - - part = lines[0].split()[1] - pin_lines = lines[3:] - while pin_lines[-1].strip() == "" or "Total Number of Pins" in pin_lines[-1]: - pin_lines.pop(-1) - - if name is not None: - name = part.upper() - - lib = [ - "(kicad_symbol_lib (version 20220914) (generator kicad_symbol_editor)", - f'(symbol "{name}" (in_bom yes) (on_board yes)', - '(property "Reference" "U" (id 0) (at 0 0 0)(effects (font (size 1.27 1.27))))', - '(property "Value" "" (id 1) (at 0 0 0)(effects (font (size 1.27 1.27)) hide))', - '(property "Footprint" "" (id 2) (at 0 0 0)(effects (font (size 1.27 1.27)) hide))', - '(property "Datasheet" "" (id 3) (at 0 0 0)(effects (font (size 1.27 1.27)) hide))', - '(property "Manufacturer" "" (id 4) (at 0 0 0)(effects (font (size 1.27 1.27)) hide))', - '(property "ManufacturerPartNumber" "" (id 5) (at 0 0 0)(effects (font (size 1.27 1.27))))', - '(property "ki_locked" "" (id 6) (at 0 0 0)(effects (font (size 1.27 1.27))))', - '(property "ki_description" "" (id 7) (at 0 0 0)(effects (font (size 1.27 1.27)) hide))', - # f'(symbol "{name}_1_0" (pin output line (at -3.81 -45.72 0) (length 2.54)(name "" (effects (font (size 1.27 1.27))))(number "" (effects (font (size 1.27 1.27))))))', - ] - - lib += [f'(symbol "{name}_{1}_1"'] - for ii, p in enumerate(pin_lines): - ( - pad, - pin_name, - mem_byte_group, - bank, - vccaux_group, - super_logic_region, - io_type, - no_connect, - ) = p.split() - if io_type in ["HR", "DRR"]: - pin_type = "bidirectional" - elif io_type == "MIO" and "PS_MIO" in pin_name and "VREF" not in pin_name: - pin_type = "bidirectional" - elif pin_name == "GND": - pin_type = "power_in" - elif "VCC" in pin_name and io_type == "NA": - pin_type = "power_in" - else: - pin_type = "unspecified" - - lib += [ - f"(pin {pin_type} line" - f"(at -3.81 {-2.54 * ii} 0) (length 3.81)" - f'(name "{pin_name}" (effects (font (size 1.27 1.27))))' - f'(number "{pad}" (effects (font (size 1.27 1.27))))' - ")" - ] - lib += [")"] # symbol variant - - lib += [")"] # symbol - - lib += [")"] # library - - with open(out, "w") as f: - f.write("\n".join(lib)) - - -if __name__ == "__main__": - csv2kisym( - dir_root / "references" / "xc7z020clg484pkg.txt", - dir_root / "hardware" / "zynq.kicad_sym", - name="XC7Z020-1CLG484I", - )