Modified sky130 Makefile to remove a blockage to parallelism that
was preventing the Makefile from building the different PDK vendor
libraries in parallel. Also: Made some revisions to the project
manager (work in progress). Includes breaking out the python
"natural sort" routine into its own file, and not relying on the
"natsort" package, which is generally not included with python3
distributions and needs to be pip installed.
diff --git a/common/create_gds_library.py b/common/create_gds_library.py
index 2dfa111..32d1636 100755
--- a/common/create_gds_library.py
+++ b/common/create_gds_library.py
@@ -14,7 +14,7 @@
import glob
import fnmatch
import subprocess
-from sort_pdkfiles import natural_sort
+import natural_sort
#----------------------------------------------------------------------------
@@ -57,7 +57,7 @@
glist = glob.glob(destlibdir + '/*.gds')
glist.extend(glob.glob(destlibdir + '/*.gdsii'))
glist.extend(glob.glob(destlibdir + '/*.gds2'))
- glist = natural_sort(glist)
+ glist = natural_sort.natural_sort(glist)
if alllibname in glist:
glist.remove(alllibname)
diff --git a/common/create_lef_library.py b/common/create_lef_library.py
index 6c9899c..3834296 100755
--- a/common/create_lef_library.py
+++ b/common/create_lef_library.py
@@ -13,7 +13,7 @@
import os
import glob
import fnmatch
-from sort_pdkfiles import natural_sort
+import natural_sort
#----------------------------------------------------------------------------
@@ -54,7 +54,7 @@
llist.append(destlibdir + '/' + rfile)
else:
llist = glob.glob(destlibdir + '/*.lef')
- llist = natural_sort(llist)
+ llist = natural_sort.natural_sort(llist)
if alllibname in llist:
llist.remove(alllibname)
diff --git a/common/create_lib_library.py b/common/create_lib_library.py
index ccb58bf..6fbef49 100755
--- a/common/create_lib_library.py
+++ b/common/create_lib_library.py
@@ -13,7 +13,7 @@
import os
import glob
import fnmatch
-from sort_pdkfiles import natural_sort
+import natural_sort
#----------------------------------------------------------------------------
@@ -61,7 +61,7 @@
llist.append(destlibdir + '/' + rfile)
else:
llist = glob.glob(destlibdir + '/*.lib')
- llist = natural_sort(llist)
+ llist = natural_sort.natural_sort(llist)
# Create exclude list with glob-style matching using fnmatch
if len(llist) > 0:
diff --git a/common/create_spice_library.py b/common/create_spice_library.py
index df2f197..d26eddb 100755
--- a/common/create_spice_library.py
+++ b/common/create_spice_library.py
@@ -14,7 +14,7 @@
import re
import glob
import fnmatch
-from sort_pdkfiles import natural_sort
+import natural_sort
#----------------------------------------------------------------------------
@@ -74,7 +74,7 @@
slist.extend(glob.glob(destlibdir + '/*.ckt'))
slist.extend(glob.glob(destlibdir + '/*.cir'))
slist.extend(glob.glob(destlibdir + '/*' + spiext))
- slist = natural_sort(slist)
+ slist = natural_sort.natural_sort(slist)
if alllibname in slist:
slist.remove(alllibname)
diff --git a/common/create_verilog_library.py b/common/create_verilog_library.py
index e1bc4af..baa6624 100755
--- a/common/create_verilog_library.py
+++ b/common/create_verilog_library.py
@@ -14,7 +14,7 @@
import re
import glob
import fnmatch
-from sort_pdkfiles import natural_sort
+import natural_sort
#----------------------------------------------------------------------------
@@ -57,7 +57,7 @@
vlist.append(destlibdir + '/' + rfile)
else:
vlist = glob.glob(destlibdir + '/*.v')
- vlist = natural_sort(vlist)
+ vlist = natural_sort.natural_sort(vlist)
if alllibname in vlist:
vlist.remove(alllibname)
diff --git a/common/foundry_install.py b/common/foundry_install.py
index 68a02da..e27009c 100755
--- a/common/foundry_install.py
+++ b/common/foundry_install.py
@@ -179,12 +179,12 @@
import subprocess
# Import local routines
+import natural_sort
from create_gds_library import create_gds_library
from create_spice_library import create_spice_library
from create_lef_library import create_lef_library
from create_lib_library import create_lib_library
from create_verilog_library import create_verilog_library
-from sort_pdkfiles import natural_sort
def usage():
print("foundry_install.py [options...]")
@@ -896,7 +896,7 @@
testpath = substitute(sourcedir + '/' + option[1], library[1])
liblist = glob.glob(testpath)
- liblist = natural_sort(liblist)
+ liblist = natural_sort.natural_sort(liblist)
# Create a file "sources.txt" (or append to it if it exists)
# and add the source directory name so that the staging install
@@ -1927,7 +1927,7 @@
# in it.
try:
cdlfiles = glob.glob(cdllibdir + '/*.cdl')
- cdlfiles = natural_sort(cdlfiles)
+ cdlfiles = natural_sort.natural_sort(cdlfiles)
except:
pass
if len(cdlfiles) > 0:
@@ -2154,12 +2154,12 @@
glist = glob.glob(srclibdir + '/*.gds')
glist.extend(glob.glob(srclibdir + '/*.gdsii'))
glist.extend(glob.glob(srclibdir + '/*.gds2'))
- glist = natural_sort(glist)
+ glist = natural_sort.natural_sort(glist)
allleflibname = leflibdir + '/' + destlib + '.lef'
if not os.path.isfile(allleflibname):
llist = glob.glob(leflibdir + '/*.lef')
- llist = natural_sort(llist)
+ llist = natural_sort.natural_sort(llist)
print('Creating magic generation script to generate SPICE library.')
with open(destlibdir + '/generate_magic.tcl', 'w') as ofile:
diff --git a/common/natural_sort.py b/common/natural_sort.py
new file mode 100755
index 0000000..7ad1e8c
--- /dev/null
+++ b/common/natural_sort.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python3
+#
+# natural_sort.py
+# Natural sort thanks to Mark Byers in StackOverflow
+
+import re
+
+def natural_sort(l):
+ convert = lambda text: int(text) if text.isdigit() else text.lower()
+ alphanum_key= lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
+ return sorted(l, key = alphanum_key)
diff --git a/common/sort_pdkfiles.py b/common/sort_pdkfiles.py
index ac0a107..9dc5492 100755
--- a/common/sort_pdkfiles.py
+++ b/common/sort_pdkfiles.py
@@ -14,12 +14,7 @@
import re
import os
import sys
-
-# Natural sort thanks to Mark Byers in StackOverflow
-def natural_sort(l):
- convert = lambda text: int(text) if text.isdigit() else text.lower()
- alphanum_key= lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
- return sorted(l, key = alphanum_key)
+import natural_sort
def pdk_sort(destdir):
if not os.path.isfile(destdir + '/filelist.txt'):
@@ -29,7 +24,7 @@
with open(destdir + '/filelist.txt', 'r') as ifile:
vlist = ifile.read().splitlines()
- vlist = natural_sort(vlist)
+ vlist = natural_sort.natural_sort(vlist)
with open(destdir + '/filelist.txt', 'w') as ofile:
for vfile in vlist: