Skip to content

Commit bc82e32

Browse files
authored
Merge pull request #8554 from eder-matheus/odb_check_pin_placement
odb: add command to check if pins are placed
2 parents 4558e92 + 3de61df commit bc82e32

8 files changed

Lines changed: 67 additions & 0 deletions

File tree

src/odb/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,14 @@ You can find examples on using the API from Tcl under `test/tcl/` directory.
445445
The full set of the Tcl commands exposed can be found under
446446
`./build/src/swig/tcl/opendb_wrapper.cpp`. Search for `SWIG_prefix`.
447447

448+
### All pin placed
449+
450+
This command checks if the IO pins of the design have a placement status of `PLACED`, `LOCKED`, `FIRM`, or `COVER`. Return `1` if true, and `0` if false.
451+
452+
```tcl
453+
all_pins_placed
454+
```
455+
448456
## Regression tests
449457

450458
There are a set of regression tests in `./test`. For more information, refer to this [section](../../README.md#regression-tests).

src/odb/src/swig/tcl/odb.tcl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,24 @@ proc define_pin_shape_pattern { args } {
10561056
odb::set_bterm_top_layer_grid $block $layer $x_step $y_step region $width $height $keepout
10571057
}
10581058

1059+
sta::define_cmd_args "all_pins_placed" {}
1060+
1061+
proc all_pins_placed { args } {
1062+
sta::parse_key_args "all_pins_placed" args \
1063+
keys {} flags {}
1064+
1065+
set block [odb::get_block]
1066+
1067+
foreach bterm [$block getBTerms] {
1068+
set placement_status [$bterm getFirstPinPlacementStatus]
1069+
if { [lsearch -exact {PLACED LOCKED FIRM COVER} $placement_status] == -1 } {
1070+
return 0
1071+
}
1072+
}
1073+
1074+
return 1
1075+
}
1076+
10591077
namespace eval odb {
10601078
proc add_direction_constraint { dir edge begin end } {
10611079
set block [get_block]

src/odb/test/BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ py_test(
142142
# From CMakeLists.txt or_integration_tests(TESTS
143143
COMPULSORY_TESTS = [
144144
"abstract_origin",
145+
"all_pins_placed1",
146+
"all_pins_placed2",
145147
"bterm_hier_create",
146148
"check_routing_tracks",
147149
"create_blockage",
@@ -326,6 +328,12 @@ filegroup(
326328
test_name + ".*",
327329
],
328330
) + {
331+
"all_pins_placed1": [
332+
"floorplan_initialize3.def",
333+
],
334+
"all_pins_placed2": [
335+
"design_is_routed1.def",
336+
],
329337
"dump_netlists": [
330338
"dump_netlists_cdl.ok",
331339
],

src/odb/test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ or_integration_tests(
22
"odb"
33
TESTS
44
abstract_origin
5+
all_pins_placed1
6+
all_pins_placed2
57
bterm_hier_create
68
check_routing_tracks
79
create_blockage

src/odb/test/all_pins_placed1.ok

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells
2+
[INFO ODB-0128] Design: top
3+
[INFO ODB-0130] Created 6 pins.
4+
[INFO ODB-0131] Created 5 components and 27 component-terminals.
5+
[INFO ODB-0133] Created 10 nets and 14 connections.
6+
Some pins are not placed

src/odb/test/all_pins_placed1.tcl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# test if all pins are placed
2+
source "helpers.tcl"
3+
read_lef Nangate45/Nangate45.lef
4+
read_def floorplan_initialize3.def
5+
6+
if { [all_pins_placed] } {
7+
puts "All pins are placed"
8+
} else {
9+
puts "Some pins are not placed"
10+
}

src/odb/test/all_pins_placed2.ok

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells
2+
[INFO ODB-0128] Design: gcd
3+
[INFO ODB-0131] Created 200 components and 1117 component-terminals.
4+
[INFO ODB-0133] Created 4 nets and 11 connections.
5+
All pins are placed

src/odb/test/all_pins_placed2.tcl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# test if all pins are placed
2+
source "helpers.tcl"
3+
read_lef Nangate45/Nangate45.lef
4+
read_def design_is_routed1.def
5+
6+
if { [all_pins_placed] } {
7+
puts "All pins are placed"
8+
} else {
9+
puts "Some pins are not placed"
10+
}

0 commit comments

Comments
 (0)