Skip to content

Commit 91a97bd

Browse files
committed
Merge remote-tracking branch 'origin/master' into odb-database-chip
2 parents 35669c8 + 2c0e0ef commit 91a97bd

File tree

13 files changed

+890
-26
lines changed

13 files changed

+890
-26
lines changed

WORKSPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ workspace(name = "openroad")
88

99
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1010

11-
rules_hdl_git_hash = "80266603b55778dd30531c9b286152a7b664fbb7"
11+
rules_hdl_git_hash = "56da46a87e8e5a4dbe84c0bbe5d00e92b936494f"
1212

13-
rules_hdl_git_sha256 = "38f04d38cfbf46c52643325b496673d607ce5ea6fda99dc1dfa3997a520bb0c2"
13+
rules_hdl_git_sha256 = "dc184ad0fe92f315eb5600fb3293c94ce1fce3fc1d0fd79400107038ed917d70"
1414

1515
http_archive(
1616
name = "rules_hdl",

src/Metrics.tcl

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ proc report_tns_metric { args } {
3636

3737
define_cmd_args "report_worst_slack_metric" {[-setup]|[-hold]}
3838
proc report_worst_slack_metric { args } {
39-
global sta_report_default_digits
4039
parse_key_args "report_worst_slack_metric" args keys {} flags {-setup -hold}
4140

4241
set min_max "-max"
@@ -53,7 +52,6 @@ proc report_worst_slack_metric { args } {
5352

5453
define_cmd_args "report_worst_negative_slack_metric" {[-setup]|[-hold]}
5554
proc report_worst_negative_slack_metric { args } {
56-
global sta_report_default_digits
5755
parse_key_args "report_worst_negative_slack_metric" args keys {} flags {-setup -hold}
5856

5957
set min_max "-max"
@@ -68,6 +66,51 @@ proc report_worst_negative_slack_metric { args } {
6866
utl::metric_float $metric_name [worst_negative_slack $min_max]
6967
}
7068

69+
define_cmd_args "report_fmax_metric" {}
70+
proc report_fmax_metric { args } {
71+
parse_key_args "report_fmax_metric" args keys {} flags {}
72+
73+
# Taken from: https://github.com/siliconcompiler/siliconcompiler/blob/e46c702df218c93483b951533fe00bcf01cf772d/siliconcompiler/tools/openroad/scripts/common/reports.tcl#L98
74+
# Modeled on: https://github.com/The-OpenROAD-Project/OpenSTA/blob/f913c3ddbb3e7b4364ed4437c65ac78c4da9174b/tcl/Search.tcl#L1078
75+
set fmax_metric 0
76+
foreach clk [sta::sort_by_name [all_clocks]] {
77+
set clk_name [get_name $clk]
78+
set min_period [sta::find_clk_min_period $clk 1]
79+
if { $min_period == 0.0 } {
80+
continue
81+
}
82+
set fmax [expr { 1.0 / $min_period }]
83+
utl::metric_float "timing__fmax__clock:${clk_name}" $fmax
84+
puts "$clk_name fmax = [format %.2f [expr { $fmax / 1e6 }]] MHz"
85+
set fmax_metric [expr { max($fmax_metric, $fmax) }]
86+
}
87+
if { $fmax_metric == 0 } {
88+
# attempt to compute based on combinatorial path
89+
set fmax_valid true
90+
set max_path [find_timing_paths -unconstrained -path_delay max]
91+
if { $max_path == "" } {
92+
set fmax_valid false
93+
} else {
94+
set max_path_delay [$max_path data_arrival_time]
95+
}
96+
set min_path [find_timing_paths -unconstrained -path_delay min]
97+
if { $min_path == "" } {
98+
set fmax_valid false
99+
} else {
100+
set min_path_delay [$min_path data_arrival_time]
101+
}
102+
if { $fmax_valid } {
103+
set path_delay [expr { $max_path_delay - min(0, $min_path_delay) }]
104+
if { $path_delay > 0 } {
105+
set fmax_metric [expr { 1.0 / $path_delay }]
106+
}
107+
}
108+
}
109+
if { $fmax_metric > 0 } {
110+
utl::metric_float "timing__fmax" $fmax_metric
111+
}
112+
}
113+
71114
# From https://wiki.tcl-lang.org/page/Inf
72115
proc ::tcl::mathfunc::finite { x } {
73116
expr { [string is double -strict $x] && $x == $x && $x + 1 != $x }

src/ant/src/AntennaChecker.cc

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ void AntennaChecker::saveGates(odb::dbNet* db_net,
205205
{
206206
std::map<PinType, std::vector<int>, PinTypeCmp> pin_nbrs;
207207
std::vector<int> ids;
208+
// struct to save pin polygons
209+
using LayerAndPin = std::pair<int, PinType>;
210+
std::vector<LayerAndPin> pin_polys;
208211
// iterate all instance pins
209212
for (odb::dbITerm* iterm : db_net->getITerms()) {
210213
odb::dbMTerm* mterm = iterm->getMTerm();
@@ -229,6 +232,8 @@ void AntennaChecker::saveGates(odb::dbNet* db_net,
229232
transform.apply(pin_rect);
230233
// convert rect -> polygon
231234
Polygon pin_pol = rectToPolygon(pin_rect);
235+
// Save polygon to add on DSU
236+
pin_polys.emplace_back(tech_layer->getRoutingLevel(), pin);
232237
// if has wire on same layer connect to pin
233238
ids = findNodesWithIntersection(node_by_layer_map[tech_layer], pin_pol);
234239
for (const int& index : ids) {
@@ -253,6 +258,13 @@ void AntennaChecker::saveGates(odb::dbNet* db_net,
253258
}
254259
}
255260
}
261+
// Sort pin polygon based by layer level (greatest first)
262+
std::sort(pin_polys.begin(),
263+
pin_polys.end(),
264+
[](const LayerAndPin& a, const LayerAndPin& b) {
265+
return a.first > b.first;
266+
});
267+
256268
// run DSU from min_layer to max_layer
257269
std::vector<int> dsu_parent(node_count);
258270
std::vector<int> dsu_size(node_count);
@@ -267,12 +279,30 @@ void AntennaChecker::saveGates(odb::dbNet* db_net,
267279
odb::dbTechLayer* iter = tech->findRoutingLayer(1);
268280
odb::dbTechLayer* lower_layer;
269281
while (iter) {
270-
// iterate each node of this layer to union set
271-
for (auto& node_it : node_by_layer_map[iter]) {
272-
int id_u = node_it->id;
273-
// if has lower layer
274-
lower_layer = iter->getLowerLayer();
275-
if (lower_layer) {
282+
// Get lower layer
283+
lower_layer = iter->getLowerLayer();
284+
if (lower_layer) {
285+
// Check only vias layer to add pin connections
286+
if (lower_layer->getRoutingLevel() != 0) {
287+
int layer_level = lower_layer->getRoutingLevel();
288+
// only include pin on layer below to the current
289+
while (!pin_polys.empty() && layer_level >= pin_polys.back().first) {
290+
PinType pin = pin_polys.back().second;
291+
int last_id = -1;
292+
pin_polys.pop_back();
293+
// Set union of all wires connected to pin
294+
for (const int& nbr_id : pin_nbrs[pin]) {
295+
if (last_id != -1
296+
&& dsu.find_set(last_id) != dsu.find_set(nbr_id)) {
297+
dsu.union_set(last_id, nbr_id);
298+
}
299+
last_id = nbr_id;
300+
}
301+
}
302+
}
303+
// iterate each node of this layer to union set
304+
for (auto& node_it : node_by_layer_map[iter]) {
305+
int id_u = node_it->id;
276306
// get lower neighbors and union
277307
for (const int& lower_it : node_it->low_adj) {
278308
int id_v = node_by_layer_map[lower_layer][lower_it]->id;

src/cts/src/TritonCTS.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,9 +1238,20 @@ bool TritonCTS::separateMacroRegSinks(
12381238
}
12391239

12401240
if (iterm->isInputSignal() && inst->isPlaced()) {
1241+
// Cells with insertion delay, macros, clock gaters and inverters that
1242+
// drive macros are put in the macro sinks.
12411243
odb::dbMTerm* mterm = iterm->getMTerm();
1242-
// Treat clock gaters like macro sink
1243-
if (hasInsertionDelay(inst, mterm) || !isSink(iterm) || inst->isBlock()) {
1244+
1245+
bool nonSinkMacro = !isSink(iterm);
1246+
sta::Cell* masterCell = network_->dbToSta(mterm->getMaster());
1247+
sta::LibertyCell* libertyCell = network_->libertyCell(masterCell);
1248+
if (libertyCell && libertyCell->isInverter()) {
1249+
odb::dbITerm* invertedTerm
1250+
= inst->getFirstOutput()->getNet()->get1stSignalInput(false);
1251+
nonSinkMacro &= invertedTerm->getInst()->isBlock();
1252+
}
1253+
1254+
if (hasInsertionDelay(inst, mterm) || nonSinkMacro || inst->isBlock()) {
12441255
macroSinks.emplace_back(inst, mterm);
12451256
} else {
12461257
registerSinks.emplace_back(inst, mterm);

src/cts/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ or_integration_tests(
2727
find_clock_pad
2828
hier_insertion_delay
2929
insertion_delay
30+
inverters
3031
lvt_lib
3132
max_cap
3233
no_clocks

0 commit comments

Comments
 (0)