OpenSTA/dcalc/ArnoldiReduce.cc

644 lines
16 KiB
C++
Raw Normal View History

2018-10-24 23:22:21 +02:00
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2024, Parallax Software, Inc.
2018-10-24 23:22:21 +02:00
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2018-10-24 23:22:21 +02:00
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
2018-10-24 23:22:21 +02:00
// (c) 2018 Nefelus, Inc.
//
// Author: W. Scott
2020-04-05 20:35:51 +02:00
#include "ArnoldiReduce.hh"
2020-04-05 23:53:44 +02:00
#include "Debug.hh"
#include "MinMax.hh"
#include "Sdc.hh"
#include "Network.hh"
#include "Units.hh"
#include "Arnoldi.hh"
2020-04-05 20:35:51 +02:00
#include "parasitics/ConcreteParasiticsPvt.hh"
2018-10-24 23:22:21 +02:00
namespace sta {
rcmodel::rcmodel() :
2019-03-13 01:25:53 +01:00
pinV(nullptr)
2018-10-24 23:22:21 +02:00
{
}
rcmodel::~rcmodel()
{
free(pinV);
}
float
rcmodel::capacitance() const
{
return ctot;
}
struct ts_point
{
ParasiticNode *node_;
int eN;
bool is_term;
int tindex; // index into termV of corresponding term
ts_edge **eV;
bool visited;
ts_edge *in_edge;
int ts;
double c;
double r;
};
struct ts_edge
{
ConcreteParasiticResistor *resistor_;
ts_point *from;
ts_point *to;
};
////////////////////////////////////////////////////////////////
const int ArnoldiReduce::ts_point_count_incr_ = 1024;
const int ArnoldiReduce::ts_edge_count_incr_ = 1024;
ArnoldiReduce::ArnoldiReduce(StaState *sta) :
StaState(sta),
ts_pointNmax(1024),
ts_edgeNmax(1024),
termNmax(256),
dNmax(8)
{
ts_pointV = (ts_point*)malloc(ts_pointNmax*sizeof(ts_point));
ts_ordV = (int*)malloc(ts_pointNmax*sizeof(int));
ts_pordV = (ts_point**)malloc(ts_pointNmax*sizeof(ts_point*));
_u0 = (double*)malloc(ts_pointNmax*sizeof(double));
_u1 = (double*)malloc(ts_pointNmax*sizeof(double));
y = (double*)malloc(ts_pointNmax*sizeof(double));
iv = (double*)malloc(ts_pointNmax*sizeof(double));
r = (double*)malloc(ts_pointNmax*sizeof(double));
c = (double*)malloc(ts_pointNmax*sizeof(double));
par = (int*)malloc(ts_pointNmax*sizeof(int));
ts_edgeV = (ts_edge*)malloc(ts_edgeNmax*sizeof(ts_edge));
ts_stackV = (ts_edge**)malloc(ts_edgeNmax*sizeof(ts_edge*));
ts_eV = (ts_edge**)malloc(2*ts_edgeNmax*sizeof(ts_edge*));
pinV = (const Pin**)malloc(termNmax*sizeof(const Pin*));
termV = (int*)malloc(termNmax*sizeof(int));
outV = (int*)malloc(termNmax*sizeof(int));
d = (double*)malloc(dNmax*sizeof(double));
e = (double*)malloc(dNmax*sizeof(double));
U = (double**)malloc(dNmax*sizeof(double*));
U0 = (double*)malloc(dNmax*termNmax*sizeof(double));
int h;
for (h=0;h<dNmax;h++) U[h] = U0 + h*termNmax;
}
ArnoldiReduce::~ArnoldiReduce()
{
free(U0);
free(U);
free(e);
free(d);
free(outV);
free(termV);
free(pinV);
free(ts_eV);
free(ts_edgeV);
free(ts_stackV);
free(par);
free(c);
free(r);
free(iv);
free(y);
free(_u1);
free(_u0);
free(ts_pordV);
free(ts_ordV);
free(ts_pointV);
}
Parasitic *
ArnoldiReduce::reduceToArnoldi(Parasitic *parasitic,
const Pin *drvr_pin,
float coupling_cap_factor,
2019-11-11 23:30:19 +01:00
const RiseFall *rf,
2018-10-24 23:22:21 +02:00
const OperatingConditions *op_cond,
const Corner *corner,
const MinMax *cnst_min_max,
const ParasiticAnalysisPt *ap)
{
parasitic_network_ = reinterpret_cast<ConcreteParasiticNetwork*>(parasitic);
drvr_pin_ = drvr_pin;
coupling_cap_factor_ = coupling_cap_factor;
2019-11-11 23:30:19 +01:00
rf_ = rf;
2018-10-24 23:22:21 +02:00
op_cond_ = op_cond;
corner_ = corner;
cnst_min_max_ = cnst_min_max;
ap_ = ap;
loadWork();
return makeRcmodelDrv();
}
void
ArnoldiReduce::loadWork()
{
pt_map_.clear();
int resistor_count = 0;
ConcreteParasiticDeviceSet devices;
2019-01-26 03:06:24 +01:00
parasitic_network_->devices(&devices);
2018-10-24 23:22:21 +02:00
ConcreteParasiticDeviceSet::Iterator device_iter(devices);
while (device_iter.hasNext()) {
ParasiticDevice *device = device_iter.next();
if (parasitics_->isResistor(device))
resistor_count++;
}
termN = parasitic_network_->pinNodes()->size();
int subnode_count = parasitic_network_->subNodes()->size();
ts_pointN = subnode_count + 1 + termN;
ts_edgeN = resistor_count;
allocPoints();
allocTerms(termN);
ts_point *p0 = ts_pointV;
pterm0 = p0 + subnode_count + 1;
ts_point *pend = p0 + ts_pointN;
ts_point *p;
ts_edge *e0 = ts_edgeV;
ts_edge *eend = e0 + ts_edgeN;
ts_edge *e;
int tindex;
for (p = p0; p!=pend; p++) {
2019-03-13 01:25:53 +01:00
p->node_ = nullptr;
2018-10-24 23:22:21 +02:00
p->eN = 0;
p->is_term = false;
}
pend = pterm0;
e = e0;
int index = 0;
ConcreteParasiticSubNodeMap::Iterator
sub_node_iter(parasitic_network_->subNodes());
while (sub_node_iter.hasNext()) {
ConcreteParasiticSubNode *node = sub_node_iter.next();
pt_map_[node] = index;
p = p0 + index;
p->node_ = node;
p->eN = 0;
p->is_term = false;
index++;
}
ConcreteParasiticPinNodeMap::Iterator
pin_node_iter(parasitic_network_->pinNodes());
while (pin_node_iter.hasNext()) {
ConcreteParasiticPinNode *node = pin_node_iter.next();
p = pend++;
pt_map_[node] = p - p0;
p->node_ = node;
p->eN = 0;
p->is_term = true;
tindex = p - pterm0;
p->tindex = tindex;
const Pin *pin = parasitics_->connectionPin(node);
pinV[tindex] = pin;
}
ts_edge **eV = ts_eV;
ConcreteParasiticDeviceSet::Iterator device_iter2(devices);
while (device_iter2.hasNext()) {
ParasiticDevice *device = device_iter2.next();
if (parasitics_->isResistor(device)) {
ConcreteParasiticResistor *resistor =
reinterpret_cast<ConcreteParasiticResistor*>(device);
ts_point *pt1 = findPt(resistor->node1());
ts_point *pt2 = findPt(resistor->node2());
e->from = pt1;
e->to = pt2;
e->resistor_ = resistor;
pt1->eN++;
if (e->from != e->to)
pt2->eN++;
e++;
}
}
for (p=p0;p!=pend;p++) {
if (p->node_) {
p->eV = eV;
eV += p->eN;
p->eN = 0;
}
}
for (e=e0;e!=eend;e++) {
e->from->eV[e->from->eN++] = e;
if (e->to != e->from)
e->to->eV[e->to->eN++] = e;
}
}
void
ArnoldiReduce::allocPoints()
{
if (ts_pointN > ts_pointNmax) {
free(par);
free(c);
free(r);
free(iv); free(y); free(_u1); free(_u0);
free(ts_pordV);
free(ts_ordV);
free(ts_pointV);
ts_pointNmax = ts_pointN + ts_point_count_incr_;
ts_pointV = (ts_point*)malloc(ts_pointNmax*sizeof(ts_point));
ts_ordV = (int*)malloc(ts_pointNmax*sizeof(int));
ts_pordV = (ts_point**)malloc(ts_pointNmax*sizeof(ts_point*));
_u0 = (double*)malloc(ts_pointNmax*sizeof(double));
_u1 = (double*)malloc(ts_pointNmax*sizeof(double));
y = (double*)malloc(ts_pointNmax*sizeof(double));
iv = (double*)malloc(ts_pointNmax*sizeof(double));
r = (double*)malloc(ts_pointNmax*sizeof(double));
c = (double*)malloc(ts_pointNmax*sizeof(double));
par = (int*)malloc(ts_pointNmax*sizeof(int));
}
if (ts_edgeN > ts_edgeNmax) {
free(ts_edgeV);
free(ts_eV);
free(ts_stackV);
ts_edgeNmax = ts_edgeN + ts_edge_count_incr_;
ts_edgeV = (ts_edge*)malloc(ts_edgeNmax*sizeof(ts_edge));
ts_stackV = (ts_edge**)malloc(ts_edgeNmax*sizeof(ts_edge*));
ts_eV = (ts_edge**)malloc(2*ts_edgeNmax*sizeof(ts_edge*));
}
}
void
ArnoldiReduce::allocTerms(int nterms)
{
if (nterms > termNmax) {
free(U0);
free(outV);
free(termV);
free(pinV);
termNmax = nterms+256;
pinV = (const Pin**)malloc(termNmax*sizeof(const Pin*));
termV = (int*)malloc(termNmax*sizeof(int));
outV = (int*)malloc(termNmax*sizeof(int));
U0 = (double*)malloc(dNmax*termNmax*sizeof(double));
int h;
for (h=0;h<dNmax;h++) U[h] = U0 + h*termNmax;
}
}
ts_point *
ArnoldiReduce::findPt(ParasiticNode *node)
{
return &ts_pointV[pt_map_[reinterpret_cast<ConcreteParasiticNode*>(node)]];
}
rcmodel *
ArnoldiReduce::makeRcmodelDrv()
{
ParasiticNode *drv_node = parasitics_->findNode(parasitic_network_,
drvr_pin_);
ts_point *pdrv = findPt(drv_node);
makeRcmodelDfs(pdrv);
getRC();
if (ctot_ < 1e-22) // 1e-10ps
2019-03-13 01:25:53 +01:00
return nullptr;
2018-10-24 23:22:21 +02:00
setTerms(pdrv);
makeRcmodelFromTs();
rcmodel *mod = makeRcmodelFromW();
return mod;
}
#define ts_orient( pp, ee) \
if (ee->from!=pp) { ee->to = ee->from; ee->from = pp; }
void
ArnoldiReduce::makeRcmodelDfs(ts_point *pdrv)
{
bool loop = false;
int k;
ts_point *p,*q;
ts_point *p0 = ts_pointV;
ts_point *pend = p0 + ts_pointN;
for (p=p0;p!=pend;p++)
p->visited = 0;
ts_edge *e;
ts_edge **stackV = ts_stackV;
int stackN = 1;
stackV[0] = e = pdrv->eV[0];
ts_orient(pdrv,e);
pdrv->visited = 1;
2019-03-13 01:25:53 +01:00
pdrv->in_edge = nullptr;
2018-10-24 23:22:21 +02:00
pdrv->ts = 0;
ts_ordV[0] = pdrv-p0;
ts_pordV[0] = pdrv;
ts_ordN = 1;
while (stackN>0) {
e = stackV[stackN-1];
q = e->to;
if (q->visited) {
// if it is a one-rseg self-loop,
// ignore, and do not even set *loop
if (e->to != e->from)
loop = true;
} else {
// try to descend
q->visited = 1;
q->ts = ts_ordN++;
ts_pordV[q->ts] = q;
ts_ordV[q->ts] = q-p0;
q->in_edge = e;
if (q->eN>1) {
for (k=0;k<q->eN;k++) if (q->eV[k] != e) break;
e = q->eV[k];
ts_orient(q,e);
stackV[stackN++] = e;
continue; // descent
}
}
// try to ascend
while (--stackN>=0) {
e = stackV[stackN];
p = e->from;
// find e in p->eV
for (k=0;k<p->eN;k++) if (p->eV[k]==e) break;
// if (k==p->eN) notice(0,"ERROR, e not found!\n");
++k;
if (k>=p->eN) continue;
e = p->eV[k];
// check that next sibling is not the incoming edge
if (stackN>0 && e==stackV[stackN-1]) {
++k;
if (k>=p->eN) continue;
e = p->eV[k];
}
ts_orient(p,e);
stackV[stackN++] = e;
break;
}
} // while (stackN)
if (loop)
2021-01-01 20:46:51 +01:00
debugPrint(debug_, "arnoldi", 1, "net %s loop",
network_->pathName(drvr_pin_));
2018-10-24 23:22:21 +02:00
}
// makeRcmodelGetRC
void
ArnoldiReduce::getRC()
{
ts_point *p, *p0 = ts_pointV;
ts_point *pend = p0 + ts_pointN;
ctot_ = 0.0;
for (p=p0;p!=pend;p++) {
p->c = 0.0;
p->r = 0.0;
if (p->node_) {
ParasiticNode *node = p->node_;
double cap = parasitics_->nodeGndCap(node, ap_)
+ pinCapacitance(node);
if (cap > 0.0) {
p->c = cap;
ctot_ += cap;
}
else
p->c = 0.0;
if (p->in_edge && p->in_edge->resistor_)
p->r = parasitics_->value(p->in_edge->resistor_, ap_);
if (!(p->r>=0.0 && p->r<100e+3)) { // 0 < r < 100kohm
2021-01-01 20:46:51 +01:00
debugPrint(debug_, "arnoldi", 1,
"R value %g out of range, drvr pin %s",
p->r,
network_->pathName(drvr_pin_));
2018-10-24 23:22:21 +02:00
}
}
}
}
float
ArnoldiReduce::pinCapacitance(ParasiticNode *node)
{
const Pin *pin = parasitics_->connectionPin(node);
float pin_cap = 0.0;
if (pin) {
Port *port = network_->port(pin);
LibertyPort *lib_port = network_->libertyPort(port);
if (lib_port)
2019-11-11 23:30:19 +01:00
pin_cap = sdc_->pinCapacitance(pin,rf_, op_cond_, corner_, cnst_min_max_);
2018-10-24 23:22:21 +02:00
else if (network_->isTopLevelPort(pin))
Network::id for maps/sets commit be70d30ae05665021254b0d7e69fb8d2f0a82890 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 17:04:49 2023 -0700 cmp Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 4d4ef96948afe3d6a00c4521aeb5bc74274f5737 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 16:08:50 2023 -0700 rvo, const Signed-off-by: James Cherry <cherry@parallaxsw.com> commit bb584e4264af2bea867b17d07e8d38c0e9eb0025 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 15:05:00 2023 -0700 const Signed-off-by: James Cherry <cherry@parallaxsw.com> commit a08fe558bca6b769b2728882258bd85aed990a27 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 14:57:33 2023 -0700 LibertyPortPair no ptrs Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 4d3bd60c109d1ce9d0589d746f4968fa7bebd90d Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 14:13:07 2023 -0700 cleanup Signed-off-by: James Cherry <cherry@parallaxsw.com> commit dc25ff77771cfbe26f9318bad2b3c45879614783 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 14:06:13 2023 -0700 const Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 06e81586ce11a0cc06948ed78fef99353077d69e Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 14:01:10 2023 -0700 sortByName Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 9d8592aff5b246f83e47e1b94490e3cef8d8e119 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 11:57:17 2023 -0700 sort pred Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 462a8e14df8b561ddfc842addc62c4b8435b6347 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 11:09:57 2023 -0700 const Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 69f71505b684e88b22d395510429497e87bf1015 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 10:45:14 2023 -0700 flush ConstPortSeq Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 6429d578b78eac3fe7e99fcd67a120789932b2eb Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 09:19:15 2023 -0700 rm ConstNetSet Signed-off-by: James Cherry <cherry@parallaxsw.com> commit f247930b16e40560b957a36af68947249ed1ef04 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 17 08:50:50 2023 -0700 sortPathNames Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 4ca2b0e0af7252c7bcbc65cf141d0ce40634d329 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 16 10:14:05 2023 -0700 const Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 3d18640d2ebc4aae3098c7e7242a554fcb64fd42 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 16 09:41:27 2023 -0700 set_input/ouput_delay -reference_pin Signed-off-by: James Cherry <cherry@parallaxsw.com> commit d4a0854dd2102f46f96a94fb9eb8749f1593a85f Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 16 09:13:46 2023 -0700 PinPairSet no malloc Signed-off-by: James Cherry <cherry@parallaxsw.com> commit a6f1583fc6a856c5ecc0dcb15a1d8b1f61e30718 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 16 08:53:33 2023 -0700 no malloc for EdgePins Signed-off-by: James Cherry <cherry@parallaxsw.com> commit c8e4b92e8b619109d6aa3c141c720646067ccb4b Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 16 06:31:08 2023 +0000 leak commit abab99e0fc3e466d914f6c1705aa08cdc204df51 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 16 06:07:36 2023 +0000 leaks commit d1913b554bb6e98b89673d80d2295f552eb4ffca Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 19:48:39 2023 -0700 LibertyCell::checkCornerCell Signed-off-by: James Cherry <cherry@parallaxsw.com> commit bcc172237d48deed647374f9592bac70bd2d5425 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 18:19:47 2023 -0700 rvo Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 8ef9800b87f5e5548055a13afc21397f28a6bcf7 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 18:07:46 2023 -0700 sdc net id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit d7235abed04ced4e2d84e91bf9968e621268567d Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 16:00:27 2023 -0700 range iter Signed-off-by: James Cherry <cherry@parallaxsw.com> commit a22f91a3c54c644574339d1126821d9bc8045bd6 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 15:52:50 2023 -0700 range iter Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 762615ce3de91d950eeaaa4680549a45b13e0e0a Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 15:42:19 2023 -0700 range iter Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 7e0c531613d343d23f064c24873bf5a498f6f4ce Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 12:26:49 2023 -0700 rm removeLoadCaps, removeNetLoadCaps Signed-off-by: James Cherry <cherry@parallaxsw.com> commit f2e88c6082e2d4605e9849348008bf4065401fc8 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 12:21:03 2023 -0700 sdc rm map ptrs Signed-off-by: James Cherry <cherry@parallaxsw.com> commit b5939666188c0b94dfe957e22bbd8a92f4786125 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 11:36:16 2023 -0700 sdc rm map ptrs Signed-off-by: James Cherry <cherry@parallaxsw.com> commit a435081bafe10260743319f53a59cbe2ed0388b7 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 08:43:37 2023 -0700 sdc rm map ptrs Signed-off-by: James Cherry <cherry@parallaxsw.com> commit acfb247559db7b726d47f203613488df0f7add53 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 08:38:07 2023 -0700 sdc rm map ptrs Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 7541b71da92ea15085615988a1e6ea1d4d53d8d6 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 08:00:55 2023 -0700 sdc rm map ptrs Signed-off-by: James Cherry <cherry@parallaxsw.com> commit d033210132656ea68fa834228575b9def1d02d90 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 07:52:03 2023 -0700 sdc rm map ptrs Signed-off-by: James Cherry <cherry@parallaxsw.com> commit ca6e9ecb7821b83ab024c4fee6df8f7fc8fc2ce2 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 07:38:12 2023 -0700 instance_pvt_maps_ Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 631e4209b596386f5818045d521784db5239f58d Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 07:26:42 2023 -0700 rm GroupPathIterator Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 059c32afa87617fff530c9afa1ef8005a136739d Author: James Cherry <cherry@parallaxsw.com> Date: Sat Jan 14 20:07:44 2023 -0700 rm ClockIterator Signed-off-by: James Cherry <cherry@parallaxsw.com> commit c65fe873a6a6696220bbb44c4ecac87d5ca978ac Author: James Cherry <cherry@parallaxsw.com> Date: Sat Jan 14 19:45:58 2023 -0700 rvo Signed-off-by: James Cherry <cherry@parallaxsw.com> commit ce15c9a0cc78915acddc2f03749573d989ae96d6 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 15 01:04:03 2023 +0000 leaks commit f97955a0c7e70b65ceb3f697ff47c0524a9b3cd4 Author: James Cherry <cherry@parallaxsw.com> Date: Sat Jan 14 01:17:58 2023 +0000 leaks commit 7cdd65684adeb14e02827f5d93e7fab3b19af5dd Author: James Cherry <cherry@parallaxsw.com> Date: Fri Jan 13 16:07:47 2023 -0700 leaks Signed-off-by: James Cherry <cherry@parallaxsw.com> commit ee97c7e50394a3927458e7ef09c5dbeb27719d15 Author: James Cherry <cherry@parallaxsw.com> Date: Fri Jan 13 11:52:48 2023 -0700 swig rm Tmp collections Signed-off-by: James Cherry <cherry@parallaxsw.com> commit c49935da8704e41459280971b7645fccd97e3d13 Author: James Cherry <cherry@parallaxsw.com> Date: Fri Jan 13 11:18:36 2023 -0700 swig rm Tmp types Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 4320b00ce700914843006f592126cd8cc1c4657a Author: James Cherry <cherry@parallaxsw.com> Date: Fri Jan 13 10:55:10 2023 -0700 swig rm TmpPinSet, TmpPinSeq Signed-off-by: James Cherry <cherry@parallaxsw.com> commit ff6004910980c9b09b41f63a553a4481404cc539 Author: James Cherry <cherry@parallaxsw.com> Date: Fri Jan 13 10:45:06 2023 -0700 swig rm Tmp collections Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 9a5bf5c1a3e5a6d2996b3ab327fa2f3015f2ff20 Author: James Cherry <cherry@parallaxsw.com> Date: Fri Jan 13 10:15:29 2023 -0700 swig rm one TmpPinSet Signed-off-by: James Cherry <cherry@parallaxsw.com> commit f441116b56e23849485b2393b30e7086c33165a8 Author: James Cherry <cherry@parallaxsw.com> Date: Fri Jan 13 09:16:56 2023 -0700 leak Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 050b08df8618340b568d9cd41fd3d5f052e2c680 Author: James Cherry <cherry@parallaxsw.com> Date: Fri Jan 13 09:10:53 2023 -0700 leak Signed-off-by: James Cherry <cherry@parallaxsw.com> commit be8c17f3a715ab53140748dc1d94698209965cf9 Author: James Cherry <cherry@parallaxsw.com> Date: Fri Jan 13 08:59:06 2023 -0700 leak Signed-off-by: James Cherry <cherry@parallaxsw.com> commit e43b82f8fb52eaeda90e3c7e76cf350ae6735ebd Author: James Cherry <cherry@parallaxsw.com> Date: Thu Jan 12 18:57:49 2023 -0700 range iter Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 8db56209de7805ac2574fd2f76170bf68afd156d Author: James Cherry <cherry@parallaxsw.com> Date: Thu Jan 12 18:08:54 2023 -0700 GroupPathSet net id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit cb7917f9827c2ea3afebd735cd4508405a0d77d4 Author: James Cherry <cherry@parallaxsw.com> Date: Thu Jan 12 12:00:15 2023 -0700 DataCheckLess net id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit d9da3c62d7a76699c6ad62cebb1f5c39f89722fa Author: James Cherry <cherry@parallaxsw.com> Date: Thu Jan 12 11:42:27 2023 -0700 rm hashPtr uses Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 5bbea162bb1e023aba813598c7992c740ddf9d0b Author: James Cherry <cherry@parallaxsw.com> Date: Thu Jan 12 11:30:12 2023 -0700 EdgePins has use net id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit df38405e2ebaabdd7bbf99f3b19d78b25bd95720 Author: James Cherry <cherry@parallaxsw.com> Date: Thu Jan 12 09:51:38 2023 -0700 ExceptionPath hash use net id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 9a6dcfa54c54c9f50b14248a2449c70c20a0d977 Author: James Cherry <cherry@parallaxsw.com> Date: Thu Jan 12 08:56:49 2023 -0700 ClockInsertion, ClockLatency net id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit dbb6dc0b8c93812458df31e93f08e0dbd74e8105 Author: James Cherry <cherry@parallaxsw.com> Date: Thu Jan 12 08:34:03 2023 -0700 ExceptionStateSet obj id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 70b8721c48ec0816289ee09b664c332ee095875f Author: James Cherry <cherry@parallaxsw.com> Date: Thu Jan 12 08:14:37 2023 -0700 ClockGroups cmp Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 4c6c4ca191a99cd8541e106fec3202ee14968f39 Author: James Cherry <cherry@parallaxsw.com> Date: Thu Jan 12 07:38:17 2023 -0700 ClockGroup typedef to ClockSet Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 66f425315e16deee5f00b05c0a505766e7afbf01 Author: James Cherry <cherry@parallaxsw.com> Date: Wed Jan 11 20:32:38 2023 -0700 set cmps Signed-off-by: James Cherry <cherry@parallaxsw.com> commit a94866c7828af5b6714e3e4fffc13bdaf5155c0e Author: James Cherry <cherry@parallaxsw.com> Date: Wed Jan 11 19:08:09 2023 -0700 net use id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 6348320908f42ebb5262117182e13d0024f65537 Author: James Cherry <cherry@parallaxsw.com> Date: Wed Jan 11 11:52:13 2023 -0700 exception id cmp Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 0edfca41b6d6408ac17f8dfe10e697c55146c1ef Author: James Cherry <cherry@parallaxsw.com> Date: Wed Jan 11 10:47:02 2023 -0700 range iter Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 44ad77985da9f0b9e7f4780e3f233c8d94fa7db7 Author: James Cherry <cherry@parallaxsw.com> Date: Wed Jan 11 08:27:58 2023 -0700 non-ptr set cmp Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 36de7d88c3fa683465604a9e16b2fc1f6bc5fdd0 Author: James Cherry <cherry@parallaxsw.com> Date: Wed Jan 11 08:00:54 2023 -0700 range iteration Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 4a31a2c8d9bdae58b09af8c05a64702ea3ac6c15 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 10 16:43:54 2023 -0700 tcl types Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 056a7447b494a4c8ecc9764650d78a5bed3d87e8 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 10 16:10:36 2023 -0700 tcl types Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 97239554c7625ba50ee729260f08eda7dec02365 Author: James Cherry <cherry@parallaxsw.com> Date: Tue Jan 10 13:10:42 2023 -0700 use RVO Signed-off-by: James Cherry <cherry@parallaxsw.com> commit c3247d8937d483102e3e1f2b69d7ac1d331ba9d4 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 9 22:41:20 2023 -0700 swig template seq's Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 5431c06feb256adb46858819fcf5d513cfa6b5ec Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 9 20:50:24 2023 -0700 swig set in template Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 592ad641bf01d3beb862314a0d8986f66e258642 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 9 17:27:25 2023 -0700 network return containers Signed-off-by: James Cherry <cherry@parallaxsw.com> commit c95f8b77e0d6bd5ffa5ba8102413c70883c756e1 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 9 12:15:37 2023 -0700 PinSeq const Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 702e7f9ba2f901066a38f32e67b35602b6c7bbdf Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 9 12:02:29 2023 -0700 InstanceSeq const Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 44fc25ba4a15e4ae570d74af27c9435872a126e0 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 9 12:01:45 2023 -0700 NetSeq const Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 03b2725c81f5d52c33c875b55056c11d482144f1 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 9 11:33:18 2023 -0700 rm PortPair Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 3fb82a7344dc053171c9883a113764ba691ab827 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Jan 9 11:20:53 2023 -0700 PinSet id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 3dd31f027e15d40d62a11d0a88ef2a115f01fb73 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 8 15:03:33 2023 -0700 InstanceSet id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit a91dea5cc0af3bede36b3faed13adb05239ff907 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 8 11:40:15 2023 -0700 NetSet id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit b91e4b6410134eccae7969ddcfb0b27933b2e746 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 8 10:44:47 2023 -0700 CellSet, PortSet id Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 6f891f77fae5a6b19c1454a1a4b4e3dfae0b5c50 Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 8 10:29:25 2023 -0700 network object sets Signed-off-by: James Cherry <cherry@parallaxsw.com> commit eb8c627a57ecc6e7c5846a01d62b090ff91c08bf Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 8 10:09:00 2023 -0700 PinSet1 Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 8e864ecbdf87000fbb3c3097c39f06173c941e35 Author: James Cherry <cherry@parallaxsw.com> Date: Sat Jan 7 17:13:03 2023 -0700 concrete network object id Signed-off-by: James Cherry <cherry@parallaxsw.com> Signed-off-by: James Cherry <cherry@parallaxsw.com>
2023-01-19 19:23:45 +01:00
pin_cap = sdc_->portExtCap(port, rf_, corner_, cnst_min_max_);
2018-10-24 23:22:21 +02:00
}
return pin_cap;
}
void
ArnoldiReduce::setTerms(ts_point *pdrv)
{
// termV: from drv-ordered to fixed order
// outV: from drv-ordered to ts_pordV
ts_point *p;
int k,k0;
termV[0] = k0 = pdrv->tindex;
for (k=1;k<termN;k++) {
if (k==k0) termV[k] = 0;
else termV[k] = k;
}
for (k=0;k<termN;k++) {
p = pterm0 + termV[k];
outV[k] = p->ts;
}
}
// The guts of the arnoldi reducer.
void
ArnoldiReduce::makeRcmodelFromTs()
{
ts_point *p, *p0 = ts_pointV;
int n = ts_ordN;
int nterms = termN;
int i,j,k,h;
if (debug_->check("arnoldi", 1)) {
for (k=0;k<ts_ordN;k++) {
p = ts_pordV[k];
2021-01-01 20:46:51 +01:00
debugPrint(debug_, "arnoldi", 1, "T%d,P%ld c=%s",
p->ts,
p-p0,
units_->capacitanceUnit()->asString(p->c));
2018-10-24 23:22:21 +02:00
if (p->is_term)
2021-01-01 20:46:51 +01:00
debugPrint(debug_, "arnoldi", 1, " term %d", p->tindex);
2018-10-24 23:22:21 +02:00
if (p->in_edge)
2021-01-01 20:46:51 +01:00
debugPrint(debug_, "arnoldi", 1, " from T%d,P%ld r=%s",
p->in_edge->from->ts,
p->in_edge->from-p0,
units_->resistanceUnit()->asString(p->r));
2018-10-24 23:22:21 +02:00
}
for (i=0;i<nterms;i++)
2021-01-01 20:46:51 +01:00
debugPrint(debug_, "arnoldi", 1, "outV[%d] = T%d", i, outV[i]);
2018-10-24 23:22:21 +02:00
}
int max_order = 5;
double *u0, *u1;
u0 = _u0; u1 = _u1;
double sum,e1;
order = max_order;
if (n < order)
order = n;
par[0] = -1; r[0] = 0.0;
c[0] = ts_pordV[0]->c;
for (j=1;j<n;j++) {
p = ts_pordV[j];
c[j] = p->c;
r[j] = p->r;
par[j] = p->in_edge->from->ts;
}
sum = 0.0;
for (j=0;j<n;j++) sum += c[j];
2021-01-01 20:46:51 +01:00
debugPrint(debug_, "arnoldi", 1, "ctot = %s",
units_->capacitanceUnit()->asString(sum));
2018-10-24 23:22:21 +02:00
ctot_ = sum;
sqc_ = sqrt(sum);
double sqrt_ctot_inv = 1.0/sqc_;
for (j=0;j<n;j++) u0[j] = sqrt_ctot_inv;
for (h=0;h<order;h++) {
for (i=0;i<nterms;i++) U[h][i] = u0[outV[i]];
// y = R C u0
for (j=0;j<n;j++) {
iv[j] = 0.0;
}
for (j=n-1;j>0;j--) {
iv[j] += c[j]*u0[j];
iv[par[j]] += iv[j];
}
iv[0] += c[0]*u0[0];
y[0] = 0.0;
for (j=1;j<n;j++) {
y[j] = y[par[j]] + r[j]*iv[j];
}
// d[h] = u0 C y
sum = 0.0;
for (j=1;j<n;j++) {
sum += u0[j]*c[j]*y[j];
}
d[h] = sum;
if (h==order-1) break;
if (d[h]<1e-13) { // .1ps
order = h+1;
break;
}
// y = y - d[h]*u0 - e[h-1]*u1
if (h==0) {
for (j=0;j<n;j++) y[j] -= sum*u0[j];
} else {
e1 = e[h-1];
for (j=0;j<n;j++) y[j] -= sum*u0[j] + e1*u1[j];
}
// e[h] = sqrt(y C y)
// u1 = y/e[h]
sum = 0.0;
for (j=0;j<n;j++) {
sum += c[j]*y[j]*y[j];
}
if (sum<1e-30) { // (1e-6ns)^2
order = h+1;
break;
}
e[h] = sqrt(sum);
sum = 1.0/e[h];
for (j=0;j<n;j++) u1[j] = sum*y[j];
// swap u0, u1
if (h%2) {
u0 = _u0; u1 = _u1;
} else {
u0 = _u1; u1 = _u0;
}
}
if (debug_->check("arnoldi", 1)) {
2020-12-29 19:33:22 +01:00
report_->reportLine("tridiagonal reduced matrix, drvr pin %s",
network_->pathName(drvr_pin_));
report_->reportLine("order %d n %d",order,n);
2018-10-24 23:22:21 +02:00
for (h=0;h<order;h++) {
if (h<order-1)
2020-12-29 19:33:22 +01:00
report_->reportLine(" d[%d] %s e[%d] %s",
h,
units_->timeUnit()->asString(d[h]),
h,
units_->timeUnit()->asString(e[h]));
else
report_->reportLine(" d[%d] %s",
h,
units_->timeUnit()->asString(d[h]));
string line = stdstrPrint("U[%d]",h);
2018-10-24 23:22:21 +02:00
for (i=0;i<nterms;i++)
2020-12-29 19:33:22 +01:00
line += stdstrPrint(" %6.2e",U[h][i]);
2021-01-05 03:14:04 +01:00
report_->reportLineString(line);
2018-10-24 23:22:21 +02:00
}
}
}
rcmodel *
ArnoldiReduce::makeRcmodelFromW()
{
int j,h;
int n = termN;
rcmodel *mod = new rcmodel();
mod->order = order;
mod->n = n;
if (order>0) {
int totd = order + order - 1 + order*n;
mod->d = (double *)malloc(totd*sizeof(double));
if (order>1) mod->e = mod->d + order;
2019-03-13 01:25:53 +01:00
else mod->e = nullptr;
2018-10-24 23:22:21 +02:00
mod->U = (double **)malloc(order*sizeof(double*));
mod->U[0] = mod->d + order + order - 1;
for (h=1;h<order;h++) mod->U[h]=mod->U[0] + h*n;
for (h=0;h<order;h++) {
mod->d[h] = d[h];
if (h<order-1) mod->e[h] = e[h];
for (j=0;j<n;j++)
mod->U[h][j] = U[h][j];
}
}
mod->pinV = (const Pin **)malloc(n*sizeof(const Pin*));
for (j=0;j<n;j++) {
int k = termV[j];
mod->pinV[j] = pinV[k];
}
mod->ctot = ctot_;
mod->sqc = sqc_;
return mod;
}
} // namespace