Skip to content

Commit

Permalink
Merge pull request #52 from rivosinc/dev/yanshengw/cut_shape
Browse files Browse the repository at this point in the history
add conformal cut for sim types
  • Loading branch information
Bellwether889 authored Sep 21, 2024
2 parents d041a2b + caf5ec5 commit bf2e5f6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
/.vscode
# Ignore tests directory
/tests
# Ignore venv
.venv/*
# Ignore .DS_Store
*.DS_Store
2 changes: 1 addition & 1 deletion opensipi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#
# SPDX-License-Identifier: Apache-2.0

__version__ = "0.1.8"
__version__ = "0.1.9"
56 changes: 36 additions & 20 deletions opensipi/sigrity_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def __init__(self, info):
self.sig_config_dict = load_yaml_to_dict(self.tool_config_dir + "config_sigrity.yaml")
self.sig_lic = self.sig_config_dict["SIG_LIC"]
self.sig_lib = expand_home_dir(self.sig_config_dict["SIG_LIB"])
if "SHAPE_CUT_TYPE" not in self.sig_config_dict:
self.SHAPE_CUT_TYPE = "CONFORMAL"
else:
self.SHAPE_CUT_TYPE = self.sig_config_dict["SHAPE_CUT_TYPE"]
self.SOLVER = "powersi"
self.UNIKEY = SIM_INPUT_COL_TITLE[0]
self.CKBOX = SIM_INPUT_COL_TITLE[1]
Expand Down Expand Up @@ -435,6 +439,14 @@ class PowersiPdnModeler(SpdModeler):
"sigrity::hook -port {Port_NUMBER} -circuit NCKT " + "-NegativeNode NNODE {!}\n"
)
TCL_IMPORT_OPTION = "sigrity::import option {OPTION_DIR} {!}\n"
TCL_CUTBYNETPOLY = (
"sigrity::update net selected 0 {GNDNETS} {!}\n"
+ "sigrity::cut addCuttingPolygon -Auto -IncludeEnabledSignalShapes {1} {!}\n"
+ "sigrity::delete area -NetToBoundary NETNAMES -PreviewResultFile $sim_spd {!}\n"
+ "sigrity::update net selected 1 {GNDNETS} {!}\n"
+ "sigrity::process shape {!}\n"
+ "sigrity::delete area unPreview -keepResult 1 {!}\n"
)

def __init__(self, info):
super().__init__(info)
Expand Down Expand Up @@ -543,7 +555,7 @@ def _mk_each_pwr_key_tcl(self, run_key, info, conn):
ctnt.append(self._en_nets(net_pos, "PowerNets"))
ctnt.append(self._en_nets(net_neg, "GroundNets"))
# autocut
ctnt.append(self._cut_shape(net_pos))
ctnt.append(self._cut_shape(net_pos, net_neg))
# ports
ctnt.append(self._set_up_ports(port_main, port_sns))
# dns components
Expand All @@ -563,12 +575,31 @@ def _en_nets(self, net, grp):
ctnt = ctnt.replace("GRPNETS", grp)
return ctnt

def _cut_shape(self, net):
"""automatically cut shape"""
def _cut_shape(self, net_pos, net_neg):
"""automatically cut shape based on selected cut type.
CONFORMAL: conformal polygon cut shape
Any other words: the regular rectangular cut shape
"""
if self.SHAPE_CUT_TYPE == "CONFORMAL":
line_tmp = self.__cut_shape_conformal(net_pos, net_neg)
else:
line_tmp = self.__cut_shape_rect(net_pos)
return line_tmp

def __cut_shape_rect(self, net):
"""automatically cut shape in a rectangular shape."""
line_tmp = "\n# auto cut\n" + self.TCL_CUTBYNET
line_tmp = line_tmp.replace("NETNAMES", " ".join(net))
return line_tmp

def __cut_shape_conformal(self, net_pos, net_neg):
"""automatically cut conformal polygon shape for selected nets."""
line_tmp = "\n# auto cut\n" + self.TCL_CUTBYNETPOLY
net_bracket = ["{" + i + "}" for i in net_pos]
line_tmp = line_tmp.replace("NETNAMES", " ".join(net_bracket))
line_tmp = line_tmp.replace("GNDNETS", " ".join(net_neg))
return line_tmp

def _set_up_ports(self, port_main, port_sns):
"""set up all ports, return string"""
port_lines = []
Expand Down Expand Up @@ -752,7 +783,7 @@ def _mk_each_pwr_key_tcl(self, run_key, info, conn):
ctnt.append(self._en_nets(net_pos, "NULL")) # signal net group
ctnt.append(self._en_nets(net_neg, "GroundNets"))
# autocut
ctnt.append(self._cut_shape(net_pos))
ctnt.append(self._cut_shape(net_pos, net_neg))
# dns components
ctnt.append(self._turn_off_dns_ckt())
# freq range
Expand Down Expand Up @@ -884,13 +915,6 @@ class ClarityModeler(PowersiIOModeler):
"sigrity::update workflow -product {Clarity 3D "
+ "Layout} -workflowkey {3DFEMExtraction} {!}\n"
)
TCL_CUTBYNETPOLY = (
"sigrity::update net selected 0 {GNDNETS} {!}\n"
+ "sigrity::cut addCuttingPolygon -Auto -IncludeEnabledSignalShapes {1} {!}\n"
+ "sigrity::delete area -NetToBoundary NETNAMES -PreviewResultFile $sim_spd {!}\n"
+ "sigrity::update net selected 1 {GNDNETS} {!}\n"
+ "sigrity::process shape {!}\n"
)

def __init__(self, info):
super().__init__(info)
Expand Down Expand Up @@ -954,14 +978,6 @@ def _mk_each_pwr_key_tcl(self, run_key, info, conn):
else:
self.lg.debug(filename + " already exists. No new key tcl is created!")

def _cut_shape(self, net_pos, net_neg):
"""automatically cut polygon shape for selected nets."""
line_tmp = "\n# auto cut\n" + self.TCL_CUTBYNETPOLY
net_bracket = ["{" + i + "}" for i in net_pos]
line_tmp = line_tmp.replace("NETNAMES", " ".join(net_bracket))
line_tmp = line_tmp.replace("GNDNETS", " ".join(net_neg))
return line_tmp

def _set_up_ports(self, info):
"""set up ports and re-order them as specified in the gSheet"""
lines = "\n# define all ports using components\n"
Expand Down Expand Up @@ -1154,7 +1170,7 @@ def _mk_each_pwr_key_tcl(self, run_key, info):
ctnt.append(self._en_nets(net_pos, "PowerNets"))
ctnt.append(self._en_nets(net_neg, "GroundNets"))
# autocut
ctnt.append(self._cut_shape(net_pos))
ctnt.append(self._cut_shape(net_pos, net_neg))
# create the run key tcl
txtfile_wr(self.run_key_dir + filename, "".join(ctnt))
self.lg.debug(filename + " is created!")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[tool.poetry]
name = "opensipi"
version = "0.1.8"
version = "0.1.9"
description = "An open-source Python3-based tool to automate signal integrity (SI) and power integrity (PI) related simulations."
authors = ["Yansheng Wang <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit bf2e5f6

Please sign in to comment.