Skip to content

Commit

Permalink
optimized getCSC
Browse files Browse the repository at this point in the history
  • Loading branch information
mmicko committed Nov 28, 2024
1 parent ea478ee commit d2d39a6
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions himbaechel/uarch/ng-ultra/pack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2379,32 +2379,13 @@ void NgUltraImpl::postPlace()

BelId NgUltraPacker::getCSC(Loc l, int row)
{
BelId bel = ctx->getBelByLocation(Loc(l.x+1,l.y+2,0));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==1)) return bel;
bel = ctx->getBelByLocation(Loc(l.x+1,l.y+2,15));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==2)) return bel;
bel = ctx->getBelByLocation(Loc(l.x+1,l.y+2,16));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==3)) return bel;
bel = ctx->getBelByLocation(Loc(l.x+1,l.y+2,31));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==4)) return bel;

bel = ctx->getBelByLocation(Loc(l.x+2,l.y+3,0));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==1)) return bel;
bel = ctx->getBelByLocation(Loc(l.x+2,l.y+3,15));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==2)) return bel;
bel = ctx->getBelByLocation(Loc(l.x+2,l.y+3,16));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==3)) return bel;
bel = ctx->getBelByLocation(Loc(l.x+2,l.y+3,31));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==4)) return bel;

bel = ctx->getBelByLocation(Loc(l.x+3,l.y+2,0));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==1)) return bel;
bel = ctx->getBelByLocation(Loc(l.x+3,l.y+2,15));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==2)) return bel;
bel = ctx->getBelByLocation(Loc(l.x+3,l.y+2,16));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==3)) return bel;
bel = ctx->getBelByLocation(Loc(l.x+3,l.y+2,31));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==4)) return bel;
const int z_loc[] = { 0, 15, 16, 31 };
for(int j=0;j<3;j++) {
for(int i=0;i<4;i++) {
BelId bel = ctx->getBelByLocation(Loc(l.x+j+1,l.y+j%2+2,z_loc[i]));
if (!ctx->getBoundBelCell(bel) && (row==0 || row==(i+1))) return bel;
}
}
return BelId();
}

Expand Down

0 comments on commit d2d39a6

Please sign in to comment.