PlacementGrid class#
- class laygo2.object.grid.PlacementGrid(name, vgrid, hgrid)[source]#
Bases:
laygo2.object.grid.core.Grid
PlacementGrid class implements a grid for placement of Instance and VirtualInstance objects.
Notes
- (Korean) PlacementGrid 클래스는 Instance 및 VirtualInstance 개체들의
배치를 위한 격자 그리드를 구현한다.
Public Data Attributes:
Type of grid.
Inherited from
Grid
the name of the grid.
return elements of subgrids ([_xy[0].elements, _xy[1].elements]).
PhyToAbsGridConverter(master=self)
AbsToPhyGridConverter(master=self)
Two-dimensional _AbsToPhyConverter of a coordinate system.
One-dimensional _AbsToPhyGridConverter
One-dimensional _AbsToPhyGridConverter of the y-coordinate system.
OneDimGrid of the x-coordinate system (=self.x).
OneDimGrid of the y-coordinate system (=self.y).
Two-dimensional _PhyToAbsConverter of a coordinate system.
One-dimensional _PhyToAbsConverter of the x-coordinate system.
One-dimensional _PhyToAbsConverter of
Two-dimensional element length in a coordinate system.
Width of the region in which the coordinate system is defined.
Height of the region in which the coordinate system is defined.
Return the height vector [0, h].
Return width as a list.
Public Methods:
place
(inst, mn)Place the instance on the specified coordinate mn, on this grid.
Inherited from
Grid
set_range
(value)__init__
(name, vgrid, hgrid)Constructor function of Grid class.
__getitem__
(pos)__eq__
(other)Return the physical grid coordinate that matches to other.
__lt__
(other)Return the index of the grid coordinate that is the largest but less than other.
__le__
(other)Return the index of the grid coordinate that is the largest but less than or equal to other.
__gt__
(other)Return the index of the grid coordinate that is the smallest but greater than other.
__ge__
(other)Return the index of the grid coordinate that is the smallest but greater than or equal to other.
bbox
(obj)Return the abstract grid coordinates corresponding to the 'internal' bounding box of obj.
bottom_left
(obj)Return the abstract grid coordinates corresponding to the bottom-left corner of obj.
bottom_right
(obj)Return the abstract grid coordinates corresponding to the bottom-right corner of obj.
top_left
(obj)Return the abstract grid coordinates corresponding to the top-left corner of obj.
top_right
(obj)Return the abstract grid coordinates corresponding to the top-right corner of obj.
crossing
(*args)Return the abstract grid coordinates corresponding to the crossing point of args.
overlap
(*args[, type])Return the abstract grid coordinates corresponding to the overlap of args.
union
(*args)Return the abstract grid coordinates corresponding to union of args.
center
(obj)Return the abstract grid coordinates corresponding to the center point of obj.
left
(obj)Return the abstract grid coordinates corresponding to the left point of obj.
right
(obj)Return the abstract grid coordinates corresponding to the right point of obj.
top
(obj)Return the abstract grid coordinates corresponding to the top point of obj.
bottom
(obj)Return the abstract grid coordinates corresponding to the bottom point of obj.
copy
()Make a copy of the current Grid object
vflip
([copy])Flip the grid in vertical direction.
hflip
([copy])Flip the grid in horizontal direction.
vstack
(obj[, copy])Stack grid(s) on top of the current grid in vertical direction.
hstack
(obj[, copy])Stack grid(s) on top of the current grid in horizontal direction.
__iter__
()__next__
()__str__
()Return the string representation of the object.
Output the information of the respective grid.
- __init__(name, vgrid, hgrid)#
Constructor function of Grid class.
- Parameters
name (str) –
vgrid (laygo2.object.grid.OndDimGrid) – OneDimGrid object of the x-coordinate system
hgrid (laygo2.object.grid.OndDimGrid) – OneDimGrid object of the y-coordinate system
- Return type
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> print(g2) <laygo2.object.grid.Grid object> name: test, class: Grid, scope: [[0, 0], [100, 100]], elements: [array([ 0, 10, 20, 40, 50]), array([10, 20, 40, 50, 60])
Notes
(Korean) Grid 클래스의 생성자함수. 파라미터
name(str): 이름
vgrid(laygo2.OneDimGrid): x좌표계 OneDimGrid 객체
hgrid(laygo2.OneDimGrid): y좌표계 OneDimGrid 객체
- 반환값
laygo2.Grid
- _get_hgrid()#
- _get_vgrid()#
- _set_hgrid(value)#
- _set_vgrid(value)#
- bbox(obj)#
Return the abstract grid coordinates corresponding to the ‘internal’ bounding box of obj.
See also
_PhyToAbsGridConverter.bbox
- bottom(obj)#
Return the abstract grid coordinates corresponding to the bottom point of obj.
- bottom_left(obj)#
Return the abstract grid coordinates corresponding to the bottom-left corner of obj.
See also
_PhyToAbsGridConverter.bottom_left
- bottom_right(obj)#
Return the abstract grid coordinates corresponding to the bottom-right corner of obj.
See also
_PhyToAbsGridConverter.bottom_right
- center(obj)#
Return the abstract grid coordinates corresponding to the center point of obj.
- Parameters
obj (laygo2.object.physical.PhysicalObject) – The object of which center coordinate is computed.
See also
laygo2.object.grid._PhyToAbsGridConverter.center
- copy()#
Make a copy of the current Grid object
- Returns
laygo2.object.grid.Grid
- Return type
the copied Grid object.
See also
- crossing(*args)#
Return the abstract grid coordinates corresponding to the crossing point of args.
See also
laygo2.object.grid._PhyToAbsGridConverter.crossing
- get_range()#
- hflip(copy=True)#
Flip the grid in horizontal direction.
- Parameters
copy (optional, boolean) – If True, make a copy and flip the copied grid (default). If False, flip the current grid object.
- Returns
laygo2.object.grid.Grid
- Return type
the flipped Grid object.
See also
- hstack(obj, copy=True)#
Stack grid(s) on top of the current grid in horizontal direction.
- left(obj)#
Return the abstract grid coordinates corresponding to the left point of obj.
- overlap(*args, type='bbox')#
Return the abstract grid coordinates corresponding to the overlap of args.
See also
laygo2.object.grid._PhyToAbsGridConverter.overlap
- place(inst, mn)[source]#
Place the instance on the specified coordinate mn, on this grid.
- Parameters
inst (laygo2.object.physical.Instance or laygo2.object.physical.VirtualInstance) – The instance to be placed on the grid.
mn (numpy.ndarray or list) – The abstract coordinate [m, n] to place the instance.
- Returns
laygo2.object.physical.Instance or
laygo2.object.physical.VirtualInstance – The placed instance.
Example
>>> import laygo2 >>> from laygo2.object.grid import OneDimGrid, PlacementGrid >>> 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 an instance >>> # >>> i0 = Instance(libname="tlib", cellname="t0", name="I0", xy=[0, 0]) >>> print(inst0.xy) [100, 100] >>> # >>> # Place the created instance >>> # >>> g.place(inst=i0, mn=[10,10]) >>> # Print parameters of the placed instance. >>> print(i0.xy) [200, 1000]
Notes
- (Korean) 인스턴스 xy속성에 추상좌표를 매핑함.
파라미터 - inst(laygo2.physical.instance): 배치할 인스턴스 - mn(numpy.ndarray or list): 인스턴스를 배치할 추상좌표 반환값 - laygo2.physical.instance: 좌표가 수정된 인스턴스
- right(obj)#
Return the abstract grid coordinates corresponding to the right point of obj.
- set_range(value)#
- summarize()#
Output the information of the respective grid.
- Parameters
None –
- Return type
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.summarize() <laygo2.object.grid.Grid object> name: test, class: Grid, scope: [[0, 0], [100, 100]], elements: [array([ 0, 10, 20, 40, 50]), array([10, 20, 40, 50, 60])
Notes
(Korean) 해당 Grid의 정보 출력.
- top(obj)#
Return the abstract grid coordinates corresponding to the top point of obj.
- top_left(obj)#
Return the abstract grid coordinates corresponding to the top-left corner of obj.
See also
_PhyToAbsGridConverter.top_left
- top_right(obj)#
Return the abstract grid coordinates corresponding to the top-right corner of obj.
See also
_PhyToAbsGridConverter.top_right
- union(*args)#
Return the abstract grid coordinates corresponding to union of args.
See also
laygo2.object.grid._PhyToAbsGridConverter.union
- vflip(copy=True)#
Flip the grid in vertical direction.
- Parameters
copy (optional, boolean) – If True, make a copy and flip the copied grid (default). If False, flip the current grid object.
- Returns
laygo2.object.grid.Grid
- Return type
the flipped Grid object.
See also
- vstack(obj, copy=True)#
Stack grid(s) on top of the current grid in vertical direction.
- _xy = None#
the list contains the 1d-grid objects for x and y axes.
- Type
List[OneDimGrid]
- abs2phy = None#
AbsToPhyGridConverter(master=self)
- property h#
OneDimGrid of the y-coordinate system (=self.y).
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.h g1_y
Notes
(Korean) y좌표계 OneDimGrid.
- Type
- property height#
Height of the region in which the coordinate system is defined.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.height 100
Notes
(Korean) 좌표계가 정의된 영역의 높이.
- Type
numpy.int32
- property height_vec#
Return the height vector [0, h].
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.height_vec [0, 100]
Notes
(Korean) height를 list로 반환.
- Type
- property hgrid#
- property m#
One-dimensional _PhyToAbsConverter of the x-coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.n[40] 2 >>> g2.n(40) 2 >>> g2.n < 40 760 >>> g2.n <= 40 810 >>> g2.n > 40 820 >>> g2.n >= 40 810
Notes
(Korean) x좌표계 1차원 _PhyToAbsConverter.
- Type
_PhyToAbsGridConverter
- property mn#
Two-dimensional _PhyToAbsConverter of a coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.mn[40,40] [3, 2] >>> g2.mn([40, 40]) [3, 2] >>> g2.mn < [40,40] [750, 760] >>> g2.mn <= [40,40] [800, 810] >>> g2.mn > [40,40] [810, 820] >>> g2.mn >= [40,40] [800, 810]
Notes
(Korean) 좌표계 2차원 _PhyToAbsConverter.
- Type
laygo2._PhyToAbsGridConverter
- property n#
- One-dimensional _PhyToAbsConverter of
the y-coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.n[40] 2 >>> g2.n(40) 2 >>> g2.n < 40 760 >>> g2.n <= 40 810 >>> g2.n > 40 820 >>> g2.n >= 40 810
Notes
(Korean) y좌표계 1차원 _PhyToAbsConverter.
- Type
_PhyToAbsGridConverter
- phy2abs = None#
PhyToAbsGridConverter(master=self)
- property range#
- property shape#
- Two-dimensional element length in a coordinate system.
length of x-axis elements, length of y-axis elements
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.shape [5, 5]
Notes
(Korean) 좌표게 2차원 element의 길이.
- Type
- type = 'placement'#
Type of grid. Should be ‘placement’ for placement grids.
- property v#
OneDimGrid of the x-coordinate system (=self.x).
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.v g1_x
Notes
(Korean) x좌표계 OneDimGrid.
- Type
- property vgrid#
- property width#
- Width of the region in which the coordinate system is defined.
x scope
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.width 100
Notes
(Korean) 좌표계가 정의된 영역의 폭.
- Type
numpy.int32
- property width_vec#
- Return width as a list.
length of the respective axis and zero
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.width_vec [100, 0]
Notes
(Korean) width를 list로 반환.
- Type
- property x#
- One-dimensional _AbsToPhyGridConverter
of the x-coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.x[10] 200 >>> g2.x < 10 [0] >>> g2.x <= 10 [1] >>> g2.x > 10 [2] >>> g2.x >= 10 [1]
Notes
(Korean) x좌표계 1차원 _AbsToPhyGridConverter.
- Type
_AbsToPhyGridConverter
- property xy#
Two-dimensional _AbsToPhyConverter of a coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.xy[10,10] [200 210] >>> g2.xy([10, 10]) [200 210] >>> g2.xy < [10,10] [0,-1] >>> g2.xy <= [10,10] [1,0] >>> g2.xy > [10,10] [2,1] >>> g2.xy >= [10,10] [1,0]
Notes
(Korean) 2차원 _AbsToPhyConverter.
- Type
_AbsToPhyGridConverter
- property y#
One-dimensional _AbsToPhyGridConverter of the y-coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.y[10] 210 >>> g2.y < 10 [-1] >>> g2.y <= 10 [0] >>> g2.y > 10 [1] >>> g2.y >= 10 [0]
Notes
(Korean) y좌표계 1차원 _AbsToPhyGridConverter.
- Type
_AbsToPhyGridConverter