Final (I hope) correction to netgen for handling signal wraparound
for buses applied to instance arrayes.
This commit is contained in:
parent
cf9dedb2f7
commit
5ea7916ff1
|
|
@ -1910,27 +1910,35 @@ nextinst:
|
||||||
else {
|
else {
|
||||||
// Instance must be an array
|
// Instance must be an array
|
||||||
char netname[128];
|
char netname[128];
|
||||||
int slice, portlen;
|
int slice, portlen, siglen;
|
||||||
|
|
||||||
/* Get the array size of the port for bit slicing */
|
/* Get the array size of the port for bit slicing */
|
||||||
portlen = (scan->width < 0) ? 1 : scan->width;
|
portlen = (scan->width < 0) ? 1 : scan->width;
|
||||||
|
|
||||||
if (wb.start >= wb.end && arraystart >= arrayend)
|
/* Get the full array size of the connecting bus */
|
||||||
slice = wb.start - (arraystart - i) * portlen;
|
GetBus(scanroot, &wb2);
|
||||||
else if (wb.start < wb.end && arraystart > arrayend)
|
siglen = wb2.start - wb2.end;
|
||||||
slice = wb.start + (arraystart - i) * portlen;
|
if (siglen < 0) siglen = -siglen;
|
||||||
else if (wb.start > wb.end && arraystart < arrayend)
|
siglen++;
|
||||||
slice = wb.start - (arraystart + i) * portlen;
|
|
||||||
else // (wb.start < wb.end && arraystart < arrayend)
|
|
||||||
slice = wb.start + (arraystart + i) * portlen;
|
|
||||||
|
|
||||||
if (wb.start < wb.end) {
|
// If signal array is smaller than the portlength *
|
||||||
while (slice < wb.start) slice += portlen;
|
// length of instance array, then the signal wraps.
|
||||||
while (slice > wb.end) slice -= portlen;
|
|
||||||
|
if (wb2.start >= wb2.end && arraystart >= arrayend) {
|
||||||
|
slice = wb.start - (arraystart - i) * portlen;
|
||||||
|
while (slice < wb2.end) slice += siglen;
|
||||||
}
|
}
|
||||||
else {
|
else if (wb2.start < wb2.end && arraystart > arrayend) {
|
||||||
while (slice > wb.start) slice -= portlen;
|
slice = wb.start + (arraystart - i) * portlen;
|
||||||
while (slice < wb.end) slice += portlen;
|
while (slice > wb2.end) slice -= siglen;
|
||||||
|
}
|
||||||
|
else if (wb2.start > wb2.end && arraystart < arrayend) {
|
||||||
|
slice = wb.start - (arraystart + i) * portlen;
|
||||||
|
while (slice < wb2.end) slice += siglen;
|
||||||
|
}
|
||||||
|
else { // (wb2.start < wb2.end && arraystart < arrayend)
|
||||||
|
slice = wb.start + (arraystart + i) * portlen;
|
||||||
|
while (slice > wb2.end) slice -= siglen;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(netname, "%s[%d]", scanroot, slice);
|
sprintf(netname, "%s[%d]", scanroot, slice);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue