{ "cells": [ { "cell_type": "markdown", "id": "1b322800", "metadata": {}, "source": [ "# Set up EDB for Serdes channel S-parameter extraction" ] }, { "cell_type": "markdown", "id": "669819ed", "metadata": {}, "source": [ "## Import the required packages" ] }, { "cell_type": "code", "execution_count": null, "id": "5b554c56", "metadata": {}, "outputs": [], "source": [ "import json" ] }, { "cell_type": "code", "execution_count": null, "id": "1ceca417", "metadata": {}, "outputs": [], "source": [ "import os\n", "import tempfile\n", "\n", "from ansys.aedt.core import Hfss3dLayout\n", "from ansys.aedt.core.downloads import download_file\n", "\n", "from pyedb import Edb\n", "\n", "AEDT_VERSION = \"2024.2\"\n", "NG_MODE = False\n" ] }, { "cell_type": "markdown", "id": "64d3710d", "metadata": {}, "source": [ "Download the example PCB data." ] }, { "cell_type": "code", "execution_count": null, "id": "e162b05e", "metadata": {}, "outputs": [], "source": [ "temp_folder = tempfile.TemporaryDirectory(suffix=\".ansys\")\n", "file_edb = download_file(source=\"edb/ANSYS-HSD_V1.aedb\", destination=temp_folder.name)\n", "download_file(source=\"touchstone\", name=\"GRM32_DC0V_25degC_series.s2p\", destination=os.path.split(file_edb)[0])" ] }, { "cell_type": "markdown", "id": "10fbe3ce", "metadata": {}, "source": [ "## Load example layout" ] }, { "cell_type": "code", "execution_count": null, "id": "6527a5b7", "metadata": {}, "outputs": [], "source": [ "edbapp = Edb(file_edb, edbversion=AEDT_VERSION)" ] }, { "cell_type": "markdown", "id": "8fe28a8a", "metadata": {}, "source": [ "## Create config file" ] }, { "cell_type": "code", "execution_count": null, "id": "f36fa800", "metadata": {}, "outputs": [], "source": [ "cfg_general = {\"anti_pads_always_on\": True, \"suppress_pads\": True}" ] }, { "cell_type": "markdown", "id": "90246157", "metadata": {}, "source": [ "Define dielectric materials, stackup and surface roughness model." ] }, { "cell_type": "code", "execution_count": null, "id": "15f02100", "metadata": {}, "outputs": [], "source": [ "cfg_stackup = {\n", " \"materials\": [\n", " {\"name\": \"copper\", \"permittivity\": 1, \"conductivity\": 58000000.0},\n", " {\"name\": \"megtron4\", \"permittivity\": 3.77, \"dielectric_loss_tangent\": 0.005},\n", " {\"name\": \"solder_resist\", \"permittivity\": 3.0, \"dielectric_loss_tangent\": 0.035},\n", " ],\n", " \"layers\": [\n", " {\n", " \"name\": \"Top\",\n", " \"type\": \"signal\",\n", " \"material\": \"copper\",\n", " \"fill_material\": \"solder_resist\",\n", " \"thickness\": \"0.035mm\",\n", " \"roughness\": {\n", " \"top\": {\"model\": \"huray\", \"nodule_radius\": \"0.5um\", \"surface_ratio\": \"5\"},\n", " \"bottom\": {\"model\": \"huray\", \"nodule_radius\": \"0.5um\", \"surface_ratio\": \"5\"},\n", " \"side\": {\"model\": \"huray\", \"nodule_radius\": \"0.5um\", \"surface_ratio\": \"5\"},\n", " \"enabled\": True,\n", " },\n", " },\n", " {\"name\": \"DE1\", \"type\": \"dielectric\", \"material\": \"megtron4\", \"fill_material\": \"\", \"thickness\": \"0.1mm\"},\n", " {\"name\": \"Inner1\", \"type\": \"signal\", \"material\": \"copper\", \"fill_material\": \"megtron4\", \"thickness\": \"0.017mm\"},\n", " {\"name\": \"DE2\", \"type\": \"dielectric\", \"material\": \"megtron4\", \"fill_material\": \"\", \"thickness\": \"0.088mm\"},\n", " {\"name\": \"Inner2\", \"type\": \"signal\", \"material\": \"copper\", \"fill_material\": \"megtron4\", \"thickness\": \"0.017mm\"},\n", " {\"name\": \"DE3\", \"type\": \"dielectric\", \"material\": \"megtron4\", \"fill_material\": \"\", \"thickness\": \"0.1mm\"},\n", " {\"name\": \"Inner3\", \"type\": \"signal\", \"material\": \"copper\", \"fill_material\": \"megtron4\", \"thickness\": \"0.017mm\"},\n", " {\"name\": \"Megtron4-1mm\", \"type\": \"dielectric\", \"material\": \"megtron4\", \"fill_material\": \"\", \"thickness\": 0.001},\n", " {\"name\": \"Inner4\", \"type\": \"signal\", \"material\": \"copper\", \"fill_material\": \"megtron4\", \"thickness\": \"0.017mm\"},\n", " {\"name\": \"DE5\", \"type\": \"dielectric\", \"material\": \"megtron4\", \"fill_material\": \"\", \"thickness\": \"0.1mm\"},\n", " {\"name\": \"Inner5\", \"type\": \"signal\", \"material\": \"copper\", \"fill_material\": \"megtron4\", \"thickness\": \"0.017mm\"},\n", " {\"name\": \"DE6\", \"type\": \"dielectric\", \"material\": \"megtron4\", \"fill_material\": \"\", \"thickness\": \"0.088mm\"},\n", " {\"name\": \"Inner6\", \"type\": \"signal\", \"material\": \"copper\", \"fill_material\": \"megtron4\", \"thickness\": \"0.017mm\"},\n", " {\"name\": \"DE7\", \"type\": \"dielectric\", \"material\": \"megtron4\", \"fill_material\": \"\", \"thickness\": \"0.1mm\"},\n", " {\n", " \"name\": \"Bottom\",\n", " \"type\": \"signal\",\n", " \"material\": \"copper\",\n", " \"fill_material\": \"solder_resist\",\n", " \"thickness\": \"0.035mm\",\n", " },\n", " ],\n", "}" ] }, { "cell_type": "markdown", "id": "8c7a19af", "metadata": {}, "source": [ "Define Component with solderballs." ] }, { "cell_type": "code", "execution_count": null, "id": "aafc799e", "metadata": {}, "outputs": [], "source": [ "cfg_components = [\n", " {\n", " \"reference_designator\": \"U1\",\n", " \"part_type\": \"io\",\n", " \"solder_ball_properties\": {\"shape\": \"cylinder\", \"diameter\": \"300um\", \"height\": \"300um\"},\n", " \"port_properties\": {\n", " \"reference_offset\": \"0\",\n", " \"reference_size_auto\": True,\n", " \"reference_size_x\": 0,\n", " \"reference_size_y\": 0,\n", " },\n", " }\n", "]" ] }, { "cell_type": "markdown", "id": "56a6d5ff", "metadata": {}, "source": [ "Edit via padstack definition. Add backdrilling." ] }, { "cell_type": "code", "execution_count": null, "id": "8f2695c0", "metadata": {}, "outputs": [], "source": [ "cfg_padstacks = {\n", " \"definitions\": [\n", " {\n", " \"name\": \"v40h15-2\",\n", " \"material\": \"copper\",\n", " \"hole_range\": \"upper_pad_to_lower_pad\",\n", " \"hole_parameters\": {\"shape\": \"circle\", \"diameter\": \"0.2mm\"},\n", " },\n", " {\n", " \"name\": \"v35h15-1\",\n", " \"material\": \"copper\",\n", " \"hole_range\": \"upper_pad_to_lower_pad\",\n", " \"hole_parameters\": {\"shape\": \"circle\", \"diameter\": \"0.25mm\"},\n", " },\n", " ],\n", " \"instances\": [\n", " {\n", " \"name\": \"Via313\",\n", " \"backdrill_parameters\": {\n", " \"from_bottom\": {\"drill_to_layer\": \"Inner3\", \"diameter\": \"1mm\", \"stub_length\": \"0.2mm\"}\n", " },\n", " },\n", " {\n", " \"name\": \"Via314\",\n", " \"backdrill_parameters\": {\n", " \"from_bottom\": {\"drill_to_layer\": \"Inner3\", \"diameter\": \"1mm\", \"stub_length\": \"0.2mm\"}\n", " },\n", " },\n", " ],\n", "}" ] }, { "cell_type": "markdown", "id": "5ff6f9a6", "metadata": {}, "source": [ "Define ports." ] }, { "cell_type": "code", "execution_count": null, "id": "64d2690a", "metadata": {}, "outputs": [], "source": [ "cfg_ports = [\n", " {\n", " \"name\": \"port_1\",\n", " \"reference_designator\": \"U1\",\n", " \"type\": \"coax\",\n", " \"positive_terminal\": {\"net\": \"PCIe_Gen4_TX2_CAP_P\"},\n", " },\n", " {\n", " \"name\": \"port_2\",\n", " \"reference_designator\": \"U1\",\n", " \"type\": \"coax\",\n", " \"positive_terminal\": {\"net\": \"PCIe_Gen4_TX2_CAP_N\"},\n", " },\n", " {\n", " \"name\": \"port_3\",\n", " \"reference_designator\": \"X1\",\n", " \"type\": \"circuit\",\n", " \"positive_terminal\": {\"pin\": \"B8\"},\n", " \"negative_terminal\": {\"pin\": \"B7\"},\n", " },\n", " {\n", " \"name\": \"port_4\",\n", " \"reference_designator\": \"X1\",\n", " \"type\": \"circuit\",\n", " \"positive_terminal\": {\"pin\": \"B9\"},\n", " \"negative_terminal\": {\"pin\": \"B10\"},\n", " },\n", "]" ] }, { "cell_type": "markdown", "id": "86bdc9e7", "metadata": {}, "source": [ "Define S-parameter assignment" ] }, { "cell_type": "code", "execution_count": null, "id": "84eb1409", "metadata": {}, "outputs": [], "source": [ "cfg_s_parameters = [\n", " {\n", " \"name\": \"cap_10nf\",\n", " \"file_path\": \"$PROJECTDIR\\\\touchstone\\\\GRM32_DC0V_25degC_series.s2p\",\n", " \"component_definition\": \"CAPC1005X55X25LL05T10\",\n", " \"components\": [\"C375\", \"C376\"],\n", " \"reference_net\": \"GND\",\n", " }\n", "]" ] }, { "cell_type": "markdown", "id": "391fe366", "metadata": {}, "source": [ "Define SIwave setup." ] }, { "cell_type": "code", "execution_count": null, "id": "c9100bb9", "metadata": {}, "outputs": [], "source": [ "cfg_setups = [\n", " {\n", " \"name\": \"siwave_setup\",\n", " \"type\": \"siwave_ac\",\n", " \"si_slider_position\": 1,\n", " \"freq_sweep\": [\n", " {\n", " \"name\": \"Sweep1\",\n", " \"type\": \"interpolation\",\n", " \"frequencies\": [\n", " {\"distribution\": \"linear_scale\", \"start\": \"50MHz\", \"stop\": \"20GHz\", \"increment\": \"50MHz\"}\n", " ],\n", " }\n", " ],\n", " }\n", "]" ] }, { "cell_type": "markdown", "id": "0640c4ed", "metadata": {}, "source": [ "Define cutout." ] }, { "cell_type": "code", "execution_count": null, "id": "b009c674", "metadata": {}, "outputs": [], "source": [ "cfg_operations = {\n", " \"cutout\": {\n", " \"signal_list\": [\"PCIe_Gen4_TX2_CAP_P\", \"PCIe_Gen4_TX2_CAP_N\", \"PCIe_Gen4_TX2_P\", \"PCIe_Gen4_TX2_N\"],\n", " \"reference_list\": [\"GND\"],\n", " \"custom_extent\": [\n", " [0.014, 0.055],\n", " [0.03674271504652968, 0.05493094625752912],\n", " [0.07, 0.039],\n", " [0.07, 0.034],\n", " [0.05609890516829415, 0.03395233061637539],\n", " [0.014, 0.044],\n", " ],\n", " }\n", "}" ] }, { "cell_type": "markdown", "id": "d0346576", "metadata": {}, "source": [ "Create final configuration." ] }, { "cell_type": "code", "execution_count": null, "id": "66fdfa09", "metadata": {}, "outputs": [], "source": [ "cfg = {\n", " \"general\": cfg_general,\n", " \"stackup\": cfg_stackup,\n", " \"components\": cfg_components,\n", " \"padstacks\": cfg_padstacks,\n", " \"ports\": cfg_ports,\n", " \"s_parameters\": cfg_s_parameters,\n", " \"setups\": cfg_setups,\n", " \"operations\": cfg_operations,\n", "}" ] }, { "cell_type": "markdown", "id": "a04b0863", "metadata": {}, "source": [ "Create the config file." ] }, { "cell_type": "code", "execution_count": null, "id": "3ac00bac", "metadata": {}, "outputs": [], "source": [ "file_json = os.path.join(temp_folder.name, \"edb_configuration.json\")\n", "with open(file_json, \"w\") as f:\n", " json.dump(cfg, f, indent=4, ensure_ascii=False)" ] }, { "cell_type": "markdown", "id": "3bc2d50f", "metadata": {}, "source": [ "## Apply Config file" ] }, { "cell_type": "markdown", "id": "3a9c1645", "metadata": {}, "source": [ "Apply configuration to the example layout" ] }, { "cell_type": "code", "execution_count": null, "id": "266164bf", "metadata": {}, "outputs": [], "source": [ "edbapp.configuration.load(config_file=file_json)\n", "edbapp.configuration.run()" ] }, { "cell_type": "code", "execution_count": null, "id": "839242ad", "metadata": {}, "outputs": [], "source": [ "edbapp.nets.plot(nets=[])" ] }, { "cell_type": "markdown", "id": "7b28efbd", "metadata": {}, "source": [ "Save and close EDB." ] }, { "cell_type": "code", "execution_count": null, "id": "286aed1e", "metadata": {}, "outputs": [], "source": [ "edbapp.save()\n", "edbapp.close()" ] }, { "cell_type": "markdown", "id": "8cbbc63d", "metadata": {}, "source": [ "The configured EDB file is saved in a temp folder." ] }, { "cell_type": "code", "execution_count": null, "id": "c39be680", "metadata": {}, "outputs": [], "source": [ "print(temp_folder.name)" ] }, { "cell_type": "markdown", "id": "efe0b510", "metadata": {}, "source": [ "## Load edb into HFSS 3D Layout." ] }, { "cell_type": "code", "execution_count": null, "id": "258806db", "metadata": {}, "outputs": [], "source": [ "h3d = Hfss3dLayout(edbapp.edbpath, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True)" ] }, { "cell_type": "markdown", "id": "3be8699b", "metadata": {}, "source": [ "Create differential pair definition." ] }, { "cell_type": "code", "execution_count": null, "id": "00327503", "metadata": {}, "outputs": [], "source": [ "h3d.set_differential_pair(\n", " differential_mode=\"DIFF_BGA\",\n", " assignment=\"port_1\",\n", " reference=\"port_2\",\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "a93ca715", "metadata": {}, "outputs": [], "source": [ "h3d.set_differential_pair(\n", " differential_mode=\"DIFF_CONN\",\n", " assignment=\"port_3\",\n", " reference=\"port_4\",\n", ")" ] }, { "cell_type": "markdown", "id": "0ad9d6e7", "metadata": {}, "source": [ "Solve.\n", "Un-comment to analyze SIwave." ] }, { "cell_type": "markdown", "id": "2229d8e7", "metadata": {}, "source": [ "h3d.analyze(setup=\"siwave_setup\")" ] }, { "cell_type": "markdown", "id": "13eb56fb", "metadata": {}, "source": [ "Plot insertion loss." ] }, { "cell_type": "markdown", "id": "5c8fcaad", "metadata": {}, "source": [ "solutions = h3d.post.get_solution_data(expressions=\"mag(S(DIFF_CONN,DIFF_BGA))\", context=\"Differential Pairs\")\n", "solutions.plot(formula=\"db20\")" ] }, { "cell_type": "markdown", "id": "686d7bf1", "metadata": {}, "source": [ "Shut Down Electronics Desktop" ] }, { "cell_type": "code", "execution_count": null, "id": "c61e4206", "metadata": {}, "outputs": [], "source": [ "h3d.close_desktop()" ] }, { "cell_type": "markdown", "id": "fa8de5df", "metadata": {}, "source": [ "All project files are saved in the folder ``temp_file.dir``. If you've run this example as a Jupyter notebook you\n", "can retrieve those project files." ] } ], "metadata": { "jupytext": { "cell_metadata_filter": "-all", "main_language": "python", "notebook_metadata_filter": "-all" } }, "nbformat": 4, "nbformat_minor": 5 }