RoutingMeshTemplate class#

class laygo2.object.template.routing.RoutingMeshTemplate(grid, tracks: Optional[dict] = None, nodes: Optional[list] = None)[source]#

Bases: laygo2.object.template.core.Template

RoutingMesh describes a two dimensional routing structure over a routing grid.

Public Data Attributes:

grid

A routing grid object that the RoutingMesh object refers to.

tracks

A dictionary that contains track information.

nodes

A list that contains layout objects to be connected through the routing channel. The element could be either one of the following: laygo2.object.physical.Instance, laygo2.object.physical.VirtualInstance, laygo2.object.physical.Rect.

Inherited from Template

name

Template name.

Public Methods:

bbox([params])

numpy.ndarray: (Abstract method) Return the bounding box of a template.

pins([params])

dict: (Abstract method) Return dict having the collection of pins of a template.

__init__(grid[, tracks, nodes])

The constructor function.

add_track(name, index[, netname])

Add a track to the mesh.

add_node(obj)

Add a node object to the mesh.

generate()

Generate a routing mesh.

Inherited from Template

__init__(grid[, tracks, nodes])

The constructor function.

__str__()

Return a string representation of this template's information.

summarize()

Return the summary of the template information.

height([params])

int: Return the height of the template.

width([params])

int: Return the width of the template.

size([params])

int: Return the size of the template.

bbox([params])

numpy.ndarray: (Abstract method) Return the bounding box of a template.

pins([params])

dict: (Abstract method) Return dict having the collection of pins of a template.

generate()

Generate a routing mesh.


__init__(grid, tracks: Optional[dict] = None, nodes: Optional[list] = None)[source]#

The constructor function.

Parameters
  • grid (laygo2.object.grid.RoutingGrid) – The grid object that this object refers to for constructing routing wires.

  • tracks (dict) – The dictionary that contains track information. The format of its element is “track_name”: [index, “net_name”].

  • nodes (list) –

    The list that contains layout objects to be connected through the routing channel. The element could be either one of the following:

    laygo2.object.physical.Instance, laygo2.object.physical.VirtualInstance, laygo2.object.physical.Rect.

    For Instance or VirtualInstance elements, the netname parameters of their pins need to be set to the name of net (netname) which the pins are connected to. For Rect elements, their netname parameters should be set.

add_node(obj)[source]#

Add a node object to the mesh.

Parameters

obj (laygo2.object.physical.Instance or laygo2.object.physical.VirtualInstance or laygo2.object.pythiscl.Rect) – The object to be added to the mesh as a node.

add_track(name: str, index: int, netname: Optional[str] = None)[source]#

Add a track to the mesh.

Parameters
  • name (str) – The name of the track to be added.

  • index (int) – The index of the track. For a horizontal track, it should be [None, i] where i is the value of abstract coordinate to place the routing track. For a vertical track, it should be [i, None].

  • netname (str) – The net name of the track.

bbox(params=None)[source]#

numpy.ndarray: (Abstract method) Return the bounding box of a template.

generate()[source]#

Generate a routing mesh.

Returns

laygo2.object.physical.VirtualInstance

Return type

the generated routing object.

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.physical import Instance, Rect
>>> # 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, 50], elements=[0])
>>> wv = CM([10])           # vertical (xgrid) width
>>> wh = CM([10])   # horizontal (ygrid) width
>>> ev = CM([10])           # vertical (xgrid) extension
>>> eh = CM([10])   # horizontal (ygrid) extension
>>> e0v = CM([5])          # vert. extension (for zero-length wires)
>>> e0h = CM([5])  # hori. extension (for zero-length wires)
>>> lv = CM([['M1', 'drawing']], dtype=object)  # layer information
>>> lh = CM([['M2', 'drawing']], dtype=object)
>>> plv = CM([['M1', 'pin']], dtype=object) # pin layers
>>> plh = CM([['M2', 'pin']], dtype=object)
>>> xcolor = CM([None], dtype=object)  # not multi-patterned
>>> 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 = 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 node objects.
>>> r0 = Rect(xy=[[45, -5], [55, 5]], layer=['M1', 'drawing'], netname = "A")
>>> r1 = Rect(xy=[[95, -5], [105, 5]], layer=['M1', 'drawing'], netname = "A")
>>> i0_pins = dict()
>>> i0_pins['X'] = laygo2.object.physical.Pin(xy=[[45, 95], [55, 105]],
>>>     layer = ['M1', 'drawing'], netname = 'A')
>>> i0 = laygo2.object.physical.Instance(name="I0", xy=[150,0],
>>>     libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
>>>     unit_size=[100, 100], pins=i0_pins, transform='R0')
>>>
>>> # Create a routing mesh.
>>> rm = laygo2.object.routing.RoutingMesh(grid = g)
>>> rm.add_track(name = "A", index = [None, 5], netname = "A")
>>> rm.add_node(r0)
>>> rm.add_node(r1)
>>> rm.add_node(i0)
>>> rinst = rm.generate()
>>>
>>> # Print horizontal wire
>>> print(rinst.pins["A"].xy)
[[ 50 250]
 [200 250]]
>>> # Vertical wire to r0
>>> print(rinst.native_elements["A_0_0"].xy)
[[ 50   0]
 [ 50 250]]
>>> # Vertical wire to r1
>>> print(rinst.native_elements["A_1_0"].xy)
[[100   0]
 [100 250]]
>>> # Vertical wire to i0
>>> print(rinst.native_elements["A_2_0"].xy)
[[200 100]
 [200 250]]
height(params=None)#

int: Return the height of the template.

pins(params=None)[source]#

dict: (Abstract method) Return dict having the collection of pins of a template.

size(params=None)#

int: Return the size of the template.

summarize()#

Return the summary of the template information.

width(params=None)#

int: Return the width of the template.

_abc_impl = <_abc._abc_data object>#
grid = None#

A routing grid object that the RoutingMesh object refers to.

Type

laygo2.object.grid.RoutingGrid

name = None#

Template name.

Type

str

nodes = []#

A list that contains layout objects to be connected through the routing channel. The element could be either one of the following:

laygo2.object.physical.Instance, laygo2.object.physical.VirtualInstance, laygo2.object.physical.Rect.

For Instance or VirtualInstance elements, the netname parameters of their pins need to be set to the name of net (netname) which the pins are connected to. For Rect elements, their netname parameters should be set.

Type

list

tracks = {}#

A dictionary that contains track information. The format of its element is “track_name”: [index, “net_name”].

Type

dict