@@ -770,6 +770,14 @@ proc tapcell { args } {
770770 puts " \[ WARNING\] Tapcell at position ($x , $lly ) will cause overlap with endcap. Skipping..."
771771 continue
772772 }
773+
774+ set min_dist [expr 2 * $site_x ]
775+ set max_tap_urx [expr $end_llx - $min_dist ]
776+
777+ while { $tap_urx > $max_tap_urx } {
778+ set tap_urx [expr $tap_urx - $site_x ]
779+ set x [expr $x - $site_x ]
780+ }
773781 set inst [odb::dbInst_create $block $master $inst_name ]
774782 $inst setOrient $ori
775783
@@ -812,7 +820,8 @@ proc tapcell { args } {
812820 set tb3_master NULL
813821
814822 if {$topbottom_chk == 1} {
815- if {[string match " MX" $ori ]} {
823+ # top
824+ if {[string match " R0" $ori ]} {
816825 set master [$db findMaster $tap_nwintie_master ]
817826 set tb2_master [$db findMaster $tap_nwin2_master ]
818827 set tb3_master [$db findMaster $tap_nwin3_master ]
@@ -822,7 +831,8 @@ proc tapcell { args } {
822831 set tb3_master [$db findMaster $tap_nwout3_master ]
823832 }
824833 } elseif {$topbottom_chk == -1} {
825- if {[string match " R0" $ori ]} {
834+ # bottom
835+ if {[string match " MX" $ori ]} {
826836 set master [$db findMaster $tap_nwintie_master ]
827837 set tb2_master [$db findMaster $tap_nwin2_master ]
828838 set tb3_master [$db findMaster $tap_nwin3_master ]
@@ -915,7 +925,7 @@ proc tapcell { args } {
915925 set row_urx [[$row getBBox] xMax]
916926 set row_ury [[$row getBBox] yMax]
917927
918- if {$blockage_llx_ < $row_llx } {
928+ if {$blockage_llx_ < $row_llx } {
919929 set blockage_llx $row_llx
920930 } else {
921931 set blockage_llx $blockage_llx_
@@ -929,7 +939,7 @@ proc tapcell { args } {
929939
930940 if {($row_lly >= $blockage_ury )} {
931941 # If row is at top of macro
932- if {[string match " MX " $ori ]} {
942+ if {[string match " R0 " $ori ]} {
933943 set incnr_master [$db findMaster $incnrcap_nwin_master ]
934944 set tb2_master [$db findMaster $tap_nwin2_master ]
935945 set tb3_master [$db findMaster $tap_nwin3_master ]
@@ -941,6 +951,8 @@ proc tapcell { args } {
941951 set tbtie_master [$db findMaster $tap_nwouttie_master ]
942952 }
943953
954+ set cell_orient $ori
955+
944956 # Insert incnr cells
945957 set row1_num_sites [expr {($blockage_llx - $row_llx )/$site_x }]
946958
@@ -956,8 +968,14 @@ proc tapcell { args } {
956968 if {$x_start < $row_llx } {
957969 set x_start $row_llx
958970 } else {
971+ # Insert cell at northwest corner
959972 set inst1 [odb::dbInst_create $block $incnr_master $inst1_name ]
960- $inst1 setOrient $ori
973+ if {[string match " R0" $ori ]} {
974+ set cell_orient " MY"
975+ } else {
976+ set cell_orient " R180"
977+ }
978+ $inst1 setOrient $cell_orient
961979 $inst1 setLocation $x_start $row_lly
962980 $inst1 setPlacementStatus LOCKED
963981
@@ -967,6 +985,7 @@ proc tapcell { args } {
967985
968986 if {(($x_end + $endcapwidth ) < $corebox_urx )} {
969987 if {($x_end + $endcapwidth ) <= $row_urx } {
988+ # Insert cell at northeast corner
970989 set inst2_name " PHY_${cnt} "
971990 set inst2 [odb::dbInst_create $block $incnr_master $inst2_name ]
972991 $inst2 setOrient $ori
@@ -1040,6 +1059,8 @@ proc tapcell { args } {
10401059 set tbtie_master [$db findMaster $tap_nwouttie_master ]
10411060 }
10421061
1062+ set cell_orient $ori
1063+
10431064 # Insert incnr cells
10441065 set row1_num_sites [expr {($blockage_llx - $row_llx )/$site_x }]
10451066
@@ -1055,8 +1076,14 @@ proc tapcell { args } {
10551076 if {$x_start < $row_llx } {
10561077 set x_start $row_llx
10571078 } else {
1079+ # Insert cell at southwest corner
10581080 set inst1 [odb::dbInst_create $block $incnr_master $inst1_name ]
1059- $inst1 setOrient $ori
1081+ if {[string match " R0" $ori ]} {
1082+ set cell_orient " MY"
1083+ } else {
1084+ set cell_orient " R180"
1085+ }
1086+ $inst1 setOrient $cell_orient
10601087 $inst1 setLocation $x_start $row_lly
10611088 $inst1 setPlacementStatus LOCKED
10621089
0 commit comments