Skip to content

Commit 9e6f0e0

Browse files
Merge pull request #9171 from ahmed532/feat/odb-create-check_3dblox
odb: create check_3dblox tcl command
2 parents 3633e5f + 4815ac8 commit 9e6f0e0

File tree

8 files changed

+112
-1
lines changed

8 files changed

+112
-1
lines changed

include/ord/OpenRoad.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ class OpenRoad
227227
void write3Dbv(const std::string& filename);
228228
void write3Dbx(const std::string& filename);
229229
void read3DBloxBMap(const std::string& filename);
230+
void check3DBlox();
230231

231232
void readDb(std::istream& stream);
232233
void readDb(const char* filename, bool hierarchy = false);

src/OpenRoad.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ void OpenRoad::read3Dbx(const std::string& filename)
493493
{
494494
odb::ThreeDBlox parser(logger_, db_, sta_);
495495
parser.readDbx(filename);
496-
parser.check();
496+
check3DBlox();
497497
db_->triggerPostRead3Dbx(db_->getChip());
498498
}
499499

@@ -503,6 +503,16 @@ void OpenRoad::read3DBloxBMap(const std::string& filename)
503503
parser.readBMap(filename);
504504
}
505505

506+
void OpenRoad::check3DBlox()
507+
{
508+
if (db_->getChip() == nullptr) {
509+
logger_->error(utl::ORD, 76, "No design loaded.");
510+
return;
511+
}
512+
odb::ThreeDBlox checker(logger_, db_, sta_);
513+
checker.check();
514+
}
515+
506516
void OpenRoad::write3Dbv(const std::string& filename)
507517
{
508518
odb::ThreeDBlox writer(logger_, db_, sta_);

src/OpenRoad.i

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,13 @@ read_3dblox_bmap_cmd(const char *filename)
376376
ord->read3DBloxBMap(filename);
377377
}
378378

379+
void
380+
check_3dblox_cmd()
381+
{
382+
OpenRoad *ord = getOpenRoad();
383+
ord->check3DBlox();
384+
}
385+
379386
void
380387
write_3dbv_cmd(const char *filename)
381388
{

src/OpenRoad.tcl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,14 @@ proc read_3dblox_bmap { args } {
228228
ord::read_3dblox_bmap_cmd $filename
229229
}
230230

231+
sta::define_cmd_args "check_3dblox" {}
232+
233+
proc check_3dblox { args } {
234+
sta::parse_key_args "check_3dblox" args keys {} flags {}
235+
sta::check_argc_eq0 "check_3dblox" $args
236+
ord::check_3dblox_cmd
237+
}
238+
231239
sta::define_cmd_args "write_db" {filename}
232240

233241
sta::define_cmd_args "read_db" {[-hier] filename}

src/odb/test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ COMPULSORY_TESTS = [
145145
"all_pins_placed1",
146146
"all_pins_placed2",
147147
"bterm_hier_create",
148+
"check_3dblox",
148149
"check_routing_tracks",
149150
"create_blockage",
150151
"create_obstruction",

src/odb/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ or_integration_tests(
55
all_pins_placed1
66
all_pins_placed2
77
bterm_hier_create
8+
check_3dblox
89
check_routing_tracks
910
create_blockage
1011
create_obstruction

src/odb/test/check_3dblox.ok

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[INFO ODB-0227] LEF file: data/../Nangate45/Nangate45_tech.lef, created 22 layers, 27 vias
2+
[INFO ODB-0227] LEF file: data/../Nangate45/fake_macros.lef, created 10 library cells
3+
[INFO ODB-0227] LEF file: data/../Nangate45/fake_bumps.lef, created 1 library cells
4+
[WARNING STA-1171] data/../Nangate45/fake_macros.lib line 32, default_max_transition is 0.0.
5+
[INFO ODB-0128] Design: fake_macros
6+
[INFO ODB-0131] Created 10 components and 32 component-terminals.
7+
[INFO ODB-0133] Created 12 nets and 24 connections.
8+
[WARNING ODB-0156] Found 1 overlapping chips
9+
[WARNING ODB-0151] Found 1 floating chip sets
10+
[WARNING ODB-0151] Found 2 floating chip sets
11+
Summary 7 / 7 (100% pass)
12+
pass

src/odb/test/check_3dblox.tcl

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
source "helpers.tcl"
2+
3+
proc get_3dblox_marker_count { sub_category_name } {
4+
set top_chip [[ord::get_db] getChip]
5+
set category [$top_chip findMarkerCategory "3DBlox"]
6+
if { $category == "NULL" } {
7+
return 0
8+
}
9+
set sub_category [$category findMarkerCategory $sub_category_name]
10+
if { $sub_category == "NULL" } {
11+
return 0
12+
}
13+
return [$sub_category getMarkerCount]
14+
}
15+
16+
# 1. Load clean design
17+
read_3dbx "data/example.3dbx"
18+
set db [ord::get_db]
19+
set top_chip [$db getChip]
20+
21+
# Get design info
22+
set inst1 [$top_chip findChipInst "soc_inst"]
23+
lassign [$inst1 getLoc] x1 y1 z1
24+
set master1 [$inst1 getMasterChip]
25+
set w1 [$master1 getWidth]
26+
set h1 [$master1 getHeight]
27+
set t1 [$master1 getThickness]
28+
29+
set inst2 [$top_chip findChipInst "soc_inst_duplicate"]
30+
31+
# Verify it is clean initially
32+
check "Initial overlap count" { get_3dblox_marker_count "Overlapping chips" } 0
33+
check "Initial floating count" { get_3dblox_marker_count "Floating chips" } 0
34+
35+
# 2. Test Partial Overlap
36+
# Move inst2 to partially overlap with inst1
37+
set p [odb::Point3D]
38+
$p set [expr $x1 + $w1 / 4] [expr $y1 + $h1 / 4] [expr $z1 + $t1 / 2]
39+
$inst2 setLoc $p
40+
41+
check_3dblox
42+
check "Partial overlap detected" { get_3dblox_marker_count "Overlapping chips" } 1
43+
44+
# 3. Test Touching (Stacked Exactly)
45+
# Place inst2 exactly on top of inst1
46+
$p set $x1 $y1 [expr $z1 + $t1]
47+
$inst2 setLoc $p
48+
49+
check_3dblox
50+
check "Touching chips no overlap" { get_3dblox_marker_count "Overlapping chips" } 0
51+
check "Touching chips not floating" { get_3dblox_marker_count "Floating chips" } 0
52+
53+
# 4. Test Vertical Gap (Floating)
54+
# Move inst2 slightly higher
55+
$p set $x1 $y1 [expr $z1 + $t1 + 1]
56+
$inst2 setLoc $p
57+
58+
check_3dblox
59+
check "Vertical gap detected as floating" { get_3dblox_marker_count "Floating chips" } 1
60+
61+
# 5. Test Multiple Floating Sets
62+
# Create another chip far away
63+
set inst3 [odb::dbChipInst_create $top_chip $master1 "inst3"]
64+
$p set [expr $x1 + 10 * $w1] [expr $y1 + 10 * $h1] $z1
65+
$inst3 setLoc $p
66+
67+
check_3dblox
68+
# Should find 2 sets of floating chips (inst2 and inst3 are both separate from inst1)
69+
check "Multiple floating sets detected" { get_3dblox_marker_count "Floating chips" } 2
70+
71+
exit_summary

0 commit comments

Comments
 (0)