ipkiss中的器件至少得包含版图和端口,通过GDSCell函数导入版图文件再加上端口,就可以搭建一个简单的器件:
如,已有版图文件 mmi.gds:
通过代码:
from si_fab import all as pdk
from ipkiss3 import all as i3class mmi1x2(i3.GDSCell):tt = i3.TraceTemplateProperty(default=pdk.SWG450())def _default_filename(self):return 'mmi.gds'class Layout(i3.GDSCell.Layout):def _generate_ports(self, ports):ports += i3.OpticalPort(name="in",position=(-5, 0), angle=180.0,trace_template=self.tt)ports += i3.OpticalPort(name="out1",position=(25, -1.0), angle=0.0,trace_template=self.tt)ports += i3.OpticalPort(name="out2",position=(25, 1.0), angle=0.0,trace_template=self.tt)return portsclass Netlist(i3.NetlistFromLayout):passif __name__ == '__main__':mmi1x2().Layout().visualize(annotate=True)
加上ports和Netlist,就可以得到一个可以在ipkiss中画版的mmi: