Skip to content

Commit dea422b

Browse files
authored
Merge pull request #10437 from The-OpenROAD-Project-staging/or_merge_sta_0514_report_generic
Update OpenSTA 5/14 code comes with report path field generalization, needs OpenROAD updation for mbff orig_name
2 parents d088e22 + 437521a commit dea422b

8 files changed

Lines changed: 105 additions & 65 deletions

File tree

src/gpl/src/mbff.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -929,27 +929,26 @@ void MBFF::ModifyPinConnections(const std::vector<Flop>& flops,
929929
}
930930

931931
// Store original FF→tray pin mapping as a property on the tray
932-
// instance so timing reports can display the original pin name.
933-
std::string tray_port;
932+
// pin (iterm) so the report_path "orig_name" field can display the
933+
// original pin name.
934+
dbITerm* tray_iterm = nullptr;
934935
if (is_d && d_pin) {
935-
tray_port = d_pin->name();
936+
tray_iterm = tray_inst[tray_idx]->findITerm(d_pin->name().c_str());
936937
} else if (is_q) {
937-
if (is_qn_inv && qn_pin) {
938-
tray_port = qn_pin->name();
939-
} else if (q_pin) {
940-
tray_port = q_pin->name();
938+
const sta::LibertyPort* tray_port = is_qn_inv ? qn_pin : q_pin;
939+
if (tray_port) {
940+
tray_iterm
941+
= tray_inst[tray_idx]->findITerm(tray_port->name().c_str());
941942
}
942943
}
943-
if (!tray_port.empty()) {
944-
const std::string key = "orig_name_" + tray_port;
944+
if (tray_iterm) {
945945
const std::string val = orig_inst_name + "/" + orig_port_name;
946946
odb::dbStringProperty* prop
947-
= odb::dbStringProperty::find(tray_inst[tray_idx], key.c_str());
947+
= odb::dbStringProperty::find(tray_iterm, kOrigNameProp);
948948
if (prop) {
949949
prop->setValue(val.c_str());
950950
} else {
951-
odb::dbStringProperty::create(
952-
tray_inst[tray_idx], key.c_str(), val.c_str());
951+
odb::dbStringProperty::create(tray_iterm, kOrigNameProp, val.c_str());
953952
}
954953
}
955954
}

src/gpl/src/mbff.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class Scene;
3232

3333
namespace gpl {
3434

35+
inline constexpr const char* kOrigNameProp = "orig_name";
36+
3537
struct Point;
3638
struct Tray;
3739
struct Flop;

src/gpl/src/replace.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <utility>
1111

1212
#include "AbstractGraphics.h"
13+
#include "db_sta/dbNetwork.hh"
1314
#include "db_sta/dbSta.hh"
1415
#include "graphicsNone.h"
1516
#include "initialPlace.h"
@@ -21,7 +22,10 @@
2122
#include "placerBase.h"
2223
#include "routeBase.h"
2324
#include "rsz/Resizer.hh"
25+
#include "sta/Graph.hh"
26+
#include "sta/Path.hh"
2427
#include "sta/StaMain.hh"
28+
#include "sta/StaState.hh"
2529
#include "timingBase.h"
2630
#include "utl/Logger.h"
2731
#include "utl/validation.h"
@@ -38,6 +42,40 @@ Replace::Replace(odb::dbDatabase* odb,
3842
: db_(odb), sta_(sta), rs_(resizer), fr_(router), log_(logger)
3943
{
4044
graphics_ = std::make_unique<GraphicsNone>();
45+
46+
// Register "orig_name" report_path field: original pin name before
47+
// multi-bit clustering. Reads "orig_name" property off the path
48+
// vertex's iterm. Registered at tool init so paths can be reported
49+
// even when the design is loaded from an already-clustered .odb
50+
// without re-running cluster_flops.
51+
if (sta_->findReportPathField(kOrigNameProp) == nullptr) {
52+
sta::dbNetwork* network = sta_->getDbNetwork();
53+
sta_->makeReportPathField(
54+
kOrigNameProp,
55+
kOrigNameProp,
56+
"Orig Name",
57+
36,
58+
true,
59+
nullptr,
60+
[network](const sta::Path* path,
61+
const sta::StaState* sta) -> std::string {
62+
if (path == nullptr) {
63+
return {};
64+
}
65+
const sta::Pin* pin = path->vertex(sta)->pin();
66+
// staToDb requires all three out-params; only iterm is used.
67+
odb::dbITerm* iterm = nullptr;
68+
odb::dbBTerm* bterm = nullptr;
69+
odb::dbModITerm* moditerm = nullptr;
70+
network->staToDb(pin, iterm, bterm, moditerm);
71+
if (iterm == nullptr) {
72+
return {};
73+
}
74+
odb::dbStringProperty* prop
75+
= odb::dbStringProperty::find(iterm, kOrigNameProp);
76+
return prop ? prop->getValue() : std::string{};
77+
});
78+
}
4179
}
4280

4381
Replace::~Replace() = default;

src/gpl/test/mbff_orig_name.def

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/gpl/test/mbff_orig_name.ok

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,23 @@
55
[INFO ODB-0227] LEF file: ./4BitTrayH4/asap7sc7p5t_DFFHQNV4X.lef, created 9 library cells
66
[INFO ODB-0394] Duplicate site asap7sc7p5t_pg in asap7sc7p5t_DFFHQNH2V2X already seen in asap7sc7p5t_DFFHQNV2X
77
[INFO ODB-0227] LEF file: ./4BitTrayH2W2/asap7sc7p5t_DFFHQNH2V2X.lef, created 9 library cells
8-
[INFO ODB-0128] Design: tray_test
9-
[INFO ODB-0130] Created 9 pins.
10-
[INFO ODB-0131] Created 4 components and 20 component-terminals.
11-
[INFO ODB-0133] Created 9 nets and 12 connections.
8+
orig_name field registered at session init (pre-cluster_flops).
9+
[WARNING IFP-0028] Core area lower left (1.000, 1.000) snapped to (1.026, 1.080).
10+
[INFO IFP-0001] Added 29 rows of 147 site asap7sc7p5t.
11+
[INFO IFP-0100] Die BBox: ( 0.000 0.000 ) ( 10.000 10.000 ) um
12+
[INFO IFP-0101] Core BBox: ( 1.026 1.080 ) ( 8.964 8.910 ) um
13+
[INFO IFP-0102] Core area: 62.155 um^2
14+
[INFO IFP-0103] Total instances area: 1.166 um^2
15+
[INFO IFP-0104] Effective utilization: 0.019
16+
[INFO IFP-0105] Number of instances: 4
1217
Alpha = 40.0, Beta = 1.0, #paths = 0, max size = -1
1318
Total ILP Cost: 112.643
1419
Total Timing Critical Path Displacement: 0.0
1520
Average slot-to-flop displacement: 1.730
1621
Final Objective Value: 112.643
1722
Sizes used
1823
4-bit: 1
19-
Startpoint: d3 (input port clocked by clk)
24+
Startpoint: d4 (input port clocked by clk)
2025
Endpoint: _tray_size4_7 (rising edge-triggered flip-flop clocked by clk)
2126
Path Group: clk
2227
Path Type: max
@@ -26,8 +31,8 @@ Path Type: max
2631
0.00 0.00 clock clk (rise edge)
2732
0.00 0.00 clock network delay (ideal)
2833
0.00 0.00 ^ input external delay
29-
0.00 0.00 ^ d3 (in)
30-
0.00 0.00 ^ _tray_size4_7/D1 (DFFHQNV4Xx1_ASAP7_75t_L) ff3/D
34+
0.00 0.00 ^ d4 (in)
35+
0.00 0.00 ^ _tray_size4_7/D0 (DFFHQNV4Xx1_ASAP7_75t_L) ff4/D
3136
0.00 data arrival time
3237

3338
1000.00 1000.00 clock clk (rise edge)

src/gpl/test/mbff_orig_name.tcl

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,26 @@ read_lib ./4BitTrayH4/asap7sc7p5t_DFFHQNV4X_LVT_TT_nldm_FAKE.lib
1414
read_lef ./4BitTrayH2W2/asap7sc7p5t_DFFHQNH2V2X.lef
1515
read_lib ./4BitTrayH2W2/asap7sc7p5t_DFFHQNH2V2X_LVT_TT_nldm_FAKE.lib
1616

17-
read_def ./$test_name.def
17+
read_verilog ./$test_name.v
18+
link_design tray_test
19+
20+
# Verify the "orig_name" report field is registered at session init
21+
# (Replace ctor), not deferred until cluster_flops. Required so an
22+
# already-clustered .odb loaded in a fresh session can still report
23+
# the saved orig_name properties via report_checks.
24+
if { [sta::find_report_path_field_abrev orig_name] == "" } {
25+
utl::error GPL 330 "orig_name report_path field not registered at session init."
26+
}
27+
puts "orig_name field registered at session init (pre-cluster_flops)."
28+
29+
initialize_floorplan -die_area "0 0 10 10" \
30+
-core_area "1 1 9 9" \
31+
-site asap7sc7p5t
32+
33+
place_inst -name ff1 -origin {6 6} -status PLACED
34+
place_inst -name ff2 -origin {4 6} -status PLACED
35+
place_inst -name ff3 -origin {4 4} -status PLACED
36+
place_inst -name ff4 -origin {6 4} -status PLACED
1837

1938
create_clock -name clk -period 1000 [get_ports clk1]
2039
set_input_delay -clock clk 0 [get_ports {d1 d2 d3 d4}]
@@ -24,6 +43,8 @@ cluster_flops -tray_weight 40.0 \
2443
-max_split_size -1 \
2544
-num_paths 0
2645

27-
# Report timing to verify original FF names appear in the path report.
28-
# After clustering the tray pin descriptions should show in the Orig Name column.
29-
report_checks -path_delay max -fields {orig_name} -through [get_pins _tray_size4_7/D1]
46+
# Report timing to verify original FF pin names appear in the path
47+
# report. After clustering the tray pin descriptions show the ffN/D
48+
# mapping in the Orig Name column.
49+
report_checks -path_delay max -fields {orig_name} \
50+
-through [get_pins -of_objects [get_cells _tray_size4_*]]

src/gpl/test/mbff_orig_name.v

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module tray_test (clk1, d1, d2, d3, d4, o1, o2, o3, o4);
2+
input clk1;
3+
input d1;
4+
input d2;
5+
input d3;
6+
input d4;
7+
output o1;
8+
output o2;
9+
output o3;
10+
output o4;
11+
12+
DFFHQNx1_ASAP7_75t_L ff1 (.CLK(clk1), .D(d1), .QN(o1));
13+
DFFHQNx1_ASAP7_75t_L ff2 (.CLK(clk1), .D(d2), .QN(o2));
14+
DFFHQNx1_ASAP7_75t_L ff3 (.CLK(clk1), .D(d3), .QN(o3));
15+
DFFHQNx1_ASAP7_75t_L ff4 (.CLK(clk1), .D(d4), .QN(o4));
16+
endmodule

0 commit comments

Comments
 (0)