当前位置: 首页 > article >正文

luceda ipkiss教程 63:器件端口延伸ExtendPorts

案例分享:通过picazzo3库中的ExtendPorts函数实现器件的端口延伸
如:
在这里插入图片描述
所有代码如下:

from si_fab import all as pdk
from ipkiss3 import all as i3
from picazzo3.container.extend_ports import ExtendPorts


# Building the MMI PCell with properties that describe its geometry
class MMI2x2(i3.PCell):
    """MMI with 2 input and 2 outputs."""

    _name_prefix = "MMI2x2"
    trace_template = i3.TraceTemplateProperty(
        doc="Trace template of the access waveguide"
    )
    width = i3.PositiveNumberProperty(default=4.0, doc="Width of the MMI section.")
    length = i3.PositiveNumberProperty(default=20.0, doc="Length of the MMI secion.")
    taper_width = i3.PositiveNumberProperty(default=1.0, doc="Width of the taper.")
    taper_length = i3.PositiveNumberProperty(default=5.0, doc="Length of the taper")
    waveguide_spacing = i3.PositiveNumberProperty(
        default=2.0, doc="Spacing between the waveguides."
    )

    def _default_trace_template(self):
        return pdk.SiWireWaveguideTemplate()

    class Layout(i3.LayoutView):
        def _generate_elements(self, elems):
            length = self.length
            width = self.width
            taper_length = self.taper_length
            taper_width = self.taper_width
            half_waveguide_spacing = 0.5 * self.waveguide_spacing
            core_layer = self.trace_template.core_layer
            cladding_layer = self.trace_template.cladding_layer
            core_width = self.trace_template.core_width

            # Si core
            elems += i3.Rectangle(
                layer=core_layer,
                center=(0.5 * length, 0.0),
                box_size=(length, width),
            )
            elems += i3.Wedge(
                layer=core_layer,
                begin_coord=(-taper_length, -half_waveguide_spacing),
                end_coord=(0.0, -half_waveguide_spacing),
                begin_width=core_width,
                end_width=taper_width,
            )
            elems += i3.Wedge(
                layer=core_layer,
                begin_coord=(-taper_length, half_waveguide_spacing),
                end_coord=(0.0, half_waveguide_spacing),
                begin_width=core_width,
                end_width=taper_width,
            )
            elems += i3.Wedge(
                layer=core_layer,
                begin_coord=(length, half_waveguide_spacing),
                end_coord=(length + taper_length, half_waveguide_spacing),
                begin_width=taper_width,
                end_width=core_width,
            )
            elems += i3.Wedge(
                layer=core_layer,
                begin_coord=(length, -half_waveguide_spacing),
                end_coord=(length + taper_length, -half_waveguide_spacing),
                begin_width=taper_width,
                end_width=core_width,
            )

            # Cladding
            elems += i3.Rectangle(
                layer=cladding_layer,
                center=(0.5 * length, 0.0),
                box_size=(length + 2 * taper_length, width + 2.0),
            )
            return elems

        def _generate_ports(self, ports):
            length = self.length
            taper_length = self.taper_length
            trace_template = self.trace_template
            half_waveguide_spacing = 0.5 * self.waveguide_spacing

            ports += i3.OpticalPort(
                name="in1",
                position=(-taper_length, -half_waveguide_spacing),
                angle=180.0,
                trace_template=trace_template,
            )
            ports += i3.OpticalPort(
                name="in2",
                position=(-taper_length, half_waveguide_spacing),
                angle=180.0,
                trace_template=trace_template,
            )
            ports += i3.OpticalPort(
                name="out1",
                position=(length + taper_length, -half_waveguide_spacing),
                angle=0.0,
                trace_template=trace_template,
            )
            ports += i3.OpticalPort(
                name="out2",
                position=(length + taper_length, half_waveguide_spacing),
                angle=0.0,
                trace_template=trace_template,
            )
            return ports


if __name__ == "__main__":
    port_labels = ["in1", "in2", "out1", "out2"]
    my_container = ExtendPorts(
        contents=MMI2x2(), port_labels=port_labels, auto_transition=True
    )
    layout = my_container.Layout(extension_length=10.0, area_layer_on=False)
    layout.visualize()

通过:

port_labels = ["in1", "in2", "out1", "out2"]

可以选择需要延伸的端口,如;

port_labels = ["in2", "out1"]

在这里插入图片描述


http://www.kler.cn/a/273195.html

相关文章:

  • Unity 使用Netcode实现用户登录和登出
  • 2024年11月4日Github流行趋势
  • 【C/C++】【三种方法】模拟实现strlen
  • iOS应用想要下载到手机上只能苹果签名吗?
  • Java面向对象 C语言字符串常量
  • PHP合成图片,生成海报图,poster-editor使用说明
  • C++——字符串、读写文件、结构体、枚举
  • 【人工智能】英文学习材料03(每日一句)
  • 【字符串算法题】541. 反转字符串 II
  • es 聚合操作(二)
  • openstack迁移虚拟机--来自gpt
  • kerberos验证协议安装配置使用
  • 6语言交易所/多语言交易所php源码/微盘PHP源码
  • 数据结构 二叉树 力扣例题AC——代码以及思路记录
  • 由浅到深认识C语言(13):共用体
  • 分享一个不错的three.js开源项目
  • 鸿蒙 Harmony 初体验
  • Linux——动静态库的制作及使用与动态库原理
  • hadoop分布式环境搭建
  • 【Datawhale组队学习:Sora原理与技术实战】使用KAN-TTS合成女生沪语音频
  • 【华为OD机试】找座位【C卷|100分】
  • 代码随想录阅读笔记-哈希表【四数之和】
  • http协议的历史与基本概念
  • 第四百一十回
  • 【现代C++】移动语义和右值引用
  • JAVA八股文面经问题整理第6弹