Skip to content

Commit

Permalink
update to latest gdsfactory
Browse files Browse the repository at this point in the history
  • Loading branch information
joamatab committed May 4, 2024
1 parent 1106a07 commit d950e33
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 53 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.7"
rev: "v0.4.1"
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format

- repo: https://github.com/shellcheck-py/shellcheck-py
Expand Down
59 changes: 28 additions & 31 deletions gf180/via_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ def via_generator(
"""
return only vias withen the range xrange and yrange while enclosing by via_enclosure
and set number of rows and number of columns according to ranges and via size and spacing
Args:
x_range: x range.
y_range: y range.
via_size: via size.
via_layer: via layer.
via_enclosure: via enclosure.
via_spacing: via spacing.
"""
c = gf.Component()

Expand All @@ -27,19 +35,15 @@ def via_generator(
if (length - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2 < via_enclosure[1]:
nr -= 1

if nr < 1:
nr = 1

nr = max(nr, 1)
nc = ceil(width / (via_size[0] + via_spacing[0]))

if (
round(width - nc * via_size[0] - (nc - 1) * via_spacing[0], 2)
) / 2 < via_enclosure[0]:
nc -= 1

if nc < 1:
nc = 1

nc = max(nc, 1)
via_sp = (via_size[0] + via_spacing[0], via_size[1] + via_spacing[1])

rect_via = gf.components.rectangle(size=via_size, layer=via_layer)
Expand All @@ -50,28 +54,36 @@ def via_generator(

via_arr.movex((width - nc * via_size[0] - (nc - 1) * via_spacing[0]) / 2)
via_arr.movey((length - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2)

return c


@gf.cell
def via_stack(
x_range: Float2 = (0, 1),
y_range: Float2 = (0, 1),
base_layer: LayerSpec = layer["comp"],
slotted_licon: int = 0,
metal_level: int = 1,
li_enc_dir="V",
con_size=(0.22, 0.22),
con_enc=0.07,
m_enc=0.06,
con_spacing=(0.28, 0.28),
via_size=(0.22, 0.22),
via_spacing=(0.28, 0.28),
via_enc=(0.06, 0.06),
) -> gf.Component:
"""Returns a via stack withen the range xrange and yrange and expecting the base_layer to be drawen
Args:
x_range (Float2, optional): [description]. Defaults to (0, 1).
y_range (Float2, optional): [description]. Defaults to (0, 1).
base_layer (LayerSpec, optional): [description]. Defaults to layer["comp"].
slotted_licon (int, optional): [description]. Defaults to 0.
metal_level (int, optional): [description]. Defaults to 1.
li_enc_dir (str, optional): [description]. Defaults to "V".
x_range: x range.
y_range: y range.
metal_level: metal level.
con_size: contact size.
con_enc: contact enclosure.
m_enc: metal enclosure.
con_spacing: contact spacing.
via_size: via size.
via_spacing: via spacing.
via_enc: via enclosure.
return via stack till the metal level indicated where :
metal_level 1 : till m1
Expand All @@ -80,23 +92,8 @@ def via_stack(
metal_level 4 : till m4
metal_level 5 : till m5
withen the range xrange and yrange and expecting the base_layer to be drawen
"""

c = gf.Component()

# vias dimensions

con_size = (0.22, 0.22)
con_enc = 0.07
m_enc = 0.06

con_spacing = (0.28, 0.28)

via_size = (0.22, 0.22)
via_spacing = (0.28, 0.28)
via_enc = (0.06, 0.06)

if metal_level >= 1:
con_gen = via_generator(
x_range=x_range,
Expand Down
22 changes: 1 addition & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ classifiers = [
"Operating System :: OS Independent"
]
dependencies = [
"gdsfactory>=7.16.0,<7.17"
"gdsfactory==7.25.1"
]
description = "GlobalFoundries 180nm MCU"
keywords = ["python"]
Expand All @@ -38,26 +38,6 @@ docs = [
]
tests = ["pytest", "pytest-cov"]

[tool.black]
exclude = ''' # Specify the files/dirs that should be ignored by the black formatter
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| env
| _build
| buck-out
| build
| dist
)/
'''
include = '\.pyi?$'
line-length = 88
target-version = ['py310']

[tool.mypy]
python_version = "3.10"
strict = true
Expand Down

0 comments on commit d950e33

Please sign in to comment.