Skip to content

Commit

Permalink
Modified sky130.tech magic techfile to add nwell and pwell as
Browse files Browse the repository at this point in the history
masterslice layers to the LEF input setup;  this should resolve
issues with the VNB and VPB pins in standard cells.  Along with
that, committed a script to correct the layers assigned to VNB
and VPB in the original sources.
  • Loading branch information
RTimothyEdwards committed Jul 15, 2020
1 parent d9fe000 commit 282d954
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.8
1.0.9
64 changes: 64 additions & 0 deletions sky130/custom/scripts/vpb_vnb_convert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env python3
#
# Convert VNB and VPB layers in a LEF file from "li1" or "met1" to
# "pwell" and "nwell" masterslice layers, as they should be.
#

import os
import sys
import re

if len(sys.argv) < 3:
print("Usage: vpb_vnb_convert.py <lef_file_in> <lef_file_out>")
sys.exit(1)

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]+;)')

vpbpin = False
vnbpin = False

linesout = []

for line in leflines:
lineout = line

lmatch = layrex.match(line)
pmatch = pinrex.match(line)
ematch = endrex.match(line)

if pmatch:
pinname = pmatch.group(1)

if pinname == 'VNB':
vnbpin = True
elif pinname == 'VPB':
vpbpin = True

elif ematch:
pinname = ''
vnbpin = False
vpbpin = False

elif lmatch:
if vpbpin:
lineout = subrex.sub(r'\1nwell\3', line)
elif vnbpin:
lineout = subrex.sub(r'\1pwell\3', line)

linesout.append(lineout)

with open(lef_file_out, 'w') as ofile:
for line in linesout:
print(line, file=ofile)
5 changes: 2 additions & 3 deletions sky130/magic/sky130.tech
Original file line number Diff line number Diff line change
Expand Up @@ -3446,9 +3446,8 @@ end

lef

masterslice pwell substrate
masterslice nwell nwell
masterslice poly poly
masterslice pwell pwell PWELL substrate
masterslice nwell nwell NWELL

routing li li1 LI1 LI li

Expand Down

0 comments on commit 282d954

Please sign in to comment.