mirror of
https://github.com/Architeuthis-Flux/Jumperless.git
synced 2024-11-14 10:37:37 +01:00
fixed an edge case routing bug
This commit is contained in:
parent
278367db0f
commit
505569c5aa
@ -740,7 +740,6 @@ void resolveAltPaths(void)
|
||||
if (path[i].Lchip == true)
|
||||
{
|
||||
|
||||
|
||||
if (ch[CHIP_L].yStatus[bb] == -1 || ch[CHIP_L].yStatus[bb] == path[i].net) /////////
|
||||
{
|
||||
|
||||
@ -750,8 +749,6 @@ void resolveAltPaths(void)
|
||||
int xMapL0c1 = xMapForChipLane0(bb, path[i].chip[0]);
|
||||
int xMapL1c1 = xMapForChipLane1(bb, path[i].chip[0]);
|
||||
|
||||
|
||||
|
||||
int freeLane = -1;
|
||||
|
||||
if ((xMapL1c0 != -1) && ch[path[i].chip[0]].xStatus[xMapL1c0] == path[i].net) // check if lane 1 shares a net first so it should prefer sharing lanes
|
||||
@ -1468,34 +1465,143 @@ void resolveAltPaths(void)
|
||||
}
|
||||
|
||||
if (ch[CHIP_L].xStatus[whichADC + 2] != -1 && ch[CHIP_L].xStatus[whichADC + 2] != path[i].net)
|
||||
// if (true)
|
||||
{
|
||||
Serial.print("\n\rCouldn't find a path for ");
|
||||
printNodeOrName(path[i].node1);
|
||||
Serial.print(" to ");
|
||||
printNodeOrName(path[i].node2);
|
||||
Serial.println(" ");
|
||||
// Serial.print("\n\rCouldn't find a path for ");
|
||||
// printNodeOrName(path[i].node1);
|
||||
// Serial.print(" to ");
|
||||
// printNodeOrName(path[i].node2);
|
||||
// Serial.println(" \n\n\n\n\n\r");
|
||||
|
||||
path[i].skip = true;
|
||||
path[i].chip[0] = -1;
|
||||
path[i].chip[1] = -1;
|
||||
path[i].chip[2] = -1;
|
||||
path[i].chip[3] = -1;
|
||||
// path[i].skip = true;
|
||||
/// path[i].chip[0] = -1;
|
||||
// path[i].chip[1] = -1;
|
||||
// path[i].chip[2] = -1;
|
||||
// path[i].chip[3] = -1;
|
||||
// numberOfPaths--;
|
||||
// break;
|
||||
// continue;
|
||||
// int foundHop = 0;
|
||||
for (int hopBB = 0; hopBB < 8; hopBB++)
|
||||
{
|
||||
if (debugNTCC3)
|
||||
{
|
||||
Serial.print("hopBB: ");
|
||||
Serial.println(hopBB);
|
||||
Serial.print("chip[0]: ");
|
||||
Serial.println(path[i].chip[0]);
|
||||
|
||||
Serial.print("xStatus: ");
|
||||
|
||||
Serial.println(ch[hopBB].xStatus[xMapForChipLane0(hopBB, path[i].chip[whichIsSF])]);
|
||||
Serial.print("yStatus: ");
|
||||
Serial.println(ch[hopBB].yStatus[0]);
|
||||
|
||||
Serial.println();
|
||||
}
|
||||
if (ch[hopBB].xStatus[xMapForChipLane0(hopBB, path[i].chip[whichIsSF])] == -1 && ch[hopBB].yStatus[0] == -1)
|
||||
{
|
||||
if (debugNTCC3)
|
||||
{
|
||||
Serial.print("found: ");
|
||||
Serial.println(hopBB);
|
||||
}
|
||||
path[i].chip[2] = hopBB;
|
||||
|
||||
path[i].x[whichIsSF] = xMapForNode(path[i].node1, path[i].chip[whichIsSF]);
|
||||
path[i].y[whichIsSF] = hopBB;
|
||||
|
||||
path[i].x[whichIsL] = xMapForNode(path[i].node2, path[i].chip[whichIsL]);
|
||||
path[i].y[whichIsL] = hopBB;
|
||||
|
||||
|
||||
path[i].x[2] = xMapForChipLane0(hopBB, path[i].chip[whichIsSF]);
|
||||
|
||||
path[i].y[2] = 0;
|
||||
|
||||
path[i].altPathNeeded = false;
|
||||
|
||||
|
||||
ch[hopBB].xStatus[xMapForChipLane0(hopBB, path[i].chip[whichIsSF])] = path[i].net;
|
||||
ch[hopBB].yStatus[0] = path[i].net;
|
||||
ch[hopBB].xStatus[xMapForChipLane0(hopBB, path[i].chip[whichIsL])] = path[i].net;
|
||||
ch[CHIP_L].yStatus[hopBB] = path[i].net;
|
||||
|
||||
if (whichIsL == 0)
|
||||
{
|
||||
ch[CHIP_L].xStatus[xMapForNode( path[i].node1,CHIP_L)] = path[i].net;
|
||||
ch[sfChip2].xStatus[xMapForNode( path[i].node2, sfChip2)] = path[i].net;
|
||||
if (debugNTCC2)
|
||||
{
|
||||
Serial.print("xMapForNode(CHIP_L, ");
|
||||
Serial.print(path[i].node1);
|
||||
Serial.print("): ");
|
||||
|
||||
Serial.println(xMapForNode( path[i].node1, CHIP_L));
|
||||
Serial.print("xMapForNode(sfChip2, path[i].node2): ");
|
||||
Serial.println(xMapForNode( path[i].node2,sfChip2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ch[CHIP_L].xStatus[xMapForNode( path[i].node2,CHIP_L)] = path[i].net;
|
||||
ch[sfChip1].xStatus[xMapForNode( path[i].node1,sfChip1)] = path[i].net;
|
||||
|
||||
if (debugNTCC2)
|
||||
{
|
||||
Serial.print("xMapForNode(CHIP_L, ");
|
||||
Serial.print(path[i].node2);
|
||||
Serial.print("): ");
|
||||
Serial.println(xMapForNode( path[i].node2,CHIP_L));
|
||||
|
||||
|
||||
Serial.print("xMapForNode(");
|
||||
Serial.print(sfChip1);
|
||||
Serial.print(", ");
|
||||
Serial.print(path[i].node1);
|
||||
Serial.print("): ");
|
||||
|
||||
Serial.println(xMapForNode( path[i].node1,sfChip1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if (whichIsL == 1)
|
||||
// {
|
||||
// ch[sfChip1].xStatus[xMapForNode(sfChip1, path[i].node1)] = path[i].net;
|
||||
// ch[CHIP_L].xStatus[xMapForNode(CHIP_L, path[i].node2)] = path[i].net;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ch[sfChip1].xStatus[xMapForNode(sfChip1, path[i].node2)] = path[i].net;
|
||||
// ch[CHIP_L].xStatus[xMapForNode(CHIP_L, path[i].node1)] = path[i].net;
|
||||
// }
|
||||
|
||||
|
||||
// foundHop = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
path[i].x[whichIsL] = whichADC + 2;
|
||||
ch[CHIP_L].xStatus[whichADC + 2] = path[i].net;
|
||||
path[i].y[whichIsL] = -2;
|
||||
|
||||
if (whichIsSF == 0)
|
||||
{
|
||||
path[i].x[whichIsSF] = xMapForNode(ADC0_5V + whichADC, sfChip1);
|
||||
ch[sfChip1].xStatus[path[i].x[whichIsSF]] = path[i].net;
|
||||
// path[i].x[whichIsL] = xMapForNode(ADC0_5V + whichADC, sfChip2);
|
||||
}
|
||||
else
|
||||
{
|
||||
path[i].x[whichIsSF] = xMapForNode(ADC0_5V + whichADC, sfChip2);
|
||||
ch[sfChip2].xStatus[path[i].x[whichIsSF]] = path[i].net;
|
||||
// path[i].x[whichIsL] = xMapForNode(ADC0_5V + whichADC, sfChip1);
|
||||
}
|
||||
|
||||
@ -1530,8 +1636,6 @@ void resolveAltPaths(void)
|
||||
ch[sfChip2].xStatus[path[i].x[whichIsSF]] = path[i].net;
|
||||
ch[sfChip2].xStatus[xMapForNode(path[i].node2, sfChip2)] = path[i].net;
|
||||
ch[sfChip1].xStatus[xMapForNode(path[i].node1, sfChip1)] = path[i].net;
|
||||
|
||||
|
||||
}
|
||||
else // l is the second chip
|
||||
{
|
||||
@ -1540,8 +1644,6 @@ void resolveAltPaths(void)
|
||||
path[i].chip[3] = sfChip1;
|
||||
path[i].chip[2] = sfChip2;
|
||||
|
||||
|
||||
|
||||
path[i].y[2] = -2;
|
||||
path[i].y[3] = -2;
|
||||
|
||||
@ -1551,9 +1653,9 @@ void resolveAltPaths(void)
|
||||
ch[sfChip1].xStatus[path[i].x[whichIsSF]] = path[i].net;
|
||||
ch[sfChip1].xStatus[xMapForNode(path[i].node1, sfChip1)] = path[i].net;
|
||||
ch[sfChip2].xStatus[xMapForNode(path[i].node2, sfChip2)] = path[i].net;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// foundPath = 1;
|
||||
path[i].altPathNeeded = false;
|
||||
// path[i].sameChip = true;
|
||||
@ -1561,19 +1663,34 @@ void resolveAltPaths(void)
|
||||
// resolveUncommittedHops();
|
||||
for (int ySearch = 0; ySearch < 8; ySearch++)
|
||||
{
|
||||
if ( ch[sfChip1].yStatus[ySearch] == -1 || ch[sfChip1].yStatus[ySearch] == path[i].net)
|
||||
if (ch[sfChip1].yStatus[ySearch] == -1 || ch[sfChip1].yStatus[ySearch] == path[i].net) //&& ch[ySearch].xStatus[xMapForChipLane0(ySearch, sfChip1)] == -1 || ch[ySearch].xStatus[xMapForChipLane0(ySearch, sfChip1)] == path[i].net)
|
||||
{
|
||||
ch[sfChip1].yStatus[ySearch] = path[i].net;
|
||||
if (debugNTCC3)
|
||||
{
|
||||
Serial.print("ySearch: ");
|
||||
Serial.println(ySearch);
|
||||
Serial.print("sfChip1: ");
|
||||
Serial.println(sfChip1);
|
||||
Serial.print("xMapForChipLane0(ySearch, sfChip1): ");
|
||||
Serial.println(xMapForChipLane0(ySearch, sfChip1));
|
||||
Serial.print("ch[ySearch].yStatus[xMapForChipLane0(ySearch, sfChip1)]: ");
|
||||
Serial.println(ch[ySearch].xStatus[xMapForChipLane0(ySearch, sfChip1)]);
|
||||
}
|
||||
//
|
||||
|
||||
if (whichIsL == 0)
|
||||
{
|
||||
path[i].y[1] = ySearch;
|
||||
path[i].y[2] = ySearch;
|
||||
ch[ySearch].yStatus[0] = path[i].net;
|
||||
ch[sfChip1].yStatus[ySearch] = path[i].net;
|
||||
}
|
||||
else
|
||||
{
|
||||
path[i].y[0] = ySearch;
|
||||
path[i].y[3] = ySearch;
|
||||
ch[ySearch].xStatus[xMapForChipLane0(ySearch, sfChip1)] = path[i].net;
|
||||
ch[sfChip1].yStatus[ySearch] = path[i].net;
|
||||
}
|
||||
|
||||
path[i].y[whichIsL] = ySearch;
|
||||
@ -1584,19 +1701,25 @@ void resolveAltPaths(void)
|
||||
}
|
||||
for (int ySearch = 0; ySearch < 8; ySearch++)
|
||||
{
|
||||
if ( ch[sfChip2].yStatus[ySearch] == -1 || ch[sfChip2].yStatus[ySearch] == path[i].net)
|
||||
if (ch[sfChip2].yStatus[ySearch] == -1 || ch[sfChip2].yStatus[ySearch] == path[i].net) // && ch[ySearch].xStatus[xMapForChipLane0(ySearch, sfChip2)] == -1 || ch[ySearch].xStatus[xMapForChipLane0(ySearch, sfChip2)] == path[i].net)
|
||||
{
|
||||
ch[ySearch].xStatus[xMapForChipLane0(ySearch, sfChip2)] = path[i].net;
|
||||
ch[sfChip2].yStatus[ySearch] = path[i].net;
|
||||
// ch[ySearch].yStatus[0] = path[i].net;
|
||||
|
||||
if (whichIsL == 0)
|
||||
{
|
||||
path[i].y[0] = ySearch;
|
||||
path[i].y[3] = ySearch;
|
||||
ch[ySearch].xStatus[xMapForChipLane0(ySearch, sfChip2)] = path[i].net;
|
||||
ch[sfChip2].yStatus[ySearch] = path[i].net;
|
||||
}
|
||||
else
|
||||
{
|
||||
path[i].y[1] = ySearch;
|
||||
path[i].y[2] = ySearch;
|
||||
ch[ySearch].yStatus[0] = path[i].net;
|
||||
ch[sfChip2].yStatus[ySearch] = path[i].net;
|
||||
}
|
||||
|
||||
// path[i].y[whichIsSF] = ySearch;
|
||||
@ -1604,7 +1727,7 @@ void resolveAltPaths(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2535,6 +2658,10 @@ void assignPathType(int pathIndex)
|
||||
if ((path[pathIndex].nodeType[0] == NANO && path[pathIndex].nodeType[1] == SF))
|
||||
{
|
||||
path[pathIndex].pathType = NANOtoSF;
|
||||
if (path[pathIndex].chip[0] != path[pathIndex].chip[1])
|
||||
{
|
||||
path[pathIndex].altPathNeeded = true;
|
||||
}
|
||||
}
|
||||
else if ((path[pathIndex].nodeType[0] == SF && path[pathIndex].nodeType[1] == SF))
|
||||
{
|
||||
@ -2544,6 +2671,12 @@ void assignPathType(int pathIndex)
|
||||
{
|
||||
swapNodes(pathIndex);
|
||||
path[pathIndex].pathType = NANOtoSF;
|
||||
if (path[pathIndex].chip[0] != path[pathIndex].chip[1])
|
||||
{
|
||||
path[pathIndex].altPathNeeded = true;
|
||||
}
|
||||
|
||||
// path[pathIndex].altPathNeeded = true;
|
||||
}
|
||||
else if ((path[pathIndex].nodeType[0] == BB && path[pathIndex].nodeType[1] == SF))
|
||||
{
|
||||
|
@ -339,7 +339,7 @@ void chooseShownReadings(void)
|
||||
void showMeasurements(int samples)
|
||||
{
|
||||
|
||||
while (Serial.available() == 0)
|
||||
while (Serial.available() == 0 && Serial1.available() == 0)
|
||||
{
|
||||
// CSI
|
||||
// Serial.write("\x1B\x5B 2K");
|
||||
@ -444,8 +444,14 @@ void showMeasurements(int samples)
|
||||
// Serial.print("ADC3: ");
|
||||
// Serial.print(adc3ReadingUnscaled);
|
||||
// Serial.print("V\n\n\r");
|
||||
|
||||
if (Serial.available() == 0 && Serial1.available() == 0)
|
||||
{
|
||||
delay(350);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int readAdc(int channel, int samples)
|
||||
|
@ -140,6 +140,8 @@ dontshowmenu:
|
||||
connectFromArduino = '\0';
|
||||
|
||||
while (Serial.available() == 0 && connectFromArduino == '\0' )
|
||||
;
|
||||
|
||||
{
|
||||
if (showReadings >= 1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user