Home Forums Nazca Connecting two cells within a cell

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #6298
    MirceaB
    Participant

    Hello,

    I am trying to connect two cells within a cell and nazca keeps throwing the following exception:

    It is not allowed to create a node outside the scope of max one level deep: You cannot connect to a cell that is not placed inside the cell you are creating.

    This is the code:

    import nazca as nd
    import nazca.demofab as demofab
    
    with nd.Cell(name="cell1") as cell1:
        demofab.deep.strt(length=100).put()
    
    with nd.Cell(name="cell2") as cell2:
        demofab.deep.strt(length=200).put()
        wg1 = demofab.deep.bend(radius=100, angle=-180).put()
        demofab.deep.cobra_p2p(pin1=wg1.pin['b0'], pin2=(100, 100, 0)).put()
    
    with nd.Cell("Final") as final:
        cl1 = cell1.put(200, 300, 0)
        cl2 = cell2.put(500, 500, 0)
        demofab.deep.cobra_p2p(pin1=cell1.pin['b0'], pin2=cell2.pin['a0']).put()
    
    nd.export_gds(filename="test")

    The error seems strange since I’m trying to connect two cells, i.e. cl1 and cl2 inside cell final

    Would you kindly suggest a solution?

    #6301
    Xaveer
    Moderator

    Hi MirceaB,

    You need to connect the cell instance, not the cell itself, since that has no location:

    import nazca as nd
    import nazca.demofab as demofab
    
    with nd.Cell(name="cell1") as cell1:
        demofab.deep.strt(length=100).put()
    
    with nd.Cell(name="cell2") as cell2:
        demofab.deep.strt(length=200).put()
        wg1 = demofab.deep.bend(radius=100, angle=-180).put()
        demofab.deep.cobra_p2p(pin1=wg1.pin['b0'], pin2=(100, 100, 0)).put()
    
    with nd.Cell("Final") as final:
        cl1=cell1.put(200, 300, 0)
        cl2=cell2.put(500, 500, 0)
        demofab.deep.cobra_p2p(pin1=cl1.pin['b0'], pin2=cl2.pin['a0']).put()
    
    final.put()
    
    nd.export_gds(filename="test")
    

    Not sure if what you get now is what you want, but it should get you going.

    Xaveer

    #6302
    Ronald
    Keymaster

    Dear MirceaB,

    The cell instances c1 and c2 need to be connected in the scope of your cell ‘final’, not the pins inside the original cells. Pins inside cell1 and cell2 are indeed not in scope of cell ‘final’.

    Change the last line in cell ‘final’ to
    demofab.deep.cobra_p2p(pin1=cl1.pin['b0'], pin2=cl2.pin['a0']).put()

    Ronald

    #6303
    Xaveer
    Moderator

    Also, look at how to add the pins to your cells, to provide the proper connectivity. E.g. see https://nazca-design.org/make_a_cell_put_a_cell/

    #6304
    MirceaB
    Participant

    Oh, of course… Thank you for the solution, Xaveer & Ronald!

    • This reply was modified 1 month, 1 week ago by MirceaB.
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.