|
| 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