Skip to content

Commit d53c86e

Browse files
authored
Merge pull request The-OpenROAD-Project#9817 from rohithsiddi/odb-test-block-wire
odb: implement wire bbox test in test_block (Python + TCL)
2 parents d759f6e + 9f33b31 commit d53c86e

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

src/odb/test/test_block.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,16 @@ def block_placement(self, test_num, flag):
9292
swire, self.lib.getTech().findLayer("L1"), 0, 4000, 100, 4100, "NONE"
9393
)
9494
if (flag and test_num == 5) or (not flag and test_num >= 5):
95-
pass
96-
# TODO ADD WIRE
95+
L1 = self.lib.getTech().findLayer("L1")
96+
L1.setWidth(200)
97+
n_w = odb.dbNet_create(self.block, "n_w")
98+
wire = odb.dbWire_create(n_w)
99+
encoder = odb.dbWireEncoder()
100+
encoder.begin(wire)
101+
encoder.newPath(L1, "ROUTED")
102+
encoder.addPoint(0, 4500)
103+
encoder.addPoint(3000, 4500)
104+
encoder.end()
97105

98106
def test_bbox0(self):
99107
box = self.block.getBBox()
@@ -135,6 +143,12 @@ def test_bbox4(self):
135143
self.block_placement(4, False)
136144
self.check_box_rect(-1580, -1000, 2550, 4100)
137145

146+
def test_bbox5(self):
147+
box = self.block.getBBox()
148+
self.block_placement(5, False)
149+
# xMax is 3100 (not 3000): wire endpoint is extended by half-width (100).
150+
self.check_box_rect(-1580, -1000, 3100, 4600)
151+
138152

139153
if __name__ == "__main__":
140154
unittest.main()

src/odb/test/test_block.tcl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,16 @@ proc block_placement { block lib test_num flag } {
9595
0 4000 100 4100 "NONE"
9696
}
9797
if { ($flag && $test_num == 5) || (!$flag && $test_num >= 5) } {
98-
# TODO ADD WIRE
98+
set L1 [[$lib getTech] findLayer "L1"]
99+
$L1 setWidth 200
100+
set n_w [odb::dbNet_create $block "n_w"]
101+
set wire [odb::dbWire_create $n_w]
102+
set encoder [odb::dbWireEncoder]
103+
$encoder begin $wire
104+
$encoder newPath $L1 "ROUTED"
105+
$encoder addPoint 0 4500
106+
$encoder addPoint 3000 4500
107+
$encoder end
99108
}
100109
}
101110

@@ -147,11 +156,21 @@ proc test_bbox4 { } {
147156
tearDown $db
148157
}
149158

159+
proc test_bbox5 { } {
160+
lassign [setUp] db lib block parentBlock
161+
set box [$block getBBox]
162+
block_placement $block $lib 5 false
163+
# xMax is 3100 (not 3000): wire endpoint is extended by half-width (100).
164+
check_box_rect $block -1580 -1000 3100 4600
165+
tearDown $db
166+
}
167+
150168
test_find
151169
test_bbox0
152170
test_bbox1
153171
test_bbox2
154172
test_bbox3
155173
test_bbox4
174+
test_bbox5
156175
puts "pass"
157176
exit 0

0 commit comments

Comments
 (0)