2022-03-31 00:02:14 -07:00
|
|
|
"""
|
|
|
|
Example code for checking connectivity in a layout by using
|
2022-03-31 00:43:54 -07:00
|
|
|
`snarled` and `masque`.
|
2022-03-31 00:02:14 -07:00
|
|
|
"""
|
2022-03-29 21:23:27 -07:00
|
|
|
from pprint import pformat
|
|
|
|
|
2022-03-27 23:43:52 -07:00
|
|
|
from masque.file import gdsii, oasis
|
|
|
|
|
2022-03-31 00:43:54 -07:00
|
|
|
import snarled
|
|
|
|
import snarled.interfaces.masque
|
2022-03-27 23:43:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
connectivity = {
|
|
|
|
((1, 0), (1, 2), (2, 0)), #M1 to M2 (via V12)
|
|
|
|
((1, 0), (1, 3), (3, 0)), #M1 to M3 (via V13)
|
|
|
|
((2, 0), (2, 3), (3, 0)), #M2 to M3 (via V23)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#cells, props = gdsii.readfile('connectivity.gds')
|
|
|
|
cells, props = oasis.readfile('connectivity.oas')
|
|
|
|
topcell = cells['top']
|
|
|
|
|
2022-03-31 00:43:54 -07:00
|
|
|
polys, labels = snarled.interfaces.masque.read_cell(topcell, connectivity)
|
|
|
|
nets_info = snarled.trace_connectivity(polys, labels, connectivity)
|
2022-03-27 23:43:52 -07:00
|
|
|
|
2022-03-29 21:23:27 -07:00
|
|
|
print('\nFinal nets:')
|
2022-03-31 00:02:14 -07:00
|
|
|
print([kk for kk in sorted(nets_info.nets.keys()) if isinstance(kk.name, str)])
|
2022-03-29 21:23:27 -07:00
|
|
|
|
|
|
|
print('\nShorted net sets:')
|
|
|
|
for short in nets_info.get_shorted_nets():
|
|
|
|
print('(' + ','.join([repr(nn) for nn in sorted(list(short))]) + ')')
|
|
|
|
|
|
|
|
print('\nOpen nets:')
|
|
|
|
print(pformat(dict(nets_info.get_open_nets())))
|