在版图设计阶段,射频集成电路工程师们通常需要将Cadence所输出的GDS文件 导入到HFSS中,并进行后续建模和仿真。这个过程相当繁琐且枯燥。如若我们能用Python脚本完成GDS的全自动导入,版图设计的效率将会得到极大的提升。
本篇文章,我们将以两层金属(VM1,VM2)结构为例,介绍相关的代码实现。该代码经过极其简单的修改,即可应用于任意层数金属的情况。若有不足之处,还望大家多多指教。
在编程之前,需要大家完成下列准备工作。
| 名称 | 厚度 | 电导率 | Z坐标 | GDS Number |
|---|---|---|---|---|
| VM1 | 1.2 um | 2.5e7 | 206 um | 32 |
| VM2 | 2.3 um | 2.5e7 | 208.2 um | 38 |
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("tutorial")
oProject.InsertDesign("HFSS", "Design1", "DrivenModal", "")
GDS_no = [32, 38]
Metal = ["VM1", "VM2"]
Sigma = [2.5e7, 2.5e7]
Z = ["200.6um", "208.2um"]
t = ["1.2um", "2.3um"]
oDefinitionManager = oProject.GetDefinitionManager()
for index in len(GDS_no):
oDefinitionManager.AddMaterial(
[
"NAME:"+Metal[index],
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic"]
],
"permittivity:=" , "1",
"conductivity:=" , Sigma[index]
])
for index in range(len(GDS_no)):
oEditor.ImportGDSII(
[
"NAME:options",
"FileName:=" , "demo.gds",
"FlattenHierarchy:=" , True,
"ImportMethod:=" , 1,
[
"NAME:LayerMap",
[
"NAME:LayerMapInfo",
"LayerNum:=" , GDS_no[index],
"DestLayer:=" , Metal[index],
"layer_type:=" , "signal"
]
],
"OrderMap:=" , [ "entry:=" , [ "order:=" , 0, "layer:=" , Metal[index]]]
])
oObject_Names = oEditor.GetObjectsInGroup( "Sheets" )
if (len(oObject_Names)):
oObjects = ""
for oObject_Name in oObject_Names:
oObjects = oObjects + oObject_Name + ","
oEditor.Move(
[
"NAME:Selections",
"Selections:=" , oObjects,
"NewPartsModelFlag:=" , "Model"
],
[
"NAME:TranslateParameters",
"TranslateVectorX:=" , "0um",
"TranslateVectorY:=" , "0um",
"TranslateVectorZ:=" , Z[index]
])
oEditor.SweepAlongVector(
[
"NAME:Selections",
"Selections:=" , oObjects,
"NewPartsModelFlag:=" , "Model"
],
[
"NAME:VectorSweepParameters",
"DraftAngle:=" , "0deg",
"DraftType:=" , "Round",
"CheckFaceFaceIntersection:=", False,
"SweepVectorX:=" , "0um",
"SweepVectorY:=" , "0um",
"SweepVectorZ:=" , t[index]
])
oEditor.AssignMaterial(
[
"NAME:Selections",
"AllowRegionDependentPartSelectionForPMLCreation:=", True,
"AllowRegionSelectionForPMLCreation:=", True,
"Selections:=" , oObjects,
],
[
"NAME:Attributes",
"MaterialValue:=" , "\""+Metal[index]+"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "nan ",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])