Instance class#

class laygo2.object.physical.Instance(xy, libname, cellname, viewname='layout', shape=None, pitch=None, transform='R0', unit_size=array([0, 0]), pins=None, name=None, params=None)[source]#

Bases: IterablePhysicalObject

Instance object class.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> print(inst0)
<laygo2.object.physical.Instance object at 0x000001AF458AF8E0>
    name: I0,
    class: Instance,
    xy: [100, 100],
    params: None,
    size: [500, 300],
    shape: [3, 2],
    pitch: [200, 200],
    transform: R0,
    pins: {'in': <laygo2.object.physical.Pin object at 0x000001AF560D6170>,
           'out': <laygo2.object.physical.Pin object at 0x000001AF560D5F30>},
>>> print( inst0[1,0].xy0 )
array([300, 100])

Public Data Attributes:

libname

The library name of the object.

cellname

The cellname of the instance object.

viewname

The view name of the instance.

shape

The mosaic shape of the instance.

unit_size

The array unit size for the object.

transform

The attribute of the object that defines its transformation (rotation and mirroring).

pins

Dictionary of pins belonging to the object.

p

Alias of pins.

xy

Retrive x,y coordinate values of the object.

xy0

The x,y coordinates of the primary corner of the object.

xy1

The x,y coordinates of the secondary corner of the object.

size

The size of the object ([self.width, self.height]).

pitch

The pitch between unit objects in the array.

spacing

Spacing between unit object of the object in array.

bbox

The physical bounding box of the object.

height

The height of the object.

width

The width of the object.

height_vec

The height direction vector [0, self.height] of the object.

width_vec

The width direction vector [self.width, 0] of the object.

Inherited from IterablePhysicalObject

elements

Numpy array containing its element objects.

xy

Retrive x,y coordinate values of the object.

shape

Array size of the object.

Inherited from PhysicalObject

name

Object name.

xy

Physical coordinate values of the object in the form of [bottom_left, top_right].

master

Master ojbect for current object (for arrays and pins).

params

Dictionary storing the parameters associated with the object

pointers

The dictionary containing the key-value pairs of the major physical coordinates of the object, such as 'left', 'right', 'top', 'bottom', 'bottom_left', 'center', etc.

left

The left-center coordinate of the object.

right

The right-center coordinate of the object.

top

The top-center coordinate of the object.

bottom

The bottom-center coordinate of the object.

center

The center-center coordinate of the object.

bottom_left

The bottom-left coordinate of the object.

bottom_right

The bottom-right coordinate of the object.

top_left

The top-left coordinate of the object.

top_right

The top-right coordinate of the object.

bbox

The physical bounding box of the object.

Public Methods:

get_p()

set_p(val)

get_pitch()

numpy.ndarray(dtype=int): Retrive the pitch of the instance.

set_pitch(value)

numpy.ndarray(dtype=int): Update the pitch of the instance.

get_spacing()

set_spacing(value)

__init__(xy, libname, cellname[, viewname, ...])

The constructor function.

summarize()

Return the summary of the object information.

update_netname(netmap)

Update the netname information for all pins belonging to this object.

Inherited from IterablePhysicalObject

__init__(xy[, name, params, elements])

The constructor function.

__getitem__(pos)

Return the sub-elements of the object, based on the pos parameter.

__setitem__(pos, item)

Update the sub-elements of the object, based on the pos and item parameters.

__iter__()

Iterator that maps directly to the elements attribute of this object.

__next__()

Iterator that maps directly to the iterator function of the elements attribute of this object.

ndenumerate()

Enumerate over the element array.

Inherited from PhysicalObject

__init__(xy[, name, params])

The constructor function.

__str__()

Return the summary of the object information.

summarize()

Return the summary of the object information.


__init__(xy, libname, cellname, viewname='layout', shape=None, pitch=None, transform='R0', unit_size=array([0, 0]), pins=None, name=None, params=None)[source]#

The constructor function.

Parameters:
  • xy (numpy.ndarray) – The primary coordinate ([x0, y0]) of the object.

  • libname (str) – The library name of the object.

  • cellname (str) – The cell name of the object.

  • shape (numpy.ndarray) – The shape [col, row] of the elements.

  • pitch (numpy.ndarray) – The pitch between unit objects in the array.

  • transform (str) – The attribute of the object that defines its transformation (rotation and mirroring).

  • unit_size (list) – The array unit size for the object.

  • pins (dict) – Dictionary of pins belonging to the object.

  • name (str) – Object name.

  • params (dict) – (optional) Dictionary storing the parameters associated with the object.

Returns:

Instance

Return type:

The constructed Instance object.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> print(inst0)
<laygo2.object.physical.Instance object at 0x000001AF458AF8E0>
    name: I0,
    class: Instance,
    xy: [100, 100],
    params: None,
    size: [500, 300],
    shape: [3, 2],
    pitch: [200, 200],
    transform: R0,
    pins: {'in': <laygo2.object.physical.Pin object at 0x000001AF560D6170>,
           'out': <laygo2.object.physical.Pin object at 0x000001AF560D5F30>},
>>> print( inst0[1,0].xy0 )
array([300, 100])
_images/object_physical_instance_init.png
_get_xy()[source]#

numpy.ndarray(dtype=numpy.int): Retrive x,y coordinate values of the object.

_set_xy(value)[source]#

numpy.ndarray(dtype=numpy.int): Update x,y coordinates of the object.

_update_elements(xy_ofst)#

Update the xy coordinates of the elements of this object, used internally by the _set_xy() function.

_update_pins(xy_ofst)[source]#

Internal function to update x,y coordinates of the object’s pins. Used as part of _set_xy().

_update_pointers()#

The internal function that updates the object’s pointers after a change in its physical coordinates.

get_p()[source]#
get_pitch()[source]#

numpy.ndarray(dtype=int): Retrive the pitch of the instance.

get_spacing()[source]#
ndenumerate()#

Enumerate over the element array. Calls np.ndenumerate() of the elements of this object.

set_p(val)[source]#
set_pitch(value)[source]#

numpy.ndarray(dtype=int): Update the pitch of the instance.

set_spacing(value)[source]#
summarize()[source]#

Return the summary of the object information.

update_netname(netmap: dict)[source]#

Update the netname information for all pins belonging to this object.

_pitch = None#

The internal variable for self.pitch.

Type:

np.array([int, int]) or None

_xy = array([0, 0])#

The x and y coordinate values stored within.

Type:

numpy.ndarray(dtype=numpy.int)

property bbox#

The physical bounding box of the object.

bottom = None#

The bottom-center coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.top
array([100,   0])
_images/object_physical_PhysicalObject_bottom.png
Type:

numpy.ndarray

bottom_left = None#

The bottom-left coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.bottom_left
array([  0,   0])
_images/object_physical_PhysicalObject_bottom_left.png
Type:

numpy.ndarray

bottom_right = None#

The bottom-right coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.bottom_right
array([200,   0])
_images/object_physical_PhysicalObject_bottom_right.png
Type:

numpy.ndarray

cellname = None#

The cellname of the instance object.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.cellname
'mycell'
_images/object_physical_instance_cellname.png
Type:

str

center = None#

The center-center coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.center
array([100, 100])
_images/object_physical_PhysicalObject_center.png
Type:

numpy.ndarray

elements = None#

Numpy array containing its element objects.

Example

>>> import laygo2
>>> phy0 = laygo2.object.physical.PhysicalObject(xy=[[0, 0], [100, 100]])
>>> phy1 = laygo2.object.physical.PhysicalObject(xy=[[0, 0], [200, 200]])
>>> phy2 = laygo2.object.physical.PhysicalObject(xy=[[0, 0], [300, 300]])
>>> element = [phy0, phy1, phy2]
>>> iphy0 = laygo2.object.physical.IterablePhysicalObject(
        xy=[[0, 0], [300, 300]], elements = elements)
>>> iphy0.elements
array([<laygo2.object.physical.PhysicalObject object at 0x000002049A77FDF0>,
       <laygo2.object.physical.PhysicalObject object at 0x000002049A77F3D0>,
       <laygo2.object.physical.PhysicalObject object at 0x000002049A77FF40>],
      dtype=object)
Type:

dict

property height#

The height of the object.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.height
300
_images/object_physical_instance_height.png
Type:

int

property height_vec#

The height direction vector [0, self.height] of the object.

Type:

numpy.ndarray(dtype=int)

left = None#

The left-center coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.left
array([  0, 100])
_images/object_physical_PhysicalObject_left.png
Type:

numpy.ndarray

libname = None#

The library name of the object.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.libname
'mylib'
_images/object_physical_instance_libname.png
Type:

str

master = None#

Master ojbect for current object (for arrays and pins).

Example

>>> import laygo2
>>> obj1 = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]],
        name="test1", params=None)
>>> obj2 = laygo2.object.physical.Pin(xy = [[0, 0], [100, 100]],
        layer = ["M1", "drawing"], master=obj1)
>>> obj2.master
<laygo2.object.physical.PhysicalObject object at 0x00000204AAF3C7C0>
Type:

numpy.ndarray

name = None#

Object name.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]],
        name="test", params={'maxI': 0.005})
>>> obj.name
“test”
_images/object_physical_PhysicalObject_name.png
Type:

str

property p#

Alias of pins.

Type:

str

params = None#

Dictionary storing the parameters associated with the object

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]],
        name="test", params={'maxI': 0.005})
>>> obj.params
{‘maxI’: 0.005 }
Type:

dict

pins = None#

Dictionary of pins belonging to the object.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.pins
{'in': <laygo2.object.physical.Pin object at 0x000001CA76EE1348>,
'out': <laygo2.object.physical.Pin object at 0x000001CA7709BD48>}
>>> inst0.pins["in"].shape
array([3, 2])
>>> inst0.pins["out"].shape
array([3, 2] )
>>> inst0.pins["in"][1, 1].xy
array([[300, 300], [310, 310]])
_images/object_physical_instance_pins.png
Type:

dict

property pitch#

The pitch between unit objects in the array.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.pitch
array([200, 200])
_images/object_physical_instance_pitch.png

See also

Instance.spacing

Type:

numpy.ndarray

pointers = None#

The dictionary containing the key-value pairs of the major physical coordinates of the object, such as ‘left’, ‘right’, ‘top’, ‘bottom’, ‘bottom_left’, ‘center’, etc.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.pointers
{'left': array([0, 100]), 'right': array([200, 100]),
 'bottom': array([100, 0]), 'top': array([100, 200]),
 'bottom_left': array([0, 0]), 'bottom_right': array([200, 0]),
 'top_left': array([0, 200]), 'top_right': array([200, 200]),
 ‘center’: array( [100, 100] )
}
_images/object_physical_PhysicalObject_pointers.png
Type:

dict

right = None#

The right-center coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.right
array([200, 100])
_images/object_physical_PhysicalObject_right.png
Type:

numpy.ndarray

shape = None#

The mosaic shape of the instance. None if the instance is non-mosaic.

Type:

np.array([int, int]) or None

property size#

The size of the object ([self.width, self.height]).

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.size
array([500, 300])
_images/object_physical_instance_size.png
Type:

numpy.ndarray

property spacing#

Spacing between unit object of the object in array.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.spacing
array([200, 200])
_images/object_physical_instance_spacing.png

See also

Instance.pitch

Type:

numpy.ndarray

top = None#

The top-center coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.top
array([100, 200])
_images/object_physical_PhysicalObject_top.png
Type:

numpy.ndarray

top_left = None#

The top-left coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.top_left
array([  0, 200])
_images/object_physical_PhysicalObject_top_left.png
Type:

numpy.ndarray

top_right = None#

The top-right coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.top_right
array([200, 200])
_images/object_physical_PhysicalObject_top_right.png
Type:

numpy.ndarray

transform = 'R0'#

The attribute of the object that defines its transformation (rotation and mirroring).

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.transform
"R0"
_images/object_physical_instance_transform.png
Type:

str

unit_size = None#

The array unit size for the object.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.unit_size
array([100, 100])
_images/object_physical_instance_unit_size.png
Type:

numpy.ndarray

viewname = None#

The view name of the instance.

Type:

str

property width#

The width of the object.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.width
500
_images/object_physical_instance_width.png
Type:

int

property width_vec#

The width direction vector [self.width, 0] of the object.

Type:

numpy.ndarray(dtype=int)

property xy#

Retrive x,y coordinate values of the object.

Type:

numpy.ndarray(dtype=numpy.int)

property xy0#

The x,y coordinates of the primary corner of the object.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.xy0
array([100, 100])
_images/object_physical_instance_xy0.png
Type:

numpy.ndarray

property xy1#

The x,y coordinates of the secondary corner of the object.

Example

>>> import laygo2
>>> inst0_pins = dict()
>>> inst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10,10]],
        layer = ['M1', 'drawing'], netname = 'in')
>>> inst0_pins['out']= laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]],
        layer=['M1', 'drawing'], netname='out')
>>> inst0 = laygo2.object.physical.Instance(name="I0", xy=[100,100],
        libname="mylib", cellname="mycell", shape=[3, 2], pitch=[200,200],
        unit_size=[100, 100], pins=inst0_pins, transform='R0')
>>> inst0.xy1
array([600, 400])
_images/object_physical_instance_xy1.png
Type:

numpy.ndarray