45 printf(
"QCLN-10 : \tbin-based density correction\n");
60 int moveableCells = 0;
61 float yBinArea = 0, yCumArea = 0;
62 int yBinStart = 0, yBinCount = 0;
63 int xBinCount, xBinStart;
64 float xBinArea, xCumArea;
67 float curOldEdge, curNewEdge;
79 allCells[moveableCells++] = cell;
90 for(c=0; c<moveableCells; c++) {
97 if (yCumArea >= totalArea*(y+1)/numBins && yBinArea > 0) {
102 printf(
"y-bin %d count=%d area=%f\n",y,yBinCount, yBinArea);
106 xBinCount = 0, xBinStart = 0;
107 xBinArea = 0, xCumArea = 0;
112 for(c2=0; c2<yBinCount; c2++) {
113 xCell = binCells[c2];
117 curOldEdge = xCell->
m_x;
119 printf(
"%.3f ", xCell->
m_x);
122 if (xCumArea >= yBinArea*(x+1)/numBins && xBinArea > 0) {
127 if ((curNewEdge-curOldEdge)>maxMovement) curNewEdge = curOldEdge + maxMovement;
128 if ((curOldEdge-curNewEdge)>maxMovement) curNewEdge = curOldEdge - maxMovement;
131 printf(
"->\tx-bin %d count=%d area=%f (%f,%f)->(%f,%f)\n",x, xBinCount, xBinArea,
132 curOldEdge, lastOldEdge, curNewEdge, lastNewEdge);
135 stretch = (curNewEdge-lastNewEdge)/(curOldEdge-lastOldEdge);
138 for(c3=xBinStart; c3<xBinStart+xBinCount; c3++) {
139 if (curOldEdge == lastOldEdge)
140 binCells[c3]->
m_x = lastNewEdge+(c3-xBinStart)*(curNewEdge-lastNewEdge);
142 binCells[c3]->
m_x = lastNewEdge+(binCells[c3]->
m_x-lastOldEdge)*stretch;
152 lastOldEdge = curOldEdge;
153 lastNewEdge = curNewEdge;
181 int moveableCells = 0;
182 float xBinArea = 0, xCumArea = 0;
183 int xBinStart = 0, xBinCount = 0;
184 int yBinCount, yBinStart;
185 float yBinArea, yCumArea;
188 float curOldEdge, curNewEdge;
200 allCells[moveableCells++] = cell;
211 for(c=0; c<moveableCells; c++) {
218 if (xCumArea >= totalArea*(x+1)/numBins && xBinArea > 0) {
225 yBinCount = 0, yBinStart = 0;
226 yBinArea = 0, yCumArea = 0;
231 for(c2=0; c2<xBinCount; c2++) {
232 yCell = binCells[c2];
236 curOldEdge = yCell->
m_y;
239 if (yCumArea >= xBinArea*(y+1)/numBins && yBinArea > 0) {
244 if ((curNewEdge-curOldEdge)>maxMovement) curNewEdge = curOldEdge + maxMovement;
245 if ((curOldEdge-curNewEdge)>maxMovement) curNewEdge = curOldEdge - maxMovement;
247 if (curOldEdge == lastOldEdge)
continue;
248 stretch = (curNewEdge-lastNewEdge)/(curOldEdge-lastOldEdge);
251 for(c3=yBinStart; c3<yBinStart+yBinCount; c3++) {
252 binCells[c3]->
m_y = lastNewEdge+(binCells[c3]->
m_y-lastOldEdge)*stretch;
262 lastOldEdge = curOldEdge;
263 lastNewEdge = curNewEdge;
int cellSortByX(const void *a, const void *b)
Sorts cells by either position coordinate.
int cellSortByY(const void *a, const void *b)
ABC_NAMESPACE_IMPL_START void spreadDensityX(int numBins, float maxMovement)
ConcreteCell ** g_place_concreteCells
float getCellArea(const ConcreteCell *cell)
void globalFixDensity(int numBins, float maxMovement)
Doesn't deal well with fixed cells in the core area.
#define ABC_NAMESPACE_IMPL_END
#define ABC_NAMESPACE_IMPL_START
void spreadDensityY(int numBins, float maxMovement)
ABC_NAMESPACE_IMPL_START int g_place_numCells