@@ -625,6 +625,30 @@ RRGSB build_one_tileable_rr_gsb(const DeviceGrid& grids,
625
625
const size_t & layer,
626
626
const vtr::Point <size_t >& gsb_coordinate,
627
627
const bool & perimeter_cb) {
628
+ /* Bounding box for GSB ranges on routing tracks.
629
+ * Note that when perimeter connection blocks are not allowed,
630
+ * - top side routing tracks for any GSB exist on y = [0, H-2)
631
+ * - right side routing tracks for any GSB exist on x = [0, W-2)
632
+ * - bottom side routing tracks for any GSB exist on y = [1, H-1)
633
+ * - left side routing tracks for any GSB exist on x = [1, W-1)
634
+ * Note that when perimeter connection blocks are allowed,
635
+ * - top side routing tracks for any GSB exist on y = [0, H-1)
636
+ * - right side routing tracks for any GSB exist on x = [0, W-1)
637
+ * - bottom side routing tracks for any GSB exist on y = [0, H)
638
+ * - left side routing tracks for any GSB exist on x = [0, W)
639
+ */
640
+ size_t std::map<e_side, vtr:Point <size_t >> track_range;
641
+ track_range[TOP] = vtr:Point <size_t >(0 , grids.height () - 2 );
642
+ track_range[RIGHT] = vtr:Point <size_t >(0 , grids.width () - 2 );
643
+ track_range[BOTTOM] = vtr:Point <size_t >(1 , grids.height () - 2 );
644
+ track_range[LEFT] = vtr:Point <size_t >(1 , grids.width () - 2 );
645
+ if (perimeter_cb) {
646
+ track_range[TOP] = vtr:Point <size_t >(0 , grids.height () - 1 );
647
+ track_range[RIGHT] = vtr:Point <size_t >(0 , grids.width () - 1 );
648
+ track_range[BOTTOM] = vtr:Point <size_t >(0 , grids.height ());
649
+ track_range[LEFT] = vtr:Point <size_t >(0 , grids.width ());
650
+ }
651
+
628
652
/* Create an object to return */
629
653
RRGSB rr_gsb;
630
654
@@ -659,8 +683,8 @@ RRGSB build_one_tileable_rr_gsb(const DeviceGrid& grids,
659
683
660
684
switch (side) {
661
685
case TOP: /* TOP = 0 */
662
- /* For the bording , we should take special care */
663
- if (gsb_coordinate.y () == grids. height () - 1 ) {
686
+ /* For the border , we should take special care. The top column (H-1) does not have any top side routing channel. Any lower column may have (<= H-2) */
687
+ if (track_range[side]. x () > gsb_coordinate.y () || gsb_coordinate. y () >= track_range[side]. y () ) {
664
688
rr_gsb.clear_one_side (side_manager.get_side ());
665
689
break ;
666
690
}
@@ -689,8 +713,8 @@ RRGSB build_one_tileable_rr_gsb(const DeviceGrid& grids,
689
713
690
714
break ;
691
715
case RIGHT: /* RIGHT = 1 */
692
- /* For the bording , we should take special care */
693
- if (gsb_coordinate.x () == grids. width () - 1 ) {
716
+ /* For the border , we should take special care. The rightmost column (W-1) does not have any right side routing channel. If perimeter connection block is not enabled, even the last second rightmost column (W-2) does not have any right side routing channel */
717
+ if (track_range[side]. x () > gsb_coordinate.x () || gsb_coordinate. x () >= track_range[side]. y () ) {
694
718
rr_gsb.clear_one_side (side_manager.get_side ());
695
719
break ;
696
720
}
@@ -719,8 +743,8 @@ RRGSB build_one_tileable_rr_gsb(const DeviceGrid& grids,
719
743
OPIN, opin_grid_side[1 ]);
720
744
break ;
721
745
case BOTTOM: /* BOTTOM = 2*/
722
- /* For the bording , we should take special care */
723
- if (!perimeter_cb && gsb_coordinate.y () == 0 ) {
746
+ /* For the border , we should take special care */
747
+ if (track_range[side]. x () > gsb_coordinate.y () || gsb_coordinate. y () >= track_range[side]. y () ) {
724
748
rr_gsb.clear_one_side (side_manager.get_side ());
725
749
break ;
726
750
}
@@ -749,8 +773,8 @@ RRGSB build_one_tileable_rr_gsb(const DeviceGrid& grids,
749
773
OPIN, opin_grid_side[1 ]);
750
774
break ;
751
775
case LEFT: /* LEFT = 3 */
752
- /* For the bording , we should take special care */
753
- if (!perimeter_cb && gsb_coordinate.x () == 0 ) {
776
+ /* For the border , we should take special care */
777
+ if (track_range[side]. x () > gsb_coordinate.x () || gsb_coordinate. x () >= track_range[side]. y () ) {
754
778
rr_gsb.clear_one_side (side_manager.get_side ());
755
779
break ;
756
780
}
@@ -846,7 +870,7 @@ RRGSB build_one_tileable_rr_gsb(const DeviceGrid& grids,
846
870
* - The concept of top/bottom side of connection block in GSB domain:
847
871
*
848
872
* ---------------+ +---------------------- ... ---------------------+ +----------------
849
- * Grid[x][y+1] |->| Y- Connection Block Y- Connection Block |<-| Grid[x+1][y+1 ]
873
+ * Grid[x][y] |->| Y- Connection Block Y- Connection Block |<-| Grid[x+1][y]
850
874
* RIGHT side | | LEFT side ... RIGHT side | | LEFT side
851
875
* --------------+ +---------------------- ... ---------------------+ +----------------
852
876
*
@@ -873,7 +897,7 @@ RRGSB build_one_tileable_rr_gsb(const DeviceGrid& grids,
873
897
chan_side = TOP;
874
898
/* The input pins of the routing channel come from the left side of Grid[x+1][y+1] */
875
899
ix = rr_gsb.get_sb_x () + 1 ;
876
- iy = rr_gsb.get_sb_y () + 1 ;
900
+ iy = rr_gsb.get_sb_y ();
877
901
ipin_rr_node_grid_side = LEFT;
878
902
break ;
879
903
case BOTTOM:
@@ -889,7 +913,7 @@ RRGSB build_one_tileable_rr_gsb(const DeviceGrid& grids,
889
913
chan_side = TOP;
890
914
/* The input pins of the routing channel come from the right side of Grid[x][y+1] */
891
915
ix = rr_gsb.get_sb_x ();
892
- iy = rr_gsb.get_sb_y () + 1 ;
916
+ iy = rr_gsb.get_sb_y ();
893
917
ipin_rr_node_grid_side = RIGHT;
894
918
break ;
895
919
default :
0 commit comments