Skip to content
Snippets Groups Projects
Commit ca08584a authored by David Lanzendörfer's avatar David Lanzendörfer
Browse files

Cleanup + helper functions

Removing redundant code from Danube River, moving it into a LibrePDK
helper function and removing redundancies within LibrePDK
parent d4e591cc
No related branches found
No related tags found
No related merge requests found
......@@ -4,10 +4,37 @@ from gdsfactory.components.compass import compass
from librepdk.structure import LibrePDKStructure
import librepdk.helper as lph
class ViaStripe(LibrePDKStructure):
device_layers = ['nwell','ndiffusion','pdiffusion', 'poly', 'pwell',]
min_row_vias = 1
min_vias = 1
device_layers = ['nwell','ndiffusion','pdiffusion', 'poly', 'pwell',]
def get_biggest_via(config, from_layer, conlayer_name):
if from_layer in device_layers:
origlayer = 1
else:
origlayer = int(from_layer.replace("metal","").strip())
# what's the highest metal layer number?
toplayer = int(conlayer_name.replace("metal","").strip())
maxdim = 0
spacing = 0
for lidx in range(origlayer, toplayer):
vln = "via"+str(lidx)
vdim = config.get_via_size(vln)
space = config.get_min_spacing((vln,vln))
# find spacing of largest via layer
if vdim > maxdim:
maxdim = vdim
spacing = space
return maxdim, spacing
def get_min_viagroup_pad_size(config, from_layer, conlayer_name):
maxdim, spacing = get_biggest_via(config, from_layer, conlayer_name)
return min_vias*(maxdim+spacing)
class ViaStripe(LibrePDKStructure):
def __init__(self, config, name, from_layer, w, h, conlayer_name, less_vias=False):
LibrePDKStructure.__init__(self, config, name)
# the layers:
......@@ -21,7 +48,7 @@ class ViaStripe(LibrePDKStructure):
viastackup = []
metalstackup = []
if self.from_layer in self.device_layers:
if self.from_layer in device_layers:
origlayer = 1
metalstackup.append(self.from_layer)
else:
......@@ -46,8 +73,7 @@ class ViaStripe(LibrePDKStructure):
# the interconnects
via = gf.Component(self.name+"_single_via")
maxdim = 0
spacing = 0
maxdim, spacing = get_biggest_via(self.config, self.from_layer, self.conlayer_name)
for vln in viastackup:
vlid = self.config.get_layer_id(vln)
......@@ -66,14 +92,14 @@ class ViaStripe(LibrePDKStructure):
col = w/(spacing+maxdim)
col = int(col)
if col < self.min_row_vias:
col = self.min_row_vias
if col < min_vias:
col = min_vias
row = h/(spacing+maxdim)
row = int(row)
if row < self.min_row_vias:
row = self.min_row_vias
if row < min_vias:
row = min_vias
if (maxdim+spacing)*col < w and not self.less_vias:
col += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment