kicad-pinout-generator icon indicating copy to clipboard operation
kicad-pinout-generator copied to clipboard

Sorted xdc by net name

Open 404manu404 opened this issue 1 year ago • 0 comments

Hello, This is a really great tool and safes us a lot of time. Thank you for uploading this! This comment is not an issue... It would be nice, if the function "xdc_format(self, component)" in pinout_plugin.py would create the output sorted by net name and not by pin name/number. Because of that I have made some changes in this function:


_def xdc_format(self, component):
    added_vars = []
    output = "## Pinout generated for "+component.GetReference()+" ("+component.GetValue()+")\n"
    pinout = get_pins(component)
    mylist = []                         
    for pad in pinout:
        myliststr = ""        
        var_name = str_to_C_variable(pad.GetNetname())
        myliststr += var_name + "ä"        #  ä=delimiter
        if var_name in added_vars or not pad_is_connected(pad) or pad_is_power(pad) or pad_is_passive(pad):
            myliststr += "# "
        else:
            added_vars.append(var_name)
        myliststr += "set_property -dict { PACKAGE_PIN "+pad.GetNumber()+"    IOSTANDARD LVCMOS33 } [get_ports { "+var_name+" }];\n"  
        mylist.append(myliststr) 

    #sort alphabetical
    mylist = sorted(mylist)               
    for i in range(len(mylist)):         
        output += mylist[i].split("ä")[1]
    return output

Sorry, i'm python newbie and I do not know how to solve it better.

Regards

404manu404 avatar Jun 27 '23 13:06 404manu404