Skip to content

Commit 12a92a4

Browse files
committed
Fix for OpenSTA issue 398 and OpenROAD issue 9454 with regression
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
1 parent f1e5587 commit 12a92a4

5 files changed

Lines changed: 61 additions & 13 deletions

File tree

test/regression_vars.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ record_public_tests {
166166
verilog_attribute
167167
verilog_specify
168168
verilog_write_escape
169+
verilog_unconnected_dbterm
169170
}
170171

171172
define_test_group fast [group_tests all]

test/verilog_unconnected_dbterm.ok

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Find b1/out2: b1/out2
2+
Find b2/out2: b2/out2
3+
Net connected to b2/u3/Z: b2/out2
4+
Find internal net connected to b2/out2: b2/out2
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
read_liberty ../examples/nangate45_typ.lib.gz
2+
read_verilog verilog_unconnected_dbterm.v
3+
link_design top
4+
puts "Find b1/out2: [get_property [get_pins b1/out2] full_name]"
5+
puts "Find b2/out2: [get_property [get_pins b2/out2] full_name]"
6+
# Check if net is connected to "b2/u3/Z" that was the b2/out2 in parent block
7+
set iterm [sta::find_pin "b2/u3/Z"]
8+
set net [get_net -of_object [get_pin $iterm]]
9+
if { $net != "NULL" } {
10+
puts "Net connected to b2/u3/Z: [get_full_name $net]"
11+
} else {
12+
puts "b2/u3/Z is not connected to any net."
13+
}
14+
puts "Find internal net connected to b2/out2: [get_property [get_net b2/out2] full_name]"

test/verilog_unconnected_dbterm.v

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module top (in, clk1, clk2, out, out2);
2+
input in, clk1, clk2;
3+
output out, out2;
4+
block1 b1 (.in(in), .clk(clk1), .out(b1out), .out2(out2));
5+
block2 b2 (.in(b1out), .clk(clk2), .out(out));
6+
endmodule // top
7+
8+
module block1 (in, clk, out, out2);
9+
input in, clk;
10+
output out, out2;
11+
BUF_X1 u1 (.A(in), .Z(u1out));
12+
DFF_X1 r1 (.D(u1out), .CK(clk), .Q(r1q));
13+
BUF_X1 u2 (.A(r1q), .Z(out));
14+
BUF_X1 u3 (.A(out), .Z(out2));
15+
endmodule // block1
16+
17+
module block2 (in, clk, out, out2);
18+
input in, clk;
19+
output out, out2;
20+
BUF_X1 u1 (.A(in), .Z(u1out));
21+
DFF_X1 r1 (.D(u1out), .CK(clk), .Q(r1q));
22+
BUF_X1 u2 (.A(r1q), .Z(out));
23+
BUF_X1 u3 (.A(out), .Z(out2));
24+
endmodule // block2
25+
26+
27+

verilog/VerilogReader.cc

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,13 +1824,11 @@ VerilogReader::makeModuleInstNetwork(VerilogModuleInst *mod_inst,
18241824
}
18251825
}
18261826

1827-
if (lib_cell) {
1828-
// Make all pins so timing arcs are built.
1829-
LibertyCellPortBitIterator port_iter(lib_cell);
1830-
while (port_iter.hasNext()) {
1831-
LibertyPort *port = port_iter.next();
1832-
network_->makePin(inst, reinterpret_cast<Port*>(port), nullptr);
1833-
}
1827+
// Make all pins so timing arcs are built and get_pins finds them.
1828+
ConcreteCellPortBitIterator port_iter(reinterpret_cast<const ConcreteCell*>(cell));
1829+
while (port_iter.hasNext()) {
1830+
Port *port = reinterpret_cast<Port*>(port_iter.next());
1831+
network_->makePin(inst, port, nullptr);
18341832
}
18351833
bool is_leaf = network_->isLeaf(cell);
18361834
VerilogBindingTbl bindings(zero_net_name_, one_net_name_);
@@ -1983,12 +1981,16 @@ VerilogReader::makeInstPin(Instance *inst,
19831981
network_->connect(inst, port, net);
19841982
}
19851983
else {
1986-
Pin *pin = network_->makePin(inst, port, net);
1987-
if (!is_leaf && net) {
1988-
const char *port_name = network_->name(port);
1989-
Net *child_net = bindings->ensureNetBinding(port_name, inst, network_);
1990-
network_->makeTerm(pin, child_net);
1991-
}
1984+
// Ensure pin exists (may have been pre-created), then connect to parent
1985+
// net if present. Always create a term for the child-side net.
1986+
Pin *pin = network_->findPin(inst, port);
1987+
if (pin == nullptr)
1988+
pin = network_->makePin(inst, port, net);
1989+
else if (net)
1990+
pin = network_->connect(inst, port, net);
1991+
const char *port_name = network_->name(port);
1992+
Net *child_net = bindings->ensureNetBinding(port_name, inst, network_);
1993+
network_->makeTerm(pin, child_net);
19921994
}
19931995
}
19941996

0 commit comments

Comments
 (0)