mirror of
https://github.com/The-OpenROAD-Project/OpenSTA.git
synced 2026-05-30 00:24:12 +08:00
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>
1620 lines
36 KiB
C++
1620 lines
36 KiB
C++
// OpenSTA, Static Timing Analyzer
|
|
// Copyright (c) 2022, Parallax Software, Inc.
|
|
//
|
|
// 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
|
|
// 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/>.
|
|
|
|
#include "Graph.hh"
|
|
|
|
#include "Debug.hh"
|
|
#include "Stats.hh"
|
|
#include "MinMax.hh"
|
|
#include "Mutex.hh"
|
|
#include "Transition.hh"
|
|
#include "TimingRole.hh"
|
|
#include "TimingArc.hh"
|
|
#include "Liberty.hh"
|
|
#include "PortDirection.hh"
|
|
#include "Network.hh"
|
|
#include "DcalcAnalysisPt.hh"
|
|
|
|
namespace sta {
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
//
|
|
// Graph
|
|
//
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
Graph::Graph(StaState *sta,
|
|
int slew_rf_count,
|
|
bool have_arc_delays,
|
|
DcalcAPIndex ap_count) :
|
|
StaState(sta),
|
|
vertices_(nullptr),
|
|
edges_(nullptr),
|
|
arc_count_(0),
|
|
slew_rf_count_(slew_rf_count),
|
|
have_arc_delays_(have_arc_delays),
|
|
ap_count_(ap_count),
|
|
width_check_annotations_(nullptr),
|
|
period_check_annotations_(nullptr),
|
|
reg_clk_vertices_(new VertexSet(graph_))
|
|
{
|
|
// For the benifit of reg_clk_vertices_ that references graph_.
|
|
graph_ = this;
|
|
}
|
|
|
|
Graph::~Graph()
|
|
{
|
|
delete vertices_;
|
|
delete edges_;
|
|
delete reg_clk_vertices_;
|
|
deleteSlewTables();
|
|
deleteArcDelayTables();
|
|
removeWidthCheckAnnotations();
|
|
removePeriodCheckAnnotations();
|
|
}
|
|
|
|
void
|
|
Graph::makeGraph()
|
|
{
|
|
Stats stats(debug_, report_);
|
|
makeVerticesAndEdges();
|
|
makeWireEdges();
|
|
stats.report("Make graph");
|
|
}
|
|
|
|
// Make vertices for each pin.
|
|
// Iterate over instances and top level port pins rather than nets
|
|
// because network may not connect floating pins to a net
|
|
// (ie, Intime occurence tree bleachery).
|
|
void
|
|
Graph::makeVerticesAndEdges()
|
|
{
|
|
vertices_ = new VertexTable;
|
|
edges_ = new EdgeTable;
|
|
makeSlewTables(ap_count_);
|
|
makeArcDelayTables(ap_count_);
|
|
|
|
LeafInstanceIterator *leaf_iter = network_->leafInstanceIterator();
|
|
while (leaf_iter->hasNext()) {
|
|
const Instance *inst = leaf_iter->next();
|
|
makePinVertices(inst);
|
|
makeInstanceEdges(inst);
|
|
}
|
|
delete leaf_iter;
|
|
makePinVertices(network_->topInstance());
|
|
}
|
|
|
|
class FindNetDrvrLoadCounts : public PinVisitor
|
|
{
|
|
public:
|
|
FindNetDrvrLoadCounts(Pin *drvr_pin,
|
|
PinSet &visited_drvrs,
|
|
int &drvr_count,
|
|
int &bidirect_count,
|
|
int &load_count,
|
|
const Network *network);
|
|
virtual void operator()(Pin *pin);
|
|
|
|
protected:
|
|
Pin *drvr_pin_;
|
|
PinSet &visited_drvrs_;
|
|
int &drvr_count_;
|
|
int &bidirect_count_;
|
|
int &load_count_;
|
|
const Network *network_;
|
|
};
|
|
|
|
FindNetDrvrLoadCounts::FindNetDrvrLoadCounts(Pin *drvr_pin,
|
|
PinSet &visited_drvrs,
|
|
int &drvr_count,
|
|
int &bidirect_count,
|
|
int &load_count,
|
|
const Network *network) :
|
|
drvr_pin_(drvr_pin),
|
|
visited_drvrs_(visited_drvrs),
|
|
drvr_count_(drvr_count),
|
|
bidirect_count_(bidirect_count),
|
|
load_count_(load_count),
|
|
network_(network)
|
|
{
|
|
}
|
|
|
|
void
|
|
FindNetDrvrLoadCounts::operator()(Pin *pin)
|
|
{
|
|
if (network_->isDriver(pin)) {
|
|
if (pin != drvr_pin_)
|
|
visited_drvrs_.insert(pin);
|
|
if (network_->direction(pin)->isBidirect())
|
|
bidirect_count_++;
|
|
else
|
|
drvr_count_++;
|
|
}
|
|
if (network_->isLoad(pin))
|
|
load_count_++;
|
|
}
|
|
|
|
void
|
|
Graph::makePinVertices(const Instance *inst)
|
|
{
|
|
InstancePinIterator *pin_iter = network_->pinIterator(inst);
|
|
while (pin_iter->hasNext()) {
|
|
Pin *pin = pin_iter->next();
|
|
makePinVertices(pin);
|
|
}
|
|
delete pin_iter;
|
|
}
|
|
|
|
// Make edges corresponding to library timing arcs.
|
|
void
|
|
Graph::makeInstanceEdges(const Instance *inst)
|
|
{
|
|
LibertyCell *cell = network_->libertyCell(inst);
|
|
if (cell)
|
|
makePortInstanceEdges(inst, cell, nullptr);
|
|
}
|
|
|
|
void
|
|
Graph::makePinInstanceEdges(const Pin *pin)
|
|
{
|
|
const Instance *inst = network_->instance(pin);
|
|
if (inst) {
|
|
LibertyCell *cell = network_->libertyCell(inst);
|
|
if (cell) {
|
|
LibertyPort *port = network_->libertyPort(pin);
|
|
makePortInstanceEdges(inst, cell, port);
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::makePortInstanceEdges(const Instance *inst,
|
|
LibertyCell *cell,
|
|
LibertyPort *from_to_port)
|
|
{
|
|
for (TimingArcSet *arc_set : cell->timingArcSets()) {
|
|
LibertyPort *from_port = arc_set->from();
|
|
LibertyPort *to_port = arc_set->to();
|
|
if ((from_to_port == nullptr
|
|
|| from_port == from_to_port
|
|
|| to_port == from_to_port)
|
|
&& filterEdge(arc_set)) {
|
|
Pin *from_pin = network_->findPin(inst, from_port);
|
|
Pin *to_pin = network_->findPin(inst, to_port);
|
|
if (from_pin && to_pin) {
|
|
Vertex *from_vertex, *from_bidirect_drvr_vertex;
|
|
Vertex *to_vertex, *to_bidirect_drvr_vertex;
|
|
pinVertices(from_pin, from_vertex, from_bidirect_drvr_vertex);
|
|
pinVertices(to_pin, to_vertex, to_bidirect_drvr_vertex);
|
|
// From pin and/or to pin can be bidirect.
|
|
// For combinational arcs edge is to driver.
|
|
// For timing checks edge is to load.
|
|
// Vertices can be missing from the graph if the pins
|
|
// are power or ground.
|
|
if (from_vertex) {
|
|
bool is_check = arc_set->role()->isTimingCheck();
|
|
if (to_bidirect_drvr_vertex &&
|
|
!is_check)
|
|
makeEdge(from_vertex, to_bidirect_drvr_vertex, arc_set);
|
|
else if (to_vertex) {
|
|
makeEdge(from_vertex, to_vertex, arc_set);
|
|
if (is_check) {
|
|
to_vertex->setHasChecks(true);
|
|
from_vertex->setIsCheckClk(true);
|
|
}
|
|
}
|
|
if (from_bidirect_drvr_vertex && to_vertex) {
|
|
// Internal path from bidirect output back into the
|
|
// instance.
|
|
Edge *edge = makeEdge(from_bidirect_drvr_vertex, to_vertex,
|
|
arc_set);
|
|
edge->setIsBidirectInstPath(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::makeWireEdges()
|
|
{
|
|
PinSet visited_drvrs(network_);
|
|
LeafInstanceIterator *inst_iter = network_->leafInstanceIterator();
|
|
while (inst_iter->hasNext()) {
|
|
Instance *inst = inst_iter->next();
|
|
makeInstDrvrWireEdges(inst, visited_drvrs);
|
|
}
|
|
delete inst_iter;
|
|
makeInstDrvrWireEdges(network_->topInstance(), visited_drvrs);
|
|
}
|
|
|
|
void
|
|
Graph::makeInstDrvrWireEdges(const Instance *inst,
|
|
PinSet &visited_drvrs)
|
|
{
|
|
InstancePinIterator *pin_iter = network_->pinIterator(inst);
|
|
while (pin_iter->hasNext()) {
|
|
Pin *pin = pin_iter->next();
|
|
if (network_->isDriver(pin)
|
|
&& !visited_drvrs.hasKey(pin))
|
|
makeWireEdgesFromPin(pin, visited_drvrs);
|
|
}
|
|
delete pin_iter;
|
|
}
|
|
|
|
void
|
|
Graph::makeWireEdgesFromPin(const Pin *drvr_pin)
|
|
{
|
|
PinSeq loads, drvrs;
|
|
PinSet visited_drvrs(network_);
|
|
FindNetDrvrLoads visitor(drvr_pin, visited_drvrs, loads, drvrs, network_);
|
|
network_->visitConnectedPins(drvr_pin, visitor);
|
|
|
|
for (auto load_pin : loads) {
|
|
if (drvr_pin != load_pin)
|
|
makeWireEdge(drvr_pin, load_pin);
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::makeWireEdgesFromPin(const Pin *drvr_pin,
|
|
PinSet &visited_drvrs)
|
|
{
|
|
// Find all drivers and loads on the net to avoid N*M run time
|
|
// for large fanin/fanout nets.
|
|
PinSeq loads, drvrs;
|
|
FindNetDrvrLoads visitor(drvr_pin, visited_drvrs, loads, drvrs, network_);
|
|
network_->visitConnectedPins(drvr_pin, visitor);
|
|
|
|
for (auto drvr_pin : drvrs) {
|
|
for (auto load_pin : loads) {
|
|
if (drvr_pin != load_pin)
|
|
makeWireEdge(drvr_pin, load_pin);
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::makeWireEdgesToPin(const Pin *to_pin)
|
|
{
|
|
PinSet *drvrs = network_->drivers(to_pin);
|
|
if (drvrs) {
|
|
for (auto drvr : *drvrs) {
|
|
if (drvr != to_pin)
|
|
makeWireEdge(drvr, to_pin);
|
|
}
|
|
}
|
|
}
|
|
|
|
class MakeEdgesThruHierPin : public HierPinThruVisitor
|
|
{
|
|
public:
|
|
MakeEdgesThruHierPin(Graph *graph);
|
|
|
|
private:
|
|
virtual void visit(const Pin *drvr,
|
|
const Pin *load);
|
|
|
|
Graph *graph_;
|
|
};
|
|
|
|
MakeEdgesThruHierPin::MakeEdgesThruHierPin(Graph *graph) :
|
|
HierPinThruVisitor(),
|
|
graph_(graph)
|
|
{
|
|
}
|
|
|
|
void
|
|
MakeEdgesThruHierPin::visit(const Pin *drvr,
|
|
const Pin *load)
|
|
{
|
|
graph_->makeWireEdge(drvr, load);
|
|
}
|
|
|
|
void
|
|
Graph::makeWireEdgesThruPin(const Pin *hpin)
|
|
{
|
|
MakeEdgesThruHierPin visitor(this);
|
|
visitDrvrLoadsThruHierPin(hpin, network_, &visitor);
|
|
}
|
|
|
|
void
|
|
Graph::makeWireEdge(const Pin *from_pin,
|
|
const Pin *to_pin)
|
|
{
|
|
TimingArcSet *arc_set = TimingArcSet::wireTimingArcSet();
|
|
Vertex *from_vertex, *from_bidirect_drvr_vertex;
|
|
pinVertices(from_pin, from_vertex, from_bidirect_drvr_vertex);
|
|
Vertex *to_vertex = pinLoadVertex(to_pin);
|
|
if (from_vertex && to_vertex) {
|
|
// From and/or to can be bidirect, but edge is always from driver to load.
|
|
if (from_bidirect_drvr_vertex)
|
|
makeEdge(from_bidirect_drvr_vertex, to_vertex, arc_set);
|
|
else
|
|
makeEdge(from_vertex, to_vertex, arc_set);
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
Vertex *
|
|
Graph::vertex(VertexId vertex_id) const
|
|
{
|
|
return vertices_->pointer(vertex_id);
|
|
}
|
|
|
|
VertexId
|
|
Graph::id(const Vertex *vertex) const
|
|
{
|
|
return vertices_->objectId(vertex);
|
|
}
|
|
|
|
void
|
|
Graph::makePinVertices(Pin *pin)
|
|
{
|
|
Vertex *vertex, *bidir_drvr_vertex;
|
|
makePinVertices(pin, vertex, bidir_drvr_vertex);
|
|
}
|
|
|
|
void
|
|
Graph::makePinVertices(Pin *pin,
|
|
Vertex *&vertex,
|
|
Vertex *&bidir_drvr_vertex)
|
|
{
|
|
PortDirection *dir = network_->direction(pin);
|
|
if (!dir->isPowerGround()) {
|
|
bool is_reg_clk = network_->isRegClkPin(pin);
|
|
vertex = makeVertex(pin, false, is_reg_clk);
|
|
network_->setVertexId(pin, id(vertex));
|
|
if (dir->isBidirect()) {
|
|
bidir_drvr_vertex = makeVertex(pin, true, is_reg_clk);
|
|
pin_bidirect_drvr_vertex_map_[pin] = bidir_drvr_vertex;
|
|
}
|
|
else
|
|
bidir_drvr_vertex = nullptr;
|
|
}
|
|
}
|
|
|
|
Vertex *
|
|
Graph::makeVertex(Pin *pin,
|
|
bool is_bidirect_drvr,
|
|
bool is_reg_clk)
|
|
{
|
|
Vertex *vertex = vertices_->make();
|
|
vertex->init(pin, is_bidirect_drvr, is_reg_clk);
|
|
makeVertexSlews(vertex);
|
|
if (is_reg_clk)
|
|
reg_clk_vertices_->insert(vertex);
|
|
return vertex;
|
|
}
|
|
|
|
void
|
|
Graph::pinVertices(const Pin *pin,
|
|
// Return values.
|
|
Vertex *&vertex,
|
|
Vertex *&bidirect_drvr_vertex) const
|
|
{
|
|
vertex = Graph::vertex(network_->vertexId(pin));
|
|
if (network_->direction(pin)->isBidirect())
|
|
bidirect_drvr_vertex = pin_bidirect_drvr_vertex_map_.findKey(pin);
|
|
else
|
|
bidirect_drvr_vertex = nullptr;
|
|
}
|
|
|
|
Vertex *
|
|
Graph::pinDrvrVertex(const Pin *pin) const
|
|
{
|
|
if (network_->direction(pin)->isBidirect())
|
|
return pin_bidirect_drvr_vertex_map_.findKey(pin);
|
|
else
|
|
return Graph::vertex(network_->vertexId(pin));
|
|
}
|
|
|
|
Vertex *
|
|
Graph::pinLoadVertex(const Pin *pin) const
|
|
{
|
|
return vertex(network_->vertexId(pin));
|
|
}
|
|
|
|
void
|
|
Graph::deleteVertex(Vertex *vertex)
|
|
{
|
|
if (vertex->isRegClk())
|
|
reg_clk_vertices_->erase(vertex);
|
|
Pin *pin = vertex->pin_;
|
|
if (vertex->isBidirectDriver())
|
|
pin_bidirect_drvr_vertex_map_.erase(pin_bidirect_drvr_vertex_map_
|
|
.find(pin));
|
|
else
|
|
network_->setVertexId(pin, vertex_id_null);
|
|
// Delete edges to vertex.
|
|
EdgeId edge_id, next_id;
|
|
for (edge_id = vertex->in_edges_; edge_id; edge_id = next_id) {
|
|
Edge *edge = Graph::edge(edge_id);
|
|
next_id = edge->vertex_in_link_;
|
|
deleteOutEdge(edge->from(this), edge);
|
|
arc_count_ -= edge->timingArcSet()->arcCount();
|
|
edges_->destroy(edge);
|
|
}
|
|
// Delete edges from vertex.
|
|
for (edge_id = vertex->out_edges_; edge_id; edge_id = next_id) {
|
|
Edge *edge = Graph::edge(edge_id);
|
|
next_id = edge->vertex_out_next_;
|
|
deleteInEdge(edge->to(this), edge);
|
|
arc_count_ -= edge->timingArcSet()->arcCount();
|
|
edges_->destroy(edge);
|
|
}
|
|
vertices_->destroy(vertex);
|
|
}
|
|
|
|
bool
|
|
Graph::hasFaninOne(Vertex *vertex) const
|
|
{
|
|
return vertex->in_edges_
|
|
&& edge(vertex->in_edges_)->vertex_in_link_ == 0;
|
|
}
|
|
|
|
void
|
|
Graph::deleteInEdge(Vertex *vertex,
|
|
Edge *edge)
|
|
{
|
|
EdgeId edge_id = id(edge);
|
|
EdgeId prev = 0;
|
|
for (EdgeId i = vertex->in_edges_;
|
|
i && i != edge_id;
|
|
i = Graph::edge(i)->vertex_in_link_)
|
|
prev = i;
|
|
if (prev)
|
|
Graph::edge(prev)->vertex_in_link_ = edge->vertex_in_link_;
|
|
else
|
|
vertex->in_edges_ = edge->vertex_in_link_;
|
|
}
|
|
|
|
void
|
|
Graph::deleteOutEdge(Vertex *vertex,
|
|
Edge *edge)
|
|
{
|
|
EdgeId next = edge->vertex_out_next_;
|
|
EdgeId prev = edge->vertex_out_prev_;
|
|
if (prev)
|
|
Graph::edge(prev)->vertex_out_next_ = next;
|
|
else
|
|
vertex->out_edges_ = next;
|
|
if (next)
|
|
Graph::edge(next)->vertex_out_prev_ = prev;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
Arrival *
|
|
Graph::makeArrivals(Vertex *vertex,
|
|
uint32_t count)
|
|
{
|
|
if (vertex->arrivals() != arrival_null)
|
|
debugPrint(debug_, "leaks", 617, "arrival leak");
|
|
Arrival *arrivals;
|
|
ArrivalId id;
|
|
{
|
|
UniqueLock lock(arrivals_lock_);
|
|
arrivals_.make(count, arrivals, id);
|
|
}
|
|
vertex->setArrivals(id);
|
|
return arrivals;
|
|
}
|
|
|
|
Arrival *
|
|
Graph::arrivals(Vertex *vertex)
|
|
{
|
|
return arrivals_.pointer(vertex->arrivals());
|
|
}
|
|
|
|
void
|
|
Graph::deleteArrivals(Vertex *vertex,
|
|
uint32_t count)
|
|
{
|
|
{
|
|
UniqueLock lock(arrivals_lock_);
|
|
arrivals_.destroy(vertex->arrivals(), count);
|
|
}
|
|
vertex->setArrivals(arrival_null);
|
|
}
|
|
|
|
Required *
|
|
Graph::makeRequireds(Vertex *vertex,
|
|
uint32_t count)
|
|
{
|
|
if (vertex->requireds() != arrival_null)
|
|
debugPrint(debug_, "leaks", 617, "required leak");
|
|
Required *requireds;
|
|
ArrivalId id;
|
|
{
|
|
UniqueLock lock(requireds_lock_);
|
|
requireds_.make(count, requireds, id);
|
|
}
|
|
vertex->setRequireds(id);
|
|
return requireds;
|
|
}
|
|
|
|
Required *
|
|
Graph::requireds(Vertex *vertex)
|
|
{
|
|
return requireds_.pointer(vertex->requireds());
|
|
}
|
|
|
|
void
|
|
Graph::deleteRequireds(Vertex *vertex,
|
|
uint32_t count)
|
|
{
|
|
{
|
|
UniqueLock lock(requireds_lock_);
|
|
requireds_.destroy(vertex->requireds(), count);
|
|
}
|
|
vertex->setRequireds(arrival_null);
|
|
}
|
|
|
|
void
|
|
Graph::clearArrivals()
|
|
{
|
|
arrivals_.clear();
|
|
requireds_.clear();
|
|
}
|
|
|
|
PathVertexRep *
|
|
Graph::makePrevPaths(Vertex *vertex,
|
|
uint32_t count)
|
|
{
|
|
PathVertexRep *prev_paths;
|
|
PrevPathId id;
|
|
{
|
|
UniqueLock lock(prev_paths_lock_);
|
|
prev_paths_.make(count, prev_paths, id);
|
|
}
|
|
vertex->setPrevPaths(id);
|
|
return prev_paths;
|
|
}
|
|
|
|
PathVertexRep *
|
|
Graph::prevPaths(Vertex *vertex) const
|
|
{
|
|
return prev_paths_.pointer(vertex->prevPaths());
|
|
}
|
|
|
|
void
|
|
Graph::clearPrevPaths()
|
|
{
|
|
prev_paths_.clear();
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
const Slew &
|
|
Graph::slew(const Vertex *vertex,
|
|
const RiseFall *rf,
|
|
DcalcAPIndex ap_index)
|
|
{
|
|
if (slew_rf_count_) {
|
|
int table_index =
|
|
(slew_rf_count_ == 1) ? ap_index : ap_index*slew_rf_count_+rf->index();
|
|
DelayTable *table = slew_tables_[table_index];
|
|
VertexId vertex_id = id(vertex);
|
|
return table->ref(vertex_id);
|
|
}
|
|
else {
|
|
static Slew slew(0.0);
|
|
return slew;
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::setSlew(Vertex *vertex,
|
|
const RiseFall *rf,
|
|
DcalcAPIndex ap_index,
|
|
const Slew &slew)
|
|
{
|
|
if (slew_rf_count_) {
|
|
int table_index =
|
|
(slew_rf_count_ == 1) ? ap_index : ap_index*slew_rf_count_+rf->index();
|
|
DelayTable *table = slew_tables_[table_index];
|
|
VertexId vertex_id = id(vertex);
|
|
Slew &vertex_slew = table->ref(vertex_id);
|
|
vertex_slew = slew;
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
Edge *
|
|
Graph::edge(EdgeId edge_id) const
|
|
{
|
|
return edges_->pointer(edge_id);
|
|
}
|
|
|
|
EdgeId
|
|
Graph::id(const Edge *edge) const
|
|
{
|
|
return edges_->objectId(edge);
|
|
}
|
|
|
|
Edge *
|
|
Graph::makeEdge(Vertex *from,
|
|
Vertex *to,
|
|
TimingArcSet *arc_set)
|
|
{
|
|
Edge *edge = edges_->make();
|
|
edge->init(id(from), id(to), arc_set);
|
|
makeEdgeArcDelays(edge);
|
|
arc_count_ += arc_set->arcCount();
|
|
// Add out edge to from vertex.
|
|
EdgeId next = from->out_edges_;
|
|
edge->vertex_out_next_ = next;
|
|
edge->vertex_out_prev_ = edge_id_null;
|
|
EdgeId edge_id = edges_->objectId(edge);
|
|
if (next)
|
|
Graph::edge(next)->vertex_out_prev_ = edge_id;
|
|
from->out_edges_ = edge_id;
|
|
|
|
// Add in edge to to vertex.
|
|
edge->vertex_in_link_ = to->in_edges_;
|
|
to->in_edges_ = edge_id;
|
|
|
|
return edge;
|
|
}
|
|
|
|
void
|
|
Graph::deleteEdge(Edge *edge)
|
|
{
|
|
Vertex *from = edge->from(this);
|
|
Vertex *to = edge->to(this);
|
|
deleteOutEdge(from, edge);
|
|
deleteInEdge(to, edge);
|
|
arc_count_ -= edge->timingArcSet()->arcCount();
|
|
edges_->destroy(edge);
|
|
}
|
|
|
|
void
|
|
Graph::makeArcDelayTables(DcalcAPIndex ap_count)
|
|
{
|
|
if (have_arc_delays_) {
|
|
arc_delays_.resize(ap_count);
|
|
for (DcalcAPIndex i = 0; i < ap_count; i++) {
|
|
DelayTable *table = new DelayTable();
|
|
arc_delays_[i] = table;
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::deleteArcDelayTables()
|
|
{
|
|
arc_delays_.deleteContentsClear();
|
|
}
|
|
|
|
void
|
|
Graph::makeEdgeArcDelays(Edge *edge)
|
|
{
|
|
if (have_arc_delays_) {
|
|
int arc_count = edge->timingArcSet()->arcCount();
|
|
ArcId arc_id = 0;
|
|
for (DcalcAPIndex i = 0; i < ap_count_; i++) {
|
|
DelayTable *table = arc_delays_[i];
|
|
ArcDelay *arc_delays;
|
|
table->make(arc_count, arc_delays, arc_id);
|
|
for (int j = 0; j < arc_count; j++)
|
|
arc_delays[j] = 0.0;
|
|
}
|
|
edge->setArcDelays(arc_id);
|
|
// Make sure there is room for delay_annotated flags.
|
|
size_t max_annot_index = (arc_id + arc_count) * ap_count_;
|
|
if (max_annot_index >= arc_delay_annotated_.size()) {
|
|
size_t size = max_annot_index * 1.2;
|
|
arc_delay_annotated_.resize(size);
|
|
}
|
|
removeDelayAnnotated(edge);
|
|
}
|
|
}
|
|
|
|
ArcDelay
|
|
Graph::arcDelay(const Edge *edge,
|
|
const TimingArc *arc,
|
|
DcalcAPIndex ap_index) const
|
|
{
|
|
if (have_arc_delays_) {
|
|
DelayTable *table = arc_delays_[ap_index];
|
|
ArcDelay *arc_delays = table->pointer(edge->arcDelays());
|
|
ArcDelay &arc_delay = arc_delays[arc->index()];
|
|
return arc_delay;
|
|
}
|
|
else
|
|
return delay_zero;
|
|
}
|
|
|
|
void
|
|
Graph::setArcDelay(Edge *edge,
|
|
const TimingArc *arc,
|
|
DcalcAPIndex ap_index,
|
|
ArcDelay delay)
|
|
{
|
|
if (have_arc_delays_) {
|
|
DelayTable *table = arc_delays_[ap_index];
|
|
ArcDelay *arc_delays = table->pointer(edge->arcDelays());
|
|
arc_delays[arc->index()] = delay;
|
|
}
|
|
}
|
|
|
|
const ArcDelay &
|
|
Graph::wireArcDelay(const Edge *edge,
|
|
const RiseFall *rf,
|
|
DcalcAPIndex ap_index)
|
|
{
|
|
if (have_arc_delays_) {
|
|
DelayTable *table = arc_delays_[ap_index];
|
|
ArcDelay *arc_delays = table->pointer(edge->arcDelays());
|
|
return arc_delays[rf->index()];
|
|
}
|
|
else
|
|
return delay_zero;
|
|
}
|
|
|
|
void
|
|
Graph::setWireArcDelay(Edge *edge,
|
|
const RiseFall *rf,
|
|
DcalcAPIndex ap_index,
|
|
const ArcDelay &delay)
|
|
{
|
|
if (have_arc_delays_) {
|
|
DelayTable *table = arc_delays_[ap_index];
|
|
ArcDelay *arc_delays = table->pointer(edge->arcDelays());
|
|
arc_delays[rf->index()] = delay;
|
|
}
|
|
}
|
|
|
|
bool
|
|
Graph::arcDelayAnnotated(Edge *edge,
|
|
TimingArc *arc,
|
|
DcalcAPIndex ap_index) const
|
|
{
|
|
if (arc_delay_annotated_.size()) {
|
|
size_t index = (edge->arcDelays() + arc->index()) * ap_count_ + ap_index;
|
|
if (index >= arc_delay_annotated_.size())
|
|
report_->critical(208, "arc_delay_annotated array bounds exceeded");
|
|
return arc_delay_annotated_[index];
|
|
}
|
|
else
|
|
return false;
|
|
}
|
|
|
|
void
|
|
Graph::setArcDelayAnnotated(Edge *edge,
|
|
TimingArc *arc,
|
|
DcalcAPIndex ap_index,
|
|
bool annotated)
|
|
{
|
|
size_t index = (edge->arcDelays() + arc->index()) * ap_count_ + ap_index;
|
|
if (index >= arc_delay_annotated_.size())
|
|
report_->critical(209, "arc_delay_annotated array bounds exceeded");
|
|
arc_delay_annotated_[index] = annotated;
|
|
}
|
|
|
|
bool
|
|
Graph::wireDelayAnnotated(Edge *edge,
|
|
const RiseFall *rf,
|
|
DcalcAPIndex ap_index) const
|
|
{
|
|
size_t index = (edge->arcDelays() + TimingArcSet::wireArcIndex(rf)) * ap_count_
|
|
+ ap_index;
|
|
if (index >= arc_delay_annotated_.size())
|
|
report_->critical(210, "arc_delay_annotated array bounds exceeded");
|
|
return arc_delay_annotated_[index];
|
|
}
|
|
|
|
void
|
|
Graph::setWireDelayAnnotated(Edge *edge,
|
|
const RiseFall *rf,
|
|
DcalcAPIndex ap_index,
|
|
bool annotated)
|
|
{
|
|
size_t index = (edge->arcDelays() + TimingArcSet::wireArcIndex(rf)) * ap_count_
|
|
+ ap_index;
|
|
if (index >= arc_delay_annotated_.size())
|
|
report_->critical(228, "arc_delay_annotated array bounds exceeded");
|
|
arc_delay_annotated_[index] = annotated;
|
|
}
|
|
|
|
// This only gets called if the analysis type changes from single
|
|
// to bc_wc/ocv or visa versa.
|
|
void
|
|
Graph::setDelayCount(DcalcAPIndex ap_count)
|
|
{
|
|
if (ap_count != ap_count_) {
|
|
// Discard any existing delays.
|
|
deleteSlewTables();
|
|
deleteArcDelayTables();
|
|
removeWidthCheckAnnotations();
|
|
removePeriodCheckAnnotations();
|
|
makeSlewTables(ap_count);
|
|
makeArcDelayTables(ap_count);
|
|
ap_count_ = ap_count;
|
|
removeDelays();
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::removeDelays()
|
|
{
|
|
VertexIterator vertex_iter(this);
|
|
while (vertex_iter.hasNext()) {
|
|
Vertex *vertex = vertex_iter.next();
|
|
makeVertexSlews(vertex);
|
|
VertexOutEdgeIterator edge_iter(vertex, this);
|
|
while (edge_iter.hasNext()) {
|
|
Edge *edge = edge_iter.next();
|
|
makeEdgeArcDelays(edge);
|
|
removeDelayAnnotated(edge);
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::removeDelayAnnotated(Edge *edge)
|
|
{
|
|
edge->setDelayAnnotationIsIncremental(false);
|
|
TimingArcSet *arc_set = edge->timingArcSet();
|
|
for (TimingArc *arc : arc_set->arcs()) {
|
|
for (DcalcAPIndex ap_index = 0; ap_index < ap_count_; ap_index++) {
|
|
setArcDelayAnnotated(edge, arc, ap_index, false);
|
|
}
|
|
}
|
|
}
|
|
|
|
bool
|
|
Graph::delayAnnotated(Edge *edge)
|
|
{
|
|
TimingArcSet *arc_set = edge->timingArcSet();
|
|
for (TimingArc *arc : arc_set->arcs()) {
|
|
for (DcalcAPIndex ap_index = 0; ap_index < ap_count_; ap_index++) {
|
|
if (arcDelayAnnotated(edge, arc, ap_index))
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void
|
|
Graph::makeSlewTables(DcalcAPIndex ap_count)
|
|
{
|
|
DcalcAPIndex tr_ap_count = slew_rf_count_ * ap_count;
|
|
slew_tables_.resize(tr_ap_count);
|
|
for (DcalcAPIndex i = 0; i < tr_ap_count; i++) {
|
|
DelayTable *table = new DelayTable;
|
|
slew_tables_[i] = table;
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::deleteSlewTables()
|
|
{
|
|
slew_tables_.deleteContentsClear();
|
|
}
|
|
|
|
void
|
|
Graph::makeVertexSlews(Vertex *vertex)
|
|
{
|
|
DcalcAPIndex tr_ap_count = slew_rf_count_ * ap_count_;
|
|
for (DcalcAPIndex i = 0; i < tr_ap_count; i++) {
|
|
DelayTable *table = slew_tables_[i];
|
|
// Slews are 1:1 with vertices and use the same object id.
|
|
Slew *slew = table->ensureId(vertices_->objectId(vertex));
|
|
*slew = 0.0;
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
void
|
|
Graph::widthCheckAnnotation(const Pin *pin,
|
|
const RiseFall *rf,
|
|
DcalcAPIndex ap_index,
|
|
// Return values.
|
|
float &width,
|
|
bool &exists)
|
|
{
|
|
exists = false;
|
|
if (width_check_annotations_) {
|
|
float *widths = width_check_annotations_->findKey(pin);
|
|
if (widths) {
|
|
int index = ap_index * RiseFall::index_count + rf->index();
|
|
width = widths[index];
|
|
if (width >= 0.0)
|
|
exists = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::setWidthCheckAnnotation(const Pin *pin,
|
|
const RiseFall *rf,
|
|
DcalcAPIndex ap_index,
|
|
float width)
|
|
{
|
|
if (width_check_annotations_ == nullptr)
|
|
width_check_annotations_ = new WidthCheckAnnotations;
|
|
float *widths = width_check_annotations_->findKey(pin);
|
|
if (widths == nullptr) {
|
|
int width_count = RiseFall::index_count * ap_count_;
|
|
widths = new float[width_count];
|
|
// Use negative (illegal) width values to indicate unannotated checks.
|
|
for (int i = 0; i < width_count; i++)
|
|
widths[i] = -1;
|
|
(*width_check_annotations_)[pin] = widths;
|
|
}
|
|
int index = ap_index * RiseFall::index_count + rf->index();
|
|
widths[index] = width;
|
|
}
|
|
|
|
void
|
|
Graph::removeWidthCheckAnnotations()
|
|
{
|
|
if (width_check_annotations_) {
|
|
WidthCheckAnnotations::Iterator check_iter(width_check_annotations_);
|
|
while (check_iter.hasNext()) {
|
|
float *widths = check_iter.next();
|
|
delete [] widths;
|
|
}
|
|
delete width_check_annotations_;
|
|
width_check_annotations_ = nullptr;
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
void
|
|
Graph::periodCheckAnnotation(const Pin *pin,
|
|
DcalcAPIndex ap_index,
|
|
// Return values.
|
|
float &period,
|
|
bool &exists)
|
|
{
|
|
exists = false;
|
|
if (period_check_annotations_) {
|
|
float *periods = period_check_annotations_->findKey(pin);
|
|
if (periods) {
|
|
period = periods[ap_index];
|
|
if (period >= 0.0)
|
|
exists = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::setPeriodCheckAnnotation(const Pin *pin,
|
|
DcalcAPIndex ap_index,
|
|
float period)
|
|
{
|
|
if (period_check_annotations_ == nullptr)
|
|
period_check_annotations_ = new PeriodCheckAnnotations;
|
|
float *periods = period_check_annotations_->findKey(pin);
|
|
if (periods == nullptr) {
|
|
periods = new float[ap_count_];
|
|
// Use negative (illegal) period values to indicate unannotated checks.
|
|
for (int i = 0; i < ap_count_; i++)
|
|
periods[i] = -1;
|
|
(*period_check_annotations_)[pin] = periods;
|
|
}
|
|
periods[ap_index] = period;
|
|
}
|
|
|
|
void
|
|
Graph::removePeriodCheckAnnotations()
|
|
{
|
|
if (period_check_annotations_) {
|
|
for (auto pin_floats : *period_check_annotations_) {
|
|
float *periods = pin_floats.second;
|
|
delete [] periods;
|
|
}
|
|
delete period_check_annotations_;
|
|
period_check_annotations_ = nullptr;
|
|
}
|
|
}
|
|
|
|
void
|
|
Graph::removeDelaySlewAnnotations()
|
|
{
|
|
VertexIterator vertex_iter(graph_);
|
|
while (vertex_iter.hasNext()) {
|
|
Vertex *vertex = vertex_iter.next();
|
|
VertexOutEdgeIterator edge_iter(vertex, graph_);
|
|
while (edge_iter.hasNext()) {
|
|
Edge *edge = edge_iter.next();
|
|
removeDelayAnnotated(edge);
|
|
}
|
|
vertex->removeSlewAnnotated();
|
|
}
|
|
removeWidthCheckAnnotations();
|
|
removePeriodCheckAnnotations();
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
//
|
|
// Vertex
|
|
//
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
Vertex::Vertex()
|
|
{
|
|
init(nullptr, false, false);
|
|
object_idx_ = object_idx_null;
|
|
}
|
|
|
|
void
|
|
Vertex::init(Pin *pin,
|
|
bool is_bidirect_drvr,
|
|
bool is_reg_clk)
|
|
{
|
|
pin_ = pin;
|
|
is_reg_clk_ = is_reg_clk;
|
|
is_bidirect_drvr_ = is_bidirect_drvr;
|
|
in_edges_ = edge_id_null;
|
|
out_edges_ = edge_id_null;
|
|
arrivals_ = arrival_null;
|
|
requireds_ = arrival_null;
|
|
prev_paths_ = prev_path_null;
|
|
tag_group_index_ = tag_group_index_max;
|
|
slew_annotated_ = false;
|
|
sim_value_ = unsigned(LogicValue::unknown);
|
|
is_disabled_constraint_ = false;
|
|
is_gated_clk_enable_ = false;
|
|
has_checks_ = false;
|
|
is_check_clk_ = false;
|
|
is_constrained_ = false;
|
|
has_downstream_clk_pin_ = false;
|
|
color_ = unsigned(LevelColor::white);
|
|
level_ = 0;
|
|
bfs_in_queue_ = 0;
|
|
crpr_path_pruning_disabled_ = false;
|
|
requireds_pruned_ = false;
|
|
}
|
|
|
|
void
|
|
Vertex::setObjectIdx(ObjectIdx idx)
|
|
{
|
|
object_idx_ = idx;
|
|
}
|
|
|
|
const char *
|
|
Vertex::name(const Network *network) const
|
|
{
|
|
if (network->direction(pin_)->isBidirect()) {
|
|
const char *pin_name = network->pathName(pin_);
|
|
return stringPrintTmp("%s %s",
|
|
pin_name,
|
|
is_bidirect_drvr_ ? "driver" : "load");
|
|
}
|
|
else
|
|
return network->pathName(pin_);
|
|
}
|
|
|
|
bool
|
|
Vertex::isDriver(const Network *network) const
|
|
{
|
|
PortDirection *dir = network->direction(pin_);
|
|
bool top_level_port = network->isTopLevelPort(pin_);
|
|
return ((top_level_port
|
|
&& (dir->isInput()
|
|
|| (dir->isBidirect()
|
|
&& is_bidirect_drvr_)))
|
|
|| (!top_level_port
|
|
&& (dir->isOutput()
|
|
|| dir->isTristate()
|
|
|| (dir->isBidirect()
|
|
&& is_bidirect_drvr_)
|
|
|| dir->isInternal())));
|
|
}
|
|
|
|
void
|
|
Vertex::setLevel(Level level)
|
|
{
|
|
level_ = level;
|
|
}
|
|
|
|
void
|
|
Vertex::setColor(LevelColor color)
|
|
{
|
|
color_ = unsigned(color);
|
|
}
|
|
|
|
bool
|
|
Vertex::slewAnnotated(const RiseFall *rf,
|
|
const MinMax *min_max) const
|
|
{
|
|
int index = min_max->index() * transitionCount() + rf->index();
|
|
return ((1 << index) & slew_annotated_) != 0;
|
|
}
|
|
|
|
bool
|
|
Vertex::slewAnnotated() const
|
|
{
|
|
return slew_annotated_ != 0;
|
|
}
|
|
|
|
void
|
|
Vertex::setSlewAnnotated(bool annotated,
|
|
const RiseFall *rf,
|
|
DcalcAPIndex ap_index)
|
|
{
|
|
// Track rise/fall/min/max annotations separately, but after that
|
|
// only rise/fall.
|
|
if (ap_index > 1)
|
|
ap_index = 0;
|
|
int index = ap_index * transitionCount() + rf->index();
|
|
if (annotated)
|
|
slew_annotated_ |= (1 << index);
|
|
else
|
|
slew_annotated_ &= ~(1 << index);
|
|
}
|
|
|
|
void
|
|
Vertex::removeSlewAnnotated()
|
|
{
|
|
slew_annotated_ = 0;
|
|
}
|
|
|
|
void
|
|
Vertex::setCrprPathPruningDisabled(bool disabled)
|
|
{
|
|
crpr_path_pruning_disabled_ = disabled;
|
|
}
|
|
|
|
void
|
|
Vertex::setRequiredsPruned(bool pruned)
|
|
{
|
|
requireds_pruned_ = pruned;
|
|
}
|
|
|
|
TagGroupIndex
|
|
Vertex::tagGroupIndex() const
|
|
{
|
|
return tag_group_index_;
|
|
}
|
|
|
|
void
|
|
Vertex::setTagGroupIndex(TagGroupIndex tag_index)
|
|
{
|
|
tag_group_index_ = tag_index;
|
|
}
|
|
|
|
void
|
|
Vertex::setArrivals(ArrivalId id)
|
|
{
|
|
arrivals_ = id;
|
|
}
|
|
|
|
void
|
|
Vertex::setRequireds(ArrivalId id)
|
|
{
|
|
requireds_ = id;
|
|
}
|
|
|
|
void
|
|
Vertex::setPrevPaths(PrevPathId prev_paths)
|
|
{
|
|
prev_paths_ = prev_paths;
|
|
}
|
|
|
|
void
|
|
Vertex::deletePaths()
|
|
{
|
|
arrivals_ = arrival_null;
|
|
requireds_ = arrival_null;
|
|
prev_paths_ = prev_path_null;
|
|
tag_group_index_ = tag_group_index_max;
|
|
crpr_path_pruning_disabled_ = false;
|
|
}
|
|
|
|
LogicValue
|
|
Vertex::simValue() const
|
|
{
|
|
return static_cast<LogicValue>(sim_value_);
|
|
}
|
|
|
|
void
|
|
Vertex::setSimValue(LogicValue value)
|
|
{
|
|
sim_value_ = unsigned(value);
|
|
}
|
|
|
|
bool
|
|
Vertex::isConstant() const
|
|
{
|
|
LogicValue value = static_cast<LogicValue>(sim_value_);
|
|
return value == LogicValue::zero
|
|
|| value == LogicValue::one;
|
|
}
|
|
|
|
void
|
|
Vertex::setIsDisabledConstraint(bool disabled)
|
|
{
|
|
is_disabled_constraint_ = disabled;
|
|
}
|
|
|
|
void
|
|
Vertex::setHasChecks(bool has_checks)
|
|
{
|
|
has_checks_ = has_checks;
|
|
}
|
|
|
|
void
|
|
Vertex::setIsCheckClk(bool is_check_clk)
|
|
{
|
|
is_check_clk_ = is_check_clk;
|
|
}
|
|
|
|
void
|
|
Vertex::setIsGatedClkEnable(bool enable)
|
|
{
|
|
is_gated_clk_enable_ = enable;
|
|
}
|
|
|
|
void
|
|
Vertex::setIsConstrained(bool constrained)
|
|
{
|
|
is_constrained_ = constrained;
|
|
}
|
|
|
|
void
|
|
Vertex::setHasDownstreamClkPin(bool has_clk_pin)
|
|
{
|
|
has_downstream_clk_pin_ = has_clk_pin;
|
|
}
|
|
|
|
bool
|
|
Vertex::bfsInQueue(BfsIndex index) const
|
|
{
|
|
return (bfs_in_queue_ >> unsigned(index)) & 1;
|
|
}
|
|
|
|
void
|
|
Vertex::setBfsInQueue(BfsIndex index,
|
|
bool value)
|
|
{
|
|
if (value)
|
|
bfs_in_queue_ |= 1 << int(index);
|
|
else
|
|
bfs_in_queue_ &= ~(1 << int(index));
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
//
|
|
// Edge
|
|
//
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
Edge::Edge()
|
|
{
|
|
init(0, 0, nullptr);
|
|
object_idx_ = object_idx_null;
|
|
}
|
|
|
|
void
|
|
Edge::init(VertexId from,
|
|
VertexId to,
|
|
TimingArcSet *arc_set)
|
|
{
|
|
from_ = from;
|
|
to_ = to;
|
|
arc_set_ = arc_set;
|
|
arc_delays_ = 0;
|
|
|
|
vertex_in_link_ = edge_id_null;
|
|
vertex_out_next_ = edge_id_null;
|
|
vertex_out_prev_ = edge_id_null;
|
|
is_bidirect_inst_path_ = false;
|
|
is_bidirect_net_path_ = false;
|
|
delay_annotation_is_incremental_ = false;
|
|
sim_timing_sense_ = unsigned(TimingSense::unknown);
|
|
is_disabled_constraint_ = false;
|
|
is_disabled_cond_ = false;
|
|
is_disabled_loop_ = false;
|
|
}
|
|
|
|
void
|
|
Edge::setObjectIdx(ObjectIdx idx)
|
|
{
|
|
object_idx_ = idx;
|
|
}
|
|
|
|
void
|
|
Edge::setTimingArcSet(TimingArcSet *set)
|
|
{
|
|
arc_set_ = set;
|
|
}
|
|
|
|
void
|
|
Edge::setArcDelays(ArcId arc_delays)
|
|
{
|
|
arc_delays_ = arc_delays;
|
|
}
|
|
|
|
bool
|
|
Edge::delayAnnotationIsIncremental() const
|
|
{
|
|
return delay_annotation_is_incremental_;
|
|
}
|
|
|
|
void
|
|
Edge::setDelayAnnotationIsIncremental(bool is_incr)
|
|
{
|
|
delay_annotation_is_incremental_ = is_incr;
|
|
}
|
|
|
|
TimingRole *
|
|
Edge::role() const
|
|
{
|
|
return arc_set_->role();
|
|
}
|
|
|
|
bool
|
|
Edge::isWire() const
|
|
{
|
|
return arc_set_->role()->isWire();
|
|
}
|
|
|
|
TimingSense
|
|
Edge::sense() const
|
|
{
|
|
return arc_set_->sense();
|
|
}
|
|
|
|
|
|
TimingSense
|
|
Edge::simTimingSense() const
|
|
{
|
|
return static_cast<TimingSense>(sim_timing_sense_);
|
|
}
|
|
|
|
void
|
|
Edge::setSimTimingSense(TimingSense sense)
|
|
{
|
|
sim_timing_sense_ = unsigned(sense);
|
|
}
|
|
|
|
bool
|
|
Edge::isDisabledConstraint() const
|
|
{
|
|
TimingRole *role = arc_set_->role();
|
|
bool is_wire = role->isWire();
|
|
return is_disabled_constraint_
|
|
|| arc_set_->isDisabledConstraint()
|
|
// set_disable_timing cell does not disable timing checks.
|
|
|| (!(role->isTimingCheck() || is_wire)
|
|
&& arc_set_->libertyCell()->isDisabledConstraint())
|
|
|| (!is_wire
|
|
&& arc_set_->from()->isDisabledConstraint())
|
|
|| (!is_wire
|
|
&& arc_set_->to()->isDisabledConstraint());
|
|
}
|
|
|
|
|
|
void
|
|
Edge::setIsDisabledConstraint(bool disabled)
|
|
{
|
|
is_disabled_constraint_ = disabled;
|
|
}
|
|
|
|
void
|
|
Edge::setIsDisabledCond(bool disabled)
|
|
{
|
|
is_disabled_cond_ = disabled;
|
|
}
|
|
|
|
void
|
|
Edge::setIsDisabledLoop(bool disabled)
|
|
{
|
|
is_disabled_loop_ = disabled;
|
|
}
|
|
|
|
void
|
|
Edge::setIsBidirectInstPath(bool is_bidir)
|
|
{
|
|
is_bidirect_inst_path_ = is_bidir;
|
|
}
|
|
|
|
void
|
|
Edge::setIsBidirectNetPath(bool is_bidir)
|
|
{
|
|
is_bidirect_net_path_ = is_bidir;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
VertexIterator::VertexIterator(Graph *graph) :
|
|
graph_(graph),
|
|
network_(graph->network()),
|
|
top_inst_(network_->topInstance()),
|
|
inst_iter_(network_->leafInstanceIterator()),
|
|
pin_iter_(nullptr),
|
|
vertex_(nullptr),
|
|
bidir_vertex_(nullptr)
|
|
{
|
|
if (inst_iter_)
|
|
findNext();
|
|
}
|
|
|
|
Vertex *
|
|
VertexIterator::next()
|
|
{
|
|
Vertex *next = nullptr;
|
|
if (vertex_) {
|
|
next = vertex_;
|
|
vertex_ = nullptr;
|
|
}
|
|
else if (bidir_vertex_) {
|
|
next = bidir_vertex_;
|
|
bidir_vertex_ = nullptr;
|
|
}
|
|
if (bidir_vertex_ == nullptr)
|
|
findNext();
|
|
return next;
|
|
}
|
|
|
|
bool
|
|
VertexIterator::findNextPin()
|
|
{
|
|
while (pin_iter_->hasNext()) {
|
|
Pin *pin = pin_iter_->next();
|
|
vertex_ = graph_->vertex(network_->vertexId(pin));
|
|
bidir_vertex_ = network_->direction(pin)->isBidirect()
|
|
? graph_->pin_bidirect_drvr_vertex_map_.findKey(pin)
|
|
: nullptr;
|
|
if (vertex_ || bidir_vertex_)
|
|
return true;
|
|
}
|
|
delete pin_iter_;
|
|
pin_iter_ = nullptr;
|
|
return false;
|
|
}
|
|
|
|
void
|
|
VertexIterator::findNext()
|
|
{
|
|
while (inst_iter_) {
|
|
if (pin_iter_
|
|
&& findNextPin())
|
|
return;
|
|
|
|
if (inst_iter_->hasNext()) {
|
|
Instance *inst = inst_iter_->next();
|
|
pin_iter_ = network_->pinIterator(inst);
|
|
} else {
|
|
delete inst_iter_;
|
|
inst_iter_ = nullptr;
|
|
if (top_inst_) {
|
|
pin_iter_ = network_->pinIterator(top_inst_);
|
|
top_inst_ = nullptr;
|
|
}
|
|
}
|
|
}
|
|
if (pin_iter_)
|
|
findNextPin();
|
|
}
|
|
|
|
VertexInEdgeIterator::VertexInEdgeIterator(Vertex *vertex,
|
|
const Graph *graph) :
|
|
next_(graph->edge(vertex->in_edges_)),
|
|
graph_(graph)
|
|
{
|
|
}
|
|
|
|
VertexInEdgeIterator::VertexInEdgeIterator(VertexId vertex_id,
|
|
const Graph *graph) :
|
|
next_(graph->edge(graph->vertex(vertex_id)->in_edges_)),
|
|
graph_(graph)
|
|
{
|
|
}
|
|
|
|
Edge *
|
|
VertexInEdgeIterator::next()
|
|
{
|
|
Edge *next = next_;
|
|
if (next_)
|
|
next_ = graph_->edge(next_->vertex_in_link_);
|
|
return next;
|
|
}
|
|
|
|
VertexOutEdgeIterator::VertexOutEdgeIterator(Vertex *vertex,
|
|
const Graph *graph) :
|
|
next_(graph->edge(vertex->out_edges_)),
|
|
graph_(graph)
|
|
{
|
|
}
|
|
|
|
Edge *
|
|
VertexOutEdgeIterator::next()
|
|
{
|
|
Edge *next = next_;
|
|
if (next_)
|
|
next_ = graph_->edge(next_->vertex_out_next_);
|
|
return next;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
class FindEdgesThruHierPinVisitor : public HierPinThruVisitor
|
|
{
|
|
public:
|
|
FindEdgesThruHierPinVisitor(EdgeSet &edges,
|
|
Graph *graph);
|
|
virtual void visit(const Pin *drvr,
|
|
const Pin *load);
|
|
|
|
protected:
|
|
EdgeSet &edges_;
|
|
Graph *graph_;
|
|
};
|
|
|
|
FindEdgesThruHierPinVisitor::FindEdgesThruHierPinVisitor(EdgeSet &edges,
|
|
Graph *graph) :
|
|
HierPinThruVisitor(),
|
|
edges_(edges),
|
|
graph_(graph)
|
|
{
|
|
}
|
|
|
|
void
|
|
FindEdgesThruHierPinVisitor::visit(const Pin *drvr,
|
|
const Pin *load)
|
|
{
|
|
Vertex *drvr_vertex = graph_->pinDrvrVertex(drvr);
|
|
Vertex *load_vertex = graph_->pinLoadVertex(load);
|
|
// Iterate over load drivers to avoid driver fanout^2.
|
|
VertexInEdgeIterator edge_iter(load_vertex, graph_);
|
|
while (edge_iter.hasNext()) {
|
|
Edge *edge = edge_iter.next();
|
|
if (edge->from(graph_) == drvr_vertex)
|
|
edges_.insert(edge);
|
|
}
|
|
}
|
|
|
|
EdgesThruHierPinIterator::EdgesThruHierPinIterator(const Pin *hpin,
|
|
Network *network,
|
|
Graph *graph)
|
|
{
|
|
FindEdgesThruHierPinVisitor visitor(edges_, graph);
|
|
visitDrvrLoadsThruHierPin(hpin, network, &visitor);
|
|
edge_iter_.init(edges_);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
VertexIdLess::VertexIdLess(Graph *&graph) :
|
|
graph_(graph)
|
|
{
|
|
}
|
|
|
|
bool
|
|
VertexIdLess::operator()(const Vertex *vertex1,
|
|
const Vertex *vertex2) const
|
|
{
|
|
return graph_->id(vertex1) < graph_->id(vertex2);
|
|
}
|
|
|
|
VertexSet::VertexSet(Graph *&graph) :
|
|
Set<Vertex*, VertexIdLess>(VertexIdLess(graph))
|
|
{
|
|
}
|
|
|
|
} // namespace
|