LUCEDA IPKISS Tutorial 77:在版图一定范围内填充dummy

案例分享:在给定的Shape内填充dummy
在这里插入图片描述
所有代码如下:

from si_fab import all as pdk
from ipkiss3 import all as i3
from shapely.geometry import Polygon, MultiPolygon
import numpy as np
import matplotlib.pyplot as plt

class CellFilledWithContacts(i3.PCell):
    contact_size = i3.PositiveNumberProperty(default=1.5, doc="width and height of the contact box")
    contact_pitch = i3.PositiveNumberProperty(default=2, doc="contact pitch")

    class Layout(i3.LayoutView):
        def _generate_elements(self, elems):
            elems += i3.Boundary(
                layer=i3.TECH.PPLAYER.SI,
                shape=[(0, 0), (7.7, -23.7),
                       (32.6, -23.7), (12.4, -38.4),
                       (20.1, -62.1), (0, -47.4),
                       (-20.1, -62.1), (-12.4, -38.4),
                       (-32.6, -23.7), (-7.7, -23.7)]
            )
            s = elems.size_info()
            polygons = [Polygon(el.shape) for el in elems]
            region = MultiPolygon(polygons).buffer(-2.0)

            plt.show()
            no_of_contacts_row = int((s.east - s.west - self.contact_pitch) / self.contact_pitch)
            no_of_contacts_col = int((s.north - s.south - self.contact_pitch) / self.contact_pitch)
            print('number of contacts in each row of along the whole cell =', no_of_contacts_row)
            print('number of contacts in each column of along the whole cell =', no_of_contacts_col)

            contact_regions = []

            # set the x and y coordinates for each contact via a for-loop
            for cnt, i in enumerate(np.linspace(s.west, s.east, no_of_contacts_row)):
                for cn, j in enumerate(np.linspace(s.north, s.south, no_of_contacts_col)):
                    contact = i3.Rectangle(layer=i3.TECH.PPLAYER.SI,
                                           center=(i, j),
                                           box_size=(self.contact_size, self.contact_size)
                                           )

                    contact_region = Polygon(contact.shape)
                    contact_regions.append(contact_region)

                    # only add the contacts when they are not in the cell
                    if contact_region.intersects(region):
                        elems += contact
            return elems


if __name__ == '__main__':
    lay = CellFilledWithContacts().Layout()
    lay.write_gdsii("demo.gds")

dummy的大小可以调节:

    contact_size = i3.PositiveNumberProperty(default=1.5, doc="width and height of the contact box")
    contact_pitch = i3.PositiveNumberProperty(default=2, doc="contact pitch")

可以通过:

shape=[(0, 0), (7.7, -23.7),
   (32.6, -23.7), (12.4, -38.4),
   (20.1, -62.1), (0, -47.4),
   (-20.1, -62.1), (-12.4, -38.4),
   (-32.6, -23.7), (-7.7, -23.7)]

来调节shape

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值