Home Forums Nazca Questions and Answers Adding pins to user defined cell

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6057
    dnortheast
    Member

    Hello, I’m somewhat new with Nazca, and am now getting into problems that defy my current understanding of the package. I am trying to make a cell that includes a high resolution ring (arbitrarily high in the code), and a ‘pulley-coupled’ waveguide that passed by. I intend the user to be able to input the radii and coupling ‘angle’, etc. Visually, all looks OK with this, and it comes together as intended.

    Then, I try to add pins so this can be instanced in other cells, and now I don’t understand what is happening. I have tried to follow examples that name pins and assign them to locations defined through the layout of internal instances. When I do this, my layout appears to translate a bit, then rotate 180 degrees! And the pins are not where I intended at all.

    In the code I am including, I intend to add pins that correspond to the ends of the two straight waveguide sections (nd.strt). I believe both of the unconnected pins here are ‘b0’ pins.  I make an ‘a0’ and ‘b0’ from these, and include ‘nd.put_stub()’ which shows the pins are in the wrong location. In the code, I have commented out the pin definitions. If they are uncommented, the design flips, as I said.

    Can anyone provide some guidance? What am I not getting about making pins here? (Or perhaps in general.)

    import nazca as nd
    from nazca.interconnects import Interconnect
    import nazca.geometries as geom
    
    # change gds database units
    unit = 1e-5
    nd.gds_base.gds_db_unit = unit*1e-6
    nd.gds_base.gds_db_user = unit
    
    # clear then define some layers
    nd.add_layer(name='one',layer=1,accuracy=1e-5)
    nd.add_layer(name='two',layer=2,accuracy=1e-5)
    nd.add_layer(name='three',layer=3,accuracy=1e-5)
    
    #ic = Interconnect(width=2.0, radius=10.0,layer='one')
    
    def r_pull(r_ring=5,w_ring=1e-1,n_ring=16000,gap=8e-2,w_wg=1e-1,theta=90,r_out1=2,r_out2=2,l_out1=3,l_out2=3,lay=1):
        with nd.Cell(name='ringres_pulley') as r_pulley:
    
            n_arc = round(n_ring/4)
            theta_wg = round(theta/2)
    
            # make the ring out of 4 arcs, centred around the origin
            points = geom.arc(radius=r_ring, width=w_ring, angle=90, N=n_arc)
            points = geom.transform(points,flipy=True)
            nd.Polygon(points=points, layer=lay).put(0)
            points = geom.arc(radius=r_ring, width=w_ring, angle=90, N=n_arc)
            points = geom.transform(points,flipx=True, flipy=True)
            nd.Polygon(points=points, layer=lay).put(0)
            points = geom.arc(radius=r_ring, width=w_ring, angle=90, N=n_arc)
            points = geom.transform(points)
            nd.Polygon(points=points, layer=lay).put(0)
            points = geom.arc(radius=r_ring, width=w_ring, angle=90, N=n_arc)
            points = geom.transform(points,flipx=True)
            nd.Polygon(points=points, layer=lay).put(0)
    
            # make half arc around ring resonator, curve off and add some length of straight waveguide
            wg1 = nd.bend(radius=r_ring+w_ring/2+gap+w_wg/2,width=w_wg,angle=-theta_wg,layer=lay)
            wg1.put((0,r_ring+w_ring/2+gap+w_wg/2),flop=True) # should point left
            wg1bend = nd.bend(radius=r_out1,width=w_wg,angle=-theta_wg,layer=lay)
            wg1bend.put()
            wg1strt = nd.strt(width=w_wg,length=l_out1,layer=lay)
            wg1strt.put()
    
            # make second half-arc, curve off and add length of straight waveguide
            wg2 = nd.bend(radius=r_ring+w_ring/2+gap+w_wg/2,width=w_wg,angle=-theta_wg,layer=lay)
            wg2.put((0,r_ring+w_ring/2+gap+w_wg/2)) # should point right
            wg2bend = nd.bend(radius=r_out2,width=w_wg,angle=theta_wg,layer=lay)
            wg2bend.put()
            wg2strt = nd.strt(width=w_wg,length=l_out2,layer=lay)
            wg2strt.put()
    
            # add pins to cell (the unconnected ends of the straight waveguides)
            #nd.Pin(name='a0', pin=wg1strt.pin['b0']).put()
            #nd.Pin(name='b0', pin=wg2strt.pin['b0']).put()
    
            nd.put_stub()
    
        return r_pulley
    
    r_pulley1 = r_pull(6,3e-1,16000,1e-1,3.5e-1,45,2,2,4,20,'one').put((0,0))
    nd.strt(width=3e-1,length=5,layer='two').put()
    
    nd.export_gds(filename='test.gds')

     

    #6059
    Ronald
    Keymaster

    Dear dnortheast,

    If no pins are placed in a new cell Nazca will place two default pins, i.e. input ‘a0’ at (0, 0, 180) and output ‘b0’ at (0, 0, 0) in the cell’s coordinates, so the cell can be connected.

    The pins you placed are on pins in the original cells (wg1strt and wg2strt) rather than the instances of those cells in your “pulley” cell, i.e. the result of their placement via a put(). So those pins in your example appear at the coordinates as they are in the original cell rather than their instance location in your new “pulley” cell, where you want them. The solution is as follows:

    # old (incorrect)
    wg2strt.put()
    nd.Pin(name='a0', pin=wg1strt.pin['b0']).put()
    
    # new (correct)
    an_instance_of_the_cell_wg2strt = wg2strt.put()
    nd.Pin(name='a0', pin=an_instance_of_the_cell_wg2strt.pin['b0']).put()

    See also this post about cells and instances

    Ronald

    #6060
    dnortheast
    Member

    OK, thank you. That is what I was missing. I was misled since the components were showing up as expected. In my head this implies they are instanced in the layout, and hence have pins locations to point to. Now I see that’s not really the case. Cheers.

    #6064
    Ronald
    Keymaster

    Dear dnortheast,

    The layout of the cell is correct, only the provided pin reference is not pointing to an instance object. To help identify this situation quickly I added a warning that will show up in the Nazca logfile, i.e. referencing of the Pin(pin=…) to a pin in a cell outside the cell you are building (available after the 0.5.10 release). It will not complain when referencing to a pin inside the same parent cell or a pin in an instance.

    Ronald

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