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

spira.Port does not connect to correct process, without process parameter #5

Open
JCoetzee123 opened this issue Sep 17, 2019 · 0 comments

Comments

@JCoetzee123
Copy link
Contributor

JCoetzee123 commented Sep 17, 2019

Title

spira.Port does not connect to correct process, without process parameter

Steps to reproduce:

import spira and desired RDD

import spira.all as spira
from spira.technologies.mit.process.database import RDD

create a class of type PCell, desired box element and ports

class Resistor(spira.PCell):

    width = spira.NumberParameter(default=spira.NUMBER(2))
    length = spira.NumberParameter(default=spira.NUMBER(5), doc='Length of the shunt resistance.')

    def validate_parameters(self):
        if self.width > self.length:
            raise ValueError('`Width` cannot be larger than `length`.')
        return True

    def create_elements(self, elems):
        elems += spira.Box(width=self.length, height=self.width, center=(0,0), layer=spira.RDD.PLAYER.R5.METAL)
        return elems
    def create_ports(self, ports):
        w, l = self.width, self.length
        ports += spira.Port(name='P1_R5', midpoint=(-l/2,0), orientation=180, width=self.width)
        ports += spira.Port(name='P2', midpoint=(l/2,0), orientation=0, width=self.width, process=spira.RDD.PROCESS.R5)
        return ports

D = Resistor()

####Expected behavior:
Script should execute without errors as naming convention of ports should connect P1 to the R5 process

####Current behavior (incorrect):

[SPiRA] Version 0.1.1-Auron [Beta] - MIT License
---------------------------------------------
Traceback (most recent call last):
  File "tests/testpy.py", line 24, in <module>
    D.gdsii_output("tests/testpy")
  File "/home/johannes/Documents/spira-next/env/lib/python3.7/site-packages/spira/yevon/aspects/output.py", line 34, in gdsii_output
    D = deepcopy(self)
  File "/usr/lib/python3.7/copy.py", line 161, in deepcopy
    y = copier(memo)
  File "/home/johannes/Documents/spira-next/env/lib/python3.7/site-packages/spira/yevon/gdsii/cell.py", line 185, in __deepcopy__
    ports=deepcopy(self.ports)
  File "/home/johannes/Documents/spira-next/env/lib/python3.7/site-packages/spira/core/parameters/descriptor.py", line 96, in __get__
    value = self.call_param_function(obj)
  File "/home/johannes/Documents/spira-next/env/lib/python3.7/site-packages/spira/yevon/geometry/ports/port_list.py", line 234, in call_param_function
    value = f(self.__type__())
  File "/home/johannes/Documents/spira-next/env/lib/python3.7/site-packages/spira/yevon/aspects/port.py", line 37, in __create_ports__
    return self.create_ports(ports)
  File "tests/testpy.py", line 19, in create_ports
    ports += spira.Port(name='P1_R5', midpoint=(-l/2,0), orientation=180, width=self.width)
  File "/home/johannes/Documents/spira-next/env/lib/python3.7/site-packages/spira/yevon/geometry/ports/base.py", line 124, in __call__
    name, process = cls._bind_process_to_name(kwargs)
  File "/home/johannes/Documents/spira-next/env/lib/python3.7/site-packages/spira/yevon/geometry/ports/base.py", line 84, in _bind_process_to_name
    raise ValueError(error_message.format(port_data['name']))
ValueError: Cannot connect port 'P1_R5' to a process.
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

No branches or pull requests

1 participant