Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/ord/OpenRoad.hh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class OpenRoad
void write3Dbv(const std::string& filename);
void write3Dbx(const std::string& filename);
void read3DBloxBMap(const std::string& filename);
void check3DBlox();

void readDb(std::istream& stream);
void readDb(const char* filename, bool hierarchy = false);
Expand Down
11 changes: 10 additions & 1 deletion src/OpenRoad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ void OpenRoad::read3Dbx(const std::string& filename)
{
odb::ThreeDBlox parser(logger_, db_, sta_);
parser.readDbx(filename);
parser.check();
check3DBlox();
db_->triggerPostRead3Dbx(db_->getChip());
}

Expand All @@ -503,6 +503,15 @@ void OpenRoad::read3DBloxBMap(const std::string& filename)
parser.readBMap(filename);
}

void OpenRoad::check3DBlox()
{
if (db_->getChip() == nullptr) {
logger_->error(utl::ORD, 76, "No design loaded.");
}
odb::ThreeDBlox checker(logger_, db_, sta_);
checker.check();
}

void OpenRoad::write3Dbv(const std::string& filename)
{
odb::ThreeDBlox writer(logger_, db_, sta_);
Expand Down
7 changes: 7 additions & 0 deletions src/OpenRoad.i
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,13 @@ read_3dblox_bmap_cmd(const char *filename)
ord->read3DBloxBMap(filename);
}

void
check_3dblox_cmd()
{
OpenRoad *ord = getOpenRoad();
ord->check3DBlox();
}

void
write_3dbv_cmd(const char *filename)
{
Expand Down
8 changes: 8 additions & 0 deletions src/OpenRoad.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,14 @@ proc read_3dblox_bmap { args } {
ord::read_3dblox_bmap_cmd $filename
}

sta::define_cmd_args "check_3dblox" {}

proc check_3dblox { args } {
sta::parse_key_args "check_3dblox" args keys {} flags {}
sta::check_argc_eq0 "check_3dblox" $args
ord::check_3dblox_cmd
}

sta::define_cmd_args "write_db" {filename}

sta::define_cmd_args "read_db" {[-hier] filename}
Expand Down
1 change: 1 addition & 0 deletions src/odb/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ COMPULSORY_TESTS = [
"all_pins_placed1",
"all_pins_placed2",
"bterm_hier_create",
"check_3dblox",
"check_routing_tracks",
"create_blockage",
"create_obstruction",
Expand Down
1 change: 1 addition & 0 deletions src/odb/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ or_integration_tests(
all_pins_placed1
all_pins_placed2
bterm_hier_create
check_3dblox
check_routing_tracks
create_blockage
create_obstruction
Expand Down
2 changes: 2 additions & 0 deletions src/odb/test/check_3dblox.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Summary 7 / 7 (100% pass)
pass
80 changes: 80 additions & 0 deletions src/odb/test/check_3dblox.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
source "helpers.tcl"

# Suppress noisy standard loading messages and checker warnings
suppress_message ODB 227
suppress_message ODB 128
suppress_message ODB 131
suppress_message ODB 133
suppress_message STA 1171
suppress_message ODB 156
suppress_message ODB 151
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for this? usually if the logger messages are not environment/run dependent (like elapsed time or consumed memory), I prefer if they stay in the log.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason; just wanted to keep the .ok file simpler. I'll add them back if that is the convention, sure.


# 1. Load clean design
read_3dbx "data/example.3dbx"
set db [ord::get_db]
set top_chip [$db getChip]

# Get design info
set inst1 [$top_chip findChipInst "soc_inst"]
lassign [$inst1 getLoc] x1 y1 z1
set master1 [$inst1 getMasterChip]
set w1 [$master1 getWidth]
set h1 [$master1 getHeight]
set t1 [$master1 getThickness]

set inst2 [$top_chip findChipInst "soc_inst_duplicate"]

# Verify it is clean initially
set category [$top_chip findMarkerCategory "3DBlox"]
if { $category != "NULL" } {
set overlapping_category [$category findMarkerCategory "Overlapping chips"]
check "Initial overlap count" { expr { $overlapping_category == "NULL" ? 0 : [$overlapping_category getMarkerCount] } } 0
set floating_category [$category findMarkerCategory "Floating chips"]
check "Initial floating count" { expr { $floating_category == "NULL" ? 0 : [$floating_category getMarkerCount] } } 0
}

# 2. Test Partial Overlap
# Move inst2 to partially overlap with inst1
set p [odb::Point3D]
$p set [expr $x1 + $w1 / 4] [expr $y1 + $h1 / 4] [expr $z1 + $t1 / 2]
$inst2 setLoc $p

check_3dblox
set category [$top_chip findMarkerCategory "3DBlox"]
set overlapping_category [$category findMarkerCategory "Overlapping chips"]
check "Partial overlap detected" { expr { $overlapping_category != "NULL" && [$overlapping_category getMarkerCount] > 0 } } 1

# 3. Test Touching (Stacked Exactly)
# Place inst2 exactly on top of inst1
$p set $x1 $y1 [expr $z1 + $t1]
$inst2 setLoc $p

check_3dblox
set category [$top_chip findMarkerCategory "3DBlox"]
set overlapping_category [$category findMarkerCategory "Overlapping chips"]
check "Touching chips no overlap" { expr { $overlapping_category == "NULL" ? 0 : [$overlapping_category getMarkerCount] } } 0
set floating_category [$category findMarkerCategory "Floating chips"]
check "Touching chips not floating" { expr { $floating_category == "NULL" ? 0 : [$floating_category getMarkerCount] } } 0

# 4. Test Vertical Gap (Floating)
# Move inst2 slightly higher
$p set $x1 $y1 [expr $z1 + $t1 + 1]
$inst2 setLoc $p

check_3dblox
set category [$top_chip findMarkerCategory "3DBlox"]
set floating_category [$category findMarkerCategory "Floating chips"]
check "Vertical gap detected as floating" { expr { $floating_category != "NULL" && [$floating_category getMarkerCount] > 0 } } 1

# 5. Test Multiple Floating Sets
# Create another chip far away
set inst3 [odb::dbChipInst_create $top_chip $master1 "inst3"]
$p set [expr $x1 + 10 * $w1] [expr $y1 + 10 * $h1] $z1
$inst3 setLoc $p

check_3dblox
set category [$top_chip findMarkerCategory "3DBlox"]
set floating_category [$category findMarkerCategory "Floating chips"]
check "Multiple floating sets detected" { expr { $floating_category != "NULL" && [$floating_category getMarkerCount] >= 2 } } 1

exit_summary
Loading