VirtualInstance class#
- class laygo2.object.physical.VirtualInstance(xy, libname, cellname, native_elements, viewname='layout', shape=None, pitch=None, transform='R0', unit_size=array([0, 0]), pins=None, name=None, params=None)[source]#
Bases:
laygo2.object.physical.Instance
The VirtualInstance class implements functions for a group of objects to be treated as a single instance with dedicated dimensional, port, and related parameters.
Example
>>> import laygo2 >>> vinst0_pins = dict() >>> # Pin information >>> vinst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing'], netname='in') >>> vinst0_pins['out'] = laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing'], netname='out') >>> # Element information >>> native_elements = dict() >>> native_elements['R0'] = laygo2.object.physical.Rect(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing']) >>> native_elements['R1'] = laygo2.object.physical.Rect(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing']) >>> native_elements['R2'] = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]], layer=['prBoundary', 'drawing']) >>> vinst0 = laygo2.object.physical.VirtualInstance(name='I0', libname='mylib', cellname='myvcell', xy=[500, 500], native_elements=native_elements, shape=[3, 2], pitch=[100, 100], unit_size=[100, 100], pins=vinst0_pins, transform='R0') >>> vinst0.native_elements {'R0': <laygo2.object.physical.Rect object at 0x00000204AAFCE170>, 'R1': <laygo2.object.physical.Rect object at 0x00000204AAFCEA40>, 'R2': <laygo2.object.physical.Rect object at 0x00000204AAFCE0B0>}
Notes
(Korean): VirtualInstance 객체 클래스. VirtualInstance는 여러 개의 레이아웃 오브젝트를 하나의 그룹으로 묶어 크기/포트 등의 관련된 파라미터 들을 이용해 추상화 할 수 있는 객체를 구현한다.
Public Data Attributes:
Dictionary that holds the physical element entities
Inherited from
Instance
The library name of the object.
The cellname of the instance object.
The view name of the instance.
The mosaic shape of the instance.
The array unit size for the object.
The attribute of the object that defines its transformation (rotation and mirroring).
Dictionary of pins belonging to the object.
Retrive x,y coordinate values of the object.
The x,y coordinates of the primary corner of the object.
The x,y coordinates of the secondary corner of the object.
The size of the object ([self.width, self.height]).
Retrive the pitch of the instance.
The physical bounding box of the object.
The height of the object.
The width of the object.
The height direction vector [0, self.height] of the object.
The width direction vector [self.width, 0] of the object.
Inherited from
IterablePhysicalObject
Numpy array containing its element objects.
Retrive x,y coordinate values of the object.
The mosaic shape of the instance.
Inherited from
PhysicalObject
Object name.
Retrive x,y coordinate values of the object.
Master ojbect for current object (for arrays and pins).
Dictionary storing the parameters associated with the object
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.
The left-center coordinate of the object.
The right-center coordinate of the object.
The top-center coordinate of the object.
The bottom-center coordinate of the object.
The center-center coordinate of the object.
The bottom-left coordinate of the object.
The bottom-right coordinate of the object.
The top-left coordinate of the object.
The top-right coordinate of the object.
The physical bounding box of the object.
Public Methods:
__init__
(xy, libname, cellname, native_elements)The constructor function.
Return the summary of the object information.
get_element_position
(obj)Get x,y coordinates of the element obj (which belongs to the object) relative to the origin (0, 0).
Inherited from
Instance
numpy.ndarray(dtype=int): Retrive the pitch of the instance.
set_pitch
(value)numpy.ndarray(dtype=int): Update the pitch of the instance.
set_spacing
(value)__init__
(xy, libname, cellname, native_elements)The constructor function.
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, libname, cellname, native_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.
Enumerate over the element array.
Inherited from
PhysicalObject
__init__
(xy, libname, cellname, native_elements)The constructor function.
__str__
()Return the summary of the object information.
Return the summary of the object information.
- __init__(xy, libname, cellname, native_elements, 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) – Physical coordinate values of the object in the form of [bottom_left, top_right].
libname (str) – The library name of the object.
cellname (str) – The cell name of the object.
native_elements (dict) – Dictionary that holds the physical element entities of the VirtualInstance 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) – Unit size of object.
pins (dict) – The array unit size for the object.
name (str) – Object name.
params (dict) – (optional) Dictionary storing the parameters associated with the object.
- Returns
laygo2.VirtualInstance
- Return type
The constructed VirtualInstance object.
See also
Example
>>> import laygo2 >>> vinst0_pins = dict() >>> # Pin information >>> vinst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing'], netname='in') >>> vinst0_pins['out'] = laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing'], netname='out') >>> # Element information >>> native_elements = dict() >>> native_elements['R0'] = laygo2.object.physical.Rect(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing']) >>> native_elements['R1'] = laygo2.object.physical.Rect(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing']) >>> native_elements['R2'] = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]], layer=['prBoundary', 'drawing']) >>> vinst0 = laygo2.object.physical.VirtualInstance(name='I0', libname='mylib', cellname='myvcell', xy=[500, 500], native_elements=native_elements, shape=[3, 2], pitch=[100, 100], unit_size=[100, 100], pins=vinst0_pins, transform='R0') >>> vinst0.native_elements {'R0': <laygo2.object.physical.Rect object at 0x00000204AAFCE170>, 'R1': <laygo2.object.physical.Rect object at 0x00000204AAFCEA40>, 'R2': <laygo2.object.physical.Rect object at 0x00000204AAFCE0B0>}
Notes
(Korean): VirtualInstance 클래스의 생성자.
파라미터 - xy(numpy.ndarray): 객체의 주좌표 [x0, y0]. - libname(str): 객체의 library 이름. - cellname(str): 객체의 cell이름. - native_elements(dict): 객체를 구성하는 물리 객체를 갖는 dict. - shape(numpy.ndarray): elements의 배열 크기 ([col, row]). - pitch(numpy.ndarray): 배열로 구성된 객체의 하위 객체 (element)간의 간격. - transform(str): 객체의 변환 속성 (R0, MX, MY 등). - unit_size(list): 객체의 단위 크기. - pins(dict): 객체에 속한 핀들을 갖는 dict. - name(str): 객체의 이름. - params(dict): 객체의 주요 속성을 갖는 dict.
- _get_xy()#
numpy.ndarray(dtype=numpy.int): Retrive x,y coordinate values of the object.
- _set_xy(value)#
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)#
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_element_position(obj)[source]#
Get x,y coordinates of the element obj (which belongs to the object) relative to the origin (0, 0).
- Parameters
obj (element) – The element belongs to the object.
- get_pitch()#
numpy.ndarray(dtype=int): Retrive the pitch of the instance.
- get_spacing()#
- ndenumerate()#
Enumerate over the element array. Calls np.ndenumerate() of the elements of this object.
- set_pitch(value)#
numpy.ndarray(dtype=int): Update the pitch of the instance.
- set_spacing(value)#
- _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])
- Type
- 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])
- Type
- 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])
- Type
- 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'
Notes
(Korean): 객체가 속한 셀 이름.
- Type
- 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])
- Type
- 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)
Notes
(Korean): 객체의 하위 구성원을 담고 있는 list.
- Type
- 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
Notes
(Korean): 객체의 높이.
- Type
- 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])
- Type
- 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'
Notes
(Korean): 객체의 라이브러리 이름.
- Type
- 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>
Notes
(Korean): 객체의 master (배열 element 또는 pin 객체들의 master 객체에 연결).
- Type
- 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”
- Type
- native_elements = None#
- Dictionary that holds the physical element entities
of the VirtualInstance object.
Example
>>> import laygo2 >>> vinst0_pins = dict() >>> # Pin information >>> vinst0_pins['in'] = laygo2.object.physical.Pin(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing'], netname='in') >>> vinst0_pins['out'] = laygo2.object.physical.Pin(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing'], netname='out') >>> # Element information >>> native_elements = dict() >>> native_elements['R0'] = laygo2.object.physical.Rect(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing']) >>> native_elements['R1'] = laygo2.object.physical.Rect(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing']) >>> native_elements['R2'] = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]], layer=['prBoundary', 'drawing']) >>> vinst0 = laygo2.object.physical.VirtualInstance(name='I0', libname='mylib', cellname='myvcell', xy=[500, 500], native_elements=native_elements, shape=[3, 2], pitch=[100, 100], unit_size=[100, 100], pins=vinst0_pins, transform='R0') >>> vinst0.native_elements {'R0': <laygo2.object.physical.Rect object at 0x00000204AAFCE170>, 'R1': <laygo2.object.physical.Rect object at 0x00000204AAFCEA40>, 'R2': <laygo2.object.physical.Rect object at 0x00000204AAFCE0B0>}
Notes
(Korean): 객체를 구성하는 하위 물리 객체들(Rect, Path, Pin, Text, Instance 등)을 갖고 있는 dict.
- Type
- 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 }
Notes
(Korean): 객체의 속성.
- Type
- 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]])
Notes
(Korean): 객체에 속한 핀들을 갖는 dict.
- Type
- property pitch#
Retrive the pitch of the instance.
- Type
numpy.ndarray(dtype=int)
- 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] ) }
Notes
(Korean): 객체의 주요 좌표들을 담고 있는 dictionary.
- Type
- 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])
- Type
- shape = None#
The mosaic shape of the instance. None if the instance is non-mosaic.
- 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])
Notes
(Korean): 객체의 크기 ([width, height]).
- Type
- property spacing#
- 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])
- Type
- 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])
- Type
- 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])
- Type
- 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"
Notes
(Korean): 객체의 변환 속성 (R0, MX, MY 등).
- Type
- 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])
Notes
(Korean): 객체가 배열로 구성되었을 때 단위 크기.
- Type
- 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
Notes
(Korean): 객체의 폭.
- Type
- 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])
Notes
(Korean): 객체의 주 코너 좌표.
- Type
- 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])
Notes
(Korean): 객체의 보조 코너 좌표.
- Type