mibuild: support pin names in IO extensions

This commit is contained in:
Yann Sionneau 2015-02-18 08:32:15 -07:00 committed by Sebastien Bourdeauducq
parent 452c60e0c3
commit cea1551ae0

View file

@ -68,10 +68,16 @@ class ConnectorManager:
for connector in connectors: for connector in connectors:
cit = iter(connector) cit = iter(connector)
conn_name = next(cit) conn_name = next(cit)
if isinstance(connector[1], str):
pin_list = [] pin_list = []
for pins in cit: for pins in cit:
pin_list += pins.split() pin_list += pins.split()
pin_list = [None if pin == "None" else pin for pin in pin_list] pin_list = [None if pin == "None" else pin for pin in pin_list]
elif isinstance(connector[1], dict):
pin_list = connector[1]
else:
raise ValueError("Unsupported pin list type {} for connector"
" {}".format(type(connector[1]), conn_name))
if conn_name in self.connector_table: if conn_name in self.connector_table:
raise ValueError("Connector specified more than once: "+conn_name) raise ValueError("Connector specified more than once: "+conn_name)
self.connector_table[conn_name] = pin_list self.connector_table[conn_name] = pin_list
@ -81,6 +87,7 @@ class ConnectorManager:
for identifier in identifiers: for identifier in identifiers:
if ":" in identifier: if ":" in identifier:
conn, pn = identifier.split(":") conn, pn = identifier.split(":")
if pn.isdigit():
pn = int(pn) pn = int(pn)
r.append(self.connector_table[conn][pn]) r.append(self.connector_table[conn][pn])
else: else: