EDB: post-layout parameterization#

This example shows you how to parameterize the signal net in post-layout.

Define input parameters.

[1]:
signal_net_name = "DDR4_ALERT3"
coplanar_plane_net_name = "1V0"  # Specify name of coplanar plane net for adding clearance
layers = ["16_Bottom"]  # Specify layers to parameterize

Perform required imports.

[2]:
import os
import tempfile

import pyedb
from pyedb.misc.downloads import download_file

temp_dir = tempfile.TemporaryDirectory(suffix=".ansys")

# Download and open example layout file in edb format.

edb_path = download_file("edb/ANSYS-HSD_V1.aedb", destination=temp_dir.name)

# Select EDB version (change it manually if needed, e.g. "2024.2")
edb_version = "2024.2"
print(f"EDB version: {edb_version}")

edb = pyedb.Edb(edb_path, edbversion=edb_version)
EDB version: 2024.2
PyEDB INFO: StdOut is enabled
PyEDB INFO: Logger is initialized in EDB.
PyEDB INFO: legacy v0.35.dev0
PyEDB INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyEDB INFO: Database ANSYS-HSD_V1.aedb Opened in 2024.2
PyEDB INFO: Cell main Opened
PyEDB INFO: Builder was initialized.
PyEDB INFO: EDB initialized.

Create cutout#

The Edb.cutout() method takes a list of signal nets as the first argument and a list of reference nets as the second argument.

[3]:
edb.cutout([signal_net_name], [coplanar_plane_net_name, "GND"], remove_single_pin_components=True)
PyEDB INFO: Cutout Multithread started.
PyEDB INFO: Net clean up Elapsed time: 0m 2sec
PyEDB INFO: Extent Creation Elapsed time: 0m 0sec
PyEDB INFO: 1981 Padstack Instances deleted. Elapsed time: 0m 1sec
PyEDB INFO: 474 Primitives deleted. Elapsed time: 0m 2sec
PyEDB INFO: 824 components deleted
PyEDB INFO: Deleted 453 components
PyEDB INFO: Single Pins components deleted Elapsed time: 0m 0sec
PyEDB INFO: Cutout completed. Elapsed time: 0m 5sec
[3]:
[[0.04833361583642983, 0.06845950802472248],
 [0.04839217710290317, 0.06820646420842003],
 [0.048476096302053164, 0.06797637324983577],
 [0.048586150580908885, 0.06776080406509359],
 [0.048672445716054995, 0.06762130958381865],
 [0.05067176818706848, 0.06491330967510935],
 [0.050769291930717185, 0.0648000049584815],
 [0.05114842692016208, 0.06442086996903659],
 [0.05120289468443713, 0.0643703064923304],
 [0.08720212328418347, 0.03335982576863652],
 [0.08735511697746182, 0.03325121473069015],
 [0.0877047359472929, 0.03304936212434437],
 [0.0882134021373534, 0.032913065429500635],
 [0.08878659946264658, 0.032913065429500635],
 [0.08929526565270708, 0.03304936212434437],
 [0.08979166909779229, 0.03333596078699098],
 [0.09016403859300909, 0.033708330282207793],
 [0.09045063725565565, 0.034204733727292984],
 [0.09058693395049935, 0.034713399917353435],
 [0.09058693395049935, 0.03503044372649857],
 [0.09058683166450263, 0.03504474631880416],
 [0.09048967107082366, 0.04183735396100174],
 [0.09048926753190141, 0.04185485402368393],
 [0.08978637017721422, 0.0639458794927306],
 [0.0897676295798525, 0.0641094442946288],
 [0.08970628997324057, 0.06441781932138024],
 [0.0895555258600598, 0.06478179608814026],
 [0.08937199173688463, 0.06505647431452988],
 [0.08924732876262124, 0.06520837658818007],
 [0.0880208395789273, 0.06643486577187402],
 [0.08788643646933333, 0.06654755746655197],
 [0.08679664168378841, 0.06730942192276895],
 [0.08676294623404525, 0.06733197520160766],
 [0.08667866067063877, 0.06738594842571934],
 [0.08658597244333009, 0.06743856277022901],
 [0.08636336408365564, 0.06754969080651728],
 [0.08602704906993228, 0.06764934763029656],
 [0.08581990776977562, 0.06767288408064792],
 [0.08580812308064588, 0.06767415242192924],
 [0.051806832872544235, 0.07112987171313323],
 [0.05170565396058174, 0.07113500016000002],
 [0.050887072320460844, 0.07113500016000002],
 [0.050691511158220036, 0.07111573906668872],
 [0.05046879970844227, 0.07107143900497076],
 [0.050289214965552706, 0.0710178513978896],
 [0.04953634065667003, 0.07071397723210866],
 [0.04935457314629638, 0.07061787855828856],
 [0.04915820200547062, 0.070486667556885],
 [0.04900629973182032, 0.07036200458262161],
 [0.04883555655902538, 0.07019126140982673],
 [0.04868479628064163, 0.06999824426118566],
 [0.04853182672022683, 0.06974350703807211],
 [0.048427348957554184, 0.06950305012843623],
 [0.0483566751331029, 0.0692563340940017],
 [0.048318457999324806, 0.0690144173068744],
 [0.04830834906256023, 0.06872046150414503]]

Retrieve the path segments from the signal net.

[4]:
net = edb.nets[signal_net_name]
trace_segments = []
for p in net.primitives:
    if p.layer_name not in layers:
        continue
    if not p.type == "Path":
        continue
    trace_segments.append(p)

Create and assign delta w variable per layer.

[5]:
for p in trace_segments:
    vname = f"{p.net_name}_{p.layer_name}_dw"
    if vname not in edb.variables:
        edb[vname] = "0mm"
    new_w = f"{p.width}+{vname}"
    p.width = new_w

Delete existing clearance.

[6]:
for p in trace_segments:
    for g in edb.modeler.get_polygons_by_layer(p.layer_name, coplanar_plane_net_name):
        for v in g.voids:
            if p.is_intersecting(v):
                v.delete()

Create and assign the clearance variable for each layer.

[7]:
for p in trace_segments:
    clr = f"{p.net_name}_{p.layer_name}_clr"
    if clr not in edb.variables:
        edb[clr] = "0.5mm"
    path = p.get_center_line()
    for g in edb.modeler.get_polygons_by_layer(p.layer_name, coplanar_plane_net_name):
        void = edb.modeler.create_trace(path, p.layer_name, f"{p.width}+{clr}*2")
        g.add_void(void)

Visualize the layout.

[8]:
edb.nets.plot(layers=layers[0])
PyEDB INFO: Plot Generation time 0.641
[8]:
(<Figure size 6000x3000 with 1 Axes>, <Axes: title={'center': 'Edb Top View'}>)
../../_images/examples_legacy_standalone_11_post_layout_parameterization_15_2.png

Save the AEDB file and close EDB.

[9]:
save_edb_path = os.path.join(temp_dir.name, "post_layout_parameterization.aedb")
edb.save_edb_as(save_edb_path)
print("Edb is saved to ", save_edb_path)
edb.close_edb()
PyEDB INFO: EDB file save time: 15.57ms
Edb is saved to  C:\Users\ansys\AppData\Local\Temp\tmp134fi67m.ansys\post_layout_parameterization.aedb
PyEDB INFO: EDB file release time: 0.00ms
[9]:
True

Clean up the temporary folder.

[10]:
temp_dir.cleanup()