Skip to content

Commit c6ce319

Browse files
committed
Revert "Revert "Merge pull request #346 from The-OpenROAD-Project/ARC""
This reverts commit 53ff70d.
1 parent 53ff70d commit c6ce319

25 files changed

+67416
-1
lines changed

include/openroad/OpenRoad.hh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ namespace pdnsim {
9898
class PDNSim;
9999
}
100100

101+
namespace antenna_checker {
102+
class AntennaChecker;
103+
}
104+
105+
101106
namespace ord {
102107

103108
using std::string;
@@ -128,6 +133,7 @@ public:
128133
replace::Replace* getReplace() { return replace_; }
129134
pdnsim::PDNSim* getPDNSim() { return pdnsim_; }
130135
FastRoute::FastRouteKernel* getFastRoute() { return fastRoute_; }
136+
antenna_checker::AntennaChecker *getAntennaChecker(){ return antennaChecker_; }
131137
// Return the bounding box of the db rows.
132138
odb::Rect getCore();
133139
// Return true if the command units have been initialized.
@@ -186,6 +192,7 @@ private:
186192
TritonCTS::TritonCTSKernel *tritonCts_;
187193
tapcell::Tapcell *tapcell_;
188194
OpenRCX::Ext *extractor_;
195+
antenna_checker::AntennaChecker *antennaChecker_;
189196
#ifdef BUILD_OPENPHYSYN
190197
psn::Psn *psn_;
191198
#endif

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ set(OPENRCX_HOME ${OPENROAD_HOME}/src/OpenRCX)
3030
set(MPLACE_HOME ${PROJECT_SOURCE_DIR}/src/TritonMacroPlace)
3131
set(OPENPHYSYN_HOME ${PROJECT_SOURCE_DIR}/src/OpenPhySyn)
3232
set(PDNSIM_HOME ${PROJECT_SOURCE_DIR}/src/PDNSim)
33+
set(ANTENNACHECKER_HOME ${PROJECT_SOURCE_DIR}/src/antennachecker)
3334

3435
set(OPENROAD_TCL_INIT ${CMAKE_CURRENT_BINARY_DIR}/OpenRoadTclInitVar.cc)
3536

@@ -220,6 +221,7 @@ add_subdirectory(tapcell)
220221
add_subdirectory(TritonMacroPlace)
221222
add_subdirectory(OpenRCX)
222223
add_subdirectory(PDNSim)
224+
add_subdirectory(antennachecker)
223225

224226
if(BUILD_OPENPHYSYN)
225227
add_subdirectory(OpenPhySyn)
@@ -255,6 +257,7 @@ target_include_directories(openroad
255257
${TAPCELL_HOME}/include
256258
${OPENRCX_HOME}/include
257259
${PDNSIM_HOME}/include
260+
${ANTENNACHECKER_HOME}/include
258261
${TCL_INCLUDE_PATH}
259262
${Boost_INCLUDE_DIRS}
260263
)
@@ -285,6 +288,7 @@ target_link_libraries(openroad
285288
defout
286289
lefin
287290
lefout
291+
antennachecker
288292
zutil
289293
${TCL_LIBRARY}
290294
)

src/FastRoute

src/OpenRoad.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#include "tapcell/MakeTapcell.h"
6666
#include "OpenRCX/MakeOpenRCX.h"
6767
#include "pdnsim/MakePDNSim.hh"
68+
#include "antennachecker/MakeAntennaChecker.hh"
6869
#ifdef BUILD_OPENPHYSYN
6970
#include "OpenPhySyn/MakeOpenPhySyn.hpp"
7071
#endif
@@ -157,6 +158,7 @@ OpenRoad::init(Tcl_Interp *tcl_interp)
157158
extractor_ = makeOpenRCX();
158159
replace_ = makeReplace();
159160
pdnsim_ = makePDNSim();
161+
antennaChecker_ = makeAntennaChecker();
160162
#ifdef BUILD_OPENPHYSYN
161163
psn_ = makePsn();
162164
#endif
@@ -181,6 +183,7 @@ OpenRoad::init(Tcl_Interp *tcl_interp)
181183
initTritonMp(this);
182184
initOpenRCX(this);
183185
initPDNSim(this);
186+
initAntennaChecker(this);
184187
#ifdef BUILD_OPENPHYSYN
185188
initPsn(this);
186189
#endif

src/antennachecker/CMakeLists.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# BSD 3-Clause License
2+
#
3+
# Copyright (c) 2020, MICL, DD-Lab, University of Michigan
4+
# All rights reserved.
5+
#
6+
# Redistribution and use in source and binary forms, with or without
7+
# modification, are permitted provided that the following conditions are met:
8+
#
9+
# * Redistributions of source code must retain the above copyright notice, this
10+
# list of conditions and the following disclaimer.
11+
#
12+
# * Redistributions in binary form must reproduce the above copyright notice,
13+
# this list of conditions and the following disclaimer in the documentation
14+
# and/or other materials provided with the distribution.
15+
#
16+
# * Neither the name of the copyright holder nor the names of its
17+
# contributors may be used to endorse or promote products derived from
18+
# this software without specific prior written permission.
19+
#
20+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30+
# POSSIBILITY OF SUCH DAMAGE.
31+
32+
add_subdirectory(src)

src/antennachecker/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Antenna Rule Checker
2+
3+
Check antenna violations based on an input LEF and DEF file, a report
4+
will be generated to indicate violated nets. 4 APIs are provided as an interface with FastRoute to preemptively fix antenna violation as well as used for the diode insertion flow:
5+
6+
## Antenna check Commands
7+
8+
---
9+
10+
- `load_antenna_rules`: import antenna rules to ARC, must be called before other commands
11+
- `check_antennas`: check antenna violations on all nets and generate a reportt
12+
13+
## Antenna fix Commands
14+
15+
---
16+
17+
### Tcl commands
18+
19+
- `check_net_violation`: check if an input net is violated, return 1 if the net is violated
20+
- -net_name: set the net name for checking
21+
- `get_met_avail_length`: print the available metal length that can be added to a net, while keeping other layers unchange and PAR values meet the ratio
22+
- -net_name: set the net name for calculation
23+
- -routing_level: set the layer whose rest metal length will be returned
24+
25+
### C++ commands
26+
27+
- `PAR_max_wire_length(dbNet * net, int routing_level)`
28+
This function returns the max wire length allowed to add for a given net, in a
29+
specific layer.
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
2+
// BSD 3-Clause License
3+
//
4+
// Copyright (c) 2020, MICL, DD-Lab, University of Michigan
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+
#include <tcl.h>
34+
#include <map>
35+
#include "opendb/db.h"
36+
#include "opendb/dbWireGraph.h"
37+
38+
39+
struct PARinfo
40+
{
41+
std::pair<odb::dbWireGraph::Node*, std::vector<odb::dbWireGraph::Node*>> WirerootNode;
42+
long unsigned int num_iterms;
43+
double wire_area;
44+
double side_wire_area;
45+
double iterm_areas[2];
46+
double PAR_value;
47+
double PSR_value;
48+
double diff_PAR_value;
49+
double diff_PSR_value;
50+
};
51+
52+
struct ARinfo
53+
{
54+
odb::dbWireGraph::Node * WirerootNode;
55+
odb::dbWireGraph::Node * GateNode;
56+
bool violated_net;
57+
double PAR_value;
58+
double PSR_value;
59+
double diff_PAR_value;
60+
double diff_PSR_value;
61+
double CAR_value;
62+
double CSR_value;
63+
double diff_CAR_value;
64+
double diff_CSR_value;
65+
double diff_area;
66+
};
67+
68+
struct ANTENNAmodel
69+
{
70+
odb::dbTechLayer* layer;
71+
72+
double metal_factor;
73+
double diff_metal_factor;
74+
75+
double cut_factor;
76+
double diff_cut_factor;
77+
78+
double side_metal_factor;
79+
double diff_side_metal_factor;
80+
81+
double minus_diff_factor;
82+
double plus_diff_factor;
83+
double diff_metal_reduce_factor;
84+
85+
ANTENNAmodel& operator =(const ANTENNAmodel& am)
86+
{
87+
metal_factor = am.metal_factor;
88+
diff_metal_factor = am.diff_metal_factor;
89+
cut_factor = am.cut_factor;
90+
diff_cut_factor = am.diff_cut_factor;
91+
side_metal_factor = am.side_metal_factor;
92+
diff_side_metal_factor = am.diff_side_metal_factor;
93+
minus_diff_factor = am.minus_diff_factor;
94+
plus_diff_factor = am.plus_diff_factor;
95+
diff_metal_reduce_factor = am.diff_metal_reduce_factor;
96+
97+
return *this;
98+
}
99+
100+
101+
};
102+
103+
namespace antenna_checker {
104+
105+
using odb::dbNet;
106+
using odb::dbWire;
107+
using odb::dbSWire;
108+
using odb::dbInst;
109+
using odb::dbWireGraph;
110+
using odb::dbTechLayer;
111+
using odb::dbITerm;
112+
113+
typedef std::pair<dbWireGraph::Node*, std::vector<dbWireGraph::Node*>> wireroots_info_vec;
114+
115+
class AntennaChecker
116+
{
117+
118+
public:
119+
AntennaChecker();
120+
~AntennaChecker();
121+
122+
void setDb( odb::dbDatabase *db ) { db_ = db; }
123+
void set_verbose( bool verbose ) { verbose_ = verbose; }
124+
void set_net_name( std::string net_name ) { net_name_ = net_name; }
125+
void set_route_level( int route_level ) { route_level_ = route_level; }
126+
127+
dbNet* get_net( std::string net_name );
128+
129+
template <class valueType>
130+
double defdist( valueType value );
131+
132+
wireroots_info_vec find_segment_root(std::pair<dbWireGraph::Node*, std::vector<dbWireGraph::Node*>> node_info, int wire_level );
133+
dbWireGraph::Node * find_segment_start( dbWireGraph::Node * node );
134+
bool if_segment_root( dbWireGraph::Node * node, int wire_level );
135+
136+
void find_wire_below_iterms( dbWireGraph::Node * node, double iterm_areas[2], int wire_level, std::set<dbITerm*>& iv, std::set<dbWireGraph::Node*>& nv);
137+
std::pair<double, double> calculate_wire_area( dbWireGraph::Node * node, int wire_level, std::set<dbWireGraph::Node*>& nv, std::set<dbWireGraph::Node*>& level_nodes );
138+
139+
double get_via_area( dbWireGraph::Edge * edge );
140+
dbTechLayer * get_via_layer( dbWireGraph::Edge * edge );
141+
std::string get_via_name( dbWireGraph::Edge * edge );
142+
double calculate_via_area( dbWireGraph::Node * node, int wire_level );
143+
dbWireGraph::Edge * find_via( dbWireGraph::Node * node, int wire_level );
144+
145+
void find_car_path( dbWireGraph::Node * node, int wire_level, dbWireGraph::Node * goal, std::vector<dbWireGraph::Node *> &current_path, std::vector<dbWireGraph::Node *> &path_found );
146+
147+
void print_graph_info( dbWireGraph graph );
148+
void calculate_PAR_table( std::vector<PARinfo>& PARtable );
149+
bool check_iterm( dbWireGraph::Node* node, double iterm_areas[2] );
150+
double get_pwl_factor(odb::dbTechLayerAntennaRule::pwl_pair pwl_info, double ref_val, double def);
151+
152+
void build_wire_PAR_table( std::vector<PARinfo> &PARtable, std::vector<std::pair<dbWireGraph::Node *, std::vector<dbWireGraph::Node*>>> wireroots_info );
153+
void build_wire_CAR_table( std::vector<ARinfo> &CARtable, std::vector<PARinfo> PARtable, std::vector<PARinfo> VIA_PARtable, std::vector<dbWireGraph::Node *> gate_iterms );
154+
void build_VIA_PAR_table( std::vector<PARinfo> &VIA_PARtable, std::vector<std::pair<dbWireGraph::Node *,std::vector<dbWireGraph::Node*>>> wireroots_info );
155+
void build_VIA_CAR_table( std::vector<ARinfo> &VIA_CARtable, std::vector<PARinfo> PARtable, std::vector<PARinfo> VIA_PARtable, std::vector<dbWireGraph::Node *> gate_iterms );
156+
157+
std::vector<wireroots_info_vec> get_wireroots(dbWireGraph graph);
158+
159+
bool check_wire_PAR( ARinfo AntennaRatio );
160+
bool check_wire_CAR( ARinfo AntennaRatio );
161+
bool check_VIA_PAR( ARinfo AntennaRatio );
162+
bool check_VIA_CAR( ARinfo AntennaRatio );
163+
164+
std::vector<int> GetAntennaRatio();
165+
166+
void load_antenna_rules();
167+
void check_antennas();
168+
169+
void find_wireroot_iterms( dbWireGraph::Node * node, int wire_level, std::vector<dbITerm *>& gates );
170+
std::vector<std::pair<double, std::vector<dbITerm *>>> PAR_max_wire_length( dbNet * net, int route_level );
171+
void check_par_max_length();
172+
std::vector<std::pair<int, std::vector<dbITerm *>>> get_net_antenna_violations( dbNet * net );
173+
std::vector<std::pair<double, std::vector<dbITerm *>>> get_violated_wire_length( dbNet * net, int routing_level );
174+
175+
private:
176+
odb::dbDatabase *db_;
177+
FILE* _out;
178+
bool verbose_;
179+
std::string net_name_;
180+
int route_level_;
181+
std::map<odb::dbTechLayer*, ANTENNAmodel> layer_info;
182+
183+
184+
};
185+
186+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// BSD 3-Clause License
2+
//
3+
// Copyright (c) 2020, MICL, DD-Lab, University of Michigan
4+
// All rights reserved.
5+
//
6+
// Redistribution and use in source and binary forms, with or without
7+
// modification, are permitted provided that the following conditions are met:
8+
//
9+
// * Redistributions of source code must retain the above copyright notice, this
10+
// list of conditions and the following disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above copyright notice,
13+
// this list of conditions and the following disclaimer in the documentation
14+
// and/or other materials provided with the distribution.
15+
//
16+
// * Neither the name of the copyright holder nor the names of its
17+
// contributors may be used to endorse or promote products derived from
18+
// this software without specific prior written permission.
19+
//
20+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30+
// POSSIBILITY OF SUCH DAMAGE.
31+
32+
#ifndef MAKE_ANTENNACHECKER_H
33+
#define MAKE_ANTENNACHECKER_H
34+
35+
namespace antenna_checker {
36+
class AntennaChecker;
37+
}
38+
39+
namespace ord {
40+
41+
class OpenRoad;
42+
43+
antenna_checker::AntennaChecker *
44+
makeAntennaChecker();
45+
46+
void
47+
deleteAntennaChecker(antenna_checker::AntennaChecker *antennachecker);
48+
49+
void
50+
initAntennaChecker(OpenRoad *openroad);
51+
52+
} // namespace
53+
#endif

0 commit comments

Comments
 (0)