Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions common/cdl2spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import re
import textwrap

# Convert linear scale to area scale suffix
# Convert linear scale to area scale suffix
# (e.g., if linear scale is 1e-6 ('u') then area scales as 1e-12 ('p'))

def getAreaScale(dscale):
Expand Down Expand Up @@ -724,7 +724,7 @@ def cdl2spice(fnmIn, fnmOut, options):
# terminal diodes.
# CDL-std does not define $[...] as available for diodes, so we silently ignore
# it.
# Always 2 terminals and a modelName.
# Always 2 terminals and a modelName.
# We already have peri=... and area=... and have ambiguity with plain numerics.
# TODO: generate a warning in case of ambiguity, but prefer plain numerics
# (with nm= added).
Expand Down Expand Up @@ -812,7 +812,7 @@ def cdl2spice(fnmIn, fnmOut, options):

# res formats:
# rname n1 n2 <numeric> $SUB=t3 $[model] $w=... $l=... m=...
# c:rname n1 n2 R=<numeric> $[model] w=... l=... m=... $SUB=t3
# c:rname n1 n2 R=<numeric> $[model] w=... l=... m=... $SUB=t3
# l:rname n1 n2 {<numeric>} {$SUB=t3} {$[model]} {$w=...} {$l=...} {m=...}
# (all after n1,n2 optional)
# We require $[model]. And add 3rd term IFF $SUB=.
Expand All @@ -839,7 +839,7 @@ def cdl2spice(fnmIn, fnmOut, options):

# bipolar formats:
# qname n1 n2 n3 model <numeric> M=... $EA=...
# qname n1 n2 n3 model $EA=... <numeric> M=...
# qname n1 n2 n3 model $EA=... <numeric> M=...
# qname n1 n2 n3 model {$EA=...} {$W=...} {$L=...} {$SUB=...} {M=...}
# No: l:qname n1 n2 n3 {nsub} model {$EA=...} {$W=...} {$L=...} {$SUB=...} {M=...}
# CDL-std adds {nsub} way to add substrate before model: We don't support it.
Expand Down Expand Up @@ -868,7 +868,7 @@ def cdl2spice(fnmIn, fnmOut, options):
tmp += [ " ".join(tok) ]
continue

# Anything else. What to do, preserve AS-IS with warning, or
# Anything else. What to do, preserve AS-IS with warning, or
# flag them as ERRORs?
tmp += [ "*cdl2spi.py: ERROR: unrecognized line:", i ]
err+=1
Expand Down
6 changes: 3 additions & 3 deletions common/compare_dirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def compare_dirs(path, styles, formats, debug):
d6 = []
d6e = list(item for item in d6 if os.path.splitext(item)[1] == '.v')
d6r = list(os.path.splitext(os.path.splitext(item)[0])[0] for item in d6e)

d1r.sort()
d2r.sort()
d3r.sort()
Expand Down Expand Up @@ -132,7 +132,7 @@ def compare_dirs(path, styles, formats, debug):
d_all.sort()
d_complete.sort()
d_notall.sort()

if debug:
print('Selected styles option: ' + ','.join(styles))
print('Selected formats option: ' + ','.join(formats))
Expand Down Expand Up @@ -262,7 +262,7 @@ def compare_dirs(path, styles, formats, debug):
print('Cells appearing in maglef/ but not in verilog/:')
for cell in d5_6:
print(cell)

if do_verilog:
print('')
if do_cdl and len(d6_1) > 0:
Expand Down
8 changes: 4 additions & 4 deletions common/create_gds_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def create_gds_library(destlibdir, destlib, startup_script, do_compile_only=Fals
os.symlink(startup_script, destlibdir + '/.magicrc')

# A GDS library is binary and requires handling in Magic
print('Creating magic generation script to generate GDS library.')
print('Creating magic generation script to generate GDS library.')
with open(destlibdir + '/generate_magic.tcl', 'w') as ofile:
print('#!/usr/bin/env wish', file=ofile)
print('#--------------------------------------------', file=ofile)
Expand All @@ -106,9 +106,9 @@ def create_gds_library(destlibdir, destlib, startup_script, do_compile_only=Fals
gdsroot = os.path.split(gdsfile)[1]
gdsname = os.path.splitext(gdsroot)[0]
print('getcell ' + gdsname, file=ofile)
# Could properly make space for the cell here. . .
# Could properly make space for the cell here. . .
print('box move e 200', file=ofile)

print('puts stdout "Writing GDS library ' + destlibroot + '"', file=ofile)
print('gds library true', file=ofile)
print('gds write ' + destlibroot, file=ofile)
Expand Down Expand Up @@ -188,7 +188,7 @@ def create_gds_library(destlibdir, destlib, startup_script, do_compile_only=Fals
else:
argumentlist.append(option)

if len(argumentlist) < 3:
if len(argumentlist) < 3:
print("Not enough arguments given to create_gds_library.py.")
usage()
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion common/create_lef_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def create_lef_library(destlibdir, destlib, do_compile_only=False, excludelist=[
else:
argumentlist.append(option)

if len(argumentlist) < 2:
if len(argumentlist) < 2:
print("Not enough arguments given to create_lef_library.py.")
usage()
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion common/create_lib_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def create_lib_library(destlibdir, destlib, do_compile_only=False, excludelist=[
else:
argumentlist.append(option)

if len(argumentlist) < 3:
if len(argumentlist) < 3:
print("Not enough arguments given to create_lib_library.py.")
usage()
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion common/create_spice_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def remove_redundant_subckts(ntext, slist, sseen):
else:
argumentlist.append(option)

if len(argumentlist) < 3:
if len(argumentlist) < 3:
print("Not enough arguments given to create_spice_library.py.")
usage()
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion common/create_verilog_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def remove_redundant_modules(ntext, mlist, m2list):
else:
argumentlist.append(option)

if len(argumentlist) < 3:
if len(argumentlist) < 3:
print("Not enough arguments given to create_verilog_library.py.")
usage()
sys.exit(1)
Expand Down
6 changes: 3 additions & 3 deletions common/find_all_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#-----------------------------------------------------------

import re
import os
import os
import sys

#-----------------------------------------------------------
Expand Down Expand Up @@ -329,7 +329,7 @@ def do_find_all_devices(pathtop, sourcefile, cellname=None, feol='tt', beol='tt'
print('Something went dreadfully wrong with device "' + devname + '"')

isdev = False

smatch = devrex.match(line)
if smatch:
instname = smatch.group(1)
Expand Down Expand Up @@ -470,7 +470,7 @@ def do_find_all_devices(pathtop, sourcefile, cellname=None, feol='tt', beol='tt'
# Defaults: Set up for the most recent PDK version.
version = 'v0.20.1'
pathtop = '../../libraries/sky130_fd_pr/' + version

# Default FEOL corner is "tt", and default BEOL corner is "tt"
feol = 'tt'
beol = 'tt'
Expand Down
4 changes: 2 additions & 2 deletions common/fix_subckt_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def convert_file(in_file, out_path, params, debug):
if inpinlist:
spicelines.append(line)
continue

else:
ematch = endsubrex.match(line)
if ematch:
Expand Down Expand Up @@ -262,7 +262,7 @@ def convert_file(in_file, out_path, params, debug):
if not os.path.isfile(inpath):
print('Input path ' + inpath + ' is not a file.')
sys.exit(1)

convert_file(inpath, outpath, params, debug)

print('Done.')
Expand Down
6 changes: 3 additions & 3 deletions common/fixspice.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def filter(inname, outname, debug=False):
# Regular expression to find 'agauss(a,b,c)' lines and record a, b, and c
grex = re.compile('[^{]agauss\(([^,]*),([^,]*),([^)]*)\)', re.IGNORECASE)

# Regular expression to determine if the line is a .PARAM card
# Regular expression to determine if the line is a .PARAM card
paramrex = re.compile('^\.param', re.IGNORECASE)
# Regular expression to determine if the line is a .MODEL card
# Regular expression to determine if the line is a .MODEL card
modelrex = re.compile('^\.model', re.IGNORECASE)
# Regular expression to detect a .SUBCKT card
subcktrex = re.compile('^\.subckt', re.IGNORECASE)
Expand Down Expand Up @@ -150,7 +150,7 @@ def filter(inname, outname, debug=False):
fixedline = altered
if debug:
print('Changed version 4.3/4.5 ' + modeltype + ' to version 4.8.0')

# Fix: Look for mulu0= (NOTE: Might be supported for bsim4?)
altered = re.sub('mulu0[ ]*=[ ]*[0-9.e+-]*', '', fixedline, flags=re.IGNORECASE)
if altered != fixedline:
Expand Down
34 changes: 17 additions & 17 deletions common/foundry_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
print("No options given to foundry_install.py.")
usage()
sys.exit(0)

optionlist = []
newopt = []

Expand Down Expand Up @@ -446,7 +446,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
for option in optionlist[:]:
if option[0] == 'library':
optionlist.remove(option)
libraries.append(option[1:])
libraries.append(option[1:])

# Check for option "ef_format" or "std_format" or "clean"
for option in optionlist[:]:
Expand Down Expand Up @@ -560,7 +560,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
print('Magic database files will not be created, and other missing file formats may not be generated.')

# Populate any targets that do not specify a library, or where the library is
# specified as "primitive".
# specified as "primitive".

# Populate the techLEF and SPICE models, if specified. Also, this section can add
# to any directory in libs.tech/ as given by the option; e.g., "-ngspice" will
Expand All @@ -580,7 +580,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
if len(libraries) > 0 and 'primitive' in libraries[0]:
if option[0] != 'techlef' and option[0] != 'techLEF' and option[0] != 'models':
continue

# Normally technology LEF files are associated with IP libraries.
# However, if no library is specified or the library is 'primitive'
# (legacy behavior), then put in the techLEF directory with no subdirectory.
Expand Down Expand Up @@ -649,7 +649,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
if os.path.isdir(targname):
shutil.rmtree(targname)
os.makedirs(targname)

# Recursively find and copy or link the whole directory
# tree from this point.

Expand Down Expand Up @@ -764,7 +764,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
# Option 'compile' is a standalone keyword ('comp' may be used).
do_compile = 'compile' in option or 'comp' in option
do_compile_only = 'compile-only' in option or 'comp-only' in option

# Option 'nospecify' is a standalone keyword ('nospec' may be used).
do_remove_spec = 'nospecify' in option or 'nospec' in option

Expand Down Expand Up @@ -901,7 +901,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):

destfilelist = []
for libname in liblist:

# Note that there may be a hierarchy to the files in option[1],
# say for liberty timing files under different conditions, so
# make sure directories have been created as needed.
Expand Down Expand Up @@ -1020,7 +1020,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
# library into a compiled <destlib>.<ext> on another pass.

compname = destlib

# To do: Make this compatible with linking from another PDK.

if option[0] == 'verilog':
Expand Down Expand Up @@ -1084,7 +1084,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
targrename = destlibdir + destpath + '/' + newname
if os.path.isfile(origname):
os.rename(origname, targrename)

# If "filelist.txt" was created, remove it
if sortscript:
if os.path.isfile(destlibdir + '/filelist.txt'):
Expand Down Expand Up @@ -1236,7 +1236,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
if item.split('=')[0] == 'lefopts':
if option[0] == 'lef':
lefopts = item.split('=')[1].strip('"')

devlist = []
pdklibrary = None

Expand Down Expand Up @@ -1330,7 +1330,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
if os.path.isfile(destlibdir + '/.magicrc'):
os.remove(destlibdir + '/.magicrc')
os.symlink(startup_script, destlibdir + '/.magicrc')

# Find GDS file names in the source
print('Getting GDS file list from ' + srclibdir + '.')
gdsfilesraw = os.listdir(srclibdir)
Expand All @@ -1357,7 +1357,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
# the target directory. Use it as input to magic to create the
# .mag files from the database.

print('Creating magic generation script to generate magic database files.')
print('Creating magic generation script to generate magic database files.')
with open(destlibdir + '/generate_magic.tcl', 'w') as ofile:
print('#!/usr/bin/env wish', file=ofile)
print('#--------------------------------------------', file=ofile)
Expand Down Expand Up @@ -1427,7 +1427,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
print('puts stdout "Annotating cells from LEF"', file=ofile)
for leffile in leffiles:
print('lef read ' + lefsrclibdir + '/' + leffile, file=ofile)

# Use CDL or SPICE netlists to set the port order
if have_cdl or have_spice:
if have_cdl:
Expand Down Expand Up @@ -1595,7 +1595,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
# write procedure, but we still need the pin use and class
# information from the LEF file, and maybe the bounding box.


# For annotation, the LEF file output will overwrite the
# original source LEF file.
lefdest = lefsrclibdir + '/' if have_lefanno else ''
Expand Down Expand Up @@ -1702,7 +1702,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
if os.path.isfile(destlibdir + '/.magicrc'):
os.remove(destlibdir + '/.magicrc')
os.symlink(startup_script, destlibdir + '/.magicrc')

# Find LEF file names in the source
leffiles = []
if os.path.isdir(srclibdir):
Expand Down Expand Up @@ -1971,7 +1971,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
print("PDK tech files before PDK vendor files?")

# If SPICE or CDL databases were specified, then convert them to
# a form that can be used by ngspice, using the cdl2spi.py script
# a form that can be used by ngspice, using the cdl2spi.py script

if have_spice:
if ef_format:
Expand Down Expand Up @@ -2110,7 +2110,7 @@ def tfilter(targetroot, filterscript, ef_format=False, outfile=[]):
if not os.path.isfile(allleflibname):
llist = glob.glob(leflibdir + '/*.lef')

print('Creating magic generation script to generate SPICE library.')
print('Creating magic generation script to generate SPICE library.')
with open(destlibdir + '/generate_magic.tcl', 'w') as ofile:
print('#!/usr/bin/env wish', file=ofile)
print('#---------------------------------------------', file=ofile)
Expand Down
2 changes: 1 addition & 1 deletion common/get_gds_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def usage():
if debug:
print('Record type = ' + str(rectype) + ' data type = ' + str(datatype) + ' length = ' + str(reclen))

if created:
if created:
crec1 = gdsdata[dataptr + 4:dataptr + 6]
crec2 = gdsdata[dataptr + 6:dataptr + 8]
crec3 = gdsdata[dataptr + 8:dataptr + 10]
Expand Down
4 changes: 2 additions & 2 deletions common/insert_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# The property is added to the layout in both the mag/ (full) and maglef/
# (abstract) directories. Option "-maglef" or "-mag" will restrict the
# use to only the view indicated by the option.
#
#
# e.g.:
#
# insert_property.py /path/to/sky130A \
Expand All @@ -19,7 +19,7 @@

def addprop(filename, propstring, noupdate):
with open(filename, 'r') as ifile:
magtext = ifile.read().splitlines()
magtext = ifile.read().splitlines()

propname = propstring.split()[0]
proprex = re.compile('<< properties >>')
Expand Down
Loading