Home Forums Nazca nm-scale offset using Tp_viper or curve2polyline pin to pin at an angle

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6600
    Cecil
    Member

    Hello Nazca team,

    I’ve had a few issues working with Tp_viper or curve2polyline (and polyline2polygon) free form parametric curves. Namely there seems to be nm-scale offsets when instancing them on another cell instance’s pin, as shown in the picture.

    This happens whether I specify anglei/angleo or not.

    Here’s the code:

    import nazca as nd
    from math import tan, radians
    
    def polynomial_curve(width, theta_in, x0, some_value1, some_value2, some_value3, N=1000, layer=1):
        
        def x(t, x0, **kwargs):
            return t*x0
    
        def y(t, a, x0, a1, a2, a3, **kwargs):
            t *= x0
            return (a*t - t**3 * a1 - t**4 * a2 - t**5 * a3)
       
        def w(t, width1, **kwargs):
            return width1
       
        params = {
            'a': tan(radians(theta_in)),
            'x0': x0,
            'a1': some_value1,
            'a2': some_value2,
            'a3': some_value3,
        }
        path = nd.Tp_viper(x=x, y=y, w=w, **params, epsilon=1e-9)
        path_cell = path(width1=width, width2=width, N=N, layer=layer)
        
        return path_cell
        
    def big_curve(width, theta_in, x0, 
        some_value1, some_value2, some_value3, some_value4, 
        angle=-120, N=1000, layer=1):
        
        with nd.Cell(name='Cell', cnt=True) as C:
            path1 = polynomial_curve(
                width=width, 
                theta_in=theta_in, 
                x0=x0, 
                some_value1=some_value1,
                some_value2=some_value2, 
                some_value3=some_value3, 
                N=N, 
                layer=layer,
            ).put()
            arc = nd.bend(
                radius=abs(some_value4), 
                angle=angle/2,
                width=width, 
                layer=layer,
            ).put()
            arc2 = nd.bend(
                radius=-abs(some_value4), 
                angle=angle/2,
                width=width, 
                layer=layer
            ).put()
            path2 = polynomial_curve(
                width=width, 
                theta_in=theta_in, 
                x0=x0, 
                some_value1=some_value1,
                some_value2=some_value2, 
                some_value3=some_value3, 
                N=N, 
                layer=layer,
            ).put('b0')
            nd.Pin('b0', show=True).put(path2.pin['a0'])
            nd.Pin('a0', show=True).put(path1.pin['a0'])
            nd.put_stub()
        return C
    
    some_value1 = 1.3766941636306883e-07 
    some_value2 = -4.7556288807929455e-11 
    some_value3 = 4.388054993928043e-15
    some_value4 = -1200
    
    nd.bend(angle=14.559922415647494, width=2, radius=1000).put()
    big_curve(
        width=2, 
        theta_in=14.559922415647494, 
        x0=3000, 
        some_value1=some_value1, 
        some_value2=some_value2, 
        some_value3=some_value3, 
        some_value4=some_value4, 
        N=1000,
    ).put()
    nd.bend(angle=-90, radius=1200, width=2).put()
    nd.export_gds(filename='test')
    

    For some reason I didn’t see it happen when instancing the curve by itself at the right angle, and then adding other instances pin to pin. It only happened when used in cells with other elements such as big_curve or cells containing big_curve.

    I also used curve2polyline extensively for custom pathing and never had this issue (input angles were always 0, output angle was specified in the xya argument).

    Any tips or input?

    Thanks,

    Cecil

    #6602
    Ronald
    Keymaster

    Dear Cecil,

    When using gds hierarchy under (no multiple of 90 degree) angles or in between grid-point translations, the snapping errors (better: delta’s) you see are fundamentally caused by looking at two non-aligned discrete coordinate systems on top of each other.

    Interconnects within a single cell are by default not instantiated and snap to the same parent grid. In contrast, the Vipers are now child cells in your example, each in their own grid system. If you flatten topcell “nazca” in your example you will enforce a single parent grid to snap to for all structures in cell “nazca”.

    Ronald

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