IF coaxes.rest#
NIL
AND Sharable[context, coaxes.first, coaxes.rest.first]
THEN {
newAncesters: LIST OF AlpsBool.Expression ← NIL;
We know those 2 wires have a common ancester, we wipe off all the generations between the start and this common ancester (included)
MakeShared:
PROC [ancesters1, ancesters2:
LIST
OF AlpsBool.Expression]
RETURNS [newAncesters:
LIST
OF AlpsBool.Expression ←
NIL] = {
WHILE ancesters1#
NIL
DO
WHILE ancesters2#
NIL
DO
IF ancesters1=ancesters2 THEN RETURN[ancesters2.rest];
ancesters2 ← ancesters2.rest;
ENDLOOP;
ancesters1 ← ancesters1.rest;
ENDLOOP;
};
lastSharable: Coax ← NIL; -- the last Coax (the only one which will result in a Coax after RightRoute). This is necessary, so that every other Coax can take its spin.
firstSpin: BOOL; -- This spin is necessary in case of a dupl
FOR auxCoaxes:
LIST
OF Coax ← coaxes, auxCoaxes.rest
DO
IF auxCoaxes.rest=NIL OR ~Sharable[context, auxCoaxes.first, auxCoaxes.rest.first] THEN {lastSharable ← auxCoaxes.first; EXIT};
ENDLOOP;
newAncesters ← lastSharable.ancesters;
The first one
firstSpin ← Spin[context, coaxes.first, lastSharable];
Add[RightRoute, TILE[[route: TRUE, contactPoly: TRUE, noUpPoly: TRUE, noLeftMetal: ~dupl, spin: firstSpin, leftPin: dupl]]];
newAncesters ← MakeShared[newAncesters, coaxes.first.ancesters];
Output["@", Convert.RopeFromInt[AlpsBool.NbOfCaseXY[context.table, coaxes.first.expr]], "@"];
coaxes ← coaxes.rest;
The intermediate ones
WHILE coaxes#
NIL
AND coaxes.first#lastSharable
DO
Add[RightRoute, TILE[[route: TRUE, contactPoly: TRUE, noLeftMetal: TRUE, spin: Spin[context, coaxes.first, lastSharable], leftPin: FALSE]]];
newAncesters ← MakeShared[newAncesters, coaxes.first.ancesters];
Output["@", Convert.RopeFromInt[AlpsBool.NbOfCaseXY[context.table, coaxes.first.expr]], "@"];
coaxes ← coaxes.rest;
ENDLOOP;
The last one
Add[RightRoute, TILE[[route: TRUE, contactPoly: TRUE, noDownPoly: TRUE, spin: TRUE]]];
IF dupl THEN newCoaxes ← CONS[NEW[CoaxRec ← [expr: coaxes.first.expr, spin: firstSpin, duplLeftInput: FALSE, ancesters: newAncesters]], newCoaxes];
newCoaxes ← CONS[NEW[CoaxRec ← [expr: coaxes.first.expr, spin: coaxes.first.spin, ancesters: newAncesters]], newCoaxes];
} ELSE {
IF dupl
THEN {
Add[RightRoute, TILE[[route: TRUE, contactPoly: TRUE, noUpPoly: TRUE, noRightMetal: TRUE, spin: TRUE, rightPin: FALSE]]];
Add[RightRoute, TILE[[route: TRUE, contactPoly: TRUE, noDownPoly: TRUE, spin: TRUE]]];
newCoaxes ← CONS[NEW[CoaxRec ← [expr: coaxes.first.expr, spin: coaxes.first.spin, duplLeftInput: FALSE, ancesters: coaxes.first.ancesters]], newCoaxes];
} ELSE {
Add[RightRoute, TILE[[route: TRUE, noUpPoly: TRUE, noDownPoly: TRUE]]];
};
newCoaxes ← CONS[coaxes.first, newCoaxes];
};