1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (c) 2019, Nefelus Inc
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 // * Redistributions of source code must retain the above copyright notice, this
11 //   list of conditions and the following disclaimer.
12 //
13 // * Redistributions in binary form must reproduce the above copyright notice,
14 //   this list of conditions and the following disclaimer in the documentation
15 //   and/or other materials provided with the distribution.
16 //
17 // * Neither the name of the copyright holder nor the names of its
18 //   contributors may be used to endorse or promote products derived from
19 //   this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 // POSSIBILITY OF SUCH DAMAGE.
32 
33 #pragma once
34 
35 #include "dbCore.h"
36 #include "dbId.h"
37 #include "dbTypes.h"
38 #include "dbVector.h"
39 #include "odb.h"
40 
41 namespace odb {
42 
43 class _dbITerm;
44 class _dbBTerm;
45 class _dbWire;
46 class _dbSWire;
47 class _dbCapNode;
48 class _dbRSeg;
49 class _dbCCSeg;
50 class _dbTechNonDefaultRule;
51 class _dbDatabase;
52 class _dbGroup;
53 class dbIStream;
54 class dbOStream;
55 class dbDiff;
56 
57 struct _dbNetFlags
58 {
59   dbSigType::Value _sig_type : 4;
60   dbWireType::Value _wire_type : 4;
61   uint _special : 1;
62   uint _wild_connect : 1;
63   uint _wire_ordered : 1;
64   uint _buffered : 1;
65   uint _disconnected : 1;  // this flag is only valid if wire_ordered == true
66   uint _spef : 1;
67   uint _select : 1;
68   uint _mark : 1;
69   uint _mark_1 : 1;
70   uint _wire_altered : 1;
71   uint _extracted : 1;
72   uint _rc_graph : 1;
73   uint _reduced : 1;
74   uint _set_io : 1;
75   uint _io : 1;
76   uint _dont_touch : 1;
77   uint _size_only : 1;
78   uint _fixed_bump : 1;
79   dbSourceType::Value _source : 4;
80   uint _rc_disconnected : 1;
81   uint _block_rule : 1;
82 };
83 
84 class _dbNet : public _dbObject
85 {
86  public:
87   enum Field  // dbJournal field name
88   {
89     FLAGS,
90     NON_DEFAULT_RULE,
91     TERM_EXTID,
92     HEAD_CAPNODE,
93     HEAD_RSEG,
94     REVERSE_RSEG,
95     INVALIDATETIMING,
96   };
97 
98   // PERSISTANT-MEMBERS
99   _dbNetFlags _flags;
100   char* _name;
101   union
102   {
103     float _gndc_calibration_factor;
104     float _refCC;
105   };
106   union
107   {
108     float _cc_calibration_factor;
109     float _dbCC;
110     float _CcMatchRatio;
111   };
112   dbId<_dbNet> _next_entry;
113   dbId<_dbITerm> _iterms;
114   dbId<_dbBTerm> _bterms;
115   dbId<_dbWire> _wire;
116   dbId<_dbWire> _global_wire;
117   dbId<_dbSWire> _swires;
118   dbId<_dbCapNode> _cap_nodes;
119   dbId<_dbRSeg> _r_segs;
120   dbId<_dbTechNonDefaultRule> _non_default_rule;
121   dbVector<dbId<_dbGroup>> _groups;
122   int _weight;
123   int _xtalk;
124   float _ccAdjustFactor;
125   uint _ccAdjustOrder;
126   // NON PERSISTANT-MEMBERS
127   int _drivingIterm;
128 
129   _dbNet(_dbDatabase*);
130   _dbNet(_dbDatabase*, const _dbNet& n);
131   ~_dbNet();
132 
133   bool operator==(const _dbNet& rhs) const;
134   bool operator!=(const _dbNet& rhs) const { return !operator==(rhs); }
135   bool operator<(const _dbNet& rhs) const;
136   void differences(dbDiff& diff, const char* field, const _dbNet& rhs) const;
137   void out(dbDiff& diff, char side, const char* field) const;
138 };
139 
140 dbOStream& operator<<(dbOStream& stream, const _dbNet& net);
141 dbIStream& operator>>(dbIStream& stream, _dbNet& net);
142 
143 }  // namespace odb
144