place() method#

Design.place(inst, grid, mn=[0, 0], anchor_xy=None)[source]#

Place instance at abstract coordinate mn on abstract grid.

Parameters:
Returns:

Placed instance(s) (list if multiple).

Return type:

laygo2.object.physical.Instance or laygo2.object.physical.VirtualInstance or list(laygo2.object.physical.Instance)

Example

>>> import laygo2
>>> from laygo2.object.grid import OneDimGrid, PlacementGrid
>>> from laygo2.object.database import Design
>>> from laygo2.object.physical import Instance
>>> # Create a grid (not needed if laygo2_tech is set up).
>>> gx  = OneDimGrid(name="gx", scope=[0, 20], elements=[0])
>>> gy  = OneDimGrid(name="gy", scope=[0, 100], elements=[0])
>>> g   = PlacementGrid(name="test", vgrid=gx, hgrid=gy)
>>> # Create a design
>>> dsn = Design(name="mycell", libname="genlib")
>>> # Create an instance
>>> i0 = Instance(libname="tlib", cellname="t0", name="I0", xy=[0, 0])
>>> print(inst0.xy)
[100, 100]
>>> ######################
>>> # Place the instance #
>>> ######################
>>> dsn.place(inst=i0, grid=g, mn=[10,10])
>>> # Print parameters of the placed instance.
>>> print(i0.xy)
[200, 1000]
>>> print(dsn)
<laygo2.object.database.Design object at 0x000002803D4C0F40>
    name: mycell
    params: None
    elements:
        {'I0': <laygo2.object.physical.Instance object at
                0x000002803D57F010>}
    libname:genlib
    rects:{}
    paths:{}
    pins:{}
    texts:{}
    instances:
        {'I0': <laygo2.object.physical.Instance object at 0x000002803D57F010>}
    virtual instances:{}
>>> # When placing multiple instances by wrapping them with a list:
>>> i1 = Instance(libname="tlib", cellname="t1", name="I1", xy=[0, 0])
>>> i2 = Instance(libname="tlib", cellname="t2", name="I2", xy=[0, 0])
>>> i3 = Instance(libname="tlib", cellname="t3", name="I3", xy=[0, 0])
>>> dsn.place(inst= [i1, i2, i3], grid=g, mn=[10,10])
>>> print(dsn)
<laygo2.object.database.Design object at 0x000002803D4C0F40>
    name: mycell
    params: None
    elements:
        {'I0': <laygo2.object.physical.Instance object at
                0x000002803D57F010>,
         'I1': <laygo2.object.physical.Instance object at
                0x000002803D57F011>,
         'I2': <laygo2.object.physical.Instance object at
                0x000002803D57F012>,
         'I3': <laygo2.object.physical.Instance object at
                0x000002803D57F013>
                }
    libname:genlib
    rects:{}
    paths:{}
    pins:{}
    texts:{}
    instances:
        {'I0': <laygo2.object.physical.Instance object at 0x000002803D57F010>,
         'I1': <laygo2.object.physical.Instance object at 0x000002803D57F011>,
         'I2': <laygo2.object.physical.Instance object at 0x000002803D57F012>,
         'I3': <laygo2.object.physical.Instance object at 0x000002803D57F013>
        }
    virtual instances:{}

See also

laygo2.object.grid.PlacementGrid.place

place a (virtual) instance on the grid.