route() method#

Design.route(grid, mn, direction=None, via_tag=None)[source]#

Create wire object(s) for routing at abstract coordinate mn.

Parameters:
  • grid (laygo2.object.grid.RoutingGrid) – Placement grid for wire placement.

  • mn (list(numpy.ndarray)) – List containing two or more mn coordinates to be connected.

  • direction (str, optional.) – None or “vertical” or “horizontal”. The direction of the routing object.

  • via_tag (list(Boolean), optional.) – The list containing switches deciding whether to place via at the edges.

Returns:

The generated routing object(s). Check the example code in laygo2.object.grid.RoutingGrid.route for details.

Return type:

laygo2.object.physical.Rect or list

Example

>>> import laygo2
>>> from laygo2.object.grid import CircularMapping as CM
>>> from laygo2.object.grid import CircularMappingArray as CMA
>>> from laygo2.object.grid import OneDimGrid, RoutingGrid
>>> from laygo2.object.template import NativeInstanceTemplate
>>> from laygo2.object.database import Design
>>> from laygo2.object.physical import Instance
>>> # Routing grid construction (not needed if laygo2_tech is set up).
>>> gv = OneDimGrid(name="gv", scope=[0, 50], elements=[0])
>>> gh = OneDimGrid(name="gv", scope=[0, 100], elements=[0, 40, 60])
>>> wv = CM([10])           # vertical (xgrid) width
>>> wh = CM([20, 10, 10])   # horizontal (ygrid) width
>>> ev = CM([10])           # vertical (xgrid) extension
>>> eh = CM([10, 10, 10])   # horizontal (ygrid) extension
>>> e0v = CM([15])          # vert. extension (for zero-length wires)
>>> e0h = CM([15, 15, 15])  # hori. extension (for zero-length wires)
>>> lv = CM([['M1', 'drawing']], dtype=object)  # layer information
>>> lh = CM([['M2', 'drawing']]*3, dtype=object)
>>> plv = CM([['M1', 'pin']], dtype=object) # pin layers
>>> plh = CM([['M2', 'pin']]*3, dtype=object)
>>> xcolor = CM([None], dtype=object)  # not multipatterned
>>> ycolor = CM([None]*3, dtype=object)
>>> primary_grid = 'horizontal'
>>> tvia = NativeInstanceTemplate(libname='tlib', cellname='via0')  # via
>>> viamap = CMA(elements=[[tvia, tvia, tvia]], dtype=object)
>>> g = laygo2.object.grid.RoutingGrid(name='mygrid', vgrid=gv, hgrid=gh,
                                       vwidth=wv, hwidth=wh,
                                       vextension=ev, hextension=eh,
                                       vlayer=lv, hlayer=lh,
                                       pin_vlayer=plv, pin_hlayer=plh,
                                       viamap=viamap, primary_grid=primary_grid,
                                       xcolor=xcolor, ycolor=ycolor,
                                       vextension0=e0v, hextension0=e0h)
>>> # Create a design
>>> dsn = Design(name="mycell", libname="genlib")
>>> #################
>>> # Route on grid #
>>> #################
>>> mn_list = [[0, -2], [0, 1], [2, 1], [5,1] ]
>>> route = dsn.route(grid=g, mn=mn_list,
                      via_tag=[True, None, True, True])
>>> # Display generated design.
>>> print(dsn)
<laygo2.object.database.Design object at 0x000001C71AE3A110>
    name: mycell, params: None
    elements: {
    'NoName_0': <laygo2.object.physical.Instance object at 0x000001C71AE3BA90>,
    'NoName_1': <laygo2.object.physical.Rect object at 0x000001C71AE3B820>,
    'NoName_2': <laygo2.object.physical.Rect object at 0x000001C71AE3ABF0>,
    'NoName_3': <laygo2.object.physical.Instance object at 0x000001C71AE3A140>,
    'NoName_4': <laygo2.object.physical.Rect object at 0x000001C71AE39DB0>,
    'NoName_5': <laygo2.object.physical.Instance object at 0x000001C71AE3AB60>}
    libname:genlib
    rects: {  # wires
    'NoName_1': <laygo2.object.physical.Rect object at 0x000001C71AE3B820>,
    'NoName_2': <laygo2.object.physical.Rect object at 0x000001C71AE3ABF0>,
    'NoName_4': <laygo2.object.physical.Rect object at 0x000001C71AE39DB0>}
    paths:{}
    pins:{}
    texts:{}
    instances:{  # vias
    'NoName_0': <laygo2.object.physical.Instance object at 0x000001C71AE3BA90>,
    'NoName_3': <laygo2.object.physical.Instance object at 0x000001C71AE3A140>,
    'NoName_5': <laygo2.object.physical.Instance object at 0x000001C71AE3AB60>}
    virtual instances:{}
_images/object_grid_RoutingGrid_route.png

See also

laygo2.object.grid.RoutingGrid.route

route wire(s) on the grid.