Home Forums Nazca Questions and Answers viper() method

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5521
    vlk
    Member

    Hi,

    I wanted to try out the viper() method which is listed in the updates in Nazca 0.5.1 release but it does not seem to be available. I presume I should call it e.g. as ic.viper(), ic being an instance of Interconnect. Am I missing something?

    Regards,
    Marek

    #5524
    Ronald
    Keymaster

    Dear Marek,

    The viper can be found in util.py and can be accessed follows

    import nazca as nd
    nd.util.viper()

    The viper() is a “lower level” function on top of polyline2polygon(). The latter has been upgraded to handle variable widths better. The viper returns an array of points, which can be fed into a Polygon. Below is an example where x, y are the coordinates that the viper follows and w the width.

    import nazca as nd
    import math as m
    
    def x(t):
    return (2+15*t)*m.exp(t)
    
    def y(t):
    return (2+20*t)*m.cos(t*5)
    
    def w(t):
    return 2+3*(m.sin(t*15))**2
    
    # N is the number of points, x, y, w functions of one parameter.
    xygon = nd.util.viper(x, y, w, N=200)
    nd.Polygon(points=xygon).put(0, 5)
    
    # draw the same viper spine again, but with constant width
    xygon = nd.util.viper(x, y, lambda t: 0.1, N=200)
    nd.Polygon(points=xygon, layer=2).put(0, 5)
    
    nd.export_gds()

    For the viper to also become an interconnect it would need some extra checks on how many polygon points are needed for grid snapping at the right resolution. In the present case just give a sufficiently large N.

    Ronald

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