Skip to content

Commit 713bdb8

Browse files
committed
[tapcell] Update check for cells
1 parent 372786f commit 713bdb8

File tree

1 file changed

+54
-49
lines changed

1 file changed

+54
-49
lines changed

src/tapcell/src/tapcell.tcl

Lines changed: 54 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ proc tapcell { args } {
490490
}
491491

492492
set end_master [$db findMaster $endcap_master]
493+
if { $end_master == "NULL" } {
494+
ord::error "\[ERROR\] Master $endcap_master not found"
495+
}
493496
set end_width [$end_master getWidth]
494497
set min_row_width [expr 2*$end_width]
495498

@@ -565,8 +568,8 @@ proc tapcell { args } {
565568
set site_x [[$row getSite] getWidth]
566569
set endcapwidth [expr $endcap_cpp*$site_x]
567570

568-
if { ![string match [$master getConstName] $endcap_master] } {
569-
puts "\[ERROR\] Master $endcap_master not found"
571+
if { $master == "NULL" } {
572+
ord::error "\[ERROR\] Master $endcap_master not found"
570573
}
571574

572575
set row_name [$row getName]
@@ -577,30 +580,30 @@ proc tapcell { args } {
577580

578581
if {$no_cell_at_top_bottom == true} {
579582
if {$top_bottom == 1} {
580-
if {[string match "MX" $ori]} {
583+
if { $ori == "MX" } {
581584
set master [$db findMaster $cnrcap_nwin_master]
582585

583-
if { ![string match [$master getConstName] $cnrcap_nwin_master] } {
586+
if { $master == "NULL" } {
584587
ord::error "\[ERROR\] Master $cnrcap_nwin_master not found"
585588
}
586589
} else {
587590
set master [$db findMaster $cnrcap_nwout_master]
588591

589-
if { ![string match [$master getConstName] $cnrcap_nwout_master] } {
592+
if { $master == "NULL" } {
590593
ord::error "\[ERROR\] Master $cnrcap_nwout_master not found"
591594
}
592595
}
593596
} elseif {$top_bottom == -1} {
594-
if {[string match "R0" $ori]} {
597+
if { $ori == "R0" } {
595598
set master [$db findMaster $cnrcap_nwin_master]
596599

597-
if { ![string match [$master getConstName] $cnrcap_nwin_master] } {
600+
if { $master == "NULL" } {
598601
ord::error "\[ERROR\] Master $cnrcap_nwin_master not found"
599602
}
600603
} else {
601604
set master [$db findMaster $cnrcap_nwout_master]
602605

603-
if { ![string match [$master getConstName] $cnrcap_nwout_master] } {
606+
if { $master == "NULL" } {
604607
ord::error "\[ERROR\] Master $cnrcap_nwout_master not found"
605608
}
606609
}
@@ -631,13 +634,13 @@ proc tapcell { args } {
631634
set blocked_region [tapcell::in_blocked_region $llx $row $blockages $halo_x $halo_y [$master getWidth] $endcapwidth]
632635
if {$add_boundary_cell == true && $blocked_region == true} {
633636
if {[tapcell::right_above_below_macros $blockages $row $halo_x $halo_y] == 1} {
634-
if {[string match "MX" $ori]} {
637+
if { $ori == "MX" } {
635638
set master [$db findMaster $cnrcap_nwin_master]
636639
} else {
637640
set master [$db findMaster $cnrcap_nwout_master]
638641
}
639642
} else {
640-
if {[string match "R0" $ori]} {
643+
if { $ori == "R0" } {
641644
set master [$db findMaster $cnrcap_nwin_master]
642645
} else {
643646
set master [$db findMaster $cnrcap_nwout_master]
@@ -658,13 +661,13 @@ proc tapcell { args } {
658661
set blocked_region [tapcell::in_blocked_region $loc_2_x $row $blockages $halo_x $halo_y [$master getWidth] $endcapwidth]
659662
if {$add_boundary_cell == true && $blocked_region == true} {
660663
if {[tapcell::right_above_below_macros $blockages $row $halo_x $halo_y] == 1} {
661-
if {[string match "MX" $ori]} {
664+
if { $ori == "MX" } {
662665
set master [$db findMaster $cnrcap_nwin_master]
663666
} else {
664667
set master [$db findMaster $cnrcap_nwout_master]
665668
}
666669
} else {
667-
if {[string match "R0" $ori]} {
670+
if { $ori == "R0" } {
668671
set master [$db findMaster $cnrcap_nwin_master]
669672
} else {
670673
set master [$db findMaster $cnrcap_nwout_master]
@@ -680,10 +683,10 @@ proc tapcell { args } {
680683
set inst2_name "PHY_${cnt}"
681684
set inst2 [odb::dbInst_create $block $master $inst2_name]
682685
set right_ori $ori
683-
if {[string match "MX" $ori]} {
686+
if { $ori == "MX" } {
684687
set right_ori "R180"
685688
} else {
686-
if {[string match "R0" $ori]} {
689+
if { $ori == "R0"} {
687690
set right_ori "MY"
688691
}
689692
}
@@ -742,47 +745,49 @@ proc tapcell { args } {
742745
set endcapwidth [expr $endcap_cpp*$site_x]
743746
for {set x [expr $llx+$offset]} {$x < [expr $urx-$endcap_cpp*$site_x]} {set x [expr $x+$pitch]} {
744747
set master [$db findMaster $tapcell_master]
748+
if { $master == "NULL" } {
749+
ord::error "\[ERROR\] Master $tapcell_master not found"
750+
}
751+
745752
set inst_name "PHY_${cnt}"
746753
set tap_width [$master getWidth]
747754
set tap_urx [expr $x + $tap_width]
748755
set end_llx [expr $urx - $endcap_width]
749756

750-
if { [string match [$master getConstName] $tapcell_master] } {
751-
if {$add_boundary_cell == true} {
752-
set blocked_region false
753-
set blocked_region [tapcell::in_blocked_region $x $row $blockages $halo_x $halo_y [$master getWidth] $endcapwidth]
754-
if {$blocked_region == true} {
755-
continue
756-
}
757+
if {$add_boundary_cell == true} {
758+
set blocked_region false
759+
set blocked_region [tapcell::in_blocked_region $x $row $blockages $halo_x $halo_y [$master getWidth] $endcapwidth]
760+
if {$blocked_region == true} {
761+
continue
757762
}
763+
}
758764

759-
set x_tmp [expr {ceil (1.0*$x/$site_x)*$site_x}]
760-
set row_orig_fix [expr { $llx % $site_x }]
761-
set x [expr { int($x_tmp + $row_orig_fix) }]
762-
set x_end [expr $x + $site_x]
765+
set x_tmp [expr {ceil (1.0*$x/$site_x)*$site_x}]
766+
set row_orig_fix [expr { $llx % $site_x }]
767+
set x [expr { int($x_tmp + $row_orig_fix) }]
768+
set x_end [expr $x + $site_x]
763769

764-
if {($x != $min_x) && ($x_end != $max_x)} {
765-
if { $tap_urx > $end_llx } {
766-
puts "\[WARNING\] Tapcell at position ($x, $lly) will cause overlap with endcap. Skipping..."
767-
continue
768-
}
770+
if {($x != $min_x) && ($x_end != $max_x)} {
771+
if { $tap_urx > $end_llx } {
772+
puts "\[WARNING\] Tapcell at position ($x, $lly) will cause overlap with endcap. Skipping..."
773+
continue
774+
}
769775

770-
set min_dist [expr 2 * $site_x]
771-
set max_tap_urx [expr $end_llx - $min_dist]
776+
set min_dist [expr 2 * $site_x]
777+
set max_tap_urx [expr $end_llx - $min_dist]
772778

773-
while { $tap_urx > $max_tap_urx } {
774-
set tap_urx [expr $tap_urx - $site_x]
775-
set x [expr $x - $site_x]
776-
}
777-
set inst [odb::dbInst_create $block $master $inst_name]
778-
$inst setOrient $ori
779+
while { $tap_urx > $max_tap_urx } {
780+
set tap_urx [expr $tap_urx - $site_x]
781+
set x [expr $x - $site_x]
782+
}
783+
set inst [odb::dbInst_create $block $master $inst_name]
784+
$inst setOrient $ori
779785

780-
$inst setLocation $x $lly
781-
$inst setPlacementStatus LOCKED
786+
$inst setLocation $x $lly
787+
$inst setPlacementStatus LOCKED
782788

783-
incr cnt
784-
incr tapcell_count
785-
}
789+
incr cnt
790+
incr tapcell_count
786791
}
787792
}
788793
}
@@ -817,7 +822,7 @@ proc tapcell { args } {
817822

818823
if {$topbottom_chk == 1} {
819824
# top
820-
if {[string match "MX" $ori]} {
825+
if { $ori == "MX" } {
821826
set master [$db findMaster $tap_nwintie_master]
822827
set tb2_master [$db findMaster $tap_nwin2_master]
823828
set tb3_master [$db findMaster $tap_nwin3_master]
@@ -828,7 +833,7 @@ proc tapcell { args } {
828833
}
829834
} elseif {$topbottom_chk == -1} {
830835
# bottom
831-
if {[string match "R0" $ori]} {
836+
if { $ori == "R0" } {
832837
set master [$db findMaster $tap_nwintie_master]
833838
set tb2_master [$db findMaster $tap_nwin2_master]
834839
set tb3_master [$db findMaster $tap_nwin3_master]
@@ -935,7 +940,7 @@ proc tapcell { args } {
935940

936941
if {($row_lly >= $blockage_ury)} {
937942
# If row is at top of macro
938-
if {[string match "R0" $ori]} {
943+
if { $ori == "R0" } {
939944
set incnr_master [$db findMaster $incnrcap_nwin_master]
940945
set tb2_master [$db findMaster $tap_nwin2_master]
941946
set tb3_master [$db findMaster $tap_nwin3_master]
@@ -966,7 +971,7 @@ proc tapcell { args } {
966971
} else {
967972
# Insert cell at northwest corner
968973
set inst1 [odb::dbInst_create $block $incnr_master $inst1_name]
969-
if {[string match "R0" $ori]} {
974+
if { $ori == "R0" } {
970975
set cell_orient "MY"
971976
} else {
972977
set cell_orient "R180"
@@ -1043,7 +1048,7 @@ proc tapcell { args } {
10431048
}
10441049
} elseif {($row_ury <= $blockage_lly)} {
10451050
# If row is at bottom of macro
1046-
if {[string match "MX" $ori]} {
1051+
if { $ori == "MX" } {
10471052
set incnr_master [$db findMaster $incnrcap_nwin_master]
10481053
set tb2_master [$db findMaster $tap_nwin2_master]
10491054
set tb3_master [$db findMaster $tap_nwin3_master]
@@ -1074,7 +1079,7 @@ proc tapcell { args } {
10741079
} else {
10751080
# Insert cell at southwest corner
10761081
set inst1 [odb::dbInst_create $block $incnr_master $inst1_name]
1077-
if {[string match "R0" $ori]} {
1082+
if { $ori == "R0"} {
10781083
set cell_orient "MY"
10791084
} else {
10801085
set cell_orient "R180"

0 commit comments

Comments
 (0)