Moving wide metal spacing to routing grid level

This commit is contained in:
Matt Guthaus
2018-10-15 09:59:16 -07:00
parent 1c426aad29
commit d855d4f1a6
4 changed files with 49 additions and 32 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ class design_rules():
def __call__(self, name, *args):
rule = self.rules[name]
if callable(rule):
return rule(args)
return rule(*args)
else:
return rule
+14 -9
View File
@@ -1,3 +1,4 @@
import debug
class drc_lut():
"""
@@ -6,8 +7,8 @@ class drc_lut():
It searches through backwards until all of the key values are
met and returns the rule value.
For exampe, the key values can be width and length,
and it would return the rule for a wire of a given width and length.
A key can be not compared by passing a None.
and it would return the rule for a wire of at least a given width and length.
A dimension can be ignored by passing inf.
"""
def __init__(self, table):
self.table = table
@@ -16,20 +17,24 @@ class drc_lut():
"""
Lookup a given tuple in the table.
"""
if len(*key)==0:
key_size = len(list(self.table.keys())[0])
key = tuple(0 for i in range(key_size))
if len(key)==0:
first_key = list(sorted(self.table.keys()))[0]
return self.table[first_key]
for table_key in sorted(self.table.keys(), reverse=True):
if self.match(key, table_key):
return self.table[table_key]
def match(self, t1, t2):
def match(self, key1, key2):
"""
Determine if t1>t2 for each tuple pair.
Determine if key1>=key2 for all tuple pairs.
(i.e. return false if key1<key2 for any pair.)
"""
# If any one pair is less than, return False
for i in range(len(t1)):
if t1[i] < t2[i]:
debug.check(len(key1)==len(key2),"Comparing invalid key lengths.")
for k1,k2 in zip(key1,key2):
if k1 < k2:
return False
return True