Home Forums Nazca Questions and Answers Pin attributes

Tagged: , , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4189
    Kristif
    Participant

    Hello Nazca team,

    I would like to know which is the way code-wise to get information about an input/output pin of an already put component (pre-designed from third parties) in your design. For example if I want to know the orientation angle of a certain pin.

    #4191
    Ronald
    Keymaster

    Hi Kristif,

    The pins in a cell (“component”) reside in a Python dictionary attribute named ‘pin’.
    Hence, if you have cell named C then you can print all pins with
    print(C.pin)

    The method xya() of a pin gives you the coordinates (x, y, a), but the pin also stores attributes like the xsection (xs) and width. To print specific info on all pins in a cell you can use the following loop over the pin dict:

    for name, pin in C.pin.items():
        print("pin '{}'\n  position: {}\n  xs: {}\n  width: {}".\
            format(name, pin.xya(), pin.xs, pin.width))

    Similarly, if cell C has a pin named ‘a0’, you can get the coordinates as
    x, y, a = C.pin['a0'].xya()

    Ronald

    #4578
    alvin
    Member

    Assuming I have defined cellA and it has the pin ‘lb’ which is set to be at the bottom left corner of the cell. I want to put a space in y-direction of 50 um between cellA and the sequent cell (cellB) automatically without knowing the actual size of cellA.
    I found if I do this:

    nd.cp.goto_pin(cellA.pin['lb'])
    nd.cp.move(0,-50,0)
    cellB.put()

    It returns an error:

    Exception: Not allowed to create a node outside the scope of max one level deep.

    associated with the use of

    nd.cp.move(0,-50,0)

    after using

    nd.cp.goto_pin

    However, there is no error if I do this:

    nd.cp.goto_pin(cellA.pin['lb'])
    xya = nd.cp.here()
    nd.cp.goto(xya.x,xya.y)
    nd.cp.move(0,-50,0)
    cellB.put()

    It is a little bit troublesome!! Is there any way I can use

    nd.cp.move(0,-50,0)

    right away?

    #4583
    Ronald
    Keymaster

    Dear alvin,

    Thank you for your interesting question. First the solution:

    A = cellA.put()
    cellB.put(A.pin['lb'].move(0, -50))

    Hence, simply use the pin (Node) methods: move, rot, skip, offset.
    It works as as follows:

    A = cellA.put()
    # place cellA in cell 'nazca' as instance variable A
    
    cellB.put(A.pin['lb'].move(0, -50))
    # connect cellB relative to pin['lb'] of instance A

    It is best to avoid the cp syntax. The preferred syntax is simpler and more intuitive and lets Nazca do the thinking.

    What happens in your first example is several things:

    nd.cp.goto_pin(cellA.pin['lb'])

    moves the “current pin” cp to a pin inside cellA. I assume here cellA is a Cell object and not an Instance.

    nd.cp.move(0, -50)

    generates a new pin (Node object) w.r.t. cp and places it in the present (active) Cell, i.e. cell ‘nazca’. However, this new pin is higher up in the hierarchy than cellA. It is not possible to connect pins between cell hierarchies. It violates (gds) hierarchy, hence the Exception.

    If you insist on cp syntax, below is how do it right, i.e. connect to an instance of cellA, not to cellA directly:

    A = cellA.put()
    nd.cp.goto_pin(A.pin['lb'])
    nd.cp.move(0, -50)
    cellB.put()

    The take away is that the pins inside a “closed” or “finished” cell are not allowed for direct connection (the cell is closed). Instantiating the closed cell in the cell under construction, the active cell, however, creates new pins in the active cell, which can be connected to. Nazca will check for consistency to avoid topological errors in your gds.

    In the second case:

    nd.cp.goto_pin(cellA.pin['lb'])
    xya = nd.cp.here()

    nothing new happens, xya is the same Node as after cp.goto_pin()

    nd.cp.goto(xya.x,xya.y)

    creates a new pin in cell ‘nazca’ based on the floats in (xya.x, xya.y), which are coordinates w.r.t. cellA!

    nd.cp.move(0, -50)

    this time over the connections are all inside cell ‘nazca’ and all seems well, but …, there is a catch from the previous lines of code: position (0, 50) is measured from the origin of cellA but applied w.r.t. origin of cell ‘nazca’.

    An other case:

    Note that in a similar way it is not allowed to connect cellB inside cellA after cellA was created:

    cellB.put(cellA.pin['lb'])
    Exception: You are trying to connect to a closed Cell object

    If you need cellB inside cellA simply put cellB there during the definition of cellA.

    Ronald

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.