from collections import defaultdict
from skidl import Pin, Part, Alias, SchLib, SKIDL, TEMPLATE

from skidl.pin import pin_types

SKIDL_lib_version = '0.0.1'

FPGA_Efinix_Trion = SchLib(tool=SKIDL).add_parts(*[
        Part(**{ 'name':'T8Q144xx', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'T8Q144xx'}), 'ref_prefix':'U', 'fplist':['Package_QFP:LQFP-144_20x20mm_P0.5mm'], 'footprint':'Package_QFP:LQFP-144_20x20mm_P0.5mm', 'keywords':'FPGA programmable logic', 'description':'', 'datasheet':'https://www.efinixinc.com/docs/trion8-ds-v4.4.pdf', 'search_text':'/usr/share/kicad/symbols/FPGA_Efinix_Trion.kicad_sym\nT8Q144xx\n\nFPGA programmable logic', 'pins':[
            Pin(num='23',name='VCCIO1A',func=pin_types.PWRIN,unit=1),
            Pin(num='24',name='TDO',func=pin_types.OUTPUT,unit=1),
            Pin(num='25',name='TMS',func=pin_types.INPUT,unit=1),
            Pin(num='26',name='TCK',func=pin_types.INPUT,unit=1),
            Pin(num='27',name='TDI',func=pin_types.INPUT,unit=1),
            Pin(num='28',name='GPIOL_09_CDI1',func=pin_types.BIDIR,unit=1),
            Pin(num='29',name='GPIOL_08_CDI0',func=pin_types.BIDIR,unit=1),
            Pin(num='30',name='GPIOL_01_CCK',func=pin_types.BIDIR,unit=1),
            Pin(num='31',name='GPIOL_00_SS_N',func=pin_types.BIDIR,unit=1),
            Pin(num='32',name='GPIOL_04_CSI',func=pin_types.BIDIR,unit=1),
            Pin(num='33',name='GPIOL_05_CSO',func=pin_types.BIDIR,unit=1),
            Pin(num='34',name='CDONE',func=pin_types.BIDIR,unit=1),
            Pin(num='35',name='CRESET_N',func=pin_types.BIDIR,unit=1),
            Pin(num='14',name='GPIOL_25_CLK1',func=pin_types.BIDIR,unit=2),
            Pin(num='15',name='GPIOL_24_CLK0',func=pin_types.BIDIR,unit=2),
            Pin(num='16',name='GPIOL_22_CTRL2',func=pin_types.BIDIR,unit=2),
            Pin(num='17',name='GPIOL_21_CTRL1_CDI5',func=pin_types.BIDIR,unit=2),
            Pin(num='18',name='GPIOL_20_CTRL0_CDI4',func=pin_types.BIDIR,unit=2),
            Pin(num='19',name='GPIOL_13_CDI3',func=pin_types.BIDIR,unit=2),
            Pin(num='20',name='GPIOL_12_CDI2',func=pin_types.BIDIR,unit=2),
            Pin(num='21',name='VCCIO1B',func=pin_types.PWRIN,unit=2),
            Pin(num='10',name='GPIOL_32_CTRL4_CDI7',func=pin_types.BIDIR,unit=3),
            Pin(num='11',name='GPIOL_31_CLK7_CDI6',func=pin_types.BIDIR,unit=3),
            Pin(num='12',name='VCCIO1C_1D',func=pin_types.PWRIN,unit=3),
            Pin(num='3',name='GPIOL_53_CDI10',func=pin_types.BIDIR,unit=3),
            Pin(num='4',name='GPIOL_54_CDI11',func=pin_types.BIDIR,unit=3),
            Pin(num='6',name='GPIOL_46',func=pin_types.BIDIR,unit=3),
            Pin(num='7',name='GPIOL_41_CDI9',func=pin_types.BIDIR,unit=3),
            Pin(num='8',name='GPIOL_40_CDI8',func=pin_types.BIDIR,unit=3),
            Pin(num='131',name='GPIOL_75_PLLIN1',func=pin_types.BIDIR,unit=4),
            Pin(num='132',name='GPIOL_74_PLLIN0',func=pin_types.BIDIR,unit=4),
            Pin(num='134',name='GPIOL_73_EXTFB1_CDI15',func=pin_types.BIDIR,unit=4),
            Pin(num='135',name='GPIOL_72_EXTFB0_CDI14',func=pin_types.BIDIR,unit=4),
            Pin(num='136',name='GPIOL_71_NSTATUS',func=pin_types.BIDIR,unit=4),
            Pin(num='137',name='GPIOL_70_CBSEL0',func=pin_types.BIDIR,unit=4),
            Pin(num='138',name='GPIOL_69_CBSEL1',func=pin_types.BIDIR,unit=4),
            Pin(num='139',name='GPIOL_68',func=pin_types.BIDIR,unit=4),
            Pin(num='140',name='GPIOL_67_CDI13',func=pin_types.BIDIR,unit=4),
            Pin(num='141',name='GPIOL_65',func=pin_types.BIDIR,unit=4),
            Pin(num='142',name='GPIOL_66_CDI12',func=pin_types.BIDIR,unit=4),
            Pin(num='143',name='VCCIO1E',func=pin_types.PWRIN,unit=4),
            Pin(num='144',name='GPIOL_64',func=pin_types.BIDIR,unit=4),
            Pin(num='109',name='GPIOR_88_CDI28',func=pin_types.BIDIR,unit=5),
            Pin(num='110',name='GPIOR_87_CDI29',func=pin_types.BIDIR,unit=5),
            Pin(num='111',name='GPIOR_85',func=pin_types.BIDIR,unit=5),
            Pin(num='112',name='GPIOR_86',func=pin_types.BIDIR,unit=5),
            Pin(num='113',name='GPIOR_84',func=pin_types.BIDIR,unit=5),
            Pin(num='114',name='GPIOR_83',func=pin_types.BIDIR,unit=5),
            Pin(num='115',name='GPIOR_82',func=pin_types.BIDIR,unit=5),
            Pin(num='116',name='GPIOR_81_MREFCLK',func=pin_types.BIDIR,unit=5),
            Pin(num='117',name='GPIOR_80',func=pin_types.BIDIR,unit=5),
            Pin(num='118',name='GPIOR_79_EXTFB1_CDI30',func=pin_types.BIDIR,unit=5),
            Pin(num='119',name='GPIOR_78_EXTFB0_CDI31',func=pin_types.BIDIR,unit=5),
            Pin(num='122',name='VCCIO3A',func=pin_types.PWRIN,unit=5),
            Pin(num='123',name='GPIOR_77_PLLIN1',func=pin_types.BIDIR,unit=5),
            Pin(num='124',name='GPIOR_76_PLLIN0',func=pin_types.BIDIR,unit=5),
            Pin(num='100',name='GPIOR_113_CDI22',func=pin_types.BIDIR,unit=6),
            Pin(num='101',name='GPIOR_112_CDI23',func=pin_types.BIDIR,unit=6),
            Pin(num='102',name='GPIOR_105_CDI24',func=pin_types.BIDIR,unit=6),
            Pin(num='103',name='GPIOR_104_CDI25',func=pin_types.BIDIR,unit=6),
            Pin(num='105',name='GPIOR_95_CDI26',func=pin_types.BIDIR,unit=6),
            Pin(num='106',name='GPIOR_94_CDI27',func=pin_types.BIDIR,unit=6),
            Pin(num='93',name='GPIOR_123_CLK12_CDI20',func=pin_types.BIDIR,unit=6),
            Pin(num='95',name='VCCIO3B_3C',func=pin_types.PWRIN,unit=6),
            Pin(num='97',name='GPIOR_122_CLK13_CDI21',func=pin_types.BIDIR,unit=6),
            Pin(num='98',name='GPIOR_117_CTRL14',func=pin_types.BIDIR,unit=6),
            Pin(num='99',name='GPIOR_116_CTRL15',func=pin_types.BIDIR,unit=6),
            Pin(num='81',name='GPIOR_139',func=pin_types.BIDIR,unit=7),
            Pin(num='82',name='GPIOR_138',func=pin_types.BIDIR,unit=7),
            Pin(num='83',name='GPIOR_136_CDI16',func=pin_types.BIDIR,unit=7),
            Pin(num='84',name='GPIOR_135_CDI17',func=pin_types.BIDIR,unit=7),
            Pin(num='86',name='GPIOR_133_CDI18',func=pin_types.BIDIR,unit=7),
            Pin(num='87',name='GPIOR_132_CDI19',func=pin_types.BIDIR,unit=7),
            Pin(num='89',name='GPIOR_129_CTRL10',func=pin_types.BIDIR,unit=7),
            Pin(num='90',name='GPIOR_128_CTRL11',func=pin_types.BIDIR,unit=7),
            Pin(num='91',name='VCCIO3D',func=pin_types.PWRIN,unit=7),
            Pin(num='92',name='GPIOR_125_CLK10',func=pin_types.BIDIR,unit=7),
            Pin(num='74',name='GPIOR_158_TEST_N',func=pin_types.BIDIR,unit=8),
            Pin(num='75',name='GPIOR_157_PLLIN',func=pin_types.BIDIR,unit=8),
            Pin(num='76',name='GPIOR_155',func=pin_types.BIDIR,unit=8),
            Pin(num='77',name='GPIOR_154',func=pin_types.BIDIR,unit=8),
            Pin(num='78',name='GPIOR_151_CBUS0',func=pin_types.BIDIR,unit=8),
            Pin(num='79',name='GPIOR_150_CBUS1',func=pin_types.BIDIR,unit=8),
            Pin(num='80',name='GPIOR_149_CBUS2',func=pin_types.BIDIR,unit=8),
            Pin(num='88',name='VCCIO3E',func=pin_types.PWRIN,unit=8),
            Pin(num='55',name='GPIOB_RXP00',func=pin_types.BIDIR,unit=9),
            Pin(num='56',name='GPIOB_RXN00',func=pin_types.BIDIR,unit=9),
            Pin(num='58',name='GPIOB_RXP02',func=pin_types.BIDIR,unit=9),
            Pin(num='59',name='GPIOB_RXN02',func=pin_types.BIDIR,unit=9),
            Pin(num='60',name='GPIOB_RXN03',func=pin_types.BIDIR,unit=9),
            Pin(num='61',name='GPIOB_RXP03',func=pin_types.BIDIR,unit=9),
            Pin(num='62',name='VCCIO4A',func=pin_types.PWRIN,unit=9),
            Pin(num='63',name='VCCIO4A',func=pin_types.PASSIVE,unit=9),
            Pin(num='65',name='GPIOB_RXN07',func=pin_types.BIDIR,unit=9),
            Pin(num='66',name='GPIOB_RXP07',func=pin_types.BIDIR,unit=9),
            Pin(num='67',name='GPIOB_RXP10',func=pin_types.BIDIR,unit=9),
            Pin(num='68',name='GPIOB_RXN10',func=pin_types.BIDIR,unit=9),
            Pin(num='69',name='GPIOB_RXN12_EXTFB0',func=pin_types.BIDIR,unit=9),
            Pin(num='70',name='GPIOB_RXP12_EXTFB0',func=pin_types.BIDIR,unit=9),
            Pin(num='71',name='GPIOB_CLKP0',func=pin_types.BIDIR,unit=9),
            Pin(num='72',name='GPIOB_CLKN0',func=pin_types.BIDIR,unit=9),
            Pin(num='36',name='REF_RES',func=pin_types.PASSIVE,unit=10),
            Pin(num='38',name='GPIOB_TXP00',func=pin_types.BIDIR,unit=10),
            Pin(num='39',name='GPIOB_TXN00',func=pin_types.BIDIR,unit=10),
            Pin(num='40',name='GPIOB_TXP02',func=pin_types.BIDIR,unit=10),
            Pin(num='41',name='GPIOB_TXN02',func=pin_types.BIDIR,unit=10),
            Pin(num='42',name='GPIOB_TXP04',func=pin_types.BIDIR,unit=10),
            Pin(num='43',name='GPIOB_TXN04',func=pin_types.BIDIR,unit=10),
            Pin(num='45',name='GPIOB_TXP06',func=pin_types.BIDIR,unit=10),
            Pin(num='46',name='GPIOB_TXN06',func=pin_types.BIDIR,unit=10),
            Pin(num='47',name='GPIOB_TXP09',func=pin_types.BIDIR,unit=10),
            Pin(num='48',name='GPIOB_TXN09',func=pin_types.BIDIR,unit=10),
            Pin(num='51',name='VCCIO4B',func=pin_types.PWRIN,unit=10),
            Pin(num='52',name='VCCIO4B',func=pin_types.PASSIVE,unit=10),
            Pin(num='53',name='GPIOB_TXP11',func=pin_types.BIDIR,unit=10),
            Pin(num='54',name='GPIOB_TXN11',func=pin_types.BIDIR,unit=10),
            Pin(num='1',name='GND',func=pin_types.PWRIN,unit=11),
            Pin(num='104',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='107',name='VCCA_TR',func=pin_types.PWRIN,unit=11),
            Pin(num='108',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='120',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='121',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='125',name='VCC',func=pin_types.PWRIN,unit=11),
            Pin(num='126',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='127',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='128',name='VCC',func=pin_types.PWRIN,unit=11),
            Pin(num='129',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='13',name='VCC',func=pin_types.PWRIN,unit=11),
            Pin(num='130',name='VCC',func=pin_types.PWRIN,unit=11),
            Pin(num='133',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='2',name='VCCA_TL',func=pin_types.PWRIN,unit=11),
            Pin(num='22',name='VCC',func=pin_types.PWRIN,unit=11),
            Pin(num='37',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='44',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='49',name='VCC',func=pin_types.PWRIN,unit=11),
            Pin(num='5',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='50',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='57',name='VCC',func=pin_types.PWRIN,unit=11),
            Pin(num='64',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='73',name='VCCA_BR',func=pin_types.PWRIN,unit=11),
            Pin(num='85',name='VCC',func=pin_types.PWRIN,unit=11),
            Pin(num='9',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='94',name='GND',func=pin_types.PASSIVE,unit=11),
            Pin(num='96',name='VCC',func=pin_types.PWRIN,unit=11)], 'unit_defs':[{'label': 'uA', 'num': 1, 'pin_nums': ['30', '28', '24', '25', '26', '27', '33', '34', '35', '29', '31', '32', '23']},{'label': 'uB', 'num': 2, 'pin_nums': ['18', '16', '14', '20', '17', '15', '19', '21']},{'label': 'uC', 'num': 3, 'pin_nums': ['10', '12', '7', '4', '11', '6', '8', '3']},{'label': 'uD', 'num': 4, 'pin_nums': ['136', '138', '140', '134', '131', '142', '144', '135', '137', '139', '141', '143', '132']},{'label': 'uE', 'num': 5, 'pin_nums': ['109', '111', '113', '115', '117', '119', '123', '110', '112', '114', '116', '118', '122', '124']},{'label': 'uF', 'num': 6, 'pin_nums': ['100', '102', '105', '93', '97', '99', '103', '106', '95', '98', '101']},{'label': 'uG', 'num': 7, 'pin_nums': ['81', '83', '82', '84', '87', '89', '90', '91', '92', '86']},{'label': 'uH', 'num': 8, 'pin_nums': ['88', '74', '76', '78', '77', '79', '80', '75']},{'label': 'uI', 'num': 9, 'pin_nums': ['56', '61', '66', '59', '63', '68', '70', '72', '55', '60', '58', '62', '65', '67', '69', '71']},{'label': 'uJ', 'num': 10, 'pin_nums': ['38', '42', '45', '47', '40', '51', '53', '36', '41', '39', '43', '46', '48', '52', '54']},{'label': 'uK', 'num': 11, 'pin_nums': ['2', '104', '125', '37', '127', '22', '73', '9', '1', '44', '85', '129', '128', '94', '5', '108', '107', '49', '120', '13', '50', '96', '133', '121', '130', '64', '57', '126']}] })])