Skip to content

Commit d7c186e

Browse files
committed
ant: use pimpl to simplify the public interface
Signed-off-by: Matt Liberty <[email protected]>
1 parent e0d25cb commit d7c186e

File tree

6 files changed

+330
-250
lines changed

6 files changed

+330
-250
lines changed

src/ant/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ cc_library(
1515
name = "ant",
1616
srcs = [
1717
"src/AntennaChecker.cc",
18+
"src/AntennaCheckerImpl.hh",
1819
"src/PinType.hh",
1920
"src/Polygon.cc",
2021
"src/Polygon.hh",

src/ant/include/ant/AntennaChecker.hh

Lines changed: 5 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -3,90 +3,14 @@
33

44
#pragma once
55

6-
#include <map>
7-
#include <mutex>
8-
#include <queue>
9-
#include <set>
10-
116
#include "odb/db.h"
12-
#include "odb/dbWireGraph.h"
137

148
namespace utl {
159
class Logger;
1610
}
1711

1812
namespace ant {
1913

20-
struct PARinfo;
21-
struct ARinfo;
22-
struct AntennaModel;
23-
class WireBuilder;
24-
25-
///////////////////////////////////////
26-
struct GraphNode;
27-
28-
struct NodeInfo
29-
{
30-
double PAR;
31-
double PSR;
32-
double diff_PAR;
33-
double diff_PSR;
34-
double area;
35-
double side_area;
36-
double iterm_gate_area;
37-
double iterm_diff_area;
38-
39-
double CAR;
40-
double CSR;
41-
double diff_CAR;
42-
double diff_CSR;
43-
44-
// Defines the ratio between the current PAR and the allowed PAR
45-
double excess_ratio_PAR;
46-
// Defines the ratio between the current PSR and the allowed PSR
47-
double excess_ratio_PSR;
48-
49-
std::vector<odb::dbITerm*> iterms;
50-
51-
NodeInfo& operator+=(const NodeInfo& a)
52-
{
53-
PAR += a.PAR;
54-
PSR += a.PSR;
55-
diff_PAR += a.diff_PAR;
56-
diff_PSR += a.diff_PSR;
57-
area += a.area;
58-
side_area += a.side_area;
59-
return *this;
60-
}
61-
NodeInfo()
62-
{
63-
PAR = 0.0;
64-
PSR = 0.0;
65-
diff_PAR = 0.0;
66-
diff_PSR = 0.0;
67-
68-
area = 0.0;
69-
side_area = 0.0;
70-
iterm_gate_area = 0.0;
71-
iterm_diff_area = 0.0;
72-
73-
CAR = 0.0;
74-
CSR = 0.0;
75-
diff_CAR = 0.0;
76-
diff_CSR = 0.0;
77-
78-
excess_ratio_PAR = 1.0;
79-
excess_ratio_PSR = 1.0;
80-
}
81-
};
82-
83-
struct ViolationReport
84-
{
85-
bool violated;
86-
std::string report;
87-
ViolationReport() { violated = false; }
88-
};
89-
9014
struct Violation
9115
{
9216
int routing_level;
@@ -95,13 +19,7 @@ struct Violation
9519
double excess_ratio;
9620
};
9721

98-
using LayerToNodeInfo = std::map<odb::dbTechLayer*, NodeInfo>;
99-
using GraphNodes = std::vector<std::unique_ptr<GraphNode>>;
100-
using LayerToGraphNodes = std::map<odb::dbTechLayer*, GraphNodes>;
101-
using GateToLayerToNodeInfo = std::map<odb::dbITerm*, LayerToNodeInfo>;
10222
using Violations = std::vector<Violation>;
103-
using GateToViolationLayers
104-
= std::map<odb::dbITerm*, std::set<odb::dbTechLayer*>>;
10523

10624
class AntennaChecker
10725
{
@@ -117,96 +35,15 @@ class AntennaChecker
11735
Violations getAntennaViolations(odb::dbNet* net,
11836
odb::dbMTerm* diode_mterm,
11937
float ratio_margin);
120-
void initAntennaRules();
12138
void setReportFileName(const char* file_name);
39+
40+
// Used in repair
41+
void initAntennaRules();
12242
void makeNetWiresFromGuides(const std::vector<odb::dbNet*>& nets);
12343

12444
private:
125-
bool haveRoutedNets();
126-
bool designIsPlaced();
127-
bool haveGuides();
128-
double getPwlFactor(odb::dbTechLayerAntennaRule::pwl_pair pwl_info,
129-
double ref_val,
130-
double def);
131-
double diffArea(odb::dbMTerm* mterm);
132-
double gateArea(odb::dbMTerm* mterm);
133-
std::vector<std::pair<double, std::vector<odb::dbITerm*>>> parMaxWireLength(
134-
odb::dbNet* net,
135-
int layer);
136-
std::vector<std::pair<double, std::vector<odb::dbITerm*>>>
137-
getViolatedWireLength(odb::dbNet* net, int routing_level);
138-
bool isValidGate(odb::dbMTerm* mterm);
139-
void buildLayerMaps(odb::dbNet* net, LayerToGraphNodes& node_by_layer_map);
140-
int checkNet(odb::dbNet* net,
141-
bool verbose,
142-
bool save_report,
143-
odb::dbMTerm* diode_mterm,
144-
float ratio_margin,
145-
Violations& antenna_violations);
146-
void saveGates(odb::dbNet* db_net,
147-
LayerToGraphNodes& node_by_layer_map,
148-
int node_count);
149-
void calculateAreas(const LayerToGraphNodes& node_by_layer_map,
150-
GateToLayerToNodeInfo& gate_info);
151-
void calculatePAR(GateToLayerToNodeInfo& gate_info);
152-
void calculateCAR(GateToLayerToNodeInfo& gate_info);
153-
bool checkRatioViolations(odb::dbNet* db_net,
154-
odb::dbTechLayer* layer,
155-
NodeInfo& node_info,
156-
float ratio_margin,
157-
bool verbose,
158-
bool report,
159-
ViolationReport& net_report);
160-
void writeReport(std::ofstream& report_file, bool verbose);
161-
void printReport(odb::dbNet* db_net);
162-
int checkGates(odb::dbNet* db_net,
163-
bool verbose,
164-
bool save_report,
165-
odb::dbMTerm* diode_mterm,
166-
float ratio_margin,
167-
GateToLayerToNodeInfo& gate_info,
168-
Violations& antenna_violations);
169-
void calculateViaPar(odb::dbTechLayer* tech_layer, NodeInfo& info);
170-
void calculateWirePar(odb::dbTechLayer* tech_layer, NodeInfo& info);
171-
bool checkPAR(odb::dbNet* db_net,
172-
odb::dbTechLayer* tech_layer,
173-
NodeInfo& info,
174-
float ratio_margin,
175-
bool verbose,
176-
bool report,
177-
ViolationReport& net_report);
178-
bool checkPSR(odb::dbNet* db_net,
179-
odb::dbTechLayer* tech_layer,
180-
NodeInfo& info,
181-
float ratio_margin,
182-
bool verbose,
183-
bool report,
184-
ViolationReport& net_report);
185-
bool checkCAR(odb::dbNet* db_net,
186-
odb::dbTechLayer* tech_layer,
187-
const NodeInfo& info,
188-
bool verbose,
189-
bool report,
190-
ViolationReport& net_report);
191-
bool checkCSR(odb::dbNet* db_net,
192-
odb::dbTechLayer* tech_layer,
193-
const NodeInfo& info,
194-
bool verbose,
195-
bool report,
196-
ViolationReport& net_report);
197-
198-
std::unique_ptr<ant::WireBuilder> wire_builder_;
199-
odb::dbDatabase* db_{nullptr};
200-
odb::dbBlock* block_{nullptr};
201-
utl::Logger* logger_{nullptr};
202-
std::map<odb::dbTechLayer*, AntennaModel> layer_info_;
203-
int net_violation_count_{0};
204-
std::string report_file_name_;
205-
std::vector<odb::dbNet*> nets_;
206-
std::map<odb::dbNet*, ViolationReport> net_to_report_;
207-
std::mutex map_mutex_;
208-
// consts
209-
static constexpr int max_diode_count_per_gate = 10;
45+
class Impl;
46+
std::unique_ptr<Impl> impl_;
21047
};
21148

21249
} // namespace ant

0 commit comments

Comments
 (0)