1 // OpenSTA, Static Timing Analyzer
2 // Copyright (c) 2020, Parallax Software, Inc.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program.  If not, see <https://www.gnu.org/licenses/>.
16 
17 #pragma once
18 
19 #include "DisallowCopyAssign.hh"
20 #include "Set.hh"
21 #include "NetworkClass.hh"
22 
23 namespace sta {
24 
25 class HpinDrvrLoad;
26 class HpinDrvrLoadVisitor;
27 
28 void
29 visitHpinDrvrLoads(const Pin *pin,
30 		   const Network *network,
31 		   HpinDrvrLoadVisitor *visitor);
32 
33 class HpinDrvrLoadLess
34 {
35 public:
36   bool operator()(const HpinDrvrLoad *drvr_load1,
37 		  const HpinDrvrLoad *drvr_load2) const;
38 };
39 
40 typedef Set<HpinDrvrLoad*, HpinDrvrLoadLess> HpinDrvrLoads;
41 
42 // Abstract base class for visitDrvrLoadsThruHierPin visitor.
43 class HpinDrvrLoadVisitor
44 {
45 public:
HpinDrvrLoadVisitor()46   HpinDrvrLoadVisitor() {}
~HpinDrvrLoadVisitor()47   virtual ~HpinDrvrLoadVisitor() {}
48   virtual void visit(HpinDrvrLoad *drvr_load) = 0;
49 
50 private:
51   DISALLOW_COPY_AND_ASSIGN(HpinDrvrLoadVisitor);
52 };
53 
54 class HpinDrvrLoad
55 {
56 public:
57   HpinDrvrLoad(Pin *drvr,
58 	       Pin *load,
59 	       PinSet *hpins_from_drvr,
60 	       PinSet *hpins_to_load);
61   ~HpinDrvrLoad();
62   void report(const Network *network);
63   HpinDrvrLoad(Pin *drvr,
64 	       Pin *load);
drvr() const65   Pin *drvr() const { return drvr_; }
load() const66   Pin *load() const { return load_; }
hpinsFromDrvr()67   PinSet *hpinsFromDrvr() { return hpins_from_drvr_; }
hpinsToLoad()68   PinSet *hpinsToLoad() { return hpins_to_load_; }
69   void setDrvr(Pin *drvr);
70 
71 private:
72   Pin *drvr_;
73   Pin *load_;
74   PinSet *hpins_from_drvr_;
75   PinSet *hpins_to_load_;
76 };
77 
78 } // namespace
79