Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tesselated via #1391

Merged
merged 3 commits into from Mar 4, 2023
Merged

Tesselated via #1391

merged 3 commits into from Mar 4, 2023

Conversation

simbilod
Copy link
Collaborator

@simbilod simbilod commented Mar 4, 2023

via_stack_from_rules is like via_stack, but instead of using hardcoded via sizes, it calculates how big the vias have to be (above a minimum size) given spacing and inclusion rules to maximize number of vias and via area

Only useful if your foundry allows you to change these things of course

Could be more general for other via stack functions

@HelgeGehring

For instance, here VIA1 and VIA2 have the same sizing and spacing rules, but different inclusions, and VIA2 ends up being sized larger:

def via_stack_from_rules(
    size: Tuple[float, float] = (1.2, 1.2),
    layers: LayerSpecs = ("M1", "M2", "M3"),
    layer_offsets: Optional[Tuple[float, ...]] = None,
    vias: Optional[Tuple[Optional[ComponentSpec], ...]] = (via1, via2),
    via_min_size: Tuple[Tuple[float, float]] = ((0.2, 0.2), (0.2, 0.2)),
    via_min_gap: Tuple[Tuple[float, float]] = ((0.1, 0.1), (0.1, 0.1)),
    via_min_enclosure: Tuple[float] = (0.15, 0.25),
    layer_port: LayerSpec = None,
) -> Component:

image

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 4, 2023

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 1.17%.

Quality metrics Before After Change
Complexity 11.40 🙂 10.41 🙂 -0.99 👍
Method Length 170.00 😞 187.83 😞 17.83 👎
Working memory 14.60 😞 14.85 😞 0.25 👎
Quality 38.75% 😞 39.92% 😞 1.17% 👍
Other metrics Before After Change
Lines 118 266 148
Changed files Quality Before Quality After Quality Change
gdsfactory/components/via_stack.py 38.75% 😞 39.92% 😞 1.17% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
gdsfactory/components/via_stack.py via_stack_from_rules 14 🙂 382 ⛔ 18 ⛔ 27.22% 😞 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/components/via_stack.py via_stack 14 🙂 329 ⛔ 17 ⛔ 29.15% 😞 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/components/via_stack.py optimized_via 3 ⭐ 103 🙂 11 😞 63.71% 🙂 Extract out complex expressions
gdsfactory/components/via_stack.py test_via_stack_from_rules 0 ⭐ 136 😞 9 🙂 66.52% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@codecov
Copy link

codecov bot commented Mar 4, 2023

Codecov Report

Merging #1391 (865abb5) into main (7273399) will increase coverage by 0.07%.
The diff coverage is 93.84%.

@@            Coverage Diff             @@
##             main    #1391      +/-   ##
==========================================
+ Coverage   69.49%   69.57%   +0.07%     
==========================================
  Files         366      366              
  Lines       21913    21972      +59     
  Branches     3141     3147       +6     
==========================================
+ Hits        15229    15286      +57     
- Misses       5781     5782       +1     
- Partials      903      904       +1     
Impacted Files Coverage Δ
gdsfactory/components/via_stack.py 95.41% <93.84%> (-2.59%) ⬇️
gdsfactory/components/via.py 80.00% <0.00%> (+6.66%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@simbilod simbilod mentioned this pull request Mar 4, 2023
@HelgeGehring
Copy link
Collaborator

Looks great!

What is layer_port?

And I'm wondering, could we somehow move the min and max size in the via definition in the PDKs?

@simbilod
Copy link
Collaborator Author

simbilod commented Mar 4, 2023

layer_port is an argument in the original via_stack function, I think it sets the layer on which the electrical port is

We could do something like this:

(1) New defaults to None

def via_stack_from_rules(
    size: Tuple[float, float] = (1.2, 1.2),
    layers: LayerSpecs = ("M1", "M2", "M3"),
    layer_offsets: Optional[Tuple[float, ...]] = None,
    vias: Optional[Tuple[Optional[ComponentSpec], ...]] = (via1, via2),
    via_min_size: Tuple[Tuple[float, float]] = (None, None),
    via_min_gap: Tuple[Tuple[float, float]] = (None, None),
    via_min_enclosure: Tuple[float] = (None, None),
    layer_port: LayerSpec = None,
) -> Component:

(2) Default to some PDK value if None:

[...]

    for current_via, min_size, min_gap, min_enclosure in zip(
        vias, via_min_size, via_min_gap, via_min_enclosure
    ):
        min_size = min_size or (pdk.via_min_size_x[current_via.info["layer"]], pdk.via_min_size_y[current_via.info["layer"]])
        min_gap = min_gap or (pdk.via_min_gap_x[current_via.info["layer"]], pdk.via_min_gap_y[current_via.info["layer"]])
        min_enclosure = min_enclosure or pdk.via_min_enclosure[current_via.info["layer"]]

        [...]

I don't know if we have such defaults yet, or what the best way to define /access them would be

@joamatab
Copy link
Contributor

joamatab commented Mar 4, 2023

Looks great, thank you Simon,

yes, moving technology specific values to the PDK can be done easily on each PDK, or we can start using gf.Pdk.constants

@joamatab joamatab merged commit 08e83d9 into gdsfactory:main Mar 4, 2023
@simbilod simbilod deleted the tesselated_via branch April 5, 2023 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants