| # Convert VNB and VPB layers in a LEF file from "li1" or "met1" to |
| # "pwell" and "nwell" masterslice layers, as they should be. |
| print("Usage: vpb_vnb_convert.py <lef_file_in> <lef_file_out>") |
| lef_file_in = sys.argv[1] |
| lef_file_out = sys.argv[2] |
| print("Input: " + lef_file_in) |
| print("Output: " + lef_file_out) |
| with open(lef_file_in, 'r') as ifile: |
| leflines = ifile.read().splitlines() |
| layrex = re.compile('[ \t]*LAYER[ \t]+([^ \t]+)[ \t]+;') |
| pinrex = re.compile('[ \t]*PIN[ \t]+([^ \t\n]+)') |
| endrex = re.compile('[ \t]*END[ \t]+([^ \t\n]+)') |
| subrex = re.compile('([ \t]*LAYER[ \t]+)([^ \t]+)([ \t]+;)') |
| lmatch = layrex.match(line) |
| pmatch = pinrex.match(line) |
| ematch = endrex.match(line) |
| pinname = pmatch.group(1) |
| lineout = subrex.sub(r'\1nwell\3', line) |
| lineout = subrex.sub(r'\1pwell\3', line) |
| with open(lef_file_out, 'w') as ofile: |