2021-06-22 23:40:43 +02:00
#!/usr/bin/env python3
import sys
from gdsMill import gdsMill
2021-07-12 20:01:51 +02:00
if len ( sys . argv ) < 4 :
print ( " Script to prefix every instance and structure with the root cell name to provide unique namespace, but skip cells that begin with the library prefix. " )
print ( " Usage: {0} <library prefix> in.gds out.gds " . format ( sys . argv [ 0 ] ) )
2021-06-22 23:40:43 +02:00
sys . exit ( 1 )
2021-07-12 20:01:51 +02:00
gds_file = sys . argv [ 2 ]
2021-06-23 00:53:45 +02:00
gds = gdsMill . VlsiLayout ( )
reader = gdsMill . Gds2reader ( gds )
reader . loadFromFile ( gds_file )
2021-06-22 23:40:43 +02:00
2021-07-12 20:01:51 +02:00
gds . uniquify ( prefix_name = sys . argv [ 1 ] )
2021-06-22 23:40:43 +02:00
writer = gdsMill . Gds2writer ( gds )
2021-07-12 20:01:51 +02:00
writer . writeToFile ( sys . argv [ 3 ] )